/* ============================================================
   GFTC Linksell CRM — Slate Operator
   Cool slate · Electric teal · DM Sans + JetBrains Mono
   Bloomberg/Linear hybrid · technical, dense, no AI warmth
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Light: cool paper ── */
:root,
[data-theme="light"] {
  --bg-base:        #F4F6FA;
  --bg-elev:        #FFFFFF;
  --bg-soft:        #ECEFF5;
  --bg-input:       #FFFFFF;
  --bg-hover:       #E6EAF2;
  --bg-overlay:     rgba(15, 23, 42, 0.45);
  --bg-grid:        rgba(15, 23, 42, 0.045);

  --border:         #E2E6EF;
  --border-strong:  #C7CEDB;
  --border-focus:   #0EA5E9;

  --ink:            #0B1220;
  --ink-soft:       #475569;
  --ink-mute:       #64748B;
  --ink-faint:      #94A3B8;

  --accent:         #0EA5E9;     /* sky / electric blue */
  --accent-deep:    #0369A1;
  --accent-soft:    #DBEAFE;
  --accent-2:       #14B8A6;     /* teal */
  --accent-2-soft:  #CCFBF1;

  --success:        #059669;
  --success-soft:   #D1FAE5;
  --warning:        #D97706;
  --warning-soft:   #FEF3C7;
  --danger:         #DC2626;
  --danger-soft:    #FEE2E2;
  --info:           #2563EB;
  --info-soft:      #DBEAFE;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -4px rgba(15, 23, 42, 0.10), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 40px -16px rgba(15, 23, 42, 0.18), 0 8px 16px -8px rgba(15, 23, 42, 0.10);

  color-scheme: light;
}

/* ── Dark: deep slate terminal ── */
[data-theme="dark"] {
  --bg-base:        #070B14;
  --bg-elev:        #0F172A;
  --bg-soft:        #131C30;
  --bg-input:       #0B1220;
  --bg-hover:       #1A2440;
  --bg-overlay:     rgba(0, 0, 0, 0.72);
  --bg-grid:        rgba(148, 163, 184, 0.06);

  --border:         #1E293B;
  --border-strong:  #334155;
  --border-focus:   #22D3EE;

  --ink:            #E2E8F0;
  --ink-soft:       #94A3B8;
  --ink-mute:       #64748B;
  --ink-faint:      #475569;

  --accent:         #22D3EE;     /* cyan */
  --accent-deep:    #06B6D4;
  --accent-soft:    rgba(34, 211, 238, 0.12);
  --accent-2:       #2DD4BF;     /* teal */
  --accent-2-soft:  rgba(45, 212, 191, 0.12);

  --success:        #34D399;
  --success-soft:   rgba(52, 211, 153, 0.12);
  --warning:        #FBBF24;
  --warning-soft:   rgba(251, 191, 36, 0.12);
  --danger:         #F87171;
  --danger-soft:    rgba(248, 113, 113, 0.12);
  --info:           #60A5FA;
  --info-soft:      rgba(96, 165, 250, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px -4px rgba(0, 0, 0, 0.55), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 50px -16px rgba(0, 0, 0, 0.7), 0 10px 20px -8px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'DM Sans', -apple-system, 'Pretendard', sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--bg-base);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'ss01';
  transition: background-color 0.2s ease, color 0.2s ease;
  /* Subtle dot grid background — technical, not paper */
  background-image:
    radial-gradient(circle, var(--bg-grid) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 0 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); }

::selection { background: var(--accent-soft); color: var(--ink); }

/* Tabular numerals helpers */
.tnum, td.num, th.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 0; border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); }

/* ── App layout ── */
.app-layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  min-height: 100vh;
}

/* ── Header ── */
.app-header {
  grid-area: header;
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
}

.header-left { display: flex; align-items: center; gap: 14px; }

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 16px;
}

.header-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-eyebrow .dot {
  display: inline-block;
  width: 7px; height: 7px;
  background: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--success-soft);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.header-divider { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.16s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle svg { width: 16px; height: 16px; }
[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.16s ease;
  cursor: pointer;
}

.user-chip:hover { border-color: var(--accent); }

.user-chip .avatar {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--ink);
  color: var(--bg-elev);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
}

.user-chip .meta { line-height: 1.1; }
.user-chip .meta .name { font-weight: 600; color: var(--ink); font-size: 12.5px; }
.user-chip .meta .role {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 1px;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.16s ease;
}

.logout-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.logout-btn svg { width: 16px; height: 16px; }

/* ── Sidebar ── */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 18px 0 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 4px 22px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.sidebar-brand .mark {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.04em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-brand .mark::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
}

.sidebar-brand .sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 6px;
  margin-left: 26px;
}

.sidebar-section {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 14px 22px 6px;
}

.sidebar-nav { list-style: none; padding: 0 10px; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px;
  margin-bottom: 1px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  position: relative;
  transition: all 0.14s ease;
}

.sidebar-nav a .ico {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  width: 14px;
  text-align: center;
  color: var(--ink-mute);
}

.sidebar-nav a:hover {
  color: var(--ink);
  background: var(--bg-hover);
}

.sidebar-nav a:hover .ico { color: var(--accent); }

.sidebar-nav a.active {
  color: var(--ink);
  background: var(--bg-hover);
  font-weight: 600;
}

.sidebar-nav a.active .ico { color: var(--accent); }

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 22px 0;
  border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Main ── */
.main-content {
  grid-area: main;
  padding: 28px 32px 56px;
  max-width: 100%;
  overflow-x: hidden;
}

/* ── Page header ── */
.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
}

.page-header .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-header .eyebrow::before {
  content: '';
  width: 16px;
  height: 1px;
  background: var(--accent);
}

.page-header p {
  color: var(--ink-mute);
  font-size: 12.5px;
  margin-top: 6px;
  max-width: 560px;
}

.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Cards ── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease;
}

.card-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  letter-spacing: -0.01em;
}

.card-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--accent);
  margin-right: 8px;
  vertical-align: middle;
}

/* ── Stats grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s ease;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.stat-card:hover { border-color: var(--border-strong); }
.stat-card:hover::after { transform: scaleX(1); }

.stat-card .label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 10px;
}

.stat-card .value {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 28px;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

.stat-card .value.compact { font-size: 20px; }

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

thead { background: var(--bg-soft); }

th {
  text-align: left;
  padding: 11px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 12px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-soft);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 0.12s ease; }
tbody tr:hover td { background: var(--bg-hover); }

td strong { color: var(--ink); font-weight: 600; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-pending     { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.badge-active      { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-closed      { background: var(--danger-soft);  color: var(--danger);  border-color: transparent; }
.badge-unassigned  { background: var(--bg-soft);      color: var(--ink-mute); border-color: transparent; }
.badge-confirmed   { background: var(--info-soft);    color: var(--info);    border-color: transparent; }
.badge-paid        { background: var(--success-soft); color: var(--success); border-color: transparent; }
.badge-admin       { background: var(--accent-soft);  color: var(--accent-deep); border-color: transparent; }
.badge-consultant  { background: var(--accent-2-soft); color: var(--accent-2); border-color: transparent; }

[data-theme="dark"] .badge-admin { color: var(--accent); }

tr.row-admin { background: var(--accent-soft); }
[data-theme="dark"] tr.row-admin { background: rgba(var(--accent-rgb, 99,102,241), 0.08); }

/* ── Forms ── */
input, select, textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--ink);
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  width: 100%;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input::placeholder, textarea::placeholder { color: var(--ink-faint); }

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: block;
  margin-bottom: 6px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  letter-spacing: 0;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

[data-theme="dark"] .btn-primary { color: #051018; }
[data-theme="dark"] .btn-primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.1); }

.btn-accent {
  background: var(--accent-2);
  color: #fff;
  border-color: var(--accent-2);
}
.btn-accent:hover { filter: brightness(0.92); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { filter: brightness(0.9); }

.btn-ghost {
  background: var(--bg-elev);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--ink);
  border-color: var(--border-strong);
}

.btn-sm { padding: 6px 12px; font-size: 11.5px; border-radius: 5px; }
.btn-lg { padding: 12px 26px; font-size: 13px; }
.btn-block { width: 100%; }

.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  gap: 9px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar .search-input {
  position: relative;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.toolbar .search-input input { padding-left: 36px; }

.toolbar .search-input::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 1.5px solid var(--ink-mute);
  border-radius: 50%;
  pointer-events: none;
}

.toolbar .search-input::after {
  content: '';
  position: absolute;
  left: 22px;
  top: 50%;
  width: 5px;
  height: 1.5px;
  background: var(--ink-mute);
  margin-top: 3px;
  transform: rotate(45deg);
  pointer-events: none;
}

.toolbar select, .toolbar input[type="month"] { width: auto; min-width: 150px; }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  overflow-x: auto;
}

.tab {
  padding: 11px 18px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-mute);
  cursor: pointer;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  transition: all 0.16s ease;
  white-space: nowrap;
  font-family: inherit;
  margin-bottom: -1px;
}

.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

.tab-content { animation: fadeIn 0.22s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ── Form grid ── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; }

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

.pagination a, .pagination span {
  min-width: 32px;
  text-align: center;
  padding: 7px 11px;
  border-radius: 5px;
  font-size: 11.5px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--ink-soft);
  transition: all 0.14s ease;
  font-family: 'JetBrains Mono', monospace;
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { background: var(--accent); color: #fff; border-color: var(--accent); }
[data-theme="dark"] .pagination .current { color: #051018; }

/* ── Login ── */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg-base);
}

.login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.login-card {
  width: 100%;
  max-width: 400px;
}

.login-card .label-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-card .label-eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--accent);
}

.login-card h1 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  color: var(--ink);
  line-height: 1.05;
}

.login-card .subtitle {
  color: var(--ink-mute);
  font-size: 13px;
  margin-bottom: 32px;
}

.login-card .form-group { margin-bottom: 14px; }

@media (max-width: 880px) {
  .login-shell { grid-template-columns: 1fr; }
}

/* ── Alerts ── */
.alert {
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  margin-bottom: 14px;
  border: 1px solid;
  font-family: inherit;
}

.alert-error   { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.alert-info    { background: var(--info-soft);    color: var(--info);    border-color: var(--info); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: var(--warning); }

/* ── Toast system ── */
.toast-stack {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: min(380px, calc(100vw - 48px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 13px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  gap: 11px;
  align-items: flex-start;
  animation: toastIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  font-size: 12.5px;
  color: var(--ink);
  position: relative;
  overflow: hidden;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-success .toast-icon { background: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-error   .toast-icon { background: var(--danger); }
.toast.toast-info    { border-left-color: var(--info); }
.toast.toast-info    .toast-icon { background: var(--info); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-warning .toast-icon { background: var(--warning); }

.toast-icon {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}

.toast-body { flex: 1; line-height: 1.45; }
.toast-body .title {
  font-weight: 600;
  margin-bottom: 2px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  letter-spacing: -0.005em;
}
.toast-body .msg { color: var(--ink-soft); font-size: 12px; }

.toast-close {
  background: none;
  border: none;
  color: var(--ink-mute);
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}
.toast-close:hover { color: var(--ink); }

.toast.leave { animation: toastOut 0.22s ease forwards; }

@keyframes toastIn  { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(120%); opacity: 0; } }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}

.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 920px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px 30px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalIn { from { transform: translateY(14px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-mute);
  font-size: 16px;
  width: 28px;
  height: 28px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.14s ease;
}
.modal-close:hover { color: var(--danger); border-color: var(--danger); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--ink-mute);
  font-size: 12.5px;
}

/* ── Notice ── */
.notice {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 16px 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.notice .icon {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 13px;
}

[data-theme="dark"] .notice .icon { color: var(--accent); }

.notice .body { flex: 1; }
.notice .body strong { color: var(--ink); display: block; margin-bottom: 4px; font-weight: 600; }
.notice .body { color: var(--ink-soft); font-size: 12.5px; line-height: 1.55; }

/* ── Autocomplete ── */
.autocomplete {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
}

.autocomplete-item {
  padding: 11px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background-color 0.1s ease;
}

.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: var(--bg-hover); }
.autocomplete-item .name { color: var(--ink); font-weight: 600; }
.autocomplete-item .email { color: var(--ink-mute); font-size: 11px; font-family: 'JetBrains Mono', monospace; }
.autocomplete-empty { padding: 14px; text-align: center; color: var(--ink-mute); font-size: 11.5px; font-family: 'JetBrains Mono', monospace; }

/* ── Guide ── */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.guide-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 22px;
  position: relative;
  transition: all 0.18s ease;
}

.guide-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.guide-card .num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.guide-card h3 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
  color: var(--ink);
}

.guide-card p { color: var(--ink-soft); font-size: 12.5px; line-height: 1.55; }

.guide-card ul {
  margin-top: 10px;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

/* ── Utilities ── */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-mute    { color: var(--ink-mute); }
.text-soft    { color: var(--ink-soft); }
.font-mono    { font-family: 'JetBrains Mono', monospace; }
.font-display { font-family: 'DM Sans', sans-serif; font-weight: 700; }

.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* Sidebar drawer */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 35;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 248px;
    height: 100vh;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: none; }
  .sidebar.open + .sidebar-backdrop { display: block; }
  .menu-toggle { display: inline-flex; }

  .main-content { padding: 22px 18px 48px; }
  .app-header { padding: 0 18px; }
  .page-header h1 { font-size: 22px; }
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .header-eyebrow { display: none; }
  .user-chip .meta .role { display: none; }
  .modal { padding: 18px; }
  .page-header h1 { font-size: 20px; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card .value { font-size: 24px; }
}
