@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 400 700;
    font-display: optional;
    src: url("../fonts/inter-latin-var.woff2") format("woff2");
}

:root {
    /* Warm-grey neutral ramp and terracotta brand ramp, matched to app.andsend.com. */
    --white:    #fdfcfc;
    --black:    #100f0e;
    --gray-50:  #f9f7f6;
    --gray-100: #f2f0ee;
    --gray-200: #e5e3e1;
    --gray-300: #c3bfbb;
    --gray-400: #9e9994;
    --gray-500: #85807a;
    --gray-600: #6a6662;
    --gray-700: #4b4744;
    --gray-800: #312e2b;
    --gray-900: #201f1d;
    --gray-950: #100f0e;

    --brand-50:  #fdf8f7;
    --brand-100: #faf2f0;
    --brand-200: #f3e1dd;
    --brand-300: #e3beb5;
    --brand-400: #d09586;
    --brand-500: #c06d59;
    --brand-600: #a85743;
    --brand-700: #844839;
    --brand-800: #61382e;
    --brand-900: #472b24;

    --error-100:   #fbe9e9;
    --error-300:   #f0a8a8;
    --error-500:   #e05252;
    --error-600:   #d92626;
    --error-700:   #ad1f1f;
    --success-100: #e1f4ec;
    --success-500: #3b9b73;
    --success-600: #2d8661;
    --success-700: #226d4e;
    --warning-100: #fbf2e9;
    --warning-600: #d98026;

    --background:       var(--white);
    --background-alt:   var(--gray-100);
    --foreground:       var(--gray-900);
    --text-secondary:   var(--gray-700);
    --text-tertiary:    var(--gray-600);
    --text-placeholder: var(--gray-400);
    --border:            var(--gray-200);
    --input:            var(--gray-200);
    --ring:             var(--brand-500);
    --muted:            var(--gray-100);

    --radius: 0.625rem;
    --shadow-xs: 0 1px 3px 0 rgba(0, 0, 0, .05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, .10), 0 1px 2px -1px rgba(0, 0, 0, .10);
    --shadow-lg: 0 1px 3px 0 rgba(0, 0, 0, .10), 0 4px 6px -1px rgba(0, 0, 0, .10);

    --bad:  var(--error-600);
    --good: var(--success-700);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--foreground);
    background: var(--background-alt);
}

header .bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 600;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    text-decoration: none;
    color: var(--foreground);
}
.brand-mark { color: #CC0000; }
.who { display: flex; align-items: center; gap: 1rem; color: var(--text-tertiary); font-size: 0.9rem; }
.inline { display: inline; }

main { max-width: 60rem; margin: 0 auto; padding: 1.5rem; }
.narrow { max-width: 22rem; }

body.wide-theme main { max-width: 76rem; }

h1 { font-size: 1.5rem; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; letter-spacing: -0.01em; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }

.hint { color: var(--text-tertiary); font-size: 0.9rem; }

.error, .ok {
    font-size: 0.9rem;
    padding: 0.6rem 0.85rem;
    border-radius: calc(var(--radius) - 4px);
    border: 1px solid transparent;
}
.error { color: var(--error-700); background: var(--error-100); border-color: var(--error-300); }
.ok    { color: var(--success-700); background: var(--success-100); border-color: var(--success-500); }

/* Notices inline in running text (labels, table cells) shouldn't carry the panel treatment -
   only standalone <p class="error">/<p class="ok"> alerts should. */
label.hint, td.error, span.error, p.hint {
    padding: 0;
    border: 0;
    background: none;
    border-radius: 0;
}

label { display: block; margin-top: 1rem; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }

input[type="text"], input[type="password"], input[type="file"], input:not([type]), select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    font: inherit;
    font-size: 0.92rem;
    color: var(--foreground);
    background: var(--background);
}

input::placeholder { color: var(--text-placeholder); }

input[type="text"]:focus, input[type="password"]:focus, input:not([type]):focus, select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--brand-100);
}

button {
    margin-top: 1.25rem;
    padding: 0.6rem 1.2rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--brand-500);
    color: var(--white);
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

button:hover { background: var(--brand-400); }

button.link {
    margin: 0;
    padding: 0;
    background: none;
    color: var(--text-tertiary);
    text-decoration: underline;
    font-weight: 400;
}
button.link:hover { background: none; color: var(--foreground); }

.upload {
    padding: 1.25rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    background: var(--gray-50);
}

.upload button { margin-top: 1rem; }

table.errors, table.admin-table {
    width: 100%;
    margin-top: 1rem;
    border-collapse: collapse;
    font-size: 0.87rem;
}

table.errors th, table.errors td,
table.admin-table th, table.admin-table td {
    text-align: left;
    padding: 0.55rem 0.7rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

table.errors th, table.admin-table th {
    color: var(--text-tertiary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--gray-50);
}

table.admin-table td code {
    font-size: 0.85em;
    white-space: nowrap;
    background: var(--gray-100);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
}

.table-scroll { overflow-x: auto; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Card-centred pages: login, upload, job status. */
body.app-theme main {
    max-width: none;
    min-height: calc(100vh - 3.6rem);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
}

.page-card {
    width: 100%;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow-sm);
    padding: 2.25rem 2rem 2rem;
}

.page-card--narrow { max-width: 22rem; }
.page-card--medium { max-width: 34rem; }
.page-card--wide { max-width: 54rem; }
.page-card--full { max-width: 72rem; }

.page-card h1 {
    margin-top: 0;
}

.page-card button[type="submit"] {
    width: 100%;
    margin-top: 1.75rem;
    border-radius: var(--radius);
    background: var(--brand-500);
    font-weight: 600;
}

.page-card button[type="submit"]:hover {
    background: var(--brand-400);
}

/* Row-level action buttons (reset password, enable/disable) inside admin tables must not inherit
   the full-width brand submit pill meant for primary page forms above - otherwise every button
   in a table cell renders as a full-width pill. Style them as a quiet outline button instead. */
.admin-table form.row-action {
    display: inline-block;
    margin: 0;
}

.admin-table form.row-action button[type="submit"],
.page-card .admin-table form.row-action button[type="submit"] {
    width: auto;
    margin-top: 0;
    padding: 0.3rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: 6px;
    background: var(--background);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.admin-table form.row-action button[type="submit"]:hover {
    background: var(--gray-50);
    color: var(--foreground);
}

/* A destructive action (disable, purge) should not look like the same friendly "Save". */
.page-card button.button-danger[type="submit"] {
    background: var(--error-600);
}
.page-card button.button-danger[type="submit"]:hover {
    background: var(--error-700);
}
.admin-table form.row-action button.button-danger[type="submit"] {
    background: var(--background);
    color: var(--error-600);
    border-color: var(--error-300);
}
.admin-table form.row-action button.button-danger[type="submit"]:hover {
    background: var(--error-100);
}

.login-card button[type="submit"] {
    height: 3rem;
}

.login-card .field {
    position: relative;
    margin-top: 1.1rem;
}

.login-card .field:first-of-type {
    margin-top: 0;
}

.login-card .field svg {
    position: absolute;
    left: 1.05rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--text-placeholder);
}

.login-card .field input[type="text"],
.login-card .field input[type="password"],
.login-card .field input:not([type]) {
    height: 3rem;
    padding: 0 1rem 0 2.75rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    background: var(--background);
}

.login-card .field input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--brand-100);
}

.page-card .error {
    margin-top: 1rem;
}

.spinner::after {
    content: "";
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-left: 0.5em;
    border: 2px solid var(--border);
    border-top-color: var(--brand-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: -0.1em;
}

@keyframes spin { to { transform: rotate(360deg); } }
