/* ═══════════════════════════════════════════
   DESIGN TOKENS
═══════════════════════════════════════════ */
:root {
  --bg: #f2ede4;
  --surface: #ffffff;
  --surface-lo: #faf8f4;
  --surface-hi: #f7f3ec;

  --nav-bg: #12223a;
  --nav-mid: #18304f;
  --nav-border: #1e3a5a;
  --nav-text: #8ba5bf;
  --nav-text-hi: #cddcec;
  --nav-active: rgba(183, 150, 93, 0.14);

  --border: #e0d8cc;
  --border-lo: #ede8e0;

  --text-1: #1c2e42;
  --text-2: #5a6e82;
  --text-3: #9aabb8;

  --brass: #b8924a;
  --brass-hi: #d4aa66;
  --brass-lo: #8a6e3a;
  --brass-soft: rgba(184, 146, 74, 0.1);
  --brass-pill: rgba(184, 146, 74, 0.14);

  /* Stage palette */
  --s-new: #64748b;
  --s-visit: #3478c8;
  --s-estimate: #0ea5e9;
  --s-sold: #16a34a;
  --s-preprod: #d97706;
  --s-scheduled: #ea580c;
  --s-inprog: #b8924a;
  --s-punch: #ca8a04;
  --s-complete: #15803d;
  --s-lost: #dc2626;
  --s-cancelled: #94a3b8;

  /* Semantic colors */
  --danger: #dc2626;
  --warning: #f59e0b;
  --success: #16a34a;
  --info: #3b82f6;

  --font-display: "Playfair Display", Georgia, serif;
  --font-ui: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  --sidebar-w: 248px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 20px;
}

/* ═══════════════════════════════════════════
   RESET
═══════════════════════════════════════════ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
button,
input,
select,
textarea {
  font: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
ul {
  list-style: none;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text-1);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════
   SCROLLBAR & ANIMATIONS
═══════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

@keyframes risein {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════════
   AUTH LAYOUT
═══════════════════════════════════════════ */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  width: 100%;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 48px 56px;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo-mark {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--brass-lo), var(--brass));
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  box-shadow: 0 2px 10px rgba(184, 146, 74, 0.3);
}
.auth-logo-mark svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}
.auth-logo-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
}
.auth-logo-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 3px;
}
.auth-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 20px;
}
.auth-body {
  display: block;
}

@media (max-width: 768px) {
  /* White body background so iOS Safari status bar is white (Safari uses body bg) */
  body {
    background: #ffffff;
  }
  .view-scroll {
    background: var(--bg);
  }
  .auth-main {
    background: var(--bg);
  }

  .auth-main {
    align-items: flex-start;
    padding: 60px 16px 32px;
    min-height: 100vh;
  }
  .auth-card {
    padding: 28px 24px;
    border-radius: var(--r-md);
    max-width: 100%;
  }
  .auth-logo {
    margin-bottom: 20px;
  }
  .auth-logo-mark {
    width: 42px;
    height: 42px;
  }
  .auth-logo-name {
    font-size: 20px;
  }
  .auth-title {
    font-size: 16px;
    margin-bottom: 16px;
  }
}

/* ═══════════════════════════════════════════
   TURBO STREAM INSERT ANIMATIONS
   Progressive enhancement — no-op in unsupported browsers
═══════════════════════════════════════════ */
.animated-insert {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.3s ease-out,
    transform 0.3s ease-out;

  @starting-style {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Staggered list entrance */
.stagger-item {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.4s ease-out,
    transform 0.4s ease-out;

  @starting-style {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* Turbo Stream enter/exit animations (JS-driven via data-stream-enter/exit) */
.stream-slide-in {
  animation: stream-slide-in 0.3s ease-out;
}
.stream-slide-out {
  animation: stream-slide-out 0.25s ease-in forwards;
}
.stream-fade-in {
  animation: stream-fade-in 0.3s ease-out;
}
.stream-fade-out {
  animation: stream-fade-out 0.25s ease-in forwards;
}
.stream-scale-in {
  animation: stream-scale-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes stream-slide-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes stream-slide-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes stream-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes stream-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes stream-scale-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ═══════════════════════════════════════════
   UTILITY CLASSES
   ───────────────────────────────────────────
   Small, composable helpers for the most
   common inline-style patterns in the app.

   Naming convention:
     Layout:     flex-center, flex-between, flex-col
     Gap:        gap-xs (4px), gap-sm (8px), gap-md (12px), gap-lg (16px)
     Typography: text-xs..text-lg, text-muted, text-secondary, font-semibold
     Color:      text-danger, text-warning, text-success
     Background: bg-danger-subtle, bg-warning-subtle, bg-success-subtle
═══════════════════════════════════════════ */

/* --- Layout --- */
.flex-center {
  display: flex;
  align-items: center;
}
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-col {
  display: flex;
  flex-direction: column;
}
.gap-xs {
  gap: 4px;
}
.gap-sm {
  gap: 8px;
}
.gap-md {
  gap: 12px;
}
.gap-lg {
  gap: 16px;
}

/* --- Typography --- */
.text-xs {
  font-size: 10px;
}
.text-sm {
  font-size: 12px;
}
.text-base {
  font-size: 14px;
}
.text-lg {
  font-size: 16px;
}
.text-mono {
  font-family: var(--font-mono);
}
.text-muted {
  color: var(--text-3);
}
.text-secondary {
  color: var(--text-2);
}
.font-semibold {
  font-weight: 600;
}

/* --- Semantic colors --- */
.text-danger {
  color: var(--danger);
}
.text-warning {
  color: var(--warning);
}
.text-success {
  color: var(--success);
}
.bg-danger-subtle {
  background: rgba(220, 38, 38, 0.06);
}
.bg-warning-subtle {
  background: rgba(245, 158, 11, 0.06);
}
.bg-success-subtle {
  background: rgba(22, 163, 74, 0.06);
}

/* --- Misc --- */
.hidden {
  display: none !important;
}
