/* ============================================================
   InTech PTO — Design System (base tokens, reset, primitives)
   Brand: navy + sky blue, orange accent (InTech design system)
   ============================================================ */

:root {
  color-scheme: dark;

  /* ---------- InTech design-system scales (theme-independent) ---------- */
  --navy: #0b0f18;
  --white: #ffffff;

  --sky-50: #ebf6ff;
  --sky-100: #d1ecff;
  --sky-200: #a8daff;
  --sky-300: #7ccaff;
  --sky-400: #49b6ff;
  --sky-500: #2b8fd8;
  --sky-600: #2273b4;
  --sky-700: #1b5a8e;
  --sky-800: #143f66;
  --sky-900: #0b233a;

  --orange-50: #fef2e8;
  --orange-100: #fcdfc6;
  --orange-200: #f9c18a;
  --orange-300: #f49960;
  --orange-400: #ef8839;
  --orange-500: #eb7823;
  --orange-600: #c46016;
  --orange-700: #974910;
  --orange-800: #6b340a;
  --orange-900: #3f1e05;

  --gray-50: #f7f8fa;
  --gray-100: #eceff3;
  --gray-200: #d6dae2;
  --gray-300: #b4bac6;
  --gray-400: #8a9ab5;
  --gray-500: #5e6478;
  --gray-600: #444a5a;
  --gray-700: #2e323e;
  --gray-800: #1c1f28;
  --gray-900: #0b0f18;

  /* Semantic (design-system spec) */
  --ds-error: #e74c3c;
  --ds-error-soft: #fdecea;
  --ds-success: #2e7d32;
  --ds-success-soft: #e8f2e9;
  --ds-warning: #e0c860;
  --ds-warning-soft: #fbf6e3;
  --ds-info: #49b6ff;
  --ds-info-soft: #ebf6ff;

  /* ---------- Dark ("midnight") theme tokens ---------- */
  --bg: var(--gray-900);
  --bg-raise: #121723;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);

  --text: var(--gray-100);
  --text-soft: var(--gray-300);
  --text-dim: var(--gray-400);

  /* Accents: sky = primary, orange = warm accent */
  --primary: var(--sky-400);
  --primary-deep: var(--sky-600);
  --accent: var(--orange-400);
  /* On-dark semantic text tints (hues per DS spec, lightened for AA) */
  --ok: #7fc983;
  --warn: var(--ds-warning);
  --danger: var(--ds-error);
  --danger-text: #f08a7c;
  --info-text: var(--sky-300);
  /* Text that sits on top of brand-gradient fills */
  --on-brand: var(--sky-900);

  --grad-brand: linear-gradient(120deg, #7ccaff 0%, #49b6ff 52%, #ef8839 100%);
  --grad-btn: linear-gradient(100deg, #2bd9b6 0%, #49b6ff 52%, #7b7df0 100%);
  --grad-text: linear-gradient(105deg, #a8daff 0%, #7ccaff 45%, #f9c18a 100%);

  /* Type */
  --font-display: "Poppins", system-ui, sans-serif;
  --font-body: "Poppins", system-ui, sans-serif;

  /* Shape */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  --shadow-card: 0 20px 50px -20px rgba(0, 0, 0, 0.65);
  --shadow-glow-primary: 0 0 40px -8px rgba(73, 182, 255, 0.45);

  /* Theme-aware extras */
  --ring-track: rgba(255, 255, 255, 0.07);
  --swatch-used: rgba(255, 255, 255, 0.18);
}

/* ============================================================
   Light theme — "daylight" palette. Same brand identity
   (navy / sky / orange) on white & cool-gray surfaces; accent
   hues stepped darker (sky-600, orange-600/700) for contrast.
   ============================================================ */
html[data-theme="light"] {
  color-scheme: light;

  --bg: var(--gray-50);
  --bg-raise: var(--white);
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(11, 15, 24, 0.06);
  --stroke: rgba(11, 15, 24, 0.12);
  --stroke-strong: rgba(11, 15, 24, 0.2);

  --text: var(--gray-800);
  --text-soft: var(--gray-600);
  --text-dim: var(--gray-500);

  --primary: var(--sky-600);
  --primary-deep: var(--sky-700);
  --accent: var(--orange-600);
  --ok: var(--ds-success);
  --warn: #8a6d1a;
  --danger: #c0392b;
  --danger-text: #c0392b;
  --info-text: var(--sky-700);
  --on-brand: var(--sky-900);

  --grad-text: linear-gradient(105deg, #1b5a8e 0%, #2273b4 48%, #c46016 100%);

  --shadow-card: 0 16px 40px -18px rgba(11, 35, 58, 0.18);
  --shadow-glow-primary: 0 12px 28px -10px rgba(34, 115, 180, 0.35);

  --ring-track: rgba(11, 15, 24, 0.09);
  --swatch-used: rgba(11, 15, 24, 0.2);
}

/* Brief, global color transition while switching themes.
   Transform/opacity are deliberately excluded so GSAP keeps full control. */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition:
    background 0.4s ease,
    background-color 0.4s ease,
    border-color 0.4s ease,
    color 0.4s ease,
    fill 0.4s ease,
    stroke 0.4s ease,
    box-shadow 0.4s ease !important;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: rgba(73, 182, 255, 0.35); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  border: 3px solid var(--bg);
}

/* ---------- Primitives ---------- */

.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 14px;
  padding: 12px 22px;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s, background 0.25s, color 0.25s;
  will-change: transform;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad-btn);
  color: var(--on-brand);
  box-shadow: var(--shadow-glow-primary);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 55px -6px rgba(73, 182, 255, 0.6); }

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--stroke);
}
.btn-ghost:hover { background: var(--surface-strong); border-color: var(--stroke-strong); }

.btn-danger-ghost {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger-text);
  border: 1px solid rgba(231, 76, 60, 0.3);
}
.btn-danger-ghost:hover { background: rgba(231, 76, 60, 0.2); }

.btn-sm { padding: 8px 16px; font-size: 13px; }

.card {
  background: var(--surface);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: var(--shadow-card);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pill-approved { background: rgba(127, 201, 131, 0.12); color: var(--ok); }
.pill-pending { background: rgba(224, 200, 96, 0.12); color: var(--warn); }
.pill-denied { background: rgba(231, 76, 60, 0.14); color: var(--danger-text); }
.pill-info { background: rgba(73, 182, 255, 0.12); color: var(--info-text); }
.pill-neutral { background: var(--surface-strong); color: var(--text-soft); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--sky-900);
  flex-shrink: 0;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.field input, .field select, .field textarea {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  padding: 13px 16px;
  color: var(--text);
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-dim); }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(73, 182, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(73, 182, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
}
.field select option { background: var(--bg-raise); color: var(--text); }

/* ---------- Brand mark (shared) ---------- */
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.01em;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--grad-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--on-brand);
  font-size: 16px;
  font-weight: 700;
  box-shadow: var(--shadow-glow-primary);
}
img.brand-logo {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  object-fit: contain;
  filter: brightness(0) invert(1);
}
html[data-theme="light"] img.brand-logo { filter: none; }
.brand-mark small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Light-theme overrides for primitives ---------- */

html[data-theme="light"] ::selection { background: rgba(73, 182, 255, 0.3); }

html[data-theme="light"] ::-webkit-scrollbar-thumb {
  background: rgba(11, 15, 24, 0.22);
  border-color: var(--bg);
}

html[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 16px 34px -10px rgba(34, 115, 180, 0.5);
}

html[data-theme="light"] .btn-danger-ghost {
  background: rgba(192, 57, 43, 0.08);
  border-color: rgba(192, 57, 43, 0.3);
}
html[data-theme="light"] .btn-danger-ghost:hover { background: rgba(192, 57, 43, 0.15); }

html[data-theme="light"] .pill-approved { background: var(--ds-success-soft); }
html[data-theme="light"] .pill-pending { background: var(--ds-warning-soft); }
html[data-theme="light"] .pill-denied { background: var(--ds-error-soft); }
html[data-theme="light"] .pill-info { background: var(--ds-info-soft); }

html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea {
  background: rgba(255, 255, 255, 0.75);
}
html[data-theme="light"] .field input:focus,
html[data-theme="light"] .field select:focus,
html[data-theme="light"] .field textarea:focus {
  border-color: rgba(34, 115, 180, 0.55);
  box-shadow: 0 0 0 4px rgba(34, 115, 180, 0.12);
  background: #ffffff;
}
