/* ============================================================
   TRADERIG - SHARED DESIGN SYSTEM
   Version 1.0
   ============================================================ */

/* ── GOOGLE FONTS ── */
@import url('https://fonts.googleapis.com/css2?family=Archivo+Narrow:wght@700;800&family=Inter:wght@300;400;500;600;700&family=Roboto+Mono:wght@500;700&display=swap');

/* ── CSS VARIABLES ── */
:root {
  /* Brand Colors */
  --navy:        #0b0f14;
  --navy-mid:    #121821;
  --navy-light:  #1a222e;
  --amber:       #1fa85d;
  --amber-dark:  #0c6637;
  --amber-soft:  #e2f4ea;
  --amber-light: #e2f4ea;

  /* Neutrals */
  --bg:          #f4f3ef;
  --bg-alt:      #ecebe5;
  --white:       #ffffff;
  --slate:       #64748b;
  --slate-light: #94a3b8;
  --line:        #e2e8f0;
  --line-strong: #cbd5e1;

  /* Semantic */
  --text:        #0b0f14;
  --text-muted:  #64748b;
  --success:     #16a34a;
  --success-bg:  #f0fdf4;
  --warning:     #6d28d9;
  --warning-bg:  #f0e9fb;
  --danger:      #dc2626;
  --danger-bg:   #fef2f2;
  --info:        #2563eb;
  --info-bg:     #eff6ff;

  /* Shadows */
  --shadow-xs:   0 1px 3px rgba(15,23,42,.06);
  --shadow-sm:   0 4px 12px rgba(15,23,42,.07);
  --shadow-md:   0 12px 32px rgba(15,23,42,.09);
  --shadow-lg:   0 24px 64px rgba(15,23,42,.10);
  --shadow-xl:   0 40px 80px rgba(15,23,42,.12);

  /* Radius */
  --r-xs:  6px;
  --r-sm:  10px;
  --r:     16px;
  --r-lg:  24px;
  --r-xl:  32px;
  --r-full: 999px;

  /* Spacing */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* Typography */
  --font-head: 'Archivo Narrow', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Roboto Mono', monospace;

  /* Transitions */
  --ease:      cubic-bezier(.4,0,.2,1);
  --ease-out:  cubic-bezier(0,0,.2,1);
  --t-fast:    .15s;
  --t-base:    .22s;
  --t-slow:    .35s;

  /* Nav */
  --nav-h:     64px;
  --side-w:    240px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* ── TYPOGRAPHY ── */
.t-display {
  font-family: var(--font-head);
  font-size: clamp(48px, 6vw, 88px);
  font-weight: 800;
  line-height: .90;
  letter-spacing: -.05em;
  text-transform: uppercase;
}

.t-h1 {
  font-family: var(--font-head);
  font-size: clamp(36px, 4.5vw, 64px);
  font-weight: 800;
  line-height: .92;
  letter-spacing: -.04em;
  text-transform: uppercase;
}

.t-h2 {
  font-family: var(--font-head);
  font-size: clamp(28px, 3.5vw, 48px);
  font-weight: 800;
  line-height: .94;
  letter-spacing: -.03em;
  text-transform: uppercase;
}

.t-h3 {
  font-family: var(--font-head);
  font-size: clamp(20px, 2.5vw, 32px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.t-h4 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
  text-transform: uppercase;
}

.t-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.t-body-lg { font-size: 18px; line-height: 1.7; }
.t-body    { font-size: 15px; line-height: 1.65; }
.t-body-sm { font-size: 13px; line-height: 1.6; }
.t-caption { font-size: 12px; line-height: 1.5; }

.t-navy   { color: var(--navy); }
.t-amber  { color: var(--amber); }
.t-muted  { color: var(--text-muted); }
.t-white  { color: var(--white); }

em.accent { font-style: normal; color: var(--amber); }

/* ── LAYOUT ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5%;
  width: 100%;
}

.container-sm {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 5%;
}

.section {
  padding: var(--sp-24) 5%;
}

.section-sm {
  padding: var(--sp-16) 5%;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: var(--sp-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--sp-6); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: var(--sp-6); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }

/* ── SECTION LABELS ── */
.mono-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: var(--sp-3);
}

.mono-tag::before {
  content: '';
  width: 16px;
  height: 2px;
  background: var(--amber);
  border-radius: 2px;
  flex-shrink: 0;
}

.mono-tag.center { justify-content: center; }
.mono-tag.center::before { display: none; }

.mono-tag.navy { color: var(--navy-mid); }
.mono-tag.navy::before { background: var(--navy-mid); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 0 20px;
  height: 44px;
  border-radius: var(--r-sm);
  border: none;
  cursor: pointer;
  transition:
    transform var(--t-base) var(--ease),
    box-shadow var(--t-base) var(--ease),
    background var(--t-base) var(--ease),
    border-color var(--t-base) var(--ease),
    color var(--t-base) var(--ease);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: linear-gradient(180deg, #1fa85d 0%, var(--amber) 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(31,168,93,.25);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(31,168,93,.32);
}
.btn-primary:active { transform: translateY(0); }

/* Primary Large */
.btn-primary-lg {
  height: 52px;
  font-size: 15px;
  font-weight: 700;
  padding: 0 28px;
  border-radius: var(--r);
}

/* Secondary */
.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  border-color: var(--amber);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--line);
}

/* Ghost Dark (for dark backgrounds) */
.btn-ghost-dark {
  background: transparent;
  color: rgba(255,255,255,.7);
  border: 1px solid rgba(255,255,255,.18);
}
.btn-ghost-dark:hover {
  color: #fff;
  border-color: rgba(255,255,255,.4);
  background: rgba(255,255,255,.06);
}

/* Danger */
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
}
.btn-danger:hover {
  background: #fee2e2;
  transform: translateY(-1px);
}

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--r-sm);
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--slate);
  flex-shrink: 0;
}
.btn-icon:hover {
  border-color: var(--amber);
  color: var(--amber);
  transform: translateY(-1px);
}

/* ── CARDS ── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-xs);
  transition:
    border-color var(--t-base) var(--ease),
    box-shadow var(--t-base) var(--ease),
    transform var(--t-base) var(--ease);
}

.card-hover:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.card-accent-top { border-top: 3px solid var(--amber); }
.card-accent-left { border-left: 3px solid var(--amber); }
.card-navy { background: var(--navy); border-color: var(--navy); }
.card-bg { background: var(--bg); border-color: transparent; }

/* ── FORMS ── */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition:
    border-color var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease);
}

.input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(31,168,93,.12);
}

.input.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,.1);
}

.input::placeholder { color: var(--slate-light); }

textarea.input {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 100px;
}

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
}

.error-banner {
  display: none;
  padding: 12px 14px;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--r-sm);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}
.error-banner.show { display: block; }

.success-banner {
  display: none;
  padding: 12px 14px;
  background: var(--success-bg);
  border: 1px solid #bbf7d0;
  border-radius: var(--r-sm);
  color: var(--success);
  font-size: 13px;
  font-weight: 600;
}
.success-banner.show { display: block; }

/* Checkbox */
.checkbox-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.checkbox-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--amber);
  cursor: pointer;
}

/* Radio */
.radio-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease);
  background: var(--white);
}

.radio-card:hover { border-color: rgba(31,168,93,.4); }
.radio-card.selected { border-color: var(--amber); background: var(--amber-soft); }

.radio-card input[type="radio"] { accent-color: var(--amber); margin-top: 2px; flex-shrink: 0; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.badge-pass    { background: var(--success-bg); color: var(--success); }
.badge-warn    { background: var(--warning-bg); color: var(--warning); }
.badge-fail    { background: var(--danger-bg);  color: var(--danger); }
.badge-info    { background: var(--info-bg);    color: var(--info); }
.badge-neutral { background: var(--bg-alt);     color: var(--slate); border: 1px solid var(--line); }
.badge-amber   { background: var(--amber-soft); color: var(--amber-dark); }
.badge-navy    { background: rgba(15,23,42,.08); color: var(--navy); }

.badge-dot::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── ICONS ── */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}

.icon-wrap-sm  { width: 32px; height: 32px; border-radius: 8px; }
.icon-wrap-md  { width: 44px; height: 44px; border-radius: 10px; }
.icon-wrap-lg  { width: 56px; height: 56px; border-radius: 12px; }
.icon-wrap-xl  { width: 72px; height: 72px; border-radius: 16px; }

.icon-wrap-amber  { background: var(--amber-soft); color: var(--amber-dark); }
.icon-wrap-navy   { background: rgba(15,23,42,.07); color: var(--navy); }
.icon-wrap-white  { background: rgba(255,255,255,.12); color: #fff; }
.icon-wrap-success{ background: var(--success-bg); color: var(--success); }
.icon-wrap-danger { background: var(--danger-bg);  color: var(--danger); }
.icon-wrap-info   { background: var(--info-bg);    color: var(--info); }

/* ── PUBLIC NAV ── */
.pub-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(247,246,242,.96);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 5%;
  gap: var(--sp-8);
  transition: box-shadow var(--t-base) var(--ease);
}

.pub-nav.scrolled { box-shadow: var(--shadow-sm); }

.pub-nav-logo { height: 28px; display: block; flex-shrink: 0; }

.pub-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.pub-nav-item {
  position: relative;
}

.pub-nav-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  border: none;
  background: none;
  white-space: nowrap;
}

.pub-nav-trigger:hover { color: var(--text); background: var(--bg-alt); }
.pub-nav-trigger.active { color: var(--text); }

.pub-nav-trigger svg {
  transition: transform var(--t-base) var(--ease);
  flex-shrink: 0;
}
.pub-nav-item:hover .pub-nav-trigger svg { transform: rotate(180deg); }

/* Mega Dropdown */
.pub-nav-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  min-width: 280px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--t-base) var(--ease),
    transform var(--t-base) var(--ease),
    visibility var(--t-base) var(--ease);
  z-index: 200;
}

.pub-nav-item:hover .pub-nav-dropdown,
.pub-nav-dropdown:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.pub-nav-dropdown.wide { min-width: 480px; }
.pub-nav-dropdown.wide .dd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }

.dd-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  text-decoration: none;
  color: var(--text);
}

.dd-item:hover {
  background: var(--bg);
  transform: translateX(3px);
}

.dd-item:hover .dd-item-title { color: var(--amber); }

.dd-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--amber-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--amber-dark);
  transition: background var(--t-base) var(--ease);
}

.dd-item:hover .dd-item-icon { background: var(--amber-light); }
.dd-item-icon.navy { background: rgba(15,23,42,.07); color: var(--navy); }
.dd-item:hover .dd-item-icon.navy { background: rgba(15,23,42,.12); }

.dd-item-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  transition: color var(--t-fast) var(--ease);
}

.dd-item-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.dd-divider {
  height: 1px;
  background: var(--line);
  margin: var(--sp-2) 0;
}

.dd-footer {
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--amber);
  cursor: pointer;
  transition: gap var(--t-base) var(--ease);
}
.dd-footer:hover { gap: var(--sp-3); }

.pub-nav-cta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* ── APP SHELL ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Compatibility aliases for the newer company shell pages */
.sidenav {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--side-w);
  background: var(--navy);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform var(--t-slow) var(--ease);
  overflow: hidden;
}

.sidenav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  z-index: 180;
  display: none;
}

.sidenav-head {
  padding: 20px var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidenav-section {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: 0 var(--sp-3);
  margin: var(--sp-4) 0 var(--sp-2);
}

.sidenav-section:first-child { margin-top: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.55);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    padding-left var(--t-base) var(--ease);
  text-decoration: none;
  position: relative;
  margin-bottom: 2px;
}

.nav-link svg { flex-shrink: 0; opacity: .6; transition: opacity var(--t-fast); }

.nav-link:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
  padding-left: 16px;
}

.nav-link:hover svg { opacity: 1; }

.nav-link.active {
  background: rgba(31,168,93,.18);
  color: #fff;
  font-weight: 600;
}

.nav-link.active svg { opacity: 1; color: var(--amber); }

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--amber);
  border-radius: 0 2px 2px 0;
}

.sidenav-foot {
  padding: var(--sp-4) var(--sp-3);
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.topbar {
  position: fixed;
  top: 0;
  left: var(--side-w);
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
  transition: left var(--t-base) var(--ease);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

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

.topbar-greeting {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.breadcrumb-item {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color var(--t-fast) var(--ease);
}

.breadcrumb-item:hover { color: var(--amber); }

.breadcrumb-current {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.breadcrumb-sep {
  color: var(--slate-light);
  display: inline-flex;
  align-items: center;
}

.main {
  margin-left: var(--side-w);
  margin-top: var(--nav-h);
  min-height: calc(100vh - var(--nav-h));
  padding: var(--sp-8);
  background: var(--bg);
}

/* Top Bar */
.app-topbar {
  position: fixed;
  top: 0; left: var(--side-w); right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
  transition: left var(--t-base) var(--ease);
}

.app-topbar-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex: 1;
}

.app-topbar-workspace {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease);
}
.app-topbar-workspace:hover { border-color: var(--amber); }

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

/* Notification Bell */
.notif-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--slate);
  position: relative;
  transition: border-color var(--t-fast), color var(--t-fast);
}
.notif-btn:hover { border-color: var(--amber); color: var(--amber); }

.notif-dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--white);
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber) 0%, var(--amber-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
  transition: box-shadow var(--t-fast);
}
.avatar:hover { box-shadow: 0 0 0 3px rgba(31,168,93,.2); }

/* Side Nav */
.app-sidenav {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--side-w);
  background: var(--navy);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform var(--t-slow) var(--ease);
  overflow: hidden;
}

.sidenav-header {
  padding: 20px var(--sp-5);
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidenav-logo { height: 24px; display: block; }

.sidenav-workspace {
  margin-top: var(--sp-3);
  padding: 6px 10px;
  background: rgba(255,255,255,.06);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.4);
}

.sidenav-body {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidenav-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: 0 var(--sp-3);
  margin: var(--sp-4) 0 var(--sp-2);
}

.sidenav-section-label:first-child { margin-top: 0; }

.sidenav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.55);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--t-fast) var(--ease),
    color var(--t-fast) var(--ease),
    padding-left var(--t-base) var(--ease);
  text-decoration: none;
  position: relative;
  margin-bottom: 2px;
}

.sidenav-link svg { flex-shrink: 0; opacity: .6; transition: opacity var(--t-fast); }

.sidenav-link:hover {
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.9);
  padding-left: 16px;
}

.sidenav-link:hover svg { opacity: 1; }

.sidenav-link.active {
  background: rgba(31,168,93,.18);
  color: #fff;
  font-weight: 600;
}
.sidenav-link.active svg { opacity: 1; color: var(--amber); }
.sidenav-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--amber);
  border-radius: 0 2px 2px 0;
}

.sidenav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--r-full);
  background: var(--amber);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidenav-footer {
  padding: var(--sp-4) var(--sp-3);
  border-top: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

/* App Main Content */
.app-main {
  margin-left: var(--side-w);
  margin-top: var(--nav-h);
  flex: 1;
  min-height: calc(100vh - var(--nav-h));
  padding: var(--sp-8);
  background: var(--bg);
}

/* ── PROGRESS BAR (onboarding) ── */
.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--line);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--amber-dark) 0%, var(--amber) 100%);
  border-radius: var(--r-full);
  transition: width var(--t-slow) var(--ease-out);
}

/* ── STAT CARDS ── */
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-6);
  transition: border-color var(--t-base), transform var(--t-base), box-shadow var(--t-base);
}

.stat-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stat-card-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-2);
}

.stat-card-value {
  font-family: var(--font-head);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--navy);
}

.stat-card-value .unit {
  font-size: 22px;
  color: var(--amber);
}

.stat-card-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

.stat-card-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  margin-top: var(--sp-2);
}

.trend-up   { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-flat { color: var(--text-muted); }

/* ── TABLE ── */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--white);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  white-space: nowrap;
}

.table td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }

.table tbody tr {
  transition: background var(--t-fast) var(--ease);
}

.table tbody tr:hover { background: var(--bg); }

/* ── SCORE DISPLAY ── */
.score-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-family: var(--font-head);
  font-weight: 800;
  flex-shrink: 0;
}

.score-circle-sm { width: 40px; height: 40px; font-size: 14px; }
.score-circle-md { width: 52px; height: 52px; font-size: 18px; }
.score-circle-lg { width: 68px; height: 68px; font-size: 24px; border-radius: 14px; }

.score-pass { background: var(--success-bg); color: var(--success); }
.score-warn { background: var(--warning-bg); color: var(--warning); }
.score-fail { background: var(--danger-bg);  color: var(--danger); }
.score-none { background: var(--bg-alt);     color: var(--slate); }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-16) var(--sp-8);
  gap: var(--sp-4);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-light);
}

.empty-state h3 {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -.02em;
  color: var(--navy);
}

.empty-state p {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 320px;
  line-height: 1.65;
}

/* ── LOADING STATE ── */
.skeleton {
  background: linear-gradient(90deg, var(--line) 25%, var(--bg-alt) 50%, var(--line) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--r-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── MOBILE NAV ── */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  cursor: pointer;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  transition: background var(--t-fast);
}

.hamburger:hover { background: var(--bg-alt); }

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--t-base) var(--ease), opacity var(--t-base) var(--ease), width var(--t-base) var(--ease);
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--white);
  z-index: 999;
  padding: var(--sp-6);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--t-slow) var(--ease);
}

.mobile-menu.open { transform: translateX(0); }

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: color var(--t-fast);
}

.mobile-menu-link:hover { color: var(--amber); }

.mobile-menu-section {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--sp-4) 0 var(--sp-2);
}

/* ── SCROLL ANIMATIONS ── */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity .55s var(--ease-out),
    transform .55s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-20px);
  transition: opacity .55s var(--ease-out), transform .55s var(--ease-out);
}
.reveal-left.visible { opacity: 1; transform: translateX(0); }

.reveal-right {
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .55s var(--ease-out), transform .55s var(--ease-out);
}
.reveal-right.visible { opacity: 1; transform: translateX(0); }

.reveal-scale {
  opacity: 0;
  transform: scale(.97);
  transition: opacity .5s var(--ease-out), transform .5s var(--ease-out);
}
.reveal-scale.visible { opacity: 1; transform: scale(1); }

.d-1 { transition-delay: .08s; }
.d-2 { transition-delay: .16s; }
.d-3 { transition-delay: .24s; }
.d-4 { transition-delay: .32s; }
.d-5 { transition-delay: .40s; }

/* ── NOTIFICATION / TOAST ── */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.toast {
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 240px;
  animation: toastIn .3s var(--ease-out) forwards;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--amber); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ── DIVIDERS ── */
.divider { height: 1px; background: var(--line); width: 100%; }
.divider-v { width: 1px; background: var(--line); align-self: stretch; }

/* ── UTILITY ── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pointer  { cursor: pointer; }
.no-select { user-select: none; }
.w-full { width: 100%; }
.mt-auto { margin-top: auto; }
.mb-0 { margin-bottom: 0; }

/* Dark section overrides */
.section-dark { background: var(--navy); }
.section-dark .mono-tag { color: var(--amber); }
.section-dark .mono-tag::before { background: var(--amber); }
.section-dark .t-h1,
.section-dark .t-h2,
.section-dark .section-h { color: #fff; }
.section-dark .section-lead,
.section-dark .t-body { color: rgba(255,255,255,.5); }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
}

@media (max-width: 900px) {
  .pub-nav-links { display: none; }
  .hamburger { display: flex; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  :root { --side-w: 0px; }
  .app-sidenav { transform: translateX(-240px); --side-w: 240px; }
  .app-sidenav.open { transform: translateX(0); }
  .app-topbar { left: 0; }
  .app-main { margin-left: 0; padding: var(--sp-5); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .section { padding: var(--sp-16) 5%; }
}

@media (max-width: 480px) {
  .section { padding: var(--sp-12) 5%; }
  .btn-primary-lg { height: 48px; font-size: 14px; padding: 0 20px; }
}

/* ── NOTIFICATION BELL (base styles only - dropdown is injected by auth.js) ── */
.notif-btn { position: relative; cursor: pointer; }

/* ── GLOBAL INTERACTION POLISH ── */

/* Button press feel */
.btn:not(:disabled):active,
.btn-primary:not(:disabled):active,
.btn-secondary:not(:disabled):active,
.btn-outline:not(:disabled):active { transform: scale(.97); }

/* Disabled state */
.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-outline:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading button spinner */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btnSpin .6s linear infinite;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* Enhanced table body row hover */
.table tbody tr,
table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover,
table tbody tr:hover { background: var(--bg) !important; }

/* Consistent card hover lift for all card types */
.crew-table-card,
.risk-card,
.completion-card,
.right-panel .card,
.module-card {
  transition: box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--ease);
}

/* Smooth focus rings for keyboard nav */
a:focus-visible,
button:focus-visible,
[tabindex="0"]:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Table scrollbar minimal */
.table-wrap::-webkit-scrollbar { height: 4px; }
.table-wrap::-webkit-scrollbar-track { background: var(--bg); }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }

/* Notification list scrollbar minimal */
.notif-list::-webkit-scrollbar { width: 4px; }
.notif-list::-webkit-scrollbar-track { background: transparent; }
.notif-list::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
