:root {
    --bg: #0f1216; --panel: #1a1f26; --text: #f1f5f9; --muted: #b6c0cc; --line: #3a4350; --accent: #38bdf8; --accent-text: #04202e; --danger: #ef4444;
    --cols: 2; --row: 120px;
}
:root[data-theme="light"] { --bg: #f1f5f9; --panel: #ffffff; --text: #0f172a; --muted: #475569; --line: #cbd5e1; --accent: #0369a1; --accent-text: #ffffff; --danger: #b91c1c; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.6rem; margin: 0 0 .6rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
main { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; max-width: 1200px; margin: 0 auto; }
.brand { font-weight: 700; font-size: 1.3rem; color: var(--text); text-decoration: none; margin-right: auto; }
.brand em { color: var(--accent); font-style: normal; }
.status { color: var(--muted); font-size: .9rem; }
button, select, input, textarea { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-height: 48px; }
input, select, textarea { width: 100%; }
input[type="checkbox"] { width: 24px; min-height: 24px; height: 24px; flex: none; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
button.quiet { background: none; border-color: transparent; color: var(--muted); }
button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
label { display: block; font-size: .95rem; color: var(--muted); }
label input, label select, label textarea { margin-top: 4px; color: var(--text); }
.check { display: flex; gap: 12px; align-items: flex-start; color: var(--text); }
.check input { margin: 2px 0 0; }
.card, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin: 16px auto; }
.card { max-width: 520px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 12px; align-items: flex-end; }
.row > label { flex: 1; }
.wrap { flex-wrap: wrap; }
.error { color: var(--danger); font-weight: 600; margin: 0; }
.notice { color: var(--accent); }
.small { font-size: .9rem; color: var(--muted); }
.pwfield { display: flex; gap: 6px; }
.key, .codes { font: 1.25rem/1.6 ui-monospace, Menlo, Consolas, monospace; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 14px; overflow-wrap: anywhere; white-space: pre-wrap; user-select: all; }
.devices { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.devices li { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.doc { max-width: 760px; }
.doc section { margin-bottom: 40px; }

.bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.tabs, .bar-right { display: flex; gap: 8px; }
.empty { color: var(--muted); }

/* The grid: 2 columns on a phone, 4 in the car's window (about 770 px), 6 when it is full screen. Order is the list order. */
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: var(--row); grid-auto-flow: dense; gap: 12px; }
@media (min-width: 700px) { :root { --cols: 4; --row: 130px; } }
@media (min-width: 1100px) { :root { --cols: 6; --row: 140px; } }
.tile { position: relative; border-radius: 16px; padding: 14px; color: #fff; text-decoration: none; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; }
.s2x1, .s2x2 { grid-column: span 2; }
.s2x2 { grid-row: span 2; }
a.tile:active { filter: brightness(1.2); }
.tname { font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.thost { font-size: .85rem; opacity: .9; overflow-wrap: anywhere; }
.tilebody { min-height: 0; }
.tilebody.note { overflow: auto; height: 100%; justify-content: flex-start; }
.tilebody.note p { margin: .3rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.clock { text-align: left; }
.clock .time { font-size: 2.6rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.s2x2 .clock .time { font-size: 4.6rem; }
.clock .date { font-size: 1rem; opacity: .92; text-transform: capitalize; }
.c-slate { background: #475569; } .c-red { background: #b91c1c; } .c-orange { background: #b45309; } .c-green { background: #15803d; } .c-teal { background: #0f766e; }
.c-blue { background: #1d4ed8; } .c-violet { background: #6d28d9; } .c-pink { background: #be185d; } .c-gray { background: #374151; }
.tile.editing { outline: 2px dashed rgba(255, 255, 255, .6); outline-offset: -4px; cursor: grab; justify-content: space-between; }
.tile.editing .tilebody { position: absolute; top: 14px; left: 14px; right: 14px; z-index: 0; }
.tile.editing .thost { display: none; }
.tile.editing .tname { font-size: 1rem; }
.ctls { display: flex; flex-wrap: wrap; gap: 4px; position: relative; z-index: 1; margin-top: auto; }
.ctl { min-height: 36px; min-width: 36px; padding: 4px 8px; background: rgba(0, 0, 0, .45); color: #fff; border-color: rgba(255, 255, 255, .35); }
@media print { .top, .bar, button { display: none; } body { background: #fff; color: #000; } .key, .codes { border-color: #000; background: #fff; } }
