/* ==========================================================================
   TaskFlow Pro — design system
   Tokens, layout primitives and components. No external dependencies, so the
   whole UI keeps working on a VPS with no outbound network access.
   ========================================================================== */

/* --- Tokens -------------------------------------------------------------- */
:root {
  --brand: #6366f1;
  --brand-dark: #4f46e5;
  --brand-soft: #eef2ff;
  --brand-ring: rgba(99, 102, 241, 0.35);

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #fbfbfd;
  --surface-3: #f1f2f7;
  --sidebar: #10131c;
  --sidebar-soft: #1a1f2e;

  --text: #131722;
  --text-2: #565d70;
  --text-3: #8b91a4;
  --border: #e5e7ef;
  --border-strong: #d3d6e2;

  --green: #0d9f6e;
  --green-soft: #e7f7f1;
  --amber: #d97706;
  --amber-soft: #fef4e6;
  --red: #e11d48;
  --red-soft: #ffeef2;
  --blue: #0284c7;
  --blue-soft: #e6f4fd;
  --purple: #7c3aed;
  --purple-soft: #f2ecfe;
  --slate-soft: #eef0f5;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --shadow-xs: 0 1px 2px rgba(16, 19, 28, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 19, 28, 0.07), 0 1px 2px rgba(16, 19, 28, 0.04);
  --shadow: 0 4px 16px rgba(16, 19, 28, 0.08), 0 1px 3px rgba(16, 19, 28, 0.04);
  --shadow-lg: 0 18px 50px rgba(16, 19, 28, 0.16);

  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --sidebar-w: 252px;
  --header-h: 62px;
}

[data-theme='dark'] {
  --brand-soft: #1e2140;
  --bg: #0b0d13;
  --surface: #141822;
  --surface-2: #171c27;
  --surface-3: #1e2431;
  --sidebar: #0d1017;
  --sidebar-soft: #171c27;

  --text: #eef0f6;
  --text-2: #a3aabd;
  --text-3: #6f7789;
  --border: #242b3a;
  --border-strong: #333c50;

  --green-soft: #0d2a22;
  --amber-soft: #2c2113;
  --red-soft: #33131f;
  --blue-soft: #10263a;
  --purple-soft: #211a3b;
  --slate-soft: #1d2331;

  --green: #34d399;
  --amber: #fbbf24;
  --red: #fb7185;
  --blue: #38bdf8;
  --purple: #a78bfa;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.45);
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.65);
}

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 { margin: 0; font-weight: 650; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p { margin: 0 0 10px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: 12px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.hidden { display: none !important; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }

/* --- Auth screens -------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
}

.auth-aside {
  position: relative;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(255, 255, 255, 0.16), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(255, 255, 255, 0.1), transparent 55%),
    linear-gradient(150deg, #4338ca 0%, #6366f1 45%, #0ea5e9 100%);
  overflow: hidden;
}
.auth-aside::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 30%, transparent 100%);
  pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside h2 { font-size: 34px; line-height: 1.15; max-width: 15ch; margin-bottom: 14px; }
.auth-aside p { color: rgba(255, 255, 255, 0.85); max-width: 46ch; font-size: 15px; }

.auth-features { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 13px; max-width: 44ch; }
.auth-features li { display: flex; gap: 11px; align-items: flex-start; color: rgba(255, 255, 255, 0.94); font-size: 14px; }
.auth-features svg { flex: none; margin-top: 2px; opacity: 0.95; }

.auth-metrics { display: flex; gap: 34px; margin-top: 36px; }
.auth-metrics div strong { display: block; font-size: 26px; letter-spacing: -0.02em; }
.auth-metrics div span { font-size: 12.5px; color: rgba(255, 255, 255, 0.75); }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 396px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card > p { color: var(--text-2); margin-bottom: 26px; }

.brand-mark { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(140deg, var(--brand), #0ea5e9);
  box-shadow: 0 2px 8px var(--brand-ring);
}
.auth-aside .brand-logo { background: rgba(255, 255, 255, 0.18); backdrop-filter: blur(6px); box-shadow: none; }

.demo-accounts { margin-top: 26px; border-top: 1px solid var(--border); padding-top: 20px; }
.demo-accounts > p { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.demo-grid { display: grid; gap: 8px; }
.demo-chip {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; text-align: left; font: inherit; color: inherit;
  transition: border-color .15s, background .15s, transform .1s;
}
.demo-chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.demo-chip:active { transform: translateY(1px); }
.demo-chip strong { font-size: 13px; }
.demo-chip span { font-size: 12px; color: var(--text-2); }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}

/* --- App shell ----------------------------------------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--sidebar); color: #cdd3e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  z-index: 40; border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.sidebar-head { padding: 17px 18px; display: flex; align-items: center; gap: 10px; color: #fff; }
.sidebar-head .brand-mark { font-size: 15.5px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 10px 16px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); background-clip: content-box; }

.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: #5c6479; padding: 16px 10px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 8.5px 11px; border-radius: var(--radius-sm);
  color: #b6bdcd; font-size: 13.5px; font-weight: 500; cursor: pointer; margin-bottom: 1px;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4); }
.nav-item svg { flex: none; opacity: 0.9; }
.nav-item .pill {
  margin-left: auto; background: rgba(255, 255, 255, 0.13); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}
.nav-item.active .pill { background: rgba(255, 255, 255, 0.25); }
.nav-item .pill.alert { background: var(--red); color: #fff; }

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .13s;
}
.sidebar-user:hover { background: rgba(255, 255, 255, 0.06); }
.sidebar-user .who { min-width: 0; }
.sidebar-user strong { display: block; font-size: 13px; color: #fff; }
.sidebar-user span { font-size: 11.5px; color: #7d8598; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h); flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 17px; }
.topbar-search { position: relative; flex: 1; max-width: 420px; }
.topbar-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.topbar-search input { padding-left: 34px; height: 36px; background: var(--surface-3); border-color: transparent; }
.topbar-search input:focus { background: var(--surface); }

.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
  position: relative; transition: background .13s, color .13s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 20px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface);
}

.page { padding: 22px; flex: 1; max-width: 1520px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { color: var(--text-2); margin: 3px 0 0; font-size: 13.5px; }

.mobile-toggle { display: none; }
@media (max-width: 1000px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: none; }
  .mobile-toggle { display: grid; }
  .page { padding: 16px; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); z-index: 35; }
}

/* --- Cards & panels ------------------------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}
.card-head {
  padding: 14px 17px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h3 { font-size: 14.5px; }
.card-body { padding: 17px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 11px 17px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 16px; }
/* Grid and flex children default to min-width:auto, which lets a wide table or
   long title stretch the whole track. Opting out keeps every column shrinkable. */
.grid > *, .stack > *, .stack-sm > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .grid-4 { grid-template-columns: 1fr; } }

/* --- Stat tiles ---------------------------------------------------------- */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; display: flex; gap: 13px; align-items: flex-start; box-shadow: var(--shadow-xs);
}
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat-value { font-size: 25px; font-weight: 680; letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.stat-delta { font-size: 11.5px; font-weight: 600; margin-top: 5px; display: inline-flex; align-items: center; gap: 3px; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .13s, border-color .13s, transform .08s, box-shadow .13s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { flex: none; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 3px var(--brand-ring); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(0.93); background: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.btn-group button {
  height: 32px; padding: 0 12px; border: 0; background: transparent; color: var(--text-2);
  font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; border-right: 1px solid var(--border);
}
.btn-group button:last-child { border-right: 0; }
.btn-group button:hover { background: var(--surface-3); color: var(--text); }
.btn-group button.active { background: var(--brand); color: #fff; }

/* --- Forms --------------------------------------------------------------- */
.field { margin-bottom: 15px; }
.field label, .label {
  display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 6px;
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; height: 38px; padding: 0 11px; font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .13s, box-shadow .13s;
}
textarea { height: auto; min-height: 90px; padding: 9px 11px; resize: vertical; line-height: 1.55; }
select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b91a4' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }

.checkbox { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13.5px; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }

.input-with-btn { display: flex; gap: 8px; }

.alert {
  padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 15px;
  display: flex; gap: 9px; align-items: flex-start;
}
.alert-error { background: var(--red-soft); color: var(--red); border: 1px solid currentColor; }
.alert-success { background: var(--green-soft); color: var(--green); border: 1px solid currentColor; }
.alert-info { background: var(--blue-soft); color: var(--blue); border: 1px solid currentColor; }
.alert svg { flex: none; margin-top: 1px; }

/* --- Badges & avatars ---------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 620; line-height: 1.7; white-space: nowrap;
  background: var(--slate-soft); color: var(--text-2);
}
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge .dot-mark { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11px; font-weight: 550;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-size: 12px; font-weight: 650; letter-spacing: 0.01em; user-select: none;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 26px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

.online-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 2px var(--surface); flex: none;
}

/* --- Tables -------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; padding: 10px 14px; font-size: 11.5px; font-weight: 650; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--border);
  background: var(--surface-2); white-space: nowrap; position: sticky; top: 0;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tr.clickable { cursor: pointer; }

/* --- Progress ------------------------------------------------------------ */
.progress { height: 6px; border-radius: 20px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; border-radius: 20px; background: var(--brand); transition: width .35s ease; }
.progress-lg { height: 9px; }

/* --- Kanban board -------------------------------------------------------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board-col {
  flex: 1 0 288px; max-width: 340px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column;
  max-height: calc(100vh - var(--header-h) - 132px);
}
.board-col.drag-over { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.board-col-head {
  padding: 11px 13px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 650; position: sticky; top: 0; background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0; z-index: 1;
}
.board-col-head .count {
  background: var(--surface-3); color: var(--text-2); font-size: 11px; padding: 0 7px; border-radius: 20px;
}
.board-col-body { padding: 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 9px; min-height: 70px; }
.col-mark { width: 8px; height: 8px; border-radius: 3px; flex: none; }

.task-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px;
  cursor: grab; box-shadow: var(--shadow-xs); transition: box-shadow .14s, transform .08s, border-color .14s;
}
.task-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.45; transform: rotate(1.5deg); }
.task-card-title { font-size: 13.5px; font-weight: 570; line-height: 1.4; margin: 6px 0 8px; }
.task-card-meta { display: flex; align-items: center; gap: 9px; font-size: 11.5px; color: var(--text-3); flex-wrap: wrap; }
.task-card-meta .item { display: inline-flex; align-items: center; gap: 3px; }

.priority-bar { width: 100%; height: 3px; border-radius: 3px; margin-bottom: 2px; }
.p-urgent { background: var(--red); }
.p-high { background: var(--amber); }
.p-medium { background: var(--blue); }
.p-low { background: var(--text-3); }

/* --- Task list ----------------------------------------------------------- */
.task-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 15px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s;
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-row .title { font-weight: 550; font-size: 13.5px; }
.task-row.done .title { color: var(--text-3); text-decoration: line-through; }

.check-circle {
  width: 19px; height: 19px; border-radius: 50%; border: 1.8px solid var(--border-strong); flex: none;
  display: grid; place-items: center; cursor: pointer; color: transparent; transition: all .14s; background: transparent;
}
.check-circle:hover { border-color: var(--green); color: var(--green); }
.check-circle.checked { background: var(--green); border-color: var(--green); color: #fff; }

/* --- Calendar ------------------------------------------------------------ */
.calendar { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-head div { padding: 8px; text-align: center; font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
  min-height: 108px; min-width: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  padding: 6px; display: flex; flex-direction: column; gap: 3px; background: var(--surface);
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other-month { background: var(--surface-2); }
.cal-day.today { background: var(--brand-soft); }
.cal-day .num { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 2px; }
.cal-day.today .num { color: var(--brand); font-weight: 750; }
.cal-event {
  font-size: 11px; padding: 2px 6px; border-radius: 5px; cursor: pointer; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid;
  background: var(--surface-3);
}
.cal-event:hover { filter: brightness(0.96); }
@media (max-width: 800px) { .cal-day { min-height: 74px; } .cal-event { font-size: 10px; } }

/* --- Charts (pure CSS/SVG) ----------------------------------------------- */
.bar-chart { display: flex; align-items: flex-end; gap: 7px; height: 148px; padding-top: 8px; }
.bar-chart .bar-col {
  flex: 1 1 0; min-width: 0; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  height: 100%; justify-content: flex-end;
}
.bar-chart .bar {
  width: 100%; max-width: 34px; border-radius: 5px 5px 2px 2px; background: var(--brand);
  min-height: 3px; transition: height .4s ease; position: relative;
}
.bar-chart .bar:hover { filter: brightness(1.12); }
.bar-chart .bar-label { font-size: 10.5px; color: var(--text-3); white-space: nowrap; }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { position: relative; width: 136px; height: 136px; flex: none; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut-center strong { font-size: 22px; font-weight: 680; letter-spacing: -0.02em; display: block; line-height: 1.1; }
.donut-center span { font-size: 11px; color: var(--text-3); }

.legend { display: grid; gap: 8px; flex: 1; min-width: 150px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-item .value { margin-left: auto; font-weight: 620; }

.hbar-row { display: flex; align-items: center; gap: 11px; padding: 7px 0; }
.hbar-track { flex: 1; height: 8px; border-radius: 20px; background: var(--surface-3); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 20px; transition: width .4s ease; }

/* --- Modal --------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11, 13, 19, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 5vh 18px; z-index: 100;
  overflow-y: auto; animation: fade .16s ease;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 540px; animation: pop .18s ease; border: 1px solid var(--border);
}
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1020px; }
.modal-head { padding: 17px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.modal-body { padding: 20px; }
.modal-body.tight { padding: 0; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 9px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-10px) scale(0.985); } }

/* --- Dropdown ------------------------------------------------------------ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; z-index: 60;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 5px; animation: pop .13s ease;
}
.dropdown-menu.wide { min-width: 340px; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; cursor: pointer; color: var(--text); border: 0; background: none; width: 100%;
  text-align: left; font-family: inherit;
}
.dropdown-item:hover { background: var(--surface-3); text-decoration: none; }
.dropdown-item.danger { color: var(--red); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* --- Notifications panel ------------------------------------------------- */
.notif-panel { max-height: 440px; overflow-y: auto; }
.notif-item { display: flex; gap: 11px; padding: 11px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.notif-item:hover { background: var(--surface-3); }
.notif-item.unread { background: var(--brand-soft); }
.notif-item .icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.notif-item strong { font-size: 13px; display: block; }
.notif-item p { font-size: 12.5px; color: var(--text-2); margin: 2px 0 0; }
.notif-item time { font-size: 11px; color: var(--text-3); }

/* --- Toast --------------------------------------------------------------- */
.toast-host { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 15px; border-radius: var(--radius);
  background: var(--sidebar); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: slide-in .2s ease; max-width: 380px;
}
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
@keyframes slide-in { from { opacity: 0; transform: translateX(24px); } }

/* --- Timeline / activity ------------------------------------------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 5px; bottom: 5px; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 15px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: ''; position: absolute; left: -21px; top: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--brand);
}
.timeline-item p { margin: 0; font-size: 13px; }
.timeline-item time { font-size: 11.5px; color: var(--text-3); }

/* --- Gantt --------------------------------------------------------------- */
.gantt { overflow-x: auto; }
.gantt-row { display: flex; align-items: center; gap: 12px; padding: 5px 0; }
.gantt-label { width: 220px; flex: none; font-size: 12.5px; }
.gantt-track { flex: 1; min-width: 420px; height: 22px; background: var(--surface-3); border-radius: 6px; position: relative; }
.gantt-bar { position: absolute; top: 3px; height: 16px; border-radius: 5px; opacity: 0.9; }

/* --- Misc ---------------------------------------------------------------- */
.empty { padding: 44px 22px; text-align: center; color: var(--text-3); }
.empty svg { opacity: 0.35; margin-bottom: 10px; }
.empty h4 { color: var(--text-2); margin-bottom: 4px; }

.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.divider { height: 1px; background: var(--border); margin: 16px 0; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 9px 14px; font-size: 13.5px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-weight: 520; }

.filters { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filters select, .filters input { height: 34px; width: auto; min-width: 132px; font-size: 13px; }
.filters input[type=search] { min-width: 210px; }

.chip-toggle {
  padding: 5px 11px; border-radius: 20px; border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 12.5px; font-weight: 550; cursor: pointer; color: var(--text-2); font-family: inherit;
}
.chip-toggle:hover { border-color: var(--brand); color: var(--brand); }
.chip-toggle.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.clock-widget {
  border-radius: var(--radius); padding: 16px; color: #fff;
  background: linear-gradient(135deg, #4338ca, #6366f1 55%, #0ea5e9);
  box-shadow: 0 6px 22px rgba(79, 70, 229, 0.28);
}
.clock-time { font-size: 30px; font-weight: 680; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.clock-widget .btn { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.28); color: #fff; backdrop-filter: blur(6px); }
.clock-widget .btn:hover { background: rgba(255, 255, 255, 0.26); }

.timer-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 20px;
  background: var(--green-soft); color: var(--green); font-size: 12.5px; font-weight: 620;
  font-variant-numeric: tabular-nums;
}
.timer-pill .pulse { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* --- Responsive refinements ---------------------------------------------
   These come last so they win over the component defaults above.
   ------------------------------------------------------------------------ */

/* The generic input rule resets padding, so restore the room for the icon. */
.topbar .topbar-search input[type=search] { padding-left: 34px; }

@media (max-width: 1000px) {
  .page-head h1 { font-size: 21px; }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 22px; }
}

@media (max-width: 760px) {
  /* A 120px-wide search box is useless — drop it and let ⌘K / the pages work. */
  .topbar-search { display: none; }
  .topbar { padding: 0 14px; gap: 8px; }
  /* Collapse the topbar action to just its icon. */
  #newTaskBtn { font-size: 0; gap: 0; padding: 0 11px; }

  .page-head { gap: 12px; }
  .page-head .row { width: 100%; flex-wrap: wrap; }
  .btn-group { flex-wrap: wrap; }
  .card-head { flex-wrap: wrap; }
  .card-head .row { flex-wrap: wrap; }

  /* Task rows keep the title and the deadline; the rest is noise on a phone. */
  .task-row { gap: 9px; padding: 11px 13px; }
  .task-row .badge:not(:last-of-type),
  .task-row .avatar,
  .task-row .task-card-meta .item:nth-child(n+3) { display: none; }
  .task-row .badge:last-of-type { min-width: 0 !important; }

  .filters { gap: 7px; }
  .filters select, .filters input, .filters input[type=search] { min-width: 0; flex: 1 1 138px; }

  .board-col { flex: 1 0 84vw; max-width: 84vw; }
  .modal-body, .modal-head, .modal-foot { padding-left: 15px; padding-right: 15px; }
  .kv { grid-template-columns: 1fr auto !important; }
  .gantt-label { width: 120px; }
  .donut-wrap { justify-content: center; }
}

@media (max-width: 480px) {
  .page { padding: 12px; }
  .grid { gap: 12px; }
  .card-body { padding: 14px; }
}

.print-only { display: none; }
@media print {
  .sidebar, .topbar, .btn, .filters { display: none !important; }
  .page { padding: 0; }
  .print-only { display: block; }
  .card { break-inside: avoid; box-shadow: none; }
}
