/* ==========================================================================
   Design tokens

   A light interface: white surfaces on a cool off-white canvas, one blue
   accent, and a light sidebar separated by a hairline rather than a dark slab.

     --stone-*  cool neutrals (the name is historical; the ramp is blue-grey).
     --brand-*  blue. Primary actions, links, focus, active navigation.

   Green is reserved for "done" states and success; red for destructive
   actions and errors. Shadows are tinted with the darkest neutral rather than
   pure black so they read as depth instead of grey film.
   ========================================================================== */
:root {
    --font-sans: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

    /* Cool neutral ramp */
    --stone-50:  #f8fafc;
    --stone-100: #f1f4f8;
    --stone-200: #e6eaf0;
    --stone-300: #d3dae4;
    --stone-400: #98a2b3;
    --stone-500: #667085;
    --stone-600: #4b5563;
    --stone-700: #374151;
    --stone-800: #1f2937;
    --stone-900: #111827;
    --stone-950: #0b1220;
    --white: #ffffff;

    /* Blue ramp */
    --brand-50:  #eff5ff;
    --brand-100: #dbe7fe;
    --brand-200: #bfd5fe;
    --brand-300: #93b8fd;
    --brand-400: #6094fa;
    --brand-500: #3b76f6;
    --brand-600: #2563eb;
    --brand-700: #1d4ed8;
    --brand-800: #1e40af;
    --brand-900: #1e3a8a;

    /* Success / "completed" */
    --green-50:  #ecfdf5;
    --green-200: #a7f3d0;
    --green-600: #059669;
    --green-700: #047857;

    /* Destructive */
    --red-50:  #fef2f2;
    --red-100: #fee2e2;
    --red-200: #fecaca;
    --red-300: #fca5a5;
    --red-400: #f87171;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-700: #b91c1c;

    /* Semantic aliases — prefer these in new rules. */
    --canvas: #f7f8fa;
    --surface: var(--white);
    --surface-sunken: var(--stone-50);
    --border: var(--stone-200);
    --border-strong: var(--stone-300);
    --text: var(--stone-900);
    --text-muted: var(--stone-500);
    /* Non-text UI (icons, chevrons) needs 3:1, not 4.5:1 — lighter than body copy but still visible. */
    --icon-muted: #7e8a9d;

    /* Sidebar and top bar are light surfaces, divided by hairlines. */
    --sidebar-bg: var(--white);
    --sidebar-border: var(--border);
    --nav-text: var(--stone-600);
    --nav-active-bg: var(--brand-50);
    --nav-active-text: var(--brand-600);

    --focus-ring: rgba(37, 99, 235, .16);

    --shadow-sm: 0 1px 2px 0 rgba(16, 24, 40, .05);
    --shadow-md: 0 4px 12px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 12px 28px -8px rgba(16, 24, 40, .12), 0 4px 8px -4px rgba(16, 24, 40, .05);
    --shadow-2xl: 0 32px 64px -16px rgba(16, 24, 40, .24);

    --topbar-height: 4.5rem;
    --sidebar-width: 17.5rem;

    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-3xl: 1.5rem;
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
    min-height: 100vh;
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; }
svg { display: block; }

/*
 * The `hidden` attribute comes from the user-agent stylesheet, and ANY author
 * rule that sets display beats it — `svg { display: block }` above was enough
 * to keep hidden icons on screen, which showed both states of the password
 * toggle at once. Author-level and !important so nothing can undo it again.
 */
[hidden] { display: none !important; }

/* Shared utilities */
.container-main { max-width: 1290px; margin: 0 auto; padding: 0 1.5rem; }
.required { color: var(--red-500); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: var(--radius-xl);
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 700;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
    white-space: nowrap;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.btn-primary { background: var(--brand-600); color: var(--white); box-shadow: 0 1px 2px rgba(16,24,40,.08); }
.btn-primary:hover { background: var(--brand-700); box-shadow: 0 4px 10px -3px rgba(37,99,235,.4); }
.btn-primary:active { background: var(--brand-800); box-shadow: none; }
.btn-outline { border: 1px solid var(--border-strong); background: var(--surface); color: var(--stone-700); }
.btn-outline:hover { background: var(--stone-50); border-color: var(--stone-400); color: var(--stone-900); }
.btn-secondary { background: var(--stone-100); border: 1px solid var(--border); color: var(--stone-800); }
.btn-secondary:hover { background: var(--stone-200); }

/*
 * Destructive actions are outlined rather than filled: in a list of rows a
 * solid red button pulls more attention than the action deserves, and reads as
 * the primary thing to do.
 */
.btn-danger { border: 1px solid var(--red-200); background: var(--surface); color: var(--red-600); }
.btn-danger:hover { background: var(--red-50); border-color: var(--red-300); color: var(--red-700); }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn-sm { border-radius: var(--radius-lg); padding: 0.5rem 0.75rem; font-size: 0.875rem; }

/* Forms */
.form-grid { display: grid; gap: 1.5rem; }
.form-group { display: grid; gap: .5rem; align-content: start; }
.form-label { display: block; color: var(--stone-700); font-size: .875rem; font-weight: 800; }
.form-control, .form-select {
    display: block;
    width: 100%;
    border: 1px solid var(--stone-300);
    border-radius: var(--radius-xl);
    background: var(--white);
    padding: .75rem 1rem;
    color: var(--stone-900);
    font-size: .875rem;
    line-height: 1.25rem;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.form-control::placeholder { color: var(--icon-muted); }
.form-control:focus, .form-select:focus { border-color: var(--brand-600); box-shadow: 0 0 0 3px var(--focus-ring); }
.form-control.is-invalid { border-color: var(--red-400); }
.form-control.is-invalid:focus { border-color: var(--red-500); box-shadow: 0 0 0 3px var(--red-100); }
.form-help { margin: .25rem 0 0; color: var(--stone-500); font-size: .75rem; line-height: 1.5; }
.form-error { margin: .25rem 0 0; color: var(--red-600); font-size: .8125rem; font-weight: 600; }
.form-actions { margin-top: 2rem; display: flex; flex-direction: column-reverse; gap: .75rem; border-top: 1px solid var(--border); padding-top: 1.5rem; }

.alert { margin-top: 1.5rem; border-radius: var(--radius-xl); padding: .8125rem 1rem; font-size: .875rem; line-height: 1.5; margin-bottom: 10px; }
/* A tinted left edge reads as a status marker without shouting like a full fill. */
.alert-success { border: 1px solid var(--green-200); border-left: 3px solid var(--green-600); background: var(--green-50); color: var(--green-700); font-weight: 700; }
.alert-error { border: 1px solid var(--red-200); border-left: 3px solid var(--red-500); background: var(--red-50); color: var(--red-700); }
.alert-title { margin: 0; font-weight: 800; }
.alert-list { margin: .5rem 0 0; padding-left: 1.25rem; }
.alert-list li + li { margin-top: .25rem; }

@media (min-width: 640px) {
    .form-actions { flex-direction: row; justify-content: flex-end; }
}
