:root {
  --bg: #f4f5f7; --card: #fff; --text: #17202a; --muted: #6b7684; --line: #e3e6ea;
  --red: #e5383b; --red-d: #b3171c; --green: #1fa855; --green-d: #127a3c;
  --amber: #e89b0c; --blue: #0071b9; --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #11151a; --card: #1a2027; --text: #e8ecf0; --muted: #94a0ad; --line: #2b333c; color-scheme: dark; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; cursor: pointer; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

header.top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .logo { height: 26px; width: auto; display: block; }
header.top .brand { font-weight: 700; padding-left: 12px; border-left: 1px solid var(--line); color: var(--muted); }
.login-logo { height: 34px; width: auto; display: block; margin-bottom: 18px; }
@media (max-width: 420px) { header.top .brand { display: none; } }
header.top .spacer { flex: 1; }
.link-btn { background: none; border: 0; color: var(--muted); padding: 4px 6px; }
.link-btn:hover { color: var(--text); }

main { max-width: 640px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1200px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 17px; margin: 0 0 12px; }

/* ---- Prisijungimas */
.login { max-width: 360px; margin: 12vh auto; }
.login h1 { font-size: 22px; margin: 0 0 4px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; }
textarea { min-height: 70px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; font-weight: 600; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 6px 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.error { color: var(--red); font-size: 14px; min-height: 20px; margin-top: 8px; }

/* ---- Komandos taškai */
.dots { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin: 4px 0 2px; }
.dot { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); width: 46px; text-align: center; }
.dot i { width: 22px; height: 22px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 20%, transparent); }
.dot.on i { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.dot.me span { font-weight: 700; color: var(--text); }
.dots-caption { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* ---- Didysis burbulas */
.bubble-wrap { display: flex; justify-content: center; padding: 18px 0 8px; }
.bubble { width: min(68vw, 260px); aspect-ratio: 1; border-radius: 50%; border: 0; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ff6b6e, var(--red) 55%, var(--red-d));
  box-shadow: 0 14px 40px color-mix(in srgb, var(--red) 45%, transparent), inset 0 -8px 20px rgba(0,0,0,.2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 800; letter-spacing: 2px; transition: transform .15s, background .3s;
  -webkit-tap-highlight-color: transparent; }
.bubble:active { transform: scale(.96); }
.bubble small { font-size: 13px; font-weight: 500; letter-spacing: 0; opacity: .9; margin-top: 4px; }
.bubble.on { background: radial-gradient(circle at 35% 30%, #5fe08f, var(--green) 55%, var(--green-d));
  box-shadow: 0 14px 40px color-mix(in srgb, var(--green) 45%, transparent), inset 0 -8px 20px rgba(0,0,0,.2);
  animation: pulse 2.4s infinite; font-size: 34px; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 55%, transparent), inset 0 -8px 20px rgba(0,0,0,.2); }
  60% { box-shadow: 0 0 0 26px transparent, inset 0 -8px 20px rgba(0,0,0,.2); } }

.notice { background: color-mix(in srgb, var(--green) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--green) 45%, transparent);
  border-radius: var(--radius); padding: 12px 14px; font-weight: 600; text-align: center; margin: 8px 0 16px; }
.conn { text-align: center; color: var(--amber); font-size: 14px; margin-bottom: 8px; }

/* ---- Uždarbis */
.earn { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.earn div { background: var(--bg); border-radius: 10px; padding: 10px 6px; }
.earn b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.earn span { font-size: 12px; color: var(--muted); }
.earn-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 10px; }

/* ---- Užklausų kortelės */
.lead { border: 2px solid var(--amber); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; background: var(--card); }
.lead.fresh { animation: flash 1s infinite alternate; }
@keyframes flash { from { border-color: var(--amber); } to { border-color: var(--red); box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 25%, transparent); } }
.lead .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.lead .tag { font-size: 12px; font-weight: 700; color: var(--amber); text-transform: uppercase; letter-spacing: .5px; }
.lead .timer { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 20px; }
.lead .timer.late { color: var(--red); }
.lead h3 { margin: 0 0 8px; font-size: 18px; }
.lead dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 12px; }
.lead dt { color: var(--muted); font-size: 14px; }
.lead dd { margin: 0; word-break: break-word; white-space: pre-wrap; }
.lead .phone { font-size: 20px; font-weight: 700; }
.lead .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lead .actions .btn { flex: 1; min-width: 140px; }
.lead details { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.lead summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row > * { flex: 1; }
.row .btn { flex: 0 0 auto; }
.msg { font-size: 13px; margin-top: 6px; }
.note { background: color-mix(in srgb, var(--amber) 14%, var(--card)); border-left: 4px solid var(--amber);
  border-radius: 8px; padding: 8px 10px; margin: 6px 0 10px; font-size: 14px; font-weight: 600; }
.transfer { margin: 0 0 12px; }
.lead h3 .badge { vertical-align: middle; margin-left: 4px; }

.history { list-style: none; padding: 0; margin: 0; }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.history li:last-child { border-bottom: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.badge.late { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.badge.wait { background: color-mix(in srgb, var(--amber) 18%, transparent); color: var(--amber); }

/* ---- Administratorius */
.grid-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.member { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.member .btn { margin-left: 26px; }
.member i { width: 16px; height: 16px; border-radius: 50%; background: var(--red); flex: none; }
.member.on i { background: var(--green); }
.member b { display: block; }
.member .small { line-height: 1.3; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--card); padding: 8px 12px; color: var(--muted); }
.seg button.active { background: var(--blue); color: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 180px; }
tfoot td { font-weight: 700; }
.alert { border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; font-weight: 600;
  background: color-mix(in srgb, var(--amber) 15%, var(--card)); border: 1px solid var(--amber); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv code { background: var(--bg); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.inline-input { width: 110px; padding: 6px 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 10px; align-items: end; }
.form-grid .btn { margin-top: 12px; }
