:root {
  --bg: #0b0f17; --surface: #131925; --surface-2: #1c2434; --border: #283246;
  --text: #e8edf5; --muted: #8a96aa;
  --brand: #6366f1; --brand-2: #22d3ee; --ok: #22c55e; --amber: #f59e0b; --danger: #ef4444;
  --radius: 14px; --shadow: 0 8px 30px rgba(0,0,0,.34); --sidebar-w: 228px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
[data-theme="light"] {
  --bg: #f3f5fb; --surface: #ffffff; --surface-2: #eef1f8; --border: #dde3ee;
  --text: #111726; --muted: #58637a; --shadow: 0 8px 30px rgba(30,50,90,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; transition: background .25s, color .25s; }
button, input, select, textarea { font-family: inherit; color: inherit; }
.green { color: var(--ok); } .amber { color: var(--amber); }
.muted-text { color: var(--muted); font-size: 13.5px; }
.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--brand); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 99; }

.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 900; font-size: 20px; padding: 6px 8px 18px; display: flex; align-items: center; gap: 9px; }
.brand-mark { font-size: 22px; }
.brand-accent { color: var(--brand); }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: none; border: none; color: var(--muted); font-size: 15px; font-weight: 600; padding: 11px 12px; border-radius: 10px; cursor: pointer; transition: .15s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #06121a; box-shadow: 0 6px 16px rgba(99,102,241,.3); }
.ni-ic { font-size: 15px; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.priv { font-size: 12px; color: var(--brand-2); font-weight: 600; }
.ghost-link { font-size: 12.5px; color: var(--muted); text-decoration: none; }
.ghost-link:hover { color: var(--text); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 13px clamp(16px,3vw,28px); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); z-index: 20; }
.topbar-title { font-size: 18px; font-weight: 800; }
.menu-btn { display: none; }
.search-top { flex: 1; max-width: 360px; margin-left: auto; background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 10px; padding: 9px 13px; font-size: 14px; }
.search-top:focus { outline: none; border-color: var(--brand); }
.icon-btn { background: var(--surface-2); border: 1px solid var(--border); width: 38px; height: 38px; border-radius: 9px; cursor: pointer; font-size: 15px; display: inline-grid; place-items: center; flex: none; }
.icon-btn:hover { border-color: var(--brand); }

.view { padding: clamp(14px,2.5vw,24px); flex: 1; min-width: 0; }

/* buttons */
.btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn:hover { border-color: var(--brand); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #06121a; border-color: transparent; }
.btn-ghost { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.row { display: flex; align-items: center; } .row.gap { gap: 10px; } .row.wrap { flex-wrap: wrap; }

/* board */
.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); width: 280px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 150px); }
.col-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-bottom: 1px solid var(--border); }
.col-title { font-weight: 800; font-size: 14px; }
.col-count { font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; min-height: 70px; transition: background .15s; }
.col-body.drop-hover { background: color-mix(in srgb, var(--brand) 12%, transparent); outline: 2px dashed color-mix(in srgb, var(--brand) 50%, transparent); outline-offset: -4px; border-radius: 10px; }
.col-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 16px 0; border: 1px dashed var(--border); border-radius: 9px; }

.job { background: var(--bg); border: 1px solid var(--border); border-radius: 11px; padding: 12px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.15); transition: border-color .15s, transform .05s; }
.job:hover { border-color: var(--brand); }
.job:active { cursor: grabbing; }
.job.dragging { opacity: .5; transform: rotate(1.5deg); }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.job-co { font-size: 14.5px; font-weight: 800; }
.prio { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.job-role { font-size: 13px; color: var(--text); margin-top: 2px; }
.job-meta { font-size: 12px; color: var(--muted); margin-top: 5px; }
.job-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; min-height: 18px; }
.follow { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.follow.overdue { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); }
.follow.today { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }
.follow.soon { background: var(--surface-2); color: var(--muted); }
.job-link { margin-left: auto; text-decoration: none; font-size: 13px; }

/* dashboard */
.grid { display: grid; gap: 14px; }
.grid.stats { grid-template-columns: repeat(5, 1fr); }
.grid.two { grid-template-columns: 1fr 1fr; margin-top: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 800; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-k { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat b { font-size: 26px; font-weight: 900; font-family: var(--mono); }
.donut-row { display: flex; align-items: center; gap: 16px; }
.chart-donut { width: 104px; height: 104px; flex: none; }
.legend { list-style: none; display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
.chart-bars { width: 100%; height: 150px; }
.card + .card { margin-top: 14px; }
.follow-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.follow-list li { display: flex; align-items: center; gap: 12px; font-size: 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.follow-list li.is-overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.fl-when { font-size: 12px; font-weight: 700; min-width: 70px; }
.fl-when.overdue { color: var(--danger); } .fl-when.today { color: var(--amber); } .fl-when.soon { color: var(--muted); }
.fl-main { flex: 1; min-width: 0; }
.fl-status { font-size: 12.5px; font-weight: 600; }

/* forms / modal */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 9px; padding: 9px 11px; font-size: 14px; font-weight: 500; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 18px; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px; }

/* empty */
.empty { text-align: center; padding: 50px 20px; margin: 30px auto; max-width: 460px; }
.empty-ic { font-size: 52px; margin-bottom: 12px; }
.empty h3 { font-size: 21px; font-weight: 800; margin-bottom: 8px; }
.empty p { color: var(--muted); margin-bottom: 20px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* toast */
.toast-host { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--ok); border-radius: 10px; padding: 11px 15px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); animation: slidein .25s ease; }
.toast.err { border-left-color: var(--danger); }
.toast.hide { opacity: 0; transform: translateX(20px); transition: .3s; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* footer */
.footer { border-top: 1px solid var(--border); margin-top: auto; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px clamp(16px,3vw,28px); color: var(--muted); font-size: 13px; }
.foot-socials { display: flex; gap: 10px; }
.foot-socials a { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); transition: .2s; }
.foot-socials a:hover { color: var(--brand); border-color: var(--brand); transform: translateY(-2px); }
.footer-bottom { border-top: 1px solid var(--border); text-align: center; padding: 11px; color: var(--muted); font-size: 12px; }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: 260px; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .menu-btn { display: inline-grid; }
  .grid.stats { grid-template-columns: 1fr 1fr; }
  .grid.two { grid-template-columns: 1fr; }
  .search-top { max-width: none; }
}
