/* CarwareToolkit portal. Light only, by choice; the logo is the only element of the house style. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; src: url("../fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; src: url("../fonts/IBMPlexSans-Medium.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; src: url("../fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; src: url("../fonts/IBMPlexSans-Bold.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; src: url("../fonts/IBMPlexMono-Regular.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; src: url("../fonts/IBMPlexMono-Medium.woff2") format("woff2"); font-display: swap; }

:root {
    color-scheme: light;
    --bg: #f3f6f8; --surface: #ffffff; --surface-2: #eaf0f4; --ink: #12222e; --muted: #5d6f7c; --line: #d5dee5; --line-strong: #b9c6d0;
    --accent: #1f6f97; --accent-ink: #ffffff; --accent-soft: #e2eff6;
    --ok: #2a7a58; --ok-soft: #e1f2ea; --warn: #a8691a; --warn-soft: #fbeed9; --err: #b1413a; --err-soft: #f8e3e1;
    --diff-old: #b1413a; --diff-new: #1f6f97;
    --radius: 6px; --shadow: 0 1px 2px rgba(18, 34, 46, .08);
    --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.loading { padding: 48px 16px; text-align: center; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.spaced { margin-top: 16px; }
.hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.hint.err { color: var(--err); }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 16px; height: 56px; display: flex; align-items: center; gap: 16px; }
.topbar .brand { display: flex; align-items: center; }
.topbar .logo { height: 26px; width: auto; display: block; }
.topbar .product { font-weight: 600; letter-spacing: .02em; color: var(--muted); border-left: 1px solid var(--line); padding-left: 12px; white-space: nowrap; }
.topbar .grow, .grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.chip.env { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.err { background: var(--err-soft); color: var(--err); border-color: transparent; }
.chip.soon { background: var(--surface-2); color: var(--muted); }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lang button { border: 0; background: transparent; color: var(--muted); padding: 4px 10px; cursor: pointer; font-weight: 500; }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.user { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.user .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--ink); }
button.link { border: 0; background: transparent; color: var(--accent); cursor: pointer; padding: 0; font-weight: 500; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100% - 56px); }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.side .group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 10px 4px; font-weight: 600; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--ink); text-decoration: none; font-weight: 500; }
.side a.nav:hover { background: var(--surface-2); }
.side a.nav.active { background: var(--accent-soft); color: var(--accent); }
.side a.nav.sub { font-weight: 400; font-size: 13px; padding: 6px 10px 6px 14px; }
.side .foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.main { padding: 24px 24px 48px; min-width: 0; }
.main > * { max-width: 1040px; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; text-wrap: balance; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 65ch; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* Blocks */
.grid { display: grid; gap: 16px; }
.grid.tools { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.two { grid-template-columns: 1fr 1fr; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.slim { margin-bottom: 16px; }
.card.tool { display: flex; flex-direction: column; gap: 8px; }
.card.tool .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card.tool .actions { margin-top: auto; padding-top: 8px; }
.card.tool p { margin: 0; color: var(--muted); }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .v.small { font-size: 15px; }
.stat .v.ok { color: var(--ok); }
.stat .v.err { color: var(--err); }
.stat .s { font-size: 12px; color: var(--muted); }
.section { margin-top: 28px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500; text-decoration: none; line-height: 1.2; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }

/* Forms */
.form { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }
.input { padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; width: 100%; }
.drop { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 20px; display: flex; gap: 16px; align-items: center; background: var(--surface-2); flex-wrap: wrap; }
.drop .file { font-family: var(--mono); font-size: 13px; }
.drop .file .name { font-weight: 500; color: var(--ink); word-break: break-all; }
.drop .file .size { color: var(--muted); }
.req { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.req span { font-family: var(--mono); }
.req .k { font-family: var(--sans); }

/* Checks */
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); }
.checks .dot { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 18px; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-top: 2px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); }
.checks .ok .dot { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.checks .err .dot { background: var(--err-soft); color: var(--err); border-color: transparent; }
.checks .t { font-weight: 500; }
.checks .d { color: var(--err); font-size: 13px; font-family: var(--mono); }
.callout { border-left: 3px solid var(--err); background: var(--err-soft); color: var(--ink); padding: 12px 14px; border-radius: 0 var(--radius) var(--radius) 0; margin-bottom: 16px; }
.callout.ok { border-color: var(--ok); background: var(--ok-soft); }
.callout.info { border-color: var(--accent); background: var(--accent-soft); }
.callout b { font-weight: 600; }

/* Catalogue filters */
.catbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.catbar .input { max-width: 480px; }
.filters-row { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 4px 12px; cursor: pointer; font-weight: 500; font-size: 13px; }
.filter .n { font-family: var(--mono); font-size: 12px; opacity: .8; margin-left: 2px; }
.filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }

/* Tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.mono, th.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.diff td.old { color: var(--diff-old); }
.diff td.new { color: var(--diff-new); font-weight: 500; }
.tfoot { padding: 8px 12px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tfoot.bare { border: 0; padding-left: 0; }

/* Key-value, files, logs */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); margin: 0; }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }
.kv dd.sans { font-family: var(--sans); word-break: normal; }
.files { display: grid; gap: 8px; }
.files .f { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); flex-wrap: wrap; }
.files .f .n { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.files .f .s { color: var(--muted); font-size: 12px; font-family: var(--mono); }
pre.json, pre.log { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow-x: auto; margin: 0; }
pre.log { max-height: 320px; overflow: auto; user-select: all; line-height: 1.45; }

/* Login */
.login-wrap { min-height: 60vh; display: grid; place-items: center; padding: 24px 0; }
.login { width: 100%; max-width: 380px; }
.login .logo { height: 32px; width: auto; display: block; margin: 4px auto 20px; }
.login h1 { font-size: 18px; text-align: center; margin-bottom: 16px; }
.login .form { grid-template-columns: 1fr; }
.login .hint { text-align: center; margin-top: 12px; }
.login .btn { justify-content: center; }

#blazor-error-ui { background: var(--err-soft); color: var(--err); bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

@media (max-width: 820px) {
    .shell { grid-template-columns: 1fr; }
    .side { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; gap: 4px; }
    .side .group, .side .foot { display: none; }
    .side a.nav { white-space: nowrap; padding: 6px 10px; }
    .main { padding: 16px 16px 40px; }
    .form, .grid.two { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr 1fr; }
    .topbar .product, .user .user-name { display: none; }
}
