/* ==========================================================================
   Zentra Tasks — design tokens + glass utilities
   Ported 1:1 from the Lovable reference (_design_reference/src/styles.css).
   This is the visual source of truth. Loaded alongside the Tailwind CDN,
   whose inline config maps utility colors (bg-primary, text-muted-foreground,
   border-border, ...) onto these CSS variables.
   PRODUCTION NOTE: replace the Tailwind Play CDN with a compiled build.
   ========================================================================== */

:root {
  --radius: 0.75rem;
  color-scheme: light;

  /* Light mode — paper */
  --background: oklch(0.985 0.002 250);
  --foreground: oklch(0.18 0.01 250);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.18 0.01 250);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.18 0.01 250);
  --primary: oklch(0.52 0.22 277);          /* #4F46E5 */
  --primary-foreground: oklch(0.99 0 0);
  --secondary: oklch(0.95 0.01 250);
  --secondary-foreground: oklch(0.18 0.01 250);
  --muted: oklch(0.96 0.005 250);
  --muted-foreground: oklch(0.5 0.015 250); /* ~#6B7280 */
  --accent: oklch(0.95 0.01 250);
  --accent-foreground: oklch(0.18 0.01 250);
  --destructive: oklch(0.62 0.22 27);       /* #EF4444 */
  --destructive-foreground: oklch(0.99 0 0);
  --border: oklch(0.9 0.008 250);
  --input: oklch(0.9 0.008 250);
  --ring: oklch(0.52 0.22 277);
  --hairline: oklch(0.18 0.01 250 / 0.08);

  --urgency-low: oklch(0.72 0.02 250);
  --urgency-normal: oklch(0.6 0.2 277);
  --urgency-high: oklch(0.76 0.17 70);
  --urgency-critical: oklch(0.62 0.22 27);
  --success: oklch(0.7 0.16 162);

  --sidebar: oklch(0.98 0.003 250);
  --sidebar-foreground: oklch(0.18 0.01 250);
  --sidebar-primary: oklch(0.52 0.22 277);
  --sidebar-primary-foreground: oklch(0.99 0 0);
  --sidebar-accent: oklch(0.95 0.01 250);
  --sidebar-accent-foreground: oklch(0.18 0.01 250);
  --sidebar-border: oklch(0.9 0.008 250);
  --sidebar-ring: oklch(0.52 0.22 277);

  --shadow-paper: 0 1px 2px rgb(20 23 26 / 0.04), 0 8px 24px -12px rgb(20 23 26 / 0.08);
}

.dark {
  color-scheme: dark;
  /* Dark hero — #0B0D12 */
  --background: oklch(0.16 0.012 270);
  --foreground: oklch(0.95 0.005 250);            /* #ECEEF2 */
  --card: oklch(1 0 0 / 0.05);                    /* glass */
  --card-foreground: oklch(0.95 0.005 250);
  --popover: oklch(0.2 0.015 270);
  --popover-foreground: oklch(0.95 0.005 250);
  --primary: oklch(0.62 0.2 277);                 /* #6366F1 */
  --primary-foreground: oklch(0.99 0 0);
  --secondary: oklch(1 0 0 / 0.06);
  --secondary-foreground: oklch(0.95 0.005 250);
  --muted: oklch(1 0 0 / 0.04);
  --muted-foreground: oklch(0.7 0.015 250);       /* #9AA3AF */
  --accent: oklch(0.78 0.14 210);                 /* #22D3EE cyan */
  --accent-foreground: oklch(0.16 0.012 270);
  --destructive: oklch(0.66 0.22 27);
  --destructive-foreground: oklch(0.99 0 0);
  --border: oklch(1 0 0 / 0.08);
  --input: oklch(1 0 0 / 0.1);
  --ring: oklch(0.62 0.2 277);
  --hairline: oklch(1 0 0 / 0.08);

  --urgency-low: oklch(0.7 0.015 250);
  --urgency-normal: oklch(0.62 0.2 277);
  --urgency-high: oklch(0.78 0.16 70);
  --urgency-critical: oklch(0.66 0.22 27);
  --success: oklch(0.72 0.17 162);

  --sidebar: oklch(0.18 0.014 270 / 0.6);
  --sidebar-foreground: oklch(0.95 0.005 250);
  --sidebar-primary: oklch(0.62 0.2 277);
  --sidebar-primary-foreground: oklch(0.99 0 0);
  --sidebar-accent: oklch(1 0 0 / 0.05);
  --sidebar-accent-foreground: oklch(0.95 0.005 250);
  --sidebar-border: oklch(1 0 0 / 0.06);
  --sidebar-ring: oklch(0.62 0.2 277);
}

/* ---- base ---- */
[x-cloak] { display: none !important; }
* { border-color: var(--border); }
html, body, #root { height: 100%; }
html, body { overflow-x: hidden; }
body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: "Inter", ui-sans-serif, system-ui, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .font-display {
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -0.02em;
}
.tabular { font-variant-numeric: tabular-nums; }

/* ---- app shell ambient gradient — dark only ---- */
.app-shell { position: relative; isolation: isolate; width: 100%; max-width: 100vw; }
.app-shell::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -1;
  background:
    radial-gradient(40% 35% at 15% 10%, oklch(0.55 0.22 277 / 0.35), transparent 60%),
    radial-gradient(35% 30% at 85% 20%, oklch(0.7 0.18 210 / 0.25), transparent 65%),
    radial-gradient(45% 40% at 70% 90%, oklch(0.55 0.22 300 / 0.22), transparent 70%);
  filter: blur(60px) saturate(120%);
  opacity: 0;
  animation: shellDrift 18s ease-in-out infinite alternate;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.dark .app-shell::before { opacity: 1; }
@keyframes shellDrift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-3%, 2%, 0) scale(1.08); }
}

/* ---- glass surface ---- */
.glass {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-paper);
  transition: transform 180ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.dark .glass {
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.04) inset, 0 20px 40px -24px oklch(0 0 0 / 0.6);
}
.glass-hover:hover { transform: translateY(-2px); border-color: oklch(1 0 0 / 0.14); }
.dark .glass-hover:hover {
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.06) inset, 0 30px 60px -28px oklch(0 0 0 / 0.7);
}

/* ---- micro-interactions ---- */
.press { transition: transform 120ms ease, background-color 160ms ease, box-shadow 160ms ease; }
.press:active { transform: translateY(1px) scale(0.985); }

.fade-rise { animation: fadeRise 280ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes fadeRise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Done celebration ---- */
.burst { position: relative; }
.burst::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, oklch(0.72 0.17 162 / 0.45), transparent 60%);
  animation: burst 500ms ease-out forwards;
  pointer-events: none;
}
@keyframes burst {
  0%   { opacity: 0; transform: scale(0.9); }
  40%  { opacity: 1; }
  100% { opacity: 0; transform: scale(1.2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---- translucent chrome (kept explicit because the Tailwind CDN config maps
   colors to raw CSS vars and cannot inject alpha via /opacity modifiers) ---- */
.chrome-blur {
  background: color-mix(in oklab, var(--background) 70%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
}

/* ---- scrollbars ---- */
.scroll-thin::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll-thin::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 999px; }

/* ---- page padding (mobile-first) ---- */
.page-x { padding-left: 1rem; padding-right: 1rem; }
@media (min-width: 640px) { .page-x { padding-left: 1.5rem; padding-right: 1.5rem; } }
@media (min-width: 768px) { .page-x { padding-left: 2.5rem; padding-right: 2.5rem; } }

/* ---- form controls in the glass theme ---- */
.field {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  color: var(--foreground);
  font-size: 0.875rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 40%, transparent);
}
.field::placeholder { color: var(--muted-foreground); }
select.field { appearance: none; background-color: var(--popover); background-image:
  linear-gradient(45deg, transparent 50%, var(--muted-foreground) 50%),
  linear-gradient(135deg, var(--muted-foreground) 50%, transparent 50%);
  background-position: calc(100% - 18px) 1.1em, calc(100% - 13px) 1.1em;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2rem;
  color: var(--popover-foreground); }
/* Native option popup: solid, readable colors in both modes (fixes white-on-white). */
select.field option, select.field optgroup { background-color: var(--popover); color: var(--popover-foreground); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  border-radius: var(--radius); padding: 0.55rem 1rem; font-size: 0.875rem; font-weight: 500;
  cursor: pointer; transition: transform 120ms ease, background-color 160ms ease, opacity 160ms ease;
  border: 1px solid transparent;
}
.btn:active { transform: translateY(1px) scale(0.985); }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { opacity: 0.92; }
.btn-ghost { background: var(--secondary); color: var(--foreground); border-color: var(--hairline); }
.btn-ghost:hover { border-color: oklch(1 0 0 / 0.14); }
.btn-danger { background: color-mix(in oklab, var(--urgency-critical) 18%, transparent); color: var(--urgency-critical);
  border-color: color-mix(in oklab, var(--urgency-critical) 35%, transparent); }

/* pill helpers */
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.6875rem;
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}

/* slide-over panel */
.slideover { transition: transform 280ms cubic-bezier(0.2, 0.7, 0.2, 1); }
