/* Kvatr's app. The homepage's palette and type (the DTU deck's): navy and cream, an orange accent,
   Space Grotesk over IBM Plex Sans. Built for the phone first. Dark mode follows the system
   setting. Every text colour holds WCAG AA (4.5:1) in both themes. */

:root {
    --navy: #16232E;
    --cream: #F5F3EE;
    --orange: #F0925E;

    --bg: #F3F2EE;
    --surface: #FBFAF7;
    --text: #16232E;
    --muted: #4A5866;
    --accent: #A9481A;
    --accent-text: #FBFAF7;
    --danger: #A12C1E;
    --border: #DEDBD3;

    --font-head: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
    --font-body: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
    --radius: 12px;

    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0F171E;
        --surface: #17232C;
        --text: #ECE8E1;
        --muted: #A3B0BA;
        --accent: #F0925E;
        --accent-text: #16232E;
        --danger: #F2A08F;
        --border: #263540;
    }
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.15; }
h1 { font-size: 1.9rem; margin: 0 0 0.75rem; }

a { color: var(--accent); }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 1rem; top: 1rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }

.app-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--navy);
    color: var(--cream);
}
.app-header .brand { color: var(--cream); font-family: var(--font-head); font-weight: 700; font-size: 1.25rem; text-decoration: none; }
.app-header .who { margin-left: auto; color: var(--cream); text-decoration: none; }
.app-header .who:hover { text-decoration: underline; }
.app-header .sign-out { margin: 0; }

.link-button {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.app-main { width: 100%; max-width: 44rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.sign-in { max-width: 24rem; }

.stack { display: flex; flex-direction: column; gap: 0.5rem; }

label { font-weight: 600; }

input {
    font: inherit;
    font-size: 1.15rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
}

.button {
    font: inherit;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-text);
    cursor: pointer;
    margin-top: 0.5rem;
}

.form-error { color: var(--danger); margin: 0; }
.small { font-size: 0.9rem; color: var(--muted); }
.notice { padding: 1rem; background: var(--surface); border-radius: var(--radius); }

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; padding: 0.75rem 1rem; background: var(--danger); color: #FFFFFF; }
#blazor-error-ui .reload { color: #FFFFFF; }

/* ---- Pages ---- */

h2 { font-size: 1.3rem; margin: 1.5rem 0 0.5rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0; }
.card h2 { margin-top: 0; }

.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 0.35rem 0; }

.meta { color: var(--muted); font-size: 0.9rem; margin-left: 0.5rem; }
.kind { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 0.35rem; }

.form-done { color: var(--text); background: var(--surface); border-left: 4px solid var(--accent); padding: 0.5rem 0.75rem; margin: 0.5rem 0; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin: 1rem 0; }
.tab { font: inherit; background: none; border: 0; border-bottom: 3px solid transparent; padding: 0.5rem 0.75rem; color: var(--muted); cursor: pointer; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

.tree { list-style: none; margin: 0; padding: 0; }
.tree li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.tree .depth-1 { padding-left: 1.25rem; }
.tree .depth-2 { padding-left: 2.5rem; }
.tree .depth-3 { padding-left: 3.75rem; }
.tree .depth-4 { padding-left: 5rem; }
.tree .depth-5 { padding-left: 6.25rem; }
.row-actions { margin-left: 0.75rem; display: inline-flex; gap: 0.75rem; font-size: 0.9rem; color: var(--accent); }
.inline-form { margin: 0.5rem 0; max-width: 24rem; }

.list { width: 100%; border-collapse: collapse; margin: 0.5rem 0; }
.list th, .list td { text-align: left; padding: 0.45rem 0.5rem 0.45rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.list th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.list .link-button { color: var(--accent); }

select { font: inherit; font-size: 1rem; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.check { font-weight: 400; display: flex; gap: 0.5rem; align-items: center; }
.plain li a + a, .plain li > a:not(:first-child) { margin-left: 0.75rem; }

/* ---- Fault reporting ---- */

.optional { font-weight: 400; color: var(--muted); font-size: 0.9rem; }
textarea { font: inherit; padding: 0.7rem 0.8rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
input[type="file"] { font: inherit; }

.qr-page { max-width: 28rem; }
.qr-page .where { color: var(--muted); margin: 0; }
.button-big { font-size: 1.25rem; padding: 1rem 1.25rem; }
.button-quiet { background: var(--surface); color: var(--text); border: 1px solid var(--border); margin-top: 0; }

.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.task { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; }
.task.open { border-left-color: var(--accent); }
.task.in-progress { border-left-color: var(--muted); }
.task.done { opacity: 0.75; }
.task-head { display: flex; flex-wrap: wrap; gap: 0.25rem 0.75rem; align-items: baseline; }
.task .status { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.task-text { margin: 0.4rem 0; }
.task-photos { display: flex; gap: 0.5rem; margin: 0.4rem 0; }
.thumb { width: 6rem; height: 6rem; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.task-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.task-actions input { flex: 1 1 10rem; font-size: 1rem; padding: 0.55rem 0.7rem; }
.task-actions .button { margin-top: 0; }

.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 1rem; }
.qr-sticker { margin: 0; padding: 1rem; border: 1px dashed var(--border); border-radius: var(--radius); background: #FFFFFF; color: #16232E; text-align: center; break-inside: avoid; }
.qr-sticker img { width: 100%; max-width: 10rem; height: auto; }
.qr-sticker figcaption { display: flex; flex-direction: column; gap: 0.2rem; }
.qr-sticker .meta { color: #4A5866; margin: 0; }

@media print {
    .app-header, .topbar, .sidebar, .scrim, .no-print, #blazor-error-ui { display: none; }
    body { background: #FFFFFF; }
    .app-main { max-width: none; padding: 0; }
}

/* ---- Kiosk ---- */

.shop { display: flex; flex-direction: column; gap: 0.5rem; }
.product { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 0.75rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.product label { font-weight: 600; display: flex; flex-direction: column; }
.product .price { font-weight: 400; color: var(--muted); }
.product input { width: 5rem; text-align: center; }
.receipt { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); padding: 1rem 1.25rem; }
.receipt h2 { margin-top: 0; }
.add-product { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.add-product input { flex: 1 1 8rem; font-size: 1rem; padding: 0.55rem 0.7rem; }
.add-product .button { margin-top: 0; }
.list input { font-size: 1rem; padding: 0.4rem 0.5rem; width: 100%; }
.list tr.inactive td { color: var(--muted); }
.month-nav { display: flex; gap: 1rem; align-items: center; }
.month-nav .link-button { color: var(--accent); }
h3 { font-size: 1.05rem; margin: 1rem 0 0.25rem; }

/* ---- A task's page ---- */

.where { color: var(--muted); margin: 0; }
.status-line { margin: 0 0 0.75rem; }
.status-line .status { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.15rem 0.5rem; border-radius: 999px; border: 1px solid var(--border); }
.status-line .status.open { border-color: var(--accent); color: var(--accent); }
.thread { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.thread li { display: flex; flex-direction: column; padding: 0.5rem 0.75rem; border-radius: var(--radius); }
.thread .message { background: var(--surface); border: 1px solid var(--border); }
.thread .event { color: var(--muted); font-size: 0.9rem; padding: 0.15rem 0.75rem; }
.thread .meta { margin-left: 0; }
.task-head a { color: var(--text); }

/* ---- Invoices ---- */

.invoice { background: #FFFFFF; color: #16232E; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.invoice a { color: #A9481A; }
.invoice .small, .invoice .meta { color: #4A5866; }
.invoice .list th, .invoice .list td { border-bottom-color: #DEDBD3; }
.invoice .list th { color: #4A5866; }
.invoice-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.invoice h1 { margin-bottom: 0.25rem; }
.party { font-style: normal; line-height: 1.4; }
.buyer { margin: 1.25rem 0; }
.facts, .totals { display: grid; grid-template-columns: auto auto; gap: 0.15rem 1rem; margin: 0.5rem 0; }
.facts dt, .totals dt { color: #4A5866; }
.facts dd, .totals dd { margin: 0; }
.totals { justify-content: end; text-align: right; margin-top: 1rem; }
.invoice-lines td:nth-child(n+2), .invoice-lines th:nth-child(n+2) { text-align: right; }
.invoice-lines td:nth-child(n+2) { white-space: nowrap; }
.pay { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 1px solid #DEDBD3; }
.draft-mark { display: inline-block; padding: 0.2rem 0.6rem; border: 2px solid #A12C1E; color: #A12C1E; border-radius: 6px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

@media print {
    .invoice { border: 0; padding: 0; }
}

/* ---- People ---- */

.avatar { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 0.5rem; flex: none; }
.avatar.initials { background: var(--border); color: var(--text); font-size: 0.8rem; font-weight: 600; }
.avatar.large { width: 7.5rem; height: 7.5rem; margin-right: 0; font-size: 2.25rem; }
.profile { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.5rem; }

/* ---- Receipts ---- */

.signature-pad { display: block; width: 100%; aspect-ratio: 5 / 2; touch-action: none; cursor: crosshair; background: #FFFFFF; color: #16232E; border: 1px dashed var(--muted); border-radius: var(--radius); }
.signature { display: block; width: 100%; height: auto; }
.signature-cell { width: 8rem; background: #FFFFFF; color: #16232E; }
.signature-box { max-width: 30rem; margin-top: 1.5rem; border-bottom: 1px solid #16232E; }
.receipt { background: #FFFFFF; color: #16232E; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.receipt .facts dt { color: #4A5866; }
@media print {
    .receipt { border: 0; padding: 0; }
}

/* ---- Contracts ---- */

.contract { max-width: 46rem; line-height: 1.55; }
.contract h2 { font-size: 1.15rem; margin: 1.5rem 0 0.4rem; }
.contract h3 { font-size: 1rem; margin: 1rem 0 0.3rem; }
.contract p { margin: 0 0 0.7rem; }
.contract code { overflow-wrap: anywhere; }
.parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem 2rem; }
.party .signature-box { margin-top: 0.25rem; }
.party p { margin: 0.2rem 0; }
.template-body { min-height: 22rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9rem; }
.party-form { border-left: 3px solid var(--border); padding-left: 0.75rem; }

/* ---- The menu, as Claude's console has it ---- */

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.shell { min-height: 100vh; }
.topbar { display: flex; align-items: center; gap: 0.75rem; padding: 0.5rem 1rem; background: var(--navy); color: var(--cream); position: sticky; top: 0; z-index: 5; }
.brand { font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; text-decoration: none; color: inherit; }
.sidebar { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.75rem; background: var(--surface); border-right: 1px solid var(--border); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0.25rem 0.75rem 0.6rem; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 8px; color: inherit; cursor: pointer; }
.icon-button:hover { background: var(--border); }
.topbar .icon-button:hover { background: rgb(255 255 255 / 0.12); }
.icon { width: 1.15rem; height: 1.15rem; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 0.65rem; width: 100%; padding: 0.45rem 0.6rem; border: 0; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.nav-item:hover { background: var(--bg); }
.nav-item.active { background: var(--border); font-weight: 600; }
.nav-item.sub { padding-left: 2.4rem; color: var(--muted); }
.nav-item.sub.active { color: var(--text); }
.account { position: relative; margin-top: auto; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.account summary { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 8px; cursor: pointer; list-style: none; }
.account summary::-webkit-details-marker { display: none; }
.account summary:hover { background: var(--bg); }
.account summary .avatar { margin-right: 0; }
.account .who { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.account-menu { position: absolute; left: 0; right: 0; bottom: 100%; padding: 0.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / 0.25); }
.account-menu form { margin: 0; }
.scrim { display: none; }

/* A narrow screen: the menu slides in over the page from the menu button. */
@media (max-width: 899px) {
    .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 20; width: 17rem; max-width: 85vw; transform: translateX(-100%); transition: transform 0.2s ease; }
    .nav-toggle:checked ~ .shell .sidebar { transform: none; }
    .nav-toggle:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgb(0 0 0 / 0.45); }
}

/* A wide screen: the menu stands on the left; folded away, the top bar with the menu button comes back. */
@media (min-width: 900px) {
    .shell { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); align-content: start; }
    .topbar { display: none; }
    .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; }
    .nav-toggle:checked ~ .shell { grid-template-columns: minmax(0, 1fr); }
    .nav-toggle:checked ~ .shell .sidebar { display: none; }
    .nav-toggle:checked ~ .shell .topbar { display: flex; }
}
