@import url("./ui-tokens.css");

:root {
  color-scheme: light;
  --bg: var(--neutral-50);
  --surface: var(--neutral-0);
  --surface-2: var(--neutral-100);
  --ink: var(--neutral-800);
  --muted: var(--neutral-500);
  --line: var(--neutral-200);
  --brand: var(--brand-500);
  --brand-dark: var(--brand-700);
  --brand-soft: var(--brand-100);
  --accent: var(--brand-500);
  --accent-soft: var(--brand-50);
  --blue: var(--semantic-info);
  --blue-soft: var(--semantic-info-soft);
  --danger: var(--semantic-danger);
  --danger-soft: var(--semantic-danger-soft);
  --success: var(--semantic-success);
  --success-soft: var(--semantic-success-soft);
  --shadow: var(--ui-shadow-lg);
  --login-bg: var(--neutral-50);
  --field-bg: var(--neutral-0);
  --sidebar-bg: var(--neutral-800);
  --column-bg: var(--neutral-50);
  --floating-surface: rgba(255, 255, 255, 0.72);
  --floating-shadow: 0 10px 28px rgba(32, 43, 36, 0.08);
  --logo-bg: var(--neutral-0);
  --toast-bg: var(--neutral-800);
  --toast-ink: var(--neutral-0);
  --modal-backdrop: rgba(19, 21, 31, 0.68);
  --modal-shadow: var(--ui-shadow-lg);
  --control-shadow: var(--ui-shadow-sm);
  --radius: var(--ui-radius-md);
  --tap: 44px;
  --app-safe-top: max(14px, env(safe-area-inset-top, 0px));
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: var(--ui-font-family);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--neutral-950);
  --surface: var(--neutral-900);
  --surface-2: var(--neutral-800);
  --ink: var(--neutral-50);
  --muted: var(--neutral-400);
  --line: var(--neutral-700);
  --brand: var(--brand-400);
  --brand-dark: var(--brand-300);
  --brand-soft: #453713;
  --accent: var(--brand-400);
  --accent-soft: #3E3213;
  --blue: #60A5FA;
  --blue-soft: #172554;
  --danger: #F87171;
  --danger-soft: #451A1A;
  --success: #4ADE80;
  --success-soft: #14532D;
  --shadow: var(--ui-shadow-lg);
  --login-bg: var(--neutral-950);
  --field-bg: var(--neutral-900);
  --sidebar-bg: var(--neutral-950);
  --column-bg: var(--neutral-900);
  --floating-surface: rgba(24, 35, 31, 0.78);
  --floating-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  --logo-bg: var(--neutral-0);
  --toast-bg: var(--neutral-100);
  --toast-ink: var(--neutral-900);
  --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;
}

html:has(> body:not([data-ui="new"])) {
  min-width: 0;
  max-width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0;
}

body[data-theme="dark"] {
  background: var(--bg);
}

h1,
h2,
h3,
h4,
.panel-heading,
.page-title {
  font-family: var(--ui-font-family-heading);
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.hidden {
  display: none !important;
}

.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: var(--neutral-800);
  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);
}

body:not([data-ui="new"]) #loginScreen {
  overflow-y: auto;
}

body:not([data-ui="new"]) #loginScreen .auth-shell {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
}

body:not([data-ui="new"]) #loginScreen .auth-institutional,
body:not([data-ui="new"]) #loginScreen .auth-workspace,
body:not([data-ui="new"]) #loginScreen .auth-card {
  width: 100%;
}

body:not([data-ui="new"]) #loginScreen .auth-brand-lockup {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

body:not([data-ui="new"]) #loginScreen .auth-brand-lockup .brand-mark {
  width: 108px;
  height: 108px;
}

body:not([data-ui="new"]) #loginScreen .auth-brand-lockup .brand-mark img {
  padding: 7px;
}

body:not([data-ui="new"]) #loginScreen .auth-brand-copy h1 {
  margin: 0;
  font-size: clamp(1.8rem, 7vw, 2.7rem);
  line-height: 1.15;
}

body:not([data-ui="new"]) #loginScreen .auth-card {
  display: grid;
  gap: 14px;
}

body:not([data-ui="new"]) #loginScreen .auth-card .login-panel {
  width: 100%;
}

body:not([data-ui="new"]) #loginScreen :is(.auth-product-category, .auth-institutional-copy, .auth-card-heading, .auth-security-note, .auth-wave) {
  display: none;
}

.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);
}

.form-section-title {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 800;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.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: linear-gradient(180deg, var(--sidebar-bg), var(--surface-2));
}

.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);
  box-shadow: var(--control-shadow);
}

.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 28px;
}

.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 {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--neutral-800);
  box-shadow: var(--ui-shadow-sm);
}

.btn.primary:hover {
  border-color: var(--brand-600);
  background: var(--brand-600);
  color: var(--neutral-800);
}

.btn.ghost {
  border-color: var(--line);
  background: var(--surface);
}

.btn.warning {
  background: var(--semantic-warning);
  color: var(--neutral-0);
}

.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);
}

.mini-btn.warning {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-mini-btn {
  width: 34px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
}

.takeaway-control {
  display: flex;
  align-items: end;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.quick-action {
  min-height: 74px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--floating-shadow);
  min-width: 0;
}

.quick-action:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.quick-action strong,
.quick-action small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-action small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.quick-action-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.quick-action-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.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: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--floating-shadow);
  min-width: 0;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.stat-card strong {
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  overflow-wrap: anywhere;
}

.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);
  box-shadow: var(--floating-shadow);
}

.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);
  box-shadow: 0 1px 0 rgba(16, 38, 55, 0.03);
}

.order-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  text-align: left;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.order-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(35, 103, 86, 0.12);
}

.order-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--floating-shadow);
}

.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;
}

.quantity-field {
  min-width: 0;
  align-content: start;
}

.item-note-field {
  min-width: 0;
  align-content: start;
}

.quantity-stepper {
  display: grid;
  grid-template-columns: 44px minmax(72px, 1fr) 44px;
  gap: 8px;
  align-items: center;
}

.quantity-stepper input {
  text-align: center;
  font-weight: 900;
}

.quantity-stepper .mini-btn {
  min-height: 44px;
  justify-content: center;
}

.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;
}

.service-fee-panel {
  display: grid;
  gap: 12px;
}

.service-fee-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.service-fee-actions {
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(120px, 160px) minmax(140px, auto) minmax(140px, auto);
  gap: 10px;
  align-items: end;
}

.compact-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.compact-field input {
  min-height: 36px;
}

.credit-layout {
  display: grid;
  gap: 16px;
}

.credit-launch-panel {
  display: grid;
  gap: 14px;
}

.credit-form {
  align-items: end;
}

.credit-stats {
  margin: 14px 0;
}

.credit-list {
  margin-top: 10px;
}

.credit-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.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;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mp-payment-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  justify-items: center;
  text-align: center;
}

.mp-qr-wrap {
  width: 100%;
  display: grid;
  place-items: center;
}

.mp-payment-box textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  text-align: left;
}

.mp-qr {
  width: min(220px, 100%);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  object-fit: contain;
}

.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;
}

.employee-access-panel {
  min-width: 0;
}

.employee-access-grid {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.employee-access-qr {
  width: 236px;
  min-height: 236px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.employee-access-qr svg {
  width: 100%;
  height: auto;
  display: block;
}

.employee-access-info {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.employee-access-info input {
  font-size: 0.9rem;
}

.inactive-products-panel,
.danger-zone,
.account-deletion-panel {
  margin-top: 14px;
}

.inactive-products-list {
  margin-top: 12px;
}

.danger-zone {
  border-color: rgba(162, 61, 53, 0.28);
}

.danger-line {
  border-color: rgba(162, 61, 53, 0.22);
  background: var(--danger-soft);
}

.danger-link {
  color: var(--danger);
  justify-self: start;
}

.deletion-actions {
  margin-top: 12px;
}

.deletion-confirm-field {
  margin-top: 14px;
}

.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;
}

.feedback-filter-form {
  margin-bottom: 14px;
}

.saas-feedback-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.saas-feedback-detail {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.saas-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.saas-kpi {
  min-width: 0;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.saas-kpi > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.saas-kpi strong {
  color: var(--ink);
  font-size: 1.45rem;
  overflow-wrap: anywhere;
}

.saas-kpi small {
  color: var(--muted);
  font-weight: 750;
}

.saas-change {
  display: block;
  font-size: 0.72rem;
  font-weight: 850;
}

.saas-change.positive {
  color: var(--success);
}

.saas-change.negative {
  color: var(--danger);
}

.saas-change.neutral {
  color: var(--muted);
}

.saas-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
  gap: 12px;
  margin-top: 14px;
}

.saas-chart-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.saas-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.saas-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.saas-chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.saas-chart-legend .new-companies,
.saas-bar.new-companies {
  background: var(--brand);
}

.saas-chart-legend .activations,
.saas-bar.activations {
  background: var(--accent);
}

.saas-bar-chart {
  min-height: 230px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(24px, 1fr);
  align-items: stretch;
  gap: 5px;
  overflow-x: auto;
  padding: 8px 2px 2px;
  border-bottom: 1px solid var(--line);
}

.saas-bar-column {
  min-width: 24px;
  height: 220px;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: end;
}

.saas-bar-pair {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
}

.saas-bar {
  display: block;
  width: min(10px, 44%);
  min-height: 2px;
  border-radius: 3px 3px 0 0;
}

.saas-bar-column > span {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  line-height: 1;
  text-align: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.saas-status-list {
  display: grid;
  gap: 16px;
  padding-top: 8px;
}

.saas-status-row {
  display: grid;
  gap: 7px;
}

.saas-status-row > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
}

.saas-status-row span {
  color: var(--muted);
  font-size: 0.74rem;
}

.saas-status-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.saas-status-track i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
  background: var(--muted);
}

.saas-status-track .active { background: var(--success); }
.saas-status-track .trial { background: var(--brand); }
.saas-status-track .past-due { background: var(--accent); }
.saas-status-track .cancelled { background: var(--danger); }
.saas-status-track .deleted { background: var(--muted); }

.saas-editor-panel {
  margin: 0 0 16px;
  padding: 16px;
  border-block: 1px solid var(--line);
  background: var(--surface-2);
}

.saas-list-table tr.is-selected > td {
  background: var(--brand-soft);
}

.saas-detail-row > td {
  padding: 0;
  text-align: left;
  background: var(--surface-2);
}

.saas-detail-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-left: 3px solid var(--brand);
  background: var(--surface-2);
}

.saas-detail-heading,
.saas-subsection-heading,
.saas-detail-actions,
.commission-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.saas-detail-heading h4,
.saas-subsection-heading h5 {
  margin: 0;
  color: var(--ink);
}

.saas-detail-heading h4 {
  font-size: 1.12rem;
}

.saas-detail-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.saas-subsection-heading {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.saas-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.saas-detail-grid > div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.saas-detail-grid span,
.commission-summary span,
.commission-formula > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.saas-detail-grid strong {
  overflow-wrap: anywhere;
}

.saas-detail-grid small,
.commission-summary small,
.commission-formula small {
  color: var(--muted);
  line-height: 1.35;
}

.saas-detail-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.status-label {
  display: inline-block;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
}

.status-label.success {
  color: var(--success);
}

.compact-history {
  max-height: 340px;
  overflow-y: auto;
}

.commission-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.commission-summary {
  min-width: 0;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--muted);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.commission-summary.primary { border-top-color: var(--brand); }
.commission-summary.warning { border-top-color: var(--accent); }
.commission-summary.success { border-top-color: var(--success); }

.commission-summary strong {
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.commission-context {
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.commission-context span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.commission-formula {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  border-radius: var(--radius);
  background: var(--surface);
}

.commission-formula.has-error {
  border-left-color: var(--danger);
}

.commission-formula strong {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.feedback-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.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-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.subscription-card {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  min-width: 0;
}

.subscription-card-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.subscription-card-actions {
  margin-top: auto;
  display: grid;
  align-items: end;
}

.subscription-card.featured {
  border-color: rgba(35, 103, 86, 0.42);
  background: var(--brand-soft);
}

.subscription-card h4,
.subscription-card p {
  margin: 0;
}

.subscription-card h4 {
  font-size: 1.12rem;
}

.subscription-card .price-main {
  color: var(--brand-dark);
  font-size: 1.55rem;
  font-weight: 950;
}

.subscription-catalog-hint {
  margin-top: 6px !important;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.35;
}

.subscription-catalog-hint.warning {
  color: var(--accent);
}

.subscription-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.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);
}

.system-modal-card {
  width: min(520px, 100%);
}

.system-modal-card input,
.system-modal-card textarea,
.system-modal-card select {
  min-height: var(--tap);
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
}

.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-grid .summary-box {
  min-width: 0;
}

.diagnostic-grid .summary-box strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.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: 1200px) {
  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .saas-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .saas-detail-grid,
  .commission-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) {
  .quick-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid,
  .split-layout,
  .orders-layout,
  .catalog-layout,
  .saas-feedback-layout,
  .saas-chart-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    min-height: 320px;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .saas-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .saas-bar-chart {
    grid-auto-columns: 28px;
  }

  .saas-dashboard-heading {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .saas-dashboard-heading .filter-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    overflow: visible;
  }

  .saas-dashboard-heading .filter-row label,
  .saas-dashboard-heading .filter-row select {
    min-width: 0;
    width: 100%;
  }

  .saas-list-heading {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .saas-list-heading .filter-row {
    display: flex;
    width: 100%;
    overflow-x: auto;
  }

  .saas-detail-heading,
  .saas-subsection-heading {
    align-items: flex-start;
  }

  .saas-detail-grid,
  .commission-summary-grid {
    grid-template-columns: 1fr;
  }

  .saas-detail-panel,
  .saas-editor-panel {
    padding: 12px;
  }

  .employee-access-grid {
    grid-template-columns: 1fr;
  }

  .employee-access-qr {
    width: min(236px, 100%);
    justify-self: center;
  }

  .app-shell {
    display: block;
    padding-bottom: calc(88px + max(12px, var(--app-safe-bottom)));
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    height: auto;
    max-height: calc(76px + max(12px, var(--app-safe-bottom)));
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 7px 8px calc(7px + max(12px, var(--app-safe-bottom)));
    border-top: 1px solid var(--line);
    border-right: 0;
    background: var(--sidebar-bg);
    backdrop-filter: blur(12px);
  }

  .brand-row,
  .sidebar-footer {
    display: none;
  }

  .main-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 2px;
    justify-content: flex-start;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .nav-btn {
    flex: 0 0 56px;
    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;
  }

  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-action {
    min-height: 66px;
  }

  .form-grid,
  .checkout-summary,
  .service-fee-grid,
  .service-fee-actions,
  .diagnostic-grid,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .subscription-hero {
    display: grid;
  }

  .subscription-price {
    text-align: left;
  }

  .subscription-plans {
    grid-template-columns: 1fr;
  }

  .about-hero {
    align-items: flex-start;
  }

  .order-detail-header {
    grid-template-columns: 1fr;
  }

  .detail-actions {
    justify-content: flex-start;
  }

  .kanban {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .kanban-column {
    min-width: 0;
  }

  .credit-card {
    grid-template-columns: 1fr;
  }

  .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 (max-width: 519px) {
  .app-shell {
    padding-bottom: calc(74px + max(6px, var(--app-safe-bottom)));
  }

  .sidebar {
    max-height: calc(64px + max(6px, var(--app-safe-bottom)));
    padding: 6px 8px calc(6px + max(8px, var(--app-safe-bottom)));
  }

  .main-nav {
    padding-bottom: 0;
  }

  .nav-btn {
    flex-basis: 50px;
    min-height: 48px;
  }
}

@media (max-width: 380px) {
  .main-content {
    padding-inline: 12px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .saas-kpi-grid {
    grid-template-columns: 1fr;
  }

  .main-nav {
    gap: 2px;
    justify-content: space-between;
    overflow-x: hidden;
  }

  .nav-btn {
    flex: 1 1 34px;
    min-width: 34px;
    min-height: 46px;
  }

  .nav-icon {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }

  .nav-icon svg {
    width: 21px;
    height: 21px;
  }
}

@media (max-width: 760px) and (min-width: 520px) {
  .sidebar {
    justify-items: center;
  }

  .main-nav {
    width: min(100%, 720px);
    margin: 0 auto;
    padding-inline: 12px;
    justify-content: center;
  }

  .nav-btn {
    flex-basis: clamp(56px, 9vw, 74px);
  }
}

@media (max-width: 760px) and (min-width: 680px) {
  .main-nav {
    justify-content: space-evenly;
    overflow-x: hidden;
  }

  .nav-btn {
    flex: 0 1 76px;
  }
}

@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;
  }
}
