/* DXQSL UI — 2026-10-16
   "Radio shack" theme: dark console by default, paper log-book in light mode.
   Accent = dial-lamp amber, confirm = teal. Callsigns always set in mono. */
:root {
  --bg: #0e1315;
  --bg-2: #121a1d;
  --surface: #172124;
  --surface-2: #1d292d;
  --line: #27363b;
  --text: #e7ecea;
  --muted: #93a39f;
  --accent: #f2b33d;
  --accent-ink: #1b1405;
  --ok: #3cc4a6;
  --warn: #f0a33b;
  --danger: #ef6a5b;
  --focus: #ffd47a;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 30px -18px rgba(0,0,0,.7);
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f1ea; --bg-2: #ece7dc; --surface: #fffdf8; --surface-2: #f6f2e9; --line: #ddd5c4;
    --text: #1d2321; --muted: #5f6b67; --accent: #b8780f; --accent-ink: #fff;
    --ok: #138a70; --warn: #b9690a; --danger: #c8412f; --focus: #b8780f;
    --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 26px -20px rgba(60,40,0,.45);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f1ea; --bg-2: #ece7dc; --surface: #fffdf8; --surface-2: #f6f2e9; --line: #ddd5c4;
  --text: #1d2321; --muted: #5f6b67; --accent: #b8780f; --accent-ink: #fff;
  --ok: #138a70; --warn: #b9690a; --danger: #c8412f; --focus: #b8780f;
  --shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 10px 26px -20px rgba(60,40,0,.45);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--sans);
  background-image: radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
}
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.mono, .cs { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar with "dial scale" ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: ""; display: block; height: 6px;
  background:
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent) 0 1px, transparent 1px 10px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--accent) 90%, transparent) 0 2px, transparent 2px 50px);
  background-size: auto 3px, auto 6px; background-repeat: repeat-x; background-position: bottom; opacity: .55;
}
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.brand img { height: 34px; width: auto; }
.brand .tag { font: 600 .7rem var(--mono); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent); padding: 1px 6px; border-radius: 99px; }
.nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .9rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.theme-btn { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; padding: 5px 10px; cursor: pointer; font: 600 .82rem var(--sans); }
.theme-btn:hover { color: var(--text); }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px 48px; }
.wrap.narrow { max-width: 820px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .grid.two { grid-template-columns: 1fr; } .nav { display: none; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card.flat { box-shadow: none; background: var(--surface-2); }
.section-title { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 12px; }
.kicker { font: 600 .72rem var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }

/* ---------- hero search ---------- */
.hero { padding: 26px 0 8px; }
.hero h1 span { color: var(--accent); }
.hero p { color: var(--muted); max-width: 60ch; }
.searchbar { display: flex; gap: 10px; margin-top: 16px; }
.searchbar input {
  flex: 1; min-width: 0; font: 600 1.35rem var(--mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
}
.searchbar input::placeholder { letter-spacing: .04em; color: var(--muted); font-weight: 500; }
.searchbar input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
@media (max-width: 520px) { .searchbar { flex-direction: column; } }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 26px 0 18px; }
.tabs button {
  background: none; border: 0; color: var(--muted); font: 600 .92rem var(--sans); padding: 10px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabpanel[hidden] { display: none; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span, .field-label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; }
label.field small, .hint { display: block; color: var(--muted); font-size: .8rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); font: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { min-height: 84px; resize: vertical; }
input.cs-input { font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; }
input.cs-input::placeholder, .searchbar input::placeholder { text-transform: none; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; }
.check input { margin-top: 4px; width: auto; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 6px; margin: 0 0 16px; }
legend { padding: 0 6px; font-weight: 700; font-size: .9rem; }
details > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

.slider { display: grid; grid-template-columns: 1fr 86px; gap: 10px; align-items: center; }
.slider input[type=range] { width: 100%; accent-color: var(--accent); }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 48px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); padding: 3px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: 600 .92rem var(--sans);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .06s, background .15s, border-color .15s;
}
.btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }
.btn-lg { padding: 14px 22px; font-size: 1rem; border-radius: 12px; }
.btn-ok { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); color: var(--ok); }
.btn-warn { border-color: color-mix(in srgb, var(--warn) 60%, var(--line)); color: var(--warn); }
.btn-danger { border-color: color-mix(in srgb, var(--danger) 60%, var(--line)); color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: .82rem; border-radius: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* ---------- alerts / toast ---------- */
.alert { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--surface-2); padding: 12px 14px; border-radius: 10px; margin: 0 0 16px; }
.alert:empty { display: none; }
.alert.err { border-left-color: var(--danger); }
.alert.ok { border-left-color: var(--ok); }
.alert h2, .alert h3 { font-size: 1.05rem; margin: 0; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 99;
  transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- QSO result cards ---------- */
.profile { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; }
.profile img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
.profile .cs { font-size: 1.6rem; font-weight: 700; letter-spacing: .06em; }
.qso-list { display: grid; gap: 12px; }
.qso {
  display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.qso:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.qso .when { font-family: var(--mono); font-size: .82rem; color: var(--muted); line-height: 1.35; }
.qso .when b { display: block; color: var(--text); font-size: .95rem; }
.qso .ev { font-weight: 700; }
.qso .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.qso .soap { color: var(--muted); font-size: .85rem; margin-top: 6px; white-space: pre-line; }
@media (max-width: 640px) { .qso { grid-template-columns: 1fr; } .qso .btns { display: flex; gap: 8px; } }
.badge { font: 600 .74rem var(--mono); padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.badge.band { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--accent); }
.badge.mode { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); color: var(--ok); }
.chip-cs { font: 700 .82rem var(--mono); letter-spacing: .05em; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }
.empty b { color: var(--text); }

/* skeleton */
.skel { height: 74px; border-radius: 12px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border: 1px solid var(--line); }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- stats sidebar ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stat .n { font: 700 1.35rem var(--mono); }
.stat .l { color: var(--muted); font-size: .78rem; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: .88rem; }
.feed li:last-child { border-bottom: 0; }
.feed a { font: 700 .88rem var(--mono); text-decoration: none; }
.feed .t { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; margin-right: 6px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);} 70% { box-shadow: 0 0 0 8px transparent;} 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- tables (server-rendered lists) ---------- */
.table-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.table-tools input { max-width: 320px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
table.data td a[href*="qrz.com"] { font-family: var(--mono); font-weight: 700; text-decoration: none; }
.card img[width="100%"] { width: 120px; height: auto; border-radius: 12px; display: block; margin-top: 10px; }
table.data td pre { margin: 0; white-space: pre-wrap; font: inherit; }
.pager { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.pager a { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }

/* ---------- modal ---------- */
dialog.viewer { border: 0; padding: 0; background: transparent; max-width: min(1100px, 96vw); width: 100%; }
dialog.viewer::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(3px); }
.viewer-in { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.viewer-body { background: #000; display: grid; place-items: center; min-height: 240px; }
.viewer-body img { display: block; width: 100%; height: auto; }
.viewer-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; justify-content: flex-end; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- steps (create flow) ---------- */
.steps { display: flex; gap: 6px; margin: 4px 0 22px; counter-reset: s; flex-wrap: wrap; }
.steps li { list-style: none; flex: 1; min-width: 150px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); font-size: .85rem; counter-increment: s; }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); margin-right: 8px; font: 700 .75rem var(--mono); }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--ok); color: #fff; content: "✓"; }
.steps li.now { color: var(--text); border-color: var(--accent); }
.steps li.now::before { background: var(--accent); color: var(--accent-ink); }

/* ---------- card designer ---------- */
.designer { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .designer { grid-template-columns: 1fr; } }
.preview-box { position: sticky; top: 84px; }
.canvas-wrap { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 50% / 20px 20px; }
.canvas-wrap canvas { display: block; width: 100%; height: auto; cursor: crosshair; }
.canvas-tip { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.dropzone { border: 2px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); transition: .15s; }
.dropzone.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); color: var(--text); }
.dropzone input[type=file] { margin-top: 8px; }
.file-check { margin-top: 8px; font-size: .85rem; }
.file-check.err { color: var(--danger); }
.file-check.ok { color: var(--ok); }
.server-preview { margin-top: 14px; }
.server-preview img { border-radius: 10px; border: 1px solid var(--line); width: 100%; }

/* ---------- keys / copy ---------- */
.keys { display: grid; gap: 10px; }
.key { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.key .k { font-size: .8rem; color: var(--muted); }
.key code { font: 600 .88rem var(--mono); overflow-wrap: anywhere; }
@media (max-width: 560px) { .key { grid-template-columns: 1fr auto; } .key .k { grid-column: 1 / -1; } }
.progress { height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--ok)); transition: width .4s; }
.manage-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.manage-actions .agree { flex-basis: 100%; display: flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--muted); margin-top: 6px; }
.manage-actions .agree input { width: auto; }
.listout > div { height: auto !important; max-height: 260px; overflow: auto !important; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); margin-top: 30px; }
.foot-in { max-width: 1120px; margin: 0 auto; padding: 18px 16px 30px; display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: .85rem; }
.foot-in a { color: var(--muted); }
.foot-in .sp { margin-left: auto; }

/* select2 (QOTA page) blends in */
.select2-container { width: 100% !important; }
.select2-container .select2-selection--single { height: 42px !important; border-radius: 10px !important; border-color: var(--line) !important; background: var(--bg-2) !important; }
.select2-container .select2-selection__rendered { line-height: 40px !important; color: var(--text) !important; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .topbar, .foot, .tabs, .btn { display: none !important; } body { background: #fff; color: #000; } }
