:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --line: #e4e7ec;
  --line-2: #d0d5dd;
  --navy: #0b1220;
  --navy-2: #111c31;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --blue: #1d4ed8;
  --amber: #b45309;
  --red: #b42318;
  --green: #067647;
  --violet: #6941c6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: #ccfbf1; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 15% -10%, #13324a 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 110%, #0b3b34 0%, transparent 55%),
    var(--navy);
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--surface);
  border-radius: 20px;
  padding: 34px 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark { width: 46px; height: 46px; border-radius: 13px; font-size: 22px; }
.login-brand-name { font-size: 18px; font-weight: 700; letter-spacing: 0.02em; }
.login-brand-sub { font-size: 12px; color: var(--muted); }

.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card .lead { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }

.form-error {
  display: none;
  background: #fef3f2;
  border: 1px solid #fecdca;
  color: #b42318;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.form-error.show { display: block; }

.login-foot { margin-top: 20px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- shell ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 252px;
  flex: 0 0 252px;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 20px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #14b8a6, #0f766e);
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
}
.brand-name { color: #f8fafc; font-weight: 700; letter-spacing: 0.06em; font-size: 15px; }
.brand-sub { color: #7d8ea6; font-size: 11.5px; letter-spacing: 0.02em; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: #64748b; padding: 16px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 9px;
  color: #cbd5e1; font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(20, 184, 166, 0.16); color: #e6fffa; }
.nav-item.active svg { color: var(--accent-2); }
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; color: #8fa3ba; }
.nav-count { margin-left: auto; font-size: 11.5px; color: #94a3b8; }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #1e293b; color: #e2e8f0;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
  flex: 0 0 34px;
}
.user-name { color: #f1f5f9; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: #7d8ea6; font-size: 11.5px; white-space: nowrap; }
.user-actions { display: flex; gap: 4px; margin-top: 4px; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted);
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { background: #fef3f2; color: var(--red); }
.sidebar .icon-btn { color: #8fa3ba; }
.sidebar .icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-weight: 650; font-size: 15px; }
.topbar .icon-btn { color: var(--ink-2); }

.content { padding: 26px 30px 48px; width: 100%; max-width: 1440px; margin: 0 auto; }

.scrim {
  display: none;
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  z-index: 35;
}
.scrim.show { display: block; }

@media (max-width: 980px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh;
    transform: translateX(-100%); transition: transform 0.22s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { display: flex; }
  .content { padding: 18px 16px 40px; }
}

/* ---------- page head ---------- */

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-title { font-size: 24px; letter-spacing: -0.02em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2);
  padding: 8px 14px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: #b9c0cc; text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #0b5f59; border-color: #0b5f59; }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.dark:hover { background: #1a2740; }
.btn.danger { color: var(--red); border-color: #fecdca; background: #fff; }
.btn.danger:hover { background: #fef3f2; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(16, 24, 40, 0.05); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- cards & panels ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 14px; font-weight: 650; }
.panel-body { padding: 16px 18px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--line-2);
}
.kpi.green::after { background: #12b76a; }
.kpi.amber::after { background: #f79009; }
.kpi.blue::after { background: #2e90fa; }
.kpi.teal::after { background: var(--accent-2); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 7px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-note { font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- filters ---------- */

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 12px; margin-bottom: 14px;
}
.search-box { position: relative; flex: 1 1 260px; min-width: 200px; }
.search-box svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: #98a2b3; pointer-events: none;
}
.search-box .input { padding-left: 34px; }

.input, .select, textarea.input {
  width: 100%;
  border: 1px solid var(--line-2);
  background: var(--surface);
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 38px;
}
.input:focus, .select:focus, textarea.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.select { appearance: none; padding-right: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23667085' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
.filters .select, .filters .input { width: auto; min-width: 130px; }
.filters .search-box .input { width: 100%; }
textarea.input { resize: vertical; min-height: 76px; line-height: 1.45; }

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.table { width: 100%; border-collapse: collapse; min-width: 880px; }
.table thead th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 650; padding: 11px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table tbody td { padding: 11px 14px; border-bottom: 1px solid #eef0f3; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: #fafbfc; }
#items-host .table tbody tr { cursor: pointer; }
.table .item-name { font-weight: 600; color: var(--ink); display: block; }
.table .item-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.table .row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.table .money-strong { font-weight: 650; }
.cell-status { white-space: nowrap; }

.empty {
  padding: 42px 20px; text-align: center; color: var(--muted);
}
.empty-icon { width: 42px; height: 42px; margin: 0 auto 10px; color: #c3cad5; }
.empty-title { color: var(--ink-2); font-weight: 600; margin-bottom: 3px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager-info { color: var(--muted); font-size: 12.5px; }
.pager-btns { display: flex; gap: 8px; }

/* ---------- badges ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.stock { color: #067647; background: #ecfdf3; border-color: #abefc6; }
.badge.transit { color: #b54708; background: #fffaeb; border-color: #fedf89; }
.badge.sold { color: #175cd3; background: #eff8ff; border-color: #b2ddff; }
.badge.planned { color: #475467; background: #f2f4f7; border-color: #d0d5dd; }
.badge.reserved { color: #6941c6; background: #f4f3ff; border-color: #d9d6fe; }
.badge.written_off { color: #b42318; background: #fef3f2; border-color: #fecdca; }

.chip {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
}

.role-badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: #f2f4f7; color: #475467; }
.role-badge.owner { background: #ecfdf3; color: #067647; }
.role-badge.manager { background: #eff8ff; color: #175cd3; }
.role-badge.buyer { background: #f4f3ff; color: #6941c6; }

/* ---------- hero (buyer catalog) ---------- */

.hero {
  background: linear-gradient(120deg, #0b1220 0%, #12313d 60%, #0f4a44 100%);
  color: #fff; border-radius: 18px; padding: 30px 32px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 260px; height: 260px;
  border-radius: 50%; background: radial-gradient(circle, rgba(20, 184, 166, 0.35), transparent 70%);
}
.hero h1 { font-size: 27px; letter-spacing: -0.02em; max-width: 720px; }
.hero p { color: #b8c6d6; margin-top: 7px; max-width: 680px; font-size: 14px; }
.hero-meta { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.hero-meta div { font-size: 13px; color: #d7e0ea; }
.hero-meta b { display: block; font-size: 20px; color: #fff; margin-bottom: 1px; }

.catalog-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px;
}
.car-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
  display: flex; flex-direction: column;
}
.car-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(16, 24, 40, 0.12); }
.car-photo { aspect-ratio: 16 / 10; background: linear-gradient(140deg, #e7ecf3, #d5dde8); position: relative; overflow: hidden; }
.car-photo img { width: 100%; height: 100%; object-fit: cover; }
.car-photo .badge { position: absolute; left: 10px; top: 10px; background: rgba(255, 255, 255, 0.94); }
.car-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #9aa7b8; }
.car-placeholder svg { width: 48px; height: 48px; }
.car-body { padding: 13px 15px 15px; display: flex; flex-direction: column; flex: 1; }
.car-category { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.car-title { font-size: 15px; font-weight: 650; margin-top: 4px; line-height: 1.32; }
.car-meta { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.car-foot { display: flex; align-items: flex-end; justify-content: space-between; margin-top: auto; padding-top: 12px; gap: 8px; }
.car-price { font-size: 18px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.car-price small { display: block; font-size: 11px; color: var(--muted); font-weight: 500; letter-spacing: 0; }

/* ---------- detail modal ---------- */

.detail-grid { display: grid; grid-template-columns: 380px 1fr; gap: 22px; }
@media (max-width: 820px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-photo {
  border-radius: 12px; overflow: hidden; background: #eef1f5; aspect-ratio: 4 / 3;
  display: grid; place-items: center; color: #9aa7b8;
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.detail-photo svg { width: 56px; height: 56px; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.detail-title { font-size: 21px; letter-spacing: -0.02em; }
.detail-sub { color: var(--muted); margin-top: 4px; font-size: 13px; }

.price-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 18px 0; }
@media (max-width: 620px) { .price-grid { grid-template-columns: 1fr 1fr; } }
.price-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.price-box .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.price-box .val { font-size: 16px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.price-box.profit .val { color: var(--green); }
.price-box.loss .val { color: var(--red); }

.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; margin: 16px 0; }
.spec { min-width: 0; }
.spec .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.spec .v { font-size: 13.5px; margin-top: 1px; overflow-wrap: anywhere; }
.section-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 650; margin: 18px 0 8px; }
.detail-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; font-size: 13px; white-space: pre-wrap; }
.detail-desc { font-size: 13.5px; color: var(--ink-2); white-space: pre-wrap; }
.expense-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.expense-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid #eef0f3; font-size: 13px; }
.expense-item:last-child { border-bottom: 0; }
.expense-item .ename { flex: 1; }
.expense-item .edate { color: var(--muted); font-size: 12px; }
.expense-item .eamount { font-weight: 650; font-variant-numeric: tabular-nums; }
.expense-total { display: flex; justify-content: space-between; padding: 10px 12px; background: var(--surface-2); font-weight: 650; border-top: 1px solid var(--line); }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(16, 24, 40, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 4vh 16px; z-index: 100; overflow-y: auto;
  animation: fade 0.14s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 720px;
  max-height: 92vh; display: flex; flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
  animation: pop 0.16s ease;
  margin: auto 0;
}
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal.wide { max-width: 1000px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); flex: 0 0 auto; background: var(--surface); border-radius: 16px 16px 0 0; }
.modal-title { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; flex: 0 0 auto; flex-wrap: wrap; }
.modal-foot .spacer { flex: 1; }

/* ---------- forms ---------- */

.form-section { margin-bottom: 20px; }
.form-section > .section-label { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .col-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .col-2 { grid-column: auto; } }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.field.required label::after { content: " *"; color: var(--red); }

.expenses-editor { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--surface-2); }
.exp-row { display: grid; grid-template-columns: 1fr 130px 140px 32px; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 640px) { .exp-row { grid-template-columns: 1fr 1fr 32px; } .exp-row .exp-date { grid-column: 1 / 3; } }
.exp-row .input { min-height: 34px; padding: 6px 9px; font-size: 13px; }
.exp-total-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 2px 2px; font-size: 13px; font-weight: 650; }
.exp-empty { color: var(--muted); font-size: 12.5px; padding: 4px 2px 6px; }

.photo-editor { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.photo-preview { width: 140px; height: 100px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line-2); display: grid; place-items: center; color: #98a2b3; overflow: hidden; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview svg { width: 28px; height: 28px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- lists ---------- */

.event-list { display: flex; flex-direction: column; }
.event-row { display: flex; gap: 12px; padding: 10px 18px; border-bottom: 1px solid #eef0f3; font-size: 13px; }
.event-row:last-child { border-bottom: 0; }
.event-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); margin-top: 7px; flex: 0 0 7px; }
.event-time { color: var(--muted); font-size: 11.5px; margin-left: auto; white-space: nowrap; }
.event-user { color: var(--muted); }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding: 10px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; min-width: 0; }
.bar { width: 100%; max-width: 44px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-radius: 5px 5px 2px 2px; min-height: 3px; transition: height 0.3s ease; }
.bar-col:hover .bar { filter: brightness(1.08); }
.bar-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.bar-val { font-size: 10.5px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }

.dash-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 980px) { .dash-tables { grid-template-columns: 1fr; } }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.mini-table td { padding: 8px 10px; border-bottom: 1px solid #f1f3f6; }
.mini-table tr:last-child td { border-bottom: 0; }
.mini-table .num { font-variant-numeric: tabular-nums; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13.5px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
  z-index: 200; max-width: min(90vw, 520px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #7a271a; }

.loading { display: flex; align-items: center; justify-content: center; padding: 60px 0; color: var(--muted); gap: 10px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #d0d5dd; border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.contact-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.contact-box .phone { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.contact-box .tg { color: var(--accent); font-weight: 600; }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #fffaeb; border: 1px solid #fedf89; color: #93370d;
  border-radius: 12px; padding: 11px 15px; font-size: 13px; margin-bottom: 16px;
}
.banner > svg { width: 22px; height: 22px; flex: 0 0 22px; }
.banner .btn { margin-left: auto; }

.photo-big { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.photo-big img { width: 100%; max-height: 420px; object-fit: contain; background: #f2f4f7; }

.settings-form { max-width: 620px; }
.kv { display: grid; grid-template-columns: 190px 1fr; gap: 8px 16px; font-size: 13px; }
.kv div:nth-child(odd) { color: var(--muted); }
@media (max-width: 620px) { .kv { grid-template-columns: 1fr; } }

@media (max-width: 620px) {
  .page-title { font-size: 20px; }
  .kpi-value { font-size: 19px; }
  .content { padding: 14px 12px 36px; }
  .hero { padding: 22px 20px; }
  .hero h1 { font-size: 22px; }
  .modal-body { padding: 16px; }
  .modal-head { padding: 14px 16px 12px; }
  .modal-foot { padding: 12px 16px; }
  .filters { gap: 8px; }
  .filters .search-box { flex: 1 1 100%; }
  .filters .select { flex: 1 1 calc(50% - 4px); width: auto; min-width: 0; }
}
