/* ========================================
   SAINT PAUL FACILITIES MANAGER — GLOBAL
   ======================================== */

/* ============================================================
   DESIGN TOKENS
   Every size, space, colour and shadow in the app comes from
   here. If a value is not a token, it is a bug -- that is what
   produced 22 font sizes and 161 colours before this existed.
   ============================================================ */
:root {
  /* ---- Type scale (1.125-1.25 ratio, 16px base) ---- */
  --text-2xs:  0.6875rem;   /* 11px - dense meta only */
  --text-xs:   0.75rem;     /* 12px - badges, captions */
  --text-sm:   0.875rem;    /* 14px - secondary text, table cells */
  --text-base: 1rem;        /* 16px - body default */
  --text-lg:   1.125rem;    /* 18px - card titles */
  --text-xl:   1.25rem;     /* 20px - section headings */
  --text-2xl:  1.5rem;      /* 24px - page titles */
  --text-3xl:  1.875rem;    /* 30px - stat figures */
  --text-4xl:  2.25rem;     /* 36px - hero numbers */

  --leading-tight:   1.2;
  --leading-snug:    1.35;
  --leading-normal:  1.55;
  --leading-relaxed: 1.7;

  --weight-normal:  400;
  --weight-medium:  500;
  --weight-semi:    600;
  --weight-bold:    700;
  --weight-black:   800;

  --tracking-tight: -0.015em;
  --tracking-wide:   0.04em;
  --tracking-caps:   0.06em;

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

  /* ---- Radius ---- */
  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-pill: 9999px;

  /* ---- Elevation: three levels, layered and soft ---- */
  --shadow-sm: 0 1px 2px rgba(16,24,40,0.05);
  --shadow:    0 1px 3px rgba(16,24,40,0.07), 0 4px 12px -2px rgba(16,24,40,0.06);
  --shadow-lg: 0 4px 8px -2px rgba(16,24,40,0.08), 0 16px 32px -4px rgba(16,24,40,0.12);
  --shadow-xl: 0 8px 16px -4px rgba(16,24,40,0.10), 0 28px 56px -8px rgba(16,24,40,0.18);
  --ring: 0 0 0 3px rgba(34,114,195,0.18);

  /* ---- Neutrals (cool, slightly blue) ---- */
  --bg:            #f6f8fb;
  --surface:       #ffffff;
  --surface-2:     #fafbfd;
  --surface-sunken:#f1f4f9;
  --border:        #e6eaf1;
  --border-strong: #d2dae5;
  --text:          #0f1729;
  --text-muted:    #5a6577;
  --text-light:    #8b95a6;

  /* ---- Brand ---- */
  --blue:   #2272C3;
  --blue-hover: #1b5fa3;
  --blue-soft:  #eaf2fb;
  --green:  #2BAE4A;
  --green-soft: #e8f7ec;
  --purple: #9B2D8E;
  --purple-soft: #f7ebf5;
  --red:    #d92d39;
  --amber:  #d98a12;
  --accent: var(--blue);
  --accent-hover: var(--blue-hover);
  --btn-default: #0f1729;

  /* Aliases used by page-level styles. --primary, --card-bg and --bg-alt were
     referenced in several templates but never defined anywhere, so rules like
     `border-bottom: 2px solid var(--primary)` silently rendered invalid. */
  --primary: var(--blue);
  --card-bg: var(--surface);
  --bg-alt: var(--surface-sunken);

  /* ---- Semantic status: bg / text / border triplets ---- */
  --ok-bg:      #e8f7ec;  --ok-fg:      #14803c;  --ok-border:      #b7e6c6;
  --info-bg:    #eaf2fb;  --info-fg:    #1b5fa3;  --info-border:    #bcd9f4;
  --warn-bg:    #fdf3e3;  --warn-fg:    #a86a10;  --warn-border:    #f2ddb4;
  --danger-bg:  #fdeaec;  --danger-fg:  #b3232f;  --danger-border:  #f6c6cb;
  --neutral-bg: #f1f4f9;  --neutral-fg: #5a6577;  --neutral-border: #dde3ec;

  /* ---- Layout ---- */
  --sidebar-bg: #12141d;
  --sidebar-w: 248px;
  --sidebar-collapsed: 68px;
  --mobile-nav-h: 62px;
  --content-max: 1440px;

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 120ms;
  --normal: 200ms;

  /* ---- Type families ---- */
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-heading: 'Lato', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'SFMono-Regular', 'Consolas', 'Liberation Mono', monospace;
}

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

html {
  font-size: 16px;              /* web standard; the old 15px broke rem math */
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-sm);
  line-height: var(--leading-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';  /* Inter's cleaner glyphs */
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Keyboard focus ring. Several components set `outline: none` for mouse
   polish, which also erased the only cue keyboard users get. :focus-visible
   fires for keyboard/AT navigation but not mouse clicks, so we get both. */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.sidebar :focus-visible,
.sidebar-search-input:focus-visible {
  outline-color: #7db4ec;   /* readable against the dark sidebar */
}
/* Belt and braces: re-assert a ring on elements whose rules kill the outline. */
.form-input:focus-visible,
.filter-search:focus-visible,
.kanban-note-input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 1px;
}

/* Skip link — first tab stop, lets keyboard users jump past the nav. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  padding: 10px 18px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
  text-decoration: none;
}

/* Visually hidden but available to screen readers. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Respect the OS "reduce motion" setting — the app animates a lot
   (beacon pulses, drawer slides, aurora blobs, tour spotlights). */
@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;
  }
}

/* ========================================
   EMPTY STATES
   ======================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state svg { opacity: 0.35; }
.empty-state-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: var(--text-base);
  color: var(--text);
}
.empty-state-text {
  font-size: var(--text-sm);
  max-width: 380px;
  line-height: 1.6;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.2s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: 72px;
}
.sidebar-logo { flex-shrink: 0; color: var(--accent); }
.sidebar-brand { white-space: nowrap; overflow: hidden; }
.brand-name { display: block; font-family: var(--font-heading); font-size: var(--text-sm); font-weight: 900; color: #f0f0f5; line-height: 1.2; }
.brand-sub { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: 0.12em; color: #4e8fc7; }
.sidebar.collapsed .sidebar-brand { display: none; }
.sidebar.collapsed .sidebar-logo img { width: 36px; height: 36px; }

/* Sidebar Search */
.sidebar-search {
  padding: 8px 12px;
  margin-bottom: 4px;
  position: relative;
}
.sidebar-search-input {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: #d0d3de;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: var(--text-xs);
  font-family: var(--font-body);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.sidebar-search-input::placeholder { color: #555568; }
.sidebar-search-input:focus { border-color: rgba(34,114,195,0.5); background: rgba(255,255,255,0.08); }
.search-results {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 100%;
  background: #1e1e2d;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
}
.search-result-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: var(--text-xs);
  color: #ccc;
  display: flex;
  gap: 8px;
  align-items: center;
  text-decoration: none;
  transition: background 0.1s;
}
.search-result-item:hover { background: rgba(255,255,255,0.05); text-decoration: none; }
.search-result-type {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
  flex-shrink: 0;
}
.search-result-type.type-asset { background: #0065bd20; color: #4da3e8; }
.search-result-type.type-task { background: #95317e20; color: #c76db3; }
.search-result-type.type-vendor { background: #2aa44820; color: #5cc878; }

.sidebar.collapsed .sidebar-search { display: none; }

.sidebar-nav {
  list-style: none;
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}
.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: #8b8fa3;
  font-size: var(--text-sm);
  font-weight: 400;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-item a:hover { background: rgba(255,255,255,0.04); color: #d0d3de; }
.nav-item.active a {
  background: rgba(34,114,195,0.12);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(34,114,195,0.5), 0 0 4px rgba(34,114,195,0.3);
  border-radius: var(--radius);
}
.nav-item.active a svg {
  transform: rotate(15deg);
  transition: transform 0.3s ease;
}
.nav-item a svg { flex-shrink: 0; }
.sidebar.collapsed .nav-item a span { display: none; }
.sidebar.collapsed .nav-item a { justify-content: center; padding: 10px; }

/* Sidebar User */
.sidebar-user {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-user-info {
  flex: 1;
  overflow: hidden;
}
.sidebar-user-name {
  display: block;
  font-size: var(--text-xs);
  color: #d0d3de;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #555568;
}
.sidebar-user-logout {
  color: #555568;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  text-decoration: none;
}
.sidebar-user-logout:hover { color: #dc3545; background: rgba(255,255,255,0.04); }
.sidebar.collapsed .sidebar-user { display: none; }

/* Sidebar Dark Mode Toggle */
.sidebar.collapsed 
.sidebar-toggle {
  background: none; border: none; color: #555568; cursor: pointer;
  padding: 12px; margin: 8px; text-align: center;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-toggle:hover { color: #d0d3de; }
.sidebar.collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* ========================================
   MOBILE BOTTOM NAV
   ======================================== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--mobile-nav-h);
  background: var(--sidebar-bg);
  z-index: 100;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #8b8fa3;
  font-size: var(--text-2xs);
  text-decoration: none;
  padding: 6px 0;
}
.mobile-nav-item.active { color: #2272C3; }

/* ========================================
   MAIN CONTENT
   ======================================== */
.main-content {
  margin-left: var(--sidebar-w);
  padding: var(--space-8) var(--space-8) var(--space-12);
  min-height: 100vh;
  transition: margin-left var(--normal) var(--ease);
}
.main-content > * { max-width: var(--content-max); }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.page-title {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--weight-black);
  letter-spacing: var(--tracking-tight);
  color: var(--text);
}
.page-subtitle {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}
.page-actions { display: flex; gap: var(--space-2); align-items: center; }

/* Section heading -- the missing rung between page title and body text */
.section-heading {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-4);
}
.eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--text-light);
}

/* Generic surface card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--space-6); }
.card-hover { transition: box-shadow var(--normal) var(--ease), transform var(--normal) var(--ease); }
.card-hover:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.breadcrumb { font-size: var(--text-sm); color: var(--text-muted); }
.breadcrumb a { color: var(--blue); }

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 38px;
  padding: 0 var(--space-4);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semi);
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--fast) var(--ease),
              border-color var(--fast) var(--ease),
              box-shadow var(--fast) var(--ease),
              transform var(--fast) var(--ease),
              color var(--fast) var(--ease);
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5; pointer-events: none;
}

/* Primary: solid brand blue. The old blue->purple gradient read as
   decorative rather than as a control; solid fill is calmer and lets the
   purple stay a genuine accent elsewhere. */
.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.16);
}
.btn-primary:hover {
  background: var(--blue-hover);
  border-color: var(--blue-hover);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.16);
  text-decoration: none;
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--text-light);
  text-decoration: none;
}

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text); text-decoration: none; }

.btn-danger { background: var(--red); color: #fff; border-color: var(--red); box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: #b3232f; border-color: #b3232f; }

.btn-sm { height: 32px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { height: 44px; padding: 0 var(--space-5); font-size: var(--text-base); }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-block { width: 100%; }

/* ========================================
   FLASH MESSAGES
   ======================================== */
.flash-container { margin-bottom: 16px; }
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  margin-bottom: 8px;
  animation: flashIn 0.3s ease;
}
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } }
.flash-success { background: #e7f6ec; color: #1f8a38; border: 1px solid #c3e6cd; }
.flash-error { background: #fce8ea; color: #a52834; border: 1px solid #f5cdd0; }
.flash-warning { background: #fdf4e6; color: #8a6d10; border: 1px solid #f0dfa8; }
.flash-close { background: none; border: none; font-size: var(--text-xl); cursor: pointer; color: inherit; opacity: 0.6; }

/* ========================================
   FORMS
   ======================================== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4) var(--space-4);
}
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-group label, .form-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semi);
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-group-full { grid-column: 1 / -1; }
.form-hint { font-size: var(--text-xs); color: var(--text-light); }

/* Flat, bordered inputs. The old inset "neumorphic" treatment muddied the
   field edge and made focus hard to see. */
.form-input {
  width: 100%;
  min-height: 38px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.form-input::placeholder { color: var(--text-light); }
.form-input:hover { border-color: var(--text-light); }
.form-input:disabled { background: var(--surface-sunken); color: var(--text-light); cursor: not-allowed; }
textarea.form-input { min-height: 84px; padding: var(--space-3); resize: vertical; line-height: var(--leading-normal); }
select.form-input { cursor: pointer; }
.form-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: inset 2px 2px 4px rgba(0,0,0,0.08), inset -2px -2px 4px rgba(255,255,255,0.7), 0 0 0 2px rgba(59,130,246,0.15);
}
.form-input-sm { padding: 5px 8px; font-size: var(--text-xs); }
.form-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: end; }
.form-row .form-input { flex: 1; }
.form-actions { margin-top: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); cursor: pointer; }
.form-check-sm { display: flex; align-items: center; gap: 4px; font-size: var(--text-xs); }

/* Upload area — dashed border box with buttons */
.upload-area { border: 2px dashed var(--border); border-radius: 8px; padding: 20px; text-align: center; cursor: pointer; transition: border-color 0.2s; margin-bottom: 12px; }
.upload-area:hover { border-color: var(--blue); }
.upload-area input[type="file"] { display: none; }
.upload-btns { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }

/* Clay button — light grey with 3D pressed/raised feel */
.btn-clay,
.photo-input-group .btn,
.upload-area .btn,
.upload-btns .btn,
#globalAssetZonePicker .btn {
  background: linear-gradient(145deg, #e8eaef, #d1d4da);
  color: #3a3a4a;
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow:
    3px 3px 6px rgba(0,0,0,0.1),
    -2px -2px 5px rgba(255,255,255,0.7),
    inset 0 1px 1px rgba(255,255,255,0.6);
}
.btn-clay:hover,
.photo-input-group .btn:hover,
.upload-area .btn:hover,
.upload-btns .btn:hover,
#globalAssetZonePicker .btn:hover {
  background: linear-gradient(145deg, #dfe1e6, #c8cbd1);
  box-shadow:
    4px 4px 8px rgba(0,0,0,0.12),
    -2px -2px 6px rgba(255,255,255,0.8),
    inset 0 1px 1px rgba(255,255,255,0.7);
  transform: translateY(-1px);
}
.btn-clay:active,
.photo-input-group .btn:active,
.upload-area .btn:active,
.upload-btns .btn:active,
#globalAssetZonePicker .btn:active {
  box-shadow:
    inset 2px 2px 4px rgba(0,0,0,0.1),
    inset -1px -1px 3px rgba(255,255,255,0.5);
  transform: translateY(0);
}
/* Aurora modal: lighter clay on dark bg */
.aurora-modal .btn-clay,
.aurora-modal .photo-input-group .btn,
.aurora-modal .upload-area .btn,
.aurora-modal .upload-btns .btn,
.aurora-modal #globalAssetZonePicker .btn {
  background: linear-gradient(145deg, rgba(255,255,255,0.15), rgba(255,255,255,0.06));
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow:
    2px 2px 6px rgba(0,0,0,0.3),
    -1px -1px 4px rgba(255,255,255,0.05),
    inset 0 1px 1px rgba(255,255,255,0.1);
}
.aurora-modal .btn-clay:hover,
.aurora-modal .photo-input-group .btn:hover,
.aurora-modal .upload-area .btn:hover,
.aurora-modal .upload-btns .btn:hover,
.aurora-modal #globalAssetZonePicker .btn:hover {
  background: linear-gradient(145deg, rgba(255,255,255,0.2), rgba(255,255,255,0.08));
  color: #fff;
}

.photo-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.photo-input-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   FILTER BAR
   ======================================== */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.filter-search {
  flex: 1;
  min-width: 180px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
}
.filter-search:focus { outline: none; border-color: var(--blue); }
.filter-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  background: var(--surface);
}

.bulk-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 16px;
  background: #eff6ff;
  border-radius: var(--radius);
  margin-bottom: 12px;
  font-size: var(--text-sm);
}

/* ========================================
   DATA TABLE
   ======================================== */
.table-container {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}
.data-table th, .data-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--fast) var(--ease); }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table th {
  background: var(--surface-sunken);
  color: var(--text-muted);
  font-weight: var(--weight-semi);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  white-space: nowrap;
  color: var(--text-muted);
}
.data-table tr:hover { background: #fafbfc; }
.col-check { width: 36px; }
.table-link { color: var(--text); font-weight: 500; }
.table-link:hover { color: var(--blue); }
.row-inactive { opacity: 0.5; }

/* ========================================
   MODALS
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,41,0.55);
  backdrop-filter: blur(4px) saturate(120%);
  -webkit-backdrop-filter: blur(4px) saturate(120%);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalIn 220ms var(--ease-out);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.modal-lg { max-width: 800px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  letter-spacing: var(--tracking-tight);
}
.modal-close {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: var(--text-xl); line-height: 1;
  color: var(--text-muted);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.modal-close:hover { background: var(--surface-sunken); color: var(--text); }
.modal form { padding: var(--space-6); }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ========================================
   DETAIL PAGES
   ======================================== */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.detail-card h3 { font-family: var(--font-heading); font-size: var(--text-base); font-weight: 900; margin-bottom: 12px; }
.detail-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.detail-card-header h2 { font-family: var(--font-heading); font-size: var(--text-xl); font-weight: 900; }
.detail-photo { max-width: 200px; margin-top: 8px; border-radius: var(--radius-sm); }

/* ========================================
   SETTINGS
   ======================================== */
.settings-grid { display: grid; gap: 20px; max-width: 800px; }
.settings-info { display: flex; flex-direction: column; gap: 8px; }
.settings-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.settings-edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.settings-label { width: 140px; font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; text-align: right; flex-shrink: 0; }
.settings-export-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.category-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.category-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: var(--text-sm);
}
.cat-color-input { width: 28px; height: 28px; border: none; padding: 0; cursor: pointer; border-radius: 4px; }
.cat-delete-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}
.cat-delete-btn:hover { border-color: #dc3545; }
.settings-add-cat { display: flex; gap: 8px; align-items: center; }

/* ========================================
   TIMELINE
   ======================================== */
.timeline { padding-left: 16px; border-left: 2px solid var(--border); }
.timeline-item { position: relative; padding: 0 0 16px 16px; }
.timeline-dot {
  position: absolute;
  left: -9px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--blue);
  border: 2px solid var(--surface);
}
.timeline-date { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); }
.timeline-text { font-size: var(--text-sm); margin-top: 2px; }
.timeline-meta { font-size: var(--text-xs); color: var(--text-muted); }

/* ========================================
   LINKED LIST
   ======================================== */
.linked-list { list-style: none; }
.linked-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.linked-list li:last-child { border-bottom: none; }
.linked-list a { display: flex; align-items: center; gap: 8px; color: var(--text); }
.linked-list a:hover { color: var(--blue); }

/* ========================================
   VIEW TOGGLE
   ======================================== */
.view-toggle { display: flex; gap: 2px; background: var(--bg); border-radius: var(--radius-sm); padding: 2px; }
.view-btn {
  background: none; border: none; padding: 6px 8px; cursor: pointer;
  border-radius: var(--radius-sm); color: var(--text-muted);
  display: flex; align-items: center;
}
.view-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ========================================
   EMPTY / ERROR STATES
   ======================================== */
.empty-state { text-align: center; padding: 24px; color: var(--text-muted); font-size: var(--text-sm); }
.error-page { text-align: center; padding: 80px 20px; }
.error-code { font-family: var(--font-heading); font-size: var(--text-4xl); color: var(--text-muted); margin-bottom: 8px; }
.error-message { color: var(--text-muted); margin-bottom: 24px; }

/* ========================================
   FAB (Mobile)
   ======================================== */
.fab-container { display: none; position: fixed; right: 16px; bottom: 76px; z-index: 90; }
.fab-main {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(34,114,195,0.35);
  transition: transform 0.2s;
}
.fab-main:hover { transform: scale(1.05); }
.fab-main.open { transform: rotate(45deg); }
.fab-menu {
  position: absolute;
  bottom: 60px;
  right: 0;
  display: none;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.fab-menu.open { display: flex; }
.fab-item {
  background: var(--surface);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: var(--text-xs);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
}

/* ========================================
   DRAWER
   ======================================== */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 150;
}
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed;
  top: 0; right: -560px; bottom: 0;
  width: 540px;
  max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 151;
  box-shadow: var(--shadow-xl);
  transition: right 280ms var(--ease-out);
  display: flex;
  flex-direction: column;
}
.drawer.open { right: 0; }
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.drawer-title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}
.drawer-close {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: var(--text-xl); line-height: 1;
  color: var(--text-muted);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.drawer-close:hover { background: var(--surface-sunken); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--space-6); }
.drawer-body .form-group { margin-bottom: var(--space-4); }
.drawer-body .form-grid { grid-template-columns: 1fr; }

/* ========================================
   RESPONSIVE
   ======================================== */
/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
.toast-container {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}
.toast {
  background: #1d1d22;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  min-width: 280px;
  animation: slideInRight 0.3s ease;
}
.toast-success { border-left: 3px solid #2BAE4A; }
.toast-error { border-left: 3px solid #dc3545; }
.toast-warning { border-left: 3px solid #f0ad4e; }
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-exit {
  animation: slideOutRight 0.3s ease forwards;
}
@keyframes slideOutRight {
  to { transform: translateX(100%); opacity: 0; }
}

/* ========================================
   DARK MODE
   ======================================== */
/* A designed theme, not a handful of overrides: every token is
   re-declared so components that use tokens adapt automatically. */
/* Dark mode removed -- the app ships light only. */

/* ========================================
   SMOOTH ANIMATIONS
   ======================================== */
.stat-card, .dash-card, .detail-card, .vendor-card, .kanban-card {
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover, .dash-card:hover, .detail-card:hover, .vendor-card:hover, .kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.data-table tr {
  transition: transform 0.15s, box-shadow 0.15s;
}
.modal-overlay {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  animation: slideUp 0.25s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1199px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .sidebar-brand { display: none; }
  .sidebar .sidebar-search { display: none; }
  .sidebar .sidebar-user { display: none; }
  .sidebar   .sidebar .nav-item a span { display: none; }
  .sidebar .nav-item a { justify-content: center; padding: 10px; }
  .main-content { margin-left: var(--sidebar-collapsed); }
}

@media (max-width: 767px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  .fab-container { display: block; }
  .main-content {
    margin-left: 0;
    padding: 12px 10px calc(var(--mobile-nav-h) + 12px);
  }
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-actions { flex-wrap: wrap; }
  .form-grid { grid-template-columns: 1fr; }
  .filter-bar { flex-direction: column; }
  .filter-search { min-width: 100%; }
  .modal-overlay { padding: 8px; }
  .modal { max-width: 100%; border-radius: 10px; }
  .drawer { width: 100%; right: -100%; max-width: 100%; }
  .data-table { font-size: var(--text-xs); }
  .data-table th, .data-table td { padding: 6px 8px; }
  .btn { padding: 7px 14px; font-size: var(--text-xs); }
  .btn-sm { padding: 4px 10px; font-size: var(--text-xs); }
}

@media (max-width: 400px) {
  .main-content { padding: 8px 6px calc(var(--mobile-nav-h) + 8px); }
  .modal-overlay { padding: 4px; }
  .page-title { font-size: var(--text-xl); }
}

/* ============================================================
   UTILITIES
   Token-backed helpers so new markup never needs a raw value.
   ============================================================ */
.u-stack   { display: flex; flex-direction: column; }
.u-row     { display: flex; align-items: center; }
.u-between { display: flex; align-items: center; justify-content: space-between; }
.u-end     { display: flex; align-items: center; justify-content: flex-end; }
.u-wrap    { flex-wrap: wrap; }
.u-grow    { flex: 1; min-width: 0; }
.u-auto    { margin-left: auto; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-5 { padding: var(--space-5); }
.p-6 { padding: var(--space-6); }

.text-2xs  { font-size: var(--text-2xs); }
.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }

.text-muted  { color: var(--text-muted); }
.text-light  { color: var(--text-light); }
.text-danger { color: var(--red); }
.text-ok     { color: var(--ok-fg); }
.text-center { text-align: center; }
.font-medium { font-weight: var(--weight-medium); }
.font-semi   { font-weight: var(--weight-semi); }
.font-bold   { font-weight: var(--weight-bold); }
.nums        { font-variant-numeric: tabular-nums; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.scroll-y { max-height: 85vh; overflow-y: auto; }

/* ============================================================
   LOADING SKELETONS
   Replaces bare "Loading..." text while panels fetch.
   ============================================================ */
@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-sunken) 25%, #e9eef5 37%, var(--surface-sunken) 63%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-line { height: 12px; margin-bottom: var(--space-2); }
.skeleton-line:last-child { width: 60%; margin-bottom: 0; }
.skeleton-block { height: 72px; margin-bottom: var(--space-3); border-radius: var(--radius); }
.skeleton-stack { padding: var(--space-4); }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}
