@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0b0a12;
  --bg2: #12101c;
  --bg3: #1a1729;
  --bg4: #221e35;
  --border: #272238;
  --border-hi: #3b3357;
  --text: #eceaf6;
  --muted: #8f8aa8;
  --accent: #38bdf8;
  --accent-dim: #38bdf818;
  --purple: #8b5cf6;
  --purple-dim: #8b5cf61c;
  --cyan: #38bdf8;
  --red: #f87171;
  --yellow: #facc15;
  --orange: #fb923c;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px #0006, 0 8px 24px -12px #000a;
  --shadow-lg: 0 24px 64px -16px #000c, 0 0 0 1px var(--border);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 80% -10%, #8b5cf60d, transparent),
    radial-gradient(900px 400px at -10% 110%, #38bdf80a, transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::selection { background: #8b5cf655; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 99px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: 4px; }
kbd {
  background: var(--bg4); border: 1px solid var(--border-hi); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 6px; font-size: 11px; font-family: inherit; color: var(--muted);
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0;
  background: linear-gradient(180deg, #14111f 0%, #100e19 100%);
  border-right: 1px solid var(--border);
  padding: 18px 12px 14px;
  display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand img { width: 34px; height: 34px; object-fit: contain; filter: drop-shadow(0 0 12px #8b5cf644); }
.brand .bt { font-size: 15px; font-weight: 800; letter-spacing: .4px; }
.brand .bt em { color: var(--accent); font-style: normal; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px; padding: 8px 10px; cursor: pointer;
  transition: border-color .15s var(--ease);
}
.search-trigger:hover { border-color: var(--border-hi); color: var(--text); }
.search-trigger kbd { margin-left: auto; }
.nav-link {
  padding: 8px 12px; border-radius: var(--radius-sm); color: var(--muted);
  font-size: 13.5px; font-weight: 500; display: flex; gap: 10px; align-items: center; cursor: pointer;
  transition: all .13s var(--ease); border: 1px solid transparent;
}
.nav-link:hover { background: var(--bg3); color: var(--text); transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(90deg, var(--purple-dim), transparent);
  color: var(--text); font-weight: 600; border-color: #8b5cf62e;
  box-shadow: inset 2px 0 0 var(--purple);
}
.sidebar .spacer { flex: 1; }
.userbox { padding: 12px 10px 2px; border-top: 1px solid var(--border); font-size: 13px; }
.userbox .name { font-weight: 600; }
.userbox .role { color: var(--purple); font-size: 11.5px; text-transform: capitalize; font-weight: 600; }
.userbox button { margin-top: 10px; width: 100%; }

.main { flex: 1; padding: 30px 36px 60px; max-width: 1360px; min-width: 0; }
.page-title { font-size: 22px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 26px; }

/* ---------- Components ---------- */
.card {
  background: linear-gradient(180deg, #14111fee, #12101cee);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
  transition: border-color .15s var(--ease);
}
button, .btn {
  background: var(--bg3); color: var(--text); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  font-family: inherit; font-weight: 500;
  transition: all .13s var(--ease);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover, .btn:hover { border-color: var(--border-hi); background: var(--bg4); transform: translateY(-1px); }
button:active, .btn:active { transform: translateY(0); }
button.primary {
  background: linear-gradient(135deg, #55c8f9, #1ba4e8); color: #04121c; font-weight: 700; border: none;
  box-shadow: 0 2px 12px -2px #38bdf866;
}
button.primary:hover { filter: brightness(1.08); box-shadow: 0 4px 18px -2px #38bdf888; }
button.danger { color: var(--red); }
button.danger:hover { border-color: #f8717155; background: #f8717111; }
button.small { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
input, textarea, select {
  background: #0d0b15; color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px; font-family: inherit;
  width: 100%; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px #8b5cf622;
}
input::placeholder, textarea::placeholder { color: #5f5a78; }
label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.field { margin-bottom: 14px; }

.progress-track { background: #0d0b15; border-radius: 99px; height: 7px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--purple), var(--accent)); transition: width .5s var(--ease); }

.badge {
  display: inline-flex; align-items: center; font-size: 10.5px; padding: 2px 8px; border-radius: 99px;
  font-weight: 700; letter-spacing: .3px;
}
.badge.critical { background: #f871711f; color: var(--red); box-shadow: inset 0 0 0 1px #f8717133; }
.badge.high { background: #fb923c1f; color: var(--orange); box-shadow: inset 0 0 0 1px #fb923c33; }
.badge.medium { background: #facc151a; color: var(--yellow); box-shadow: inset 0 0 0 1px #facc1526; }
.badge.low { background: #8f8aa81a; color: var(--muted); box-shadow: inset 0 0 0 1px #8f8aa826; }

/* ---------- Dashboard ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; }
.stat .num { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat .lbl { color: var(--muted); font-size: 12px; font-weight: 500; }
.hero-row { display: flex; gap: 12px; margin-bottom: 24px; align-items: stretch; flex-wrap: wrap; }
.donut-card { display: flex; align-items: center; gap: 18px; padding: 18px 22px; }
.donut { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; position: relative; flex-shrink: 0; }
.donut::before { content: ''; position: absolute; inset: 9px; background: var(--bg2); border-radius: 50%; }
.donut span { position: relative; font-size: 19px; font-weight: 800; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; margin-bottom: 24px; }
.cat-card { cursor: pointer; }
.cat-card:hover { border-color: var(--border-hi); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.cat-card { transition: all .18s var(--ease); }
.cat-card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cat-card .icon { font-size: 20px; }
.cat-card .title { font-weight: 650; font-size: 14px; }
.cat-card .counts { color: var(--muted); font-size: 12px; margin-top: 9px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.list-item { padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.list-item:last-child { border-bottom: none; }
.list-item .meta { color: var(--muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
h3.section { font-size: 13px; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }

/* ---------- Kanban ---------- */
.board-toolbar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.board-toolbar select { width: auto; font-size: 12.5px; padding: 7px 10px; }
.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
@media (max-width: 1200px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .board { grid-template-columns: 1fr; } }
.col {
  background: #100e1a99; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; min-height: 220px; transition: all .15s var(--ease);
}
.col-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 2px 6px; }
.col-head .t { font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.col-head .n { color: var(--muted); font-size: 11px; background: var(--bg3); padding: 1px 8px; border-radius: 99px; font-weight: 600; }
.col.drag-over { border-color: var(--accent); background: var(--accent-dim); box-shadow: inset 0 0 0 1px var(--accent); }
.quick-add {
  width: 100%; background: transparent; border: 1px dashed var(--border); color: var(--muted);
  font-size: 12.5px; padding: 7px 10px; border-radius: var(--radius-sm); margin-bottom: 8px;
}
.quick-add:focus { border-style: solid; background: #0d0b15; }
.task-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px 9px; margin-bottom: 7px; cursor: grab; font-size: 13px;
  transition: all .15s var(--ease); position: relative;
}
.task-card:hover { border-color: var(--border-hi); transform: translateY(-1px); box-shadow: var(--shadow); }
.task-card:active { cursor: grabbing; }
.task-card .t { font-weight: 550; margin-bottom: 7px; line-height: 1.4; font-size: 13px; }
.task-card .tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.task-card .cat-tag { font-size: 11px; color: var(--muted); font-weight: 500; }
.task-card.dragging { opacity: .35; transform: rotate(1.5deg) scale(.98); }
.pdot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

/* ---------- Roadmap ---------- */
.phase { display: flex; gap: 18px; position: relative; padding-bottom: 26px; }
.phase .rail { display: flex; flex-direction: column; align-items: center; }
.phase .dot {
  width: 15px; height: 15px; border-radius: 50%; background: var(--bg3);
  border: 3px solid var(--border-hi); z-index: 1; flex-shrink: 0; margin-top: 5px;
  transition: all .3s var(--ease);
}
.phase.done .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 12px #38bdf866; }
.phase.active .dot { border-color: var(--purple); background: var(--purple-dim); box-shadow: 0 0 12px #8b5cf655; }
.phase .line { width: 2px; flex: 1; background: linear-gradient(var(--border-hi), var(--border)); }
.phase:last-child .line { display: none; }
.phase .body { flex: 1; padding-bottom: 6px; min-width: 0; }
.phase .ph-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.phase .ph-name { font-weight: 750; font-size: 15.5px; letter-spacing: -.2px; }
.phase .ph-date { color: var(--muted); font-size: 12px; }
.phase .ph-desc { color: var(--muted); font-size: 13px; margin: 5px 0 10px; }
.phase .ph-progress { max-width: 440px; display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.phase .ph-progress .pct { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-weight: 600; }
.phase .ph-progress .progress-track { flex: 1; }
.phase-tasks { display: flex; flex-direction: column; gap: 3px; }
.ptask { font-size: 13px; display: flex; gap: 9px; align-items: center; padding: 5px 9px; border-radius: 7px; transition: background .12s; }
.ptask:hover { background: var(--bg3); }
.ptask input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
.ptask.done .txt { text-decoration: line-through; color: var(--muted); }
.ptask .cat-ic { font-size: 12px; }

/* ---------- Notes / md ---------- */
.notes-layout { display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: start; }
@media (max-width: 800px) { .notes-layout { grid-template-columns: 1fr; } }
.notes-nav { display: flex; flex-direction: column; gap: 3px; }
.notes-content textarea { min-height: 480px; font-family: 'Cascadia Code', Consolas, monospace; font-size: 13px; line-height: 1.65; }
.md { line-height: 1.7; font-size: 13.5px; }
.md h1 { font-size: 19px; margin: 14px 0 8px; letter-spacing: -.3px; }
.md h2 { font-size: 15px; margin: 16px 0 6px; color: var(--accent); }
.md p { margin: 6px 0; }
.md ul { margin: 6px 0 6px 22px; }
.md code { background: var(--bg4); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.md table { border-collapse: collapse; margin: 10px 0; width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; font-size: 13px; text-align: left; }
.md th { background: var(--bg3); }
.notes-toolbar { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.notes-toolbar .meta { color: var(--muted); font-size: 12px; margin-left: auto; }

/* ---------- Tables / team ---------- */
table.users { width: 100%; border-collapse: collapse; }
table.users th, table.users td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
table.users th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
table.users tr { transition: background .12s; }
table.users tbody tr:hover { background: #ffffff05; }
table.users select { width: auto; padding: 5px 8px; font-size: 12.5px; }
.invite-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.invite-box code {
  background: #0d0b15; border: 1px dashed var(--purple); padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: 15px; letter-spacing: 2px; color: var(--accent); font-family: Consolas, monospace;
}

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; flex-direction: column; }
.auth-logo { width: 270px; max-width: 82%; margin-bottom: 20px; filter: drop-shadow(0 0 40px #8b5cf655); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.auth-card { width: 390px; max-width: 100%; padding: 24px; }
.auth-card h1 { font-size: 19px; margin-bottom: 4px; letter-spacing: -.3px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.err { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- Modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: #05040acc; backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 8vh 20px 20px;
  animation: fade .15s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 560px; max-width: 100%; max-height: 84vh; overflow-y: auto; padding: 22px;
  box-shadow: var(--shadow-lg);
  animation: pop .18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal h3 { margin-bottom: 18px; font-size: 16px; letter-spacing: -.2px; }
.modal .row { display: flex; gap: 10px; }
.modal .row .field { flex: 1; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.hidden { display: none !important; }

/* ---------- Toast ---------- */
#toast-stack { position: fixed; bottom: 22px; right: 22px; z-index: 99; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg4); border: 1px solid var(--border-hi); color: var(--text);
  padding: 11px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: center;
  animation: slidein .22s var(--ease);
}
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } }
.toast.out { opacity: 0; transform: translateX(16px); transition: all .25s var(--ease); }

/* ---------- Command palette ---------- */
.cmdk-back {
  position: fixed; inset: 0; background: #05040ac9; backdrop-filter: blur(8px);
  z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 20px 20px;
  animation: fade .12s var(--ease);
}
.cmdk {
  width: 620px; max-width: 100%; background: var(--bg2); border: 1px solid var(--border-hi);
  border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop .16s var(--ease);
}
.cmdk input {
  border: none; background: transparent; font-size: 15px; padding: 16px 18px; border-radius: 0;
  border-bottom: 1px solid var(--border);
}
.cmdk input:focus { box-shadow: none; }
.cmdk-list { max-height: 46vh; overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 8px 12px 4px; font-weight: 700; }
.cmdk-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  font-size: 13.5px; cursor: pointer;
}
.cmdk-item .meta { margin-left: auto; color: var(--muted); font-size: 11px; display: flex; gap: 6px; align-items: center; }
.cmdk-item.sel { background: var(--purple-dim); box-shadow: inset 0 0 0 1px #8b5cf633; }
.cmdk-foot { border-top: 1px solid var(--border); padding: 8px 14px; display: flex; gap: 14px; font-size: 11px; color: var(--muted); }

.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.edit-grid .span2 { grid-column: span 2; }
@media (max-width: 640px) { .edit-grid { grid-template-columns: 1fr; } }
