:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #162a37;
    background: #eef3f4;
    --ink: #142a38;
    --muted: #526873;
    --line: #d7e1e5;
    --teal: #006a63;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.shell { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }
.topbar { background: var(--ink); color: #f2f9fb; }
.topbar-content { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar nav { display: flex; gap: 5px; padding-bottom: 5px; }
.topbar nav button { background: transparent; }
.topbar nav button[aria-current="page"], .topbar nav button:hover { background: #284657; }
.brand { display: flex; align-items: center; gap: 10px; height: 64px; font-size: 17px; font-weight: 700; }
.brand span:last-child { color: #9bdacf; font-weight: 500; margin-left: -5px; }
.brand-mark { width: 16px; height: 16px; border: 2px solid #80d5c6; border-radius: 4px; transform: rotate(45deg); margin-right: 5px; }
main { padding: 49px 0 64px; }
.intro { margin-bottom: 30px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(34px, 5vw, 55px); letter-spacing: -.045em; line-height: 1.05; }
h2 { font-size: 22px; letter-spacing: -.025em; line-height: 1.2; }
p { color: var(--muted); line-height: 1.55; }
.intro p { margin-top: 12px; font-size: 17px; }
.forms { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 24px; background: #fff; }
.forms .card { display: flex; flex-direction: column; align-items: flex-start; }
.forms p { margin: 8px 0 18px; min-height: 48px; font-size: 14px; }
label { display: block; margin-bottom: 7px; font-weight: 650; font-size: 14px; }
textarea, input { font: inherit; }
textarea, input[type=email] { width: 100%; padding: 10px 12px; border: 1px solid #aabcc4; border-radius: 8px; color: var(--ink); }
textarea { min-height: 81px; resize: vertical; }
.file-area { flex: 1; width: 100%; border: 1px dashed #aabcc4; border-radius: 9px; padding: 13px; background: #f6f9fa; }
.file-picker { position: relative; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.file-picker input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.file-picker:focus-within { outline: 3px solid #00877c; outline-offset: 3px; border-radius: 6px; }
.file-button { flex: none; background: #fff; color: var(--ink); border: 1px solid var(--line); padding: 7px 10px; border-radius: 6px; }
#file-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
button { border: 1px solid transparent; border-radius: 8px; padding: 10px 15px; min-height: 42px; background: var(--teal); color: white; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.forms button { margin-top: 16px; }
button:hover { filter: brightness(.92); }
button:disabled { opacity: .55; cursor: wait; }
button.secondary { color: var(--teal); border-color: #9dc4be; background: #eef8f6; }
:focus-visible { outline: 3px solid #00877c; outline-offset: 3px; }
.results, .notice { margin-top: 18px; }
.lookup-progress { margin-top: 18px; }
.lookup-progress progress { display: block; width: 100%; height: 14px; accent-color: var(--teal); }
.lookup-progress p { margin-top: 6px; font-size: 14px; }
.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.result-head p { margin-top: 5px; font-size: 14px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.result-controls .copy-status:empty { margin: 0; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 9px; max-height: 460px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; text-align: left; font-size: 13px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { position: sticky; top: 0; background: #eff5f6; }
tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: #f8fafb; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.key { font-family: ui-monospace, Consolas, monospace; }
.device-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 390px), 1fr)); gap: 12px; }
.device-result { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.device-result header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 8px; }
.device-result h3 { margin: 0; overflow-wrap: anywhere; font-size: 16px; }
.device-result dl { margin: 0; }
.device-result dl > div { border-top: 1px solid var(--line); padding: 8px 0; }
.device-result dt { color: var(--muted); font-size: 13px; font-weight: 650; }
.device-result dd { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 0 0; }
.device-result code { overflow-wrap: anywhere; user-select: all; }
.copy-button { flex: none; min-height: 34px; padding: 5px 9px; font-size: 13px; }
.copy-status { color: var(--teal); font-size: 13px; }
.copy-status:not(:empty) { margin-top: 6px; }
.success { color: var(--teal); }
.failed { color: #9f3529; }
.email { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 18px; }
.email div { width: min(320px, 100%); }
.notice { border-radius: 8px; padding: 10px 12px; background: #e4f2ef; color: #215850; }
.notice.error { background: #fbece9; color: #853026; }
.auth-view, .credentials { max-width: 450px; }
.credentials h2, .credentials h3 { margin: 0 0 16px; }
.credentials label { margin-top: 12px; }
.credentials input, .credentials select { width: 100%; padding: 10px 12px; border: 1px solid #aabcc4; border-radius: 8px; color: var(--ink); background: white; font: inherit; }
.credentials button { margin-top: 16px; }
.admin-view { margin-top: 28px; }
.admin-view > h2 { margin-bottom: 14px; }
.admin-view .credentials { max-width: none; }
.admin-view .notice { margin: 12px 0 0; min-height: 0; }
#session-note { margin-top: 0; }

@media (max-width: 670px) {
    .shell { width: calc(100% - 28px); }
    main { padding-top: 30px; }
    .forms { grid-template-columns: 1fr; }
    .forms p { min-height: auto; }
    .card { padding: 17px; }
}
