:root {
    /* Semel brand palette (enroll.semel.fi) */
    --brand-navy: #162E45;
    --brand-navy-dark: #0D1E2E;
    --brand-amber: #F1AB47;
    --brand-amber-dark: #D4912E;

    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface-2: #f0f2f7;
    --text: #1b1f2a;
    --text-muted: #5b6270;
    --border: #e2e6ee;
    --accent: var(--brand-navy);
    --accent-hover: var(--brand-navy-dark);
    --shadow: 0 1px 2px rgba(20, 27, 45, .04), 0 8px 24px rgba(20, 27, 45, .08);
    --radius: 16px;

    /* Presence statuses. Blue is the office and green is remote — the assignment the phones
       follow, defined in iOS's PresenceStatus.tint and mirrored in Android's PresenceAccents.
       Nothing that is not a presence status may point at these; that is what --danger and the
       roles below are for, and why these were finally free to move. */
    --office: #2f6fed;
    --remote: #15803d;
    --focus: #4f46e5;
    --lunch: #c2410c;
    --away: #64748b;
    --checkedout: #94a3b8;
    --unknown: #cbd5e1;

    /* Semantic roles, previously borrowed from the statuses above — --focus was carrying every
       form error, --lunch every expiry warning, --away every muted badge. That is precisely why
       the palette could not be changed: repainting a status repainted the error states with it.
       Values are the ones those rules already rendered, so splitting them changed nothing on
       screen; they are free to diverge from here.
       --danger happens to equal --lunch today. Coincidence, not a link — a truer red would suit
       an error better than this burnt orange, and can now be chosen without touching a status. */
    --danger: #c2410c;
    --warn: #b45309;
    --muted: #64748b;
    --info: #6b46e5;

    /* The two check-in buttons put white on a gradient, so they need a tone dark enough to carry
       it in either theme — they cannot follow the statuses when those lighten for dark mode. */
    --office-solid: #2f6fed;
    --office-solid-lift: #4b83f0;
    --remote-solid: #15803d;
    --remote-solid-lift: #199a4a;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f131c;
        --surface: #171c28;
        --surface-2: #1f2634;
        --text: #eef1f7;
        --text-muted: #9aa3b4;
        --border: #2a3242;
        --accent: #6a97c4;
        --accent-hover: #83a9d0;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);

        /* The statuses are chosen against white, and several of them go muddy here — indigo
           measures 2.7:1 on this surface and the old remote purple was already under the 3:1 a
           meaningful graphic owes. These are Android's DarkPresenceAccents, tuned against a
           near-identical ground, so the browser and the phone agree in dark mode too. Checked out
           and unknown go *darker* rather than lighter: their job is to recede, and on a dark
           ground receding means dropping toward the surface.
           The roles above keep their light values — unchanged from what dark mode renders today,
           and none of them is failing. */
        --office: #8ab4ff;
        --remote: #5bd98a;
        --focus: #b9a5ff;
        --lunch: #ff9e6e;
        --away: #a8b3c2;
        --checkedout: #98a3b1;
        --unknown: #79838f;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    /* Stop iOS Safari from inflating text (and em-sized logos with it) inside
       horizontally-scrolling wide blocks like the diagnostics table. */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* iOS paints the status-bar strip (and the rubber-band overscroll areas) with the document
   *canvas* colour, which it takes from the root element — the header underneath it doesn't
   get a say. Left to the body's light --bg, that strip reads white above our navy header, so
   the canvas is navy and <body> keeps --bg for the page itself. This also decides the status
   bar's glyph colour: against navy iOS draws the clock and battery white. */
html { background-color: var(--brand-navy); }

body {
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Installed on iOS the status bar sits on top of us (black-translucent), so the top
       padding carries the inset and the navy extends behind the clock. The side insets
       keep the brand and account menu clear of the notch in landscape. */
    padding: calc(18px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right))
             18px calc(24px + env(safe-area-inset-left));
    border-bottom: 1px solid var(--brand-navy-dark);
    background: var(--brand-navy);
    color: #fff;
}

.user {
    display: flex;
    align-items: center;
    color: rgba(255, 255, 255, .72);
    font-size: .9rem;
    font-weight: 550;
}

/* Account menu: the display name is the trigger; Sign out lives inside it so it stays low-key
   (a rare action) instead of sitting in the header as its own button. */
.user-menu { position: relative; display: flex; }
.user-menu.open { z-index: 41; }

.user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: .9rem;
    font-weight: 550;
    color: rgba(255, 255, 255, .82);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 6px 8px 6px 12px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.user-trigger:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.user-menu.open .user-trigger { background: rgba(255, 255, 255, .14); color: #fff; }

.user-name { white-space: nowrap; }

.user-caret {
    width: 14px;
    height: 14px;
    flex: none;
    opacity: .7;
    transition: transform .15s ease;
}
.user-menu.open .user-caret { transform: rotate(180deg); }

/* Invisible full-viewport catcher so a click/tap anywhere else closes the menu. */
.user-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    cursor: default;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 41;
    min-width: 168px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.signout-form { margin: 0; }

.signout {
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
    font-size: .9rem;
    font-weight: 550;
    color: var(--text);
    background: transparent;
    border: 0;
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.signout:hover { background: var(--surface-2); }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -.01em;
    color: #fff;
}

.brand-mark {
    width: 26px;
    height: 26px;
    flex: none;
    color: #fff;
}

.brand-accent {
    color: var(--brand-amber);
    margin-left: 2px;
}

.app-main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px calc(64px + env(safe-area-inset-bottom));
}

.checkin {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.greeting h1 {
    margin: 0 0 4px;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.greeting .sub {
    margin: 0;
    color: var(--text-muted);
    font-size: 1rem;
}

/* --- Current status card --- */
.status-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--status, var(--unknown));
}

.status-card .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--status, var(--unknown));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--status, var(--unknown)) 22%, transparent);
    flex: none;
}

.status-text { display: flex; flex-direction: column; gap: 2px; }
.status-name { font-weight: 650; font-size: 1.05rem; }
.status-detail { color: var(--text-muted); font-size: .875rem; }

.status-inoffice   { --status: var(--office); }
.status-remote     { --status: var(--remote); }
.status-focus      { --status: var(--focus); }
.status-lunch      { --status: var(--lunch); }
.status-away       { --status: var(--away); }
.status-checkedout { --status: var(--checkedout); }
.status-unknown    { --status: var(--unknown); }

/* --- Primary actions --- */
.actions-primary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 26px 16px;
    font: inherit;
    font-weight: 650;
    font-size: 1.05rem;
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .08s ease, filter .15s ease, box-shadow .15s ease;
}

.btn-office { background: linear-gradient(135deg, var(--office-solid), var(--office-solid-lift)); }
.btn-remote { background: linear-gradient(135deg, var(--remote-solid), var(--remote-solid-lift)); }
.btn .btn-emoji { font-size: 1.7rem; line-height: 1; }
.btn:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0); filter: brightness(.97); }

/* --- Two dimensions, one control each --- */
/* The card grows a row per dimension that has something to say. --status moves from the card to each
   row; the .status-* classes only set that variable, so they work on either. The card keeps its own
   class too, so a state with nothing riding on it looks exactly as it did before there were two rows. */
.status-rows { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.status-row { display: flex; align-items: baseline; gap: 12px; }
.status-row .status-name { border-left: 3px solid var(--status, var(--unknown)); padding-left: 10px; }
.status-row .status-detail { margin-left: auto; white-space: nowrap; }
.status-row:only-child .status-name { border-left: none; padding-left: 0; }

.dimension { display: flex; flex-direction: column; gap: 10px; }
.dimension-label {
    font-size: .78rem;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.dimension-hint { margin: 0; color: var(--text-muted); font-size: .85rem; }

/* Check out spans the location group rather than becoming a third peer of the two big buttons. */
.actions-primary .chip-ghost { grid-column: 1 / -1; }

/* Two by two, unconditionally. The card around this row is capped at 440px (.checkin
   max-width), so the row is 440px at every viewport and a media query on the viewport cannot
   reach it. Four across needs (widest label + 28px padding) × 4 + 30px of gaps: English
   "Available" fits in 410, but Swedish "Tillgänglig" needs 502 and Finnish "Tavoitettavissa"
   602 — so four across was overflowing its buttons in two of the three shipped languages,
   at every width. A 215px column leaves 50% headroom over the widest of them, so the next
   translation has somewhere to go. Same shape iOS settled on for these four chips in 3c. */
.actions-availability { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Selected, never disabled: restating a status on purpose is a repair gesture, not a no-op. */
.chip.is-current {
    font-weight: 650;
    border-color: var(--status, var(--accent));
    background: color-mix(in srgb, var(--status, var(--accent)) 12%, var(--surface));
}
.btn:not(.is-current) { filter: saturate(.62); }
.btn:not(.is-current):hover:not(:disabled) { filter: saturate(.85) brightness(1.05); }

.duration-row { display: flex; align-items: center; gap: 10px; }
.duration-row label { font-size: .85rem; font-weight: 600; }
.duration-row .select { flex: 0 1 auto; }

/* --- Secondary actions --- */
.actions-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.chip {
    flex: 1 1 auto;
    min-width: 84px;
    padding: 12px 14px;
    font: inherit;
    font-weight: 550;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .08s ease;
}

.chip:hover:not(:disabled) { background: var(--surface-2); border-color: var(--accent); }
.chip:active:not(:disabled) { transform: translateY(1px); }
.chip-ghost { color: var(--text-muted); flex-basis: 100%; }

.btn:disabled, .chip:disabled { opacity: .55; cursor: default; }

/* --- Tuntivelho clock still running --- */
/* Shown only when the status has ended but the work-time clock has not. Warm rather than
   alarming: nothing is broken, but a legal work-time record is drifting and only the user can stop it. */
/* Two ways the status and the work-time clock disagree, one look: the clock running past a
   check-out, and a check-in that never stamped it. */
.clock-running,
.clock-not-stamped {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--warn, #d68a00);
    border-radius: 12px;
    background: color-mix(in srgb, var(--warn, #d68a00) 10%, var(--surface));
}

.clock-running p, .clock-not-stamped p { margin: 0; color: var(--text-muted); }
.clock-running .chip, .clock-not-stamped .chip { flex: 0 0 auto; }

/* The pin is a quieter thing than the clock banner above: it reports a rule working as intended,
   not a problem to fix, so it states itself in the surface's own colours and offers the way out. */
.pin-note {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
}

.pin-note strong { font-size: .95rem; }
.pin-note p { margin: 0; color: var(--text-muted); font-size: .925rem; }
.pin-note .chip { flex: 0 0 auto; }

.confirm {
    margin: 0;
    text-align: center;
    color: var(--text-muted);
    font-size: .925rem;
    animation: fade-in .25s ease;
}

.loading {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 420px) {
    .app-main { padding: 28px 16px calc(48px + env(safe-area-inset-bottom)); }
    .greeting h1 { font-size: 1.5rem; }
    .actions-primary { grid-template-columns: 1fr; }
    .duration-row { flex-wrap: wrap; }
}

/* ===== Header navigation ===== */
.app-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-right: auto;
    margin-left: 20px;
}

.nav-link {
    font-size: .9rem;
    font-weight: 550;
    color: rgba(255, 255, 255, .72);
    text-decoration: none;
    padding: 7px 12px;
    border-radius: 9px;
    transition: background .15s ease, color .15s ease;
}

.nav-link:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav-link.active { color: #fff; background: rgba(255, 255, 255, .14); }

/* Language switcher: a compact segmented control in the header. The active language is disabled and
   marked .is-current so it can't be re-selected (a re-select would needlessly reload). */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 12px;
    padding: 2px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 9px;
    background: rgba(255, 255, 255, .04);
}

.lang-option {
    font: inherit;
    font-size: .74rem;
    font-weight: 650;
    letter-spacing: .02em;
    color: rgba(255, 255, 255, .62);
    background: transparent;
    border: 0;
    border-radius: 7px;
    padding: 4px 8px;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.lang-option:hover:not(.is-current) { background: rgba(255, 255, 255, .1); color: #fff; }
.lang-option.is-current { background: rgba(255, 255, 255, .16); color: #fff; cursor: default; }

/* Brand-only headers (WelcomeLayout, SignedOutLayout) put the switcher straight after the brand: pin it
   to the right end, even if a narrow screen ever wraps it onto its own row. MainLayout's header has the
   nav between the two, so this doesn't match there and its layout is unchanged. */
.brand + .lang-switch { margin-left: auto; }

/* ===== Generic page scaffold (Tokens / Automate) ===== */
.page {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.page-head {
    padding-bottom: 16px;
    border-bottom: 3px solid var(--brand-amber);
}

.page-head h1 {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.page-head .sub { margin: 0; color: var(--text-muted); font-size: 1rem; max-width: 60ch; }

.page h2 { margin: 0 0 14px; font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; }
.page h3 { margin: 0; font-size: 1.05rem; font-weight: 650; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.muted { color: var(--text-muted); font-size: .9rem; }
.muted.empty { padding: 20px; text-align: center; }

/* ===== Code + copy ===== */
.code-row { display: flex; align-items: flex-start; gap: 8px; }
.code-row > .secret, .code-row > .snippet { flex: 1 1 auto; min-width: 0; }

code, .snippet {
    font-family: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;
}

.secret {
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 13px;
    font-size: .85rem;
    color: var(--text);
    word-break: break-all;
}

.snippet {
    margin: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: .82rem;
    line-height: 1.55;
    color: var(--text);
    overflow: auto hidden;
    white-space: pre;
}

.snippet code { font-size: inherit; }

.copy {
    flex: none;
    font: inherit;
    font-size: .8rem;
    font-weight: 550;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 8px 13px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.copy:hover { background: var(--surface-2); border-color: var(--accent); color: var(--text); }

/* Inline code inside prose */
.page p code, .contract-list code, .kv code, .check code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: .85em;
}

/* ===== Token reveal (after mint) ===== */
.reveal {
    background: color-mix(in srgb, var(--accent) 7%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fade-in .25s ease;
}

.reveal-head { display: flex; align-items: flex-start; gap: 12px; }
.reveal-check {
    flex: none;
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--brand-amber);
    color: var(--brand-navy);
    font-size: .85rem;
    font-weight: 700;
}
.reveal-title { display: flex; flex-direction: column; gap: 2px; margin-right: auto; }
.reveal-title strong { font-size: 1rem; }
.reveal-warn { color: var(--warn); font-size: .85rem; font-weight: 550; }
.reveal-try { margin: 2px 0 0; font-size: .85rem; font-weight: 550; color: var(--text-muted); }
.reveal-more { margin: 0; font-size: .85rem; color: var(--text-muted); }
.reveal-more a, .page a { color: var(--accent); }

.icon-btn {
    flex: none;
    font: inherit;
    line-height: 1;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 8px;
    padding: 4px 6px;
    cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ===== Mint form ===== */
.mint { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .field-label { font-size: .85rem; font-weight: 600; color: var(--text); }

.field input[type="text"], .field input[type="number"], .field input[type="password"] {
    font: inherit;
    padding: 10px 13px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input[type="number"] { max-width: 120px; }
.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.field input::placeholder { color: var(--text-muted); }

.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.expiry { display: flex; align-items: center; gap: 10px; }
.expiry .suffix { color: var(--text-muted); font-size: .85rem; }
.form-error { margin: 0; color: var(--danger); font-size: .875rem; font-weight: 550; }

.btn-primary {
    align-self: flex-start;
    font: inherit;
    font-weight: 650;
    color: var(--brand-navy);
    background: linear-gradient(135deg, var(--brand-amber), var(--brand-amber-dark));
    border: none;
    border-radius: 11px;
    padding: 12px 22px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: filter .15s ease, transform .08s ease;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .5; cursor: default; }

/* ===== Token list ===== */
.tokens { display: flex; flex-direction: column; gap: 14px; }
.token-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.token {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
    align-items: center;
    padding: 15px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--badge, var(--muted));
}
.token-active   { --badge: #16a34a; }
.token-expired  { --badge: var(--warn); }
.token-revoked  { --badge: var(--muted); }
.token-revoked, .token-expired { opacity: .82; }

.token-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.token-name { font-weight: 650; }
.token-scopes { display: flex; gap: 5px; }
.scope {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    border-radius: 5px;
    padding: 2px 7px;
}
.token-meta {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    color: var(--text-muted);
    font-size: .82rem;
}
.token-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.badge {
    font-size: .72rem;
    font-weight: 650;
    padding: 3px 9px;
    border-radius: 999px;
    color: #fff;
    background: var(--badge, var(--muted));
}
.badge-active { background: #16a34a; }
.badge-expired { background: var(--warn); }
.badge-revoked { background: var(--muted); }

.revoke {
    font: inherit;
    font-size: .82rem;
    font-weight: 550;
    color: var(--danger);
    background: transparent;
    border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border));
    border-radius: 8px;
    padding: 5px 12px;
    cursor: pointer;
    transition: background .15s ease;
}
.revoke:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* ===== Service logos (Teams / Slack), shown next to service mentions ===== */
.svc-icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    vertical-align: -0.22em;
    margin-right: 6px;
    object-fit: contain;
}
/* Wrapper for logo + label that keeps them centered as a unit. */
.svc-label { display: inline-flex; align-items: center; }
.svc-label .svc-icon { vertical-align: baseline; }

/* ===== Automate page ===== */
.contract { display: flex; flex-direction: column; gap: 16px; }
.baseurl { display: flex; flex-direction: column; gap: 7px; }
.contract-list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: .9rem; }
.contract-list em { font-style: normal; font-weight: 600; color: var(--text); }
.opt {
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 0 5px;
    margin-left: 2px;
}

.step { display: flex; align-items: flex-start; gap: 14px; }
.step-num {
    flex: none;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: var(--brand-amber);
    color: var(--brand-navy);
    font-weight: 700;
    font-size: .9rem;
}
.step-body { display: flex; flex-direction: column; gap: 4px; }
.step-body h2 { margin: 0; }
.step-body p { margin: 0; color: var(--text-muted); font-size: .92rem; max-width: 60ch; }

.recipe { display: flex; flex-direction: column; gap: 12px; }
.recipe-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 2px; }
.recipe-head h3 { display: flex; align-items: center; gap: 10px; }
.recipe-icon { width: 26px; height: 26px; flex: none; object-fit: contain; }
.recipe-head p { margin: 0; color: var(--text-muted); font-size: .9rem; }
.flag {
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--info);
    background: color-mix(in srgb, var(--info) 14%, transparent);
    border-radius: 5px;
    padding: 2px 7px;
    vertical-align: middle;
    margin-left: 6px;
}
.step-label { margin: 4px 0 0; font-size: .85rem; font-weight: 600; color: var(--text); }

.kv { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.kv > div { display: flex; gap: 10px; font-size: .88rem; }
.kv dt { flex: none; width: 68px; color: var(--text-muted); }
.kv dd { margin: 0; min-width: 0; overflow: auto hidden; }

.principles ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; font-size: .9rem; }
.principles strong { color: var(--text); }

@media (max-width: 640px) {
    .app-header {
        flex-wrap: wrap;
        gap: 10px 0;
        padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
                 14px calc(16px + env(safe-area-inset-left));
    }
    .app-nav { order: 3; width: 100%; margin: 0; gap: 8px 4px; }
    .app-main { padding: 24px 16px calc(56px + env(safe-area-inset-bottom)); }
    .token { grid-template-columns: 1fr; }
    .token-actions { grid-column: 1; grid-row: auto; flex-direction: row; align-items: center; justify-content: space-between; }
    .btn-primary { align-self: stretch; text-align: center; }
}

/* ===== Slack connection card (lives on the Settings page) ===== */
.conn-card { display: flex; flex-direction: column; gap: 14px; }

.conn-head { display: flex; align-items: center; gap: 12px; }
.conn-logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.conn-logo-icon { width: 22px; height: 22px; flex: none; }

.conn-state {
    margin-left: auto;
    font-size: .72rem;
    font-weight: 650;
    letter-spacing: .02em;
    padding: 3px 10px;
    border-radius: 999px;
    color: #fff;
    background: var(--muted);
}
.conn-state-on { background: #16a34a; }
.conn-state-warn { background: var(--warn); }
.conn-state-off { background: var(--muted); }

.conn-desc { margin: 0; color: var(--text-muted); font-size: .92rem; max-width: 60ch; }
.conn-desc em { font-style: normal; font-weight: 600; color: var(--text); }
.conn-note { margin: 0; color: var(--text-muted); font-size: .9rem; }
.conn-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conn-meta { margin: 0; color: var(--text-muted); font-size: .85rem; }
.disconnect-form { margin: 0; }
.conn-form { display: flex; flex-direction: column; gap: 14px; margin: 2px 0 0; max-width: 340px; }
.warn-desc { color: var(--warn); font-weight: 550; }

.btn-slack {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 650;
    color: #fff;
    text-decoration: none;
    background: #4a154b;
    border: none;
    border-radius: 11px;
    padding: 11px 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: filter .15s ease, transform .08s ease;
}
.btn-slack:hover { filter: brightness(1.12); transform: translateY(-1px); }

.btn-ghost {
    font: inherit;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 11px;
    padding: 11px 18px;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); color: var(--text); }

.confirm-error { color: var(--danger); }

/* ===== Settings page ===== */
.settings {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.settings .card { display: flex; flex-direction: column; }
.card-title { margin: 0 0 4px; font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; }
.card-sub { margin: 0 0 4px; color: var(--text-muted); font-size: .9rem; max-width: 60ch; }
.card-sub em { font-style: normal; font-weight: 600; color: var(--text); }

.setting-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 15px 0 4px;
    margin-top: 11px;
    border-top: 1px solid var(--border);
}

.setting-label { display: flex; flex-direction: column; gap: 3px; margin-right: auto; min-width: 0; }
.setting-name { font-weight: 600; font-size: .98rem; color: var(--text); }
.setting-desc { color: var(--text-muted); font-size: .86rem; max-width: 46ch; }
.setting-desc a { color: var(--accent); font-weight: 550; white-space: nowrap; }
.setting-row-disabled .setting-name { color: var(--text-muted); }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    transition: background .15s ease, border-color .15s ease;
}
.slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(20, 27, 45, .3);
    transition: transform .18s ease;
}
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider::before { transform: translate(18px, -50%); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.switch input:disabled + .slider { opacity: .5; cursor: default; }

.select {
    font: inherit;
    flex: none;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.select:disabled { opacity: .5; cursor: default; }

/* ===== Activity page ===== */
.activity-page { max-width: 720px; }
.activity-list { display: flex; flex-direction: column; gap: 12px; }

.activity-item {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 16px;
    padding: 16px 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--accent);
}

.activity-suppressedByPin { border-left-color: var(--warn); }
.activity-noOp { border-left-color: var(--muted); }

.activity-time {
    display: flex;
    flex-direction: column;
    gap: 3px;
    color: var(--text);
    font-weight: 700;
    line-height: 1.1;
}

.activity-time small {
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 500;
}

.activity-body { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.activity-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.activity-title strong { font-size: 1rem; }
.activity-body p { margin: 0; color: var(--text-muted); font-size: .9rem; }

.activity-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--text-muted);
    font-size: .78rem;
}

.activity-meta span {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 7px;
}

/* ===== Admin diagnostics ===== */
.admin-page { max-width: 980px; }

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.metric {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-label {
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0;
}

.metric strong { font-size: 1.5rem; line-height: 1; }
.metric-ok { border-left: 4px solid #16a34a; }
.metric-warn { border-left: 4px solid var(--warn); }

.table-wrap { overflow: auto; }

.diag-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
    font-size: .88rem;
}

.diag-table th,
.diag-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.diag-table th {
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
}

.failure-list { display: flex; flex-direction: column; gap: 10px; }

.failure {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 13px 15px;
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, .8fr) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    border-left: 4px solid var(--danger);
}

.failure div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.failure span { color: var(--text-muted); font-size: .82rem; overflow-wrap: anywhere; }
.failure code { overflow-wrap: anywhere; font-size: .82rem; }

@media (max-width: 760px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .activity-item { grid-template-columns: 1fr; gap: 10px; }
    .activity-time { flex-direction: row; align-items: baseline; gap: 8px; }
    .failure { grid-template-columns: 1fr; align-items: start; }
}

/* ===== Blazor reconnect overlay =====
   Custom UI (id="components-reconnect-modal") so the framework reuses it instead of
   injecting its own <style>, which the strict `style-src 'self'` CSP would refuse. */
#components-reconnect-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: color-mix(in srgb, var(--brand-navy-dark) 62%, transparent);
    backdrop-filter: blur(2px);
}
/* Visible in every non-hidden circuit state (reconnecting / retrying / failed / rejected). */
#components-reconnect-modal.components-reconnect-show,
#components-reconnect-modal.components-reconnect-retrying,
#components-reconnect-modal.components-reconnect-paused,
#components-reconnect-modal.components-reconnect-resume-failed,
#components-reconnect-modal.components-reconnect-failed,
#components-reconnect-modal.components-reconnect-rejected { display: flex; }

.reconnect-card {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 24px 28px;
    max-width: 360px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.reconnect-spinner {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    animation: reconnect-spin 0.8s linear infinite;
}
@keyframes reconnect-spin { to { transform: rotate(360deg); } }

.reconnect-title { margin: 0; font-weight: 650; font-size: 1.05rem; }
.reconnect-retrying { margin: 0; color: var(--text-muted); font-size: .9rem; max-width: 40ch; }
.reconnect-failed-text { margin: 0; display: none; color: var(--text-muted); font-size: .9rem; max-width: 40ch; }

/* Reload action styled as a large, full-width tap target so it is easy to hit on
   touch screens (e.g. after a backgrounded tab is put to sleep and times out). */
.reconnect-reload {
    display: none;
    box-sizing: border-box;
    width: 100%;
    min-height: 52px;
    margin-top: 4px;
    padding: 14px 24px;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 650;
    text-decoration: none;
    color: var(--brand-navy);
    background: linear-gradient(135deg, var(--brand-amber), var(--brand-amber-dark));
    border-radius: 11px;
    box-shadow: var(--shadow);
    transition: filter .15s ease, transform .08s ease;
}
.reconnect-reload:hover { filter: brightness(1.05); transform: translateY(-1px); }
.reconnect-reload:active { filter: brightness(.97); transform: translateY(0); }

/* Terminal states: drop the spinner + retry line, show the reload prompt. */
#components-reconnect-modal.components-reconnect-failed .reconnect-spinner,
#components-reconnect-modal.components-reconnect-rejected .reconnect-spinner,
#components-reconnect-modal.components-reconnect-failed .reconnect-retrying,
#components-reconnect-modal.components-reconnect-rejected .reconnect-retrying { display: none; }
#components-reconnect-modal.components-reconnect-failed .reconnect-failed-text,
#components-reconnect-modal.components-reconnect-rejected .reconnect-failed-text { display: block; }
#components-reconnect-modal.components-reconnect-failed .reconnect-reload,
#components-reconnect-modal.components-reconnect-rejected .reconnect-reload { display: flex; }

/* Danger zone — self-service data erasure (Settings). Reuses .btn-primary's shape, overrides colour. */
.danger-zone { border-color: color-mix(in srgb, #d7263d 28%, var(--border)); }
.danger-zone .card-title { color: #d7263d; }
.btn-danger { background: #d7263d; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }

/* Terminal "your data has been deleted" page. */
.goodbye { max-width: 34rem; }
.goodbye-note { color: var(--text-muted); line-height: 1.55; }

/* ===== Privacy policy (/privacy) — long-form legal prose ===== */
/* Effective-date / applies-to metadata under the page-head intro. */
.policy-meta {
    margin: 16px 0 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: .9rem;
}
.policy-meta > div { display: flex; gap: 6px; }
.policy-meta dt { color: var(--text-muted); font-weight: 550; }
.policy-meta dt::after { content: ":"; }
.policy-meta dd { margin: 0; color: var(--text); }

/* Shown in Finnish or Swedish above the English-only policy text. */
.policy-lang-note {
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: .925rem;
}

/* Each numbered section is a block inside the single policy card. */
.policy .card { display: flex; flex-direction: column; gap: 28px; }
.policy-section h2 { margin: 0 0 10px; }
.policy-section p { margin: 0 0 12px; line-height: 1.6; }
.policy-section p:last-child { margin-bottom: 0; }
.policy-section em { font-style: italic; }

/* Bold lead-in labels for the data groups in section 2 (kept tight to the list that follows). */
.policy-section p.policy-group { margin-bottom: 6px; font-weight: 650; color: var(--text); }

.policy-section ul {
    margin: 0 0 12px;
    padding-left: 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    line-height: 1.55;
}
.policy-section ul:last-child { margin-bottom: 0; }
.policy-section li { padding-left: 2px; }

.policy code {
    font-size: .88em;
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

/* ===== First-login onboarding wizard (/welcome) ===== */
.welcome {
    width: 100%;
    max-width: 30rem;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* Step progress dots */
.wizard-progress {
    display: flex;
    justify-content: center;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.wizard-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--border);
    transition: background .2s ease, transform .2s ease;
}
.wizard-dot-done { background: var(--brand-amber); }
.wizard-dot-current { background: var(--accent); transform: scale(1.3); }

/* Intro / summary bullet list */
.wizard-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.wizard-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    line-height: 1.5;
    color: var(--text);
}
.wizard-list em { font-style: normal; font-weight: 650; white-space: nowrap; }
.wizard-list-emoji { flex: none; font-size: 1.25rem; line-height: 1.3; }

/* "✓ connected" confirmation line inside a connection card */
.wizard-connected { margin: 0; font-weight: 600; color: #16a34a; }

/* Action row at the foot of each step */
.wizard-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.wizard-actions .btn-primary { text-decoration: none; }
.wizard-inline-form { margin: 0; }

/* ===== "How your check-in syncs" explainer (collapsible panel on the check-in page) ===== */
.guide {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* display:block (not flex) so the native disclosure triangle never renders — the marker only
   appears on the default `display: list-item`. Text + caret centre as one inline line. */
.guide-summary {
    display: block;
    padding: 13px 16px;
    font-size: .9rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: color .15s ease, background .15s ease;
}
.guide-summary::-webkit-details-marker { display: none; }
.guide-summary::marker { content: ""; }
.guide-summary:hover { color: var(--text); background: var(--surface-2); }
.guide-caret { vertical-align: -.18em; margin-left: 3px; transition: transform .2s ease; }
.guide[open] > .guide-summary { color: var(--text); border-bottom: 1px solid var(--border); }
.guide[open] > .guide-summary .guide-caret { transform: rotate(180deg); }

.guide-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    animation: fade-in .2s ease;
}

.guide-intro, .guide-foot {
    margin: 0;
    font-size: .875rem;
    line-height: 1.5;
    color: var(--text-muted);
}
.guide-intro em, .guide-foot em { font-style: normal; font-weight: 650; color: var(--text); }
.guide-foot { padding-top: 13px; border-top: 1px solid var(--border); }

.guide-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 404px; /* below this the .table-wrap scrolls, rather than cramming headers */
    font-size: .8rem;
}
.guide-table th:first-child, .guide-table td:first-child { width: 31%; }
.guide-table th, .guide-table td {
    padding: 8px 9px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    /* Finnish and Swedish compound rather than borrow: "arbetstidsklocka" and
       "työaikakello" are single unbreakable words in a table-layout:fixed cell that is
       93px wide. hyphens breaks them properly where the browser has the dictionary,
       overflow-wrap guarantees they never bleed past the cell where it does not. */
    hyphens: auto;
    overflow-wrap: break-word;
}
.guide-table thead th {
    color: var(--text-muted);
    font-size: .66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    vertical-align: bottom;
}
.guide-table thead th small {
    display: block;
    margin-top: 3px;
    font-size: .66rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    opacity: .85;
}
.guide-table thead .svc-icon { width: 1em; height: 1em; margin-right: 3px; vertical-align: -.15em; }
.guide-table tbody th[scope="row"] { font-weight: 600; color: var(--text); }
.guide-table tbody td { color: var(--text); }
.guide-table tbody td strong { font-weight: 700; }
.guide-table .g-none { color: var(--text-muted); font-style: italic; }
.guide-table tbody tr:last-child th, .guide-table tbody tr:last-child td { border-bottom: none; }
.g-emoji { font-size: 1rem; }

/* The check-in row is the hero — the one action that lights up every system. */
.guide-hero { background: color-mix(in srgb, var(--office) 7%, transparent); }
.guide-hero td { font-weight: 600; }

/* The expiry row is the surprising one: Teams and Slack clear themselves, the work-time clock does
   not. Marked so the eye lands on the cell that differs, not on the row as a whole. */
.guide-expiry { background: color-mix(in srgb, var(--warn, #d68a00) 6%, transparent); }
.guide-table .g-warn { font-weight: 650; color: var(--warn, #d68a00); }
