:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7684;
  --line: #dde2e8;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --ok: #e6f6ea;
  --ok-line: #2f9e44;
  --warn: #fff4d6;
  --warn-line: #d69e00;
  --err: #fde8e8;
  --err-line: #d64545;
  --top: #16202e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161d;
    --card: #1a212b;
    --text: #e3e8ee;
    --muted: #8f9aa7;
    --line: #2c3541;
    --accent: #4a8df8;
    --ok: #16301f;
    --warn: #3a3014;
    --err: #3b1c1c;
    --top: #0b0f14;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: .2rem 0 1rem; }
h1 small { font-size: .9rem; font-weight: normal; color: var(--muted); margin-left: .4rem; }
h2 { font-size: 1.15rem; }

.top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--top); color: #fff; padding: .6rem 1rem;
}
.top a { color: #fff; text-decoration: none; }
.top .brand { font-weight: 700; font-size: 1.1rem; }
.top nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.top nav a { opacity: .85; }
.top nav a:hover { opacity: 1; text-decoration: underline; }
.top .utc { margin-left: auto; white-space: nowrap; font-family: ui-monospace, Menlo, Consolas, monospace; opacity: .9; }

main { max-width: 1300px; margin: 0 auto; padding: 1rem; }
.bottom { text-align: center; color: var(--muted); font-size: .85rem; padding: 2rem 1rem; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 1rem 1.2rem; margin-bottom: 1rem;
}
.card.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.card.danger { border-color: var(--err-line); }
.muted { color: var(--muted); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .7rem; }
label > input, label > select { display: block; margin-top: .2rem; }
label > .inline { display: flex; margin-top: .2rem; }
.inline input { flex: 1; min-width: 0; }
label.check { display: flex; align-items: center; gap: .4rem; color: var(--text); }
input, select {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: .45rem .55rem; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input:disabled { opacity: .5; }
input[type=checkbox] { width: auto; }
input.upper { text-transform: uppercase; }
input.big { font-size: 1.35rem; font-weight: 700; letter-spacing: .03em; }
.inline { display: flex; gap: .4rem; align-items: stretch; }
.inline label { flex: 1; margin-bottom: 0; }

.btn {
  display: inline-block; font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap;
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: .45rem .8rem;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.danger { background: var(--err-line); color: #fff; border-color: var(--err-line); }
.btn.big { font-size: 1.05rem; padding: .6rem 1.2rem; }
.btn.right { margin-left: auto; }

.flash { padding: .6rem .8rem; border-radius: 6px; margin-bottom: .8rem; border-left: 4px solid; }
.flash.ok { background: var(--ok); border-color: var(--ok-line); }
.flash.warn { background: var(--warn); border-color: var(--warn-line); }
.flash.err { background: var(--err); border-color: var(--err-line); }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.call { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.card.logbook { display: block; text-decoration: none; color: var(--text); }
.card.logbook:hover { border-color: var(--accent); }
.card.logbook .call { font-size: 1.5rem; color: var(--accent); }
.card.logbook .title { font-weight: 600; }

/* QSO įvedimo forma */
.qso-form {
  display: grid; gap: 0 .8rem;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.qso-form .f-time { grid-column: 1 / -1; display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; }
.qso-form .f-time label.check { margin-bottom: .9rem; }
.qso-form .time-fields { gap: .8rem; }
#qso-entry:has(#use-now:checked) .time-fields { opacity: .55; }
.qso-form .f-freq { grid-column: span 1; }
.qso-form .f-band { grid-column: span 5; }
.qso-form .f-mode { grid-column: 1 / -1; }
.qso-form .f-call { grid-column: span 2; }
.qso-form .f-notes { grid-column: span 5; }
.qso-form.contest .f-notes { grid-column: span 3; }
.call-info { display: block; min-height: 1.2em; margin-top: .25rem; font-size: .85rem; }
.call-info.new { color: var(--ok-line); }
.call-info.worked { color: var(--accent); }
.call-info.dupe { color: var(--err-line); font-weight: 700; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
kbd { font: .72rem ui-monospace, Menlo, Consolas, monospace; padding: .05rem .35rem; border-radius: 4px;
      border: 1px solid currentColor; opacity: .6; margin-left: .3rem; vertical-align: middle; }

/* Juostų ir modų mygtukai */
fieldset.pills { border: 0; padding: 0; margin: 0 0 .7rem; min-width: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
fieldset.pills legend { font-size: .85rem; color: var(--muted); padding: 0; margin-bottom: .25rem; float: left; width: 100%; }
.pill { margin: 0; display: inline-flex; color: var(--text); }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pill span {
  display: inline-block; min-width: 3rem; text-align: center; cursor: pointer; user-select: none;
  padding: .38rem .6rem; border: 1px solid var(--line); border-radius: 6px; background: var(--card);
  font: 600 .88rem ui-monospace, Menlo, Consolas, monospace; transition: background .12s, border-color .12s;
}
.pill span:hover { border-color: var(--accent); }
.pill input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 900px) {
  .qso-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qso-form .f-call, .qso-form .f-freq, .qso-form .f-band, .qso-form .f-notes, .qso-form.contest .f-notes { grid-column: 1 / -1; }
  .pill span { min-width: 2.6rem; padding: .45rem .5rem; }
}

/* Ankstesni ryšiai su stotimi */
.worked-before { border-color: var(--accent); }
.worked-before h2 { margin: 0 0 .6rem; font-size: 1.05rem; }
.worked-before .table-wrap { border: 0; border-radius: 0; }
.worked-before tr.same td { background: color-mix(in srgb, var(--err-line) 10%, transparent); }

/* Filtrai ir lentelė */
.filters { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .6rem; }
.filters input, .filters select { width: auto; }
.filters input[type=text] { width: 160px; }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table.qsos { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.qsos th, table.qsos td { padding: .4rem .55rem; border-bottom: 1px solid var(--line); text-align: left; }
table.qsos th { font-size: .78rem; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: nowrap; }
table.qsos tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
table.qsos td a { text-decoration: none; }
table.qsos td.notes { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1rem; }
code { background: var(--bg); padding: .1rem .3rem; border-radius: 4px; }

/* Admin */
.subnav { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.subnav a { padding: .35rem .8rem; border-radius: 6px; text-decoration: none; color: var(--text); border: 1px solid var(--line); background: var(--card); }
.subnav a.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.subnav .muted { margin-left: auto; font-size: .85rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem; }
.tile-value { font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile-label { color: var(--muted); font-size: .85rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 1rem; }
.cols .card { min-width: 0; }
.bars { display: grid; gap: .35rem; }
.bar-row { display: grid; grid-template-columns: minmax(0, 9rem) 1fr 3.5rem; gap: .6rem; align-items: center; font-size: .88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; }
.bar-fill { display: block; height: 100%; min-width: 2px; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-row:hover .bar-fill { opacity: .8; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; height: 180px; align-items: end; }
.month { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.month-bar { width: 70%; max-width: 40px; min-height: 1px; background: var(--accent); border-radius: 4px 4px 0 0; }
.month:hover .month-bar { opacity: .8; }
.month-value { font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.month-label { font-size: .72rem; color: var(--muted); margin-top: 4px; border-top: 1px solid var(--line); width: 100%; text-align: center; padding-top: 2px; }
.badge { display: inline-block; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.badge.ok { border-color: var(--ok-line); color: var(--ok-line); }
.badge.warn { border-color: var(--warn-line); color: var(--warn-line); }
.badge.err { border-color: var(--err-line); color: var(--err-line); }
.qr { width: 220px; max-width: 100%; background: #fff; padding: 4px; border-radius: 8px; margin: .5rem 0 1rem; }
.qr svg { display: block; width: 100%; height: auto; }
code.secret { font-size: 1.05rem; letter-spacing: .05em; user-select: all; }
.top .lang-switch { display: flex; gap: .4rem; font-size: .85rem; }
.top .lang-switch a { opacity: .7; }
.top .lang-switch a:hover { opacity: 1; }
.top .lang-switch b { border-bottom: 2px solid #fff; }
.top .lang-switch + .utc { margin-left: 0; }
.top .lang-switch { margin-left: auto; }
.small-link { margin-left: .8rem; font-size: .88rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* Žurnalo sąrašas */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.list-head .filters { margin: 0; }
.counts { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.counts b { color: var(--text); font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
table.qsos th a { color: inherit; text-decoration: none; }
table.qsos th a:hover { color: var(--accent); }
table.qsos th.sorted { color: var(--text); }
table.qsos tr.day td {
  background: var(--bg); color: var(--muted); font-size: .78rem; font-weight: 600;
  padding: .3rem .55rem; letter-spacing: .02em;
}
table.qsos tbody tr.day:hover { background: none; }
table.qsos tr.hl td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
table.qsos tr.fresh td { animation: fresh 2.5s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--ok-line) 30%, transparent); } to { background: transparent; } }
table.qsos.compact { font-size: .85rem; }
.tag { display: inline-block; font: 600 .75rem ui-monospace, Menlo, Consolas, monospace; padding: .05rem .4rem;
       border-radius: 4px; background: var(--bg); border: 1px solid var(--line); }
.icon-btn { text-decoration: none; opacity: .6; }
.icon-btn:hover { opacity: 1; }
.filters input[type=search] { width: 180px; }
input.upper::placeholder { text-transform: none; }

/* Limitai */
.usage { display: grid; gap: .5rem; }
.usage-plan { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.meter { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: .7rem; align-items: center; font-size: .9rem; }
.meter-label { color: var(--muted); }
.meter-bar { height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.meter-bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.meter.high .meter-bar span { background: var(--warn-line); }
.meter.full .meter-bar span { background: var(--err-line); }
.meter-text { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-meter { display: inline-block; width: 44px; height: 5px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; vertical-align: middle; margin-left: .3rem; }
.mini-meter span { display: block; height: 100%; background: var(--accent); }
.mini-meter.high span { background: var(--warn-line); }
.mini-meter.full span { background: var(--err-line); }
.small { font-size: .82rem; }
.plan-form .pill span { min-width: 8rem; font-family: inherit; }
.plan-form .pill small { display: block; font-weight: normal; opacity: .8; font-size: .72rem; }
.plan-fields { flex-wrap: wrap; gap: .8rem; }
.plan-fields label { min-width: 150px; }

/* DXCC, HamQTH, statistika */
.flag { display: inline-block; min-width: 1.4em; margin-right: .25rem; }
.dxcc-info { display: block; min-height: 1.2em; margin-top: .25rem; font-size: .85rem; color: var(--text); }
.hamqth-info { display: block; font-size: .8rem; color: var(--muted); }
.dxcc-info .badge { vertical-align: baseline; }
table.matrix th, table.matrix td { text-align: center; }
table.matrix th:first-child { text-align: left; }
table.matrix tfoot td, table.matrix tfoot th { border-top: 2px solid var(--line); }
.num { text-align: right; }

/* Darbas be interneto */
.offline-bar { display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.offline-bar[hidden] { display: none; }
table.qsos tr.pending td { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--warn-line) 10%, transparent) 8px 16px); color: var(--muted); }
table.matrix tbody th, table.matrix tfoot th { text-transform: none; font-size: .9rem; color: var(--text); }

/* Pasisveikinimo langas */
.welcome-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.welcome { max-width: 480px; width: 100%; text-align: center; padding: 2rem 1.2rem; }
.welcome-logo { border-radius: 20px; }
.welcome h1 { font-size: 1.7rem; margin: 1rem 0 .4rem; }
.welcome .lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 1.2rem; }
.welcome-points { list-style: none; padding: 0; margin: 0 auto 1.8rem; display: inline-block; text-align: left; line-height: 1.9; }
.welcome .choose { font-weight: 600; margin-bottom: .7rem; }
.lang-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.lang-btn {
  display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: 1.3rem 1rem;
  border: 2px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.lang-btn b { font-size: 2rem; letter-spacing: .05em; color: var(--accent); }
.lang-btn:hover, .lang-btn:focus-visible { border-color: var(--accent); transform: translateY(-2px); }

/* Nustatymai, prisijungimas, parama */
.settings { max-width: 760px; margin: 0 auto; }
.settings h2 { margin-top: 0; font-size: 1.1rem; }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 180px; }
.narrow-form { max-width: 380px; }
.signup-cta { display: flex; gap: .8rem; align-items: center; justify-content: space-between; flex-wrap: wrap;
              margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.donate { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 1.5rem;
          border-style: dashed; color: var(--muted); }
.bottom a { color: inherit; }
/* Automatiškai užpildyti laukai (HamQTH / ankstesnis QSO) */
input.autofilled { background: color-mix(in srgb, var(--accent) 7%, var(--card)); border-style: dashed; }
/* Dažnis ⇄ juosta */
.freq-hint { display: block; min-height: 1.1em; margin-top: .2rem; font-size: .78rem; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.freq-hint.warn { color: var(--err-line); font-family: inherit; }
input.out-of-band { border-color: var(--err-line); }
input.flash-change { animation: flashchange .6s ease-out; }
@keyframes flashchange { from { background: color-mix(in srgb, var(--accent) 25%, var(--card)); } to { background: var(--card); } }
