:root {
  --bg: #0f172a; --bg2: #131c31; --panel: #1b2540; --panel2: #222d4b; --line: #2c385a; --line2: #3a4870;
  --text: #e6ebf5; --muted: #93a0bd; --faint: #6b7896;
  --accent: #4f8cff; --accent2: #3b74e0;
  --todo: #94a3b8; --doing: #60a5fa; --review: #c084fc; --blocked: #f87171; --done: #4ade80;
  --warn: #fbbf24; --danger: #f87171; --ok: #4ade80;
  --p-rendah: #94a3b8; --p-sedang: #60a5fa; --p-tinggi: #fbbf24; --p-kritis: #f87171;
  --bar-todo: #64748b; --bar-doing: #3b82f6; --bar-review: #a855f7; --bar-blocked: #ef4444; --bar-done: #22a35a;
  --radius: 12px; --shadow: 0 10px 30px rgba(0,0,0,.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
}
html.light {
  --bg: #f3f5fa; --bg2: #eef1f8; --panel: #ffffff; --panel2: #f6f8fc; --line: #dfe4ef; --line2: #c9d1e3;
  --text: #1c2437; --muted: #5d6882; --faint: #8a94ab; --shadow: 0 10px 30px rgba(20,30,60,.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .tiny { font-size: 11px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; } .col { display: flex; flex-direction: column; gap: 8px; }
.hidden { display: none !important; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  padding: 7px 12px; border-radius: 9px; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel2); border-color: var(--line); }
.btn.sm { padding: 4px 9px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.input, select.input, textarea.input { width: 100%; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; outline: none; }
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 70px; }
select.input { padding-right: 26px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* layout */
.layout { display: grid; grid-template-columns: 220px 1fr; height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 8px 16px; }
.brand .logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font-size: 16px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--panel2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav .ico { width: 18px; text-align: center; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.side .foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.me { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.top { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--bg); flex-wrap: wrap; }
.top h1 { font-size: 18px; margin: 0 8px 0 0; white-space: nowrap; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1; }
.filters .input { width: auto; padding: 6px 8px; font-size: 13px; }
.filters .search { min-width: 180px; }
.content { flex: 1; overflow: auto; padding: 18px; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 240px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .menu-btn { display: inline-flex; }
  .content { padding: 12px; }
}

/* chips, avatars */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.chip .dot, .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.chip.prio-rendah { color: var(--p-rendah); } .chip.prio-sedang { color: var(--p-sedang); } .chip.prio-tinggi { color: var(--p-tinggi); } .chip.prio-kritis { color: var(--p-kritis); }
.chip.st-todo { color: var(--todo); } .chip.st-doing { color: var(--doing); } .chip.st-review { color: var(--review); } .chip.st-blocked { color: var(--blocked); } .chip.st-done { color: var(--done); }
.chip.danger { color: var(--danger); border-color: rgba(248,113,113,.4); } .chip.warn { color: var(--warn); border-color: rgba(251,191,36,.4); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.avatar.sm { width: 20px; height: 20px; font-size: 10px; }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* cards & panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; }
.kpi:hover { border-color: var(--accent); }
.kpi .n { font-size: 28px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi.danger .n { color: var(--danger); } .kpi.warn .n { color: var(--warn); } .kpi.ok .n { color: var(--ok); }
.dash { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.tlist { display: flex; flex-direction: column; }
.tlist .it { display: flex; gap: 8px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.tlist .it:first-child { border-top: 0; }
.tlist .it:hover { background: var(--panel2); }
.tlist .it .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--faint); padding: 14px; text-align: center; border: 1px dashed var(--line2); border-radius: 10px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { color: var(--muted); font-size: 12px; font-weight: 600; position: sticky; top: 0; background: var(--panel); z-index: 1; cursor: pointer; user-select: none; white-space: nowrap; }
.tbl tr.click:hover td { background: var(--panel2); cursor: pointer; }
.tblwrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }

/* board */
.board { display: grid; grid-template-columns: repeat(5, minmax(250px, 1fr)); gap: 14px; align-items: start; min-height: 100%; }
.colm { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.colm.over { border-color: var(--accent); background: var(--panel2); }
.colm .hd { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; padding: 2px 4px; }
.colm .hd .cnt { margin-left: auto; color: var(--muted); font-weight: 600; }
.colm .list { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.card { background: var(--bg2); border: 1px solid var(--line2); border-left: 4px solid var(--p-sedang); border-radius: 12px; padding: 11px 12px; cursor: grab; display: flex; flex-direction: column; gap: 7px; }
.card:hover { border-color: var(--accent); border-left-color: inherit; }
.card.dragging { opacity: .4; }
.card.p-rendah { border-left-color: var(--p-rendah); } .card.p-sedang { border-left-color: var(--p-sedang); } .card.p-tinggi { border-left-color: var(--p-tinggi); } .card.p-kritis { border-left-color: var(--p-kritis); }
.card .ttl { font-weight: 600; font-size: 14px; line-height: 1.35; }
.card .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card .stale { color: var(--warn); font-size: 12px; }
.card .quick { border: 1px dashed var(--line2); border-radius: 9px; padding: 6px; text-align: center; color: var(--muted); font-size: 12px; background: transparent; cursor: pointer; }
.card .quick:hover { color: var(--ok); border-color: var(--ok); }
.placeholder { height: 56px; border: 2px dashed var(--accent); border-radius: 12px; opacity: .6; }
.addcard { color: var(--muted); font-size: 13px; padding: 6px; border-radius: 8px; text-align: center; cursor: pointer; border: 1px dashed transparent; }
.addcard:hover { border-color: var(--line2); color: var(--text); }

/* timeline */
.tlctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.tlwrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 190px); position: relative; }
.tlgrid { position: relative; }
.tlrow { display: flex; min-height: 34px; border-bottom: 1px solid var(--line); }
.tlrow.grp { background: var(--panel2); font-weight: 700; min-height: 32px; }
.tllab { position: sticky; left: 0; z-index: 3; width: 300px; flex: none; background: var(--panel); border-right: 1px solid var(--line); padding: 6px 10px; display: flex; align-items: center; gap: 6px; font-size: 13px; overflow: hidden; }
.tlrow.grp .tllab { background: var(--panel2); }
.tllab .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.tllab .t:hover { color: var(--accent); }
.tltrack { position: relative; flex: none; }
.tlhead { position: sticky; top: 0; z-index: 5; background: var(--panel); }
.tlhead .tlrow { min-height: 22px; }
.tlhead .tllab { z-index: 6; font-weight: 700; color: var(--muted); font-size: 12px; }
.tlday { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; font-size: 10px; color: var(--muted); border-left: 1px solid var(--line); }
.tlday.we { color: var(--faint); }
.tlday.today { color: #fff; background: var(--accent); border-radius: 4px; }
.tlmon { position: absolute; top: 0; bottom: 0; font-size: 11px; font-weight: 700; color: var(--text); padding: 3px 6px; border-left: 1px solid var(--line2); white-space: nowrap; }
.tlbg { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 1; }
.tlbg .we { position: absolute; top: 0; bottom: 0; background: rgba(148,163,184,.07); }
.tlbg .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: .8; }
.tlbar { position: absolute; top: 6px; height: 22px; border-radius: 6px; z-index: 2; color: #fff; font-size: 11px; font-weight: 600; line-height: 22px; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; user-select: none; touch-action: none; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.tlbar .pg { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,.22); pointer-events: none; }
.tlbar .lbl { position: relative; }
.tlbar .h { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.tlbar .h.l { left: 0; } .tlbar .h.r { right: 0; }
.tlbar.st-todo { background: #64748b; } .tlbar.st-doing { background: #3b82f6; } .tlbar.st-review { background: #a855f7; } .tlbar.st-blocked { background: #ef4444; } .tlbar.st-done { background: #22a35a; }
.tlbar.overdue { outline: 2px solid var(--danger); outline-offset: 1px; }
.tlbar.ms { width: 16px !important; padding: 0; border-radius: 3px; transform: rotate(45deg) scale(.8); margin-left: 3px; }
.tlout { position: absolute; top: 6px; font-size: 11px; color: var(--muted); line-height: 22px; white-space: nowrap; z-index: 2; pointer-events: none; }

/* calendar */
.calhd { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.calhd h2 { margin: 0 8px; font-size: 18px; min-width: 170px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cal .dow { padding: 10px; text-align: center; font-weight: 700; font-size: 12px; color: var(--muted); background: var(--panel2); border-bottom: 1px solid var(--line); letter-spacing: .05em; }
.cal .day { min-width: 0; min-height: 128px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day.out { background: var(--bg2); }
.cal .day.out .dn { color: var(--faint); }
.cal .day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal .day.we .dn { color: var(--muted); }
.cal .dn { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.cal .dn .badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; }
.cal .add { position: absolute; right: 6px; top: 4px; opacity: 0; border: 0; background: var(--panel2); color: var(--muted); border-radius: 6px; cursor: pointer; padding: 0 7px; }
.cal .day:hover .add { opacity: 1; }
.cev { font-size: 11.5px; padding: 3px 7px; border-radius: 6px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid; background: var(--panel2); }
.cev.st-todo { border-color: var(--todo); } .cev.st-doing { border-color: var(--doing); } .cev.st-review { border-color: var(--review); } .cev.st-blocked { border-color: var(--blocked); } .cev.st-done { border-color: var(--done); opacity: .7; text-decoration: line-through; }
.cev.overdue { background: rgba(248,113,113,.15); color: #fecaca; }
html.light .cev.overdue { color: #b91c1c; }
.cmore { font-size: 11px; color: var(--muted); cursor: pointer; text-align: center; }
.cmore:hover { color: var(--accent); }
.cfoot { margin-top: auto; font-size: 11px; color: var(--faint); }
@media (max-width: 700px) { .cal .day { min-height: 80px; } .cev { font-size: 10px; } }

/* modal */
.ovl { position: fixed; inset: 0; background: rgba(5,10,25,.6); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 14px; overflow-y: auto; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; width: 100%; max-width: 560px; box-shadow: var(--shadow); }
.modal.wide { max-width: 980px; }
.modal .mh { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal .mh h2 { margin: 0; font-size: 16px; flex: 1; }
.modal .mb { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.modal .mf { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.tdlg { display: grid; grid-template-columns: 1fr 300px; gap: 0; }
.tdlg .lft { padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tdlg .rgt { padding: 18px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; background: var(--bg2); border-radius: 0 0 16px 0; }
@media (max-width: 800px) { .tdlg { grid-template-columns: 1fr; } .tdlg .rgt { border-left: 0; border-top: 1px solid var(--line); border-radius: 0 0 16px 16px; } }
.ttlin { font-size: 18px; font-weight: 700; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; width: 100%; }
.ttlin:hover, .ttlin:focus { border-color: var(--line2); background: var(--bg2); outline: none; }
.sec h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.cl { display: flex; flex-direction: column; gap: 4px; }
.cl .ci { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 7px; }
.cl .ci:hover { background: var(--panel2); }
.cl .ci.done .tx { text-decoration: line-through; color: var(--muted); }
.cl .ci .tx { flex: 1; }
.cl .ci .x { opacity: 0; } .cl .ci:hover .x { opacity: 1; }
.feed { display: flex; flex-direction: column; gap: 10px; }
.fi { display: flex; gap: 10px; }
.fi .bd { flex: 1; min-width: 0; }
.fi .bx { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; white-space: pre-wrap; word-break: break-word; margin-top: 3px; }
.fi.sys { font-size: 12px; color: var(--muted); }
.fi.sys .ico { width: 26px; text-align: center; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .box { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.auth h1 { margin: 0; font-size: 22px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }
.banner { background: rgba(251,191,36,.12); border: 1px solid rgba(251,191,36,.4); color: var(--warn); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; display: flex; gap: 10px; align-items: center; }

/* toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; animation: tin .2s; }
.toast.err { border-left-color: var(--danger); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

.projgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--accent); }
.pcard h3 { margin: 0; font-size: 15px; }
.qf { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.qf .chip { cursor: pointer; padding: 5px 11px; }
.qf .chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.bulk { display: flex; gap: 8px; align-items: center; background: var(--panel2); border: 1px solid var(--accent); padding: 8px 12px; border-radius: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
kbd { background: var(--panel2); border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; font-size: 11px; }

.tscroll { overflow-x: auto; }
.panel { min-width: 0; }
