/* =========================================================================
   Chrome — light, elegant CMS surface for content-admin chrome pages
   (login, dashboard, static-dashboard, dynamic-dashboard).
   Standalone stylesheet. Class prefix `ch-`. Reuses `he-*` for shared
   buttons / banners.
   ========================================================================= */

:root {
  --bg: #FAFAF7;
  --bg-pattern: radial-gradient(circle at 1px 1px, rgba(20, 17, 14, 0.04) 1px, transparent 0);
  --surface: #FFFFFF;
  --surface-soft: #F5F4EE;
  --surface-sunken: #F1EFE8;
  --surface-hover: #F8F7F2;

  --border: #E8E5DC;
  --border-strong: #CDC9BD;
  --border-subtle: #F0EEE6;

  --text: #15120E;
  --text-muted: #6E6A60;
  --text-subtle: #A19D93;
  --text-inverse: #FAFAF7;

  --accent: #18181B;
  --accent-hover: #27272A;
  --accent-soft: #F4F4F5;
  --accent-ring: rgba(24, 24, 27, 0.12);

  --brand: #B45309;
  --brand-soft: #FEF3C7;

  --success: #047857;
  --success-soft: #ECFDF5;
  --warning: #B45309;
  --warning-soft: #FEF3C7;
  --danger: #B91C1C;
  --danger-soft: #FEF2F2;
  --info: #1E40AF;
  --info-soft: #EFF6FF;

  --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;
  --s-20: 80px;

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-2xl: 28px; --r-pill: 999px;

  --sh-xs: 0 1px 2px rgba(20, 17, 14, 0.04);
  --sh-sm: 0 1px 2px rgba(20, 17, 14, 0.05), 0 1px 3px rgba(20, 17, 14, 0.04);
  --sh-md: 0 4px 12px -2px rgba(20, 17, 14, 0.06), 0 2px 4px -1px rgba(20, 17, 14, 0.04);
  --sh-lg: 0 12px 28px -8px rgba(20, 17, 14, 0.10), 0 6px 12px -4px rgba(20, 17, 14, 0.06);
  --sh-xl: 0 24px 48px -12px rgba(20, 17, 14, 0.14), 0 12px 24px -6px rgba(20, 17, 14, 0.08);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

  --topbar-h: 60px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 120ms;
  --t-mid: 200ms;
  --t-slow: 320ms;
}

/* ----- reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body.chrome-body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-pattern);
  background-size: 24px 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; cursor: pointer; }
input, button { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* =========================================================================
   Top bar (shared)
   ========================================================================= */
.he-topbar {
  display: flex; align-items: center; gap: var(--s-4);
  padding: 0 var(--s-5); height: var(--topbar-h);
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky; top: 0; z-index: 30;
}
.he-topbar__brand { display: flex; align-items: center; gap: var(--s-3); font-weight: 600; }
.he-topbar__logo {
  width: 28px; height: 28px; border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand) 0%, #C2410C 100%);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px;
  box-shadow: 0 1px 2px rgba(180,83,9,0.30), inset 0 1px 0 rgba(255,255,255,0.18);
}
.he-topbar__title { display: flex; flex-direction: column; line-height: 1.1; }
.he-topbar__title small { font-size: 11px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.02em; text-transform: uppercase; }
.he-topbar__title strong { font-size: 15px; font-weight: 600; }
.he-topbar__sep { width: 1px; height: 24px; background: var(--border); margin: 0 var(--s-2); }
.he-topbar__crumbs { display: flex; align-items: center; gap: var(--s-2); font-size: 13px; color: var(--text-muted); }
.he-topbar__crumbs a { transition: color var(--t-fast); }
.he-topbar__crumbs a:hover { color: var(--text); }
.he-topbar__crumbs span.current { color: var(--text); font-weight: 500; }
.he-topbar__spacer { flex: 1; }
.he-topbar__actions { display: flex; align-items: center; gap: var(--s-2); }
.he-user {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 36px; padding: 0 12px 0 6px; border-radius: var(--r-pill);
  background: var(--surface-soft); border: 1px solid var(--border-subtle);
  font-size: 12.5px; font-weight: 500;
}
.he-user__avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #1f2937 0%, #4b5563 100%);
  color: #fff; display: grid; place-items: center; font-size: 11px; font-weight: 600;
}
.he-logout {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--text-muted); font-size: 12.5px; transition: color var(--t-fast);
}
.he-logout:hover { color: var(--text); }

/* ----- Buttons / Banner (shared) ----- */
.he-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 36px; padding: 0 var(--s-4); border-radius: var(--r-md); border: 1px solid transparent;
  font-size: 13px; font-weight: 500; letter-spacing: -0.005em;
  transition: all var(--t-fast) var(--ease); user-select: none; cursor: pointer;
}
.he-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.he-btn--primary { background: var(--accent); color: var(--text-inverse); border-color: var(--accent); box-shadow: var(--sh-xs); }
.he-btn--primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--sh-sm); }
.he-btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.he-btn--ghost:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.he-btn--lg { height: 44px; padding: 0 var(--s-6); font-size: 14px; font-weight: 600; }
.he-btn--block { width: 100%; }

.he-banner {
  margin: 0 0 var(--s-4) 0;
  padding: var(--s-3) var(--s-5); border-radius: var(--r-md);
  font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: var(--s-3);
}
.he-banner--success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(4,120,87,0.18); }
.he-banner--info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(30,64,175,0.18); }
.he-banner--error { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(185,28,28,0.18); }

/* =========================================================================
   Login layout — split hero (left) + form (right)
   ========================================================================= */
.ch-login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
}
@media (max-width: 880px) {
  .ch-login { grid-template-columns: 1fr; }
  .ch-login__hero { display: none; }
}

.ch-login__hero {
  background: linear-gradient(160deg, #1a1a1f 0%, #0F0E0C 100%);
  color: #FAFAF7;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--s-12);
  position: relative;
  overflow: hidden;
}
.ch-login__hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(180, 83, 9, 0.22) 0%, transparent 45%),
              radial-gradient(circle at 10% 90%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
  pointer-events: none;
}
.ch-login__brand {
  display: flex; align-items: center; gap: var(--s-3);
  position: relative; z-index: 1;
}
.ch-login__logo {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--brand) 0%, #C2410C 100%);
  display: grid; place-items: center;
  color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.4);
}
.ch-login__brand-name {
  display: flex; flex-direction: column;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ch-login__brand-name span:first-child {
  font-size: 16px;
}
.ch-login__brand-name span:last-child {
  font-size: 11.5px;
  color: rgba(250, 250, 247, 0.6);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ch-login__hero-content {
  position: relative; z-index: 1;
  max-width: 420px;
}
.ch-login__hero-eyebrow {
  margin: 0 0 var(--s-3) 0;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(250, 250, 247, 0.55);
}
.ch-login__hero-title {
  margin: 0 0 var(--s-4) 0;
  font-size: 38px; font-weight: 600;
  line-height: 1.1; letter-spacing: -0.025em;
}
.ch-login__hero-copy {
  margin: 0 0 var(--s-6) 0;
  font-size: 16px; line-height: 1.6;
  color: rgba(250, 250, 247, 0.8);
}
.ch-login__hero-chips {
  display: flex; flex-wrap: wrap; gap: var(--s-2);
}
.ch-login__hero-chip {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  border-radius: var(--r-pill);
  background: rgba(250, 250, 247, 0.10);
  border: 1px solid rgba(250, 250, 247, 0.18);
  font-size: 12px; font-weight: 500;
  color: rgba(250, 250, 247, 0.85);
  backdrop-filter: blur(4px);
}

.ch-login__hero-foot {
  position: relative; z-index: 1;
  font-size: 12px; color: rgba(250, 250, 247, 0.5);
}

.ch-login__panel {
  display: flex; align-items: center; justify-content: center;
  padding: var(--s-12) var(--s-8);
}
.ch-login__card {
  width: 100%;
  max-width: 400px;
}
.ch-login__eyebrow {
  margin: 0 0 var(--s-2) 0;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-subtle);
}
.ch-login__title {
  margin: 0 0 var(--s-2) 0;
  font-size: 28px; font-weight: 600; letter-spacing: -0.02em;
  color: var(--text);
}
.ch-login__copy {
  margin: 0 0 var(--s-6) 0;
  font-size: 14px; color: var(--text-muted); line-height: 1.55;
}
.ch-login__form {
  display: flex; flex-direction: column; gap: var(--s-4);
}
.ch-field {
  display: flex; flex-direction: column; gap: 6px;
}
.ch-field__label {
  font-size: 12.5px; font-weight: 600; color: var(--text);
}
.ch-field__input {
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  color: var(--text);
  transition: all var(--t-fast) var(--ease);
}
.ch-field__input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.ch-field__input::placeholder { color: var(--text-subtle); }

/* =========================================================================
   Dashboard hero (centered) + workspace cards
   ========================================================================= */
.ch-shell { min-height: 100vh; display: flex; flex-direction: column; }

.ch-main {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: var(--s-10) var(--s-6) var(--s-16) var(--s-6);
}
@media (max-width: 720px) {
  .ch-main { padding-left: var(--s-4); padding-right: var(--s-4); padding-top: var(--s-6); }
}

.ch-hero {
  margin-bottom: var(--s-10);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--border-subtle);
}
.ch-hero__eyebrow {
  margin: 0 0 var(--s-2) 0;
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--text-subtle);
}
.ch-hero__eyebrow::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.ch-hero__title {
  margin: 0; font-size: 36px; font-weight: 600;
  letter-spacing: -0.025em; line-height: 1.1; color: var(--text);
}
.ch-hero__copy {
  margin: var(--s-3) 0 0 0;
  font-size: 15.5px; color: var(--text-muted);
  max-width: 60ch; line-height: 1.6;
}

/* Big workspace entry cards */
.ch-entries {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--s-5);
}
.ch-entry {
  position: relative;
  display: flex; flex-direction: column; gap: var(--s-3);
  padding: var(--s-8);
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--t-mid) var(--ease);
  overflow: hidden;
  min-height: 220px;
}
.ch-entry:hover {
  border-color: var(--border-strong);
  box-shadow: var(--sh-md);
  transform: translateY(-2px);
}
.ch-entry::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--brand-soft) 0%, transparent 40%);
  opacity: 0;
  transition: opacity var(--t-mid);
  pointer-events: none;
}
.ch-entry:hover::before { opacity: 1; }
.ch-entry__label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-subtle);
}
.ch-entry__title {
  margin: 0;
  font-size: 22px; font-weight: 600; letter-spacing: -0.015em; color: var(--text);
}
.ch-entry__copy {
  margin: 0; font-size: 14px; color: var(--text-muted); line-height: 1.55;
  flex: 1;
}
.ch-entry__action {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--accent);
  margin-top: auto;
}
.ch-entry__action::after {
  content: '→';
  transition: transform var(--t-fast);
}
.ch-entry:hover .ch-entry__action::after { transform: translateX(3px); }
.ch-entry--accent {
  background: linear-gradient(160deg, #1a1a1f 0%, #0F0E0C 100%);
  border-color: transparent;
  color: #FAFAF7;
}
.ch-entry--accent .ch-entry__label { color: rgba(250, 250, 247, 0.5); }
.ch-entry--accent .ch-entry__title { color: #FAFAF7; }
.ch-entry--accent .ch-entry__copy { color: rgba(250, 250, 247, 0.75); }
.ch-entry--accent .ch-entry__action { color: #FAFAF7; }
.ch-entry--accent::before { background: radial-gradient(circle at 100% 0%, rgba(180, 83, 9, 0.32) 0%, transparent 50%); opacity: 1; }

/* =========================================================================
   Workspace card grid (static / dynamic dashboards)
   ========================================================================= */
.ch-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.ch-section-head__title {
  margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em;
}
.ch-section-head__copy {
  margin: 4px 0 0 0; font-size: 13px; color: var(--text-muted);
}
.ch-section-head__count {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  font-size: 12px; font-weight: 500; color: var(--text-muted);
}

.ch-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-4);
}
.ch-card {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.ch-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--sh-sm);
  transform: translateY(-1px);
}
.ch-card__top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--s-2);
}
.ch-card__pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500;
  background: var(--success-soft); color: var(--success);
  border: 1px solid rgba(4, 120, 87, 0.18);
}
.ch-card__pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.ch-card__title {
  margin: 0;
  font-size: 15px; font-weight: 600;
  color: var(--text); letter-spacing: -0.005em;
}
.ch-card__route {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-soft);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  width: fit-content;
}
.ch-card__scope {
  margin: 4px 0 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}
.ch-card__action {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: var(--s-2);
  font-size: 12px; font-weight: 600; color: var(--accent);
}
.ch-card__action::after {
  content: '→';
  transition: transform var(--t-fast);
}
.ch-card:hover .ch-card__action::after { transform: translateX(3px); }

/* Empty state */
.ch-empty {
  text-align: center;
  padding: var(--s-12) var(--s-6);
  border-radius: var(--r-lg);
  border: 1px dashed var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
