/* ============================================================
   AWB PracticeFlow — Design System
   AWB Green: #1E7716 | AWB Blue: #4E5CBD
   ============================================================ */

/* ── CSS Variables (Light) ───────────────────────────────── */
:root {
  /* Brand */
  --green:        #1E7716;
  --green-dark:   #165910;
  --green-light:  #e8f5e3;
  --green-mid:    #2d8f23;
  --blue:         #4E5CBD;
  --blue-dark:    #3a44a0;
  --blue-light:   #eef0fa;

  /* Semantic */
  --color-success:     #16a34a;
  --color-success-bg:  #dcfce7;
  --color-warning:     #d97706;
  --color-warning-bg:  #fef3c7;
  --color-danger:      #dc2626;
  --color-danger-bg:   #fee2e2;
  --color-info:        #2563eb;
  --color-info-bg:     #dbeafe;

  /* Neutral */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  /* Surface */
  --bg-app:         #f1f5f9;
  --bg-card:        #ffffff;
  --bg-sidebar:     #0f1a0e;
  --bg-sidebar-hover: rgba(255,255,255,0.06);
  --bg-sidebar-active: rgba(30,119,22,0.2);
  --bg-input:       #ffffff;
  --bg-hover:       #f8fafc;
  --bg-subtle:      #f8fafc;

  /* Border */
  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;
  --border-focus:   var(--green);

  /* Sidebar */
  --sidebar-width:     240px;
  --sidebar-collapsed: 60px;

  /* Spacing */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  /* Shadow */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
  --shadow:     0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ── Dark Mode ───────────────────────────────────────────── */
[data-theme="dark"] {
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --bg-app:         #0f172a;
  --bg-card:        #1e293b;
  --bg-input:       #1e293b;
  --bg-hover:       #334155;
  --bg-subtle:      #1e293b;
  --border:         #334155;
  --border-strong:  #475569;
  --color-success-bg: #14532d;
  --color-warning-bg: #451a03;
  --color-danger-bg:  #450a0a;
  --color-info-bg:    #1e3a5f;
  --green-light:    #14290f;
  --blue-light:     #1e2456;
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font); color: var(--text-primary);
  background: var(--bg-app); line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200; overflow: hidden;
  transition: width 0.2s ease;
  border-right: 1px solid rgba(255,255,255,0.06);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-info,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role,
.sidebar.collapsed .brand-logo { display: none; }

/* Toggle button: stays centered and visible on its own once the logo hides */
.sidebar.collapsed .sidebar-brand {
  flex-direction: column;
  justify-content: center;
  padding: 1rem 0.5rem;
}
.sidebar.collapsed .sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.sidebar.collapsed .nav-link { justify-content: center; padding: 10px 0; }

/* Footer: avatar and sign-out stacked vertically, both stay visible and clickable */
.sidebar.collapsed .user-card {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.sidebar.collapsed .user-avatar { margin: 0; }
.sidebar.collapsed .user-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: #5a7a55;
  font-size: 15px;
  padding: 4px;
  border-radius: 4px;
}
.sidebar.collapsed .user-logout:hover { color: #e2f3df; background: rgba(255,255,255,0.08); }

.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem; min-height: 60px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-logo { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  background: var(--green); color: #fff;
  font-size: 12px; font-weight: 700; padding: 5px 8px;
  border-radius: var(--radius-sm); letter-spacing: .06em;
  flex-shrink: 0; min-width: 38px; text-align: center;
}
.brand-name { font-size: 13px; font-weight: 600; color: #e2f3df; line-height: 1.2; }
.brand-sub  { font-size: 10px; color: #5a7a55; }
.sidebar-toggle {
  background: none; border: none; color: #5a7a55;
  cursor: pointer; font-size: 16px; padding: 4px;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.sidebar-toggle:hover { color: #e2f3df; background: rgba(255,255,255,0.06); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

.nav-group { padding: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; color: #8aad85;
  font-size: 13px; font-weight: 400;
  border-radius: 0; transition: all 0.15s;
  position: relative; text-decoration: none;
}
.nav-link:hover { background: var(--bg-sidebar-hover); color: #d4e8d0; text-decoration: none; }
.nav-link.active {
  background: var(--bg-sidebar-active);
  color: #a8e0a0; font-weight: 500;
  border-right: 2px solid var(--green);
}
.nav-icon { width: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; }
.nav-badge {
  background: var(--green); color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 99px;
  min-width: 18px; text-align: center; flex-shrink: 0;
}
.nav-badge.badge-red { background: var(--color-danger); }

.sidebar-footer {
  padding: 12px; border-top: 1px solid rgba(255,255,255,0.06);
}
.user-card { display: flex; align-items: center; gap: 8px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.user-name  { font-size: 12px; font-weight: 500; color: #d4e8d0; line-height: 1.2; }
.user-role  { font-size: 10px; color: #5a7a55; }
.user-logout {
  margin-left: auto; color: #5a7a55; font-size: 16px;
  text-decoration: none; padding: 4px;
  border-radius: var(--radius-sm); flex-shrink: 0;
}
.user-logout:hover { color: #d4e8d0; }

/* ── Main wrap ───────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-width);
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh; transition: margin-left 0.2s ease;
}
.sidebar.collapsed ~ .main-wrap { margin-left: var(--sidebar-collapsed); }

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: 56px; background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.breadcrumb { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb span { color: var(--text-primary); font-weight: 500; }
.breadcrumb-sep { color: var(--text-muted); }

.topbar-btn {
  padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-subtle);
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; gap: 4px; text-decoration: none;
  transition: all 0.15s;
}
.topbar-btn:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.ai-btn { background: var(--green-light); border-color: var(--green); color: var(--green); font-weight: 500; }
.topbar-alert {
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--color-warning-bg); color: var(--color-warning);
  font-size: 12px; font-weight: 500; text-decoration: none;
}
.mobile-menu-btn { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }

/* ── Alerts ──────────────────────────────────────────────── */
.page-alerts { padding: 0 1.5rem; }
.alert {
  padding: 10px 14px; border-radius: var(--radius-sm);
  margin: 12px 0 0; font-size: 13px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-success { background: var(--color-success-bg); color: var(--color-success); border: 1px solid #86efac; }
.alert-error   { background: var(--color-danger-bg);  color: var(--color-danger);  border: 1px solid #fca5a5; }
.alert-warning { background: var(--color-warning-bg); color: var(--color-warning); border: 1px solid #fcd34d; }
.alert-info    { background: var(--color-info-bg);    color: var(--color-info);    border: 1px solid #93c5fd; }

/* ── Page Main ───────────────────────────────────────────── */
.page-main { padding: 1.5rem; flex: 1; }

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1.5rem; gap: 1rem;
}
.page-header h1 { font-size: 20px; font-weight: 600; margin: 0 0 2px; }
.page-header h2 { font-size: 18px; font-weight: 600; margin: 0 0 2px; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin: 0; }
.header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── Stat Cards ──────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-grid-5 { grid-template-columns: repeat(5,1fr); }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-sm); transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card-warn   { border-color: #fcd34d; }
.stat-card-danger { border-color: #fca5a5; }
.stat-card-green  { border-color: #86efac; }

.stat-label   { font-size: 12px; color: var(--text-secondary); font-weight: 500; margin-bottom: 4px; }
.stat-value   { font-size: 26px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat-sub     { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.stat-trend   { font-size: 11px; margin-top: 4px; }
.stat-trend.up   { color: var(--color-success); }
.stat-trend.down { color: var(--color-danger); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.card-header h3 { font-size: 14px; font-weight: 600; margin: 0; }
.card-body  { padding: 1.25rem; }
.card-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--border); background: var(--bg-subtle); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1.25rem; }
.grid-3-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 1.25rem; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--bg-subtle); padding: 8px 14px;
  text-align: left; font-size: 11px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: .04em; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td     { background: var(--bg-hover); }
.data-table tr.row-edd td   { background: rgba(220,38,38,0.03); }
.data-table tr.row-urgent td { background: rgba(217,119,6,0.03); }
.client-link    { color: var(--text-primary); font-weight: 500; }
.client-link:hover { color: var(--blue); text-decoration: none; }
.cell-sub       { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.actions-cell   { white-space: nowrap; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 500; white-space: nowrap;
}
.badge-green  { background: var(--color-success-bg);  color: var(--color-success); }
.badge-amber  { background: var(--color-warning-bg);  color: var(--color-warning); }
.badge-red    { background: var(--color-danger-bg);   color: var(--color-danger); }
.badge-blue   { background: var(--color-info-bg);     color: var(--color-info); }
.badge-grey   { background: var(--bg-subtle);         color: var(--text-secondary); border: 1px solid var(--border); }
.badge-low    { background: var(--color-success-bg);  color: var(--color-success); }
.badge-med    { background: var(--color-warning-bg);  color: var(--color-warning); }
.badge-high   { background: var(--color-danger-bg);   color: var(--color-danger); }

.arm-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 500; }
.arm-charity    { background: var(--green-light);  color: var(--green); }
.arm-commercial { background: var(--blue-light);   color: var(--blue); }

.tick  { color: var(--color-success); font-weight: 600; }
.cross { color: var(--color-danger);  font-weight: 600; }
.edd-flag { color: var(--color-danger); font-weight: 500; font-size: 12px; }

/* ── Health Score ────────────────────────────────────────── */
.health-score {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
}
.health-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.health-green .health-dot { background: var(--color-success); }
.health-amber .health-dot { background: var(--color-warning); }
.health-red   .health-dot { background: var(--color-danger); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-card);
  font-size: 13px; font-weight: 500; color: var(--text-primary);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: all 0.15s; font-family: var(--font);
}
.btn:hover { border-color: var(--border-strong); background: var(--bg-hover); text-decoration: none; }
.btn:focus { outline: 2px solid var(--green); outline-offset: 2px; }

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

.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-dark); }

.btn-danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }
.btn-danger:hover { opacity: .9; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--border); }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 15px; border-radius: var(--radius); }
.btn-full { width: 100%; justify-content: center; }

.btn-ai {
  background: linear-gradient(135deg, var(--green-light), var(--blue-light));
  border-color: var(--green); color: var(--green); font-weight: 600;
}
.btn-ai:hover { opacity: .9; }

/* ── Forms ───────────────────────────────────────────────── */
.form-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.25rem;
  margin-bottom: 1rem; box-shadow: var(--shadow-sm);
}
.form-section {
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 0 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.field-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.field-full   { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; }
label {
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
}
.required { color: var(--color-danger); }

input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=password], input[type=number], input[type=search],
select, textarea {
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-input);
  color: var(--text-primary); font-size: 14px;
  font-family: var(--font); width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(30,119,22,0.1);
}
textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: 11px; color: var(--text-muted); }

.checkbox-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 13px; color: var(--text-primary); cursor: pointer;
  margin-bottom: 8px;
}
.checkbox-row input[type=checkbox] { width: auto; margin-top: 2px; }

.radio-group { display: flex; gap: 8px; }
.radio-opt {
  flex: 1; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  text-align: center; transition: all 0.15s; background: var(--bg-subtle);
}
.radio-opt input[type=radio] { display: none; }
.radio-opt.selected { background: var(--green-light); border-color: var(--green); color: var(--green); font-weight: 500; }

.form-actions {
  display: flex; gap: 10px; align-items: center;
  padding-top: 1rem; border-top: 1px solid var(--border); margin-top: 1rem;
}

/* ── Kanban ──────────────────────────────────────────────── */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col {
  min-width: 260px; flex: 1; display: flex; flex-direction: column; gap: 0;
}
.kanban-col-header {
  padding: 10px 14px; border-radius: var(--radius) var(--radius) 0 0;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-header .col-count {
  background: rgba(255,255,255,0.3); padding: 1px 7px; border-radius: 99px; font-size: 11px;
}
.kanban-col-body {
  background: var(--bg-subtle); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 var(--radius) var(--radius);
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
  min-height: 200px;
}
.kanban-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: box-shadow 0.15s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card-title { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.kanban-card-meta  { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.col-pending     { background: #f1f5f9; border-color: #cbd5e1; }
.col-in_progress { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.col-waiting     { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.col-review      { background: #f3e8ff; border-color: #d8b4fe; color: #6b21a8; }
.col-complete    { background: #dcfce7; border-color: #86efac; color: #14532d; }

/* ── Activity Feed ───────────────────────────────────────── */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green-light); border: 2px solid var(--green);
  margin-top: 5px; flex-shrink: 0;
}
.activity-body { font-size: 13px; color: var(--text-secondary); flex: 1; }
.activity-actor { font-weight: 500; color: var(--text-primary); }
.activity-time  { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ── Pipeline funnel ─────────────────────────────────────── */
.funnel { display: flex; flex-direction: column; gap: 4px; padding: 1rem; }
.funnel-step {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  background: var(--bg-subtle); border: 1px solid var(--border);
}
.funnel-bar-wrap { flex: 1; background: var(--border); border-radius: 99px; height: 6px; }
.funnel-bar      { height: 6px; border-radius: 99px; background: var(--green); }
.funnel-label    { font-size: 12px; color: var(--text-secondary); width: 100px; }
.funnel-count    { font-size: 13px; font-weight: 600; width: 30px; text-align: right; }
.funnel-value    { font-size: 12px; color: var(--text-muted); width: 70px; text-align: right; }

/* ── Timeline ────────────────────────────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border); position: relative;
}
.tl-item:last-child { border-bottom: none; }
.tl-dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--green); background: var(--bg-card);
  flex-shrink: 0; margin-top: 4px;
}
.tl-content { flex: 1; }
.tl-title { font-size: 13px; font-weight: 500; }
.tl-meta  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Detail layout ───────────────────────────────────────── */
.detail-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); flex-shrink: 0; width: 150px; }
.detail-value { color: var(--text-primary); text-align: right; flex: 1; }

/* ── Filter bar ──────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 12px; flex: 1; max-width: 320px;
}
.search-box input {
  border: none; background: transparent; padding: 0;
  font-size: 13px; color: var(--text-primary); width: 100%;
}
.search-box input:focus { outline: none; box-shadow: none; }
.filter-select { min-width: 140px; }

/* ── Proposal builder ────────────────────────────────────── */
.service-picker { display: flex; flex-direction: column; gap: 6px; }
.service-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s;
  background: var(--bg-subtle);
}
.service-item:hover { border-color: var(--green); background: var(--green-light); }
.service-item.selected { border-color: var(--green); background: var(--green-light); }
.service-item input[type=checkbox] { flex-shrink: 0; }
.service-name { flex: 1; font-size: 13px; font-weight: 500; }
.service-price { font-size: 13px; font-weight: 600; color: var(--green); }
.service-billing { font-size: 11px; color: var(--text-muted); }

.price-summary {
  background: var(--bg-subtle); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.price-row { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.price-total {
  display: flex; justify-content: space-between;
  font-size: 16px; font-weight: 700; padding-top: 10px;
  margin-top: 6px; border-top: 2px solid var(--border);
  color: var(--green);
}

/* ── AI Panel ────────────────────────────────────────────── */
.ai-panel {
  background: linear-gradient(135deg, var(--green-light), var(--blue-light));
  border: 1px solid var(--green); border-radius: var(--radius-lg);
  padding: 1.25rem; margin-bottom: 1rem;
}
.ai-panel-header {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: 13px; font-weight: 600; color: var(--green);
}
.ai-loading {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary);
}
.ai-spinner {
  width: 16px; height: 16px; border: 2px solid var(--border);
  border-top-color: var(--green); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.ai-output {
  background: var(--bg-card); border-radius: var(--radius-sm);
  padding: 1rem; font-size: 13px; line-height: 1.7;
  color: var(--text-primary); white-space: pre-wrap;
  max-height: 400px; overflow-y: auto;
}

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  background: linear-gradient(135deg, #0f1a0e 0%, #1a2d18 50%, #0f172a 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--bg-card); border-radius: var(--radius-xl);
  padding: 2.5rem; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo .brand-mark { font-size: 18px; padding: 8px 16px; display: inline-block; margin-bottom: 12px; }
.login-logo h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.login-logo p  { font-size: 13px; color: var(--text-secondary); margin: 0; }
.btn-login { width: 100%; padding: 11px; font-size: 15px; font-weight: 600; border-radius: var(--radius); margin-top: 8px; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 2rem;
  color: var(--text-muted);
}
.empty-icon  { font-size: 48px; margin-bottom: 1rem; }
.empty-state h3 { font-size: 16px; color: var(--text-secondary); margin: 0 0 8px; }
.empty-state p  { font-size: 13px; margin: 0 0 1rem; }

/* ── Progress bar ────────────────────────────────────────── */
.progress-bar { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--green); transition: width 0.3s; }
.progress-fill.amber { background: var(--color-warning); }
.progress-fill.red   { background: var(--color-danger); }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab {
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; border: none;
  background: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
}
.tab:hover  { color: var(--text-primary); }
.tab.active { color: var(--green); border-bottom-color: var(--green); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stat-grid   { grid-template-columns: repeat(2,1fr); }
  .stat-grid-5 { grid-template-columns: repeat(3,1fr); }
  .grid-2, .grid-3, .grid-3-1, .grid-1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .mobile-menu-btn { display: block; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .page-main { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .kanban-board { flex-direction: column; }
  .field-grid, .field-grid-3 { grid-template-columns: 1fr; }
}

/* ── Utilities ───────────────────────────────────────────── */
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.font-mono    { font-family: var(--font-mono); }
.fw-600       { font-weight: 600; }
.fw-500       { font-weight: 500; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

