/* dhiKarm — Day (default) and Night themes. Red / amber / green keep the
   same meaning in both: overdue / reminder / done. */
:root {
  --theme: #4338ca; --theme2: #6366f1; --tint: #eef2ff;
  --bg: #f5f7fb; --card: #ffffff; --ink: #1e293b; --mut: #64748b; --line: #e2e8f0; --soft: #f1f5f9;
  --red: #dc2626; --redbg: #fef2f2; --amb: #d97706; --ambbg: #fffbeb; --grn: #0f766e; --grnbg: #f0fdfa;
  --blue: #1d4ed8; --shadow: 0 2px 10px rgba(30, 41, 59, .08); --radius: 12px;
}
:root[data-theme="night"] {
  --theme: #818cf8; --theme2: #6366f1; --tint: #1e1b4b;
  --bg: #0b1120; --card: #111827; --ink: #e5e7eb; --mut: #94a3b8; --line: #1f2937; --soft: #1f2937;
  --redbg: #2a1215; --ambbg: #2a1d0b; --grnbg: #0b2622; --blue: #93c5fd; --shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--theme); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; width: 100%; }
:root[data-theme="night"] input, :root[data-theme="night"] select, :root[data-theme="night"] textarea { border-color: #334155; }
label { display: block; font-size: 12.5px; font-weight: 700; color: var(--mut); margin: 12px 0 4px; }

/* ---------- header ---------- */
.kHead { background: linear-gradient(135deg, var(--theme2), #4338ca); color: #fff; padding: 10px 14px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 50; }
:root[data-theme="night"] .kHead { background: #020617; border-bottom: 1px solid #1f2937; }
.kHead .brand { font-weight: 800; font-size: 18px; text-decoration: none; color: #fff; }
.kHead .chain { font-size: 11.5px; opacity: .85; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hBtn { background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .45); color: #fff; border-radius: 9px; padding: 5px 9px; font-size: 13px; font-weight: 700; position: relative; text-decoration: none; }
.hBtn .dot { position: absolute; top: -6px; right: -7px; background: #ef4444; color: #fff; border-radius: 999px; font-size: 10px; padding: 1px 5px; }

/* ---------- tabs ---------- */
.kTabs { display: flex; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; position: sticky; top: 50px; z-index: 40; }
.kTabs a { flex: 1; text-align: center; padding: 11px 10px; font-weight: 700; font-size: 13.5px; color: var(--mut); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; }
.kTabs a.on { color: var(--theme); border-bottom-color: var(--theme); }
.kTabs sup { background: var(--amb); color: #fff; border-radius: 999px; padding: 0 5px; font-size: 10px; margin-left: 3px; }

main.kMain { max-width: 1240px; margin: 0 auto; padding: 10px 12px 60px; }
.narrow { max-width: 640px; margin: 0 auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--mut); font-size: 12.5px; }
.btn { border: 1px solid var(--line); background: var(--soft); color: var(--ink); border-radius: 9px; padding: 8px 12px; font-weight: 700; font-size: 13px; }
.btn.p { background: var(--theme); border-color: var(--theme); color: #fff; }
.btn.g { background: var(--grn); border-color: var(--grn); color: #fff; }
.btn.r { background: var(--redbg); border-color: #fca5a5; color: var(--red); }
.btn.a { background: var(--ambbg); border-color: #fcd34d; color: #92400e; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.addBtn { background: var(--theme); color: #fff; border: none; border-radius: 10px; padding: 9px 14px; font-weight: 800; font-size: 14px; text-decoration: none; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; }

/* ---------- segment + blocks ---------- */
.seg { display: flex; background: var(--soft); border-radius: 10px; padding: 3px; margin: 8px 0; }
.seg button { flex: 1; border: none; background: none; padding: 7px 0; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--mut); }
.seg button.on { background: var(--card); color: var(--theme); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.block { border-radius: 14px; padding: 6px 0 8px; margin: 12px 0; border: 1px solid var(--line); background: var(--card); }
.block.m { background: var(--tint); border-color: #c7d2fe; }
:root[data-theme="night"] .block.m { border-color: #312e81; }
.block.s { background: var(--soft); border-style: dashed; }
.bHead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 2px; font-weight: 800; font-size: 14px; gap: 8px; }
.bHead small { font-weight: 600; color: var(--mut); font-size: 11.5px; }
.grp { padding: 10px 12px 2px; font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; }
.g-red { color: var(--red); } .g-amb { color: var(--amb); } .g-grn { color: var(--grn); } .g-ind { color: var(--theme); } .g-mut { color: var(--mut); }
.modH { padding: 9px 12px 0; font-size: 12.5px; font-weight: 800; color: var(--theme); }
.empty { padding: 8px 12px; color: var(--mut); font-size: 13px; }

/* ---------- task card ---------- */
.tc { margin: 6px 10px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 9px 10px; display: flex; gap: 10px; align-items: center; }
.tc.red { border-left: 4px solid var(--red); } .tc.amb { border-left: 4px solid var(--amb); } .tc.grn { border-left: 4px solid var(--grn); }
.tc .tx { flex: 1; min-width: 0; cursor: pointer; }
.tc .tt { font-size: 14px; font-weight: 700; line-height: 1.3; }
.tc .ts { font-size: 12px; color: var(--mut); margin-top: 2px; }
.od { color: var(--red); font-weight: 700; } .rm { color: var(--amb); font-weight: 700; }
.tag { display: inline-block; font-size: 10px; font-weight: 800; border-radius: 5px; padding: 1px 6px; margin-left: 5px; vertical-align: middle; white-space: nowrap; }
.t-code { background: var(--soft); color: var(--mut); } .t-urgent { background: var(--redbg); color: var(--red); } .t-high { background: var(--ambbg); color: #92400e; }
.t-rep { background: #fef3c7; color: #92400e; } .t-link { background: #dcfce7; color: #166534; } .t-team { background: #ede9fe; color: #6d28d9; }
.t-who { background: #f5f3ff; color: #6d28d9; }
:root[data-theme="night"] .t-rep, :root[data-theme="night"] .t-link, :root[data-theme="night"] .t-team, :root[data-theme="night"] .t-who { background: #1f2937; }
.st { font-size: 10.5px; font-weight: 800; white-space: nowrap; letter-spacing: .3px; }
.st-open { color: var(--mut); } .st-inProgress { color: var(--blue); } .st-done { color: var(--grn); } .st-closed { color: #64748b; }

/* ---------- board ---------- */
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--ink); }
.chip.on { background: var(--theme); border-color: var(--theme); color: #fff; }
.filters select, .filters input { width: auto; padding: 6px 10px; border-radius: 999px; font-size: 13px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(220px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: var(--soft); border-radius: 12px; padding: 8px; min-height: 300px; }
.lane.m { background: var(--tint); }
.lane.drop { outline: 2px dashed var(--theme); }
.lane h4 { margin: 2px 4px 8px; font-size: 13.5px; display: flex; justify-content: space-between; }
.kc { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 9px; margin-bottom: 8px; font-size: 13px; cursor: grab; }
.kc.red { border-color: #fca5a5; } .kc.amb { border-color: #fcd34d; } .kc.chk { border-color: #5eead4; }
.kc b { display: block; font-size: 13.5px; } .kc small { color: var(--mut); }
.kc .ft { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-size: 12px; gap: 6px; }
.av { background: #ccfbf1; color: #115e59; border-radius: 999px; padding: 1px 7px; font-weight: 800; font-size: 11px; }
@media (max-width: 900px) { .board { grid-template-columns: repeat(5, 240px); } }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .dn { font-size: 12px; font-weight: 700; color: var(--mut); padding: 6px 0; }
.cal .d { padding: 8px 0 6px; border-radius: 10px; cursor: pointer; font-size: 14px; min-height: 44px; }
.cal .d:hover { background: var(--soft); }
.cal .d.today { outline: 2px solid var(--theme); }
.cal .d.sel { background: var(--theme); color: #fff; }
.dots { display: flex; justify-content: center; gap: 2px; margin-top: 3px; min-height: 7px; }
.dt { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.d-r { background: var(--red); } .d-a { background: var(--amb); } .d-g { background: var(--grn); } .d-x { background: #94a3b8; } .d-i { background: var(--theme2); } .d-f { background: #99f6e4; }

/* ---------- teams / requests / hierarchy ---------- */
.mchip { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; margin: 3px 4px 3px 0; }
.mchip button { border: none; background: none; color: var(--mut); padding: 0 0 0 2px; font-size: 14px; }
.reqBox { background: var(--ambbg); border: 1px solid #fde68a; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.secT { font-size: 11.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--mut); margin: 16px 0 6px; }
table.ht { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--card); }
table.ht th, table.ht td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; }
table.ht th { background: var(--soft); font-size: 11px; color: var(--mut); text-transform: uppercase; position: sticky; top: 0; }
table.ht select { padding: 5px 8px; font-size: 13px; }
table.ht tr.miss td { background: var(--redbg); }
.roleTag { display: inline-block; font-size: 10.5px; background: var(--soft); border-radius: 5px; padding: 1px 5px; margin: 1px 2px 1px 0; color: var(--mut); }
.tableWrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 12px; }
.tree ul { list-style: none; margin: 0; padding-left: 22px; border-left: 2px dashed #c7d2fe; }
.tree > ul { border-left: none; padding-left: 0; }
.tnode { display: inline-flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin: 4px 0; cursor: grab; font-size: 13px; }
.tnode.dropOk { outline: 2px dashed var(--theme); }
.tnode.miss { border-color: #fca5a5; background: var(--redbg); }

/* ---------- task detail / form ---------- */
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11px; font-weight: 800; border-radius: 999px; padding: 4px 10px; background: var(--soft); color: var(--ink); }
.b-inProgress { background: #dbeafe; color: #1d4ed8; } .b-done { background: #ccfbf1; color: #0f766e; } .b-closed { background: #e2e8f0; color: #334155; } .b-open { background: var(--soft); }
.b-urgent { background: #fee2e2; color: #b91c1c; } .b-high { background: #fef3c7; color: #92400e; }
.part { display: flex; justify-content: space-between; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; font-size: 13.5px; cursor: pointer; }
.part small { display: block; color: var(--mut); font-size: 11.5px; }
.warnBox { background: var(--ambbg); border: 1px dashed #f59e0b; color: #92400e; border-radius: 10px; padding: 8px 10px; font-size: 13px; margin-top: 8px; }
.infoBox { background: var(--tint); border: 1px solid #c7d2fe; border-radius: 10px; padding: 8px 10px; font-size: 13px; }
.note { border-top: 1px dashed var(--line); padding: 8px 0; font-size: 13.5px; }
.hist { font-size: 12.5px; color: var(--mut); line-height: 1.7; }
.pick { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--card); }
.pickList { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 9px; margin-top: 6px; }
.pickList div { padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; }
.pickList div:hover { background: var(--soft); }
.pchip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 10px; margin: 3px 4px 3px 0; font-size: 12.5px; background: #ecfeff; border: 1px solid #a5f3fc; color: #155e75; }
.pchip.w { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.pchip button { border: none; background: none; color: inherit; padding: 0; font-size: 14px; }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prio { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.prio button { flex: 1; border: none; background: var(--card); padding: 9px 0; font-weight: 700; color: var(--ink); }
.prio button.on { background: var(--theme); color: #fff; }
.prio button.u { color: var(--red); } .prio button.u.on { background: var(--red); color: #fff; }
.step { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 6px; display: flex; justify-content: space-between; gap: 6px; font-size: 13.5px; background: var(--card); }
.step small { display: block; color: var(--mut); }
.bigBtn { width: 100%; margin-top: 14px; padding: 12px; border-radius: 11px; border: none; background: var(--theme); color: #fff; font-weight: 800; font-size: 15px; }
.bigBtn:disabled { opacity: .55; }
.msg { font-size: 13px; margin-top: 8px; min-height: 16px; } .msg.err { color: var(--red); } .msg.ok { color: var(--grn); }

/* ---------- popups ---------- */
.mWrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: none; align-items: flex-end; justify-content: center; z-index: 200; }
.mWrap.open { display: flex; }
.mCard { background: var(--card); color: var(--ink); width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 14px 16px 18px; }
@media (min-width: 700px) { .mWrap { align-items: center; } .mCard { border-radius: 16px; } }
.mCard h3 { margin: 0 0 6px; }
.bellList { position: absolute; right: 8px; top: 48px; width: 340px; max-width: calc(100vw - 16px); max-height: 70vh; overflow: auto; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 100; display: none; }
.bellList.open { display: block; }
.bellList .bi { padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.bellList .bi.unread { background: var(--tint); }
.bellList .bi small { display: block; color: var(--mut); font-size: 11px; margin-top: 2px; }
