/* ==========================================================================
   RTIH KPI Management Platform — Design System
   Premium enterprise SaaS aesthetic (Stripe / Linear / Notion inspired)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root{
  /* --- Neutrals --- */
  --white:#FFFFFF;
  --gray-25:#FCFCFD;
  --gray-50:#F8F9FA;
  --gray-75:#F5F6F7;
  --gray-100:#F1F2F4;
  --gray-150:#E9EAEC;
  --gray-200:#E4E6EA;
  --gray-300:#D6D9DE;
  --gray-400:#B9BEC6;
  --gray-500:#8B919B;
  --gray-600:#6B717C;
  --gray-700:#4B505A;
  --gray-800:#2E323A;
  --gray-900:#15171B;

  /* --- Accent (single professional accent) --- */
  --accent-50:#EEF2FF;
  --accent-100:#E0E7FF;
  --accent-500:#4F5AED;
  --accent-600:#3F49D8;
  --accent-700:#333CB8;

  /* --- Semantic --- */
  --success-50:#ECFDF5;
  --success-600:#0F9D6E;
  --warning-50:#FFFBEB;
  --warning-600:#B7791F;
  --danger-50:#FEF2F2;
  --danger-600:#D3402E;
  --info-50:#EFF6FF;
  --info-600:#2563AE;

  /* --- Elevation --- */
  --shadow-xs: 0 1px 2px rgba(16,24,40,0.04);
  --shadow-sm: 0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
  --shadow-md: 0 4px 12px rgba(16,24,40,0.06), 0 2px 4px rgba(16,24,40,0.04);
  --shadow-lg: 0 12px 24px rgba(16,24,40,0.08), 0 4px 8px rgba(16,24,40,0.04);
  --shadow-focus: 0 0 0 4px rgba(79,90,237,0.12);

  /* --- Radius --- */
  --r-sm:8px;
  --r-md:12px;
  --r-lg:16px;
  --r-xl:20px;
  --r-full:999px;

  /* --- Spacing (8px system) --- */
  --sp-1:4px;
  --sp-2:8px;
  --sp-3:12px;
  --sp-4:16px;
  --sp-5:20px;
  --sp-6:24px;
  --sp-7:28px;
  --sp-8:32px;
  --sp-10:40px;
  --sp-12:48px;
  --sp-16:64px;

  --sidebar-w:264px;
  --topbar-h:64px;
  --transition: 180ms cubic-bezier(.4,0,.2,1);
}

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

html, body{
  height:100%;
}

body{
  margin:0;
  font-family:'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:var(--gray-50);
  color:var(--gray-800);
  font-size:14px;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  font-weight:400;
}

h1,h2,h3,h4,h5{
  margin:0;
  font-weight:600;
  color:var(--gray-900);
  letter-spacing:-0.01em;
}
h1{ font-size:24px; line-height:1.3; }
h2{ font-size:19px; line-height:1.35; }
h3{ font-size:16px; line-height:1.4; }
h4{ font-size:14px; font-weight:600; }

p{ margin:0; color:var(--gray-600); }
a{ color:inherit; text-decoration:none; }

::selection{ background:var(--accent-100); }

/* Safety net: every icon() SVG gets a sane default size unless a more
   specific component rule (e.g. .btn svg, .stat-icon svg) overrides it. */
svg{
  width:16px;
  height:16px;
  flex-shrink:0;
  vertical-align:-2.5px;
}

/* Scrollbar */
::-webkit-scrollbar{ width:8px; height:8px; }
::-webkit-scrollbar-track{ background:transparent; }
::-webkit-scrollbar-thumb{ background:var(--gray-300); border-radius:var(--r-full); }
::-webkit-scrollbar-thumb:hover{ background:var(--gray-400); }

/* ==========================================================================
   App Shell
   ========================================================================== */

.app-shell{
  display:flex;
  min-height:100vh;
}

/* --- Sidebar --- */
.sidebar{
  width:var(--sidebar-w);
  flex-shrink:0;
  background:var(--white);
  border-right:1px solid var(--gray-150);
  display:flex;
  flex-direction:column;
  position:fixed;
  top:0; left:0; bottom:0;
  z-index:40;
  transition:transform var(--transition);
}

.sidebar-brand{
  height:var(--topbar-h);
  display:flex;
  align-items:center;
  gap:var(--sp-3);
  padding:0 var(--sp-6);
  border-bottom:1px solid var(--gray-150);
  flex-shrink:0;
}

.brand-mark{
  width:32px; height:32px;
  border-radius:var(--r-sm);
  background:linear-gradient(155deg, var(--accent-500), var(--accent-700));
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-weight:700; font-size:13px;
  box-shadow: var(--shadow-sm);
  flex-shrink:0;
}

.brand-text{ display:flex; flex-direction:column; line-height:1.2; }
.brand-text strong{ font-size:14px; font-weight:600; color:var(--gray-900); }
.brand-text span{ font-size:11px; color:var(--gray-500); }

.sidebar-scope{
  padding:var(--sp-5) var(--sp-6) var(--sp-3);
}
.scope-label{
  font-size:10.5px;
  text-transform:uppercase;
  letter-spacing:0.06em;
  color:var(--gray-400);
  font-weight:600;
  margin-bottom:var(--sp-2);
}
.scope-value{
  display:flex; align-items:center; gap:var(--sp-2);
  font-size:13px; font-weight:500; color:var(--gray-800);
  background:var(--gray-50);
  border:1px solid var(--gray-150);
  border-radius:var(--r-sm);
  padding:var(--sp-2) var(--sp-3);
}
.scope-value .dot{ width:7px; height:7px; border-radius:50%; background:var(--success-600); flex-shrink:0; }

.sidebar-nav{
  flex:1;
  overflow-y:auto;
  padding:var(--sp-2) var(--sp-4) var(--sp-4);
}

.nav-group{ margin-top:var(--sp-5); }
.nav-group:first-child{ margin-top:0; }
.nav-group-label{
  font-size:10.5px;
  text-transform:uppercase;
  letter-spacing:0.06em;
  color:var(--gray-400);
  font-weight:600;
  padding:0 var(--sp-3);
  margin-bottom:var(--sp-2);
}

.nav-item{
  display:flex;
  align-items:center;
  gap:var(--sp-3);
  padding:var(--sp-2) var(--sp-3);
  border-radius:var(--r-sm);
  color:var(--gray-600);
  font-size:13.5px;
  font-weight:500;
  margin-bottom:2px;
  transition:background var(--transition), color var(--transition);
  position:relative;
}
.nav-item svg{ width:18px; height:18px; flex-shrink:0; opacity:0.85; }
.nav-item:hover{ background:var(--gray-50); color:var(--gray-900); }
.nav-item.active{
  background:var(--accent-50);
  color:var(--accent-700);
  font-weight:600;
}
.nav-item.active svg{ opacity:1; }
.nav-item .nav-badge{
  margin-left:auto;
  font-size:11px;
  font-weight:600;
  background:var(--danger-50);
  color:var(--danger-600);
  border-radius:var(--r-full);
  padding:1px 7px;
}
.nav-item.active .nav-badge{ background:var(--accent-100); color:var(--accent-700); }

.sidebar-foot{
  border-top:1px solid var(--gray-150);
  padding:var(--sp-4) var(--sp-5);
  display:flex;
  align-items:center;
  gap:var(--sp-3);
}
.avatar{
  width:36px; height:36px;
  border-radius:50%;
  background:var(--gray-100);
  color:var(--gray-700);
  display:flex; align-items:center; justify-content:center;
  font-weight:600; font-size:13px;
  flex-shrink:0;
  border:1px solid var(--gray-200);
}
.user-meta{ line-height:1.25; overflow:hidden; }
.user-meta strong{ display:block; font-size:13px; color:var(--gray-900); font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-meta span{ font-size:11.5px; color:var(--gray-500); }
.icon-btn-ghost{
  margin-left:auto;
  width:30px; height:30px;
  border-radius:var(--r-sm);
  display:flex; align-items:center; justify-content:center;
  color:var(--gray-500);
  border:1px solid transparent;
  flex-shrink:0;
}
.icon-btn-ghost:hover{ background:var(--gray-50); border-color:var(--gray-150); color:var(--gray-800); }
.icon-btn-ghost svg{ width:16px; height:16px; }

/* --- Main column --- */
.main-col{
  margin-left:var(--sidebar-w);
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
}

.topbar{
  height:var(--topbar-h);
  background:rgba(255,255,255,0.85);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--gray-150);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 var(--sp-8);
  position:sticky;
  top:0;
  z-index:30;
}

.topbar-left{ display:flex; flex-direction:column; }
.topbar-eyebrow{ font-size:11.5px; color:var(--gray-500); font-weight:500; }
.topbar-title{ font-size:16px; font-weight:600; color:var(--gray-900); }

.topbar-right{ display:flex; align-items:center; gap:var(--sp-4); }

.deadline-chip{
  display:flex; align-items:center; gap:var(--sp-2);
  background:var(--warning-50);
  color:var(--warning-600);
  border:1px solid #FBE8C6;
  border-radius:var(--r-full);
  padding:6px 14px;
  font-size:12.5px;
  font-weight:600;
}
.deadline-chip svg{ width:14px; height:14px; }

.icon-btn{
  width:36px; height:36px;
  border-radius:var(--r-sm);
  border:1px solid var(--gray-200);
  background:var(--white);
  display:flex; align-items:center; justify-content:center;
  color:var(--gray-600);
  position:relative;
  transition:all var(--transition);
}
.icon-btn:hover{ border-color:var(--gray-300); color:var(--gray-900); box-shadow:var(--shadow-xs); }
.icon-btn svg{ width:17px; height:17px; }
.icon-btn .ping{
  position:absolute; top:-3px; right:-3px;
  width:9px; height:9px; border-radius:50%;
  background:var(--danger-600);
  border:2px solid var(--white);
}

/* User menu (topbar) */
.user-menu{ position:relative; }
.user-menu-trigger{
  display:flex; align-items:center; gap:6px;
  background:transparent; border:1px solid transparent;
  padding:4px 8px 4px 4px; border-radius:var(--r-full);
  cursor:pointer; transition:all var(--transition);
}
.user-menu-trigger:hover{ background:var(--gray-50); border-color:var(--gray-150); }
.user-menu-trigger svg{ width:15px; height:15px; color:var(--gray-500); }
.user-menu-dropdown{
  position:absolute; top:calc(100% + 10px); right:0;
  width:260px;
  background:var(--white);
  border:1px solid var(--gray-150);
  border-radius:var(--r-md);
  box-shadow:var(--shadow-lg);
  padding:var(--sp-4);
  display:none;
  z-index:60;
}
.user-menu-dropdown.open{ display:block; }
.user-menu-header{ display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.user-menu-role{ margin-bottom:2px; }
.user-menu-item{
  display:flex; align-items:center; gap:10px;
  padding:9px 10px; border-radius:var(--r-sm);
  font-size:13px; font-weight:500; color:var(--gray-700);
  transition:background var(--transition);
}
.user-menu-item svg{ width:16px; height:16px; color:var(--gray-500); }
.user-menu-item:hover{ background:var(--gray-50); }
.user-menu-item.danger{ color:var(--danger-600); }
.user-menu-item.danger svg{ color:var(--danger-600); }
.user-menu-item.danger:hover{ background:var(--danger-50); }

.content{
  padding:var(--sp-8);
  max-width:1400px;
  width:100%;
  margin:0 auto;
}

/* Page header inside content */
.page-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  margin-bottom:var(--sp-7);
  gap:var(--sp-6);
  flex-wrap:wrap;
}
.page-header .subtitle{ margin-top:4px; font-size:13.5px; color:var(--gray-500); }
.page-header-actions{ display:flex; gap:var(--sp-3); flex-shrink:0; }

.breadcrumb{
  display:flex; align-items:center; gap:6px;
  font-size:12.5px; color:var(--gray-500);
  margin-bottom:var(--sp-3);
}
.breadcrumb .sep{ color:var(--gray-300); }
.breadcrumb .current{ color:var(--gray-800); font-weight:500; }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  height:38px;
  padding:0 16px;
  border-radius:var(--r-sm);
  font-size:13.5px;
  font-weight:600;
  border:1px solid transparent;
  cursor:pointer;
  transition:all var(--transition);
  white-space:nowrap;
  line-height:1;
}
.btn svg{ width:16px; height:16px; }
.btn:focus-visible{ box-shadow:var(--shadow-focus); outline:none; }

.btn-primary{
  background:var(--accent-500);
  color:#fff;
  box-shadow:var(--shadow-sm);
}
.btn-primary:hover{ background:var(--accent-600); box-shadow:var(--shadow-md); transform:translateY(-1px); }
.btn-primary:active{ transform:translateY(0); }

.btn-secondary{
  background:var(--white);
  color:var(--gray-700);
  border-color:var(--gray-200);
}
.btn-secondary:hover{ border-color:var(--gray-300); color:var(--gray-900); box-shadow:var(--shadow-xs); }

.btn-ghost{
  background:transparent;
  color:var(--gray-600);
}
.btn-ghost:hover{ background:var(--gray-100); color:var(--gray-900); }

.btn-danger-ghost{
  background:var(--danger-50);
  color:var(--danger-600);
}
.btn-danger-ghost:hover{ background:#FCE4E1; }

.btn-sm{ height:32px; padding:0 12px; font-size:12.5px; }
.btn-block{ width:100%; }
.btn[disabled]{ opacity:0.5; cursor:not-allowed; }

/* ==========================================================================
   Cards
   ========================================================================== */

.card{
  background:var(--white);
  border:1px solid var(--gray-150);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-xs);
  transition: box-shadow var(--transition), transform var(--transition);
}
.card-pad{ padding:var(--sp-6); }
.card-hover:hover{ box-shadow:var(--shadow-md); }

.card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:var(--sp-5) var(--sp-6);
  border-bottom:1px solid var(--gray-150);
}
.card-header h3{ font-size:15px; }
.card-header .muted{ font-size:12.5px; color:var(--gray-500); margin-top:2px; }
.card-body{ padding:var(--sp-6); }
.card-body.tight{ padding:var(--sp-4) var(--sp-6); }

/* Grid */
.grid{ display:grid; gap:var(--sp-6); }
.grid-4{ grid-template-columns:repeat(4,1fr); }
.grid-3{ grid-template-columns:repeat(3,1fr); }
.grid-2{ grid-template-columns:repeat(2,1fr); }
.grid-12{ grid-template-columns:repeat(12,1fr); }
.col-span-8{ grid-column:span 8; }
.col-span-7{ grid-column:span 7; }
.col-span-5{ grid-column:span 5; }
.col-span-4{ grid-column:span 4; }
.col-span-6{ grid-column:span 6; }
.col-span-12{ grid-column:span 12; }

@media (max-width:1180px){
  .grid-4{ grid-template-columns:repeat(2,1fr); }
  .grid-3{ grid-template-columns:repeat(1,1fr); }
  .col-span-8, .col-span-7, .col-span-5, .col-span-4, .col-span-6{ grid-column:span 12; }
}

/* ==========================================================================
   KPI stat cards
   ========================================================================== */

.stat-card{
  background:var(--white);
  border:1px solid var(--gray-150);
  border-radius:var(--r-lg);
  padding:var(--sp-5) var(--sp-6);
  box-shadow:var(--shadow-xs);
  transition:box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover{ box-shadow:var(--shadow-md); transform:translateY(-2px); }
.stat-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:var(--sp-4); }
.stat-icon{
  width:34px; height:34px;
  border-radius:var(--r-sm);
  display:flex; align-items:center; justify-content:center;
  background:var(--accent-50);
  color:var(--accent-600);
}
.stat-icon svg{ width:17px; height:17px; }
.stat-label{ font-size:12.5px; color:var(--gray-500); font-weight:500; }
.stat-value{ font-size:26px; font-weight:700; color:var(--gray-900); letter-spacing:-0.02em; margin-top:2px; }
.stat-value .unit{ font-size:14px; font-weight:500; color:var(--gray-500); margin-left:4px; }
.stat-delta{
  display:inline-flex; align-items:center; gap:4px;
  font-size:12px; font-weight:600;
  margin-top:var(--sp-3);
  padding:2px 0;
}
.stat-delta svg{ width:12px; height:12px; }
.delta-up{ color:var(--success-600); }
.delta-down{ color:var(--danger-600); }
.delta-flat{ color:var(--gray-500); }
.stat-delta .vs{ color:var(--gray-400); font-weight:500; margin-left:2px; }

/* ==========================================================================
   Badges / Pills / Tags
   ========================================================================== */

.badge{
  display:inline-flex;
  align-items:center;
  gap:5px;
  font-size:11.5px;
  font-weight:600;
  padding:3px 10px;
  border-radius:var(--r-full);
  border:1px solid transparent;
  white-space:nowrap;
}
.badge svg{ width:11px; height:11px; }
.badge-dot::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }

.badge-neutral{ background:var(--gray-100); color:var(--gray-600); }
.badge-success{ background:var(--success-50); color:var(--success-600); border-color:#D3F1E4; }
.badge-warning{ background:var(--warning-50); color:var(--warning-600); border-color:#FBE8C6; }
.badge-danger{ background:var(--danger-50); color:var(--danger-600); border-color:#FAD9D5; }
.badge-info{ background:var(--info-50); color:var(--info-600); border-color:#D6E6FA; }
.badge-accent{ background:var(--accent-50); color:var(--accent-700); border-color:var(--accent-100); }

/* ==========================================================================
   Progress
   ========================================================================== */

.progress-track{
  width:100%; height:8px;
  background:var(--gray-100);
  border-radius:var(--r-full);
  overflow:hidden;
}
.progress-fill{
  height:100%;
  background:linear-gradient(90deg, var(--accent-500), var(--accent-600));
  border-radius:var(--r-full);
  transition:width 400ms ease;
}
.progress-fill.success{ background:linear-gradient(90deg,#18B37E,var(--success-600)); }
.progress-fill.warning{ background:linear-gradient(90deg,#E0A83B,var(--warning-600)); }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap{
  overflow-x:auto;
  border-radius:var(--r-lg);
}
table.data-table{
  width:100%;
  border-collapse:collapse;
  font-size:13.5px;
  min-width:640px;
}
.data-table thead th{
  position:sticky; top:0;
  background:var(--gray-50);
  text-align:left;
  font-size:11.5px;
  text-transform:uppercase;
  letter-spacing:0.04em;
  font-weight:600;
  color:var(--gray-500);
  padding:var(--sp-3) var(--sp-5);
  border-bottom:1px solid var(--gray-150);
  white-space:nowrap;
}
.data-table tbody td{
  padding:var(--sp-4) var(--sp-5);
  border-bottom:1px solid var(--gray-100);
  color:var(--gray-700);
  vertical-align:middle;
}
.data-table tbody tr:last-child td{ border-bottom:none; }
.data-table tbody tr:nth-child(even){ background:var(--gray-25); }
.data-table tbody tr:hover{ background:var(--accent-50); }
.data-table td.num{ text-align:right; font-variant-numeric:tabular-nums; }
.data-table td.strong{ font-weight:600; color:var(--gray-900); }
.data-table .row-code{
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size:12px; color:var(--gray-500); font-weight:600;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-grid{ display:grid; grid-template-columns:repeat(2,1fr); gap:var(--sp-5) var(--sp-6); }
.field{ display:flex; flex-direction:column; gap:6px; }
.field.full{ grid-column:1/-1; }
.field label{ font-size:12.5px; font-weight:600; color:var(--gray-700); display:flex; align-items:center; gap:6px; }
.field label .req{ color:var(--danger-600); }
.field label .opt{ font-weight:500; color:var(--gray-400); }
.hint{ font-size:12px; color:var(--gray-500); }

.input, select.input, textarea.input{
  width:100%;
  height:40px;
  padding:0 var(--sp-4);
  border:1px solid var(--gray-200);
  border-radius:var(--r-sm);
  background:var(--white);
  font-family:inherit;
  font-size:13.5px;
  color:var(--gray-900);
  transition:border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
textarea.input{ height:auto; padding:var(--sp-3) var(--sp-4); resize:vertical; line-height:1.5; }
.input::placeholder{ color:var(--gray-400); }
.input:hover{ border-color:var(--gray-300); }
.input:focus{ outline:none; border-color:var(--accent-500); box-shadow:var(--shadow-focus); }
.input:disabled, .input.readonly{ background:var(--gray-50); color:var(--gray-500); border-color:var(--gray-150); cursor:not-allowed; }
.input.has-error{ border-color:var(--danger-600); }
.input.has-error:focus{ box-shadow:0 0 0 4px rgba(211,64,46,0.12); }

.input-group{ position:relative; display:flex; align-items:center; }
.input-group .prefix{
  position:absolute; left:14px; font-size:13px; color:var(--gray-500); font-weight:500; pointer-events:none;
}
.input-group .input{ padding-left:30px; }
.input-group .suffix-icon{ position:absolute; right:12px; color:var(--gray-400); display:flex; }
.input-group .suffix-icon svg{ width:16px; height:16px; }

.error-msg{ display:flex; align-items:center; gap:5px; font-size:12px; color:var(--danger-600); font-weight:500; }
.error-msg svg{ width:13px; height:13px; flex-shrink:0; }
.success-msg{ display:flex; align-items:center; gap:5px; font-size:12px; color:var(--success-600); font-weight:500; }

.upload-zone{
  border:1.5px dashed var(--gray-250, var(--gray-300));
  border-radius:var(--r-md);
  padding:var(--sp-4);
  display:flex;
  align-items:center;
  gap:var(--sp-3);
  background:var(--gray-25);
  transition:all var(--transition);
}
.upload-zone:hover{ border-color:var(--accent-500); background:var(--accent-50); }
.upload-zone .u-icon{
  width:36px; height:36px; border-radius:var(--r-sm);
  background:var(--white); border:1px solid var(--gray-200);
  display:flex; align-items:center; justify-content:center; color:var(--gray-500); flex-shrink:0;
}
.upload-zone .u-icon svg{ width:16px; height:16px; }
.upload-zone .u-text{ font-size:12.5px; }
.upload-zone .u-text strong{ color:var(--accent-600); font-weight:600; }
.upload-zone .u-text span{ display:block; color:var(--gray-500); margin-top:1px; }

.evidence-chip{
  display:inline-flex; align-items:center; gap:6px;
  background:var(--success-50); color:var(--success-600);
  border:1px solid #D3F1E4;
  padding:5px 10px 5px 8px;
  border-radius:var(--r-full);
  font-size:12px; font-weight:600;
}
.evidence-chip svg{ width:13px; height:13px; }

/* Toggle switch */
.toggle-switch{ position:relative; display:inline-block; width:38px; height:22px; flex-shrink:0; }
.toggle-switch input{ opacity:0; width:0; height:0; }
.toggle-slider{
  position:absolute; cursor:pointer; inset:0;
  background:var(--gray-200); border-radius:var(--r-full);
  transition:background var(--transition);
}
.toggle-slider::before{
  content:''; position:absolute; height:16px; width:16px; left:3px; top:3px;
  background:#fff; border-radius:50%; transition:transform var(--transition);
  box-shadow:var(--shadow-xs);
}
.toggle-switch input:checked + .toggle-slider{ background:var(--accent-500); }
.toggle-switch input:checked + .toggle-slider::before{ transform:translateX(16px); }

/* Checkbox / toggle-ish */
.check-row{ display:flex; align-items:center; gap:10px; padding:10px 0; }
.check-row input[type=checkbox]{
  width:18px; height:18px; accent-color:var(--accent-500); border-radius:4px; cursor:pointer;
}
.check-row label{ font-size:13.5px; color:var(--gray-700); font-weight:500; }

/* ==========================================================================
   Stepper (weekly report sections)
   ========================================================================== */

.stepper{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.step-item{
  display:flex;
  align-items:center;
  gap:var(--sp-3);
  padding:var(--sp-3) var(--sp-3);
  border-radius:var(--r-sm);
  cursor:pointer;
  transition:background var(--transition);
  position:relative;
}
.step-item:hover{ background:var(--gray-50); }
.step-item.active{ background:var(--accent-50); }
.step-num{
  width:26px; height:26px;
  border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:11.5px; font-weight:700;
  background:var(--gray-100); color:var(--gray-500);
  flex-shrink:0;
  border:1px solid var(--gray-200);
}
.step-item.active .step-num{ background:var(--accent-500); color:#fff; border-color:var(--accent-500); }
.step-item.complete .step-num{ background:var(--success-50); color:var(--success-600); border-color:#D3F1E4; }
.step-item.complete .step-num svg{ width:13px; height:13px; }
.step-label{ flex:1; min-width:0; }
.step-label strong{ display:block; font-size:13px; font-weight:600; color:var(--gray-800); }
.step-item.active .step-label strong{ color:var(--accent-700); }
.step-label span{ font-size:11.5px; color:var(--gray-500); }
.step-flag{ width:8px; height:8px; border-radius:50%; background:var(--warning-600); flex-shrink:0; }

/* Section content header inside form card */
.section-title-row{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:var(--sp-1);
}
.section-code-badge{
  display:inline-flex; align-items:center; justify-content:center;
  width:30px; height:30px; border-radius:var(--r-sm);
  background:var(--gray-900); color:#fff; font-size:12px; font-weight:700;
  flex-shrink:0;
}

/* ==========================================================================
   Tabs
   ========================================================================== */

.tabs{
  display:flex;
  gap:var(--sp-1);
  border-bottom:1px solid var(--gray-150);
  padding:0 var(--sp-2);
}
.tab-item{
  padding:var(--sp-3) var(--sp-4);
  font-size:13.5px; font-weight:600; color:var(--gray-500);
  border-bottom:2px solid transparent;
  margin-bottom:-1px;
  cursor:pointer;
  transition:color var(--transition);
}
.tab-item:hover{ color:var(--gray-800); }
.tab-item.active{ color:var(--accent-700); border-bottom-color:var(--accent-500); }

/* ==========================================================================
   Timeline (history)
   ========================================================================== */

.timeline{ position:relative; padding-left:var(--sp-2); }
.timeline-item{
  display:flex; gap:var(--sp-4);
  padding-bottom:var(--sp-6);
  position:relative;
}
.timeline-item:last-child{ padding-bottom:0; }
.timeline-item::before{
  content:'';
  position:absolute;
  left:15px; top:32px; bottom:-4px;
  width:1.5px;
  background:var(--gray-150);
}
.timeline-item:last-child::before{ display:none; }
.timeline-dot{
  width:32px; height:32px; border-radius:50%;
  background:var(--white); border:1.5px solid var(--gray-200);
  display:flex; align-items:center; justify-content:center;
  flex-shrink:0; z-index:1; color:var(--gray-500);
}
.timeline-dot svg{ width:15px; height:15px; }
.timeline-dot.success{ background:var(--success-50); border-color:#D3F1E4; color:var(--success-600); }
.timeline-dot.danger{ background:var(--danger-50); border-color:#FAD9D5; color:var(--danger-600); }
.timeline-dot.accent{ background:var(--accent-50); border-color:var(--accent-100); color:var(--accent-600); }
.timeline-content{ flex:1; padding-top:5px; }
.timeline-content .t-head{ display:flex; align-items:center; justify-content:space-between; gap:var(--sp-3); }
.timeline-content h4{ font-size:13.5px; }
.timeline-content .t-time{ font-size:12px; color:var(--gray-400); white-space:nowrap; }
.timeline-content p{ font-size:12.5px; margin-top:3px; }

/* ==========================================================================
   Chart helpers (pure SVG, no libs)
   ========================================================================== */

.chart-card .card-body{ padding-top:var(--sp-4); }
.chart-legend{ display:flex; gap:var(--sp-5); margin-bottom:var(--sp-4); flex-wrap:wrap; }
.legend-item{ display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--gray-600); font-weight:500; }
.legend-swatch{ width:10px; height:10px; border-radius:3px; }

.sparkline-row{ display:flex; align-items:center; gap:var(--sp-4); }
.sparkline-row svg{ flex-shrink:0; }

/* ==========================================================================
   Empty states / misc
   ========================================================================== */

.empty-state{
  text-align:center;
  padding:var(--sp-12) var(--sp-6);
  color:var(--gray-500);
}
.empty-state .e-icon{
  width:52px; height:52px; border-radius:50%;
  background:var(--gray-50); border:1px solid var(--gray-150);
  display:flex; align-items:center; justify-content:center;
  margin:0 auto var(--sp-4);
  color:var(--gray-400);
}
.empty-state .e-icon svg{ width:24px; height:24px; }
.empty-state h4{ color:var(--gray-700); margin-bottom:4px; }
.empty-state p{ font-size:13px; max-width:340px; margin:0 auto; }

.divider{ height:1px; background:var(--gray-150); border:none; margin:var(--sp-6) 0; }

.kicker{ font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; color:var(--accent-600); margin-bottom:6px; }

.tooltip-note{
  font-size:12px; color:var(--gray-500); display:flex; gap:6px; align-items:flex-start;
  background:var(--gray-50); border:1px solid var(--gray-150); border-radius:var(--r-md); padding:var(--sp-3) var(--sp-4);
}
.tooltip-note svg{ width:15px; height:15px; flex-shrink:0; margin-top:1px; color:var(--gray-400); }

/* Section nav pill list (evidence checklist etc.) */
.list-row{
  display:flex; align-items:center; justify-content:space-between;
  padding:var(--sp-3) 0;
  border-bottom:1px solid var(--gray-100);
}
.list-row:last-child{ border-bottom:none; }
.list-row-left{ display:flex; align-items:center; gap:var(--sp-3); }
.list-row-icon{
  width:32px; height:32px; border-radius:var(--r-sm);
  background:var(--gray-50); border:1px solid var(--gray-150);
  display:flex; align-items:center; justify-content:center; color:var(--gray-500); flex-shrink:0;
}
.list-row-icon svg{ width:15px; height:15px; }
.list-row-title{ font-size:13.5px; font-weight:600; color:var(--gray-800); }
.list-row-sub{ font-size:12px; color:var(--gray-500); }

/* ==========================================================================
   Hub verification workspace
   ========================================================================== */

.verify-row{
  border:1px solid var(--gray-150);
  border-radius:var(--r-md);
  padding:var(--sp-5);
  margin-bottom:var(--sp-4);
  transition:box-shadow var(--transition), border-color var(--transition);
}
.verify-row:hover{ box-shadow:var(--shadow-sm); }
.verify-row.is-resolved{ opacity:0.6; }
.verify-row-top{ display:flex; align-items:flex-start; justify-content:space-between; gap:var(--sp-4); margin-bottom:var(--sp-3); }
.verify-row-id{ display:flex; align-items:center; gap:8px; margin-bottom:3px; }
.verify-row-id .row-code{ font-family:ui-monospace,'SF Mono',Menlo,monospace; font-size:12px; font-weight:700; color:var(--gray-500); }
.verify-row-meta{ font-size:12px; color:var(--gray-500); }
.verify-row-values{ display:flex; gap:var(--sp-6); margin:var(--sp-3) 0; flex-wrap:wrap; }
.verify-row-value-block .k{ font-size:11px; color:var(--gray-500); font-weight:600; text-transform:uppercase; letter-spacing:.04em; margin-bottom:3px; }
.verify-row-value-block .v{ font-size:13.5px; font-weight:600; color:var(--gray-900); }
.verify-ai-note{
  display:flex; gap:8px; align-items:flex-start;
  font-size:12.5px; color:var(--gray-700);
  background:var(--gray-25); border:1px solid var(--gray-150); border-radius:var(--r-sm);
  padding:var(--sp-3); margin-bottom:var(--sp-3);
}
.verify-ai-note.risk-high{ background:var(--danger-50); border-color:#FAD9D5; }
.verify-ai-note.risk-medium{ background:var(--warning-50); border-color:#FBE8C6; }
.verify-ai-note svg{ width:14px; height:14px; flex-shrink:0; margin-top:1px; }
.verify-row-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.verify-row-panel{
  margin-top:var(--sp-3);
  background:var(--gray-25);
  border:1px solid var(--gray-150);
  border-radius:var(--r-sm);
  padding:var(--sp-4);
}
.verify-row-panel .panel-actions{ display:flex; gap:8px; margin-top:10px; }
.verify-row-result{
  display:flex; align-items:center; gap:8px;
  font-size:13px; font-weight:600;
  padding:10px 12px; border-radius:var(--r-sm); margin-top:var(--sp-3);
}
.verify-row-result svg{ width:15px; height:15px; }
.verify-row-result.accepted{ background:var(--success-50); color:var(--success-600); }
.verify-row-result.rejected{ background:var(--danger-50); color:var(--danger-600); }
.verify-row-result.correction{ background:var(--warning-50); color:var(--warning-600); }

.spoke-tabs{ display:flex; gap:8px; margin-bottom:24px; flex-wrap:wrap; }
.spoke-tab{
  display:flex; align-items:center; gap:8px;
  padding:9px 16px; border-radius:var(--r-full);
  border:1px solid var(--gray-200); background:var(--white);
  font-size:13px; font-weight:600; color:var(--gray-600);
  transition:all var(--transition);
}
.spoke-tab:hover{ border-color:var(--gray-300); color:var(--gray-900); }
.spoke-tab.active{ background:var(--gray-900); border-color:var(--gray-900); color:#fff; }
.spoke-tab .count{
  font-size:11px; font-weight:700; padding:1px 7px; border-radius:var(--r-full);
  background:var(--gray-100); color:var(--gray-600);
}
.spoke-tab.active .count{ background:rgba(255,255,255,0.18); color:#fff; }

/* Footer bar inside forms */
.form-actions-bar{
  position:sticky;
  bottom:0;
  background:rgba(255,255,255,0.9);
  backdrop-filter:blur(8px);
  border-top:1px solid var(--gray-150);
  padding:var(--sp-4) var(--sp-6);
  display:flex;
  align-items:center;
  justify-content:space-between;
  border-radius:0 0 var(--r-lg) var(--r-lg);
}
.autosave-note{ display:flex; align-items:center; gap:6px; font-size:12px; color:var(--gray-500); }
.autosave-note svg{ width:14px; height:14px; color:var(--success-600); }

/* Responsive */
@media (max-width: 960px){
  .sidebar{ transform:translateX(-100%); }
  .sidebar.open{ transform:translateX(0); box-shadow:var(--shadow-lg); }
  .main-col{ margin-left:0; }
  .content{ padding:var(--sp-5); }
  .topbar{ padding:0 var(--sp-4); }
  .form-grid{ grid-template-columns:1fr; }
}
