:root {
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #16181f;
  --muted: #6b7280;
  --line: #e5e7eb;
  --border: #e5e7eb;
  --soft: #f8fafc;
  --card-soft: #f8fafc;
  --primary: #111827;
  --primary-soft: #eef2ff;
  --danger: #b91c1c;
  --success: #166534;
  --radius: 18px;
  --shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(245, 246, 251, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: white;
  background: var(--primary);
  font-weight: 800;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topnav a {
  padding: 9px 12px;
  color: var(--muted);
  border-radius: 12px;
}

.topnav a:hover {
  background: white;
  color: var(--text);
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero,
.restaurant-hero,
.admin-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.hero {
  padding: clamp(26px, 6vw, 62px);
  background: radial-gradient(circle at 20% 20%, #ffffff 0, #ffffff 30%, #eef2ff 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero h1,
.restaurant-hero h1,
.admin-head h1 {
  margin: 0;
  font-size: clamp(32px, 6vw, 62px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.hero-text {
  max-width: 680px;
  color: var(--muted);
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 28px 0 16px;
}

.section-head h2,
.menu-section h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.section-head p,
.muted {
  color: var(--muted);
}

.restaurant-grid,
.menu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

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

.restaurant-card,
.dish-card,
.order-card {
  padding: 20px;
}

.restaurant-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-badge {
  width: fit-content;
  padding: 7px 10px;
  background: var(--primary-soft);
  border-radius: 999px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.card h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.meta-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
}

.meta-row span {
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 11px 16px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-weight: 750;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-secondary {
  background: #eef2f7;
  color: var(--primary);
}

.btn-small {
  min-height: 36px;
  padding: 8px 12px;
  background: var(--primary);
  color: white;
}

.btn.disabled,
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.restaurant-hero {
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
}

.back-link {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

.cart-box {
  position: sticky;
  top: 90px;
  padding: 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cart-box h3 {
  margin: 0 0 12px;
}

.cart-preview {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.cart-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
  border-radius: 12px;
}

.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.qty-controls button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  background: #e5e7eb;
  font-weight: 800;
}

.empty {
  color: var(--muted);
}

.menu-section {
  margin: 30px 0;
}

.menu-section h2 {
  margin-bottom: 14px;
}

.dish-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 180px;
}

.dish-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.dish-footer strong {
  font-size: 18px;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  align-items: start;
}

.checkout-card,
.success-card,
.admin-detail {
  padding: 24px;
}

.checkout-card h1,
.checkout-card h2,
.success-card h1,
.admin-detail h1 {
  margin-top: 0;
  letter-spacing: -0.04em;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: white;
}

.checkout-cart,
.order-items {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.order-item,
.checkout-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 14px;
}

.totals {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.totals div,
.order-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.total-line {
  font-size: 20px;
}

.alert {
  padding: 13px 14px;
  border-radius: 14px;
  margin-bottom: 16px;
}

.alert-danger {
  color: var(--danger);
  background: #fee2e2;
}

.hidden {
  display: none !important;
}

.input-error {
  border-color: var(--danger) !important;
  background: #fff1f2 !important;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.12);
}

.success-card {
  max-width: 760px;
  margin: 0 auto;
}

.success-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  color: white;
  background: var(--success);
  border-radius: 22px;
  font-size: 32px;
  font-weight: 900;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.summary-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 14px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  margin-bottom: 18px;
}

.orders-list {
  display: grid;
  gap: 14px;
}

.order-card-main {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.status {
  display: inline-flex;
  width: fit-content;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  background: #eef2f7;
}

.status-new { background: #dbeafe; }
.status-accepted { background: #dcfce7; }
.status-cooking { background: #fef3c7; }
.status-ready { background: #e0e7ff; }
.status-warning { background: #fef3c7; }
.status-done { background: #dcfce7; }
.status-cancelled { background: #fee2e2; }

.status-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  margin: 18px 0;
}

.empty-state {
  padding: 26px;
  color: var(--muted);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 34px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 14px;
}

@media (max-width: 900px) {
  .restaurant-grid,
  .menu-grid,
  .restaurant-hero,
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .cart-box {
    position: static;
  }

  .summary-grid.compact,
  .summary-grid,
  .filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar,
  .footer,
  .section-head,
  .order-card-main {
    flex-direction: column;
    align-items: stretch;
  }

  .topnav {
    width: 100%;
  }

  .topnav a {
    flex: 1;
    text-align: center;
    background: white;
  }

  .page {
    width: min(100% - 22px, 1120px);
    padding-top: 16px;
  }

  .hero {
    border-radius: 22px;
  }
}

.alert-success {
  color: var(--success);
  background: #dcfce7;
}

.notice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.notice-card span {
  color: var(--muted);
}

.notice-warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.notice-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.settings-card {
  padding: 22px;
}

.settings-card h2 {
  margin: 0 0 16px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.settings-card label {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
  font-weight: 750;
}

.settings-card input[type="text"],
.settings-card input:not([type]),
.settings-card input[name="telegram_bot_token"],
.settings-card input[name="telegram_chat_id"] {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #f8fafc;
}

.settings-card small {
  color: var(--muted);
  font-weight: 500;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 10px !important;
  padding: 12px;
  background: #f8fafc;
  border-radius: 14px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.steps-list {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding-left: 20px;
  color: var(--muted);
}

.steps-list strong {
  color: var(--text);
}

.settings-alert {
  margin-top: 16px;
}

.chat-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.chat-list h3 {
  margin: 0;
}

.chat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 14px;
}

.chat-item div {
  display: grid;
  gap: 4px;
}

.chat-item span {
  color: var(--muted);
  font-size: 13px;
}

.chat-item code {
  padding: 7px 9px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
}

.test-card {
  margin-top: 18px;
}

@media (max-width: 900px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .notice-card {
    flex-direction: column;
    align-items: stretch;
  }
}


/* v4 admin restaurants/menu */
.split-head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.head-actions { justify-content: flex-end; }
.admin-grid, .menu-admin-list { display: grid; gap: 18px; }
.admin-entity-card, .category-admin-card, .admin-form { padding: 22px; }
.entity-top, .category-admin-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.entity-top h3 { margin-top: 12px; }
.entity-stats { margin: 16px 0; }
.muted-card { opacity: 0.64; }
.form-grid { display: grid; gap: 14px; }
.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-form small { color: var(--muted); font-weight: 500; }
.checkbox-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.compact-form h2, .category-admin-card h3 { margin: 0 0 14px; letter-spacing: -0.03em; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 12px; align-items: end; }
.category-form { flex: 1; }
.item-list { display: grid; gap: 10px; margin: 18px 0; }
.menu-item-form { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(240px, 1.4fr) 110px 150px 120px; gap: 10px; align-items: end; padding: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 16px; }
.menu-item-form label, .inline-form label { margin-bottom: 0; }
.item-check { margin: 0 !important; }
.item-actions { margin-top: 0; padding-left: 12px; }
.add-item-box { padding: 16px; background: #fbfdff; border: 1px dashed var(--line); border-radius: 18px; }
.btn-danger { background: #fee2e2; color: var(--danger); }
@media (max-width: 980px) {
  .split-head, .two-cols, .checkbox-grid, .inline-form, .menu-item-form { grid-template-columns: 1fr; }
  .category-admin-head, .entity-top { flex-direction: column; align-items: stretch; }
  .head-actions { justify-content: stretch; }
}


/* v5 auth */
.user-pill {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  color: var(--primary);
  background: white;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}
.auth-shell {
  display: grid;
  place-items: start center;
  min-height: 64vh;
  padding-top: 26px;
}
.auth-card {
  width: min(520px, 100%);
  padding: clamp(22px, 4vw, 34px);
}
.auth-shell-card {
  margin: 40px auto;
}
.auth-card h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}
.auth-card .btn {
  width: 100%;
  margin-top: 4px;
}
.demo-logins {
  display: grid;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.demo-logins h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.03em;
}
.demo-logins div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 13px;
}
.demo-logins span {
  color: var(--muted);
  font-weight: 700;
}
.demo-logins code {
  padding: 5px 8px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13px;
}
@media (max-width: 560px) {
  .user-pill {
    justify-content: center;
  }
  .demo-logins div {
    align-items: stretch;
    flex-direction: column;
  }
}


/* v5 access management */
.access-card { display: grid; gap: 14px; }
.access-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: end; }
.access-password-form { grid-template-columns: minmax(0, 1fr) auto; }
@media (max-width: 760px) {
  .access-actions, .access-password-form { grid-template-columns: 1fr; }
}


/* v6 responsive: один сайт для desktop + mobile, без отдельной мобильной версии */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
}

img,
svg {
  max-width: 100%;
}

.topbar {
  flex-wrap: wrap;
}

.topnav {
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topnav a,
.user-pill {
  white-space: nowrap;
}

.btn,
.qty-controls button,
input,
select,
textarea {
  touch-action: manipulation;
}

@media (max-width: 1100px) {
  .restaurant-grid,
  .menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .restaurant-grid,
  .menu-grid,
  .restaurant-hero,
  .checkout-layout,
  .settings-grid,
  .summary-grid,
  .summary-grid.compact,
  .filters,
  .split-head,
  .two-cols,
  .checkbox-grid,
  .inline-form,
  .menu-item-form,
  .access-actions,
  .access-password-form {
    grid-template-columns: 1fr;
  }

  .category-admin-head,
  .entity-top,
  .notice-card {
    flex-direction: column;
    align-items: stretch;
  }

  .head-actions {
    justify-content: stretch;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand {
    width: 100%;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }

  .topnav {
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .topnav::-webkit-scrollbar {
    display: none;
  }

  .topnav a,
  .user-pill {
    flex: 0 0 auto;
    padding: 8px 11px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
  }

  .page {
    width: calc(100% - 22px);
    padding: 16px 0 42px;
  }

  .hero,
  .restaurant-hero,
  .admin-head {
    margin-bottom: 18px;
  }

  .hero {
    padding: 22px;
    border-radius: 22px;
  }

  .hero h1,
  .restaurant-hero h1,
  .admin-head h1 {
    font-size: clamp(30px, 10vw, 44px);
    line-height: 0.98;
  }

  .hero-text {
    font-size: 16px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    margin: 22px 0 12px;
  }

  .restaurant-grid,
  .menu-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .restaurant-card,
  .dish-card,
  .order-card,
  .checkout-card,
  .success-card,
  .admin-detail,
  .settings-card,
  .admin-entity-card,
  .category-admin-card,
  .admin-form {
    padding: 16px;
    border-radius: 16px;
  }

  .card h3 {
    font-size: 19px;
  }

  .meta-list {
    gap: 7px;
  }

  .meta-row {
    gap: 7px;
  }

  .meta-row span {
    width: 100%;
    padding: 9px 10px;
    border-radius: 13px;
  }

  .btn {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
  }

  .actions-row,
  .head-actions {
    width: 100%;
    gap: 8px;
  }

  .actions-row .btn,
  .head-actions .btn {
    flex: 1 1 100%;
  }

  .restaurant-hero {
    gap: 14px;
  }

  .cart-box {
    position: sticky;
    top: 104px;
    z-index: 12;
    max-height: 62vh;
    overflow: auto;
    padding: 14px;
    border-radius: 16px;
  }

  .cart-box h3 {
    margin-bottom: 8px;
  }

  .cart-preview {
    gap: 8px;
  }

  .cart-line {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
  }

  .cart-line:last-child {
    align-items: center;
    flex-direction: row;
  }

  .qty-controls {
    justify-content: space-between;
    width: 100%;
  }

  .qty-controls button {
    width: 42px;
    height: 38px;
    border-radius: 12px;
    font-size: 18px;
  }

  .dish-card {
    min-height: auto;
  }

  .dish-footer {
    align-items: stretch;
    flex-direction: column;
    margin-top: 14px;
  }

  .dish-footer strong {
    font-size: 20px;
  }

  .checkout-layout {
    gap: 12px;
  }

  .checkout-card h1,
  .checkout-card h2,
  .success-card h1,
  .admin-detail h1 {
    font-size: clamp(28px, 10vw, 38px);
  }

  label {
    gap: 6px;
    margin-bottom: 12px;
  }

  input,
  select,
  textarea {
    padding: 13px 12px;
    border-radius: 12px;
    font-size: 16px;
  }

  .order-item,
  .checkout-item {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .summary-grid,
  .summary-grid.compact {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .filters {
    padding: 14px;
  }

  .order-card-main,
  .entity-top,
  .category-admin-head,
  .notice-card,
  .chat-item {
    align-items: stretch;
    flex-direction: column;
  }

  .status-form,
  .inline-form,
  .menu-item-form,
  .access-actions,
  .access-password-form {
    grid-template-columns: 1fr;
  }

  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .demo-logins div,
  .chat-item {
    align-items: stretch;
  }

  .chat-item code {
    max-width: 100%;
    overflow-x: auto;
  }

  .footer {
    width: calc(100% - 20px);
    align-items: stretch;
    flex-direction: column;
    padding: 18px 0 26px;
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 9px 10px;
  }

  .topnav a,
  .user-pill {
    padding: 8px 10px;
    font-size: 12px;
  }

  .page {
    width: calc(100% - 16px);
  }

  .hero {
    padding: 18px;
  }

  .restaurant-card,
  .dish-card,
  .order-card,
  .checkout-card,
  .success-card,
  .admin-detail,
  .settings-card,
  .admin-entity-card,
  .category-admin-card,
  .admin-form {
    padding: 14px;
  }

  .cart-box {
    top: 96px;
    max-height: 58vh;
  }

  .brand-logo {
    width: 34px;
    height: 34px;
  }
}

/* v7: regional marketplace + restaurant logo placeholders */
.regional-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 18px;
  align-items: stretch;
}

.hero-panel {
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 22px;
  padding: 22px;
  background: rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 130px;
}

.hero-panel strong {
  font-size: 44px;
  line-height: 1;
}

.hero-panel span {
  color: rgba(255,255,255,0.76);
  margin-top: 8px;
}

.region-filter-card {
  margin-bottom: 26px;
}

.region-filter {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(180px, 1fr) auto auto;
  gap: 12px;
  align-items: end;
}

.location-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--soft);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.restaurant-card-head,
.restaurant-title-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.restaurant-title-row {
  margin-bottom: 8px;
}

.compact-title-row {
  margin-top: 6px;
}

.restaurant-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, #111827, #374151);
  color: white;
  font-weight: 900;
  letter-spacing: .03em;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.16);
  overflow: hidden;
}

.restaurant-logo.large {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  font-size: 22px;
}

.restaurant-logo.small {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  font-size: 14px;
}

.restaurant-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-logo-head {
  align-items: flex-start;
}

.location-summary-grid small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 600;
}

.wide-card {
  grid-column: 1 / -1;
}

@media (max-width: 840px) {
  .regional-hero {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
  }

  .region-filter {
    grid-template-columns: 1fr;
  }

  .restaurant-title-row {
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .restaurant-logo {
    width: 50px;
    height: 50px;
    border-radius: 16px;
  }

  .restaurant-logo.large {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    font-size: 18px;
  }

  .hero-panel strong {
    font-size: 36px;
  }
}

/* v8: корзина внизу страницы ресторана, компактнее и спокойнее */
.restaurant-hero {
  grid-template-columns: 1fr;
}

.cart-section {
  margin: 34px 0 10px;
}

.cart-compact {
  position: static;
  top: auto;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(240px, 2fr) auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
}

.cart-compact-head h3 {
  margin: 0 0 5px;
}

.cart-compact-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.cart-compact .cart-preview {
  gap: 7px;
  margin: 0;
}

.cart-compact .cart-line {
  padding: 8px 10px;
  border-radius: 11px;
}

.cart-compact .cart-line strong {
  font-size: 14px;
}

.cart-compact small {
  color: var(--muted);
}

.cart-compact .qty-controls button {
  width: 26px;
  height: 26px;
}

.cart-actions {
  display: grid;
  gap: 8px;
  min-width: 130px;
}

@media (max-width: 820px) {
  .cart-compact {
    grid-template-columns: 1fr;
  }

  .cart-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 460px) {
  .cart-actions {
    grid-template-columns: 1fr;
  }
}

/* v9: пилотный каркас, реквизиты, чеки оплаты, режим приема заказов */
.payment-transfer-box {
  display: none;
  gap: 12px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  background: #fff7ed;
}

.payment-transfer-box.visible {
  display: grid;
}

.payment-transfer-box h3 {
  margin: 0;
}

.payment-transfer-box pre,
.payment-info-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  padding: 12px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  font: inherit;
  line-height: 1.45;
}

.payment-transfer-box input[type="file"] {
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.payment-info-card {
  margin: 18px 0;
}

.status-stack {
  display: grid;
  gap: 6px;
  justify-items: end;
}

@media (max-width: 620px) {
  .status-stack {
    justify-items: start;
  }
}

/* owner-control */
.onboarding-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin: 18px 0;
}
.onboarding-card h2 { margin-top: 0; }
.copy-list { display: grid; gap: 12px; }
.copy-list input { cursor: copy; }
.checklist-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0 18px; }
.check-row { display: flex; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 16px; padding: 12px; background: var(--card-soft); }
.check-row span { width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 900; }
.check-row p { margin: 0; }
.check-row.ok span { background: rgba(31, 164, 101, .15); color: #1fa465; }
.check-row.warn span { background: rgba(234, 179, 8, .18); color: #a16207; }
.check-row.bad span { background: rgba(239, 68, 68, .14); color: #dc2626; }
@media (max-width: 760px) {
  .onboarding-grid, .checklist-grid { grid-template-columns: 1fr; }
}

.pilot-missing {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #fde68a;
  border-radius: 14px;
  background: #fffbeb;
  color: #92400e;
  font-size: 14px;
}
.pilot-missing strong { color: #78350f; }

/* pilot polish: QR, logos, cleaner pilot cards */
.logo-upload-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-soft);
}

.logo-upload-card .checkbox-line {
  grid-column: 1 / -1;
  margin: 0;
}

.qr-preview-card {
  min-height: 100%;
}

.qr-preview-box {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.qr-preview-box img {
  width: 132px;
  height: 132px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.qr-print-card {
  max-width: 920px;
  margin: 0 auto;
  padding: 30px;
}

.qr-print-head {
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.qr-print-body {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.qr-large {
  width: 100%;
  max-width: 320px;
  padding: 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 24px;
}

@media (max-width: 760px) {
  .logo-upload-card,
  .qr-preview-box,
  .qr-print-body {
    grid-template-columns: 1fr;
  }

  .qr-preview-box img,
  .qr-large {
    width: 220px;
    max-width: 100%;
  }
}

@media print {
  body {
    background: white;
  }

  .topbar,
  .footer,
  .back-link,
  .no-print {
    display: none !important;
  }

  .page {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .qr-print-card {
    box-shadow: none;
    border: 0;
  }
}

/* пилотная полировка, QR и настоящие логотипы */
.logo-upload-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-soft);
}

.logo-upload-card label {
  margin: 0;
}

.logo-upload-card input[type="file"] {
  padding: 11px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.qr-preview-card {
  grid-column: 1 / -1;
}

.qr-preview-box {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.qr-preview-box img {
  width: 156px;
  height: 156px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px;
}

.qr-print-card {
  max-width: 900px;
  margin: 0 auto;
}

.qr-print-head {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.qr-print-body {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.qr-large {
  width: 280px;
  height: 280px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fff;
  padding: 14px;
}

.qr-restaurant-card {
  margin: 18px 0;
}

@media (max-width: 700px) {
  .logo-upload-card,
  .qr-preview-box,
  .qr-print-body {
    grid-template-columns: 1fr;
  }

  .qr-preview-box img,
  .qr-large {
    width: min(260px, 100%);
    height: auto;
  }
}

@media print {
  .topbar, .footer, .back-link, .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .page {
    max-width: 100%;
    padding: 0;
  }

  .qr-print-card {
    box-shadow: none;
    border: 2px solid #111827;
  }
}

.qr-restaurant-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
  align-items: center;
  padding: 22px;
  margin: 18px 0;
}

.qr-mini-box {
  display: grid;
  place-items: center;
}

.qr-mini-box img {
  width: 156px;
  height: 156px;
  padding: 8px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
}

@media (max-width: 760px) {
  .qr-restaurant-card {
    grid-template-columns: 1fr;
  }

  .qr-mini-box {
    justify-content: start;
  }
}

/* v13 pilot pack */
.pilot-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.pilot-pack-card.needs-work {
  border-color: rgba(245, 158, 11, 0.45);
}

.pilot-pack-head,
.pilot-qr-row,
.onboarding-qr-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.pilot-pack-head {
  justify-content: space-between;
}

.qr-thumb {
  width: 132px;
  height: 132px;
  object-fit: contain;
  border-radius: 18px;
  background: #fff;
  padding: 8px;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}

.copy-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-field input {
  min-width: 0;
}

.btn-mini {
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.compact-copy label {
  margin-bottom: 8px;
}

@media (max-width: 760px) {
  .pilot-pack-head,
  .pilot-qr-row,
  .onboarding-qr-row,
  .copy-field {
    flex-direction: column;
  }

  .copy-field {
    align-items: stretch;
  }

  .qr-thumb {
    width: 148px;
    height: 148px;
  }
}

/* v13 pilot pack / owner workflow */
.pilot-summary-grid {
  margin-bottom: 18px;
}

.pilot-status-card,
.pilot-workflow-table-card {
  padding: 20px;
  margin-bottom: 18px;
}

.pilot-status-card {
  display: grid;
  gap: 14px;
}

.pilot-status-card h2,
.pilot-workflow-table-card h2 {
  margin: 10px 0 0;
}

.pilot-progress {
  height: 12px;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 999px;
}

.pilot-progress.small {
  height: 9px;
  margin: 14px 0;
}

.pilot-progress div {
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.pilot-restaurant-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.copy-textarea {
  width: 100%;
  min-height: 260px;
  padding: 14px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-soft);
  color: var(--text);
}

.inline-form {
  margin: 4px 0 12px;
}

.onboarding-password-copy {
  margin: 12px 0;
}

.manual-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.manual-check {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card-soft);
  font-weight: 700;
}

.manual-check input {
  width: 18px;
  height: 18px;
}

.pilot-checklist-form textarea {
  width: 100%;
  margin-top: 8px;
}

.pilot-workflow-table {
  display: grid;
  gap: 8px;
}

.pilot-workflow-row {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr .8fr .8fr .8fr 1.4fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card-soft);
}

.pilot-workflow-row.head {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pilot-workflow-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.pilot-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-row {
  position: relative;
}

.check-row .btn-mini {
  margin-left: auto;
}

@media (max-width: 980px) {
  .pilot-restaurant-layout,
  .manual-check-grid {
    grid-template-columns: 1fr;
  }

  .pilot-workflow-row,
  .pilot-workflow-row.head {
    grid-template-columns: 1fr;
  }

  .pilot-workflow-row.head {
    display: none;
  }
}


/* v16 live polish: clean login + light/dark theme */
:root {
  --field: #f8fafc;
  --field-focus: #ffffff;
  --chip: #ffffff;
  --chip-soft: #f8fafc;
  --topbar-bg: rgba(245, 246, 251, 0.9);
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --card: #111827;
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: #273449;
  --border: #273449;
  --soft: #172033;
  --card-soft: #172033;
  --primary: #f8fafc;
  --primary-soft: #1e293b;
  --danger: #fca5a5;
  --success: #86efac;
  --field: #172033;
  --field-focus: #1e293b;
  --chip: #172033;
  --chip-soft: #0b1220;
  --topbar-bg: rgba(15, 23, 42, 0.92);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.32);
}

.topbar { background: var(--topbar-bg); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 12px;
  color: var(--muted);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  white-space: nowrap;
}

.theme-toggle:hover { color: var(--text); transform: translateY(-1px); }

input, select, textarea,
.settings-card input[type="text"],
.settings-card input:not([type]),
.settings-card input[name="telegram_bot_token"],
.settings-card input[name="telegram_chat_id"] { background: var(--field); }

input:focus, select:focus, textarea:focus { background: var(--field-focus); }

html[data-theme="dark"] .hero { background: radial-gradient(circle at 20% 20%, #1f2937 0, #111827 38%, #0f172a 100%); }
html[data-theme="dark"] .brand-logo,
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-small { background: #f8fafc; color: #111827; }
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .status,
html[data-theme="dark"] .card-badge,
html[data-theme="dark"] .qty-controls button { background: #1e293b; color: #f8fafc; }
html[data-theme="dark"] .topnav a:hover,
html[data-theme="dark"] .user-pill,
html[data-theme="dark"] .cart-box,
html[data-theme="dark"] .meta-row span,
html[data-theme="dark"] .summary-grid div,
html[data-theme="dark"] .order-item,
html[data-theme="dark"] .checkout-item,
html[data-theme="dark"] .cart-line,
html[data-theme="dark"] .checkbox-line,
html[data-theme="dark"] .chat-item,
html[data-theme="dark"] .chat-item code,
html[data-theme="dark"] .menu-item-form,
html[data-theme="dark"] .add-item-box { background: var(--chip-soft); color: var(--text); }
html[data-theme="dark"] .alert-danger { color: #fecaca; background: rgba(127, 29, 29, 0.48); }
html[data-theme="dark"] .alert-success,
html[data-theme="dark"] .notice-success { color: #bbf7d0; background: rgba(20, 83, 45, 0.42); }
html[data-theme="dark"] .notice-warning,
html[data-theme="dark"] .status-warning { color: #fde68a; background: rgba(113, 63, 18, 0.42); }
html[data-theme="dark"] pre,
html[data-theme="dark"] code { color: #e2e8f0; background: #0b1220; border-color: var(--line); }
html[data-theme="dark"] .demo-logins { display: none; }

@media (max-width: 560px) { .theme-toggle { flex: 1; } }


/* v17 theme cache fix + PWA install UI */
:root {
  --field: #f8fafc;
  --field-focus: #ffffff;
  --chip: #ffffff;
  --chip-soft: #f8fafc;
  --topbar-bg: rgba(245, 246, 251, 0.9);
}

html[data-theme="dark"],
html.theme-dark {
  color-scheme: dark;
  --bg: #0f172a;
  --card: #111827;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: #273449;
  --border: #273449;
  --soft: #172033;
  --card-soft: #172033;
  --primary: #f8fafc;
  --primary-soft: #1e293b;
  --danger: #fca5a5;
  --success: #86efac;
  --field: #172033;
  --field-focus: #1e293b;
  --chip: #172033;
  --chip-soft: #0b1220;
  --topbar-bg: rgba(15, 23, 42, 0.94);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] body,
html.theme-dark body {
  background: var(--bg) !important;
  color: var(--text) !important;
}

.topbar { background: var(--topbar-bg); }

.theme-toggle,
.install-toggle,
.install-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 12px;
  color: var(--muted);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  white-space: nowrap;
}

.theme-toggle:hover,
.install-toggle:hover,
.install-close:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.install-toggle[hidden],
.install-panel[hidden] { display: none !important; }

.install-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: grid;
  gap: 12px;
  width: min(420px, calc(100% - 32px));
  padding: 16px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.install-panel strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.install-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.42;
}

.install-close {
  width: fit-content;
  color: var(--text);
}

html[data-theme="dark"] .topbar,
html.theme-dark .topbar {
  background: var(--topbar-bg) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .restaurant-card,
html[data-theme="dark"] .dish-card,
html[data-theme="dark"] .order-card,
html[data-theme="dark"] .checkout-card,
html[data-theme="dark"] .success-card,
html[data-theme="dark"] .admin-detail,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .admin-entity-card,
html[data-theme="dark"] .category-admin-card,
html[data-theme="dark"] .admin-form,
html[data-theme="dark"] .notice-card,
html[data-theme="dark"] .auth-card,
html.theme-dark .card,
html.theme-dark .restaurant-card,
html.theme-dark .dish-card,
html.theme-dark .order-card,
html.theme-dark .checkout-card,
html.theme-dark .success-card,
html.theme-dark .admin-detail,
html.theme-dark .settings-card,
html.theme-dark .admin-entity-card,
html.theme-dark .category-admin-card,
html.theme-dark .admin-form,
html.theme-dark .notice-card,
html.theme-dark .auth-card {
  background: var(--card) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .hero,
html.theme-dark .hero {
  background: radial-gradient(circle at 20% 20%, #1f2937 0, #111827 38%, #0f172a 100%) !important;
}

html[data-theme="dark"] .topnav a,
html[data-theme="dark"] .user-pill,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .install-toggle,
html.theme-dark .topnav a,
html.theme-dark .user-pill,
html.theme-dark .theme-toggle,
html.theme-dark .install-toggle {
  background: var(--chip) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .brand-logo,
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .btn-small,
html.theme-dark .brand-logo,
html.theme-dark .btn-primary,
html.theme-dark .btn-small {
  background: #f8fafc !important;
  color: #111827 !important;
}

html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .status,
html[data-theme="dark"] .card-badge,
html[data-theme="dark"] .qty-controls button,
html.theme-dark .btn-secondary,
html.theme-dark .status,
html.theme-dark .card-badge,
html.theme-dark .qty-controls button {
  background: #1e293b !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .settings-card input[type="text"],
html[data-theme="dark"] .settings-card input:not([type]),
html[data-theme="dark"] .settings-card input[name="telegram_bot_token"],
html[data-theme="dark"] .settings-card input[name="telegram_chat_id"],
html.theme-dark input,
html.theme-dark select,
html.theme-dark textarea,
html.theme-dark .settings-card input[type="text"],
html.theme-dark .settings-card input:not([type]),
html.theme-dark .settings-card input[name="telegram_bot_token"],
html.theme-dark .settings-card input[name="telegram_chat_id"] {
  background: var(--field) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus,
html.theme-dark input:focus,
html.theme-dark select:focus,
html.theme-dark textarea:focus {
  background: var(--field-focus) !important;
}

html[data-theme="dark"] .cart-box,
html[data-theme="dark"] .meta-row span,
html[data-theme="dark"] .summary-grid div,
html[data-theme="dark"] .order-item,
html[data-theme="dark"] .checkout-item,
html[data-theme="dark"] .cart-line,
html[data-theme="dark"] .checkbox-line,
html[data-theme="dark"] .chat-item,
html[data-theme="dark"] .chat-item code,
html[data-theme="dark"] .menu-item-form,
html[data-theme="dark"] .add-item-box,
html[data-theme="dark"] .pilot-progress,
html[data-theme="dark"] .copy-textarea,
html[data-theme="dark"] .manual-check,
html[data-theme="dark"] .pilot-workflow-row,
html[data-theme="dark"] .payment-transfer-box,
html[data-theme="dark"] .payment-info-card pre,
html.theme-dark .cart-box,
html.theme-dark .meta-row span,
html.theme-dark .summary-grid div,
html.theme-dark .order-item,
html.theme-dark .checkout-item,
html.theme-dark .cart-line,
html.theme-dark .checkbox-line,
html.theme-dark .chat-item,
html.theme-dark .chat-item code,
html.theme-dark .menu-item-form,
html.theme-dark .add-item-box,
html.theme-dark .pilot-progress,
html.theme-dark .copy-textarea,
html.theme-dark .manual-check,
html.theme-dark .pilot-workflow-row,
html.theme-dark .payment-transfer-box,
html.theme-dark .payment-info-card pre {
  background: var(--chip-soft) !important;
  color: var(--text) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .alert-danger,
html.theme-dark .alert-danger {
  color: #fecaca !important;
  background: rgba(127, 29, 29, 0.48) !important;
}

html[data-theme="dark"] .alert-success,
html[data-theme="dark"] .notice-success,
html.theme-dark .alert-success,
html.theme-dark .notice-success {
  color: #bbf7d0 !important;
  background: rgba(20, 83, 45, 0.42) !important;
}

html[data-theme="dark"] .notice-warning,
html[data-theme="dark"] .status-warning,
html.theme-dark .notice-warning,
html.theme-dark .status-warning {
  color: #fde68a !important;
  background: rgba(113, 63, 18, 0.42) !important;
}

html[data-theme="dark"] pre,
html[data-theme="dark"] code,
html.theme-dark pre,
html.theme-dark code {
  color: #e2e8f0 !important;
  background: #0b1220 !important;
  border-color: var(--line) !important;
}

@media (max-width: 560px) {
  .theme-toggle,
  .install-toggle { flex: 1 0 auto; }
  .install-panel { right: 10px; bottom: 10px; width: calc(100% - 20px); }
}


/* v19 telegram private chat flow */
.connect-code {
  margin: 12px 0 16px;
  padding: 14px 16px;
  border: 1px dashed var(--line, #d1d5db);
  border-radius: 14px;
  background: var(--soft, #f8fafc);
  word-break: break-word;
}
.connect-code code {
  font-size: 1.05rem;
  font-weight: 800;
}
.soft-details {
  margin: 8px 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line, #d1d5db);
  border-radius: 14px;
  background: var(--soft, #f8fafc);
}
.soft-details summary {
  cursor: pointer;
  font-weight: 800;
}
.chat-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted, #6b7280);
}
