/* ============================================================
   COUNSEL PORTAL — CSS Design System
   Pixel-matched to Clio Manage (verified from screenshots)
   ============================================================ */

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

:root {
  /* ── Core Blue ── */
  --blue:         #0070D2;
  --blue-dark:    #005BB0;
  --blue-darker:  #004A8F;
  --blue-light:   #EBF4FF;
  --blue-mid:     #0864C6;  /* topbar search bg */

  /* ── Sidebar ── */
  --sidebar-bg:        #0D1E3D;
  --sidebar-logo-bg:   #071429;
  --sidebar-active-bg: #182E52;
  --sidebar-hover-bg:  #142444;
  --sidebar-border:    rgba(255,255,255,0.08);
  --sidebar-text:      rgba(255,255,255,0.85);
  --sidebar-text-dim:  rgba(255,255,255,0.50);
  --sidebar-width:     220px;
  --sidebar-width-collapsed: 56px;

  /* ── Topbar ── */
  --topbar-bg:     #0070D2;
  --topbar-h:      48px;
  --topbar-search: #0864C6;

  /* ── Page / Surface ── */
  --page-bg:       #F3F4F6;
  --surface:       #FFFFFF;
  --surface-hover: #F5F8FF;
  --border:        #E1E4E8;
  --border-strong: #D1D5DB;
  --divider:       #EAECEF;

  /* ── Typography ── */
  --text-primary:   #1A1A2E;
  --text-secondary: #5A6B7B;
  --text-tertiary:  #8C9BAA;
  --text-link:      #0070D2;
  --text-link-hover:#005BB0;

  /* ── Status Colors ── */
  --status-pending-bg:    #FFF3CD;
  --status-pending-text:  #856404;
  --status-pending-border:#FFE08A;
  --status-progress-bg:   #CCE5FF;
  --status-progress-text: #004085;
  --status-progress-border:#99CAFF;
  --status-done-bg:       #D4EDDA;
  --status-done-text:     #155724;
  --status-done-border:   #A3D9B1;
  --status-overdue-bg:    #F8D7DA;
  --status-overdue-text:  #721C24;
  --status-overdue-border:#F5C6CB;
  --status-high-bg:       #F8D7DA;
  --status-high-text:     #721C24;

  /* ── Semantic ── */
  --success:      #28A745;
  --success-bg:   #D4EDDA;
  --danger:       #DC3545;
  --danger-bg:    #F8D7DA;
  --warning:      #FFC107;
  --warning-bg:   #FFF3CD;
  --info:         #17A2B8;
  --info-bg:      #D1ECF1;

  /* ── Shadows ── */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow:     0 2px 8px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.14);

  /* ── Radius ── */
  --r-sm:  4px;
  --r:     6px;
  --r-lg:  8px;

  /* ── Transitions ── */
  --t: 0.15s ease;

  font-family: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

/* ── Reset ── */
a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--text-link-hover); text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ============================================================
   LAYOUT
   ============================================================ */
body { background: var(--page-bg); min-height: 100vh; display: flex; }

#app-shell {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  transition: width var(--t);
  overflow: hidden;
}
#sidebar.collapsed { width: var(--sidebar-width-collapsed); }

.sidebar-logo {
  background: var(--sidebar-logo-bg);
  padding: 0 16px;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--sidebar-border);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-logo-icon {
  width: 28px; height: 28px;
  background: var(--blue);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 14px; font-weight: 700; color: #fff;
}
.sidebar-logo-text { font-size: 14px; font-weight: 700; color: #fff; letter-spacing: -0.01em; }
.sidebar-logo-sub  { font-size: 10px; color: var(--sidebar-text-dim); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; overflow-x: hidden; }
.sidebar-section-label {
  padding: 16px 16px 4px;
  font-size: 10px; font-weight: 600;
  color: var(--sidebar-text-dim);
  text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap;
}
.sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px; height: 40px;
  color: var(--sidebar-text);
  font-size: 13.5px; font-weight: 400;
  cursor: pointer;
  transition: background var(--t);
  white-space: nowrap;
  position: relative;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-item:hover { background: var(--sidebar-hover-bg); color: #fff; text-decoration: none; }
.sidebar-item.active {
  background: var(--sidebar-active-bg);
  color: #fff;
  border-left-color: var(--blue);
  font-weight: 500;
}
.sidebar-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.75; }
.sidebar-item.active svg { opacity: 1; }
.sidebar-item:hover svg { opacity: 1; }
.sidebar-badge {
  margin-left: auto;
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.sidebar-item.active .sidebar-badge { background: var(--blue); }

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

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background var(--t);
  overflow: hidden;
}
.sidebar-user:hover { background: var(--sidebar-hover-bg); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-name  { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 11px; color: var(--sidebar-text-dim); }
.sidebar-collapse-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; height: 36px;
  color: var(--sidebar-text);
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--r);
  transition: background var(--t);
  margin-top: 4px;
}
.sidebar-collapse-btn:hover { background: var(--sidebar-hover-bg); }
.sidebar-collapse-btn svg { width: 16px; height: 16px; flex-shrink: 0; transition: transform var(--t); }
#sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

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

/* ── Topbar ── */
#topbar {
  background: var(--topbar-bg);
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky; top: 0; z-index: 50;
  flex-shrink: 0;
}
.topbar-search {
  flex: 1; max-width: 380px;
  display: flex; align-items: center; gap: 8px;
  background: var(--topbar-search);
  border-radius: var(--r-sm);
  padding: 0 12px;
  height: 32px;
}
.topbar-search svg { width: 14px; height: 14px; color: rgba(255,255,255,0.7); flex-shrink: 0; }
.topbar-search input {
  background: transparent; border: none; outline: none;
  color: #fff; font-size: 13.5px;
  flex: 1; min-width: 0;
}
.topbar-search input::placeholder { color: rgba(255,255,255,0.6); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t);
  position: relative;
}
.topbar-icon-btn:hover { background: rgba(255,255,255,0.2); }
.topbar-icon-btn svg { width: 16px; height: 16px; }
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: #DC3545; color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 1px 4px; border-radius: 8px;
  min-width: 16px; text-align: center;
  line-height: 14px;
}
.topbar-create-btn {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff; font-size: 13px; font-weight: 500;
  padding: 0 14px; height: 32px;
  border-radius: var(--r-sm);
  transition: background var(--t);
}
.topbar-create-btn:hover { background: rgba(255,255,255,0.26); }
.topbar-create-btn svg { width: 14px; height: 14px; }

/* ── Content ── */
#content { flex: 1; padding: 24px; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.page-title { font-size: 22px; font-weight: 400; color: var(--text-primary); }
.page-title-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; height: 32px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--t);
  white-space: nowrap;
  line-height: 1;
}
.btn svg { width: 14px; height: 14px; }
.btn-primary   { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-secondary { background: #fff; color: var(--text-primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--page-bg); }
.btn-danger    { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #c82333; }
.btn-ghost     { background: transparent; color: var(--text-link); border-color: transparent; }
.btn-ghost:hover { background: var(--blue-light); }
.btn-sm { padding: 4px 10px; height: 28px; font-size: 12.5px; }
.btn-lg { padding: 9px 20px; height: 38px; font-size: 14px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.card-section {
  border-bottom: 1px solid var(--divider);
  padding: 16px 20px;
}
.card-section:last-child { border-bottom: none; }
.card-section-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 12px;
}
.card-section-title svg { width: 14px; height: 14px; }

/* ── Tables ── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--divider);
  flex-wrap: wrap;
}
.table-filter-tabs { display: flex; gap: 0; }
.filter-tab {
  padding: 5px 14px; font-size: 13px;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-secondary);
  cursor: pointer; transition: all var(--t);
  white-space: nowrap;
}
.filter-tab:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.filter-tab:last-child  { border-radius: 0 var(--r-sm) var(--r-sm) 0; border-left: none; }
.filter-tab:not(:first-child):not(:last-child) { border-left: none; }
.filter-tab.active { background: var(--blue-light); color: var(--blue); border-color: var(--blue); font-weight: 500; z-index: 1; }
.table-search {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 0 10px; height: 30px; min-width: 200px;
  background: var(--surface);
}
.table-search svg { width: 13px; height: 13px; color: var(--text-tertiary); flex-shrink: 0; }
.table-search input {
  border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--text-primary); flex: 1; min-width: 0;
}
.table-search input::placeholder { color: var(--text-tertiary); }
.table-actions-right { margin-left: auto; display: flex; gap: 8px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #F8F9FA;
  padding: 9px 12px;
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.04em;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
thead th.sortable { cursor: pointer; }
thead th.sortable:hover { color: var(--text-primary); }
thead th.sorted { color: var(--blue); }
.sort-icon { display: inline-block; margin-left: 4px; font-size: 10px; opacity: 0.5; }
thead th.sorted .sort-icon { opacity: 1; color: var(--blue); }
tbody tr { border-bottom: 1px solid var(--divider); transition: background var(--t); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-hover); }
tbody td { padding: 10px 12px; font-size: 13.5px; vertical-align: middle; }
tbody td.td-check { width: 40px; }
tbody td.td-actions { width: 140px; white-space: nowrap; }
.table-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--divider);
  display: flex; align-items: center; gap: 12px;
  font-size: 12.5px; color: var(--text-secondary);
}
.table-footer-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pagination-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px;
  transition: all var(--t);
}
.pagination-btn:hover:not(:disabled) { background: var(--page-bg); color: var(--text-primary); }
.pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
select.per-page {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 3px 6px; font-size: 12.5px;
  color: var(--text-primary); background: var(--surface);
  outline: none;
}
.expand-rows-toggle {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer;
}

/* ── Status Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
  white-space: nowrap;
}
.badge::before { content:''; width:6px; height:6px; border-radius:50%; flex-shrink:0; }
.badge-pending   { background:var(--status-pending-bg);  color:var(--status-pending-text);  border:1px solid var(--status-pending-border); }
.badge-pending::before   { background:var(--status-pending-text); }
.badge-progress  { background:var(--status-progress-bg); color:var(--status-progress-text); border:1px solid var(--status-progress-border); }
.badge-progress::before  { background:var(--status-progress-text); }
.badge-done      { background:var(--status-done-bg);     color:var(--status-done-text);     border:1px solid var(--status-done-border); }
.badge-done::before      { background:var(--status-done-text); }
.badge-overdue   { background:var(--status-overdue-bg);  color:var(--status-overdue-text);  border:1px solid var(--status-overdue-border); }
.badge-overdue::before   { background:var(--status-overdue-text); }
.badge-high      { background:var(--status-high-bg);     color:var(--status-high-text); }
.badge-high::before      { background:var(--status-high-text); }
.badge-open  { background:#CCE5FF; color:#004085; border:1px solid #99CAFF; }
.badge-open::before  { background:#004085; }
.badge-closed { background:#E2E3E5; color:#383D41; border:1px solid #D6D8DB; }
.badge-closed::before { background:#383D41; }
.badge-client { background:#CCE5FF; color:#004085; font-size:11px; padding:2px 7px; }
.badge-external { background:#D4EDDA; color:#155724; font-size:11px; padding:2px 7px; }

/* ── Action buttons in table ── */
.actions-btn {
  display: inline-flex; align-items: center; gap: 0;
  font-size: 13px;
}
.actions-btn .act-main {
  padding: 4px 10px; height: 28px;
  border: 1px solid var(--border-strong);
  border-right: none;
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: var(--surface); color: var(--text-primary);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: background var(--t);
}
.actions-btn .act-main:hover { background: var(--page-bg); }
.actions-btn .act-drop {
  width: 26px; height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface); color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background var(--t);
  font-size: 11px;
}
.actions-btn .act-drop:hover { background: var(--page-bg); }

/* ── Tabs ── */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab {
  padding: 10px 16px;
  font-size: 13.5px; color: var(--text-secondary);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: all var(--t);
  white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }

/* ── Forms ── */
.form-page-bg { background: var(--page-bg); }
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 28px 32px;
  max-width: 680px;
  margin: 0 auto 20px;
  box-shadow: var(--shadow-sm);
}
.form-section { margin-bottom: 28px; }
.form-section-title { font-size: 18px; font-weight: 500; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--divider); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-row.full { grid-template-columns: 1fr; }
.form-row.thirds { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.form-group label .req { color: var(--danger); }
.input, .select-input, .textarea-input {
  padding: 7px 10px; height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 13.5px; color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color var(--t);
  width: 100%;
}
.textarea-input { height: auto; min-height: 80px; resize: vertical; }
.input:focus, .select-input:focus, .textarea-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,112,210,0.12);
}
.input::placeholder, .textarea-input::placeholder { color: var(--text-tertiary); }
.form-hint { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; }
.form-info-box {
  background: var(--blue-light);
  border: 1px solid #99CAFF;
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 13px; color: var(--text-primary);
  display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 16px;
}
.form-info-box svg { width: 15px; height: 15px; color: var(--blue); flex-shrink: 0; margin-top: 1px; }
.form-footer {
  position: sticky; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 32px;
  display: flex; align-items: center; gap: 10px;
}

/* ── Sidebar sections in form ── */
.form-sections-nav {
  width: 200px; flex-shrink: 0;
  position: sticky; top: 80px;
}
.form-sections-label { font-size: 10px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.form-section-link {
  display: block; padding: 5px 0; font-size: 13px;
  color: var(--text-link); cursor: pointer;
}
.form-section-link:hover { text-decoration: underline; }
.form-layout { display: flex; gap: 32px; }
.form-content { flex: 1; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { opacity:0; transform:translateY(-10px); } to { opacity:1; transform:none; } }
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-header h2 { font-size: 16px; font-weight: 600; flex: 1; }
.modal-close { width: 28px; height: 28px; border-radius: var(--r-sm); border: none; background: transparent; font-size: 18px; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; transition: background var(--t); }
.modal-close:hover { background: var(--page-bg); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── KPI cards ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 400; color: var(--text-primary); line-height: 1.2; }
.kpi-value.blue  { color: var(--blue); }
.kpi-value.red   { color: var(--danger); }
.kpi-value.green { color: var(--success); }
.kpi-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 4px; }
.kpi-card.accent-top { border-top: 3px solid var(--blue); }

/* ── Detail panel ── */
.detail-panel {
  position: fixed; right: 0; top: 0;
  width: 380px; height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(0,0,0,0.1);
  z-index: 90;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.detail-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.detail-title { font-size: 16px; font-weight: 600; margin-bottom: 3px; }
.detail-sub { font-size: 12.5px; color: var(--text-secondary); }
.detail-close { margin-left: auto; background: none; border: none; font-size: 20px; color: var(--text-secondary); padding: 4px; cursor: pointer; }
.detail-field { display: flex; justify-content: space-between; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--divider); font-size: 13px; }
.detail-field:last-child { border-bottom: none; }
.detail-field-label { color: var(--text-secondary); font-weight: 500; }
.detail-field-value { color: var(--text-primary); text-align: right; max-width: 60%; }

/* ── Empty state ── */
.empty-state { padding: 60px 20px; text-align: center; color: var(--text-tertiary); }
.empty-state svg { width: 48px; height: 48px; opacity: 0.3; margin-bottom: 14px; }
.empty-state h3 { font-size: 15px; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; margin-bottom: 16px; }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1A1A2E; color: #fff;
  padding: 10px 16px; border-radius: var(--r);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  max-width: 340px;
  animation: toast-in 0.25s ease;
}
.toast-success { background: #155724; }
.toast-error   { background: #721C24; }
.toast-warning { background: #856404; }
@keyframes toast-in { from { opacity:0; transform:translateX(20px); } to { opacity:1; } }

/* ── Alerts ── */
.alert {
  padding: 12px 16px; border-radius: var(--r-sm);
  font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
  margin-bottom: 14px;
}
.alert svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: var(--info-bg);    color: #0C5460; border: 1px solid #B8DAFF; }
.alert-success { background: var(--success-bg); color: var(--status-done-text); border: 1px solid var(--status-done-border); }
.alert-warning { background: var(--warning-bg); color: var(--status-pending-text); border: 1px solid var(--status-pending-border); }
.alert-danger  { background: var(--danger-bg);  color: var(--status-overdue-text); border: 1px solid var(--status-overdue-border); }

/* ── Overdue indicator ── */
.overdue-dot { display: inline-flex; align-items: center; gap: 5px; }
.overdue-dot::before { content:''; width:10px; height:10px; background:var(--danger); border-radius:50%; flex-shrink:0; }
.overdue-text { color: var(--danger); font-weight: 500; }

/* ── Dropdown menus ── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  min-width: 160px; z-index: 50;
  overflow: hidden;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 13.5px; color: var(--text-primary);
  cursor: pointer; transition: background var(--t);
}
.dropdown-item:hover { background: var(--page-bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--divider); margin: 4px 0; }

/* ── File upload ── */
.file-drop {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  color: var(--text-secondary);
}
.file-drop:hover, .file-drop.drag { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }
.file-drop svg { width: 32px; height: 32px; margin-bottom: 8px; opacity: 0.5; }
.file-drop h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.file-drop p  { font-size: 12.5px; }

/* ── Avatars ── */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; color: #fff; }
.avatar-sm  { width: 24px; height: 24px; font-size: 10px; }
.avatar-md  { width: 32px; height: 32px; font-size: 13px; }
.avatar-lg  { width: 40px; height: 40px; font-size: 15px; }
.avatar-xl  { width: 48px; height: 48px; font-size: 18px; }
.avatar-blue   { background: var(--blue); }
.avatar-green  { background: #28A745; }
.avatar-orange { background: #FD7E14; }
.avatar-purple { background: #6F42C1; }
.avatar-teal   { background: #20C997; }

/* ── Checkboxes ── */
input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--blue);
  cursor: pointer;
}

/* ── Misc helpers ── */
.text-muted     { color: var(--text-tertiary); }
.text-secondary { color: var(--text-secondary); }
.text-primary   { color: var(--text-primary); }
.text-blue      { color: var(--blue); }
.text-red       { color: var(--danger); }
.text-green     { color: var(--success); }
.text-sm        { font-size: 12.5px; }
.text-xs        { font-size: 11.5px; }
.fw-600         { font-weight: 600; }
.d-flex         { display: flex; }
.align-center   { align-items: center; }
.gap-8          { gap: 8px; }
.gap-12         { gap: 12px; }
.ml-auto        { margin-left: auto; }
.mt-4           { margin-top: 4px; }
.mt-8           { margin-top: 8px; }
.mt-16          { margin-top: 16px; }
.mb-8           { margin-bottom: 8px; }
.mb-16          { margin-bottom: 16px; }
.tag {
  display: inline-block;
  background: var(--blue-light); color: var(--blue);
  font-size: 11.5px; font-weight: 500;
  padding: 2px 7px; border-radius: 3px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.mobile-open { transform: none; }
  #main { margin-left: 0 !important; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .form-layout { flex-direction: column; }
  .form-sections-nav { width: 100%; position: static; }
}
