:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #17202a;
  --muted: #6b7785;
  --line: #e3e8ee;
  --accent: #1f5eff;
  --accent-dark: #1747c4;
  --sidebar: #131a22;
  --sidebar-ink: #c9d2dc;
  --ok: #1f9d55;
  --warn: #b7791f;
  --err: #c53030;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; margin: 14px 0 8px; }
p { margin: 0 0 8px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.nw { white-space: nowrap; }
.c { text-align: center; }
.r { text-align: right; }
.bold { font-weight: 600; }

.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--sidebar); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px 18px; color: #fff; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #2f6bff, #7aa2ff);
  display: grid; place-items: center; font-weight: 800; font-size: 19px; color: #fff;
}
.brand small { display: block; color: #8b98a7; font-size: 11px; letter-spacing: .02em; }
.brand.big { padding: 0 0 18px; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  color: var(--sidebar-ink); padding: 9px 12px; border-radius: 9px; font-size: 13.5px; text-decoration: none;
}
.nav-item:hover { background: #1d2733; text-decoration: none; color: #fff; }
.nav-item.active { background: #22324a; color: #fff; box-shadow: inset 3px 0 0 #4f82ff; }
.me { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #26303c; font-size: 12.5px; }
.me-name { color: #fff; font-weight: 600; }
.me-role { color: #8b98a7; margin-bottom: 6px; }
.link { background: none; border: 0; color: #8bb2ff; padding: 0; cursor: pointer; font: inherit; }
.link:hover { text-decoration: underline; }

.main { flex: 1; padding: 22px 26px 60px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; }
.flash.ok { background: #e7f7ee; color: #146c3c; border: 1px solid #bfe8d2; }
.flash.err { background: #fdecec; color: #9b1c1c; border: 1px solid #f5c2c2; }
.flash.warn { background: #fff7e6; color: #8a5a00; border: 1px solid #f3dfb0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card.narrow { max-width: 520px; margin: 40px auto; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.two-col { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; align-items: start; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; font: inherit;
  font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f7f9fc; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--err); border-color: #f3c6c6; }
.btn.danger:hover { background: #fdf2f2; }
.btn.tiny { padding: 4px 8px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
label.wide { grid-column: 1 / -1; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13.5px; padding-top: 20px; white-space: nowrap; }
label.check span { white-space: nowrap; }
input, select, textarea {
  font: inherit; font-size: 13.5px; padding: 8px 10px; border: 1px solid #cfd7e2; border-radius: 9px;
  background: #fff; color: var(--ink); width: 100%;
}
input[type="checkbox"] { width: auto; height: 16px; padding: 0; accent-color: var(--accent); flex: 0 0 auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c9d9ff; border-color: #7ba0ff; }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.form-grid label.wide { grid-column: 1 / -1; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .03em; padding: 8px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 6px 7px; }
.table .thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); }
.unread .email-subject { font-weight: 700; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; text-decoration: none;
}
.chip:hover { background: #f7f9fc; text-decoration: none; }
.chip.active { background: #1b2633; color: #fff; border-color: #1b2633; }
.chip-count { font-size: 11px; opacity: .75; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { display: flex; gap: 8px; align-items: center; min-width: 320px; }
.search input { min-width: 220px; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.status-draft { background: #eef1f5; color: #4a5563; border-color: #dde3ea; }
.status-synced { background: #e8f0ff; color: #1b4bb8; border-color: #c8d8ff; }
.status-partial { background: #fff4e5; color: #8a5a00; border-color: #f3ddb7; }
.status-paid { background: #e7f7ee; color: #146c3c; border-color: #bfe8d2; }
.status-shipped { background: #e9f7f7; color: #0f6b6b; border-color: #bfe6e6; }
.status-cancelled { background: #f3f4f6; color: #6b7280; }
.badge-kp { background: #f0eaff; color: #5b34b8; }
.badge-invoice { background: #e8f0ff; color: #1b4bb8; }
.badge-ready { background: #e7f7ee; color: #146c3c; }
.badge-muted { background: #eef1f5; color: #5c6773; }
.badge-warn { background: #fff4e5; color: #8a5a00; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #d69e2e; margin-left: 3px; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); }
.stat:hover { border-color: #b9c7dc; text-decoration: none; }
.stat-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12.5px; }

.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; margin-bottom: 10px; }
.kv > div { border-bottom: 1px dashed #e7ebf1; padding-bottom: 6px; }
.kv span { display: block; color: var(--muted); font-size: 11.5px; }
.kv b { font-weight: 600; font-size: 13.5px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 7px 0; border-bottom: 1px solid #eef1f5; }
.list li:last-child { border-bottom: 0; }

.email-body {
  white-space: pre-wrap; background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-top: 12px; font-size: 13.5px; max-height: 560px; overflow: auto;
}
.attachments { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.attach { background: #f4f7fb; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; font-size: 12.5px; }
.attach small { color: var(--muted); }

.order-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.order-title { font-size: 22px; font-weight: 700; }
.order-total { text-align: right; }
.order-total span { display: block; color: var(--muted); font-size: 12px; }
.order-total b { font-size: 24px; }
.order-total small { display: block; color: var(--muted); }

.pay-form { display: grid; grid-template-columns: 1.1fr 1fr .9fr 1.6fr auto; gap: 8px; margin: 8px 0 12px; }

.items-edit { width: 100%; border-collapse: collapse; font-size: 13px; }
.items-edit th { text-align: left; font-size: 11px; color: var(--muted); text-transform: uppercase; padding: 6px; }
.items-edit td { padding: 6px 4px; border-top: 1px solid #eef1f5; vertical-align: top; }
.items-edit input, .items-edit textarea { padding: 6px 8px; font-size: 12.5px; border-radius: 7px; }
.items-edit td:nth-child(1) { color: var(--muted); width: 22px; }
.items-edit td:nth-child(2) { width: 110px; }
.items-edit td:nth-child(4) { width: 74px; }
.items-edit td:nth-child(5) { width: 100px; }
.items-edit td:nth-child(6) { width: 130px; }
.items-edit td:nth-child(7) { width: 110px; text-align: right; white-space: nowrap; font-weight: 600; }
.items-edit td:nth-child(8) { width: 30px; }
.items-edit .f-desc { margin-top: 4px; min-height: 38px; color: #3c4653; }
.items-edit .f-name { font-weight: 600; }
.items-edit .opts { margin-top: 4px; }
.items-edit .opts summary { font-size: 11.5px; color: var(--muted); cursor: pointer; }
.opts-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin-top: 5px; }
.items-edit .thumb { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); margin-bottom: 4px; }
.disc { display: grid; gap: 4px; }
.disc input:last-child::placeholder { color: #9aa5b1; }
.items-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; flex-wrap: wrap; }
.totals-mini { font-size: 13px; color: var(--muted); }
.totals-mini b { color: var(--ink); font-size: 15px; }

.search-inline { position: relative; min-width: 320px; }
.search-inline input { min-width: 300px; }
.dropdown { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 12px 30px rgba(16, 24, 40, .14); margin-top: 4px; max-height: 340px; overflow: auto; display: none; }
.dropdown.open { display: block; }
.dropdown button {
  display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border: 0;
  background: #fff; cursor: pointer; font: inherit; font-size: 13px; border-bottom: 1px solid #f1f3f7;
}
.dropdown button:hover { background: #f6f9ff; }
.dropdown img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.dropdown .dd-name { font-weight: 600; }
.dropdown .dd-meta { color: var(--muted); font-size: 11.5px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { padding: 8px 14px; border-radius: 9px; color: var(--muted); font-size: 13.5px; }
.tab:hover { background: #e9eef6; text-decoration: none; }
.tab.active { background: #fff; color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.settings-card { max-width: 1040px; }
.hint { color: var(--muted); font-size: 12px; margin-top: 14px; }
.dropzone {
  border: 1.5px dashed #b9c7dc; border-radius: 12px; background: #f8faff; padding: 18px;
  text-align: center; cursor: pointer; transition: .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: #f1f6ff; }
.dropzone .dz-title { font-size: 14px; margin-bottom: 4px; }
.req-status { margin: 10px 0; padding: 10px 12px; border-radius: 9px; font-size: 13px; }
.req-status.ok { background: #e7f7ee; color: #146c3c; }
.req-status.err { background: #fdecec; color: #9b1c1c; }
.req-status.load { background: #eef3ff; color: #1b4bb8; }

.auth-body { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(1200px 600px at 20% 0%, #e8efff, #f3f5f8 60%); }
.auth-card { width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; box-shadow: 0 20px 60px rgba(16, 24, 40, .08); }
.auth-card h1 { margin-bottom: 16px; font-size: 19px; }
.auth-card .btn { width: 100%; justify-content: center; }

@media (max-width: 1120px) {
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .kv { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app { display: block; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  .brand { padding: 0 8px 0 0; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .me { margin-left: auto; border: 0; padding: 0; }
  .main { padding: 16px; }
  .grid-2, .two-col { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .pay-form { grid-template-columns: 1fr 1fr; }
  .search, .search input, .search-inline, .search-inline input { min-width: 0; width: 100%; }
  .table { display: block; overflow-x: auto; }
}

/* ---- Фирменный стиль Candelabre (по счёту с сайта) ---- */
:root {
  --bg: #f2efe9;
  --card: #ffffff;
  --ink: #23262b;
  --muted: #7b7468;
  --line: #e5e1d8;
  --accent: #a96f1c;
  --accent-dark: #8c5a13;
  --sidebar: #23262b;
  --sidebar-ink: #d6d0c4;
  --ok: #3f7d4f;
  --warn: #b7791f;
  --err: #b23b3b;
  --radius: 13px;
  --cream: #faf7f0;
  --gold: #e9a23b;
}
body { background: #f2efe9; }
a { color: #a96f1c; }
.sidebar {
  background: #23262b;
  border-top: 3px solid var(--gold);
  padding-top: 16px;
}
.brand { display: block; padding: 0 2px 18px; }
.brand-logo {
  display: block; width: 100%; max-width: 176px;
  background: #fff; border-radius: 9px; padding: 7px 9px; box-sizing: border-box;
}
.brand-text small {
  display: block; margin-top: 8px; color: #a9a090; font-size: 10.5px;
  letter-spacing: .12em; text-transform: uppercase;
}
.brand.big .brand-logo { max-width: 240px; background: none; padding: 0; }
.brand.big .brand-text small { color: var(--muted); margin-top: 10px; }
.nav-item { color: #cfc8bb; }
.nav-item:hover { background: #2f3238; color: #fff; }
.nav-item.active { background: #3a3225; color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.me { border-top-color: #373b40; }
.me-role { color: #a9a090; }
.link { color: #e9b45b; }
.topbar { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.topbar h1 { letter-spacing: -.01em; }
.card { border-color: var(--line); box-shadow: 0 1px 2px rgba(60, 45, 20, .04); }
.card-head h2 { position: relative; padding-left: 11px; }
.card-head h2::before {
  content: ""; position: absolute; left: 0; top: 2px; bottom: 2px;
  width: 3px; border-radius: 2px; background: var(--gold);
}
.btn { border-color: var(--line); }
.btn.primary { background: #a96f1c; border-color: #a96f1c; color: #fff; }
.btn.primary:hover { background: #8c5a13; }
.table th {
  color: #8b6a2c; background: var(--cream); border-bottom: 1px solid var(--line);
  padding-top: 9px; padding-bottom: 9px;
}
.table td { border-bottom-color: #efe9de; }
.table tr:hover td { background: #fcfaf5; }
.chip { border-color: var(--line); }
.chip.active { background: #23262b; border-color: #23262b; color: #fff; }
.chip.active .chip-count { color: var(--gold); }
.stat { background: linear-gradient(180deg, #fff 0, #fdfbf6 100%); border-color: var(--line); }
.stat:hover { border-color: #d8c9aa; box-shadow: 0 6px 18px rgba(80, 60, 20, .08); }
.stat-num { color: #23262b; }
.badge.status-synced { background: #fbf1dd; color: #8c5a13; border-color: #eed9b4; }
.badge.status-partial { background: #fdf3e2; color: #9a6200; border-color: #f0dcb6; }
.badge.status-paid { background: #eaf5ec; color: #2f6b3d; border-color: #cbe5d1; }
.badge.status-shipped { background: #eef1f4; color: #3b4652; border-color: #d9e0e7; }
.badge.status-draft { background: #f3f0ea; color: #71695d; border-color: #e2dbcf; }
.badge-kp { background: #fbf1dd; color: #8c5a13; }
.badge-invoice { background: #f3ede1; color: #6f5a33; }
.badge-ready { background: #eaf5ec; color: #2f6b3d; }
.flash.ok { background: #eef6ef; color: #2f6b3d; border-color: #cfe6d3; }
.flash.err { background: #fbeeee; color: #8f2f2f; border-color: #eed3d3; }
.flash.warn { background: #fdf4e3; color: #7c5410; border-color: #efdcb8; }
.auth-body { background: radial-gradient(1000px 600px at 20% 0%, #fbf3e3, #f2efe9 60%); }
.auth-card { border-color: var(--line); box-shadow: 0 24px 70px rgba(70, 50, 20, .12); }
input:focus, select:focus, textarea:focus { outline: 2px solid #f1d9ae; border-color: #c9a76a; }
.tabs .tab.active { border-color: #e2d6be; }
.dropzone { border-color: #d8c9aa; background: #fdfbf6; }
.dropzone:hover, .dropzone.drag { border-color: #c8892f; background: #fbf4e7; }

/* ---- Кнопка «Создать заказ» внизу формы ---- */
.order-submit-bar {
  position: sticky;
  bottom: 14px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 24px 0 12px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #fffaf0 0%, #fdf3e2 100%);
  border: 1px solid #e3cfa8;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(80, 55, 20, .14);
  backdrop-filter: blur(8px);
}
.order-submit-copy { display: flex; flex-direction: column; gap: 3px; }
.order-submit-copy b { font-size: 16px; color: #23262b; }
.order-submit-copy span { font-size: 12.5px; color: #7b7468; }
.order-submit-btn {
  min-width: 230px;
  padding: 15px 36px;
  border: 1px solid #a96f1c;
  background: linear-gradient(135deg, #c8892f 0%, #a96f1c 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(169, 111, 28, .30);
}
.order-submit-btn:hover {
  background: linear-gradient(135deg, #b97a24, #8c5a13);
  transform: translateY(-1px);
}
@media (max-width: 700px) {
  .order-submit-bar { flex-direction: column; align-items: stretch; padding: 16px; bottom: 8px; }
  .order-submit-btn { width: 100%; min-width: 0; padding: 15px; }
}

/* ---- Удобная мобильная версия ---- */
.mobile-bar, .sidebar-overlay { display: none; }

@media (max-width: 900px) {
  body { font-size: 15px; }
  .mobile-bar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 60;
    display: flex; align-items: center; gap: 10px;
    height: 58px; padding: 0 12px;
    background: #23262b; color: #fff;
    border-bottom: 2px solid #e9a23b;
  }
  .mobile-menu {
    width: 42px; height: 42px; flex: 0 0 42px;
    display: grid; place-items: center; align-content: center;
    background: #32353b; border: 1px solid #4a4d53; border-radius: 10px;
    cursor: pointer; padding: 0;
  }
  .mobile-menu span {
    display: block; width: 18px; height: 2px; background: #fff;
    border-radius: 2px; margin: 2px auto;
  }
  .mobile-logo {
    height: 26px; width: auto; max-width: 138px;
    background: #fff; border-radius: 5px; padding: 3px 5px;
  }
  .mobile-page {
    flex: 1 1 auto; min-width: 0; margin-left: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 14px; font-weight: 600; color: #f4efe5;
  }

  body { overflow-x: hidden; }
  .main { padding: 72px 12px 88px; min-width: 0; width: 100%; overflow-x: clip; }
  .order-form { min-width: 0; width: 100%; max-width: calc(100vw - 24px); overflow-x: clip; }
  .topbar { margin-bottom: 12px; }
  .topbar h1 { display: none; }
  .topbar .top-actions { width: 100%; }
  .top-actions .btn { flex: 1 1 auto; }

  .sidebar {
    position: fixed; left: -100%; top: 0; bottom: 0;
    width: min(86vw, 320px); height: 100vh; height: 100dvh;
    z-index: 80; display: flex; flex-direction: column;
    align-items: stretch; flex-wrap: nowrap; gap: 0;
    padding: 18px 14px; overflow-y: auto;
    background: #23262b; box-shadow: 18px 0 45px rgba(20, 18, 15, .35);
    transition: left .22s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar .brand { display: block; padding: 0 4px 16px; }
  .sidebar .brand-logo { max-width: 178px; }
  .sidebar nav { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px; width: 100%; }
  .sidebar .nav-item { padding: 12px 14px; font-size: 15px; border-radius: 10px; }
  .sidebar .me {
    margin-top: auto; padding: 14px 6px 2px;
    border-top: 1px solid #373b40; border-left: 0;
  }
  .sidebar-overlay {
    display: block; position: fixed; inset: 0; z-index: 70;
    background: rgba(20, 18, 15, .52);
    opacity: 0; pointer-events: none; transition: opacity .2s ease;
  }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }

  .card { padding: 14px; border-radius: 12px; width: 100%; max-width: calc(100vw - 24px); min-width: 0; overflow-x: clip; }
  .card-head { gap: 10px; align-items: flex-start; }
  .grid-2, .two-col { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 12px; }
  .stat-num { font-size: 22px; }

  .table { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 0; }
  .table th, .table td { white-space: nowrap; padding: 9px 8px; }
  .table .thumb { width: 40px; height: 40px; }
  .items-edit { display: block; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .chip { flex: 0 0 auto; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search, .search input, .search-inline, .search-inline input { width: 100%; min-width: 0; }
  .search input { font-size: 16px; }

  input, select, textarea { font-size: 16px; padding: 10px 11px; }
  .btn { min-height: 42px; justify-content: center; padding: 9px 13px; }
  .btn.tiny { min-height: 30px; }

  .order-submit-bar {
    position: sticky; bottom: 8px; flex-direction: column;
    align-items: stretch; padding: 14px; gap: 12px;
    max-width: calc(100vw - 24px);
  }
  .order-submit-btn { width: 100%; min-width: 0; }
  .dropzone { padding: 18px 12px; }
  .auth-body { padding: 0; }
  .auth-card { width: calc(100% - 28px); margin: 20px auto; padding: 22px 18px; }
}

@media (max-width: 520px) {
  .main { padding-left: 10px; padding-right: 10px; }
  .mobile-logo { max-width: 108px; }
  .mobile-page { font-size: 13px; }
  .sidebar { width: 88vw; }
}
