/* ===========================================================================
   MSM Domains — My Studio Manager brand
   ---------------------------------------------------------------------------
   Typography:  Inter (Google Fonts) — clean, legible, SaaS-standard
   Palette:     Deep MSM purple as the primary, warm yellow as accent/highlight,
                neutral white/grey for surfaces and text.
   Layout:      Clean productivity interface. Rounded corners. Generous spacing.
   =========================================================================== */


:root {
    --bg:           #F9FAFB;
    --bg-card:      #FFFFFF;
    --bg-subtle:    #F3F4F6;
    --border:       #E5E7EB;
    --border-strong:#D1D5DB;

    --text:         #111827;
    --text-secondary:#374151;
    --text-muted:   #6B7280;

    /* Primary brand colour — MSM purple (sampled from logo). */
    --accent:       #3A0F5A;
    --accent-hover: #280841;
    --accent-soft:  #F5EEFB;

    /* Secondary brand colour — MSM warm yellow (sampled from logo).
       Use sparingly for highlights, hover accents, badges. */
    --brand-yellow:        #F4C84F;
    --brand-yellow-hover:  #E0B43D;
    --brand-yellow-soft:   #FEF7DD;

    --ok:           #16A34A;
    --ok-soft:      #F0FDF4;
    --ok-border:    #BBF7D0;
    --warn:         #D97706;
    --warn-soft:    #FFFBEB;
    --warn-border:  #FDE68A;
    --bad:          #DC2626;
    --bad-soft:     #FEF2F2;
    --bad-border:   #FECACA;

    --radius-sm:    0.375rem;
    --radius:       0.5rem;
    --radius-lg:    0.75rem;
    --radius-full:  9999px;

    --shadow-sm:    0 1px 2px 0 rgba(0,0,0,0.05);
    --shadow:       0 1px 3px 0 rgba(0,0,0,0.10), 0 1px 2px -1px rgba(0,0,0,0.10);

    --gutter:       clamp(1rem, 4vw, 2rem);
}

/* ---------------------------------------------------------------- reset */

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

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

html {
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

/* ---------------------------------------------------------------- header */

header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    gap: 2rem;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--text);
    flex-shrink: 0;
}

.logo img {
    height: 2.25rem;
    width: auto;
    display: block;
}

nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    flex-wrap: wrap;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-sm);
    transition: color 120ms, background 120ms;
}

nav a:hover,
nav a.active {
    color: var(--text);
    background: var(--bg-subtle);
}

.header-aux {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-aux a {
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.375rem 0.625rem;
    border-radius: var(--radius-sm);
    transition: color 120ms, background 120ms;
}

.header-aux a:hover { color: var(--text); background: var(--bg-subtle); }

.header-aux .btn-signup {
    background: var(--accent);
    color: #fff;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 120ms;
}

.header-aux .btn-signup:hover { background: var(--accent-hover); color: #fff; }

/* ---------------------------------------------------------------- main */

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem var(--gutter) 4rem;
}

/* ---------------------------------------------------------------- footer */

footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 1rem var(--gutter);
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

footer .mode { font-weight: 500; color: var(--text-secondary); }
footer .mode-prod { color: var(--ok); }

/* ---------------------------------------------------------------- page header */

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    margin: 0 0 0.25rem;
}

.page-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ---------------------------------------------------------------- typography */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
    margin: 0 0 0.5rem;
}

/* Typography hierarchy mirrors docs/design/design-system.md:
   page title = text-3xl/600, section = text-xl/600, subsection = text-lg/500. */
h1 { font-size: 1.875rem; font-weight: 600; }
h2 { font-size: 1.25rem;  font-weight: 600; margin-top: 1.5rem; }
h3 { font-size: 1.125rem; font-weight: 500; }

p { margin: 0 0 1rem; color: var(--text-secondary); }
p.lead { font-size: 1rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 120ms;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

strong { font-weight: 600; }

code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 0.85em;
    background: var(--bg-subtle);
    padding: 0.1em 0.4em;
    border-radius: var(--radius-sm);
    color: var(--text);
}

pre {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--text);
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ---------------------------------------------------------------- cards */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.card > h2:first-child,
.card > h3:first-child { margin-top: 0; }

.card.ok {
    background: var(--ok-soft);
    border-color: var(--ok-border);
    border-left: 4px solid var(--ok);
}

.card.warn,
.card.warning {
    background: var(--warn-soft);
    border-color: var(--warn-border);
    border-left: 4px solid var(--warn);
}

.card.error,
.card.bad {
    background: var(--bad-soft);
    border-color: var(--bad-border);
    border-left: 4px solid var(--bad);
}

/* ---------------------------------------------------------------- KPI grid */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.kpi-value a { text-decoration: none; color: inherit; }
.kpi-value a:hover { color: var(--accent); }
.kpi-warn .kpi-value { color: var(--bad); }

/* ---------------------------------------------------------------- badges / pills */

.pill {
    /* Doc spec: px-3 py-1 (12px/4px), text-xs (0.75rem), font-medium (500),
       rounded-full. Tightens up the previous slightly-cramped sizing. */
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--bg-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border);
    text-transform: capitalize;
    white-space: nowrap;
}

.pill-soft {
    /* Used in the customers list for service counts — neutral surface,
       no capitalization (so "linux hostings" reads right). */
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-color: var(--border);
    text-transform: none;
    margin-right: 0.25rem;
}

.pill-ok,
.pill-provisioned,
.pill-active {
    background: var(--ok-soft);
    color: var(--ok);
    border-color: var(--ok-border);
}

.pill-bad,
.pill-failed,
.pill-error {
    background: var(--bad-soft);
    color: var(--bad);
    border-color: var(--bad-border);
}

.pill-warn,
.pill-pending,
.pill-paid {
    background: var(--warn-soft);
    color: var(--warn);
    border-color: var(--warn-border);
}

.pill-refunded {
    background: var(--bg-subtle);
    color: var(--text-muted);
    border-color: var(--border);
    text-decoration: line-through;
}

/* ---------------------------------------------------------------- forms */

form { max-width: 640px; }
form.wide { max-width: 100%; }

form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin: 1rem 0 0.375rem;
}

form label.checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 400;
    margin: 0.75rem 0;
    cursor: pointer;
}

form label.checkbox input[type="checkbox"] {
    width: auto;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form select,
form textarea {
    /* Doc spec: input p-3 (12px) rounded-lg border, text-base sized. */
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0.75rem 0.875rem;
    font-family: inherit;
    font-size: 0.9375rem;
    color: var(--text);
    transition: border-color 150ms, box-shadow 150ms;
    -webkit-appearance: none;
}

form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="password"]:focus,
form input[type="number"]:focus,
form select:focus,
form textarea:focus {
    outline: none;
    border-color: var(--accent);
    /* Brand-tinted focus ring (purple), not the old blue. */
    box-shadow: 0 0 0 3px rgba(58, 15, 90, 0.18);
}

form input[disabled],
form input[type="text"][disabled],
form input[type="email"][disabled] {
    background: var(--bg-subtle);
    color: var(--text-muted);
    cursor: not-allowed;
}

form.inline-form { display: inline; margin: 0; max-width: none; }

.linklike {
    background: transparent;
    border: 0;
    padding: 0;
    margin: 0;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 120ms;
}
.linklike:hover { color: var(--accent-hover); text-decoration: underline; }

/* Buttons */

button[type="submit"],
.button,
button.button-primary {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 120ms, box-shadow 120ms;
    white-space: nowrap;
    min-height: 44px;
}

button[type="submit"]:hover,
.button:hover,
button.button-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow);
}

.button-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 120ms, border-color 120ms;
    white-space: nowrap;
    min-height: 44px;
}

.button-secondary:hover {
    background: var(--bg-subtle);
    border-color: var(--border);
    color: var(--text);
    text-decoration: none;
}

.button-danger {
    background: var(--bad);
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 120ms;
    white-space: nowrap;
    min-height: 44px;
}

/* Contact form grid */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0 1.5rem;
}

fieldset {
    border: 0;
    border-top: 1px solid var(--border);
    padding: 1.25rem 0 0;
    margin: 1.5rem 0 0.5rem;
}

fieldset legend {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-right: 0.5rem;
}

/* Step navigation */
.actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ---------------------------------------------------------------- tables */

table.results {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0 1.5rem;
    font-size: 0.9375rem;
    font-variant-numeric: tabular-nums;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

table.results thead { position: sticky; top: 60px; z-index: 10; }

table.results th {
    /* Doc spec: sticky header row with text-sm font-semibold. */
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--bg-subtle);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.results td {
    text-align: left;
    padding: 1rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-secondary);
}

table.results tbody tr:nth-child(even) td { background: var(--bg-subtle); }
table.results tr:last-child td { border-bottom: none; }

table.results tbody tr:hover td { background: var(--accent-soft); }

table.results td strong {
    font-weight: 600;
    color: var(--text);
}

.row-ok td { background: var(--ok-soft); }
.row-no td { background: var(--bg-subtle); color: var(--text-muted); }
table.results .row-ok:hover td { background: #dcfce7; }
table.results .row-no:hover td { background: var(--bg-subtle); }

/* Register CTA in search table */
.register-button {
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    color: #fff;
    background: var(--accent);
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    display: inline-block;
    transition: background 120ms;
    white-space: nowrap;
}

.register-button:hover {
    background: var(--accent-hover);
    color: #fff;
    text-decoration: none;
}

/* ---------------------------------------------------------------- definition lists */

dl {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    gap: 0.5rem 1.5rem;
}

dl dt {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    padding-top: 0.125rem;
}

dl dd {
    margin: 0;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

dl dd code { background: transparent; padding: 0; }

/* ---------------------------------------------------------------- flashes */

.flashes {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flash {
    font-size: 0.9375rem;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
}

.flash-ok {
    background: var(--ok-soft);
    border-color: var(--ok-border);
    color: var(--ok);
}

.flash-error {
    background: var(--bad-soft);
    border-color: var(--bad-border);
    color: var(--bad);
}

/* ---------------------------------------------------------------- details/summary */

details {
    margin: 0 0 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

details > summary {
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    padding: 0.75rem 1rem;
    background: var(--bg-subtle);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    border-bottom: 1px solid transparent;
}

details[open] > summary {
    border-bottom-color: var(--border);
}

details > summary::-webkit-details-marker { display: none; }

details > summary::before {
    content: "▶";
    font-size: 0.6875rem;
    color: var(--text-muted);
    transition: transform 150ms;
    display: inline-block;
}

details[open] > summary::before { transform: rotate(90deg); }

details > *:not(summary) {
    padding: 1rem;
}

/* ---------------------------------------------------------------- landing hero */

.hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 2.5rem 0 3rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 2.5rem;
}

@media (min-width: 800px) {
    .hero { grid-template-columns: 1.5fr 1fr; align-items: start; }
}

.hero h1 { font-size: 2.25rem; margin-bottom: 0.75rem; }
.hero p { font-size: 1rem; margin-bottom: 1.5rem; }

.hero-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.hero-search {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.hero-search h3 { margin-top: 0; margin-bottom: 0.25rem; }
.hero-search p { font-size: 0.875rem; margin-bottom: 1rem; }
.hero-search form {
    max-width: none;
    margin: 0;
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.hero-search form > div { flex: 1 1 180px; }
.hero-search form label { margin-top: 0; }
.hero-search form button { flex-shrink: 0; }

/* ---------------------------------------------------------------- feature grid */

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.feature-cell {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
}

.feature-cell h3 {
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.feature-cell .num {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    display: block;
}

.feature-cell p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

/* ---------------------------------------------------------------- dashboard quick links */

.quick-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.quick-links li { /* no extra styles needed */ }

.quick-links a {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color 120ms, box-shadow 120ms, background 120ms;
    min-height: 80px;
    justify-content: center;
}

.quick-links a:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    background: var(--accent-soft);
    color: var(--text);
    text-decoration: none;
}

.quick-links .label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.quick-links .title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* ---------------------------------------------------------------- auth pages */

.auth {
    max-width: 440px;
    margin: 3rem auto;
}

.auth h1 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.auth > p { color: var(--text-muted); margin-bottom: 1.5rem; }

.auth form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

.auth form label:first-of-type { margin-top: 0; }

.auth .alt {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 1.25rem;
}

/* ---------------------------------------------------------------- admin nav */

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.admin-nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color 120ms, background 120ms;
}

.admin-nav a:hover { color: var(--text); background: var(--bg-subtle); }
.admin-nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* ---------------------------------------------------------------- order status banners */

.status-banner {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
    display: flex;
    gap: 1rem;
    align-items: center;
    background: var(--bg-card);
}

.status-banner::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--text-muted);
}

.status-banner.is-pending {
    background: var(--warn-soft);
    border-color: var(--warn-border);
}
.status-banner.is-pending::before {
    background: var(--warn);
    animation: pulse 1.4s ease-in-out infinite;
}

.status-banner.is-paid {
    background: var(--warn-soft);
    border-color: var(--warn-border);
}
.status-banner.is-paid::before {
    background: var(--warn);
    animation: pulse 1.4s ease-in-out infinite;
}

.status-banner.is-done {
    background: var(--ok-soft);
    border-color: var(--ok-border);
}
.status-banner.is-done::before { background: var(--ok); }

.status-banner.is-fail {
    background: var(--bad-soft);
    border-color: var(--bad-border);
}
.status-banner.is-fail::before { background: var(--bad); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.35; }
}

/* ---------------------------------------------------------------- misc utils */

.muted { color: var(--text-muted); }
.inline-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* Heading row: h2 + pill / secondary text side by side */
.section-heading {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 1.5rem 0 0.75rem;
}
.section-heading h2 { margin: 0; }

/* Search results heading row (icon + h2 + count) */
.results-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0 0.75rem;
}
.results-heading h2 { margin: 0; }

/* Hint text below checkbox label */
.hint {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Compact error detail list inside .card.error */
.error-list {
    font-size: 0.875rem;
    margin: 0.5rem 0 0;
    padding-left: 1.25rem;
}

/* Full-width form with top margin (for final review/confirm forms) */
form.confirm {
    margin-top: 1.5rem;
    max-width: none;
}

/* Fieldset first-child (no top border/margin reset) */
fieldset.flush {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* ---------------------------------------------------------------- form layout helpers */

.form-row {
    display: grid;
    gap: 0 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 600px) {
    .form-row-2col { grid-template-columns: 1fr 2fr; }
    .form-row-equal { grid-template-columns: 1fr 1fr; }
    .form-row-search { grid-template-columns: 1fr auto; align-items: end; }
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 640px) {
    header {
        gap: 0.75rem;
        flex-wrap: wrap;
        height: auto;
        padding: 0.75rem var(--gutter) 0;
    }

    nav {
        order: 3;
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 0 0 0.625rem;
        gap: 0.125rem;
        border-top: 1px solid var(--border);
        margin: 0 calc(-1 * var(--gutter));
        padding: 0.5rem var(--gutter) 0.5rem;
    }

    nav::-webkit-scrollbar { display: none; }

    nav a { white-space: nowrap; }

    .header-aux { margin-left: auto; }

    /* Sticky table header offset increases because header is taller on mobile */
    table.results thead { top: 0; }

    h1 { font-size: 1.5rem; }
    .hero h1 { font-size: 1.75rem; }
    dl { grid-template-columns: 1fr; gap: 0.15rem 0; }
    dl dt { padding-top: 0.75rem; }
    .actions { flex-direction: column-reverse; align-items: stretch; }
    .actions .button,
    .actions button[type="submit"] { width: 100%; justify-content: center; }
    table.results { font-size: 0.8125rem; }
    table.results th, table.results td { padding: 0.625rem 0.75rem; }
}

/* ---------------------------------------------------------------- badges */

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}
.badge-ok  { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.badge-new { background: var(--accent-soft); color: var(--accent); border-color: #E0CDF0; }

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