/* styles.css — оформление на CRM системата. Работи на компютър и телефон. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --muted: #334155;
  --faint: #475569;
  --border: #e4e8ee;
  --accent: #0f766e;
  --accent-hover: #0b5e57;
  --accent-soft: #e6f3f1;
  --green: #15803d;
  --green-soft: #dcfce7;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --red: #b91c1c;
  --red-soft: #fee2e2;
  --blue: #1d4ed8;
  --blue-soft: #dbeafe;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 2px 6px rgba(15, 23, 42, 0.07), 0 12px 40px rgba(15, 23, 42, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --company: #0f766e;
  --sidebar-w: 232px;
  --dur-1: 150ms;
  --dur-2: 200ms;
  --dur-3: 250ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-family: inherit; font-size: 15px; }
/* Базов вид на самостоятелните падащи менюта (извън .field). */
select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
select:hover { border-color: var(--faint); }
/* Самостоятелните полета за търсене/период във филтрите (без клас, извън .field). */
input[type="search"], input[type="date"] {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
input[type="search"]:hover, input[type="date"]:hover { border-color: var(--faint); }
input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }
a { color: var(--accent); }

::selection { background: var(--accent-soft); }

/* Видим фокус за клавиатура — в цвета на марката. Полетата имат собствен пръстен. */
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Тънки, дискретни ленти за превъртане. */
* { scrollbar-width: thin; scrollbar-color: rgba(100, 116, 139, 0.35) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.35); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.55); border: 2px solid transparent; background-clip: content-box; }

/* ---------- Анимации ---------- */
@keyframes fade-in { from { opacity: 0; } }
@keyframes overlay-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { transform: translateY(10px) scale(0.97); opacity: 0; } }

/* ---------- Вход ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 18% -12%, var(--accent-soft) 0%, transparent 62%),
    radial-gradient(900px 420px at 105% 110%, var(--accent-soft) 0%, transparent 55%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 28px;
  animation: modal-in var(--dur-3) var(--ease-out) both;
}
.auth-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.auth-logo .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}
.auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.auth-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; margin-bottom: 20px; }
.auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 7px;
  font-weight: 600; color: var(--muted);
  transition: color var(--dur-1) ease, background var(--dur-1) ease;
}
.auth-tabs button:hover { color: var(--ink); }
.auth-tabs button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Форми ---------- */
.field { margin-bottom: 20px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); outline: none;
  font-size: 15.5px;
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease, background var(--dur-1) ease;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--faint); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 72px; }
.field-row { display: flex; gap: 22px; }
.field-row > .field { flex: 1; }

.btn {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px 16px; font-weight: 600; font-size: 14px;
  background: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
/* button.btn — за да надделее над късно вмъкнатите правила от темите (#theme-css). */
button.btn { transition: background var(--dur-1) ease, border-color var(--dur-1) ease, color var(--dur-1) ease, box-shadow var(--dur-1) ease, transform var(--dur-1) ease; }
.btn:hover { background: var(--accent-hover); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
button.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn.full { width: 100%; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--border); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--faint); }
.btn.danger { background: var(--surface); color: var(--red); border-color: var(--border); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.btn.danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.help-btn { white-space: nowrap; }

.err { background: var(--red-soft); color: var(--red); padding: 9px 12px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; animation: pop var(--dur-2) var(--ease-out); }

/* ---------- Структура ---------- */
.app { display: flex; min-height: 100vh; }
.company-bar { position: fixed; top: 0; left: 0; right: 0; height: 4px; background: var(--company); z-index: 60; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--surface); border-right: 1px solid var(--border);
  position: fixed; top: 0; bottom: 0; left: 0; padding-top: 4px;
  display: flex; flex-direction: column; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; letter-spacing: -0.02em; }
.brand .mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-hover) 100%);
  color: #fff; display: grid; place-items: center; font-size: 15px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}
/* Когато значката е логото (img), махаме фона/сянката — логото си носи цветовете. */
.auth-logo img.mark, .brand img.mark {
  background: none; box-shadow: none; border-radius: 6px;
  object-fit: contain; padding: 0;
}
.nav { padding: 6px 10px 14px; flex: 1; overflow-y: auto; }
.nav button {
  position: relative;
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: 0; background: transparent; color: var(--muted);
  padding: 10px 12px; border-radius: var(--radius-sm); font-weight: 600; font-size: 14px;
  margin-bottom: 2px; text-align: left;
  transition: background var(--dur-1) ease, color var(--dur-1) ease, transform var(--dur-1) ease;
}
.nav button .ic { width: 18px; text-align: center; opacity: .9; transition: transform var(--dur-2) var(--ease-out); }
.nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav button:hover .ic { transform: translateX(1px); }
.nav button:active { transform: scale(0.99); }
.nav button.active { background: var(--accent-soft); color: var(--accent); }
.nav button.active::before {
  content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav .badge { margin-left: auto; background: var(--red); color: #fff; font-size: 11px; border-radius: 20px; padding: 1px 7px; font-weight: 700; }

.content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 12px 22px;
}
/* Полупрозрачен размит фон, който следва темата (без закован бял цвят). */
@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .topbar {
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}
.topbar h1 { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -0.02em; flex: 1; }

.company-select { position: relative; }
.company-pill {
  display: flex; align-items: center; gap: 9px;
  border: 1px solid var(--border); background: var(--surface);
  padding: 7px 12px; border-radius: 30px; font-weight: 600; font-size: 14px;
  color: var(--ink);
  transition: border-color var(--dur-1) ease, background var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
.company-pill:hover { background: var(--surface-2); border-color: var(--faint); box-shadow: var(--shadow); }
.company-pill:active { transform: scale(0.98); }
.company-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--company); }
@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .company-pill .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--company) 18%, transparent); }
}
.company-pill .chev { color: var(--faint); font-size: 12px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 70;
  transform-origin: top right;
  animation: menu-in var(--dur-1) var(--ease-out);
}
.menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent;
  text-align: left; padding: 9px 11px; border-radius: var(--radius-sm); font-size: 14px; color: var(--ink);
  transition: background var(--dur-1) ease;
}
.menu button:hover { background: var(--surface-2); }
.menu .dot { width: 9px; height: 9px; border-radius: 50%; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; border: 0;
  transition: box-shadow var(--dur-1) ease, transform var(--dur-1) ease;
}
.avatar:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.avatar:active { transform: scale(0.95); }

.page { padding: 24px 22px; max-width: 1180px; width: 100%; animation: page-in var(--dur-3) var(--ease-out); }

/* ---------- Карти / таблици ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  transition: box-shadow var(--dur-2) ease, transform var(--dur-2) var(--ease-out), border-color var(--dur-2) ease;
}
.stat:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.08); }
.stat .label { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--faint); margin-top: 2px; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 14px; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.panel-head h2 { font-size: 16px; font-weight: 700; margin: 0; flex: 1; letter-spacing: -0.01em; }
.search { flex: 0 1 240px; }
.search input {
  width: 100%; padding: 8px 14px; border: 1px solid var(--border); border-radius: 30px; outline: none;
  background: var(--surface); color: var(--ink);
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease, background var(--dur-1) ease;
}
.search input:hover { border-color: var(--faint); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); padding: 11px 18px; border-bottom: 1px solid var(--border); font-weight: 700; background: var(--surface-2); }
td { padding: 13px 18px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--dur-1) ease; }
tbody tr:hover { background: var(--surface-2); cursor: pointer; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.tag { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; line-height: 1.5; }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.gray { background: var(--surface-2); color: var(--muted); }

.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .big {
  font-size: 26px; margin: 0 auto 12px; width: 64px; height: 64px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--faint);
}
.empty p { margin: 0 0 16px; }

/* ---------- Фуния (сделки) ---------- */
.pipeline { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { flex: 0 0 250px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; transition: outline-color var(--dur-1) ease; }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; margin-bottom: 10px; padding: 0 4px; }
.col-head .count { margin-left: auto; color: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.deal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 12px; margin-bottom: 8px; box-shadow: var(--shadow); cursor: grab;
  transition: box-shadow var(--dur-2) ease, transform var(--dur-2) var(--ease-out), border-color var(--dur-2) ease;
}
.deal-card:hover { transform: translateY(-1px); border-color: var(--faint); box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06), 0 8px 20px rgba(15, 23, 42, 0.09); }
.deal-card:active { cursor: grabbing; }
.deal-card.dragging { opacity: .5; transform: scale(0.98); }
.deal-card .t { font-weight: 600; font-size: 14px; }
.deal-card .v { color: var(--accent); font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.deal-card .c { color: var(--muted); font-size: 13px; margin-top: 2px; }
.col.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-soft); }

/* ---------- Модал ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); z-index: 100;
  display: grid; place-items: center; padding: 32px;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: overlay-in var(--dur-2) ease-out;
}
.modal {
  background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 540px; max-height: 90vh;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12), 0 24px 80px rgba(15, 23, 42, 0.28);
  animation: modal-in var(--dur-3) var(--ease-out);
}
.modal.wide { max-width: 1180px; }
.modal-head { display: flex; align-items: center; padding: 22px 28px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 19px; flex: 1; letter-spacing: -0.01em; color: var(--ink); }
.modal-head .x {
  border: 0; background: transparent; font-size: 22px; color: var(--faint); line-height: 1;
  width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center;
  transition: background var(--dur-1) ease, color var(--dur-1) ease;
}
.modal-head .x:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 26px 32px; overflow-y: auto; }
.modal-foot { padding: 18px 28px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); }

/* редове на фактура */
.items th { padding: 11px 10px; font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--muted); background: transparent; }
.items td { padding: 9px 8px; border: 0; }
.items input {
  padding: 12px 12px; font-size: 15.5px; width: 100%; box-sizing: border-box; color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); outline: none;
  transition: border-color var(--dur-1) ease, box-shadow var(--dur-1) ease;
}
.items input:hover { border-color: var(--faint); }
.items input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.items .num input { text-align: right; }
.totals { margin-top: 12px; margin-left: auto; width: 260px; }
.totals .line { display: flex; justify-content: space-between; padding: 4px 0; font-variant-numeric: tabular-nums; }
.totals .line.grand { font-weight: 700; font-size: 17px; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }

/* toast */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 30px; font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: pop var(--dur-3) var(--ease-out);
}
.toast.err { background: var(--red); color: #fff; }

.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-bottom: 18px; }
.detail-meta .k { font-size: 12px; color: var(--faint); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.detail-meta .v { font-size: 15px; }
.timeline { border-left: 2px solid var(--border); margin-left: 6px; padding-left: 16px; }
.timeline .item { margin-bottom: 16px; position: relative; }
.timeline .item::before { content: ''; position: absolute; left: -23px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline .when { font-size: 12px; color: var(--faint); }

/* ---------- По-широки и по-четливи форми (добавено 08.07.2026) ----------
   Стойностите са влети направо в основните правила по-горе (полета 12/14px,
   шрифт 15.5px, широк модал 1180px, по-щедри отстояния). Селекторите по-долу
   остават за съвместимост и вече ползват само променливи на темата. */
:root { --muted: #334155; --faint: #475569; }
.overlay { padding: 32px; }
.modal.wide { max-width: 1180px; }
.modal-head { padding: 22px 28px; }
.modal-head h3 { font-size: 19px; color: var(--ink); }
.modal-body { padding: 26px 32px; }
.modal-foot { padding: 18px 28px; }
.field { margin-bottom: 20px; }
.field label { font-size: 14px; margin-bottom: 8px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { padding: 12px 14px; font-size: 15.5px; color: var(--ink); }
.field-row { gap: 22px; }
.items th { padding: 11px 10px; font-size: 13px; color: var(--muted); }
.items td { padding: 9px 8px; }
.items input { padding: 12px 12px; font-size: 15.5px; color: var(--ink); }

/* мобилна навигация */
.mobile-nav { display: none; }
.hamburger { display: none; }
.scrim { display: none; }

@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--dur-3) var(--ease-out); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .content { margin-left: 0; }
  .hamburger {
    display: inline-grid; place-items: center; width: 38px; height: 38px;
    border: 1px solid var(--border); background: var(--surface); color: var(--ink);
    border-radius: 9px; font-size: 18px;
    transition: background var(--dur-1) ease, border-color var(--dur-1) ease;
  }
  .hamburger:hover { background: var(--surface-2); }
  .hamburger:active { transform: scale(0.95); }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 45; animation: fade-in var(--dur-2) ease-out; }
  .topbar h1 { font-size: 16px; }
  .page { padding: 16px; padding-bottom: 80px; }
  .overlay { padding: 16px; }
  .modal-head { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-foot { padding: 14px 18px; }
  .field-row { flex-direction: column; gap: 0; }
  .detail-meta { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* ---------- По-малко движение при поискване от системата ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Месечен разделител в списъка с фактури — следва темата, не е закован в светли цветове. */
tr.month-row td.month-sep { background: var(--accent-soft); color: var(--accent); font-weight: 700; padding: 9px 12px; border-top: 2px solid var(--accent); text-transform: capitalize; letter-spacing: .01em; }

/* ---------- Помощ (ръководството идва с вградени светли стилове от app.js) ----------
   Тук само поправяме тъмната тема — по-високата специфичност надделява над вградените. */
[data-theme="dark"] .help-guide { color: var(--ink); }
[data-theme="dark"] .help-guide .sub { color: var(--muted); }
[data-theme="dark"] .help-guide h2 { color: var(--accent); border-top-color: var(--border); }
[data-theme="dark"] .help-guide b { color: var(--ink); }
[data-theme="dark"] .help-guide .step { color: var(--accent); }
[data-theme="dark"] .help-guide .entry,
[data-theme="dark"] .help-guide .tip { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
[data-theme="dark"] .help-guide .warn { background: var(--amber-soft); border-color: var(--amber); color: var(--ink); }
[data-theme="dark"] .help-guide .toc a { background: var(--surface); border-color: var(--border); color: var(--accent); }

/* ---------- Печат на фактура ---------- */
#print-area { display: none; }
@media print {
  body > * { display: none !important; }
  #print-area { display: block !important; position: static; padding: 28px 32px; background: #fff; color: #000; }
  .toasts, .overlay { display: none !important; }
}
.inv {
  font-size: 13px; color: #111; max-width: 820px; margin: 0 auto;
}
.inv-top { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.inv-top .firm h2 { margin: 0 0 6px; font-size: 18px; }
.inv-top .meta { text-align: right; }
.inv-top .meta .big { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.inv-parties { display: flex; gap: 24px; margin-bottom: 22px; }
.inv-parties > div { flex: 1; border: 1px solid #ddd; border-radius: 8px; padding: 12px 14px; }
.inv-parties .ttl { font-size: 11px; text-transform: uppercase; color: #888; font-weight: 700; letter-spacing: .05em; margin-bottom: 6px; }
.inv table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.inv th { background: #f3f4f6; text-align: left; padding: 9px 10px; font-size: 11px; text-transform: uppercase; color: #444; border-bottom: 1px solid #ddd; }
.inv td { padding: 9px 10px; border-bottom: 1px solid #eee; }
.inv .r { text-align: right; font-variant-numeric: tabular-nums; }
.inv-tot { width: 280px; margin-left: auto; }
.inv-tot .l { display: flex; justify-content: space-between; padding: 4px 0; }
.inv-tot .l.g { font-weight: 800; font-size: 16px; border-top: 2px solid #111; margin-top: 6px; padding-top: 8px; }
.inv-sign { display: flex; justify-content: space-between; margin-top: 40px; font-size: 12px; color: #555; }
.inv-pay { margin: 16px 0; font-size: 12px; color: #333; }
.inv-note { color: #555; }
