/* ============================================================
   AGENA HUB — Design System
   Brand: Olive (#555725) · Yellow (#FAF185) · Off-white · Black
   Fonts: Syne (display) · DM Sans (body) · DM Mono (code)
   ============================================================ */

:root {
  --black:        #0a0a0a;
  --white:        #ffffff;
  --off-white:    #f7f6f0;
  --accent:       #FAF185;
  --accent-dark:  #e0c800;
  --brand:        #555725;
  --brand-dark:   #3d3f18;
  --brand-mid:    #6e7230;
  --surface:      #ffffff;
  --surface2:     #f7f6f0;
  --surface3:     #edecd8;
  --border:       #e4e3d4;
  --border-mid:   #cccbb8;
  --text:         #0a0a0a;
  --text-mid:     #3a3829;
  --text-muted:   #7a7866;
  --red:          #b91c1c;
  --red-bg:       #fef2f2;
  --green:        #166534;
  --green-bg:     #f0fdf4;
  --orange:       #9a3412;
  --orange-bg:    #fff7ed;
  --blue:         #1e40af;
  --blue-bg:      #eff6ff;
  --purple:       #6d28d9;
  --purple-bg:    #ede9fe;
  --teal:         #0f766e;
  --teal-bg:      #ccfbf1;

  --font-d: 'Syne', sans-serif;
  --font-b: 'DM Sans', sans-serif;
  --font-m: 'DM Mono', monospace;

  --r:    6px;
  --r-lg: 12px;
  --r-xl: 18px;
  --t:    0.15s ease;
  --nav-h: 60px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 36px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.05);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  background: var(--off-white);
  color: var(--text);
  font-family: var(--font-b);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-b); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-b); outline: none; }

/* ── NAV ──────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--brand);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 1.5rem;
}

/* App switcher — matches demo app style */
.app-switcher { position: relative; }
.app-switcher summary {
  list-style: none;
  cursor: pointer;
  color: rgba(255,255,255,.75);
  padding: 6px 10px;
  border-radius: var(--r);
  font-size: 16px;
  line-height: 1;
  user-select: none;
  transition: background var(--t);
}
.app-switcher summary::-webkit-details-marker { display: none; }
.app-switcher summary:hover { background: rgba(255,255,255,.12); color: #fff; }
.app-switcher[open] summary { background: rgba(255,255,255,.15); color: #fff; }
.switcher-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px;
  min-width: 180px;
  z-index: 200;
}
.switcher-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  transition: background var(--t);
}
.switcher-dropdown a:hover { background: var(--surface2); }
.switcher-dropdown a.current { background: #eff6ff; color: var(--blue); font-weight: 600; }
.switcher-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* Nav brand */
.nav-divider { color: rgba(255,255,255,.2); margin: 0 .25rem; font-weight: 300; font-size: 1.1rem; }
.nav-brand { display: flex; align-items: center; }
.brand-logo {
  height: 22px;
  width: auto;
  filter: brightness(0) invert(1);
}
.brand-text {
  font-family: var(--font-d);
  font-weight: 700;
  font-size: .95rem;
  color: rgba(255,255,255,.9);
  letter-spacing: -.01em;
}

/* Nav links */
.nav-links { display: flex; gap: .125rem; flex: 1; }
.nav-link {
  color: rgba(255,255,255,.6);
  font-size: .84rem;
  font-weight: 500;
  padding: .35rem .7rem;
  border-radius: var(--r);
  transition: color var(--t), background var(--t);
}
.nav-link:hover { color: rgba(255,255,255,.9); background: rgba(0,0,0,.15); }
.nav-link.active { color: #fff; background: rgba(0,0,0,.2); }

/* Nav user */
.nav-user { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.nav-user-name { font-size: .875rem; color: rgba(255,255,255,.75); }
.btn-ghost {
  background: transparent;
  color: rgba(255,255,255,.55);
  font-size: .8rem;
  padding: .28rem .6rem;
  border-radius: var(--r);
  transition: color var(--t), background var(--t);
  white-space: nowrap;
}
.btn-ghost:hover { color: #fff; background: rgba(0,0,0,.2); }

/* ── MAIN ─────────────────────────────────────────────────────── */
.main { max-width: 1200px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.main-auth {
  display: flex;
  min-height: 100vh;
  background: var(--brand-dark);
}

/* ── FLASH ────────────────────────────────────────────────────── */
.req        { color: var(--red); }
.flash-wrap { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: .5rem; }
.flash { padding: .75rem 1rem; border-radius: var(--r); font-size: .875rem; }
.flash-success { background: var(--green-bg); color: var(--green); border: 1px solid #bbf7d0; }
.flash-danger  { background: var(--red-bg);   color: var(--red);   border: 1px solid #fecaca; }
.flash-info    { background: var(--blue-bg);  color: var(--blue);  border: 1px solid #bfdbfe; }

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--r);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--t), box-shadow var(--t), transform .1s;
  white-space: nowrap;
  font-family: var(--font-b);
}
.btn:active { transform: scale(.98); }
.btn-brand {
  background: var(--brand);
  color: #fff;
}
.btn-brand:hover { background: var(--brand-dark); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--surface3); color: var(--text-mid); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: .3rem .65rem; font-size: .8rem; }
.btn-link { background: none; border: none; color: var(--brand); cursor: pointer;
            font-size: .85rem; padding: 0; font-weight: 500; font-family: var(--font-b); }
.btn-link:hover { text-decoration: underline; }
.btn-link-danger { color: var(--red); }
.w-full { width: 100%; }

/* ── AUTH ─────────────────────────────────────────────────────── */
.auth-brand {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  background: var(--brand);
  padding: 3rem 2rem;
}
.auth-brand-mark {
  height: 110px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: .9;
}
.auth-brand-tagline {
  font-family: var(--font-d);
  font-size: .85rem;
  font-weight: 600;
  color: rgba(255,255,255,.6);
  text-transform: uppercase;
  letter-spacing: .12em;
}
.auth-form-pane {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--off-white);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 2rem;
}
.auth-title {
  font-family: var(--font-d);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}
.auth-subtitle {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 1px;
}
.auth-footer {
  margin-top: 1.5rem;
  font-size: .73rem;
  color: var(--text-muted);
  text-align: center;
}

/* ── FORMS ────────────────────────────────────────────────────── */
.field { margin-bottom: 1.1rem; }
.label, .field label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .35rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.input, .field input, .field select, .field textarea {
  width: 100%;
  padding: .6rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: .9rem;
  font-family: var(--font-b);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t);
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(85,87,37,.12);
}
.field small { font-size: .78rem; color: var(--text-muted); font-weight: 400;
               text-transform: none; letter-spacing: 0; }
label.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: 400;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.4;
}
.checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--brand);
}
.store-checkboxes {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding-left: 1.25rem;
  margin-top: .5rem;
}

/* ── CARD ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}
.form-card { max-width: 660px; }
.form-section { margin-bottom: 2rem; }
.form-section h2 {
  font-family: var(--font-d);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: .6rem;
  margin-bottom: 1.25rem;
}
.form-actions { display: flex; gap: .75rem; margin-top: .25rem; }

/* ── PAGE HEADER ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}
.page-header h1 {
  font-family: var(--font-d);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
}

/* ── TABLE ────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: .7rem 1rem;
  text-align: left;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .09em;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: .85rem 1rem;
  font-size: .875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-mid);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t); }
.table tbody tr:hover { background: var(--surface2); }
.row-inactive td { color: var(--text-muted); }
.table td.actions { display: flex; gap: .75rem; align-items: center; }
.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem !important;
  font-size: .875rem;
}

/* User cell with avatar */
.user-cell { display: flex; align-items: center; gap: .75rem; }
.user-cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 700;
  color: var(--brand-dark);
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-cell-name  { font-weight: 600; font-size: .875rem; color: var(--text); }
.user-cell-email { font-size: .78rem; color: var(--text-muted); margin-top: 1px; }

/* ── SEARCH BAR ───────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.25rem;
  max-width: 380px;
}
.search-bar input {
  flex: 1;
  padding: .55rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: .875rem;
  font-family: var(--font-b);
  background: var(--surface);
  transition: border-color var(--t), box-shadow var(--t);
}
.search-bar input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(85,87,37,.12);
}

/* ── BADGES ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.badge-green  { background: var(--green-bg); color: var(--green); }
.badge-gray   { background: var(--surface3); color: var(--text-muted); }
.badge-olive  { background: #ecf0cc; color: var(--brand-dark); }
.badge-teal   { background: var(--teal-bg); color: var(--teal); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-blue   { background: var(--blue-bg); color: var(--blue); }
.badge-yellow { background: var(--accent); color: var(--brand-dark); }

/* ── LANDING ──────────────────────────────────────────────────── */
.landing-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3.5rem 1rem 4rem;
  gap: 2.5rem;
}
.landing-header { text-align: center; }
.landing-greeting {
  font-family: var(--font-d);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  margin-bottom: .4rem;
}
.landing-sub { font-size: .9rem; color: var(--text-muted); }

.app-cards {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 800px;
}
.app-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 2rem 1.75rem;
  min-width: 180px;
  flex: 1;
  max-width: 220px;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  position: relative;
  overflow: hidden;
}
.app-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand);
  opacity: 0;
  transition: opacity .18s;
}
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-mid);
}
.app-card:hover::before { opacity: 1; }

.card-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: .9rem;
  background: var(--surface3);
}
.card-label {
  font-family: var(--font-d);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .25rem;
  color: var(--text);
}
.card-role {
  font-size: .78rem;
  color: var(--text-muted);
  text-transform: capitalize;
}
.no-access-msg {
  color: var(--text-muted);
  font-size: .9rem;
  text-align: center;
  padding: 2rem;
  background: var(--surface);
  border: 1px dashed var(--border-mid);
  border-radius: var(--r-lg);
  max-width: 360px;
}

/* ── Quick-logout FAB (store_manager / store_crew only) ── */
.quick-logout {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand);
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  border-radius: 2rem;
  padding: 0.55rem 1rem 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.quick-logout:hover {
  background: var(--brand-dark, #3d3f18);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
}
.quick-logout-icon { font-size: 1rem; line-height: 1; }
@media (max-width: 768px) {
  .quick-logout {
    padding: 0.7rem;
    border-radius: 50%;
    bottom: 1.5rem;
    left: 1rem;
    width: 44px;
    height: 44px;
    justify-content: center;
  }
  .quick-logout-label { display: none; }
  .quick-logout-icon { font-size: 1.2rem; }
}
