/* SAQME web — utilitarian twin of the iOS design system (DSColor/DSType).
   Brand follows the app's TBC-flavoured palette; Georgian system faces. */

:root {
  --brand: #00a3e0;
  --brand-deep: #002b45;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-alt: #eef1f4;
  --text: #14202b;
  --text-2: #5b6b7a;
  --separator: #dde3e9;
  --income: #1d9a6c;
  --expense: #d64545;
  --warning: #b98900;
  --danger: #c0392b;
  --radius: 12px;
  --radius-sm: 8px;
  font-size: 15px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans Georgian", "BPG Nino Mtavruli", Sylfaen, "Segoe UI", system-ui, sans-serif;
  line-height: 1.45;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand-deep); color: #fff;
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 52px;
}
.brand { font-weight: 700; letter-spacing: 0.08em; }
.webtag { font-size: 0.7em; opacity: 0.6; letter-spacing: 0; font-weight: 500; }
#tabs { display: flex; gap: 4px; overflow-x: auto; }
#tabs a {
  color: #cfe3ef; text-decoration: none; padding: 6px 12px;
  border-radius: 8px; font-size: 0.92em; white-space: nowrap;
}
#tabs a.active { background: var(--brand); color: #fff; font-weight: 600; }
#tabs a:hover:not(.active) { background: rgba(255, 255, 255, 0.1); }

main { max-width: 900px; margin: 0 auto; padding: 20px 16px 80px; }

h1 { font-size: 1.3em; margin: 0 0 14px; }
h2 { font-size: 1.05em; margin: 20px 0 8px; }

.card {
  background: var(--surface); border: 1px solid var(--separator);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px;
}
.card h3 { margin: 0 0 8px; font-size: 0.95em; color: var(--text-2); font-weight: 600; }

.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; }
.row .label { color: var(--text-2); font-size: 0.9em; }
.row .value { font-weight: 600; font-variant-numeric: tabular-nums; }

.big { font-size: 1.7em; font-weight: 700; font-variant-numeric: tabular-nums; }
.income { color: var(--income); }
.expense { color: var(--expense); }
.muted { color: var(--text-2); font-size: 0.85em; }
.micro { color: var(--text-2); font-size: 0.78em; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 0.75em; font-weight: 600; white-space: nowrap;
}
.pill.green { background: #e2f4ec; color: var(--income); }
.pill.amber { background: #f8efd4; color: var(--warning); }
.pill.red { background: #f9e3e3; color: var(--expense); }
.pill.blue { background: #e0f2fb; color: #0277a8; }
.pill.gray { background: var(--surface-alt); color: var(--text-2); }

.banner {
  border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 0;
  font-size: 0.85em; border: 1px solid;
}
.banner.info { background: #e8f4fb; border-color: #bfe2f3; color: #085e85; }
.banner.warning { background: #fdf6e0; border-color: #eeda9e; color: #7a5b00; }
.banner.danger { background: #fbe9e7; border-color: #f2c4bd; color: #8e2418; }
.banner.success { background: #e5f5ee; border-color: #bfe3d2; color: #14603f; }

button, .btn {
  font: inherit; cursor: pointer; border: none; border-radius: var(--radius-sm);
  padding: 9px 16px; background: var(--surface-alt); color: var(--text);
}
button.primary { background: var(--brand); color: #fff; font-weight: 600; }
button.primary:disabled { opacity: 0.45; cursor: default; }
button.ghost { background: transparent; color: var(--brand); font-weight: 600; padding: 6px 8px; }
button.danger { background: var(--danger); color: #fff; }
button.small { padding: 4px 10px; font-size: 0.85em; }

input, select, textarea {
  font: inherit; width: 100%; padding: 8px 10px;
  border: 1px solid var(--separator); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); border-color: transparent; }
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: 0.8em; color: var(--text-2); margin-bottom: 3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 0.9em; }
.check input { width: auto; }

.tx {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--separator); cursor: pointer;
}
.tx:last-child { border-bottom: none; }
.tx .who { font-weight: 600; }
.tx .amount { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx .meta { font-size: 0.78em; color: var(--text-2); }
.tx.excluded { opacity: 0.45; }

.import-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--separator); }
.import-row:last-child { border-bottom: none; }
.import-row .body { flex: 1; min-width: 0; }
.include-toggle {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--separator);
  background: none; padding: 0; flex-shrink: 0; margin-top: 2px;
}
.include-toggle.on { background: var(--income); border-color: var(--income); color: #fff; }

.dropzone {
  border: 2px dashed var(--brand); border-radius: var(--radius);
  background: rgba(0, 163, 224, 0.05); padding: 28px 16px; text-align: center; cursor: pointer;
}
.dropzone strong { color: var(--brand); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips button { padding: 5px 12px; font-size: 0.85em; border-radius: 999px; }
.chips button.on { background: var(--brand); color: #fff; }

.radar { height: 8px; background: var(--surface-alt); border-radius: 4px; overflow: hidden; margin: 6px 0 2px; }
.radar > div { height: 100%; background: var(--income); }
.radar.approaching > div { background: var(--warning); }
.radar.crossed > div { background: var(--expense); }

pre.doc {
  background: var(--surface); border: 1px solid var(--separator); border-radius: var(--radius);
  padding: 18px; overflow-x: auto; font-size: 0.82em; line-height: 1.5;
  font-family: "Cascadia Mono", Consolas, monospace;
}

table.lines { width: 100%; border-collapse: collapse; font-size: 0.9em; }
table.lines td { padding: 4px 4px; vertical-align: top; }

details.reason { margin-top: 6px; }
details.reason summary { cursor: pointer; color: var(--brand); font-size: 0.85em; }
details.reason li { font-size: 0.85em; color: var(--text-2); }

.empty { text-align: center; color: var(--text-2); padding: 40px 0; }
.right { text-align: right; }
.spacer { flex: 1; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
