:root {
  color-scheme: light;
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-2: #eef3ee;
  --ink: #1f2b24;
  --muted: #627066;
  --line: #d9e0d8;
  --brand: #236756;
  --brand-dark: #174b40;
  --brand-soft: #dcece7;
  --accent: #b45f1c;
  --accent-soft: #f7e7d7;
  --blue: #236a8b;
  --blue-soft: #dbeef5;
  --danger: #a23d35;
  --danger-soft: #f4dedb;
  --success: #237447;
  --success-soft: #dff1e6;
  --shadow: 0 18px 45px rgba(32, 43, 36, 0.12);
  --login-bg:
    linear-gradient(180deg, rgba(247, 251, 249, 0.96) 0%, rgba(238, 247, 244, 0.92) 50%, rgba(248, 250, 246, 0.98) 100%),
    linear-gradient(120deg, rgba(35, 103, 86, 0.08), rgba(180, 95, 28, 0.05));
  --field-bg: #ffffff;
  --sidebar-bg: #fbfcfa;
  --column-bg: #fbfcfa;
  --floating-surface: rgba(255, 255, 255, 0.72);
  --floating-shadow: 0 10px 28px rgba(32, 43, 36, 0.08);
  --environment-bg: #fff7ed;
  --environment-ink: #8a3d12;
  --environment-line: rgba(180, 95, 28, 0.34);
  --logo-bg: #ffffff;
  --toast-bg: #1f2b24;
  --toast-ink: #ffffff;
  --modal-backdrop: rgba(31, 43, 36, 0.64);
  --modal-shadow: 0 22px 54px rgba(11, 22, 17, 0.28);
  --control-shadow: 0 1px 4px rgba(32, 43, 36, 0.10);
  --radius: 8px;
  --tap: 44px;
  --app-safe-top: max(14px, env(safe-area-inset-top, 0px));
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1714;
  --surface: #18231f;
  --surface-2: #22312b;
  --ink: #eef7f3;
  --muted: #a6bbb1;
  --line: #344841;
  --brand: #4ecdb3;
  --brand-dark: #9ce9d8;
  --brand-soft: #193f37;
  --accent: #ffad73;
  --accent-soft: #3b2a1f;
  --blue: #7cc7e5;
  --blue-soft: #17394a;
  --danger: #ff9a90;
  --danger-soft: #3f2424;
  --success: #82d8a4;
  --success-soft: #183a29;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.34);
  --login-bg:
    linear-gradient(180deg, rgba(13, 28, 24, 0.98) 0%, rgba(18, 38, 34, 0.94) 54%, rgba(10, 20, 18, 0.98) 100%),
    linear-gradient(120deg, rgba(78, 205, 179, 0.10), rgba(255, 173, 115, 0.08));
  --field-bg: #101a17;
  --sidebar-bg: #121d19;
  --column-bg: #13201c;
  --floating-surface: rgba(24, 35, 31, 0.78);
  --floating-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  --environment-bg: #3b2a1f;
  --environment-ink: #ffd2ad;
  --environment-line: rgba(255, 173, 115, 0.38);
  --logo-bg: #ffffff;
  --toast-bg: #eef7f3;
  --toast-ink: #101a17;
  --modal-backdrop: rgba(4, 10, 8, 0.76);
  --modal-shadow: 0 22px 54px rgba(0, 0, 0, 0.46);
  --control-shadow: 0 1px 5px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.hidden {
  display: none !important;
}

.environment-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid var(--environment-line);
  border-radius: 6px;
  background: var(--environment-bg);
  color: var(--environment-ink);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.environment-badge.inline {
  margin-top: 6px;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-content: center;
  place-items: center;
  gap: 22px;
  padding: calc(32px + var(--app-safe-top)) 24px calc(58px + var(--app-safe-bottom));
  background: var(--login-bg);
}

.login-brand {
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.login-brand .brand-mark {
  width: 108px;
  height: 108px;
}

.login-brand .brand-mark img {
  padding: 7px;
}

.login-brand .eyebrow {
  display: none;
}

.login-version {
  position: absolute;
  left: 50%;
  bottom: calc(16px + var(--app-safe-bottom));
  transform: translateX(-50%);
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  opacity: 0.62;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  box-shadow: none;
}

.brand-mark.has-logo {
  border: 1px solid var(--line);
  background: var(--logo-bg);
  color: transparent;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.login-brand h1,
.topbar h2,
.panel-heading h3 {
  margin: 0;
  line-height: 1.15;
}

.login-brand h1 {
  font-size: clamp(1.8rem, 7vw, 2.7rem);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-mode-group {
  display: grid;
  gap: 14px;
}

.login-help-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

.login-server-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(35, 103, 86, 0.16);
  border-radius: var(--radius);
  background: var(--floating-surface);
  box-shadow: var(--floating-shadow);
}

.login-server-panel strong,
.login-server-panel span {
  display: block;
}

.login-server-panel span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.server-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.server-actions .mini-btn {
  min-height: 34px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.password-input {
  position: relative;
  display: block;
}

.password-input input {
  padding-right: 66px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  min-width: 50px;
  min-height: 32px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.field-hint {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.field-hint.success {
  color: var(--success);
}

.field-hint.danger {
  color: var(--danger);
}

.inline-action-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.inline-action-field input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 800;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(35, 103, 86, 0.14);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: var(--app-safe-top);
  height: calc(100vh - var(--app-safe-top));
  height: calc(100dvh - var(--app-safe-top));
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row span {
  color: var(--muted);
  font-size: 0.86rem;
}

.main-nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  min-height: var(--tap);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-weight: 800;
  text-align: center;
  position: relative;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.nav-btn.locked {
  opacity: 0.48;
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (hover: hover) and (min-width: 761px) {
  .nav-btn::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    z-index: 30;
    min-width: max-content;
    transform: translate(-4px, -50%);
    opacity: 0;
    pointer-events: none;
    padding: 7px 9px;
    border-radius: var(--radius);
    background: var(--ink);
    color: #fff;
    box-shadow: var(--shadow);
    font-size: 0.78rem;
    line-height: 1;
    transition: opacity 0.16s ease, transform 0.16s ease;
  }

  .nav-btn:hover::after,
  .nav-btn:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.main-content {
  min-width: 0;
  padding: calc(22px + var(--app-safe-top)) 22px 22px;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h2 {
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}

.topbar-actions,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.btn,
.icon-btn,
.text-btn,
.segmented,
.mini-btn {
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: var(--tap);
  color: var(--ink);
  font-weight: 800;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.ghost {
  border-color: var(--line);
  background: var(--surface);
}

.btn.warning {
  background: var(--accent);
  color: #fff;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.wide {
  width: 100%;
}

.icon-btn {
  width: var(--tap);
  display: grid;
  place-items: center;
  background: var(--surface);
  border-color: var(--line);
  font-size: 1.15rem;
}

.text-btn {
  min-height: 36px;
  background: transparent;
  color: var(--brand);
  padding: 0 4px;
}

.mini-btn {
  min-height: 34px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--brand-dark);
}

.mini-btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.mini-btn.success {
  background: var(--success-soft);
  color: var(--success);
}

.mini-btn.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.icon-mini-btn {
  width: 34px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.takeaway-control {
  display: flex;
  align-items: end;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  min-height: 104px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.stat-card strong {
  font-size: clamp(1.35rem, 3vw, 1.9rem);
}

.workspace-grid,
.split-layout {
  display: grid;
  gap: 16px;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.split-layout {
  grid-template-columns: minmax(310px, 0.9fr) minmax(430px, 1.5fr);
  align-items: start;
}

.orders-layout {
  grid-template-columns: minmax(310px, 420px) minmax(0, 1fr);
}

.order-create-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.quick-client-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.panel-heading.compact {
  margin-bottom: 0;
}

.panel-heading.compact h3 {
  font-size: 0.96rem;
}

.panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h3 {
  font-size: 1.05rem;
}

.detail-panel {
  min-height: 480px;
}

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

.form-grid .wide,
.form-grid label:has(textarea),
.form-grid .full {
  grid-column: 1 / -1;
}

.filter-row {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: var(--tap);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.segmented {
  min-height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.segmented.active {
  background: var(--surface);
  color: var(--brand-dark);
  box-shadow: var(--control-shadow);
}

.stack-list {
  display: grid;
  gap: 10px;
}

.order-card,
.line-card,
.kitchen-card,
.history-line,
.catalog-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.order-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: left;
}

.order-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(35, 103, 86, 0.12);
}

.order-card button {
  text-align: left;
}

.card-top,
.line-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-title,
.line-title {
  display: grid;
  gap: 2px;
}

.card-title strong,
.line-title strong {
  font-size: 1rem;
}

.card-title span,
.line-title span,
.muted {
  color: var(--muted);
  font-size: 0.86rem;
}

.money {
  font-weight: 900;
  white-space: nowrap;
}

.pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-open {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.status-closed {
  background: var(--success-soft);
  color: var(--success);
}

.status-new {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-progress {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-cancelled {
  background: var(--danger-soft);
  color: var(--danger);
}

.takeaway-pill {
  width: max-content;
  background: var(--accent-soft);
  color: var(--accent);
}

.order-detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.order-detail-header h3 {
  margin: 0 0 4px;
  font-size: 1.3rem;
}

.detail-actions,
.line-actions,
.receipt-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-sections {
  display: grid;
  gap: 14px;
}

.subpanel {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.subpanel h4 {
  margin: 0;
  font-size: 0.98rem;
}

.line-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.quantity-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.quantity-controls span {
  min-width: 32px;
  text-align: center;
  font-weight: 900;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
  font-size: 1.06rem;
}

.kitchen-layout {
  display: grid;
  gap: 14px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.kanban-column {
  min-width: 240px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--column-bg);
}

.kanban-column h3 {
  margin: 0;
  font-size: 0.98rem;
}

.kitchen-card {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.kitchen-card strong {
  font-size: 1rem;
}

.kitchen-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.kitchen-history-panel {
  align-self: start;
}

.kitchen-history-list {
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.kitchen-history-card {
  background: var(--surface);
}

.checkout-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.summary-box {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.summary-box span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.summary-box strong {
  display: block;
  margin-top: 4px;
  font-size: 1.18rem;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td:last-child,
th:last-child {
  text-align: right;
}

.catalog-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.catalog-list {
  display: grid;
  gap: 10px;
}

.company-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.company-preview .brand-mark {
  flex: 0 0 auto;
  box-shadow: none;
}

.company-preview strong,
.company-preview span {
  display: block;
}

.company-preview span {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 800;
}

.about-layout {
  display: grid;
  gap: 16px;
}

.about-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.about-hero h3 {
  margin: 0 0 8px;
  font-size: 1.55rem;
}

.about-hero p:last-child {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  line-height: 1.45;
}

.about-system-logo {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.about-system-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

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

.about-list {
  max-height: none;
}

.theme-toggle {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  cursor: pointer;
}

.theme-toggle strong,
.theme-toggle small {
  display: block;
}

.theme-toggle strong {
  color: var(--ink);
  font-size: 1rem;
}

.theme-toggle small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.theme-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.theme-switch {
  position: relative;
  width: 56px;
  height: 32px;
  flex: 0 0 56px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field-bg);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.theme-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--muted);
  transition: transform 0.18s ease, background 0.18s ease;
}

.theme-toggle input:checked + .theme-switch {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.theme-toggle input:checked + .theme-switch::after {
  transform: translateX(24px);
  background: var(--brand-dark);
}

.theme-toggle input:focus-visible + .theme-switch {
  box-shadow: 0 0 0 3px rgba(35, 103, 86, 0.18);
}

.subscription-layout {
  display: grid;
  gap: 16px;
}

.subscription-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.subscription-hero h3 {
  margin: 0 0 8px;
  font-size: 1.55rem;
}

.subscription-hero p {
  margin: 0;
  max-width: 680px;
  color: var(--muted);
  line-height: 1.45;
}

.subscription-price {
  min-width: 160px;
  text-align: right;
}

.subscription-price strong {
  display: block;
  font-size: 1.8rem;
  color: var(--brand-dark);
}

.subscription-price span {
  color: var(--muted);
  font-weight: 800;
}

.subscription-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.subscription-alert,
.subscription-banner.warning {
  border-color: rgba(180, 95, 28, 0.28);
  background: var(--accent-soft);
}

.subscription-alert h3,
.subscription-alert p {
  margin: 0;
}

.subscription-alert p {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 800;
}

.subscription-banner {
  margin-bottom: 14px;
  padding: 11px 13px;
  border-radius: var(--radius);
  font-weight: 900;
}

.subscription-banner.success {
  background: var(--success-soft);
  color: var(--success);
}

.subscription-banner.warning {
  color: var(--accent);
}

.logo-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.file-input {
  padding: 9px;
}

.catalog-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.stock-alert {
  color: var(--danger);
  font-weight: 900;
}

.history-list {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.history-line {
  padding: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.history-line strong {
  color: var(--ink);
}

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--toast-bg);
  color: var(--toast-ink);
  box-shadow: var(--shadow);
  font-weight: 800;
  text-align: center;
}

.admin-pin-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: calc(18px + var(--app-safe-top)) 18px calc(18px + var(--app-safe-bottom));
  background: var(--modal-backdrop);
}

.admin-pin-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--modal-shadow);
}

.admin-pin-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-pin-heading strong {
  font-size: 1.08rem;
  line-height: 1.25;
}

.admin-pin-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.admin-pin-card input {
  min-height: 52px;
  font-size: 1.18rem;
  font-weight: 800;
  text-align: center;
}

.admin-pin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.print-preview {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--modal-backdrop);
}

.print-preview[hidden] {
  display: none;
}

.print-preview-bar,
.print-preview-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.print-preview-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.print-close {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  font-weight: 900;
}

.print-preview-body {
  overflow: auto;
  padding: 22px;
}

.receipt-sheet {
  width: min(380px, 100%);
  margin: 0 auto;
  padding: 22px;
  border-radius: var(--radius);
  background: #fff;
  color: #111;
  box-shadow: var(--shadow);
  font-family: Arial, sans-serif;
  line-height: 1.45;
}

.receipt-logo {
  max-width: 82px;
  max-height: 82px;
  object-fit: contain;
  margin-bottom: 10px;
}

.receipt-sheet h1 {
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.diagnostic-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(22px + var(--app-safe-top)) 22px 22px;
}

.diagnostic-panel {
  max-width: 980px;
  margin: 0 auto;
}

.diagnostic-panel h1 {
  margin: 0;
  font-size: 1.7rem;
}

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

.diagnostic-output {
  min-height: 120px;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.diagnostic-email-form {
  display: grid;
  gap: 12px;
}

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

  .workspace-grid,
  .split-layout,
  .orders-layout,
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    min-height: 320px;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .app-shell {
    display: block;
    padding-bottom: calc(112px + max(24px, var(--app-safe-bottom)));
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    height: calc(76px + max(24px, var(--app-safe-bottom)));
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 8px 8px calc(8px + max(24px, var(--app-safe-bottom)));
    border-top: 1px solid var(--line);
    border-right: 0;
    background: rgba(251, 252, 250, 0.97);
    backdrop-filter: blur(12px);
  }

  .brand-row,
  .sidebar-footer {
    display: none;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
    gap: 2px;
    overflow: hidden;
  }

  .nav-btn {
    min-height: 54px;
    justify-content: center;
    padding: 0 4px;
    font-size: 0.68rem;
    text-align: center;
  }

  .main-content {
    padding: calc(16px + var(--app-safe-top)) 16px 24px;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    justify-content: stretch;
  }

  .topbar-actions .logout-btn {
    display: inline-flex;
    min-width: 70px;
  }

  .topbar-actions .btn,
  .topbar-actions .icon-btn {
    min-height: 40px;
  }

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

  .form-grid,
  .checkout-summary,
  .diagnostic-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .subscription-hero {
    display: grid;
  }

  .subscription-price {
    text-align: left;
  }

  .about-hero {
    align-items: flex-start;
  }

  .order-detail-header {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    justify-content: flex-start;
  }

  .kanban {
    grid-template-columns: repeat(4, minmax(220px, 78vw));
  }

  .filter-row {
    width: 100%;
    overflow-x: auto;
  }

  .segmented {
    flex: 1 0 auto;
  }

  .catalog-row {
    grid-template-columns: 1fr;
  }

  .catalog-row .line-actions {
    justify-content: flex-start;
  }
}

@media print {
  body {
    background: #fff;
  }

  body:has(.print-preview:not([hidden])) > *:not(#printPreview) {
    display: none !important;
  }

  .sidebar,
  .topbar,
  .toast,
  .print-preview-bar,
  .print-preview-actions,
  .no-print {
    display: none !important;
  }

  .print-preview {
    position: static;
    display: block;
    background: #fff;
  }

  .print-preview-body {
    padding: 0;
    overflow: visible;
  }

  .receipt-sheet {
    width: auto;
    max-width: 320px;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .app-shell {
    display: block;
  }

  .main-content,
  .panel {
    padding: 0;
    border: 0;
  }
}
