/*
  Styles of the web client (index.html). Colours are variables, so dark mode only
  changes the variables. The full-screen card view stays white in dark mode too: a
  scanner reads black on a bright white screen best.
*/

:root {
  --bg: #f6f7f9; --fg: #16181d; --muted: #5d6470; --panel: #fff; --line: #dde1e7;
  --accent: #1f6feb; --accent-fg: #fff; --warn: #b42318;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f1115; --fg: #e8eaee; --muted: #9aa1ad; --panel: #181b21; --line: #2a2f38;
    --accent: #4c8dff; --warn: #ff8a80; }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, sans-serif; }
header, main { max-width: 560px; margin: 0 auto; padding: 0 16px; }
header { padding-top: max(24px, env(safe-area-inset-top)); }
h1 { margin: 0; font-size: 24px; }
h2 { margin: 0 0 12px; font-size: 19px; }
.sub, .muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--warn); }
[hidden] { display: none !important; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 16px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

button, .button {
  font: inherit; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--fg); cursor: pointer; text-decoration: none; display: inline-block;
}
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
button:disabled { opacity: 0.6; cursor: default; }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#pair-qr { display: block; width: min(280px, 100%); image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 8px; margin: 8px 0; }

/* The card list: one row per card, with a star button on the right. */
.cards { list-style: none; margin: 0; padding: 0; }
.cards li { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); }
.cards li:first-child { border-top: 0; }
.cards .open { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; border: 0; background: none; padding: 12px 4px; min-width: 0; }
.cards .dot { width: 24px; height: 24px; border-radius: 50%; flex: none; border: 1px solid var(--line); }
.cards .text { min-width: 0; }
.cards .name, .cards .number { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards .name { font-weight: 600; }
.cards .number { color: var(--muted); font-size: 14px; }
.cards .star { border: 0; background: none; font-size: 20px; padding: 8px; }

/* One card, full screen, always black on white. */
.card-view {
  position: fixed; inset: 0; background: #fff; color: #111; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  touch-action: pan-y; user-select: none;
}
.card-view #face { flex: 1; min-height: 0; width: 100%; }
.card-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; }
.card-bar button { background: #fff; color: #111; border-color: #ccc; }
.card-bar span { color: #555; text-align: center; }
