/* =========================================================
   ETRUSURE Design System v1.0
   Programmable Guarantees. Verifiable Trust.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=Fraunces:opsz,wght@9..144,500;9..144,600&display=swap');

:root {
  /* ---------- Colors: Neutrals ---------- */
  --bg:              #FAFAF7;         /* app background */
  --bg-elevated:     #FFFFFF;         /* cards */
  --bg-sunken:       #F4F3EE;         /* subtle inset */
  --bg-sidebar:      #FBFAF5;         /* sidebar */
  --bg-hover:        #F1EFE7;
  --bg-selected:     #EDEBE0;

  --ink-1:           #1A1D1A;         /* primary text */
  --ink-2:           #4A4E48;         /* secondary text */
  --ink-3:           #7A7D74;         /* tertiary / labels */
  --ink-4:           #A8AAA0;         /* placeholder / muted */
  --ink-inverse:     #FAFAF7;

  --border:          #E4E1D4;         /* default border */
  --border-strong:   #C9C5B4;
  --border-soft:     #EEECE2;

  /* ---------- Colors: Brand olive ---------- */
  --olive-50:        #F3F5EA;
  --olive-100:       #E6EAD2;
  --olive-200:       #C9D19E;
  --olive-500:       #7A8A4A;
  --olive-600:       #5B6B3A;         /* PRIMARY */
  --olive-700:       #47542C;
  --olive-800:       #364020;

  /* ---------- Colors: Status ---------- */
  --success:         #3B7A4B;
  --success-bg:      #E8F1E9;
  --success-border:  #C6DDC9;

  --warning:         #A67019;
  --warning-bg:      #FBF1DE;
  --warning-border:  #ECD7A8;

  --pending:         #4A5A6E;
  --pending-bg:      #ECEFF3;
  --pending-border:  #D3D9E1;

  --danger:          #94322B;
  --danger-bg:       #F6E4E2;
  --danger-border:   #E5C1BD;

  --info:            #2D5F7A;
  --info-bg:         #E3EDF3;
  --info-border:     #BFD3DE;

  --trust:           #3B5C7A;         /* blockchain / verified accent */
  --trust-bg:        #E5ECF3;

  --esg:             #4A7A4B;         /* ESG green */
  --esg-bg:          #E7F0E4;

  /* ---------- Type ---------- */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', ui-monospace, monospace;
  --font-display: 'Fraunces', 'Inter', serif;

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

  /* ---------- Radius ---------- */
  --r-sm: 3px;
  --r:    5px;
  --r-md: 8px;
  --r-lg: 12px;

  /* ---------- Shadow ---------- */
  --shadow-1: 0 1px 2px rgba(20, 22, 18, 0.04);
  --shadow-2: 0 2px 8px rgba(20, 22, 18, 0.06), 0 0 0 1px rgba(20, 22, 18, 0.02);
  --shadow-3: 0 8px 24px rgba(20, 22, 18, 0.10), 0 2px 6px rgba(20, 22, 18, 0.06);
  --shadow-focus: 0 0 0 3px rgba(91, 107, 58, 0.18);

  /* ---------- Layout ---------- */
  --sidebar-w: 240px;
  --topbar-h:  56px;
}

/* =========================================================
   Reset + base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-1);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01", "ss03";
}

a { color: var(--olive-600); text-decoration: none; }
a:hover { color: var(--olive-700); }

button { font-family: inherit; cursor: pointer; }

/* =========================================================
   Typography
   ========================================================= */
.t-h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--ink-1); margin: 0; }
.t-h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; color: var(--ink-1); margin: 0; }
.t-h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.4; color: var(--ink-1); margin: 0; }
.t-body { font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.t-small { font-size: 12px; color: var(--ink-3); }
.t-tiny  { font-size: 11px; color: var(--ink-3); letter-spacing: 0.02em; }
.t-label {
  font-size: 11px; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.t-mono  { font-family: var(--font-mono); font-feature-settings: "zero"; }
.t-kpi   { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink-1); font-family: var(--font-mono); font-feature-settings: "zero"; }
.t-kpi-lg{ font-size: 34px; font-weight: 600; letter-spacing: -0.025em; color: var(--ink-1); font-family: var(--font-mono); font-feature-settings: "zero"; }
.t-display { font-family: var(--font-display); font-weight: 500; letter-spacing: -0.02em; }

.ink-1 { color: var(--ink-1) !important; }
.ink-2 { color: var(--ink-2) !important; }
.ink-3 { color: var(--ink-3) !important; }
.ink-olive { color: var(--olive-600) !important; }

/* =========================================================
   App Shell
   ========================================================= */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  min-height: 100vh;
}

.sidebar {
  grid-row: 1 / 3;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 0 12px;
}

.sidebar-brand {
  padding: 0 20px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: var(--r);
  background: var(--olive-600);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.02em;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.10);
}
.brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--ink-1);
  line-height: 1.15;
}

/* Workspace chip: identifies which of the three ETRUSURE workspaces you're in */
.workspace-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 3px;
  border: 1px solid;
  white-space: nowrap;
}
.workspace-chip::before {
  content: "";
  width: 4px; height: 4px; border-radius: 50%;
  display: inline-block;
}
.workspace-chip.client {
  background: var(--olive-50);
  border-color: var(--olive-200);
  color: var(--olive-700);
}
.workspace-chip.client::before { background: var(--olive-600); }
.workspace-chip.ops {
  background: #232B1B;
  border-color: #3A452B;
  color: #D6DAB8;
}
.workspace-chip.ops::before { background: #C9E29B; }
.workspace-chip.institution {
  background: var(--info-bg);
  border-color: var(--info-border);
  color: var(--info);
}
.workspace-chip.institution::before { background: var(--info); }

/* Tenant strip: shows the current organization/tenant scope in client sidebar */
.tenant-strip {
  display: flex; align-items: center; gap: 10px;
  margin: 4px 12px 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.tenant-mark {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #7A8A4A, #47542C);
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: 10px;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}
.tenant-name {
  font-size: 12px; font-weight: 600; color: var(--ink-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tenant-sub { font-size: 10px; color: var(--ink-3); }

/* Ops variant of the tenant strip — darker */
.tenant-strip.ops {
  background: #2E3823;
  border-color: #3A452B;
}
.tenant-strip.ops .icn { color: #C9E29B; }

/* Operations sidebar — dark treatment while keeping olive DNA */
.sidebar-ops {
  background: #232B1B;
  border-right-color: #384229;
  color: #E8E9DE;
}
.sidebar-ops .sidebar-brand {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding-bottom: 14px;
}
.sidebar-ops .sidenav-section { color: rgba(214, 218, 184, 0.55); }
.sidebar-ops .sidenav a {
  color: rgba(232, 233, 222, 0.75);
}
.sidebar-ops .sidenav a:hover {
  background: rgba(255,255,255,0.06);
  color: #F5F4EA;
}
.sidebar-ops .sidenav a.active {
  background: rgba(201, 226, 155, 0.10);
  color: #E8E9DE;
  font-weight: 600;
}
.sidebar-ops .sidenav a.active::before {
  background: #C9E29B;
}
.sidebar-ops .sidebar-foot {
  border-top-color: rgba(255,255,255,0.08);
}
.sidebar-ops .sidebar-foot a {
  color: rgba(232, 233, 222, 0.75);
}
.sidebar-ops .sidebar-foot a:hover {
  background: rgba(255,255,255,0.06);
  color: #F5F4EA;
}

/* Ops brand-mark: subtle inset */
.brand-mark.ops {
  background: #C9E29B;
  color: #232B1B;
  box-shadow: inset 0 -6px 10px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.30);
}

/* Internal-only badge (dense, distinctive) */
.internal-only {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  background: #232B1B;
  color: #D6DAB8;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid #384229;
}
.internal-only::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: #C9E29B;
}

/* Customer-visible dual badge */
.customer-visible {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  background: var(--olive-50);
  color: var(--olive-700);
  border: 1px solid var(--olive-200);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.customer-visible::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--olive-600);
}

.sidenav {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
}
.sidenav-section {
  padding: 12px 10px 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-4);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.sidenav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background .12s;
  white-space: nowrap;
}
.sidenav a > span { overflow: hidden; text-overflow: ellipsis; }
.sidenav a:hover { background: var(--bg-hover); color: var(--ink-1); }
.sidenav a.active {
  background: var(--bg-selected);
  color: var(--olive-700);
  font-weight: 600;
  position: relative;
}
.sidenav a.active::before {
  content: "";
  position: absolute;
  left: -10px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--olive-600);
  border-radius: 2px;
}
.sidenav .disabled-nav {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: var(--r);
  color: var(--ink-4);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: not-allowed;
  user-select: none;
}
.sidebar-ops .sidenav .disabled-nav { color: rgba(232, 233, 222, 0.35); }
.sidenav .disabled-nav > span:first-of-type {
  flex: 1;
  overflow: hidden; text-overflow: ellipsis;
}
.sidenav .later-chip {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-sunken);
  color: var(--ink-3);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}
.sidebar-ops .sidenav .later-chip {
  background: rgba(255,255,255,0.06);
  color: rgba(232, 233, 222, 0.55);
  border-color: rgba(255,255,255,0.12);
}
.sidenav .icn {
  width: 16px; height: 16px;
  flex: 0 0 16px;
  color: currentColor;
  opacity: 0.85;
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px;
}
.sidebar-foot a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13px;
}
.sidebar-foot a:hover { background: var(--bg-hover); color: var(--ink-1); }

.org-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  margin-top: 8px;
}
.org-card .badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.org-card .org-name { font-size: 12px; font-weight: 600; color: var(--ink-1); line-height: 1.3; }
.org-card .org-role { font-size: 11px; color: var(--ink-3); }

/* Topbar */
.topbar {
  grid-column: 2;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-3);
}
.topbar .crumbs .sep { color: var(--ink-4); }
.topbar .crumbs .cur { color: var(--ink-1); font-weight: 500; }

.topbar-spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--bg-sunken);
  border-radius: var(--r);
  width: 300px;
  color: var(--ink-3);
  font-size: 12px;
}
.search input {
  border: none; background: transparent; outline: none;
  flex: 1; font: inherit; color: var(--ink-1);
}
.search kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
}

.top-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r);
  color: var(--ink-2);
  border: 1px solid transparent;
  background: transparent;
  position: relative;
}
.top-icon:hover { background: var(--bg-sunken); color: var(--ink-1); }
.top-icon .dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--olive-600);
  border: 1.5px solid #fff;
}

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #B0B39F, #7A8A4A);
  color: #fff;
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.main {
  grid-column: 2;
  padding: 28px 32px 48px;
  min-width: 0;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--r);
  font: 500 13px var(--font-sans);
  letter-spacing: -0.005em;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink-1);
  transition: background .12s, border-color .12s, box-shadow .12s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }

.btn-primary {
  background: var(--olive-600);
  border-color: var(--olive-600);
  color: #fff;
}
.btn-primary:hover { background: var(--olive-700); border-color: var(--olive-700); }

.btn-ghost {
  background: transparent; border-color: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--ink-1); }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 18px; font-size: 13px; }

.icon-btn { width: 34px; padding: 0; }

/* =========================================================
   Forms
   ========================================================= */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px; font-weight: 500; color: var(--ink-2);
  letter-spacing: -0.005em;
}
.field-hint { font-size: 11px; color: var(--ink-3); }
.field-req { color: var(--danger); margin-left: 2px; }

.input, .select, .textarea {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--bg-elevated);
  color: var(--ink-1);
  font: 400 13px var(--font-sans);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--olive-500);
  box-shadow: var(--shadow-focus);
}
.textarea { height: auto; padding: 10px; resize: vertical; min-height: 80px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' stroke='%237A7D74' stroke-width='1.5' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.input-mono { font-family: var(--font-mono); font-size: 12.5px; }

/* Checkbox */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.check input {
  appearance: none;
  width: 15px; height: 15px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: #fff;
  display: inline-grid; place-items: center;
  cursor: pointer;
}
.check input:checked {
  background: var(--olive-600);
  border-color: var(--olive-600);
}
.check input:checked::after {
  content: "";
  width: 8px; height: 5px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}

/* =========================================================
   Cards
   ========================================================= */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 20px 22px; }
.card-pad-lg { padding: 24px 28px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head h3 { font-size: 14px; font-weight: 600; margin: 0; color: var(--ink-1); }
.card-head .actions { display: flex; align-items: center; gap: 8px; }

.kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 108px;
  position: relative;
}
.kpi-card .label {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-card .value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -0.02em;
  line-height: 1;
}
.kpi-card .foot { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.kpi-card .delta-up { color: var(--success); font-weight: 500; }
.kpi-card .delta-down { color: var(--danger); font-weight: 500; }

/* =========================================================
   Badges / Status
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 4px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }

.badge-success  { background: var(--success-bg); border-color: var(--success-border); color: var(--success); }
.badge-warning  { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.badge-pending  { background: var(--pending-bg); border-color: var(--pending-border); color: var(--pending); }
.badge-danger   { background: var(--danger-bg);  border-color: var(--danger-border);  color: var(--danger); }
.badge-info     { background: var(--info-bg);    border-color: var(--info-border);    color: var(--info); }
.badge-trust    { background: var(--trust-bg);   border-color: #C7D3DE;               color: var(--trust); }
.badge-esg      { background: var(--esg-bg);     border-color: #C8DBC6;               color: var(--esg); }
.badge-olive    { background: var(--olive-50);   border-color: var(--olive-200);      color: var(--olive-700); }
.badge-neutral  { background: var(--bg-sunken);  border-color: var(--border);         color: var(--ink-2); }

.badge-lg { height: 26px; padding: 0 10px; font-size: 12px; }

.badge-success .dot { background: var(--success); }
.badge-warning .dot { background: var(--warning); }
.badge-pending .dot { background: var(--pending); }
.badge-danger  .dot { background: var(--danger); }
.badge-info    .dot { background: var(--info); }
.badge-trust   .dot { background: var(--trust); }
.badge-esg     .dot { background: var(--esg); }
.badge-olive   .dot { background: var(--olive-600); }

/* Trust indicator chip (with tiny icon) */
.trust-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
}
.trust-chip .ico { width: 12px; height: 12px; color: var(--olive-600); }
.trust-chip.esg .ico { color: var(--esg); }
.trust-chip.chain .ico { color: var(--trust); }

/* =========================================================
   Tabs
   ========================================================= */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  align-items: flex-end;
}
.tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  border: none;
  background: transparent;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  letter-spacing: -0.005em;
}
.tab:hover { color: var(--ink-1); }
.tab.active {
  color: var(--olive-700);
  border-bottom-color: var(--olive-600);
  font-weight: 600;
}
.tab .count {
  margin-left: 6px;
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 500;
}
.tab.active .count { color: var(--olive-600); }

/* =========================================================
   Tables
   ========================================================= */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 500;
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink-1);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(244, 243, 238, 0.5); }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: var(--bg-hover); }

.table .num { font-family: var(--font-mono); font-size: 12px; text-align: right; }
.table .id-cell { font-family: var(--font-mono); font-size: 12px; color: var(--olive-700); font-weight: 500; }

/* =========================================================
   Progress bars
   ========================================================= */
.bar {
  height: 6px;
  background: var(--bg-sunken);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--olive-600);
  border-radius: 999px;
}
.bar.thin { height: 4px; }
.bar.esg > span { background: var(--esg); }
.bar.warn > span { background: var(--warning); }

/* =========================================================
   Step indicator (KYC)
   ========================================================= */
.steps { display: flex; flex-direction: column; gap: 2px; }
.step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  cursor: pointer;
  position: relative;
}
.step:hover { background: var(--bg-hover); }
.step.active { background: var(--bg-selected); }
.step .step-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-2);
}
.step.done .step-num {
  background: var(--olive-600);
  color: #fff;
  border-color: var(--olive-600);
}
.step.pending .step-num {
  border-color: var(--warning-border);
  color: var(--warning);
  background: var(--warning-bg);
}
.step .step-title { font-size: 13px; font-weight: 500; color: var(--ink-1); }
.step .step-sub  { font-size: 11px; color: var(--ink-3); }
.step .step-status { font-size: 11px; font-weight: 500; }
.step.done .step-status { color: var(--success); }
.step.pending .step-status { color: var(--warning); }

/* Lifecycle horizontal */
.lifecycle {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 4px 0;
}
.lc-node {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  min-width: 90px;
}
.lc-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #fff;
  border: 1.5px solid var(--border);
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
}
.lc-done .lc-dot { background: var(--olive-600); border-color: var(--olive-600); color: #fff; }
.lc-current .lc-dot { background: #fff; border-color: var(--olive-600); color: var(--olive-600); position: relative; }
.lc-current .lc-dot::after {
  content: ""; position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(91,107,58,0.30);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.15); opacity: 0.5; } }
.lc-label { font-size: 11px; color: var(--ink-2); font-weight: 500; }
.lc-current .lc-label { color: var(--olive-700); font-weight: 600; }
.lc-line {
  flex: 1;
  height: 1.5px;
  background: var(--border);
  margin: 0 -4px;
  margin-bottom: 22px;
}
.lc-line.done { background: var(--olive-600); }

/* =========================================================
   Alerts / Info blocks
   ========================================================= */
.alert {
  display: flex; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid;
  font-size: 12px;
  line-height: 1.5;
}
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info); }
.alert-warn { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.alert-olive{ background: var(--olive-50); border-color: var(--olive-200); color: var(--olive-700); }

.disclaimer {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.55;
  font-style: italic;
}

/* =========================================================
   Utility grid + flex
   ========================================================= */
.row { display: flex; gap: var(--s-4); }
.row-tight { display: flex; gap: var(--s-2); }
.col { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-1 { display: flex; flex-direction: column; gap: 4px; }
.stack-2 { display: flex; flex-direction: column; gap: 8px; }
.stack-3 { display: flex; flex-direction: column; gap: 12px; }
.stack-4 { display: flex; flex-direction: column; gap: 16px; }
.stack-6 { display: flex; flex-direction: column; gap: 24px; }
.stack-8 { display: flex; flex-direction: column; gap: 32px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.center { display: flex; align-items: center; gap: var(--s-2); }
.wrap { flex-wrap: wrap; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.grow { flex: 1; } .shrink-0 { flex-shrink: 0; }
.hidden { display: none !important; }

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

/* Sr-only */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* =========================================================
   Icons — inline SVG stroke color follows currentColor
   ========================================================= */
.icn { display: inline-block; vertical-align: middle; }
svg.icn { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* =========================================================
   Login-specific
   ========================================================= */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-hero {
  background: linear-gradient(160deg, #2A3121 0%, #384229 45%, #4A5730 100%);
  color: #E8E9DE;
  position: relative;
  overflow: hidden;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
}
.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 15%, rgba(220,220,180,0.10), transparent 50%),
    radial-gradient(circle at 15% 90%, rgba(255,255,255,0.05), transparent 45%);
  pointer-events: none;
}
.login-form-side {
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 48px;
}
.login-card {
  width: 100%;
  max-width: 420px;
}

/* Trust-network SVG background */
.trust-net {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  pointer-events: none;
}

/* =========================================================
   Global Search Overlay
   ========================================================= */
.search-overlay {
  position: fixed; inset: 0;
  background: rgba(26, 29, 26, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 88px 24px 24px;
}
.search-overlay.open { display: flex; }
.search-panel {
  width: 100%; max-width: 720px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 120px);
}
.search-panel-input {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.search-panel-input input {
  flex: 1;
  border: none; background: transparent; outline: none;
  font: 400 15px var(--font-sans);
  color: var(--ink-1);
}
.search-panel-input input::placeholder { color: var(--ink-4); }
.search-panel-input .esc {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-sunken);
}
.search-panel-body {
  overflow-y: auto;
  padding: 6px 0;
  max-height: 480px;
}
.search-group { padding: 8px 6px 4px; }
.search-group-heading {
  padding: 6px 14px 6px;
  font-size: 10px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.search-item {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--r);
  color: var(--ink-1);
  text-decoration: none;
  margin: 1px 6px;
}
.search-item:hover, .search-item.focused {
  background: var(--bg-hover);
}
.search-item .si-ico {
  width: 28px; height: 28px;
  background: var(--olive-50);
  border-radius: var(--r-sm);
  display: grid; place-items: center;
  color: var(--olive-700);
}
.search-item .si-title { font-size: 13px; font-weight: 500; color: var(--ink-1); }
.search-item .si-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.search-item .si-enter {
  opacity: 0;
  transition: opacity .12s;
}
.search-item.focused .si-enter, .search-item:hover .si-enter { opacity: 1; }
.search-item .si-enter kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-sunken);
}

.search-panel-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-sunken);
  font-size: 11px;
  color: var(--ink-3);
}
.kbd-group { display: inline-flex; align-items: center; gap: 4px; }
.search-panel-foot kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
}

.search-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-2);
  font-size: 13px;
}

/* =========================================================
   Laptop safety (< 1280px) — ETRUSURE is desktop-first
   ========================================================= */
.small-screen-notice {
  display: none;
  position: fixed; inset: 0;
  z-index: 200;
  background: var(--bg);
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}
.small-screen-notice .box {
  max-width: 480px;
  padding: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
}
.small-screen-notice .brand-mark {
  width: 44px; height: 44px; font-size: 20px;
  margin: 0 auto 20px;
}
.small-screen-notice h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.small-screen-notice p {
  font-size: 13.5px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 0;
}
@media (max-width: 1279px) {
  .small-screen-notice { display: flex; }
  .app, .login-shell { display: none !important; }
}
