/* ============================================================================
   EHAI Admin — Shared Stylesheet
   ----------------------------------------------------------------------------
   Single source of truth for admin.extrahourai.com tool chrome.
   Linear / Vercel tier — restraint, multi-layer shadows, refined typography.
   Cosmetic only. Targets existing class names; no HTML refactor required.
   Deploy: scp to /var/www/admin/assets/ehai-admin.css
   ========================================================================= */

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

/* ----------------------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------------------- */
:root {
  /* Brand — orange */
  --brand-50:  #fff7ed;
  --brand-100: #ffedd5;
  --brand-200: #fed7aa;
  --brand-300: #fdba74;
  --brand-400: #fb923c;
  --brand-500: #f97316;
  --brand-600: #ea580c;
  --brand-700: #c2410c;
  --brand-800: #9a3412;
  --brand-900: #7c2d12;

  /* Ink — neutrals */
  --ink-900: #111111;
  --ink-800: #1f1f1f;
  --ink-700: #2d2d2d;
  --ink-600: #4a4a4a;
  --ink-500: #5a5a5a;
  --ink-400: #8a8a8a;
  --ink-300: #9a9a9a;
  --ink-200: #cfcfcf;
  --ink-100: #e8e8e8;
  --ink-75:  #ececea;
  --ink-50:  #f5f5f3;
  --ink-25:  #fafaf8;
  --white:   #ffffff;

  /* Semantic — keep palette small */
  --success-50:  #ecfdf5;
  --success-100: #d1fae5;
  --success-500: #10b981;
  --success-700: #047857;
  --warning-50:  #fffbeb;
  --warning-100: #fef3c7;
  --warning-500: #f59e0b;
  --warning-700: #b45309;
  --danger-50:   #fef2f2;
  --danger-100:  #fee2e2;
  --danger-500:  #ef4444;
  --danger-700:  #b91c1c;

  /* Spacing scale — 4px grid */
  --s-1:  4px;
  --s-2:  8px;
  --s-3:  12px;
  --s-4:  16px;
  --s-5:  20px;
  --s-6:  24px;
  --s-7:  28px;
  --s-8:  32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-14: 56px;
  --s-16: 64px;
  --s-20: 80px;

  /* Radius */
  --r-1:  4px;
  --r-2:  6px;
  --r-3:  8px;
  --r-4:  10px;
  --r-5:  12px;
  --r-6:  14px;
  --r-7:  16px;
  --r-8:  20px;
  --r-pill: 999px;

  /* Shadows — multi-layer, the "premium" tell */
  --shadow-xs: 0 1px 0 rgba(17, 17, 17, 0.04);
  --shadow-sm:
    0 1px 0 rgba(17, 17, 17, 0.04),
    0 1px 2px rgba(17, 17, 17, 0.05);
  --shadow-md:
    0 1px 0 rgba(17, 17, 17, 0.04),
    0 4px 12px -4px rgba(17, 17, 17, 0.06),
    0 12px 24px -16px rgba(17, 17, 17, 0.08);
  --shadow-lg:
    0 1px 0 rgba(17, 17, 17, 0.04),
    0 8px 24px -8px rgba(17, 17, 17, 0.08),
    0 24px 48px -24px rgba(17, 17, 17, 0.12);
  --shadow-xl:
    0 1px 0 rgba(17, 17, 17, 0.06),
    0 16px 36px -12px rgba(17, 17, 17, 0.12),
    0 40px 64px -32px rgba(17, 17, 17, 0.18);
  --shadow-glow: 0 0 0 3px rgba(249, 115, 22, 0.16);
  --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* Motion */
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast:  120ms;
  --t-base:  180ms;
  --t-slow:  220ms;

  /* Type */
  --font-display: 'Barlow Condensed', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Layout */
  --wrap-max: 1180px;
  --wrap-wide: 1400px;
  --nav-h: 64px;
}

/* ----------------------------------------------------------------------------
   2. Reset + base
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--ink-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv11";
}
img, svg, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; background: transparent; border: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-800); }
hr { border: 0; border-top: 1px solid var(--ink-100); margin: var(--s-6) 0; }

::selection { background: rgba(249, 115, 22, 0.18); color: var(--ink-900); }

/* ----------------------------------------------------------------------------
   3. Atmosphere — subtle radial gradient on body, the Linear tell
   ------------------------------------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 480px;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(249, 115, 22, 0.045), transparent 70%),
    radial-gradient(ellipse 40% 40% at 85% 0%, rgba(249, 115, 22, 0.03), transparent 70%);
}

/* ----------------------------------------------------------------------------
   4. Typography
   ------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--ink-900);
  text-transform: uppercase;
}
h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 900; letter-spacing: -0.02em; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }
h4 { font-size: 18px; letter-spacing: 0.02em; }

h1.display,
h2.display {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(48px, 7vw, 84px);
  line-height: 0.94;
  letter-spacing: -0.022em;
  text-transform: uppercase;
  color: var(--ink-900);
}
h1.display .accent,
h2.display .accent {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 60%, var(--danger-500) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink-500);
  max-width: 620px;
}

.eyebrow,
.section-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
}

.mono, code, pre, .ehai-mono { font-family: var(--font-mono); font-feature-settings: "calt" 0; }
.tabular, .ehai-tabular { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------------------
   5. Nav — sticky glass
   .ehai-nav is canonical (used by every tool except admin-portal hub)
   .nav is the admin-portal alias (current hub HTML)
   ------------------------------------------------------------------------- */
.ehai-nav,
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245, 245, 243, 0.72);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid rgba(17, 17, 17, 0.06);
}
.ehai-nav-inner,
.nav-inner {
  max-width: var(--wrap-wide);
  margin: 0 auto;
  padding: 0 var(--s-6);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
}
.ehai-brand,
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.ehai-brand-mark,
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--brand-600) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 1px 2px rgba(194, 65, 12, 0.4),
    0 4px 10px -2px rgba(249, 115, 22, 0.4);
}
.ehai-brand-mark svg,
.brand-mark svg { width: 18px; height: 18px; }
.ehai-brand-word,
.brand-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink-900);
  text-transform: none;
}
.ehai-brand-word .accent,
.brand-word .accent { color: var(--brand-500); }

.ehai-nav-links,
.nav-links {
  display: flex;
  gap: 2px;
  align-items: center;
  flex: 1;
  justify-content: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.ehai-nav-links::-webkit-scrollbar,
.nav-links::-webkit-scrollbar { display: none; }
.ehai-nav-link,
.nav-link {
  padding: 7px 13px;
  border-radius: var(--r-3);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.ehai-nav-link:hover,
.nav-link:hover {
  background: var(--brand-50);
  color: var(--brand-700);
}
.ehai-nav-link.active,
.nav-link.active {
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 600;
}

.ehai-nav-tag,
.nav-tag {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-700);
  background: var(--brand-100);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .ehai-nav-links, .nav-links { display: none; }
}

/* ----------------------------------------------------------------------------
   6. Layout — wrappers
   ------------------------------------------------------------------------- */
.wrap, .container, .ehai-wrap {
  position: relative;
  z-index: 1;
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: var(--s-12) var(--s-6) var(--s-16);
}
.container.wide { max-width: var(--wrap-wide); }
.wrap.wide, .ehai-wrap.wide { max-width: var(--wrap-wide); }

.header,
.page-header {
  margin-bottom: var(--s-8);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-6);
}
.header h1,
.page-header h1 {
  font-size: clamp(28px, 3.5vw, 38px);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.header .lede,
.page-header .lede { font-size: 14.5px; }

.header-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

/* ----------------------------------------------------------------------------
   7. Cards — multi-layer shadow, refined hover
   ------------------------------------------------------------------------- */
.card {
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-7);
  padding: var(--s-7);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out);
}
.card.flat { box-shadow: none; }
.card.elevated { box-shadow: var(--shadow-md); }

.card-title,
.section-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: var(--s-3);
}

/* ----------------------------------------------------------------------------
   8. Buttons
   ------------------------------------------------------------------------- */
.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  height: 36px;
  border-radius: var(--r-3);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  background: var(--white);
  color: var(--ink-700);
  border: 1px solid var(--ink-100);
  box-shadow: var(--shadow-xs);
  transition:
    background var(--t-fast) var(--ease-out),
    border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out),
    transform var(--t-fast) var(--ease-out);
  text-decoration: none;
}
.btn:hover {
  background: var(--ink-25);
  border-color: var(--ink-200);
  color: var(--ink-900);
}
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-glow); }
.btn[disabled],
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary,
.btn.btn-primary {
  background: linear-gradient(180deg, var(--brand-500) 0%, var(--brand-600) 100%);
  color: var(--white);
  border-color: var(--brand-600);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 1px 0 rgba(194, 65, 12, 0.3),
    0 4px 12px -2px rgba(249, 115, 22, 0.35);
}
.btn-primary:hover,
.btn.btn-primary:hover {
  background: linear-gradient(180deg, var(--brand-600) 0%, var(--brand-700) 100%);
  border-color: var(--brand-700);
  color: var(--white);
}

.btn-ghost,
.btn.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-500);
  box-shadow: none;
}
.btn-ghost:hover,
.btn.btn-ghost:hover {
  background: var(--ink-75);
  color: var(--ink-900);
  border-color: transparent;
}

.btn-sm { height: 30px; font-size: 12.5px; padding: 6px 11px; }
.btn-lg { height: 44px; font-size: 14.5px; padding: 12px 18px; border-radius: var(--r-4); }

/* Preset button row (date presets, quick filters) */
.preset-btns,
.preset-btn-group {
  display: inline-flex;
  align-items: center;
  background: var(--ink-75);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-4);
  padding: 3px;
  gap: 0;
  box-shadow: inset 0 1px 2px rgba(17, 17, 17, 0.03);
}
.preset-btn {
  padding: 5px 11px;
  height: 28px;
  border-radius: var(--r-2);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-500);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
  white-space: nowrap;
}
.preset-btn:hover { color: var(--ink-900); }
.preset-btn.active {
  background: var(--white);
  color: var(--ink-900);
  font-weight: 600;
  box-shadow: var(--shadow-xs), 0 1px 3px rgba(17, 17, 17, 0.06);
}

/* ----------------------------------------------------------------------------
   9. Form controls — input, select, textarea
   ------------------------------------------------------------------------- */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="password"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
  display: inline-block;
  width: auto;
  max-width: 100%;
  height: 36px;
  padding: 7px 12px;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-900);
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-3);
  box-shadow: inset 0 1px 2px rgba(17, 17, 17, 0.025);
  transition:
    border-color var(--t-fast) var(--ease-out),
    box-shadow var(--t-fast) var(--ease-out),
    background var(--t-fast) var(--ease-out);
}
textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
}

/* Stacked label+input form contexts use full width */
.field input,
.field select,
.field textarea,
.filter-group input,
.filter-group select,
.filter-group textarea,
.form-group input,
.form-group select,
.form-group textarea {
  display: block;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--ink-400); }

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow:
    inset 0 1px 2px rgba(17, 17, 17, 0.025),
    0 0 0 3px rgba(249, 115, 22, 0.16);
}
input:hover:not(:focus),
select:hover:not(:focus),
textarea:hover:not(:focus) {
  border-color: var(--ink-200);
}

input[disabled],
select[disabled],
textarea[disabled] {
  background: var(--ink-25);
  color: var(--ink-400);
  cursor: not-allowed;
}

/* Custom select chevron */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235a5a5a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}
select:focus { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c2410c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); }

/* Date input chevron normalize (Webkit) */
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
  filter: grayscale(1);
  transition: opacity var(--t-fast) var(--ease-out);
}
input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: 0.8; }

/* Field group */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.field label,
.field > .label,
.form-row > .field > label {
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.field .hint,
.hint {
  font-size: 11.5px;
  color: var(--ink-400);
  line-height: 1.45;
}
.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: flex-end;
}

/* ----------------------------------------------------------------------------
   10. Pills, badges, tags
   ------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-100);
  color: var(--brand-700);
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  line-height: 1.2;
  letter-spacing: 0.02em;
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--brand-500);
  animation: pulse 2.2s var(--ease-in-out) infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.pill.ok    { background: var(--success-100); color: var(--success-700); }
.pill.err   { background: var(--danger-100);  color: var(--danger-700); }
.pill.wait  { background: var(--ink-100);     color: var(--ink-700); }
.pill.warn  { background: var(--warning-100); color: var(--warning-700); }
.pill.muted { background: var(--ink-75);      color: var(--ink-500); }

.badge,
.ehai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--ink-75);
  color: var(--ink-700);
  line-height: 1.3;
  white-space: nowrap;
}
.badge-positive,
.badge-success { background: var(--success-100); color: var(--success-700); }
.badge-neutral { background: var(--ink-75);      color: var(--ink-600); }
.badge-negative,
.badge-danger  { background: var(--danger-100);  color: var(--danger-700); }
.badge-warning { background: var(--warning-100); color: var(--warning-700); }
.badge-brand   { background: var(--brand-100);   color: var(--brand-700); }
.badge-info    { background: #e0f2fe;            color: #0369a1; }

/* ----------------------------------------------------------------------------
   11. KPI / stat cards
   ------------------------------------------------------------------------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.kpi-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.kpi-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.kpi-row.cols-5 { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) {
  .kpi-row,
  .kpi-row.cols-3,
  .kpi-row.cols-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .kpi-row,
  .kpi-row.cols-3,
  .kpi-row.cols-5 { grid-template-columns: 1fr; }
}

.kpi-row .card {
  padding: var(--s-5) var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.kpi-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.kpi-value.small { font-size: 26px; }
.kpi-value.tiny  { font-size: 20px; }
.kpi-label {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--ink-400);
  letter-spacing: 0.02em;
}
.kpi-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 8px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: var(--r-pill);
}
.kpi-change.up,
.kpi-change.positive   { background: var(--success-100); color: var(--success-700); }
.kpi-change.down,
.kpi-change.negative   { background: var(--danger-100);  color: var(--danger-700); }
.kpi-change.neutral    { background: var(--ink-75);      color: var(--ink-500); }

/* ----------------------------------------------------------------------------
   12. Filter row — refined
   ------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-3);
  padding: var(--s-5) var(--s-6);
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-7);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--s-5);
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.filter-group label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.filter-group select,
.filter-group input { min-width: 140px; }
.filter-search { flex: 1; min-width: 260px; }
.filter-search input { width: 100%; }
.filter-search { display: flex; gap: 6px; align-items: stretch; flex-direction: row; align-items: flex-end; }
.filter-search > input { flex: 1; }

.filter-sep {
  width: 1px;
  align-self: stretch;
  background: var(--ink-100);
  margin: 0 var(--s-1);
}

.date-presets,
.date-filter,
.date-range {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.date-range input,
.date-filter input { min-width: 130px; }

/* ----------------------------------------------------------------------------
   13. Tables — base + DataTables overrides
   ------------------------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-body);
  font-size: 13.5px;
}
th, td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
thead th {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
  background: var(--ink-25);
  border-bottom: 1px solid var(--ink-100);
  white-space: nowrap;
}
thead th:first-child { border-top-left-radius: var(--r-5); }
thead th:last-child  { border-top-right-radius: var(--r-5); }
tbody td { border-bottom: 1px solid var(--ink-100); color: var(--ink-700); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--t-fast) var(--ease-out); }
tbody tr:hover { background: rgba(249, 115, 22, 0.03); }

/* DataTables-specific overrides */
table.dataTable { border-collapse: separate !important; }
table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
  cursor: pointer;
  position: relative;
}
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
  display: inline-block;
  margin-left: 6px;
  opacity: 0.4;
  font-size: 10px;
  vertical-align: middle;
}
table.dataTable thead .sorting::after { content: "↕"; }
table.dataTable thead .sorting_asc::after { content: "▲"; opacity: 1; color: var(--brand-600); }
table.dataTable thead .sorting_desc::after { content: "▼"; opacity: 1; color: var(--brand-600); }

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: var(--s-3);
  font-size: 13px;
  color: var(--ink-500);
}
.dataTables_wrapper .dataTables_filter input {
  display: inline-block;
  width: auto;
  min-width: 220px;
  height: 32px;
  margin-left: 8px;
}
.dataTables_wrapper .dataTables_length select {
  display: inline-block;
  width: auto;
  height: 30px;
  margin: 0 6px;
}
.dataTables_wrapper .dataTables_info {
  margin-top: var(--s-3);
  font-size: 12.5px;
  color: var(--ink-400);
}
.dataTables_wrapper .dataTables_paginate { margin-top: var(--s-3); }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  margin: 0 2px;
  border-radius: var(--r-3);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-500);
  background: var(--white);
  border: 1px solid var(--ink-100);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--ink-25);
  color: var(--ink-900);
  border-color: var(--ink-200);
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--brand-500);
  color: var(--white);
  border-color: var(--brand-500);
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--white);
  color: var(--ink-400);
}

/* ----------------------------------------------------------------------------
   14. Tabs
   ------------------------------------------------------------------------- */
.tab-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--ink-75);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-5);
  margin-bottom: var(--s-5);
  width: fit-content;
  box-shadow: inset 0 1px 2px rgba(17, 17, 17, 0.03);
}
.tab-btn {
  padding: 7px 16px;
  height: 34px;
  border-radius: var(--r-3);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink-900); }
.tab-btn.active {
  background: var(--white);
  color: var(--ink-900);
  font-weight: 600;
  box-shadow: var(--shadow-xs), 0 1px 3px rgba(17, 17, 17, 0.06);
}

/* ----------------------------------------------------------------------------
   15. States — loading, empty, error, skeleton
   ------------------------------------------------------------------------- */
.state-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s-16) var(--s-6);
  text-align: center;
  color: var(--ink-500);
}
.spinner {
  width: 32px;
  height: 32px;
  border: 2.5px solid var(--ink-100);
  border-top-color: var(--brand-500);
  border-radius: var(--r-pill);
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--s-3);
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading {
  padding: var(--s-12) var(--s-6);
  text-align: center;
  color: var(--ink-400);
  font-size: 13.5px;
}

.no-data,
.empty-state {
  padding: var(--s-12) var(--s-6);
  text-align: center;
  color: var(--ink-400);
  font-size: 14px;
  line-height: 1.6;
}
.empty-state strong { color: var(--ink-700); display: block; margin-bottom: 4px; font-size: 15px; }

.error-banner {
  padding: var(--s-4) var(--s-5);
  background: var(--danger-50);
  border: 1px solid var(--danger-100);
  border-radius: var(--r-4);
  color: var(--danger-700);
  font-size: 13.5px;
  line-height: 1.55;
}
.error-banner strong { font-weight: 600; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--ink-75) 0%, var(--ink-100) 50%, var(--ink-75) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-3);
}
.skeleton-line { height: 14px; margin-bottom: 10px; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 70%; }
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ----------------------------------------------------------------------------
   16. Pagination — premium pills
   ------------------------------------------------------------------------- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-3) 0 0;
  flex-wrap: wrap;
}
.page-info {
  font-size: 12.5px;
  color: var(--ink-400);
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------------------
   17. Hub — tool grid (admin-portal)
   ------------------------------------------------------------------------- */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s-5);
}
.tool-grid.tight { gap: var(--s-4); grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
  .tool-grid.tight { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .tool-grid,
  .tool-grid.tight { grid-template-columns: 1fr; }
}

.tool-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-8);
  padding: var(--s-7);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--t-base) var(--ease-out),
    box-shadow var(--t-base) var(--ease-out),
    border-color var(--t-base) var(--ease-out);
  overflow: hidden;
}
.tool-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.04), transparent 40%);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease-out);
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-200);
}
.tool-card:hover::before { opacity: 1; }

.tool-grid.tight .tool-card { padding: var(--s-5); border-radius: var(--r-6); }

.tool-icon {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: var(--r-5);
  background: linear-gradient(135deg, var(--brand-50) 0%, var(--brand-100) 100%);
  border: 1px solid var(--brand-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-700);
  box-shadow: var(--shadow-inset);
}
.tool-icon svg { width: 22px; height: 22px; stroke-width: 1.75; }
.tool-grid.tight .tool-icon { width: 38px; height: 38px; border-radius: var(--r-3); }
.tool-grid.tight .tool-icon svg { width: 18px; height: 18px; }

.tool-name {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  color: var(--ink-900);
}
.tool-grid.tight .tool-name { font-size: 17px; }

.tool-desc {
  position: relative;
  z-index: 1;
  font-size: 13.5px;
  color: var(--ink-500);
  line-height: 1.6;
  flex: 1;
}
.tool-grid.tight .tool-desc { font-size: 12.5px; line-height: 1.5; }

.tool-foot {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: 4px;
  padding-top: var(--s-3);
  border-top: 1px solid var(--ink-100);
}
.tool-url {
  font-size: 11px;
  color: var(--ink-400);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tool-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-600);
  flex-shrink: 0;
  transition: gap var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}
.tool-card:hover .tool-cta { color: var(--brand-700); gap: 7px; }

.foot {
  margin-top: var(--s-16);
  padding-top: var(--s-6);
  border-top: 1px solid var(--ink-100);
  font-size: 12px;
  color: var(--ink-400);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
}
.foot .mono { font-size: 11.5px; }

/* ----------------------------------------------------------------------------
   18. Toast
   ------------------------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-900);
  color: var(--white);
  padding: 10px 18px;
  border-radius: var(--r-4);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  z-index: 1000;
  transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----------------------------------------------------------------------------
   19. Code blocks — refined
   ------------------------------------------------------------------------- */
pre, .code-block {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-700);
  background: var(--ink-25);
  border: 1px solid var(--ink-100);
  border-radius: var(--r-4);
  padding: var(--s-4) var(--s-5);
  overflow-x: auto;
  white-space: pre;
}
code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 1px 6px;
  background: var(--ink-75);
  border-radius: 4px;
  color: var(--ink-700);
}
pre code { padding: 0; background: transparent; font-size: inherit; }

/* JSON syntax-quiet (apply via spans in JS-rendered output) */
.json-key    { color: var(--ink-700); font-weight: 500; }
.json-string { color: var(--ink-500); }
.json-number { color: var(--brand-700); font-variant-numeric: tabular-nums; }
.json-bool   { color: var(--brand-700); font-weight: 500; }
.json-null   { color: var(--ink-300); font-style: italic; }

/* ----------------------------------------------------------------------------
   20. Scrollbars — Webkit + Firefox
   ------------------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--ink-200) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--ink-200);
  border-radius: var(--r-pill);
  border: 2px solid var(--ink-50);
}
*::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ----------------------------------------------------------------------------
   21. Utilities
   ------------------------------------------------------------------------- */
.truncate, .ehai-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-mute, .ehai-text-mute { color: var(--ink-400); }
.text-strong { color: var(--ink-900); font-weight: 600; }

.row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.grow { flex: 1; min-width: 0; }
.flex-end { margin-left: auto; }

.stack-1 > * + * { margin-top: var(--s-1); }
.stack-2 > * + * { margin-top: var(--s-2); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-4 > * + * { margin-top: var(--s-4); }
.stack-5 > * + * { margin-top: var(--s-5); }
.stack-6 > * + * { margin-top: var(--s-6); }

/* ----------------------------------------------------------------------------
   22. Reduced motion & print
   ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body::before { display: none; }
  .ehai-nav, .nav, .toast, .filters, .pagination-bar, .preset-btns, .preset-btn-group { display: none !important; }
  .container, .wrap, .ehai-wrap { padding: 0; max-width: 100%; }
  .card, .filters, .tool-card { box-shadow: none !important; border-color: var(--ink-200) !important; break-inside: avoid; }
  body { background: var(--white); }
}
