:root {
  --bg: #f4f6f8; --card: #ffffff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --brand: #0f766e; --brand-2: #115e59;
  --red: #dc2626; --red-bg: #fef2f2; --orange: #d97706; --orange-bg: #fffbeb;
  --green: #16a34a; --green-bg: #f0fdf4; --grey-bg: #f3f4f6;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 1px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --card: #111827; --text: #e5e7eb; --muted: #9ca3af; --line: #1f2937;
    --red-bg: #2a1215; --orange-bg: #2a1f0d; --green-bg: #0d2318; --grey-bg: #1f2937;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: "Noto Sans Georgian", system-ui, sans-serif; font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 48px 16px; }
.small { font-size: 12.5px; }

header.top {
  position: sticky; top: 0; z-index: 5; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
}
header.top .title { font-weight: 700; font-size: 16px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top button { background: rgba(255,255,255,.15); border: 0; color: #fff; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
main { max-width: 1180px; margin: 0 auto; padding: 14px 16px 80px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: var(--card); padding: 7px 12px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.chip { border-radius: 12px; padding: 10px 14px; background: var(--card); box-shadow: var(--shadow); min-width: 96px; cursor: pointer; border: 2px solid transparent; }
.chip b { display: block; font-size: 22px; line-height: 1.1; }
.chip.red b { color: var(--red); } .chip.orange b { color: var(--orange); } .chip.green b { color: var(--green); }
.chip.on { border-color: var(--brand); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.toolbar input[type=search], .toolbar select, .field input, .field select, .field textarea {
  border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 8px 10px; min-width: 0;
}
.toolbar input[type=search] { flex: 1 1 200px; }
.btn { border: 0; background: var(--brand); color: #fff; padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--brand-2); }
.btn.ghost { background: var(--grey-bg); color: var(--text); font-weight: 500; }
.btn.danger { background: var(--red); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; }
.btn:disabled { opacity: .55; cursor: default; }

.cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.card { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; border-left: 6px solid var(--line); }
.card.red { border-left-color: var(--red); background: linear-gradient(90deg, var(--red-bg), var(--card) 60%); }
.card.orange { border-left-color: var(--orange); }
.card.green { border-left-color: var(--green); }
.card .row1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .tid { font-weight: 700; font-size: 17px; }
.card .addr { margin: 2px 0 8px; }
.cd { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cd.red { color: var(--red); } .cd.orange { color: var(--orange); } .cd.green { color: var(--green); }
.card .acts { display: flex; gap: 8px; margin-top: 8px; }
.card .acts .btn { flex: 0 0 auto; white-space: nowrap; }
.card .acts .btn:first-child { flex: 1 1 auto; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--grey-bg); color: var(--muted); margin-right: 4px; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { padding: 7px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; background: var(--card); font-weight: 600; white-space: nowrap; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--grey-bg); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.dot.red { background: var(--red); } .dot.orange { background: var(--orange); } .dot.green { background: var(--green); } .dot.grey { background: #9ca3af; }

.bar { height: 8px; border-radius: 999px; background: var(--grey-bg); overflow: hidden; display: flex; min-width: 90px; }
.bar i { display: block; height: 100%; }

.login { max-width: 360px; margin: 9vh auto 0; padding: 0 16px; text-align: center; }
.login h1 { font-size: 22px; margin: 8px 0 4px; }
.pin-display { font-size: 30px; letter-spacing: 12px; height: 48px; margin: 18px 0 10px; font-variant-numeric: tabular-nums; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pad button { padding: 16px 0; font-size: 22px; border: 0; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); cursor: pointer; }
.pad button:active { background: var(--grey-bg); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.modal-box { background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 16px; }
@media (min-width: 700px) { .modal { align-items: center; } .modal-box { border-radius: 18px; } }
.modal-box h3 { margin: 0 0 6px; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; }
.photos { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; cursor: zoom-in; background: var(--grey-bg); }
.photos.big img { width: 100%; height: auto; max-height: 60vh; object-fit: contain; }
.hist { border-top: 1px solid var(--line); padding: 10px 0; }
.hist.rejected { opacity: .6; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 30; max-width: 90vw; }
.pinbox { font-size: 28px; letter-spacing: 6px; font-weight: 700; background: var(--green-bg); color: var(--green); padding: 10px; border-radius: 10px; text-align: center; margin: 8px 0; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin: 6px 0 10px; }
