/* ============================================================
   e-Parapheur — Design System
   Institutionnel sobre · Navy + blanc + teal discret
   ============================================================ */

/* === DESIGN TOKENS === */
:root {
  /* Core palette — navy institutional */
  --navy-900: #0B1F3A;
  --navy-800: #12284A;
  --navy-700: #1B3563;
  --navy-600: #2A4575;
  --navy-500: #3D5A8C;
  --navy-100: #E8EDF5;
  --navy-50:  #F2F5FA;

  /* Neutrals */
  --ink-900: #0E1420;
  --ink-700: #2B3240;
  --ink-500: #5A6475;
  --ink-400: #8892A3;
  --ink-300: #B9C0CC;
  --ink-200: #D9DEE6;
  --ink-100: #EDF0F5;
  --ink-50:  #F7F8FA;
  --white:   #FFFFFF;

  /* Accent — teal */
  --teal-700: #0A6153;
  --teal-600: #0E7C6B;
  --teal-500: #13998A;
  --teal-100: #D6EEE9;
  --teal-50:  #ECF7F5;

  /* Status */
  --warn-700: #8A5A00;
  --warn-500: #C38100;
  --warn-100: #FBEFD4;
  --danger-700: #8B1F2E;
  --danger-500: #C2384A;
  --danger-100: #F8E2E5;
  --info-700: #0E4E8A;
  --info-500: #2E78C2;
  --info-100: #DDE9F7;

  /* Legacy aliases (used by dynamic app.js HTML) */
  --primary: var(--navy-900);
  --primary-light: var(--navy-700);
  --accent: var(--teal-600);
  --accent-hover: var(--teal-700);
  --success: #0E7C6B;
  --warning: var(--warn-500);
  --danger: var(--danger-500);
  --info: var(--info-500);
  --bg: var(--ink-50);
  --surface: var(--white);
  --border: var(--ink-200);
  --text: var(--ink-900);
  --text-muted: var(--ink-500);
  --sidebar-bg: var(--navy-900);
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-active: rgba(255,255,255,0.08);
  --sidebar-text: var(--ink-300);
  --sidebar-text-active: var(--white);
  --sidebar-width: 252px;
  --topbar-height: 56px;

  /* Radii */
  --radius: 6px;
  --radius-lg: 8px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  /* Elevation */
  --shadow: 0 1px 2px rgba(11,31,58,0.06), 0 0 0 1px rgba(11,31,58,0.04);
  --shadow-lg: 0 12px 32px rgba(11,31,58,0.10), 0 0 0 1px rgba(11,31,58,0.06);
  --transition: 0.12s ease;

  /* Typography */
  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "IBM Plex Serif", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-10: 56px;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font-sans);
  background: var(--ink-50);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: var(--teal-700); text-decoration: none; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
ul { list-style: none; }

/* === SCREENS === */
.screen { display: none; }
.screen.active { display: flex; }

/* ============================================================
   LOGIN — two-column institutional layout
   ============================================================ */
#login-screen {
  min-height: 100vh;
  height: 100%;
  align-items: stretch;
  background: var(--navy-900);
}

.login-page {
  display: grid;
  grid-template-columns: 1fr 440px;
  width: 100%;
  height: 100vh;
  background: var(--navy-900);
  color: var(--white);
}

/* Hero (left panel) */
.login-hero {
  position: relative;
  padding: var(--s-8);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(900px 600px at 85% 100%, rgba(19,153,138,0.22), transparent 60%),
    radial-gradient(700px 500px at 10% 20%, rgba(42,69,117,0.5), transparent 60%),
    var(--navy-900);
  overflow: hidden;
}
.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  mask-image: radial-gradient(800px 600px at 50% 50%, #000 40%, transparent 100%);
}
.login-hero > * { position: relative; z-index: 1; }

.login-mark {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.login-mark-logo {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  background: var(--white);
  color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; letter-spacing: -0.4px;
  flex-shrink: 0;
}
.login-mark-text { display: flex; flex-direction: column; line-height: 1.1; }
.login-mark-name { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.login-mark-sub {
  font-size: 10.5px; color: rgba(255,255,255,0.55);
  text-transform: uppercase; letter-spacing: 0.14em;
}

.login-pitch { max-width: 520px; }
.login-pitch h1 {
  font-size: 36px; font-weight: 500; letter-spacing: -0.8px;
  line-height: 1.15; margin: 0 0 var(--s-4); color: var(--white);
}
.login-pitch h1 em { font-style: normal; color: var(--teal-500); }
.login-pitch p { font-size: 15px; color: rgba(255,255,255,0.65); line-height: 1.6; max-width: 480px; }

.login-feats {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: var(--s-5); margin-top: var(--s-7); max-width: 560px;
}
.login-feat { display: flex; gap: var(--s-3); align-items: flex-start; }
.login-feat-ico {
  width: 32px; height: 32px; border-radius: var(--r-md);
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: var(--teal-500); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.login-feat-txt { font-size: 13px; color: rgba(255,255,255,0.8); line-height: 1.5; }
.login-feat-txt strong { color: var(--white); font-weight: 600; display: block; margin-bottom: 2px; font-size: 13.5px; }

.login-foot {
  display: flex; gap: var(--s-5); flex-wrap: wrap;
  font-size: 11.5px; color: rgba(255,255,255,0.4); letter-spacing: 0.02em;
}
.login-foot .dot-sep { opacity: 0.4; }

/* Right panel (form) */
.login-panel {
  background: var(--white);
  color: var(--ink-900);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--s-8);
}
.login-form {
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
}
.login-panel-title {
  font-size: 24px; font-weight: 600; color: var(--navy-900);
  margin: 0 0 6px; letter-spacing: -0.4px;
}
.login-panel-sub {
  font-size: 13.5px; color: var(--ink-500);
  margin: 0 0 var(--s-6); line-height: 1.55;
}

.login-fields { display: flex; flex-direction: column; gap: var(--s-4); margin-bottom: var(--s-5); }

.login-options {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--s-5); font-size: 12.5px;
}
.checkbox {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-700); cursor: pointer; user-select: none;
}
.checkbox input {
  appearance: none; -webkit-appearance: none;
  width: 15px; height: 15px;
  border: 1px solid var(--ink-300); border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; background: var(--white); cursor: pointer;
}
.checkbox input:checked { background: var(--teal-600); border-color: var(--teal-600); }
.checkbox input:checked::after {
  content: ""; width: 8px; height: 4px;
  border-left: 1.6px solid white; border-bottom: 1.6px solid white;
  transform: rotate(-45deg) translateY(-1px);
  position: absolute;
}
.link { color: var(--teal-700); font-weight: 500; }
.link:hover { text-decoration: underline; }

.login-divider {
  display: flex; align-items: center; gap: var(--s-3);
  color: var(--ink-400); font-size: 11.5px;
  margin: var(--s-5) 0; text-transform: uppercase; letter-spacing: 0.12em;
}
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--ink-200); }

.login-alt-btns { display: flex; flex-direction: column; gap: var(--s-2); }

/* Form fields inside login */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12.5px; color: var(--ink-700); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.field-label .req { color: var(--danger-500); }
.field-hint { font-size: 11.5px; color: var(--ink-500); }

.input, .select, .textarea {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  padding: 0 var(--s-3);
  height: 38px;
  font-size: 13.5px;
  color: var(--ink-900);
  transition: border-color 0.12s, box-shadow 0.12s;
  width: 100%;
}
.textarea { height: auto; padding: var(--s-3); resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px var(--teal-50);
}
.input::placeholder { color: var(--ink-400); }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 36px; }
.input-group .input-ico {
  position: absolute; left: var(--s-3); color: var(--ink-400);
  display: flex; align-items: center; pointer-events: none;
}
.input-group .input-trail { position: absolute; right: var(--s-2); display: flex; align-items: center; gap: 4px; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app-screen {
  height: 100vh;
  width: 100%;
  overflow: hidden;
  flex-direction: row;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100%;
  width: 100%;
}
.app.collapsed { grid-template-columns: 64px 1fr; }

/* ============================================================
   SIDEBAR
   ============================================================ */
#sidebar, .sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--navy-900);
  color: var(--ink-200);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.04);
  transition: width var(--transition);
  z-index: 100;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-item span:not(.badge),
.sidebar.collapsed .user-details,
.sidebar.collapsed .sidebar-brand-text { display: none; }
.sidebar.collapsed .menu-item { justify-content: center; padding: 8px 12px; }
.sidebar.collapsed .badge { display: none; }

/* Brand */
.sidebar-header, .sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-5);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: 68px;
}
.sidebar-logo, .sidebar-brand-mark {
  width: 32px; height: 32px;
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--navy-900);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: -0.3px;
  flex-shrink: 0;
}
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidebar-brand-name { font-size: 14px; font-weight: 600; color: var(--white); letter-spacing: -0.2px; }
.sidebar-brand-sub { font-size: 11px; color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.08em; }

.sidebar-toggle {
  background: none; border: none;
  color: var(--ink-400); cursor: pointer;
  padding: 6px; border-radius: var(--r-md);
  transition: background 0.12s, color 0.12s;
  margin-left: auto;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.06); color: var(--white); }

/* Nav sections */
.sidebar-menu { flex: 1; padding: 0; overflow-y: auto; display: flex; flex-direction: column; }
.menu-section { padding: var(--s-4) var(--s-3) var(--s-2); }

.menu-label, .sidebar-section-label {
  font-size: 10.5px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0 var(--s-3) var(--s-2);
  font-weight: 500;
  display: block;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  color: var(--ink-300);
  font-size: 13.5px;
  font-weight: 450;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  position: relative;
  min-height: 36px;
  text-align: left;
  width: 100%;
  background: none;
  border: none;
  text-decoration: none;
}
.menu-item i { width: 17px; text-align: center; font-size: 15px; flex-shrink: 0; opacity: 0.9; }
.menu-item span { flex: 1; }
.menu-item:hover { background: rgba(255,255,255,0.04); color: var(--white); }
.menu-item.active { background: rgba(255,255,255,0.06); color: var(--white); }
.menu-item.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--teal-500);
  border-radius: 0 2px 2px 0;
}

/* Sidebar footer / user */
.sidebar-footer {
  margin-top: auto;
  padding: var(--s-4);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.user-info { display: flex; align-items: center; gap: var(--s-3); }
.user-avatar, .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--teal-600);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12.5px; letter-spacing: 0.3px;
  flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: 10.5px; }
.user-details { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-name { font-size: 13px; font-weight: 500; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 11.5px; color: var(--ink-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   TOPBAR
   ============================================================ */
.main-content {
  flex: 1; display: flex; flex-direction: column;
  min-height: 100vh; overflow: hidden;
}
.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--ink-200);
  display: flex; align-items: center;
  padding: 0 var(--s-6);
  gap: var(--s-4);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: var(--s-3); flex: 1; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: var(--s-2); }
.breadcrumb {
  font-size: 13.5px; font-weight: 500; color: var(--ink-700);
}
.breadcrumb .sep { color: var(--ink-300); margin: 0 4px; }
.breadcrumb .sub { font-weight: 400; color: var(--ink-500); }

.page-content { flex: 1; overflow-y: auto; padding: var(--s-7) var(--s-7) var(--s-10); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2); height: 36px; padding: 0 var(--s-4);
  border-radius: var(--r-md); font-size: 13.5px; font-weight: 500;
  transition: background 0.12s, color 0.12s, border-color 0.12s, box-shadow 0.12s;
  white-space: nowrap; border: 1px solid transparent; cursor: pointer;
  text-decoration: none;
}
.btn-sm { height: 28px; padding: 0 var(--s-3); font-size: 12.5px; }
.btn-lg { height: 44px; padding: 0 var(--s-5); font-size: 14px; }
.btn-full, .btn-block { width: 100%; justify-content: center; }

.btn-primary { background: var(--teal-600); color: var(--white); box-shadow: inset 0 -1px 0 rgba(0,0,0,0.1); }
.btn-primary:hover { background: var(--teal-700); }
.btn-success { background: var(--teal-600); color: var(--white); }
.btn-success:hover { background: var(--teal-700); }
.btn-secondary, .btn-outline {
  background: var(--white); color: var(--navy-900);
  border-color: var(--ink-200);
}
.btn-secondary:hover, .btn-outline:hover { background: var(--ink-50); border-color: var(--ink-300); }
.btn-outline-primary {
  background: transparent; border: 1px solid var(--teal-500); color: var(--teal-700);
}
.btn-outline-primary:hover { background: var(--teal-50); }
.btn-ghost { background: transparent; color: var(--ink-700); border-color: transparent; }
.btn-ghost:hover { background: var(--ink-100); color: var(--ink-900); }
.btn-navy { background: var(--navy-900); color: var(--white); }
.btn-navy:hover { background: var(--navy-800); }
.btn-danger { background: var(--white); color: var(--danger-700); border-color: var(--danger-100); }
.btn-danger:hover { background: var(--danger-100); }
.btn-warning { background: var(--warn-100); color: var(--warn-700); border-color: #F2DEA6; }
.btn-warning:hover { background: #f5e4b0; }
.btn-collab { background: var(--navy-700); color: var(--white); }
.btn-collab:hover { background: var(--navy-800); }

.btn-icon, .icon-btn {
  width: 34px; height: 34px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-500); background: none; border: none; cursor: pointer;
  position: relative; transition: background 0.12s, color 0.12s;
}
.btn-icon:hover, .icon-btn:hover { background: var(--ink-100); color: var(--ink-900); }
.icon-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px;
  background: var(--danger-500); border-radius: 50%;
  border: 1.5px solid var(--white);
}
.btn-text {
  background: none; border: none; cursor: pointer;
  color: var(--ink-500); padding: 6px; border-radius: var(--r-md);
  transition: color 0.12s;
}
.btn-text:hover { color: var(--danger-500); }
.user-avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--teal-600); color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border-radius: 10px;
  font-size: 10.5px; font-weight: 600; line-height: 1.5;
  white-space: nowrap; border: 1px solid transparent;
}
.badge-danger, .sidebar-badge { background: var(--danger-500); color: var(--white); }
.badge-success { background: var(--teal-600); color: var(--white); }
.badge-warning { background: var(--warn-500); color: var(--white); }
.badge-info { background: var(--info-500); color: var(--white); }
.badge-muted { background: var(--ink-100); color: var(--ink-700); }
.badge-primary { background: var(--navy-700); color: var(--white); }
.badge-purple { background: #6D3FA0; color: var(--white); }

/* Status pills (new design) */
.badge.neutral { background: var(--ink-100); color: var(--ink-700); }
.badge.teal { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.badge.navy { background: var(--navy-50); color: var(--navy-700); border-color: var(--navy-100); }
.badge.warn { background: var(--warn-100); color: var(--warn-700); border-color: #F2DEA6; }
.badge.danger { background: var(--danger-100); color: var(--danger-700); border-color: #EFCED3; }
.badge.info { background: var(--info-100); color: var(--info-700); border-color: #C9DCEE; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card-header, .card-head {
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--ink-100);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--ink-900); margin: 0; letter-spacing: -0.1px; }
.card-title i { color: var(--teal-600); }
.card-sub { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }
.card-body { padding: var(--s-5); }
.card-foot {
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--ink-100);
  background: var(--ink-50);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12.5px; color: var(--ink-500);
}

/* ============================================================
   STATS / KPI
   ============================================================ */
.stats-grid, .kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}
.stat-card, .kpi {
  background: var(--white);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  display: flex; flex-direction: column; gap: var(--s-3);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 3px; height: 100%; border-radius: 0;
}
.stat-card.blue::before { background: var(--teal-500); }
.stat-card.green::before { background: var(--teal-600); }
.stat-card.orange::before { background: var(--warn-500); }
.stat-card.red::before { background: var(--danger-500); }
.kpi-accent { position: absolute; top: 0; left: 0; width: 3px; height: 100%; }
.kpi-accent.teal { background: var(--teal-500); }
.kpi-accent.navy { background: var(--navy-700); }
.kpi-accent.warn { background: var(--warn-500); }
.kpi-accent.danger { background: var(--danger-500); }

.stat-icon { width: 40px; height: 40px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.stat-card.blue .stat-icon { background: var(--teal-50); color: var(--teal-600); }
.stat-card.green .stat-icon { background: var(--teal-50); color: var(--teal-600); }
.stat-card.orange .stat-icon { background: var(--warn-100); color: var(--warn-700); }
.stat-card.red .stat-icon { background: var(--danger-100); color: var(--danger-700); }

.kpi-label {
  font-size: 11.5px; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
  display: flex; align-items: center; gap: var(--s-2);
}
.stat-label { font-size: 12px; color: var(--ink-500); }
.stat-value, .kpi-value {
  font-size: 30px; font-weight: 600; color: var(--navy-900);
  line-height: 1; letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
}
.kpi-delta { font-size: 12px; color: var(--ink-500); display: flex; align-items: center; gap: var(--s-1); }
.kpi-delta.up { color: var(--teal-700); }
.kpi-delta.down { color: var(--danger-700); }

/* ============================================================
   TABLES
   ============================================================ */
.table-container { overflow-x: auto; border-radius: var(--r-md); }
table, .table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, thead tr th, th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  font-size: 11.5px; color: var(--ink-500);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
  background: var(--ink-50);
  border-bottom: 1px solid var(--ink-200);
  white-space: nowrap;
}
.table td, td {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--ink-100);
  color: var(--ink-700); vertical-align: middle;
}
.table tbody tr, tbody tr { transition: background 0.1s; }
.table tbody tr:hover, tbody tr:hover td { background: var(--ink-50); }
tbody tr:last-child td, .table tbody tr:last-child td { border-bottom: none; }
.table .cell-strong, .doc-title { color: var(--navy-900); font-weight: 500; }
.table .cell-mono, .doc-ref { font-family: var(--font-mono); font-size: 12px; color: var(--ink-500); }

/* ============================================================
   DOCUMENT LIST
   ============================================================ */
.doc-row { cursor: pointer; }
.doc-row:hover td { background: var(--ink-50); }
.doc-title-cell { display: flex; flex-direction: column; gap: 2px; }
.doc-sender { display: flex; align-items: center; gap: var(--s-2); }
.doc-sender .user-avatar { width: 24px; height: 24px; font-size: 10px; }

.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 12px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  border: 1px solid transparent;
}
.status-pending { background: var(--warn-100); color: var(--warn-700); border-color: #F2DEA6; }
.status-signed { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.status-refused { background: var(--danger-100); color: var(--danger-700); border-color: #EFCED3; }
.status-visa { background: var(--info-100); color: var(--info-700); border-color: #C9DCEE; }

.urgent-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger-500); display: inline-block; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============================================================
   FILTERS
   ============================================================ */
.filters-bar { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); flex-wrap: wrap; }
.filter-tabs { display: flex; background: var(--ink-100); border-radius: var(--r-md); padding: 2px; gap: 2px; }
.filter-tab {
  padding: 5px 12px; border-radius: 4px; border: none;
  background: none; cursor: pointer; font-size: 12.5px; font-weight: 500;
  color: var(--ink-700); transition: all 0.12s;
}
.filter-tab.active {
  background: var(--white); color: var(--navy-900);
  box-shadow: 0 1px 2px rgba(11,31,58,0.08);
}
.search-input-wrap { position: relative; flex: 1; max-width: 280px; }
.search-input-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-400); font-size: 13px; pointer-events: none; }
.search-input {
  width: 100%; padding: 8px 12px 8px 36px;
  border: 1px solid var(--ink-200); border-radius: var(--r-md);
  outline: none; background: var(--white); transition: border-color 0.12s;
  font-size: 13.5px;
}
.search-input:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px var(--teal-50); }

/* ============================================================
   CIRCUIT VISUALIZER
   ============================================================ */
.circuit-flow { display: flex; align-items: center; flex-wrap: wrap; padding: 8px 0; }
.circuit-step { display: flex; align-items: center; }
.step-node { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.step-bubble {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; border: 2px solid;
  transition: all 0.12s;
}
.step-bubble.type-visa { background: var(--info-100); border-color: var(--info-500); color: var(--info-700); }
.step-bubble.type-signature { background: var(--teal-50); border-color: var(--teal-600); color: var(--teal-700); }
.step-bubble.type-cachet { background: var(--warn-100); border-color: var(--warn-500); color: var(--warn-700); }
.step-bubble.status-done { background: var(--teal-600); border-color: var(--teal-600); color: var(--white); }
.step-bubble.status-current { box-shadow: 0 0 0 4px var(--teal-50); }
.step-label { font-size: 11px; color: var(--ink-500); text-align: center; max-width: 80px; }
.step-connector { width: 40px; height: 2px; background: var(--ink-200); position: relative; margin: 0 4px; flex-shrink: 0; }
.step-connector.done { background: var(--teal-500); }
.step-connector::after { content: '▶'; position: absolute; right: -6px; top: 50%; transform: translateY(-50%); font-size: 8px; color: inherit; }

/* ============================================================
   PDF / DOCX VIEWER
   ============================================================ */
.viewer-layout { display: flex; height: calc(100vh - var(--topbar-height) - 3rem); gap: var(--s-4); }
.viewer-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.viewer-toolbar {
  background: var(--white); border: 1px solid var(--ink-200);
  border-radius: var(--r-md) var(--r-md) 0 0; padding: 10px var(--s-4);
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
}
.toolbar-group { display: flex; align-items: center; gap: 4px; }
.toolbar-sep { width: 1px; height: 24px; background: var(--ink-200); margin: 0 4px; }
.tool-btn {
  padding: 6px 10px; border: 1px solid transparent; border-radius: var(--r-sm);
  background: none; cursor: pointer; color: var(--ink-500); transition: all 0.12s;
  font-size: 13px; display: flex; align-items: center; gap: 6px; font-weight: 500;
}
.tool-btn:hover { background: var(--ink-50); color: var(--ink-900); border-color: var(--ink-200); }
.tool-btn.active { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.zoom-display { font-size: 12.5px; font-weight: 600; color: var(--ink-700); min-width: 50px; text-align: center; }
.page-nav { display: flex; align-items: center; gap: var(--s-2); font-size: 12.5px; color: var(--ink-500); }

.viewer-doc {
  flex: 1; overflow-y: auto; background: #525659;
  border: 1px solid var(--ink-200); border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  display: flex; flex-direction: column; align-items: center;
  padding: var(--s-6); gap: var(--s-4); position: relative;
}

.pdf-page {
  background: var(--white); width: 595px; min-height: 842px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4); border-radius: 2px;
  position: relative; padding: 3rem 3.5rem;
  display: flex; flex-direction: column;
}
.pdf-page.zoom-75 { width: 446px; min-height: 632px; padding: 2.25rem 2.625rem; }
.pdf-page.zoom-125 { width: 744px; min-height: 1053px; padding: 3.75rem 4.375rem; }
.pdf-page.pdf-page-file { width: 794px; padding: 0; background: var(--white); display: block; min-height: 1040px; height: auto; }
.pdf-page.pdf-page-file.zoom-75 { width: 596px; padding: 0; min-height: 1040px; }
.pdf-page.pdf-page-file.zoom-125 { width: 992px; padding: 0; min-height: 1040px; }
.oo-inline-wrap { position: relative; width: 100%; height: 900px; background: var(--ink-50); }
.oo-inline-wrap > .oo-inline-target { position: absolute; inset: 0; width: 100%; height: 100%; }
.oo-inline-wrap > .oo-inline-loading {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: var(--ink-50); z-index: 2; pointer-events: none;
}

.docx-page { background: var(--white); padding: 96px 96px 64px 96px; }
.pdf-page.pdf-page-file.zoom-75 .docx-page { padding: 72px 72px 48px 72px; }
.pdf-page.pdf-page-file.zoom-125 .docx-page { padding: 120px 120px 80px 120px; }
.docx-render { font-family: "Calibri", "Carlito", Arial, sans-serif; font-size: 11pt; line-height: 1.5; color: #000; }
.docx-render h1, .docx-render h2, .docx-render h3 { color: #000; margin: 1rem 0 0.75rem; font-weight: 700; }
.docx-render h1 { font-size: 1.5rem; }
.docx-render h2 { font-size: 1.25rem; }
.docx-render h3 { font-size: 1.1rem; }
.docx-render h1.doc-title { text-align: center; font-size: 1.4rem; }
.docx-render p.doc-subtitle { text-align: center; color: #444; font-size: 1rem; margin-top: -0.25rem; }
.docx-render p { margin: 0 0 0.5rem; line-height: 1.5; }
.docx-render p.text-center { text-align: center; }
.docx-render p.text-right { text-align: right; }
.docx-render p.text-justify { text-align: justify; }
.docx-render table { border-collapse: collapse; margin: 0.75rem 0; width: 100%; }
.docx-render table td, .docx-render table th { border: 1px solid #999; padding: 6px 8px; vertical-align: top; }
.docx-render ul, .docx-render ol { margin: 0.5rem 0 0.5rem 1.5rem; }
.docx-render img { max-width: 100%; height: auto; display: inline-block; }
.docx-render strong { font-weight: 700; }
.docx-render em { font-style: italic; }
.docx-render mark { background: #fff59d; color: inherit; padding: 0 2px; }
.docx-render a { color: var(--teal-700); text-decoration: underline; }

/* DOCX editor */
.docx-editor-wrap { background: var(--white); }
.docx-editor-toolbar {
  display: flex; align-items: center; gap: 2px; padding: 8px 12px;
  background: var(--ink-50); border-bottom: 1px solid var(--ink-200);
  flex-wrap: wrap; position: sticky; top: 0; z-index: 10;
}
.docx-editor-toolbar button {
  padding: 5px 9px; border: 1px solid transparent; border-radius: 4px;
  background: transparent; cursor: pointer; font-size: 13px; color: var(--ink-700);
  transition: background 0.12s, border-color 0.12s; line-height: 1;
}
.docx-editor-toolbar button:hover { background: var(--ink-200); border-color: var(--ink-200); }
.docx-editor-toolbar button.active { background: var(--teal-50); border-color: var(--teal-100); color: var(--teal-700); }
.docx-editor-toolbar .tb-sep { width: 1px; height: 20px; background: var(--ink-200); margin: 0 4px; }
.docx-editor-toolbar .tb-select {
  padding: 4px 6px; border: 1px solid var(--ink-200); border-radius: 4px;
  font-size: 12.5px; background: var(--white); cursor: pointer; color: var(--ink-700);
}
.docx-editor-toolbar .tb-save {
  margin-left: auto; background: var(--teal-600) !important; color: var(--white) !important;
  border-color: var(--teal-600) !important; padding: 5px 12px !important; font-weight: 600;
}
.docx-editor-toolbar .tb-save:hover { background: var(--teal-700) !important; }
.docx-editor-toolbar .tb-saved {
  margin-left: auto; background: var(--teal-600) !important; color: var(--white) !important;
  border-color: var(--teal-600) !important; padding: 5px 12px !important; font-weight: 600;
}
.docx-editable {
  font-family: "Calibri", "Carlito", Arial, sans-serif; font-size: 11pt;
  line-height: 1.5; color: #000; outline: none;
  padding: 96px 96px 64px 96px; min-height: 900px;
  caret-color: var(--teal-600);
}
.docx-editable:focus { box-shadow: inset 0 0 0 2px rgba(14,124,107,0.15); }
.docx-editable h1, .docx-editable h2, .docx-editable h3 { color: #000; margin: 1rem 0 0.75rem; font-weight: 700; }
.docx-editable h1 { font-size: 1.5rem; }
.docx-editable h2 { font-size: 1.25rem; }
.docx-editable h3 { font-size: 1.1rem; }
.docx-editable p { margin: 0 0 0.5rem; line-height: 1.5; }
.docx-editable table { border-collapse: collapse; margin: 0.75rem 0; width: 100%; }
.docx-editable table td, .docx-editable table th { border: 1px solid #999; padding: 6px 8px; vertical-align: top; }
.docx-editable ul, .docx-editable ol { margin: 0.5rem 0 0.5rem 1.5rem; }
.docx-editable img { max-width: 100%; height: auto; }
.docx-editable strong { font-weight: 700; }
.docx-editable em { font-style: italic; }
.docx-editable mark { background: #fff59d; color: inherit; padding: 0 2px; }

.pdf-header { border-bottom: 2px solid var(--navy-700); padding-bottom: var(--s-4); margin-bottom: var(--s-6); display: flex; justify-content: space-between; align-items: flex-start; }
.pdf-org { font-size: 13px; font-weight: 700; color: var(--navy-900); }
.pdf-org-sub { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.pdf-logo-placeholder { width: 60px; height: 60px; border: 1px solid var(--ink-200); border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; color: var(--ink-400); font-size: 20px; }
.pdf-body h2 { font-size: 15px; font-weight: 700; text-align: center; color: var(--navy-900); text-transform: uppercase; letter-spacing: 1px; margin-bottom: var(--s-6); }
.pdf-body p { font-size: 13px; color: #333; line-height: 1.8; margin-bottom: 12px; text-align: justify; }
.pdf-body .article { margin: var(--s-4) 0; padding: 12px; background: var(--ink-50); border-left: 3px solid var(--teal-500); border-radius: 0 4px 4px 0; }
.pdf-footer { margin-top: auto; padding-top: var(--s-7); border-top: 1px solid var(--ink-200); display: flex; justify-content: flex-end; align-items: flex-end; }
.signature-zone {
  width: 240px; border: 1.5px dashed var(--ink-300); border-radius: var(--r-md);
  padding: 12px; text-align: center; min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; font-size: 11px; color: var(--ink-500); transition: all 0.12s; cursor: pointer; overflow: hidden;
}
.signature-zone:hover { border-color: var(--teal-600); background: var(--teal-50); }
.signature-zone.signed { border-color: var(--teal-600); background: var(--teal-50); color: var(--teal-700); }
.signature-zone img { max-width: 210px; max-height: 100px; object-fit: contain; display: block; margin: 0 auto; }
.sig-label { font-weight: 700; font-size: 12px; }

.annotation-layer { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; }
.annotation-note {
  position: absolute; background: rgba(46,120,194,0.12); border: 1.5px solid var(--info-500);
  border-radius: var(--r-sm); padding: 6px 8px; font-size: 11px; color: var(--info-700);
  max-width: 160px; pointer-events: auto; cursor: pointer;
}

/* ============================================================
   SIDE PANEL
   ============================================================ */
.viewer-panel { width: 280px; flex-shrink: 0; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.panel-section { background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-md); }
.panel-section-header {
  padding: 12px var(--s-4); font-size: 13px; font-weight: 600; color: var(--ink-900);
  border-bottom: 1px solid var(--ink-100); display: flex; align-items: center; justify-content: space-between; cursor: pointer;
}
.panel-section-header i { color: var(--teal-600); margin-right: var(--s-2); }
.panel-section-body { padding: 12px var(--s-4); }

.meta-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--ink-100); gap: var(--s-2); }
.meta-item:last-child { border-bottom: none; }
.meta-key { font-size: 12px; color: var(--ink-500); font-weight: 500; white-space: nowrap; }
.meta-value { font-size: 12px; color: var(--ink-700); font-weight: 500; text-align: right; }

.action-btns { display: flex; flex-direction: column; gap: var(--s-2); padding: 12px; }

/* ============================================================
   CIRCUIT BUILDER
   ============================================================ */
.circuit-builder { display: flex; gap: var(--s-6); }
.circuit-steps-list { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.circuit-step-item {
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-md);
  padding: var(--s-4); display: flex; align-items: center; gap: var(--s-4); transition: all 0.12s;
}
.circuit-step-item:hover { border-color: var(--teal-500); box-shadow: 0 2px 8px rgba(14,124,107,0.08); }
.step-order-badge { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--white); flex-shrink: 0; }
.step-info { flex: 1; }
.step-name { font-weight: 600; font-size: 13px; color: var(--ink-900); }
.step-user { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.step-type-badge { padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.type-visa { background: var(--info-100); color: var(--info-700); }
.type-signature { background: var(--teal-50); color: var(--teal-700); }
.type-cachet { background: var(--warn-100); color: var(--warn-700); }
.step-drag { color: var(--ink-400); cursor: grab; padding: 0 4px; }

/* ============================================================
   TRACKING TIMELINE
   ============================================================ */
.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: var(--s-4); padding: 14px 0; position: relative; }
.timeline-item:not(:last-child)::after { content: ''; position: absolute; left: 17px; top: 48px; bottom: 0; width: 1px; background: var(--ink-200); }
.timeline-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; z-index: 1; }
.timeline-icon.upload { background: var(--info-100); color: var(--info-700); }
.timeline-icon.visa { background: var(--info-100); color: var(--info-700); }
.timeline-icon.signature { background: var(--teal-50); color: var(--teal-700); }
.timeline-icon.cachet { background: var(--warn-100); color: var(--warn-700); }
.timeline-icon.refus { background: var(--danger-100); color: var(--danger-700); }
.timeline-icon.notification { background: var(--ink-100); color: var(--ink-500); }
.timeline-icon.login { background: var(--info-100); color: var(--info-700); }
.timeline-body { flex: 1; }
.timeline-title { font-weight: 600; font-size: 13px; color: var(--ink-900); }
.timeline-meta { font-size: 12px; color: var(--ink-500); margin-top: 2px; }
.timeline-comment { font-size: 13px; color: var(--ink-700); margin-top: 6px; background: var(--ink-50); padding: 8px 12px; border-radius: var(--r-sm); border-left: 2px solid var(--ink-200); }

/* Circuit timeline (new design) */
.timeline-step { display: grid; grid-template-columns: 36px 1fr; gap: var(--s-3); padding: var(--s-3) 0; position: relative; }
.timeline-step::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: -4px; width: 1px; background: var(--ink-200); }
.timeline-step:last-child::before { display: none; }
.timeline-dot { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--white); border: 1.5px solid var(--ink-200); color: var(--ink-500); font-weight: 600; font-size: 12px; z-index: 1; }
.timeline-step.done .timeline-dot { background: var(--teal-600); border-color: var(--teal-600); color: var(--white); }
.timeline-step.active .timeline-dot { border-color: var(--teal-600); color: var(--teal-700); box-shadow: 0 0 0 4px var(--teal-50); }
.timeline-step.rejected .timeline-dot { background: var(--danger-500); border-color: var(--danger-500); color: var(--white); }
.timeline-step-body { padding-bottom: var(--s-4); min-width: 0; }
.timeline-step-title { font-size: 13.5px; font-weight: 500; color: var(--ink-900); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.timeline-step-meta { font-size: 12px; color: var(--ink-500); margin-top: 2px; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(11,31,58,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-overlay.hidden { display: none; }
.modal-container { background: var(--white); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); width: 560px; max-width: calc(100vw - 2rem); max-height: calc(100vh - 4rem); display: flex; flex-direction: column; animation: modalIn 0.15s ease; }
.modal-container.modal-lg { width: 720px; }
.modal-container.modal-xl { width: 960px; }
.modal-container.modal-sm { width: 420px; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { padding: var(--s-5) var(--s-6); border-bottom: 1px solid var(--ink-200); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h3 { font-size: 15px; font-weight: 600; color: var(--ink-900); display: flex; align-items: center; gap: 10px; letter-spacing: -0.1px; }
.modal-header h3 i { color: var(--teal-600); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--ink-400); font-size: 18px; padding: 4px; border-radius: var(--r-sm); transition: all 0.12s; }
.modal-close:hover { color: var(--danger-700); background: var(--danger-100); }
.modal-body { padding: var(--s-6); overflow-y: auto; flex: 1; }
.modal-footer { padding: var(--s-4) var(--s-6); border-top: 1px solid var(--ink-200); display: flex; justify-content: flex-end; gap: 12px; flex-shrink: 0; }

/* ============================================================
   SIGNATURE PAD
   ============================================================ */
.sig-pad-container { border: 1px solid var(--ink-200); border-radius: var(--r-md); background: var(--white); overflow: hidden; cursor: crosshair; }
.sig-pad-container canvas { display: block; }
.sig-pad-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.sig-type-tabs { display: flex; gap: var(--s-2); }
.sig-type-tab { padding: 6px 12px; border: 1px solid var(--ink-200); border-radius: var(--r-md); font-size: 13px; font-weight: 500; background: none; cursor: pointer; color: var(--ink-500); transition: all 0.12s; }
.sig-type-tab.active { border-color: var(--teal-500); color: var(--teal-700); background: var(--teal-50); }

/* ============================================================
   FORMS
   ============================================================ */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.form-field, .form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-4); }
.form-field label, .form-group label { font-size: 12.5px; font-weight: 500; color: var(--ink-700); display: flex; align-items: center; gap: 6px; }
.form-group label i { color: var(--ink-400); width: 14px; }
.form-field input, .form-field select, .form-field textarea,
.form-group input, .form-group select, .form-group textarea {
  padding: 8px 12px; border: 1px solid var(--ink-200); border-radius: var(--r-md);
  outline: none; background: var(--white); transition: border-color 0.12s; font-size: 13.5px;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus,
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--teal-600); box-shadow: 0 0 0 3px var(--teal-50);
}
.form-field textarea, .form-group textarea { resize: vertical; min-height: 80px; }
.form-field .hint { font-size: 11.5px; color: var(--ink-500); }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); margin-bottom: var(--s-6); }
.admin-card { background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg); padding: var(--s-5); text-align: center; cursor: pointer; transition: all 0.12s; }
.admin-card:hover { border-color: var(--teal-500); box-shadow: 0 4px 12px rgba(14,124,107,0.1); transform: translateY(-2px); }
.admin-card-icon { width: 52px; height: 52px; border-radius: 12px; background: linear-gradient(135deg, var(--navy-800), var(--navy-600)); display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--white); margin: 0 auto 12px; }
.admin-card-title { font-weight: 600; color: var(--ink-900); font-size: 14px; }
.admin-card-desc { font-size: 12.5px; color: var(--ink-500); margin-top: 4px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-6); margin-bottom: var(--s-7);
  padding-bottom: var(--s-5); border-bottom: 1px solid var(--ink-200);
}
.page-header-left h2, .page-title {
  font-size: 22px; font-weight: 600; color: var(--navy-900);
  letter-spacing: -0.4px; margin: 0 0 4px;
}
.page-header-left p, .page-subtitle { font-size: 13.5px; color: var(--ink-500); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container { position: fixed; top: var(--s-4); right: var(--s-4); z-index: 2000; display: flex; flex-direction: column; gap: var(--s-2); pointer-events: none; }
.toast {
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  padding: 14px 18px; box-shadow: var(--shadow-lg); min-width: 280px; max-width: 380px;
  display: flex; align-items: flex-start; gap: 12px; pointer-events: auto;
  animation: toastIn 0.25s ease; border-left: 3px solid var(--info-500);
}
.toast.success { border-left-color: var(--teal-600); }
.toast.error { border-left-color: var(--danger-500); }
.toast.warning { border-left-color: var(--warn-500); }
.toast i { font-size: 15px; margin-top: 1px; flex-shrink: 0; }
.toast.success i { color: var(--teal-600); }
.toast.error i { color: var(--danger-500); }
.toast.warning i { color: var(--warn-700); }
.toast.info i { color: var(--info-500); }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 13.5px; color: var(--ink-900); }
.toast-msg { font-size: 12.5px; color: var(--ink-500); margin-top: 2px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); max-height: 0; padding: 0; margin: 0; } }

/* ============================================================
   MISC COMPONENTS
   ============================================================ */
.notification-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--danger-500); border-radius: 50%; border: 1.5px solid var(--white); }
.progress-bar { height: 6px; background: var(--ink-100); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--teal-500); transition: width 0.5s ease; }

.empty-state, .empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--s-8) var(--s-5); color: var(--ink-500); text-align: center; }
.empty-state i { font-size: 40px; margin-bottom: var(--s-4); opacity: 0.3; }
.empty-ico { width: 48px; height: 48px; margin: 0 auto var(--s-3); border-radius: 50%; background: var(--ink-100); color: var(--ink-400); display: flex; align-items: center; justify-content: center; }
.empty-state h3, .empty-title { font-size: 14px; color: var(--ink-700); font-weight: 600; margin-bottom: 4px; }
.empty-state p, .empty-sub { font-size: 12.5px; }

.upload-zone { border: 1.5px dashed var(--ink-300); border-radius: var(--r-lg); padding: var(--s-8); text-align: center; cursor: pointer; transition: all 0.12s; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--teal-600); background: var(--teal-50); }
.upload-zone i { font-size: 36px; color: var(--ink-400); margin-bottom: 12px; display: block; }
.upload-zone p { color: var(--ink-500); font-size: 13.5px; }
.upload-zone strong { color: var(--teal-700); }

.segmented { display: inline-flex; background: var(--ink-100); border-radius: var(--r-md); padding: 2px; }
.segmented button { padding: 5px 12px; font-size: 12.5px; color: var(--ink-700); border-radius: 4px; font-weight: 500; transition: background 0.12s, color 0.12s; background: none; border: none; cursor: pointer; }
.segmented button.active { background: var(--white); color: var(--navy-900); box-shadow: 0 1px 2px rgba(11,31,58,0.08); }

.tabs { display: flex; border-bottom: 1px solid var(--ink-200); margin-bottom: var(--s-5); }
.tabs button { padding: var(--s-3) var(--s-4); font-size: 13px; color: var(--ink-500); font-weight: 500; position: relative; transition: color 0.12s; background: none; border: none; cursor: pointer; }
.tabs button:hover { color: var(--ink-900); }
.tabs button.active { color: var(--navy-900); }
.tabs button.active::after { content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: -1px; height: 2px; background: var(--teal-600); }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted { color: var(--ink-500); }
.text-success { color: var(--teal-700); }
.text-danger { color: var(--danger-700); }
.text-warning { color: var(--warn-700); }
.text-accent { color: var(--teal-700); }
.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.row { display: flex; align-items: center; gap: var(--s-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.muted { color: var(--ink-500); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) { .stats-grid, .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) {
  #sidebar, .sidebar { position: fixed; left: calc(-1 * var(--sidebar-width)); top: 0; height: 100vh; transition: left 0.12s; }
  #sidebar.mobile-open, .sidebar.mobile-open { left: 0; }
  .main-content { margin-left: 0 !important; }
  .viewer-layout { flex-direction: column; height: auto; }
  .viewer-panel { width: 100%; }
  .stats-grid, .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: repeat(2, 1fr); }
  .login-page { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}
@media (max-width: 560px) {
  .stats-grid, .kpi-grid { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .page-content { padding: var(--s-4); }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-200); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }
