﻿/* ===== KIPILOTвЂ” Linear & Raycast Design System ===== */

/* ---------- Design Tokens ---------- */
:root {
  /* Spacing Scale (8px rhythm) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Typography Scale */
  --text-xs:   11px;
  --text-sm:   12.5px;
  --text-base: 13.5px;
  --text-md:   14.5px;
  --text-lg:   16.5px;
  --text-xl:   20px;
  --text-2xl:  26px;
  --text-stat: 24px;

  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semi:   600;
  --fw-bold:   650;
  --fw-heavy:  750;

  --lh-tight:   1.2;
  --lh-normal:  1.5;
  --lh-relaxed: 1.6;

  /* Border Radius (Linear style: sharp & balanced) */
  --radius-xs:   5px;
  --radius-sm:   7px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-fast:   100ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-normal: 160ms cubic-bezier(0.16, 1, 0.3, 1);
  --ease-slow:   250ms cubic-bezier(0.16, 1, 0.3, 1);

  --sidebar: 220px;
}

/* ---------- Theme: Dark (Linear / Raycast Signature Default) ---------- */
:root, :root[data-theme="dark"] {
  color-scheme: dark;

  /* Surfaces & Canvas */
  --bg:              #08090d;
  --bg-subtle:       #0d0f14;
  --surface:         #11141c;
  --surface-2:       #171b26;
  --surface-3:       #202534;
  --surface-hover:   rgba(255, 255, 255, 0.04);
  --surface-active:  rgba(255, 255, 255, 0.08);

  /* Hairline Borders */
  --border:          rgba(255, 255, 255, 0.08);
  --border-subtle:   rgba(255, 255, 255, 0.04);
  --border-hover:    rgba(255, 255, 255, 0.16);
  --border-focus:    #6366f1;

  /* Typography */
  --text:            #f3f4f6;
  --text-secondary:  #949ba8;
  --text-tertiary:   #606775;

  /* Backward compatibility aliases */
  --muted:           var(--text-secondary);
  --faint:           var(--text-tertiary);

  /* Accents (Linear Electric Indigo) */
  --accent:          #6366f1;
  --accent-2:        #4f46e5;
  --accent-soft:     rgba(99, 102, 241, 0.14);
  --accent-glow:     0 0 24px rgba(99, 102, 241, 0.35);

  /* Semantic Statuses */
  --success:         #10b981;
  --success-soft:    rgba(16, 185, 129, 0.14);
  --warn:            #f59e0b;
  --warn-soft:       rgba(245, 158, 11, 0.14);
  --danger:          #f43f5e;
  --danger-soft:     rgba(244, 63, 94, 0.14);
  --info:            #38bdf8;
  --info-soft:       rgba(56, 189, 248, 0.14);

  /* Elevation & Highlights */
  --shadow-sm:       0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow:          inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 2px 8px rgba(0, 0, 0, 0.45);
  --shadow-lg:       0 24px 48px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --card-highlight:  inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
}

/* ---------- Theme: Light (Clean Minimalist Linear Light) ---------- */
:root[data-theme="light"] {
  color-scheme: light;

  --bg:              #f7f8fb;
  --bg-subtle:       #eff1f6;
  --surface:         #ffffff;
  --surface-2:       #f1f3f7;
  --surface-3:       #e3e6ee;
  --surface-hover:   rgba(0, 0, 0, 0.03);
  --surface-active:  rgba(0, 0, 0, 0.06);

  --border:          rgba(0, 0, 0, 0.08);
  --border-subtle:   rgba(0, 0, 0, 0.04);
  --border-hover:    rgba(0, 0, 0, 0.15);
  --border-focus:    #4f46e5;

  --text:            #0f172a;
  --text-secondary:  #535c6f;
  --text-tertiary:   #8a94a6;

  --muted:           var(--text-secondary);
  --faint:           var(--text-tertiary);

  --accent:          #5355e5;
  --accent-2:        #4338ca;
  --accent-soft:     rgba(83, 85, 229, 0.1);
  --accent-glow:     0 0 20px rgba(83, 85, 229, 0.25);

  --success:         #059669;
  --success-soft:    rgba(5, 150, 105, 0.1);
  --warn:            #d97706;
  --warn-soft:       rgba(217, 119, 6, 0.1);
  --danger:          #e11d48;
  --danger-soft:     rgba(225, 29, 72, 0.1);
  --info:            #0284c7;
  --info-soft:       rgba(2, 132, 199, 0.1);

  --shadow-sm:       0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow:          0 1px 3px rgba(0, 0, 0, 0.05), 0 3px 12px rgba(0, 0, 0, 0.03);
  --shadow-lg:       0 20px 40px -10px rgba(0, 0, 0, 0.12);
  --card-highlight:  inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
}

/* ---------- Global Reset & Micro Typography ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-base);
  line-height: var(--lh-normal);
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Linear-style sleek custom scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(140, 150, 170, 0.2);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: rgba(140, 150, 170, 0.35); }

a { color: var(--accent); text-decoration: none; transition: color var(--ease-fast); }
a:hover { color: var(--accent-2); }
button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3 {
  margin: 0;
  line-height: var(--lh-tight);
  letter-spacing: -0.024em;
}
h1 { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--text); }
h2 { font-size: var(--text-lg); font-weight: var(--fw-semi); color: var(--text); }
h3 { font-size: var(--text-base); font-weight: var(--fw-semi); }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}
.muted { color: var(--text-secondary); }
.faint { color: var(--text-tertiary); }
.hidden { display: none !important; }

/* ---------- Accessibility & Focus (Linear Focus Ring) ---------- */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
button:focus-visible, .btn:focus-visible, .tick:focus-visible, .tabs button:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}
.input:focus-visible { outline: none; }

/* ---------- Layout: Modern App Shell ---------- */
.app { display: flex; min-height: 100vh; background: var(--bg); }

/* Sidebar: Raycast / Linear Dark Navigation */
.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  padding: var(--sp-3) var(--sp-2);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--sp-2) var(--sp-2) var(--sp-4);
  font-weight: var(--fw-heavy);
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.brand small {
  display: block;
  font-weight: var(--fw-medium);
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 520;
  font-size: 13px;
  transition: all var(--ease-fast);
  border: 1px solid transparent;
}
.nav a:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.nav a.active {
  background: var(--surface-active);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.nav a.active svg { color: var(--accent); }
.nav a .badge { margin-left: auto; }

.nav-sep {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 16px 10px 6px;
  font-weight: var(--fw-bold);
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: var(--sp-2);
}
.me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px var(--sp-2);
  border-radius: var(--radius-sm);
  transition: background var(--ease-fast);
}
.me:hover { background: var(--surface-hover); }
.me-info { min-width: 0; flex: 1; }
.me-info b {
  display: block;
  font-size: 13px;
  font-weight: var(--fw-semi);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.me-info span {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* Main Canvas & Topbar */
.main {
  flex: 1;
  margin-left: var(--sidebar);
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--border);
  min-height: 52px;
}
.topbar .title {
  font-weight: 550;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}
.topbar .spacer { flex: 1; }
.content {
  padding: 24px 32px 64px;
  max-width: 1200px;
  width: 100%;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 0 0 24px 0;
}
.page-head h1 { font-size: 22px; font-weight: var(--fw-bold); letter-spacing: -0.024em; margin: 0; color: var(--text); }
.page-head p { margin: 5px 0 0; color: var(--text-secondary); font-size: 13px; }

/* ---------- Linear / Raycast Cards & Panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  transition: border-color var(--ease-fast);
}
.card:hover {
  border-color: var(--border-hover);
}
.card-pad { padding: 18px 24px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.card-head h2 { font-size: 15px; font-weight: var(--fw-semi); }
.card-head .sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.grid { display: grid; gap: 20px; }
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 1200px) {
  .grid-2 {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }
}

/* Stats Bar */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: var(--sp-4);
}
.stat {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all var(--ease-fast);
}
.stat:hover {
  border-color: var(--border-hover);
  background: var(--surface-2);
}
.stat .label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 540;
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat .value {
  font-size: var(--text-stat);
  font-weight: var(--fw-heavy);
  letter-spacing: -0.025em;
  color: var(--text);
  margin-top: 2px;
}
.stat .value small {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.stat .bar { margin-top: 8px; }

/* ---------- Buttons (Linear Tactile Precision) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 550;
  font-size: 13px;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all var(--ease-fast);
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
  color: #fff;
}
.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  border-color: #4338ca;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 2px 6px rgba(79, 70, 229, 0.35);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #6d70f8 0%, #5850ec 100%);
  border-color: #4f46e5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 4px 14px rgba(79, 70, 229, 0.45);
  color: #ffffff;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(244, 63, 94, 0.2);
  background: var(--surface-2);
}
.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: #fff;
}

.btn-ghost {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: transparent;
}

.btn-sm {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: var(--radius-xs);
  gap: 5px;
}
.btn-icon {
  padding: 0;
  width: 32px;
  height: 32px;
}
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-block { width: 100%; }

/* ---------- Inputs & Forms (Linear Obsidian Input) ---------- */
.input, select.input, textarea.input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13.5px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: all var(--ease-normal);
}
.input::placeholder, textarea.input::placeholder {
  color: var(--text-tertiary);
}
.input:hover {
  border-color: var(--border-hover);
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 12px rgba(99, 102, 241, 0.25);
  background: var(--surface);
}
textarea.input {
  resize: vertical;
  min-height: 72px;
  line-height: var(--lh-normal);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
}
.field label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}
.field .hint {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.4;
}
.row { display: flex; gap: var(--sp-3); }
.row > * { flex: 1; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: 13px; }

/* ---------- Badges (Linear Pill Badges) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 560;
  letter-spacing: -0.01em;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge-accent {
  background: var(--accent-soft);
  color: #a5b4fc;
  border-color: rgba(99, 102, 241, 0.25);
}
.badge-success {
  background: var(--success-soft);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.25);
}
.badge-warn {
  background: var(--warn-soft);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.25);
}
.badge-danger {
  background: var(--danger-soft);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.25);
}
.badge-info {
  background: var(--info-soft);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.25);
}
.badge-count {
  background: var(--danger);
  color: #fff;
  min-width: 17px;
  height: 17px;
  border-radius: var(--radius-full);
  justify-content: center;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  border: 0;
}

/* User Avatars */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: var(--fw-bold);
  font-size: 11.5px;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 0 0 1px var(--border);
}
.avatar-sm { width: 22px; height: 22px; font-size: 9.5px; }

/* Progress Bar */
.bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #818cf8 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar.ok > i {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

/* Linear Segmented Tabs */
.tabs {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px;
  border-radius: var(--radius-sm);
  gap: 2px;
  flex-wrap: wrap;
}
.tabs button {
  border: 0;
  background: transparent;
  padding: 5px 11px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-weight: 530;
  font-size: 12.5px;
  color: var(--text-secondary);
  transition: all var(--ease-fast);
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  background: var(--surface-3);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.toolbar .input { width: auto; }
.toolbar .search { flex: 1; min-width: 180px; }

.datenav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  box-shadow: var(--shadow-sm);
}
.datenav .btn { border: 0; box-shadow: none; background: transparent; }
.datenav .btn:hover { background: var(--surface-2); }
.datenav input[type="date"] {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  outline: none;
  font-weight: var(--fw-semi);
  font-size: 12.5px;
  color: var(--text);
}

/* ---------- Lists & Linear Task Items ---------- */
.list { display: flex; flex-direction: column; }
.item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px var(--sp-5);
  border-top: 1px solid var(--border-subtle);
  position: relative;
  transition: background var(--ease-fast);
}
.item:first-child { border-top: 0; }
.item.clickable { cursor: pointer; }
.item.clickable:hover { background: var(--surface-hover); }
.item-body { flex: 1; min-width: 0; }
.item-title {
  font-size: 13.5px;
  font-weight: 520;
  color: var(--text);
  word-break: break-word;
}
.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}
.item.done .item-title {
  text-decoration: line-through;
  color: var(--text-tertiary);
}
.item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--ease-fast);
}
.item:hover .item-actions { opacity: 1; }

.group-title {
  padding: 12px var(--sp-5) 6px;
  font-size: 11px;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.group-title.danger { color: var(--danger); }

/* Linear Checkbox (Smooth Animated Tick) */
.tick {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 1.5px solid var(--text-tertiary);
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all var(--ease-normal);
  color: transparent;
  padding: 0;
}
.tick:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.tick.on {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
  animation: tick-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.tick.round { border-radius: 50%; }
.tick[disabled] { cursor: default; opacity: 0.5; }

@keyframes tick-pop {
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Empty State (Raycast Minimalist Graphic) */
.empty {
  text-align: center;
  padding: var(--sp-8) var(--sp-5);
  color: var(--text-secondary);
}
.empty .icon {
  width: 52px;
  height: 52px;
  margin: 0 auto var(--sp-3);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  box-shadow: var(--shadow-sm);
}
.empty .empty-title {
  font-weight: var(--fw-semi);
  font-size: 14.5px;
  margin-bottom: 4px;
  color: var(--text);
  letter-spacing: -0.015em;
}
.empty .empty-hint {
  font-size: 12.5px;
  max-width: 320px;
  margin: 0 auto;
  color: var(--text-secondary);
  line-height: 1.45;
}

.quick-add {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5) var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-subtle);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ---------- Today Command Cockpit (Linear Style) ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 22px 28px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.ring {
  position: relative;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
}
.ring svg { width: 76px; height: 76px; transform: rotate(-90deg); }
.ring .pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: var(--fw-heavy);
  font-size: 15px;
  letter-spacing: -0.02em;
}
.hero-text { flex: 1; min-width: 200px; }
.hero-text h2 { font-size: 16px; font-weight: var(--fw-bold); margin: 0 0 8px 0; }
.hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* Metric Steppers */
.metric-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 0;
  border-top: 1px dashed var(--border);
}
.metric-row:first-child { border-top: 0; }
.metric-row .mname { flex: 1; min-width: 0; font-weight: 520; font-size: 13px; }
.metric-row .mname small {
  display: block;
  color: var(--text-tertiary);
  font-weight: var(--fw-normal);
  font-size: 11.5px;
  margin-top: 1px;
}
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.stepper button {
  border: 0;
  background: transparent;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  font-weight: var(--fw-semi);
  color: var(--text-secondary);
  transition: all var(--ease-fast);
}
.stepper button:hover {
  background: var(--surface-3);
  color: var(--text);
}
.stepper input {
  width: 60px;
  border: 0;
  text-align: center;
  height: 32px;
  background: transparent;
  outline: none;
  font-weight: var(--fw-bold);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ---------- Table (Linear Clean Rules) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: var(--fw-bold);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable {
  cursor: pointer;
  transition: background var(--ease-fast);
}
.table tbody tr.clickable:hover { background: var(--surface-hover); }
.table td.r, .table th.r { text-align: right; }
.table tfoot td { font-weight: var(--fw-bold); border-top: 1px solid var(--border); }
.person { display: flex; align-items: center; gap: 9px; min-width: 160px; }
.person b { display: block; font-weight: var(--fw-semi); font-size: 13px; color: var(--text); }
.person > div span { font-size: 11.5px; color: var(--text-tertiary); }
.note-snippet {
  max-width: 260px;
  color: var(--text-secondary);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Charts (Linear Muted Data) ---------- */
.chart { width: 100%; height: 230px; display: block; }
.chart .bar-rect {
  fill: var(--accent);
  rx: 3;
  transition: fill var(--ease-fast);
}
.chart .bar-rect:hover { fill: #818cf8; }
.chart .axis { fill: var(--text-tertiary); font-size: 10px; font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--border-subtle); stroke-dasharray: 2 4; }
.chart .target-line { stroke: var(--warn); stroke-dasharray: 4 3; stroke-width: 1.5; }

/* ---------- Raycast Style Modals & Toasts ---------- */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: var(--sp-4);
  animation: fade var(--ease-fast);
}
.modal {
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: pop var(--ease-normal);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5) 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-head h2 { font-size: 15px; }
.modal-body { padding: var(--sp-4) var(--sp-5) 6px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  padding: 12px var(--sp-5) var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.modal-foot .left { margin-right: auto; }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }

.toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  z-index: 200;
}
.toast {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-hover);
  padding: 10px var(--sp-4);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-weight: 540;
  font-size: 13px;
  max-width: 360px;
  animation: pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.err {
  border-color: var(--danger);
  color: #fda4af;
  background: #1e1115;
}

/* Popover & Notifications */
.popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 350px;
  max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  overflow: hidden;
}
.popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.popover-head h3 { font-size: 13px; font-weight: var(--fw-semi); }
.popover-list { max-height: 400px; overflow: auto; }
.rem {
  display: flex;
  gap: 10px;
  padding: 11px var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--ease-fast);
}
.rem:hover { background: var(--surface-hover); }
.rem:last-child { border-bottom: 0; }
.rem .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--info);
  box-shadow: 0 0 6px var(--info);
}
.rem .dot.danger { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.rem .dot.warn { background: var(--warn); box-shadow: 0 0 6px var(--warn); }
.rem b { display: block; font-weight: var(--fw-semi); font-size: 13px; color: var(--text); }
.rem span { font-size: 11.5px; color: var(--text-secondary); }
.bell { position: relative; }
.bell .badge-count { position: absolute; top: -3px; right: -3px; }

.banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  margin-bottom: var(--sp-4);
  background: var(--warn-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--text);
  font-size: 13px;
  flex-wrap: wrap;
}
.banner.info { background: var(--info-soft); border-color: rgba(56, 189, 248, 0.3); }
.banner .grow { flex: 1; min-width: 200px; }

.weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.weekdays label { cursor: pointer; }
.weekdays input { display: none; }
.weekdays span {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 32px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  font-weight: 550;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-2);
  transition: all var(--ease-fast);
}
.weekdays input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}

.user-picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 6px;
  max-height: 200px;
  overflow: auto;
  padding: var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* ---------- Auth Screens (Linear Vault) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
.auth-side {
  background: radial-gradient(circle at 10% 20%, #4338ca 0%, transparent 45%),
              radial-gradient(circle at 90% 80%, #7c3aed 0%, transparent 45%),
              #08090d;
  color: #fff;
  padding: var(--sp-12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.auth-side h1 {
  font-size: 36px;
  line-height: 1.1;
  max-width: 440px;
  letter-spacing: -0.03em;
  font-weight: var(--fw-heavy);
}
.auth-side p { color: rgba(255, 255, 255, 0.7); max-width: 400px; font-size: 14.5px; }
.auth-feats { display: grid; gap: 12px; margin-top: var(--sp-6); }
.auth-feats div { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, 0.85); font-size: 13.5px; }
.auth-feats i {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  font-style: normal;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.auth-main { display: grid; place-items: center; padding: var(--sp-8) var(--sp-5); }
.auth-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
}
.auth-card h2 { font-size: var(--text-xl); margin-bottom: 6px; font-weight: var(--fw-bold); }
.auth-card .switch { margin-top: var(--sp-4); text-align: center; color: var(--text-secondary); font-size: 13px; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-4);
  font-size: 13px;
  border: 1px solid transparent;
}
.alert-err { background: var(--danger-soft); color: #fda4af; border-color: rgba(244, 63, 94, 0.25); }
.alert-ok { background: var(--success-soft); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.25); }
.alert-info { background: var(--info-soft); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.25); }

.mobile-nav { display: none; }

/* ---------- Loading Pulse ---------- */
.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-5);
  gap: var(--sp-3);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 520;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Responsive Layout ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: 72px; width: 100%; }
  .topbar, .content { padding-left: 20px; padding-right: 20px; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .item-actions { opacity: 1; }
  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: color-mix(in srgb, var(--surface) 95%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 30;
    padding: 6px var(--sp-1) calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: var(--text-secondary);
    padding: var(--sp-1) 0;
    font-weight: var(--fw-semi);
    transition: color var(--ease-fast);
  }
  .mobile-nav a.active { color: var(--accent); }
  .row { flex-direction: column; gap: 0; }
  h1 { font-size: var(--text-xl); }
  .toasts { left: var(--sp-4); right: var(--sp-4); bottom: 84px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
}

@media (max-width: 540px) {
  .content { padding-left: 14px; padding-right: 14px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  h1 { font-size: 19px; }
  .hero { flex-direction: column; text-align: center; gap: 16px; padding: 18px 16px; }
  .hero-chips { justify-content: center; }
  .ring { width: 68px; height: 68px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .modal { border-radius: var(--radius) var(--radius) 0 0; align-self: end; max-height: 90vh; }
  .modal-head { padding: 14px 16px 6px; }
  .modal-body { padding: 12px 16px 6px; }
  .modal-foot { padding: 10px 16px 14px; }
  .page-head { gap: 10px; }
  .card-pad { padding: 14px 16px; }
  .card-head { padding: 14px 16px 10px; }
  .item { padding: 12px 16px; }
  .quick-add { padding: 10px 14px; }
  .group-title { padding-left: 16px; padding-right: 16px; }
}

/* Utility overrides */
.stat[data-href] { cursor: pointer; }
.card > .bar { margin: 2px var(--sp-5) var(--sp-2); }
.stepper button[disabled] { opacity: 0.35; cursor: not-allowed; }
.stepper input[readonly], textarea.input[readonly] { background: var(--surface-2); color: var(--text-secondary); }

/* Jamoa: ochiladigan xodim qatori */
.table tbody tr.clickable .chev { display: inline-flex; color: var(--text-tertiary); transition: transform .15s; }
.table tbody tr.clickable.open .chev { transform: rotate(90deg); }
.table tbody tr.clickable.open { background: var(--surface-hover); }
.detail-row > td { padding: 0 !important; background: var(--surface-hover); }
.team-detail { position: sticky; left: 0; box-sizing: border-box; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding: 16px 20px 20px; white-space: normal; }
.team-detail h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-secondary); }
.team-detail p { margin: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mini-list li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.mini-list li small { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; font-size: 11.5px; }
.mini-list.done li, .mini-list li.done { color: var(--text-tertiary); }
.mini-list li.overdue > span { color: var(--danger); }
.danger-text { color: var(--danger); }
.rep-block { margin-bottom: 10px; font-size: 13px; }
.rep-block b { display: block; font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 2px; }
.rep-block p { white-space: pre-wrap; word-break: break-word; }
.rep-block.warn b { color: var(--danger); }
@media (max-width: 900px) { .team-detail { grid-template-columns: 1fr; } }

/* Vazifalar: xodim bo'yicha guruh sarlavhasi */
.group-title.person-group { padding-top: 16px; font-size: 12.5px; text-transform: none; letter-spacing: 0; color: var(--text); }
.group-title.person-group b { font-weight: var(--fw-semi); }
.group-title .person-link { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--accent); text-decoration: none; }
.group-title .person-link:hover { text-decoration: underline; }

/* Hisobotni ko'rib chiqish */
.review-box { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-subtle); font-size: 13px; }
.review-box:empty { display: none; }
.review-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.review-comment { margin: 6px 0 0; padding: 8px 10px; border-radius: var(--radius); background: var(--accent-soft); white-space: pre-wrap; word-break: break-word; }
.review-form { display: flex; gap: 6px; margin-top: 8px; }
.review-form .input { flex: 1; min-width: 0; }
.review-head + .review-form, .review-comment + .review-form { margin-top: 8px; }

/* Xodim sahifasi */
.person-lg .avatar { width: 48px; height: 48px; font-size: 17px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-wd { font-size: 11px; color: var(--text-tertiary); text-align: center; padding-bottom: 2px; }
.cal-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border-radius: 8px;
  background: var(--surface-3); color: var(--text); text-decoration: none; font-size: 13px; border: 1px solid transparent; }
.cal-day small { font-size: 10.5px; min-height: 13px; color: var(--text-secondary); white-space: nowrap; }
.cal-day.ok { background: var(--success-soft); }
.cal-day.late { background: var(--warn-soft); }
.cal-day.miss { background: var(--danger-soft); }
.cal-day.wait { background: var(--surface-3); }
.cal-day.rest { background: transparent; border: 1px dashed var(--border-subtle); color: var(--text-tertiary); }
.cal-day.muted-day { opacity: .4; }
.cal-day.is-today { border-color: var(--accent); }
a.cal-day:hover { filter: brightness(1.08); border-color: var(--border-accent); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 11.5px; color: var(--text-tertiary); }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cal-legend i.ok { background: var(--success); } .cal-legend i.late { background: var(--warn); } .cal-legend i.miss { background: var(--danger); } .cal-legend i.rest { border: 1px dashed var(--text-tertiary); }
.rep-feed { display: flex; flex-direction: column; }
.rep-item { padding: 14px 20px; border-top: 1px solid var(--border-hairline); }
.rep-item.unreviewed { box-shadow: inset 3px 0 0 var(--accent); }
.rep-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rep-item-head a { color: var(--text); text-decoration: none; }
.rep-item-head .spacer { flex: 1; }
/* Jarimalar */
.mini-list.fines li { align-items: flex-start; }
.mini-list.fines li.cancelled { opacity: .6; }
.mini-list.fines li.cancelled b { text-decoration: line-through; }

/* Jamoa: haftalik jadval */
.week-table th.c, .week-table td.c { text-align: center; padding-left: 4px; padding-right: 4px; width: 52px; }
.week-table th.c small { display: block; font-weight: 400; color: var(--text-tertiary); }
.week-table th.is-today { color: var(--accent); }
.week-table a.person { color: inherit; text-decoration: none; }
.week-table a.person:hover b { color: var(--accent); }
.wk { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px;
  font-weight: 700; font-size: 14px; text-decoration: none; }
.wk.ok { background: var(--success-soft); color: var(--success); }
.wk.late { background: var(--warn-soft); color: var(--warn); }
.wk.miss { background: var(--danger-soft); color: var(--danger); }
.wk.wait { background: var(--surface-3); color: var(--text-tertiary); }
.wk.rest { background: transparent; border: 1px dashed var(--border-subtle); color: var(--text-tertiary); font-size: 10.5px; font-weight: 500; }
.wk.off { background: transparent; border: 1px dashed var(--border-subtle); width: 32px; height: 32px; }
a.wk:hover { filter: brightness(1.15); outline: 1px solid currentColor; }
.wk-flag { position: absolute; top: -5px; right: -5px; width: 14px; height: 14px; border-radius: 50%; background: var(--danger); color: #fff;
  font-size: 9.5px; font-style: normal; line-height: 14px; }
.wk-dot { position: absolute; bottom: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
@media (max-width: 600px) { .cal { gap: 3px; } .cal-day { min-height: 42px; } .cal-day small { font-size: 9.5px; } .rep-item { padding: 12px 14px; } }
