/* Riffi Admin. Brand from riffi.in: ink, lime, Geist, pill buttons, soft grey surfaces. Served by the admin service
   itself (no CDN); Geist is bundled under the SIL Open Font License (fonts/OFL.txt). Styles plain elements so the
   templates stay simple; the few classes are the layout, cards, badges and notices. */

@font-face { font-family: Geist; src: url("fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
    --ink: #0d0d0f;
    --ink-soft: #2a2a30;
    --muted: #6b6b75;
    --line: #e6e6e7;
    --surface: #f4f4f6;
    --page: #fafafb;
    --white: #fff;
    --lime: #baee27;
    --lime-soft: #edffba;
    --lime-deep: #769719;
    --blue: #4ab2fa;
    --blue-soft: #e3f3fe;
    --orange: #e95b22;
    --orange-soft: #fde9e0;
    --red-deep: #b52a11;
    --yellow: #fff947;
    --yellow-soft: #fffcc2;
    --radius: 14px;
    --sidebar: 248px;
    --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 400 14px/1.55 Geist, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Layout ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky; top: 0;
    flex: 0 0 var(--sidebar);
    height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
    background: var(--ink); color: #d9d9de;
    padding: 22px 14px 18px;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 0 10px 22px;
    color: var(--white); text-decoration: none;
    font-weight: 700; font-size: 17px; letter-spacing: -0.01em;
}
.brand-mark {
    display: grid; place-items: center;
    width: 30px; height: 30px; border-radius: 9px;
    background: var(--lime); color: var(--ink);
    font-weight: 800; font-size: 16px;
}
.brand small { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: -4px; }

.nav-group {
    margin: 14px 10px 6px;
    color: #8b8b95; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.sidebar a.nav {
    display: block;
    padding: 7px 10px; margin: 1px 0;
    border-radius: 9px;
    color: #d9d9de; text-decoration: none; font-weight: 500;
}
.sidebar a.nav:hover { background: var(--ink-soft); color: var(--white); }
.sidebar a.nav.active { background: var(--lime); color: var(--ink); }

.sidebar-foot {
    margin-top: auto; padding: 16px 10px 0;
    border-top: 1px solid var(--ink-soft);
}
.me-name { color: var(--white); font-weight: 600; overflow-wrap: anywhere; }
.me-role { color: #8b8b95; font-size: 12px; margin-bottom: 10px; }
.sidebar-foot form { display: block; margin: 0; }
.sidebar-foot button {
    width: 100%;
    background: transparent; color: #d9d9de;
    border: 1px solid #ffffff33;
}
.sidebar-foot button:hover { background: var(--ink-soft); color: var(--white); }

.main {
    flex: 1; min-width: 0;
    padding: 28px 40px 64px;
    max-width: 1280px;
    overflow-x: auto;
}

/* ---------- Type ---------- */

h1 { font-size: 28px; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 14px; }
h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; margin: 32px 0 10px; }
h3 { font-size: 15px; font-weight: 650; margin: 22px 0 8px; }
p { margin: 0 0 12px; }
a { color: #1677c7; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
code, kbd, samp, pre { font-family: var(--mono); font-size: 0.92em; }
pre { white-space: pre-wrap; background: var(--surface); padding: 12px; border-radius: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
small, .muted { color: var(--muted); }

/* The links line above a page's heading (Home · back to the list). */
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Tables ---------- */

table {
    width: 100%;
    border-collapse: separate; border-spacing: 0;
    background: var(--white);
    border: 1px solid var(--line); border-radius: var(--radius);
    margin: 8px 0 18px;
    overflow: hidden;
}
th, td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
tr:last-child > th, tr:last-child > td { border-bottom: 0; }
th { font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: 0.02em; background: var(--surface); }
/* Key/value tables (a row header followed by its value): the header column stays narrow. */
tr > th:first-child + td:last-child { width: 100%; }
tr:hover > td { background: #fcfcfd; }
td { overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }

/* ---------- Forms ---------- */

form {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px;
    margin: 10px 0 18px;
}
form > p, form > table, form > h2, form > h3, form > div, form > fieldset, form > ul { flex-basis: 100%; margin: 0; }
label {
    display: inline-flex; flex-direction: column; gap: 5px;
    font-size: 12px; font-weight: 600; color: var(--muted);
}
label:has(> textarea) { flex-basis: 100%; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
    flex-direction: row; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 500; color: var(--ink);
}
input, select, textarea {
    font: inherit; color: var(--ink);
    background: var(--white);
    border: 1px solid #d4d4d8; border-radius: 10px;
    padding: 8px 11px; min-height: 38px;
    font-weight: 400;
}
textarea { width: 100%; min-height: 84px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 16px; height: 16px; accent-color: var(--ink); }
input[type="file"] { padding: 6px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
    outline: 2px solid var(--lime-deep); outline-offset: 1px; border-color: var(--lime-deep);
}
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
legend { font-weight: 600; padding: 0 6px; }

button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 38px; padding: 8px 18px;
    border: 1px solid var(--ink); border-radius: 999px;
    background: var(--ink); color: var(--white);
    font: inherit; font-weight: 600; text-decoration: none;
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s;
}
button:hover, .button:hover { background: var(--lime); border-color: var(--lime); color: var(--ink); }
button:active { transform: translateY(1px); }
/* Small row buttons inside tables. */
td form { margin: 0; gap: 8px; }
td button { min-height: 30px; padding: 4px 12px; font-size: 13px; }

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

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 18px 0 28px; }
.card {
    display: block;
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; color: var(--ink); text-decoration: none;
    transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card:hover { border-color: var(--ink); color: var(--ink); transform: translateY(-1px); box-shadow: 0 6px 18px #0d0d0f12; }
.card-title { font-weight: 650; font-size: 15px; }
.card-text { color: var(--muted); font-size: 13px; margin-top: 4px; }
.card-count { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; margin-top: 6px; }
.card.alert { background: var(--orange-soft); border-color: #f6b79c; }
.card.alert .card-count { color: var(--red-deep); }
.card.ok .card-count { color: var(--lime-deep); }

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

.status {
    display: inline-block;
    padding: 2px 9px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    background: var(--surface); color: var(--ink-soft);
}
.status-SUCCEEDED { background: var(--lime-soft); color: #4b6110; }
.status-FAILED { background: var(--orange-soft); color: var(--red-deep); }
.status-UNKNOWN { background: var(--yellow-soft); color: #6d5c00; }
.status-REQUESTED { background: var(--blue-soft); color: #165f93; }

/* Long identifiers (UUIDs) in a calmer type. */
.id { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* ---------- Sign-in ---------- */

.signin {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 24px;
    background: var(--ink);
}
.signin-card {
    width: 100%; max-width: 400px;
    background: var(--white); border-radius: 20px;
    padding: 34px 30px;
}
.signin-card .brand { color: var(--ink); padding: 0 0 18px; }
.signin-card h1 { font-size: 24px; }
.signin-card form { flex-direction: column; align-items: stretch; }
.signin-card .button { width: 100%; }
.notice {
    padding: 10px 14px; border-radius: 10px;
    background: var(--surface); margin-bottom: 14px;
}
.notice.warn { background: var(--orange-soft); color: var(--red-deep); }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { position: static; height: auto; flex-basis: auto; padding: 14px; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .nav-group { display: none; }
    .sidebar-foot { margin-top: 10px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
    .sidebar-foot button { width: auto; }
    .main { padding: 20px 16px 48px; }
    table { display: block; overflow-x: auto; }
}
