/* Korpa — stilovi. Sistemski font, jedna akcentna boja, automatski tamni režim. */

:root {
  --bg: #f4f5f4;
  --surface: #ffffff;
  --surface-2: #eceeed;
  --text: #151918;
  --muted: #6a7370;
  --border: rgba(20, 30, 28, 0.09);
  --accent: #0F766E;
  --accent-bg: #0F766E;
  --accent-weak: #e3f1ef;
  --on-accent: #ffffff;
  --up: #B45309;
  --up-weak: #fbefe2;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 6px 24px rgba(0, 0, 0, 0.16);
  --radius: 16px;
  --radius-sm: 11px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413;
    --surface: #1b201f;
    --surface-2: #272d2b;
    --text: #edf1ef;
    --muted: #98a29f;
    --border: rgba(255, 255, 255, 0.08);
    --accent: #3cb8a8;
    --accent-bg: #0F766E;
    --accent-weak: rgba(60, 184, 168, 0.14);
    --up: #f0a24e;
    --up-weak: rgba(240, 162, 78, 0.14);
    --danger: #ff7b6e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  padding-left: var(--sal);
  padding-right: var(--sar);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
img { display: block; }
[hidden] { display: none !important; }
code { font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

.view { max-width: 640px; margin: 0 auto; }
.screen { padding-bottom: calc(110px + var(--sab)); }
.screen.enter { animation: enter 0.18s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen.enter { animation: none; } }

.pad { padding-left: 16px; padding-right: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.badge { font-size: 11px; vertical-align: middle; background: var(--up-weak); color: var(--up); padding: 2px 6px; border-radius: 6px; font-weight: 600; }

/* ---------- zaglavlje ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(var(--sat) + 6px) 12px 8px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
}
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.app-title { margin: 0; padding-left: 4px; font-size: 28px; font-weight: 750; letter-spacing: -0.02em; }
.topbar-title { margin: 0; font-size: 17px; font-weight: 600; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  min-width: 44px; height: 44px; border: 0; background: none; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; text-decoration: none; color: var(--accent);
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn-spacer { width: 44px; }
.back-btn { font-size: 34px; line-height: 1; padding-bottom: 4px; }
.icon-btn.sm { min-width: 44px; height: 44px; font-size: 16px; color: var(--muted); }
.icon-btn.sm:disabled { opacity: 0.3; }
.icon-btn.danger { color: var(--danger); }
.icon-btn.ghost { visibility: hidden; display: inline-block; }

.search {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 0 12px; height: 40px;
  background: var(--surface-2); border-radius: 12px;
}
.search-ico { color: var(--muted); font-size: 18px; transform: scaleX(-1); }
.search input { flex: 1; border: 0; background: none; outline: none; height: 40px; font-size: 16px; min-width: 0; }
.search input::-webkit-search-cancel-button { opacity: 0.5; }

.progress { margin-top: 8px; }
.progress-track { height: 3px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
.progress-text { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }

.update-bar {
  position: fixed; z-index: 60; left: 12px; right: 12px; top: calc(var(--sat) + 8px);
  max-width: 480px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 8px 8px 16px; border-radius: 14px;
  background: var(--accent-bg); color: var(--on-accent); box-shadow: var(--shadow-lg);
}
.update-bar button { border: 0; background: rgba(255, 255, 255, 0.2); color: inherit; font-weight: 600; padding: 0 16px; height: 36px; border-radius: 10px; }

/* ---------- čipovi i segmenti ---------- */

.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 6px 16px 10px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-padding: 16px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 18px;
  border: 1px solid var(--border); background: var(--surface); font-size: 15px; white-space: nowrap;
  position: relative;
}
.chip::after { content: ""; position: absolute; inset: -4px 0; } /* veća dodirna površina */
.chip.on { background: var(--accent-bg); border-color: var(--accent-bg); color: var(--on-accent); }

.seg {
  display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2);
}
.seg-item { flex: 1; position: relative; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span {
  display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 8px;
  border-radius: 9px; font-size: 15px; font-weight: 500; color: var(--muted); cursor: pointer;
  transition: background 0.15s, color 0.15s; white-space: nowrap; user-select: none;
}
.seg-item input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg-item input:focus-visible + span { outline: 2px solid var(--accent); }
.seg-sm .seg-item span { min-height: 38px; font-size: 14px; }

/* ---------- red iznad liste ---------- */

.list-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 6px; min-height: 44px; }
.meta-text { font-size: 13px; color: var(--muted); }
.meta-actions { display: flex; gap: 6px; flex: none; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 12px;
  border-radius: 10px; border: 0; background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 500;
  position: relative; white-space: nowrap;
}
.chip-btn::after { content: ""; position: absolute; inset: -4px 0; }
.chip-btn:disabled { opacity: 0.6; }
.chip-btn .spin-ico { display: inline-block; color: var(--accent); font-weight: 700; }
.chip-btn.spinning .spin-ico { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sort-btn { overflow: hidden; }
.sort-btn #sort-label { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.sort-btn select { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; font-size: 16px; }

.changed-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 8px 16px 0; padding: 10px 14px; border-radius: 12px;
  background: var(--accent-weak); color: var(--accent); font-size: 14px;
}
.link { border: 0; background: none; padding: 8px 0; color: var(--accent); font-weight: 600; font-size: inherit; min-height: 36px; }

/* ---------- kartice ---------- */

.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  display: flex; gap: 12px; align-items: stretch;
  background: var(--surface); border-radius: var(--radius); padding: 10px;
  box-shadow: var(--shadow); cursor: pointer; transition: transform 0.12s ease;
  outline: none;
}
.card:active { transform: scale(0.985); }
.card:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.thumb {
  position: relative; flex: none; width: 76px; height: 76px; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
}
.thumb img[data-img] { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.2s; background: #fff; }
.thumb.has-img img[data-img] { opacity: 1; }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.card-title {
  margin: 0; font-size: 16px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warn-ico { color: var(--up); margin-left: 6px; font-weight: 700; }
.card-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; margin-top: 2px; }
.price { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.chg { font-size: 13px; font-weight: 600; white-space: nowrap; }
.chg s { font-weight: 400; opacity: 0.8; }
.chg-down { color: var(--accent); }
.chg-up { color: var(--up); }
.card-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; flex: none; }
.link-btn {
  width: 44px; height: 44px; margin: 0 -6px -6px 0; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; text-decoration: none; font-size: 18px;
}
.link-btn:active { background: var(--surface-2); }

.prio { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 7px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.prio-1 { background: var(--accent-weak); color: var(--accent); }
.prio-3 { background: transparent; border: 1px dashed var(--border); }

/* favicon sa rezervnim slovom */
.fav {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); vertical-align: -3px; overflow: hidden;
}
.fav-letter { font-size: 11px; font-weight: 700; color: var(--muted); }
.fav img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--surface); }
.fav-lg { width: 36px; height: 36px; border-radius: 10px; }
.fav-lg .fav-letter { font-size: 18px; }
.fav-xl { width: 72px; height: 72px; border-radius: 20px; }
.fav-xl .fav-letter { font-size: 34px; }

/* ---------- zbir ---------- */

.totals-box {
  margin-top: 16px; padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px;
}
.tot-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; font-variant-numeric: tabular-nums; }
.tot-sum { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 2px; }

/* ---------- prazno stanje ---------- */

.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty p { margin: 0; }
.empty .btn { margin-top: 16px; }
.empty-ico { font-size: 48px; margin-bottom: 8px; }

/* ---------- FAB ---------- */

.fab {
  position: fixed; z-index: 30;
  right: calc(18px + var(--sar)); bottom: calc(18px + var(--sab));
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--on-accent); font-size: 30px; font-weight: 300; text-decoration: none;
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.4);
  transition: transform 0.12s ease;
}
.fab:active { transform: scale(0.94); }
@media (min-width: 672px) { .fab { right: calc(50% - 320px + 18px); } }

/* ---------- dugmad ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 18px; border-radius: 13px; border: 0;
  font-size: 16px; font-weight: 600; text-decoration: none; text-align: center;
  transition: transform 0.1s ease, opacity 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }
.btn-primary { background: var(--accent-bg); color: var(--on-accent); }
.btn-accent { background: var(--accent-weak); color: var(--accent); }
.btn-plain { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-plain { background: var(--surface-2); color: var(--danger); }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 10px; }

/* ---------- forma ---------- */

.form { display: flex; flex-direction: column; gap: 16px; padding-top: 4px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted); padding-left: 2px; }
.req { color: var(--danger); }
.input {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); font-size: 16px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.input.invalid { border-color: var(--danger); }
.input.warn { border-color: var(--up); background: var(--up-weak); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.4; }
select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat;
  padding-right: 36px;
}
.field-error { margin: 0; font-size: 13px; color: var(--danger); }
.warn-line { margin: 0; font-size: 13px; color: var(--up); font-weight: 600; }

.paste-btn {
  min-height: 64px; border-radius: var(--radius); border: 2px dashed var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-weak); color: var(--accent); font-size: 19px; font-weight: 700;
}
.paste-btn:active { transform: scale(0.99); }

.url-row { position: relative; }
.url-row .fav { position: absolute; left: 14px; top: 15px; z-index: 1; }
.url-row .input { padding-left: 42px; }

.status-line { margin: 0; font-size: 14px; color: var(--muted); }
.status-line.ok { color: var(--accent); font-weight: 500; }
.status-line.err { color: var(--up); font-weight: 500; }
.dup-warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--up-weak); color: var(--up); font-size: 14px; font-weight: 500; }
.dup-warn a { color: inherit; font-weight: 700; }

.from-page { padding: 12px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.from-page p { margin: 8px 0 0; }
.from-page-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.skeleton-row { display: flex; gap: 12px; align-items: center; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2) 25%, color-mix(in srgb, var(--surface-2) 50%, var(--surface)) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
.sk-img { width: 56px; height: 56px; border-radius: 12px; flex: none; }
.sk-line { height: 14px; }
.sk-line.short { width: 40%; }
.sk-img-lg { width: 100%; aspect-ratio: 4 / 3; max-height: 260px; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; } }

.price-row { display: flex; gap: 8px; align-items: center; }
.price-row .input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }
.price-row .seg { flex: none; width: 150px; }

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); min-height: 56px;
}
.switch-row > span { display: flex; flex-direction: column; }
.switch-label { font-size: 16px; }
.switch {
  -webkit-appearance: none; appearance: none; flex: none; position: relative;
  width: 51px; height: 31px; border-radius: 16px; background: var(--surface-2); margin: 0;
  transition: background 0.2s; cursor: pointer; border: 1px solid var(--border);
}
.switch::before {
  content: ""; position: absolute; top: 1px; left: 1px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); transition: transform 0.2s;
}
.switch:checked { background: var(--accent-bg); border-color: var(--accent-bg); }
.switch:checked::before { transform: translateX(20px); }

.prio-seg .seg-item span { min-height: 42px; }

.img-preview { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.img-preview img { width: 100%; max-height: 300px; object-fit: contain; background: #fff; }
.img-actions { display: flex; gap: 8px; padding: 8px; justify-content: flex-end; }
.img-src { position: absolute; left: 12px; bottom: 20px; }
.img-add {
  width: 100%; min-height: 72px; border-radius: var(--radius); border: 1px dashed var(--border);
  background: var(--surface); font-size: 16px; font-weight: 500; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}

.save-bar {
  position: sticky; bottom: 0; z-index: 15;
  margin: 8px -16px 0; padding: 12px 16px calc(12px + var(--sab));
  background: linear-gradient(to bottom, transparent, var(--bg) 30%);
  transition: transform 0.15s ease;
}
.screen-add, .screen-edit { padding-bottom: 0; }

/* ---------- detalji ---------- */

.hero { margin: 0 16px; border-radius: 20px; overflow: hidden; background: #fff; box-shadow: var(--shadow); }
.hero img { width: 100%; max-height: 52vh; object-fit: contain; }
.hero-empty { background: var(--surface); height: 160px; display: flex; align-items: center; justify-content: center; }
.detail-title { margin: 14px 0 4px; font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
.detail-shop { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 15px; }
.detail-price { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.price-big { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.paid { margin-top: 4px; }
.status-badge { display: inline-block; margin-top: 14px; font-size: 13px; font-weight: 600; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); }
.st-kupljeno { background: var(--accent-weak); color: var(--accent); }

.tracking { margin-top: 8px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.track-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: 0.5; flex: none; }
.dot-on { background: var(--accent); opacity: 1; }
.track-err {
  padding: 10px 12px; border-radius: 12px; background: var(--up-weak); color: var(--up); font-weight: 500;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.track-err .muted { color: inherit; opacity: 0.75; font-weight: 400; }
.track-err .btn { background: var(--surface); color: var(--up); }

.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 16px; }
.tags .prio { font-size: 13px; padding: 5px 10px; }
.tag { font-size: 13px; padding: 5px 10px; border-radius: 7px; background: var(--surface-2); }

.action-row { display: flex; gap: 8px; margin-top: 10px; }
.action-row .btn { flex: 1; padding: 0 10px; font-size: 15px; }
.status-actions { margin-top: 24px; }

.section { margin-top: 24px; }
.section-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.note { margin: 0; white-space: pre-wrap; background: var(--surface); padding: 12px 14px; border-radius: var(--radius-sm); }

.history { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius-sm); overflow: hidden; }
.history li { display: grid; grid-template-columns: 1fr auto 56px; gap: 10px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.history li:first-child { border-top: 0; }
.h-date { color: var(--muted); font-size: 14px; }
.h-price { font-weight: 600; }
.h-src { font-size: 12px; color: var(--muted); text-align: right; }
.history li.lowest { background: var(--accent-weak); }
.history li.lowest .h-price { color: var(--accent); }
.history li.lowest .h-src::before { content: "najniža · "; color: var(--accent); }
.section > .muted.small { margin: 6px 2px 0; }

.chart { width: 100%; height: auto; margin-bottom: 10px; background: var(--surface); border-radius: var(--radius-sm); padding: 6px 4px 2px; overflow: visible; }
.chart-line { stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-area { fill: var(--accent-weak); }
.chart-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.chart-min { fill: var(--accent); }
.chart-label { font-size: 9px; fill: var(--muted); }

.meta-list { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.meta-list > div { display: flex; justify-content: space-between; }

/* ---------- podešavanja ---------- */

.group { margin-top: 20px; }
.group-title { margin: 0 0 8px 4px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.group-box { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.group > .btn { margin-top: 8px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 8px 14px; border-top: 1px solid var(--border); width: 100%;
}
.group-box > .row:first-child, .group-box > :first-child { border-top: 0; }
.row-col { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 14px; }
.row-col > label, .row-col > .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.row-end { display: flex; align-items: center; gap: 8px; text-align: right; }
.row-btn { border: 0; border-top: 1px solid var(--border); background: none; text-align: left; font-size: 16px; }
.row-btn:active { background: var(--surface-2); }
.row.switch-row { border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; background: none; }
.input-inline { width: 100px; min-height: 40px; padding: 6px 10px; text-align: right; }
.key-row { display: flex; gap: 8px; }
.key-row .input { flex: 1; min-width: 0; }
.hint { font-size: 13px; color: var(--muted); margin: 8px 4px 0; }
.version { text-align: center; margin-top: 28px; }

.cat-row { padding: 0 6px 0 4px; gap: 4px; }
.cat-name { flex: 1; min-width: 0; text-align: left; border: 0; background: none; min-height: 52px; padding: 0 8px; display: flex; align-items: center; gap: 10px; font-size: 16px; }
.cat-ico { font-size: 20px; width: 28px; text-align: center; }
.cat-actions { display: flex; flex: none; }
.cat-edit { display: flex; gap: 8px; }
.emoji-input { width: 64px; flex: none; text-align: center; font-size: 22px; padding: 6px; }

/* ---------- dijalog ---------- */

.dlg {
  border: 0; padding: 0; border-radius: 20px; width: min(92vw, 400px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.dlg::backdrop { background: rgba(0, 0, 0, 0.4); }
.dlg[open] { animation: pop 0.16s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
.dlg-form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dlg-title { margin: 0; font-size: 19px; font-weight: 700; }
.dlg-body p { margin: 0 0 8px; }
.dlg-body { display: flex; flex-direction: column; gap: 8px; }
.dlg-actions { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.dlg-actions .btn { flex: 1; }

/* ---------- toast ---------- */

.toasts {
  position: fixed; z-index: 70; left: 0; right: 0; bottom: calc(92px + var(--sab));
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px;
}
.toast {
  pointer-events: auto; max-width: 480px; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 14px; border: 0; text-align: left;
  background: #1f2523; color: #fff; font-size: 15px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: none; }
.toast-action { color: #7fe0d2; font-weight: 700; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .toast { background: #e9eeec; color: #121615; } .toast-action { color: #0F766E; } }
