/* Employee Birthday Automation — admin UI (mobile-first, no framework) */
:root {
    --brand: #0F4C81;
    --brand-2: #F5A623;
    --bg: #F4F6FA;
    --surface: #FFFFFF;
    --surface-2: #F8FAFC;
    --text: #0F172A;
    --muted: #64748B;
    --border: #E2E8F0;
    --ok: #15803D;
    --ok-bg: #DCFCE7;
    --fail: #B91C1C;
    --fail-bg: #FEE2E2;
    --warn: #B45309;
    --warn-bg: #FEF3C7;
    --info-bg: #E0F2FE;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
    --sidebar: 248px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0B1120;
        --surface: #111827;
        --surface-2: #0F172A;
        --text: #E5E7EB;
        --muted: #94A3B8;
        --border: #1F2937;
        --ok-bg: #052E16;
        --ok: #4ADE80;
        --fail-bg: #450A0A;
        --fail: #F87171;
        --warn-bg: #451A03;
        --warn: #FBBF24;
        --info-bg: #0C2A3E;
        --shadow: none;
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.25; margin: 0; }
code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
small { color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
    display: flex; flex-direction: column; gap: 8px;
    background: var(--surface); border-right: 1px solid var(--border);
    padding: 18px 12px; transform: translateX(-100%); transition: transform .2s ease;
}
.sidebar.is-open { transform: translateX(0); }
.sidebar__brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 14px; border-bottom: 1px solid var(--border); }
.sidebar__brand strong { display: block; font-size: 15px; }
.sidebar__brand small { display: block; font-size: 12px; }
.logo-dot { font-size: 26px; }
.sidebar__nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; padding-top: 6px; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px;
    color: var(--text); text-decoration: none; font-size: 14px;
}
.nav-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-link:hover { background: var(--surface-2); }
.nav-link.is-active { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--brand); font-weight: 600; }
.sidebar__footer { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sidebar__user { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-size: 14px; }
.sidebar__user small { display: block; text-transform: capitalize; }
.backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 20; }
.backdrop.is-open { display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn { border: 0; background: none; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--text); }
.menu-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.content { padding: 16px; display: flex; flex-direction: column; gap: 16px; max-width: 1180px; width: 100%; }

.mode-pill { font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.mode-pill--dry { background: var(--warn-bg); color: var(--warn); }
.mode-pill--live { background: var(--ok-bg); color: var(--ok); }

@media (min-width: 960px) {
    .sidebar { transform: none; position: sticky; top: 0; height: 100vh; flex: none; }
    .menu-btn, .backdrop, .backdrop.is-open { display: none; }
    .topbar { padding: 16px 28px; }
    .content { padding: 24px 28px; }
}
.mode-pill__short { display: none; }
@media (max-width: 520px) {
    .mode-pill__full { display: none; }
    .mode-pill__short { display: inline; }
}

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; margin-bottom: 14px; }
.card__head h2 { font-size: 16px; }
.card__head .muted { font-size: 13px; }

.hero {
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px;
    padding: 20px; border-radius: var(--radius); color: #fff;
    background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #000));
}
.hero__date { margin: 0 0 4px; opacity: .85; font-size: 13px; }
.hero__title { font-size: 24px; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px; }
.hero .chip { background: rgba(255, 255, 255, .16); color: #fff; }
.hero .chip--ok { background: var(--brand-2); color: #1a1a1a; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); }
.chip--ok { background: var(--ok-bg); color: var(--ok); }
.chip--muted { opacity: .85; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.stat__label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat__value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat--alert { border-color: var(--fail); }
.stat--alert .stat__value { color: var(--fail); }

.bday-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.bday { display: grid; grid-template-columns: auto 1fr; gap: 12px 14px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.bday:first-child { border-top: 0; padding-top: 0; }
.bday__info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bday__info .muted { font-size: 13px; }
.bday__status { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
.bday__status span { display: inline-flex; align-items: center; gap: 6px; }
@media (min-width: 760px) {
    .bday { grid-template-columns: auto 1fr auto; }
    .bday__status { grid-column: auto; flex-direction: column; align-items: flex-end; gap: 6px; }
}

.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
    background: color-mix(in srgb, var(--brand) 15%, transparent); color: var(--brand); font-weight: 700; font-size: 13px;
}
.avatar--lg { width: 44px; height: 44px; font-size: 15px; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--fail { background: var(--fail-bg); color: var(--fail); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--pending { background: var(--info-bg); color: var(--brand); }
.badge--muted { background: var(--surface-2); color: var(--muted); }

.empty { text-align: center; padding: 28px 12px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h2 { font-size: 20px; }
.empty p { margin: 0; max-width: 520px; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; text-transform: none; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 12px 16px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.grid-2--top { align-items: start; gap: 16px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field small { font-weight: 400; }
.field input, .field select, .field textarea {
    font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 600; font-size: 14px; border-radius: 8px; padding: 10px 16px;
    border: 1px solid transparent; cursor: pointer; text-decoration: none; min-height: 40px;
}
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { padding: 6px 10px; min-height: 32px; font-size: 13px; width: 100%; }
.btn--block { width: 100%; }

.alert { padding: 11px 14px; border-radius: 8px; font-size: 14px; background: var(--info-bg); }
.alert--success { background: var(--ok-bg); color: var(--ok); }
.alert--error { background: var(--fail-bg); color: var(--fail); }
.alert--warning { background: var(--warn-bg); color: var(--warn); }
.flash-stack { padding: 16px 16px 0; display: flex; flex-direction: column; gap: 8px; max-width: 1180px; }
@media (min-width: 960px) { .flash-stack { padding: 24px 28px 0; } }

/* ---------- Bare pages (login / setup / errors) ---------- */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 16px;
    background: radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 55%), var(--bg); }
.bare__wrap { width: 100%; display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 28px 24px; display: flex; flex-direction: column; gap: 16px; }
.auth-card--wide { max-width: 640px; }
.auth-card__head { text-align: center; }
.auth-card__head h1 { font-size: 22px; margin-top: 6px; }
.auth-card__head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.auth-card__icon { font-size: 36px; }
.section-title { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.checklist li span { display: inline-block; width: 18px; font-weight: 700; }
.checklist .ok span { color: var(--ok); }
.checklist .fail { color: var(--fail); }

/* ---------- Phase 3: employees ---------- */
.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; }
.block { display: block; }
.small { font-size: 13px; }
.btn--auto { width: auto; }
.btn--xs { padding: 4px 10px; min-height: 30px; font-size: 12px; width: auto; }
.btn--danger { background: var(--fail); color: #fff; }
.btn--danger:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.toolbar__stats { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; color: var(--muted); font-size: 14px; }
.toolbar__stats strong { color: var(--text); }
.toolbar__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar__actions .btn { width: auto; }

.filters { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: end; }
@media (min-width: 760px) { .filters { grid-template-columns: 2fr 1fr 1fr 1fr auto auto; } }
.filters__buttons { display: flex; gap: 8px; }
.filters__buttons .btn { width: auto; }
.field--grow { min-width: 0; }
.field--sm input { width: 110px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; min-height: 40px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }

.card--flush { padding: 0; overflow: hidden; }
.card__head--pad { padding: 16px 18px 0; }
.card--muted { background: var(--surface-2); box-shadow: none; }
/* Employee photo (edit page) */
.photo-field { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.photo-field__img, .photo-field__initials { width: 120px; height: 120px; border-radius: 50%; flex: none; border: 4px solid var(--brand-2); box-shadow: var(--shadow); }
.photo-field__img { object-fit: cover; background: var(--surface-2); }
.photo-field__initials { display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; font-size: 40px; font-weight: 800; letter-spacing: .02em; }
.photo-field__controls { flex: 1 1 260px; min-width: 0; display: grid; gap: 8px; }
.photo-field__controls input[type="file"] { max-width: 100%; }
.photo-field__actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }

/* Photo cropper */
.cropper { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.cropper[hidden] { display: none; }
.cropper__stage { position: relative; width: min(320px, 100%); aspect-ratio: 1; overflow: hidden; border-radius: 12px; background: #0B1220; cursor: grab; touch-action: none; user-select: none; flex: none; }
.cropper__stage.is-dragging { cursor: grabbing; }
.cropper__stage:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.cropper__img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.cropper__ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 9999px rgba(11, 18, 32, .55); border: 3px solid var(--brand-2); pointer-events: none; }
.cropper__side { flex: 1 1 220px; min-width: 0; display: grid; gap: 12px; align-content: start; }
.cropper__zoom input[type="range"] { width: 100%; accent-color: var(--brand); }
.cropper__preview-wrap { display: flex; align-items: center; gap: 12px; }
.cropper__preview { width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--brand-2); background: var(--surface-2); }
.cropper__buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-field.is-cropping [data-photo-current] { opacity: .5; }
.card--danger { border-color: color-mix(in srgb, var(--fail) 40%, var(--border)); }
.bulk { display: flex; gap: 8px; align-items: center; }
.bulk select { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
.table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); border-top: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.table tr.is-inactive td { opacity: .6; }
.col-check { width: 36px; }
.col-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.col-actions { text-align: right; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 6px; }
.sort-link { color: inherit; text-decoration: none; }
.sort-link.is-active { color: var(--brand); }
.person { display: flex; gap: 10px; align-items: center; }
.person .badge { margin-left: 4px; }
.dot-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin-right: 8px; }
.dot-flag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.dot-flag.on::before { background: var(--ok); }
.dot-flag.off { color: var(--muted); text-decoration: line-through; }
.dot-flag.off::before { background: var(--border); }

/* Responsive table: rows become cards on phones */
@media (max-width: 759px) {
    .table--responsive thead { display: none; }
    .table--responsive, .table--responsive tbody, .table--responsive tr, .table--responsive td { display: block; width: 100%; }
    .table--responsive tr { padding: 12px 14px; border-top: 1px solid var(--border); position: relative; }
    .table--responsive td { border: 0; padding: 4px 0; }
    .table--responsive td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
    .table--responsive td[data-label="Name"]::before { display: none; }
    .table--responsive .col-check { position: absolute; right: 14px; top: 14px; width: auto; }
    .table--responsive .col-actions { text-align: left; padding-top: 8px; }
}

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; }

.test-data { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; }
.inline-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }

/* Form page */
.form--page { gap: 16px; }
.field__error { color: var(--fail); font-weight: 500; font-size: 13px; }
[aria-invalid="true"] { border-color: var(--fail) !important; }
.bday-fields { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 12px; }
.bday-fields[aria-invalid="true"] select { border-color: var(--fail); }
.toggles { display: flex; flex-direction: column; gap: 14px; }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }
.switch small { display: block; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.danger-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.danger-row p { margin: 4px 0 0; }

/* Import */
.radio-group { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; margin: 0; }
.radio-group legend { font-size: 14px; font-weight: 600; padding: 0 4px; }
.plain-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.stats--inline { margin-bottom: 14px; }
.stats--inline .stat { box-shadow: none; }
.error-list { margin: 0; padding-left: 16px; color: var(--fail); font-size: 13px; }
.table code { white-space: nowrap; }

/* ---------- Phase 4: Zoho ---------- */
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; overflow-x: auto; margin: 8px 0 0; }
code.copy { user-select: all; word-break: break-all; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.radio-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.radio-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; align-items: flex-start; }
.radio-card:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.link-form { display: flex; gap: 6px; align-items: center; }
.link-form select { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); max-width: 280px; min-width: 0; flex: 1; }
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.history li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
details summary { cursor: pointer; margin: 8px 0; }
.form .btn--auto { align-self: flex-start; }

/* ---------- Phase 5: automation ---------- */
.gates { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.gates li { padding-left: 22px; position: relative; }
.gates li::before { content: "•"; position: absolute; left: 6px; color: var(--muted); }
.gates li.ok::before { content: "✓"; color: var(--ok); }
.gates li.warn::before { content: "!"; color: var(--warn); font-weight: 700; }
.gates li.fail::before { content: "✕"; color: var(--fail); }
.date-test { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--border); }
.date-test .field--sm input { width: 170px; }
.mail-preview { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mail-preview header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mail-preview .dl dd { word-break: break-word; }
.mail-text { white-space: pre-wrap; font: 13px/1.5 var(--font); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin: 0; max-height: 260px; overflow: auto; }
.chip--link { text-decoration: none; }
.hero .chip--link:hover { background: rgba(255,255,255,.28); }

/* Dark-mode contrast fix for "Pending" badges */
@media (prefers-color-scheme: dark) {
    .badge--pending { color: #7DD3FC; }
    .nav-link.is-active { color: #93C5FD; }
}

/* Phase 6: Zoho Mail + template editor */
.mt-12 { margin-top: 12px; }
.tpl-editor { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 1100px) { .tpl-editor { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.tpl-preview { display: flex; flex-direction: column; gap: 10px; }
.tpl-preview .card__head { margin-bottom: 0; }
.preview-frame { width: 100%; height: 620px; border: 1px solid var(--border); border-radius: 10px; background: #f4f6fa; }
.code-area { font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; resize: vertical; }
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip--btn { border: 1px solid var(--border); cursor: pointer; color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 500; }
.chip--btn:hover:not(:disabled) { border-color: var(--brand); }
.chip--btn:disabled { cursor: default; opacity: .6; }
.field--inline { flex-direction: row; align-items: center; }
.field--inline select { max-width: 240px; }
.tpl-row .bday__status { justify-content: flex-start; }
@media (min-width: 640px) {
    .tpl-row { grid-template-columns: auto 1fr auto; }
    .tpl-row .bday__status { grid-column: auto; }
}

/* Colleague wishes */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.wish-card textarea { min-height: 120px; }
.wish-note { text-align: center; margin: 0; }
.wish-closed { text-align: center; }
.wish-thanks { text-align: center; }
.wish-box { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 14px; }
.wish-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.wish-item { border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.wish-item--hidden { opacity: .55; border-left-color: var(--muted); }
.wish-item__msg { white-space: pre-wrap; margin: 0; font-size: 15px; }
.wish-item__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }

/* Phase 7: birthday cards */
.card-gallery { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 900px) { .card-gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card-design { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.card-design img, .today-cards img { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); display: block; background: var(--surface-2); }
.card-design.is-selected img { outline: 3px solid var(--brand); outline-offset: 2px; }
.card-design figcaption { font-size: 14px; font-weight: 600; }
.today-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .today-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.today-cards li { display: flex; flex-direction: column; gap: 8px; }
.today-cards__meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.card-missing { aspect-ratio: 1200 / 630; border: 1px dashed var(--border); border-radius: 10px; display: grid; place-items: center; color: var(--muted); font-size: 13px; padding: 12px; text-align: center; }
.mail-card { max-width: 360px; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }

/* Phase 8: keep long commands inside the card on phones */
.steps > li, .plain-list > li, .history > li { min-width: 0; overflow-wrap: anywhere; }
pre.code { max-width: 100%; white-space: pre; }
.card { min-width: 0; }
.field--sm input[type="time"] { width: 150px; }

/* Phase 9: admin pages */
.color-field { display: flex; gap: 8px; align-items: center; }
.color-field input[type="color"] { width: 48px; height: 40px; padding: 2px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.color-field input[type="text"] { flex: 1; min-width: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.tabs a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; }
.tabs a.is-active { background: var(--info-bg); color: var(--brand); }
.log-filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.log-table td { vertical-align: top; }
.log-table details pre { white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; font-size: 12px; background: var(--surface-2); padding: 8px; border-radius: 6px; margin: 6px 0 0; }
.inline-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.secret-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 16px; padding: 10px 12px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; user-select: all; overflow-wrap: anywhere; }
.preview-frame--sm { height: 520px; }
.nowrap { white-space: nowrap; }
.field--sm input[type="date"] { width: 170px; }

/* Dark mode: brand-coloured links and disabled buttons need more contrast on the dark page */
@media (prefers-color-scheme: dark) {
    .content a:not(.btn):not(.chip):not(.nav-link), .alert a, .gates a { color: #7DD3FC; }
    .btn:disabled, .btn[disabled] { opacity: .55; color: var(--text); border-color: var(--border); }
}

/* ------------------------------------------------------------------ card template editor */
@font-face { font-family: "CM Pacifico"; src: url("../fonts/Pacifico-Regular.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "CM Nunito Black"; src: url("../fonts/Nunito-Black.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "CM Nunito ExtraBold"; src: url("../fonts/Nunito-ExtraBold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "CM Nunito SemiBold"; src: url("../fonts/Nunito-SemiBold.ttf") format("truetype"); font-display: swap; }
.f-pacifico { font-family: "CM Pacifico", cursive; line-height: 1.05; }
.f-nunito-black { font-family: "CM Nunito Black", sans-serif; line-height: 1.1; }
.f-nunito-extrabold { font-family: "CM Nunito ExtraBold", sans-serif; line-height: 1.1; }
.f-nunito-semibold { font-family: "CM Nunito SemiBold", sans-serif; line-height: 1.1; }

.tpl-edit { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .tpl-edit { grid-template-columns: minmax(0, 1fr); } }
.tpl-stage { position: relative; width: 100%; aspect-ratio: 1200 / 630; overflow: hidden; border-radius: 10px; background: #fff; border: 1px solid var(--border); user-select: none; touch-action: none; }
.tpl-stage--empty { background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, #fff), color-mix(in srgb, var(--brand-2) 25%, #fff)); }
.tpl-stage:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
.tpl-stage__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.tpl-el { position: absolute; cursor: move; box-sizing: border-box; }
.tpl-el.is-hidden { opacity: .25; }
.tpl-el--text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; outline: 1px dashed rgba(15, 23, 42, .25); }
.tpl-el--pill { width: auto !important; max-width: 100%; display: inline-block; background: var(--pill, #0F4C81); border-radius: 999px; padding: .2em .9em; outline-offset: 2px; }
.tpl-el--photo { border-radius: 50%; border-style: solid; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-family: "CM Nunito Black", sans-serif; }
.tpl-el--logo { height: auto; max-width: none; }
.tpl-el.is-selected { outline: 2px solid var(--brand-2); outline-offset: 2px; z-index: 2; }
.tpl-el-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tpl-el-list .chip { cursor: pointer; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 13px; }
.tpl-prop-title { margin: 4px 0 8px; font-size: 16px; }
.tpl-edit__side .field { margin-top: 10px; }
.tpl-edit__side input[type="range"] { width: 100%; accent-color: var(--brand); }
.tpl-edit__side input[type="color"] { width: 100%; height: 38px; padding: 2px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.grid-2--tight { gap: 8px; }
.tpl-preview-img { display: block; width: 100%; height: auto; margin-top: 12px; border-radius: 10px; border: 1px solid var(--border); }
.tpl-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tpl-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.tpl-card img { display: block; width: 100%; height: auto; }
.tpl-card.is-inactive img { opacity: .55; }
.tpl-card__meta { display: grid; gap: 6px; padding: 10px 12px; justify-items: start; }
.tpl-el-list .chip--ok { background: var(--brand); color: #fff; border-color: var(--brand); }
.tpl-preview-img[hidden] { display: none; }
