:root {
    color-scheme: light;
    --blue: #1e3c72;
    --blue-2: #2a5298;
    --ink: #1e3c72;
    --text: #2c3e50;
    --muted: #6c757d;
    --line: #e3e6f0;
    --paper: #f8f9fa;
    --card: #ffffff;
    --green: #2e7d32;
    --amber: #e65100;
    --red: #c62828;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}
button, a, input, select { touch-action: manipulation; }
button, input, select, textarea {
    font: inherit;
    color: inherit;
}
button, .tabs a { cursor: pointer; }
.shell {
    width: min(1100px, calc(100% - 32px));
    margin: 20px auto 32px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}
.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 24px 28px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
    color: white;
}
.eyebrow {
    margin: 0 0 4px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--muted);
}
.top .eyebrow { color: rgba(255, 255, 255, 0.85); }
.top strong { font-size: 1.6rem; }
h1, h2 { font-weight: 600; margin: 0 0 8px; color: var(--ink); }
h1 { font-size: 1.8rem; }
h2 { font-size: 1.2rem; }
.lede, .muted { color: var(--muted); }
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 18px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
.tabs a {
    text-decoration: none;
    color: var(--ink);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.92rem;
}
.tabs a.on, .tabs a:hover {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
    color: white;
}
main { padding: 8px 22px 28px; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
    margin: 14px 0;
    box-shadow: 0 5px 15px rgba(30, 60, 114, 0.08);
}
.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.login .card { width: min(420px, 100%); margin: 0; }
.login button { width: 100%; }
label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 10px 0;
    font-size: 0.92rem;
    color: var(--ink);
    font-weight: 600;
}
input, select, textarea {
    background: white;
    border: 1px solid #d1d3e2;
    border-radius: 5px;
    padding: 10px;
    color: var(--ink);
    font-weight: 400;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
}
button {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
    color: white;
    border: 0;
    border-radius: 8px;
    padding: 10px 16px;
}
button:hover { background: #2980b9; }
button.ghost, button.small {
    background: white;
    color: var(--ink);
    border: 1px solid #d1d3e2;
}
button.small { padding: 4px 10px; font-size: 0.82rem; }
.top button.ghost {
    background: white;
    color: var(--ink);
    border: 0;
    font-weight: 700;
}
.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 16px;
}
.grid .span { grid-column: 1 / -1; }
.checks, .keys {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin: 8px 0 14px;
}
.checks label, .keys label, .checkline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}
.flash {
    background: #e3f2fd;
    color: var(--ink);
    border-radius: 8px;
    padding: 10px 12px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th {
    background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
    color: white;
    text-align: left;
    padding: 12px 10px;
    font-weight: 600;
}
td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: #f8f9fa; }
code { font-family: ui-monospace, monospace; background: #f8f9fa; padding: 2px 6px; border-radius: 4px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.facts div { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.facts dt { color: var(--muted); font-size: 0.78rem; }
.facts dd { margin: 2px 0 0; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
a.quiet { color: inherit; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill {
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 20px;
    padding: 4px 10px;
    background: #e3f2fd;
    color: var(--ink);
}
.pill.ok { background: #e8f5e8; color: var(--green); }
.pill.call { background: #e3f2fd; color: #1565c0; }
.pill.warn { background: #fff3e0; color: var(--amber); }
.pill.bad { background: #ffebee; color: var(--red); }
.row-actions, .form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
}
.pager a {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #d1d3e2;
    border-radius: 8px;
    padding: 6px 12px;
    background: white;
}
.pager a:hover { background: #f8f9fa; }
.toast { margin-top: 8px; }
.dialer .dialrow {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}
.dialer .dialrow label {
    flex: 1 1 220px;
    margin: 0;
}
.dialer .dialrow button { min-width: 7rem; }
audio { width: min(100%, 420px); margin: 8px 0; }
audio#ear {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0.02;
    pointer-events: none;
}
.record {
    border-top: 1px solid var(--line);
    margin-top: 14px;
    padding-top: 12px;
}
.record h3 { margin: 0 0 4px; font-size: 1rem; }
.record p { margin: 0; }
.earbar {
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #e3f2fd;
    color: #1565c0;
    font-weight: 700;
}
.earbar:not([hidden]) {
    display: flex;
    position: sticky;
    top: 8px;
    z-index: 25;
}
.earbar button { min-height: 44px; }
.dock { display: none; }
@media (max-width: 760px) {
    body:has(.shell) {
        background: var(--paper);
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
    }
    .shell {
        width: 100%;
        margin: 0;
        min-height: 100dvh;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
    }
    .top {
        position: sticky;
        top: 0;
        z-index: 20;
        padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    }
    .top strong { font-size: 1.2rem; }
    .tabs { display: none; }
    .earbar:not([hidden]) { top: calc(68px + env(safe-area-inset-top)); }
    .dock {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 30;
        gap: 8px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
        background: white;
        border-top: 1px solid var(--line);
        scrollbar-width: none;
    }
    .dock::-webkit-scrollbar { display: none; }
    .dock a {
        flex: 0 0 auto;
        text-decoration: none;
        color: var(--ink);
        font-weight: 700;
        font-size: 0.84rem;
        border-radius: 999px;
        padding: 10px 14px;
        background: var(--paper);
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    .dock a.on {
        background: linear-gradient(135deg, var(--blue) 0%, var(--blue-2) 100%);
        color: white;
    }
    main { padding: 4px 12px 16px; }
    .card { padding: 14px; }
    .grid { grid-template-columns: 1fr; }
    .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    input, select, textarea { font-size: 16px; min-height: 44px; }
    button { min-height: 44px; }
    button.small { min-height: 40px; padding: 8px 12px; }
    .row-actions { width: 100%; }
    .row-actions button { flex: 1; }
    table { display: block; }
    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }
    tbody { display: block; }
    tr {
        display: block;
        border: 1px solid var(--line);
        border-radius: 12px;
        margin: 0 0 10px;
        padding: 8px 12px;
        background: white;
    }
    td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        border: 0;
        padding: 7px 0;
        text-align: right;
    }
    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.75rem;
        font-weight: 700;
        text-align: left;
    }
    td:not([data-label])::before { content: none; }
    td:has(.row-actions) { display: block; text-align: left; }
    code { word-break: break-all; }
}
