:root {
  --blue-950: #062a4d;
  --blue-900: #0a3a6b;
  --blue-800: #0b4f8f;
  --blue-700: #0b63b6;
  --blue-600: #0a7ae0;
  --blue-500: #1e90ff;
  --sky-400: #38bdf8;
  --sky-300: #7dd3fc;
  --sky-100: #e0f2fe;
  --sky-50: #f0f8ff;
  --bg: #f3f8fd;
  --card: #ffffff;
  --text: #0c2340;
  --muted: #6b7f99;
  --line: #e3ecf6;
  --green: #12b886;
  --amber: #f59f00;
  --red: #f03e3e;
  --violet: #7950f2;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(10, 58, 107, 0.06), 0 1px 3px rgba(10, 58, 107, 0.05);
  --shadow: 0 6px 24px rgba(10, 58, 107, 0.08);
  --shadow-lg: 0 24px 64px rgba(6, 42, 77, 0.22);
  --surface: #ffffff;
  --text-soft: #34506f;
  --danger-bg: #fff0f0;
  --danger-bg-hover: #ffe3e3;
  --switch-off: #cfdbe8;
  --backdrop: rgba(6, 42, 77, 0.45);
  --st-new-bg: #e7f3ff;
  --st-accepted-bg: #f3f0ff;
  --st-delivering-bg: #fff8e6;
  --st-delivering: #d9480f;
  --st-done-bg: #e6fcf5;
  --st-done: #099268;
  --st-cancelled-bg: #f1f3f5;
  --st-cancelled: #868e96;
  --stat-blue-bg: #e7f3ff;
  --stat-green-bg: #e6fcf5;
  --stat-violet-bg: #f3f0ff;
  --sidebar-from: var(--blue-700);
  --sidebar-to: var(--blue-900);
  color-scheme: light;
}

/* ---------- Тёмная тема ---------- */
:root[data-theme="dark"] {
  --blue-600: #3b9bff;
  --blue-700: #6cb4ff;
  --blue-800: #8cc8ff;
  --sky-300: #3d78b3;
  --sky-100: #16304f;
  --sky-50: #121f33;
  --bg: #0a111d;
  --card: #131d2e;
  --surface: #131d2e;
  --text: #e8f0fa;
  --text-soft: #b6c6da;
  --muted: #8094ae;
  --line: #22314a;
  --green: #38d9a9;
  --red: #ff6b6b;
  --violet: #9775fa;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.6);
  --danger-bg: rgba(255, 107, 107, 0.12);
  --danger-bg-hover: rgba(255, 107, 107, 0.2);
  --switch-off: #3a4c68;
  --backdrop: rgba(0, 0, 0, 0.6);
  --st-new-bg: rgba(59, 155, 255, 0.16);
  --st-accepted-bg: rgba(151, 117, 250, 0.16);
  --st-delivering-bg: rgba(255, 146, 43, 0.15);
  --st-delivering: #ffa94d;
  --st-done-bg: rgba(56, 217, 169, 0.14);
  --st-done: #63e6be;
  --st-cancelled-bg: rgba(173, 181, 189, 0.14);
  --st-cancelled: #adb5bd;
  --stat-blue-bg: rgba(59, 155, 255, 0.16);
  --stat-green-bg: rgba(56, 217, 169, 0.14);
  --stat-violet-bg: rgba(151, 117, 250, 0.16);
  --sidebar-from: #0f4a8a;
  --sidebar-to: #0a2342;
  color-scheme: dark;
}
:root[data-theme="dark"] .status-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23b6c6da' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); }
:root[data-theme="dark"] .nav a.active { background: rgba(255, 255, 255, 0.95); color: #0b4f8f; }
:root[data-theme="dark"] .lang-switch button.active, :root[data-theme="dark"] .theme-switch button.active { color: #0b4f8f; }
:root[data-theme="dark"] .login { background: radial-gradient(1200px 600px at 10% 0%, #1660b0 0%, transparent 60%), linear-gradient(160deg, #0d3f7a 0%, #0a111d 100%); }
:root[data-theme="dark"] .map-frame { filter: brightness(0.85) contrast(1.05); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--blue-600); text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; }
.brand-drop {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #fff 0%, var(--sky-100) 100%);
  color: var(--blue-600); font-size: 26px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; opacity: 0.7; }
.brand-lg .brand-drop { width: 56px; height: 56px; font-size: 32px; border-radius: 18px;
  background: linear-gradient(140deg, var(--blue-600), var(--sky-400)); color: #fff; }
.brand-lg .brand-name { font-size: 22px; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% 0%, var(--sky-400) 0%, transparent 60%),
              linear-gradient(160deg, var(--blue-600) 0%, var(--blue-900) 100%);
  position: relative; overflow: hidden;
}
.login-waves svg { position: absolute; left: 0; bottom: 0; width: 100%; height: 40vh; }
.login-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 24px; padding: 36px 32px;
  box-shadow: var(--shadow-lg); display: grid; gap: 22px;
}

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: linear-gradient(175deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
  color: #fff; padding: 24px 16px; display: flex; flex-direction: column; gap: 28px;
}
.sidebar .brand { padding: 0 8px; }
.brand-side { flex-direction: column; align-items: flex-start; gap: 6px; }
.brand-side .brand-img { width: 150px; height: auto; display: block; }
.brand-lg { flex-direction: column; align-items: flex-start; gap: 8px; }
.brand-logo { background: linear-gradient(135deg, #0a6fd0, #08346e); border-radius: 18px; padding: 14px 18px; box-shadow: 0 10px 24px rgba(8, 52, 110, 0.25); }
.brand-logo img { width: 170px; height: auto; display: block; }
.sidebar-wave { position: absolute; left: 0; bottom: 0; width: 100%; height: 200px; pointer-events: none; }
.nav { display: grid; gap: 4px; }
.nav a, .nav-logout {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  color: rgba(255, 255, 255, 0.78); font-weight: 600; transition: 0.15s;
  border: 0; background: none; font: inherit; cursor: pointer; text-align: left; width: 100%;
}
.nav a i, .nav-logout i { font-size: 21px; }
.nav a:hover, .nav-logout:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.nav a.active { background: #fff; color: var(--blue-700); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15); }
.sidebar-bottom { margin-top: auto; position: relative; z-index: 1; display: grid; gap: 10px; }
.nav-logout { position: relative; z-index: 1; }

/* Переключатели темы */
.switches { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.theme-switch { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.1); }
.theme-switch button {
  border: 0; background: none; color: rgba(255, 255, 255, 0.75); font-size: 17px; padding: 4px 10px; border-radius: 9px;
  cursor: pointer; transition: 0.15s; flex: 1; display: grid; place-items: center;
}
.theme-switch button:hover { color: #fff; }
.theme-switch button.active { background: #fff; color: var(--blue-700); }
.theme-switch.light { background: var(--sky-50); border: 1px solid var(--line); }
.theme-switch.light button { color: var(--muted); }
.theme-switch.light button.active { background: var(--blue-600); color: #fff; }
.sidebar .theme-switch { display: flex; margin: 0 6px; }

/* Переключатель языка */
.lang-switch { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.1); }
.lang-switch button {
  border: 0; background: none; color: rgba(255, 255, 255, 0.75); font: inherit; font-weight: 800; font-size: 12.5px;
  padding: 6px 10px; border-radius: 9px; cursor: pointer; transition: 0.15s; flex: 1;
}
.lang-switch button:hover { color: #fff; }
.lang-switch button.active { background: #fff; color: var(--blue-700); }
.lang-switch.light { background: var(--sky-50); border: 1px solid var(--line); }
.lang-switch.light button { color: var(--muted); }
.lang-switch.light button.active { background: var(--blue-600); color: #fff; }
.sidebar .lang-switch { display: flex; margin: 0 6px; }
.login-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.mobile-only { display: none !important; }
.info-box { display: flex; gap: 12px; padding: 14px 16px; background: var(--sky-50); border-radius: 12px; color: var(--text-soft); line-height: 1.6; font-size: 13.5px; }
.info-box i { color: var(--blue-600); font-size: 22px; }
.badge {
  margin-left: auto; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 7px;
  display: grid; place-items: center; font-size: 12px; background: var(--sky-400); color: #fff;
}
.nav a.active .badge { background: var(--blue-600); }

.main { padding: 28px 32px 48px; min-width: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { font-size: 26px; font-weight: 800; }
.topbar p { margin: 4px 0 0; }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 10px 16px; font: inherit; font-weight: 700;
  cursor: pointer; transition: 0.15s; white-space: nowrap; background: var(--sky-50); color: var(--blue-700);
}
.btn i { font-size: 18px; }
.btn:hover { background: var(--sky-100); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: linear-gradient(135deg, var(--blue-600), var(--blue-500)); color: #fff; box-shadow: 0 6px 16px rgba(10, 122, 224, 0.3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--blue-700), var(--blue-600)); }
.btn-danger { background: var(--danger-bg); color: var(--red); }
.btn-danger:hover { background: var(--danger-bg-hover); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 20px; font-size: 15.5px; border-radius: 14px; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--sky-50); color: var(--blue-700);
  display: inline-grid; place-items: center; cursor: pointer; font-size: 19px; transition: 0.15s; flex-shrink: 0;
}
.icon-btn:hover { background: var(--sky-100); }
.icon-btn.danger { color: var(--red); background: var(--danger-bg); }
.icon-btn.danger:hover { background: var(--danger-bg-hover); }

.field { display: grid; gap: 7px; }
.field > span { font-weight: 700; font-size: 13px; color: var(--text-soft); }
.field small { color: var(--muted); font-size: 12px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; transition: 0.15s;
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(30, 144, 255, 0.12); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 19px; }
.input-icon input { padding-left: 40px; }
.form-error { color: var(--red); font-weight: 600; min-height: 0; }
.form-error:empty { display: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form { display: grid; gap: 16px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; user-select: none; }
.switch input { display: none; }
.switch i {
  width: 42px; height: 24px; border-radius: 12px; background: var(--switch-off); position: relative; transition: 0.2s; flex-shrink: 0;
}
.switch i::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch input:checked + i { background: var(--blue-500); }
.switch input:checked + i::after { left: 21px; }

/* ---------- Cards ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.card-pad { padding: 22px; }
.card h3 { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.card h3 i { color: var(--blue-600); font-size: 22px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat {
  padding: 18px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
}
.stat-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 24px; flex-shrink: 0; }
.stat-value { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat.hero { background: linear-gradient(135deg, var(--blue-600), var(--sky-400)); color: #fff; border: 0; box-shadow: 0 10px 24px rgba(10, 122, 224, 0.28); }
.stat.hero .stat-label { color: rgba(255, 255, 255, 0.85); }
.stat.hero .stat-icon { background: rgba(255, 255, 255, 0.2); color: #fff; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; background: var(--surface); border: 1px solid var(--line); padding: 5px; border-radius: 14px; overflow-x: auto; max-width: 100%; }
.tabs button {
  border: 0; background: none; padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 700;
  color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center;
}
.tabs button.active { background: var(--sky-100); color: var(--blue-700); }
.tabs button .count { font-size: 11.5px; background: var(--blue-600); color: #fff; padding: 1px 7px; border-radius: 10px; }
.search { min-width: 240px; }

/* ---------- Orders ---------- */
.orders { display: grid; gap: 12px; }
.order {
  display: grid; grid-template-columns: 90px 1.2fr 1.6fr 130px 170px 44px; gap: 16px; align-items: center;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); cursor: pointer; transition: 0.15s; position: relative;
}
.order:hover { border-color: var(--sky-300); box-shadow: var(--shadow); }
.order.is-new::before {
  content: ''; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--blue-500);
}
.order-id { font-weight: 800; font-size: 16px; }
.order-time { font-size: 12px; color: var(--muted); }
.order-name { font-weight: 700; }
.order-phone { color: var(--blue-600); font-weight: 600; font-size: 13.5px; }
.order-addr { color: var(--text-soft); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.order-addr .loc { display: inline-flex; align-items: center; gap: 3px; color: var(--green); font-weight: 700; font-size: 12px; margin-right: 6px; }
.order-total { font-weight: 800; font-size: 15.5px; }
.order-items { font-size: 12px; color: var(--muted); }

.status-select {
  appearance: none; -webkit-appearance: none; border: 0; font-weight: 700; font-size: 13px; padding: 8px 30px 8px 12px; border-radius: 10px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='currentColor' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.st-new { background-color: var(--st-new-bg); color: var(--blue-600); }
.st-accepted { background-color: var(--st-accepted-bg); color: var(--violet); }
.st-delivering { background-color: var(--st-delivering-bg); color: var(--st-delivering); }
.st-done { background-color: var(--st-done-bg); color: var(--st-done); }
.st-cancelled { background-color: var(--st-cancelled-bg); color: var(--st-cancelled); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; white-space: nowrap; border-radius: 999px; font-size: 12px; font-weight: 700; }

.order-detail { display: grid; gap: 18px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { background: var(--sky-50); border-radius: 12px; padding: 12px 14px; }
.detail-item .lbl { font-size: 12px; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.detail-item .val { font-weight: 700; margin-top: 4px; word-break: break-word; white-space: pre-wrap; }
.detail-item.wide { grid-column: 1 / -1; }
.map-frame { width: 100%; height: 240px; border: 0; border-radius: 14px; background: var(--sky-50); }
.items-table { width: 100%; border-collapse: collapse; }
.items-table td { padding: 10px 4px; border-bottom: 1px dashed var(--line); }
.items-table td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.items-table tr.total td { border: 0; font-size: 16px; font-weight: 800; padding-top: 14px; }
.items-table tr.sub td { color: var(--muted); border: 0; padding: 4px; }

/* ---------- Products ---------- */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.product { overflow: hidden; display: flex; flex-direction: column; transition: 0.15s; }
.product:hover { box-shadow: var(--shadow); }
.product.inactive { opacity: 0.62; }
.product-img {
  aspect-ratio: 4 / 3; background: linear-gradient(150deg, var(--sky-100), var(--surface)); position: relative;
  display: grid; place-items: center; color: var(--sky-300); font-size: 64px; overflow: hidden;
}
.product-img img { width: 100%; height: 100%; object-fit: cover; }
.product-img .tags { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.product-img .photos { position: absolute; right: 10px; bottom: 10px; background: rgba(6, 42, 77, 0.6); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 8px; display: flex; align-items: center; gap: 4px; }
.tag { font-size: 11.5px; font-weight: 800; padding: 4px 9px; border-radius: 8px; background: var(--surface); color: var(--blue-700); box-shadow: var(--shadow-sm); }
.tag.red { background: var(--red); color: #fff; }
.tag.gray { background: #495057; color: #fff; }
.product-body { padding: 14px 16px 16px; display: grid; gap: 8px; flex: 1; }
.product-cat { font-size: 12px; font-weight: 700; color: var(--blue-600); text-transform: uppercase; letter-spacing: 0.04em; }
.product-name { font-weight: 800; font-size: 15.5px; line-height: 1.3; }
.price { font-weight: 800; font-size: 17px; color: var(--blue-800); }
.price s { font-weight: 600; color: var(--muted); font-size: 13px; margin-left: 6px; }
.product-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.product-foot .switch { font-size: 12.5px; color: var(--muted); }
.product-foot .actions { display: flex; gap: 6px; }

/* Image uploader */
.uploader { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sky-50); border: 1.5px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .main-tag { position: absolute; left: 6px; bottom: 6px; font-size: 10.5px; font-weight: 800; background: var(--blue-600); color: #fff; padding: 2px 7px; border-radius: 6px; }
.thumb .thumb-actions { position: absolute; top: 5px; right: 5px; display: flex; gap: 4px; opacity: 0; transition: 0.15s; }
.thumb:hover .thumb-actions { opacity: 1; }
.thumb .thumb-actions button { width: 26px; height: 26px; border-radius: 8px; border: 0; background: rgba(255, 255, 255, 0.95); cursor: pointer; display: grid; place-items: center; font-size: 15px; color: var(--blue-700); }
.thumb .thumb-actions button.del { color: var(--red); }
.dropzone {
  aspect-ratio: 1; border-radius: 12px; border: 2px dashed var(--sky-300); background: var(--sky-50);
  display: grid; place-items: center; text-align: center; cursor: pointer; color: var(--blue-600); font-weight: 700; font-size: 12px; transition: 0.15s; padding: 6px;
}
.dropzone i { font-size: 28px; display: block; }
.dropzone:hover, .dropzone.over { background: var(--sky-100); border-color: var(--blue-500); }

/* ---------- Categories ---------- */
.cat-list { display: grid; gap: 10px; }
.cat-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.cat-icon { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(140deg, var(--sky-100), var(--surface)); color: var(--blue-600); display: grid; place-items: center; font-size: 26px; flex-shrink: 0; }
.cat-row .info { flex: 1; min-width: 0; }
.cat-row .name { font-weight: 800; font-size: 15.5px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.icon-grid button { aspect-ratio: 1; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 26px; color: var(--blue-700); cursor: pointer; display: grid; place-items: center; }
.icon-grid button.active { border-color: var(--blue-500); background: var(--sky-100); box-shadow: 0 0 0 3px rgba(30, 144, 255, 0.15); }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.settings .card { display: grid; gap: 18px; }
.settings .span-2 { grid-column: 1 / -1; }
.steps { margin: 0; padding: 14px 16px 14px 34px; background: var(--sky-50); border-radius: 12px; color: var(--text-soft); line-height: 1.7; font-size: 13.5px; }
.steps code { background: var(--surface); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; }
.recipients { display: grid; gap: 8px; }
.recipient { display: grid; grid-template-columns: 1fr 1fr 36px; gap: 8px; align-items: center; }
.discovered { display: grid; gap: 8px; }
.discovered .row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--sky-50); border-radius: 12px; }
.discovered .row .info { flex: 1; min-width: 0; }
.discovered .row .info b { display: block; }
.discovered .row .info small { color: var(--muted); }

/* ---------- Empty / loading ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty i { font-size: 56px; color: var(--sky-300); display: block; margin-bottom: 8px; }
.empty b { color: var(--text); font-size: 16px; display: block; margin-bottom: 4px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--sky-100); border-top-color: var(--blue-500); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); backdrop-filter: blur(3px); animation: fade 0.15s; }
.modal-card {
  position: relative; width: 100%; max-width: 640px; max-height: calc(100vh - 40px); overflow: auto;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg); animation: pop 0.18s ease-out;
}
.modal-card.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { font-size: 19px; font-weight: 800; }
.modal-body { padding: 22px 24px 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: 14px; background: var(--blue-950); color: #fff;
  box-shadow: var(--shadow-lg); font-weight: 600; animation: pop 0.2s ease-out; max-width: 360px;
}
.toast i { font-size: 20px; color: var(--sky-300); }
.toast.error i { color: #ff8787; }
.toast.success i { color: #63e6be; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .order { grid-template-columns: 80px 1fr 1.3fr 120px; }
  .order .order-status-cell { grid-column: 2 / 4; }
  .order .order-more { display: none; }
}
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .settings { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 40;
    flex-direction: row; padding: 8px; gap: 0; border-radius: 20px 20px 0 0;
  }
  .sidebar .brand, .sidebar-wave, .sidebar .lang-switch, .sidebar .theme-switch { display: none !important; }
  .sidebar-bottom { margin: 0; }
  .mobile-only { display: inline-flex !important; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; flex: 1; }
  .nav a, .nav-logout { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: 11px; text-align: center; }
  .nav-logout { width: auto; margin: 0; padding: 8px 12px; }
  .badge { position: absolute; margin: 0 0 0 22px; min-width: 18px; height: 18px; font-size: 10.5px; }
  .nav a { position: relative; }
  .main { padding: 20px 16px 100px; }
  .order { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .order > * { grid-column: auto !important; }
  .order .order-addr-cell { grid-column: 1 / -1 !important; }
  .grid-2, .grid-3, .detail-grid { grid-template-columns: 1fr; }
  .search { min-width: 0; flex: 1; }
  .modal { padding: 0; align-items: end; }
  .modal-card { border-radius: 22px 22px 0 0; max-height: 92vh; }
  .recipient { grid-template-columns: 1fr 36px; }
  .recipient input:nth-child(2) { grid-row: 2; }
}
