@font-face {
  font-family: "Z06 Walone";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/Z06-Walone-Regular.ttf") format("truetype");
  unicode-range: U+1000-109F, U+AA60-AA7F, U+A9E0-A9FF;
}

:root {
  color-scheme: dark;
  --font-ui: "Z06 Walone", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-data: var(--font-ui);
  --bg: #141618;
  --nav: #17191b;
  --surface: #1b1e21;
  --surface-2: #22262a;
  --surface-3: #2b3035;
  --row-hover: #252a2e;
  --ink: #dce1e5;
  --ink-strong: #f3f5f6;
  --muted: #a4adb5;
  --muted-2: #89939d;
  --line: #30353a;
  --line-strong: #49535d;
  --primary: #7cd4dd;
  --primary-strong: #9ce1e8;
  --primary-ink: #102b30;
  --success: #87d5aa;
  --warning: #e8c786;
  --danger: #ffb2ad;
  --shadow: 0 12px 32px rgb(0 0 0 / 24%);
  --radius: 8px;
  --radius-sm: 6px;
  --focus: 0 0 0 3px rgb(124 212 221 / 28%);
  --row-digimium: #1c272e;
  --row-dmarwal: #202834;
  --row-digimium2: #282432;
  --row-telegram: #1b2b30;
  --row-viber: #2d2430;
  --row-extra1: #202c27;
  --row-extra2: #2e2a22;
  --row-digimium-hover: #85bbc9;
  --row-dmarwal-hover: #87aee8;
  --row-digimium2-hover: #b6a0de;
  --row-telegram-hover: #77cbdc;
  --row-viber-hover: #ce9ec9;
  --row-extra1-hover: #97c7a9;
  --row-extra2-hover: #d4bd86;
}

body[data-store-theme="dmarwal"],
body[data-store-theme="facebook"] {
  --primary: #9bbcf0;
  --primary-strong: #bad1f6;
}
body[data-store-theme="digimium2"] {
  --primary: #c5b0e8;
  --primary-strong: #d7c8ef;
}
body[data-store-theme="telegram"] {
  --primary: #88d5e5;
  --primary-strong: #ace3ec;
}
body[data-store-theme="viber"] {
  --primary: #dbb0d6;
  --primary-strong: #e7cce3;
}
body[data-store-theme="extra1"],
body[data-store-theme="website"] {
  --primary: #a1d4b6;
  --primary-strong: #bfe3cc;
}
body[data-store-theme="extra2"] {
  --primary: #e0c993;
  --primary-strong: #ebdcb9;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-padding-top: 92px; }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:disabled, input:disabled, select:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, a:focus-visible, .table-wrap:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
input, select, textarea { accent-color: var(--primary); }
::placeholder { color: var(--muted-2); opacity: 1; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; }
.app-shell { min-height: 100vh; }
.skip-link {
  position: fixed;
  top: 8px;
  left: 16px;
  z-index: 60;
  transform: translateY(-150%);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-ink);
  padding: 10px 16px;
}
.skip-link:focus { transform: translateY(0); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 36px;
  min-height: 68px;
  padding-inline: 32px;
  border-bottom: 1px solid var(--line);
  background: var(--nav);
}
.brand { --logo-width: 118px; display: inline-flex; align-items: center; gap: 14px; }
.brand-logo { display: block; width: var(--logo-width); height: auto; aspect-ratio: 137 / 48; object-fit: contain; }
.brand-divider { flex: 0 0 1px; width: 1px; height: 28px; background: #fff; }
/* Match visible artwork height, accounting for Digimium's transparent padding. */
.partner-logo { position: relative; display: block; flex: 0 0 calc(var(--logo-width) * 0.848); width: calc(var(--logo-width) * 0.848); aspect-ratio: 1077 / 390; overflow: hidden; }
.partner-logo img { position: absolute; width: 185.7%; max-width: none; height: auto; left: -42.8%; top: -206.4%; }
.nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
  min-width: 0;
  align-self: stretch;
}
.nav-link {
  position: relative;
  flex: 0 0 auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.nav > .nav-link { align-self: stretch; }
.nav-link:hover, .nav-link.active { color: var(--ink-strong); }
.nav-link.active::after {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  content: "";
}
.nav-short { display: none; }
.session-controls { display: flex; align-items: center; gap: 24px; min-width: 0; }
.nav-link.logout { color: var(--muted); }
.nav-link.logout:hover { color: var(--ink-strong); }
.sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.sync-indicator .icon { width: 15px; height: 15px; }
.sync-indicator > span { overflow: hidden; text-overflow: ellipsis; }
.sync-indicator[data-status="synced"] .icon { color: var(--success); }
.sync-indicator[data-status="syncing"],
.sync-indicator[data-status="pending"],
.sync-indicator[data-status="saving"] { color: var(--primary); }
.sync-indicator[data-status="offline"],
.sync-indicator[data-status="error"] { color: var(--warning); }

.container {
  width: min(1760px, calc(100% - 64px));
  margin-inline: auto;
  padding: 24px 0 48px;
}
.container:focus { outline: none; }
.toolbar, .panel, .table-card { min-width: 0; }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  min-height: 64px;
  padding: 0 0 20px;
}
.toolbar-group { display: flex; align-items: center; gap: 12px; min-width: 0; }
.toolbar-title {
  margin: 0;
  color: var(--ink-strong);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}
.single-tab {
  color: var(--muted);
  font-size: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
}
.action-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.icon-button, .primary-button, .secondary-button, .danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.primary-button { background: var(--primary); color: var(--primary-ink); }
.toolbar button[aria-controls] { min-width: 128px; }
.primary-button:hover:not(:disabled) { background: var(--primary-strong); }
.secondary-button { border-color: var(--line-strong); background: transparent; color: var(--ink); }
.secondary-button:hover:not(:disabled) { background: var(--surface-3); }
.danger-button { border-color: #59413f; background: #302323; color: var(--danger); }
.danger-button:hover:not(:disabled) { background: #45302e; }
.icon-button { width: 38px; padding: 0; background: transparent; color: var(--muted); }
.icon-button:hover:not(:disabled) { background: var(--surface-3); color: var(--ink-strong); }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.store-filter {
  width: 160px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 120ms ease, background-color 120ms ease;
}
.store-filter:hover { border-color: var(--line-strong); background: var(--surface-3); }
.store-filter:focus-within { border-color: var(--primary); }
.search-control {
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.store-filter select {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-overflow: ellipsis;
}
.store-filter select:focus-visible { outline-offset: 4px; }
.search-control {
  display: flex;
  align-items: center;
  width: 280px;
  min-width: 160px;
  padding-inline: 4px;
  color: var(--muted);
}
.search-control:focus-within { border-color: var(--primary); }
.search-control > .icon { width: 16px; height: 16px; }
.search-control input {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}
.search-control input:focus-visible { outline: none; }
.search-control input::-webkit-search-cancel-button { display: none; }
.search-clear, .search-submit {
  display: inline-grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}
.search-clear:hover, .search-submit:hover { background: var(--surface-3); color: var(--ink-strong); }
.search-submit .icon { width: 16px; height: 16px; }
.search-clear .icon { width: 14px; height: 14px; }

.panel { margin-bottom: 24px; border-block: 1px solid var(--line); background: var(--surface); }
.panel-title {
  display: flex;
  align-items: center;
  min-height: 52px;
  margin: 0;
  padding: 16px 20px 0;
  color: var(--ink-strong);
  font-size: 16px;
  font-weight: 600;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  padding: 20px;
}
.sale-form { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: grid; min-width: 0; gap: 6px; }
.field > span { color: var(--ink); font-size: 12px; font-weight: 500; }
.field input, .field select, .field textarea, .summary-form input,
.summary-form select, .store-setting-row input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  padding: 7px 10px;
  font-size: 14px;
}
.field textarea { min-height: 80px; resize: vertical; }
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}
#sales-table-region, #products-table-region, .panel { scroll-margin-top: 92px; }

.table-card { border-block: 1px solid var(--line); padding: 0; }
.table-wrap {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  table-layout: fixed;
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}
.col-index { width: 44px; }
.col-actions { width: 92px; }
.col-money { width: 112px; }
.col-date { width: 108px; }
.col-customer, .col-email { width: 19%; }
.col-detail { width: 120px; }
.col-manager { width: 220px; }
.col-duration { width: 64px; }
.col-renewal { width: 70px; }
.col-supplier { width: 17%; }
.col-status { width: 100px; }
.col-timestamp { width: 180px; }
.sales-table { min-width: 1080px; }
.product-table { min-width: 1000px; }
.expiry-table { min-width: 980px; }
.users-table { min-width: 900px; }
th, td {
  overflow: hidden;
  padding: 0 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
thead { background: var(--surface); }
thead th {
  height: 40px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-align: left;
}
tbody td {
  height: 44px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
}
tbody tr:hover { background: var(--row-hover); }
.store-row { --store-fill: var(--row-digimium); }
.store-row[data-store="dmarwal"], .store-row[data-store="facebook"] { --store-fill: var(--row-dmarwal); }
.store-row[data-store="digimium2"] { --store-fill: var(--row-digimium2); }
.store-row[data-store="telegram"] { --store-fill: var(--row-telegram); }
.store-row[data-store="viber"] { --store-fill: var(--row-viber); }
.store-row[data-store="extra1"], .store-row[data-store="website"] { --store-fill: var(--row-extra1); }
.store-row[data-store="extra2"] { --store-fill: var(--row-extra2); }
tbody .store-row { background: var(--store-fill); }
tbody .store-row:hover { background: color-mix(in srgb, var(--store-fill) 88%, white); }
.total-row td {
  height: 38px;
  border-top-color: var(--line-strong);
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.total-row .money-cell { color: var(--ink-strong); }
.total-label { text-align: right; }
.total-label-compact { display: none; }
/* Round date-group edges without separating individual records into cards. */
@media (min-width: 601px) {
  #sales-table-region .table-card { border: 0; }
  .sales-table { border-collapse: separate; border-spacing: 0; }
  .sales-table thead { background: transparent; }
  .sales-table th { background: var(--surface); }
  .sales-table th:first-child { border-top-left-radius: 8px; }
  .sales-table th:last-child { border-top-right-radius: 8px; }
  .sales-table tbody .store-row { background: transparent; }
  .sales-table .store-row td { background: var(--store-fill); }
  .sales-table .store-row:hover td { background: color-mix(in srgb, var(--store-fill) 88%, white); }
  .sales-table .total-row + .store-row td { border-top: 0; }
  .sales-table .total-row + .store-row td:first-child { border-top-left-radius: 8px; }
  .sales-table .total-row + .store-row td:last-child { border-top-right-radius: 8px; }
  .sales-table .store-row:has(+ .total-row) td:first-child,
  .sales-table .store-row:last-child td:first-child { border-bottom-left-radius: 8px; }
  .sales-table .store-row:has(+ .total-row) td:last-child,
  .sales-table .store-row:last-child td:last-child { border-bottom-right-radius: 8px; }
  .sales-table .total-row td { border-top: 0; }
}
.number-cell { color: var(--muted); text-align: center; }
.money-cell, .date-cell { text-align: right; }
.money-cell { font-variant-numeric: tabular-nums; }
.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 100%;
}
.row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}
.row-action .icon { width: 16px; height: 16px; }
.row-action:hover:not(:disabled) { background: var(--surface-3); color: var(--ink-strong); }
.row-action[data-action^="delete"]:hover:not(:disabled) { background: #49312f; color: var(--danger); }
.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding-block: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.table-pagination > div { display: flex; align-items: center; gap: 16px; }
.table-pagination .secondary-button { min-width: 76px; min-height: 34px; font-size: 12px; }
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 24px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--ink);
  font-size: 12px;
}
.status { display: inline-flex; align-items: center; gap: 7px; color: var(--success); font-size: 12px; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status[data-active="false"] { color: var(--muted); }

.panel > .toolbar { min-height: 76px; padding: 20px; }
.summary-form { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.summary-form label { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.summary-form input, .summary-form select { width: 138px; font-size: 13px; }
.summary-form .store-filter { width: 138px; }
.summary-form .store-filter select {
  width: 100%;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
}
select:not([multiple]), .store-filter select, .summary-form .store-filter select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a4adb5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 16px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  padding-right: 44px;
  text-overflow: ellipsis;
}
.summary-form .check-label { white-space: nowrap; }
.summary-form .check-label input { width: 16px; min-height: 16px; height: 16px; margin: 0; }
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 8px 0 24px;
}
.metric { min-width: 0; padding: 0 24px; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }
.metric-label { margin: 0; color: var(--muted); font-size: 12px; font-weight: 500; }
.metric-value { margin: 8px 0 0; color: var(--ink-strong); font-size: 24px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.metric-delta { margin-top: 8px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.table-card > .toolbar { padding: 20px 0; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; padding: 24px 20px; }
.settings-card { min-width: 0; }
.settings-card h3 { margin: 0 0 4px; color: var(--ink-strong); font-size: 14px; font-weight: 600; }
.settings-card > button { justify-self: start; }
.settings-card.stack { align-content: start; }
.settings-card + .settings-card { border-left: 1px solid var(--line); padding-left: 32px; }
.settings-grid .store-settings { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); padding: 24px 0 0; }
.settings-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.store-settings-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 32px; }
.store-setting-row { display: grid; grid-template-columns: 12px 80px minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; }
.store-swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--row-digimium-hover); }
.store-swatch[data-store="dmarwal"] { background: var(--row-dmarwal-hover); }
.store-swatch[data-store="digimium2"] { background: var(--row-digimium2-hover); }
.store-swatch[data-store="telegram"] { background: var(--row-telegram-hover); }
.store-swatch[data-store="viber"] { background: var(--row-viber-hover); }
.store-swatch[data-store="extra1"] { background: var(--row-extra1-hover); }
.store-swatch[data-store="extra2"] { background: var(--row-extra2-hover); }
.store-code { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.stack { display: grid; gap: 14px; }
.empty-state { display: grid; place-items: center; min-height: 180px; padding: 24px; color: var(--muted); font-size: 14px; text-align: center; }

.app-loading, .login-shell { min-height: 100vh; min-height: 100svh; background: var(--bg); }
.app-loading { display: grid; place-items: center; padding: 24px; color: var(--muted); font-size: 13px; }
.login-shell { display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(404px, 100%); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 32px; }
.login-kicker { margin: 0 0 8px; color: var(--muted); font-size: 12px; text-align: center; }
.login-brand { --logo-width: 110px; display: flex; justify-content: center; margin: 12px auto 28px; }
.setup-copy { margin: -8px 0 24px; color: var(--muted); font-size: 13px; text-align: center; }
.login-panel .field + .field { margin-top: 16px; }
.password-field { display: flex; gap: 8px; }
.password-field input { min-width: 0; flex: 1; }
.password-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  min-width: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--muted);
}
.password-toggle:hover { color: var(--ink-strong); }
.login-error { min-height: 20px; margin: 10px 0; color: var(--danger); font-size: 12px; }
.success-message { color: var(--success); }
.login-button { width: 100%; }
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(420px, calc(100% - 48px));
  transform: translateY(8px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-strong);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  padding: 12px 16px;
  font-size: 13px;
  transition: opacity 140ms ease, transform 140ms ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

/* Compact tables keep price and both actions together; secondary fields remain in the edit form. */
@media (max-width: 1500px) {
  .sales-table .optional-column, .product-table .optional-column { display: none; }
  .total-label-wide { display: none; }
  .total-label-compact { display: table-cell; }
}
@media (max-width: 1120px) {
  .topbar .brand { --logo-width: 96px; gap: 10px; }
  .topbar { gap: 24px; padding-inline: 24px; }
  .nav { gap: 16px; }
  .session-controls { gap: 16px; }
  .container { width: calc(100% - 48px); }
  .toolbar { gap: 14px; }
  .toolbar > .action-row { flex-wrap: wrap; }
  .search-control { width: 240px; }
  .sale-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  html { scroll-padding-top: 128px; }
  .topbar { grid-template-columns: 1fr auto; gap: 0 20px; padding-top: 10px; }
  .session-controls { grid-row: 1; grid-column: 2; }
  .nav { grid-row: 2; grid-column: 1 / -1; justify-content: flex-start; gap: 28px; min-height: 48px; }
  .container { padding-top: 20px; }
  .toolbar > .action-row { width: 100%; }
  .action-row .search-control { flex: 1; }
  .toolbar { padding-bottom: 16px; }
  .sales-table { min-width: 920px; }
  .sales-table .col-product { width: 200px; }
  .product-table { min-width: 860px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 0; }
  .metric:nth-child(3) { border-left: 0; }
  .summary-form { gap: 12px; }
  .summary-form label:not(.check-label) { display: grid; gap: 5px; }
  .summary-form { align-items: end; }
  .summary-form .check-label { min-height: 38px; }
  .summary-form input, .summary-form select { width: 140px; }
  .summary-form .store-filter { width: 140px; }
  #sales-table-region, #products-table-region, .panel { scroll-margin-top: 124px; }
}
@media (max-width: 600px) {
  html { scroll-padding-top: 118px; }
  .topbar { grid-template-columns: auto minmax(0, 1fr); gap: 0 12px; padding-inline: max(16px, env(safe-area-inset-left)); padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar .brand { --logo-width: 80px; gap: 8px; }
  .brand-divider { height: 22px; }
  .login-brand { --logo-width: 94px; gap: 12px; }
  .session-controls { justify-content: flex-end; gap: 8px; }
  .session-controls .nav-link { font-size: 12px; }
  .sync-indicator { font-size: 10px; }
  .nav { justify-content: space-between; gap: 12px; min-height: 48px; }
  .nav-link { font-size: 13px; }
  .nav-full { display: none; }
  .nav-short { display: inline; }
  .container { width: 100%; padding: 20px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left)); }
  .toolbar-title { font-size: 18px; }
  .toolbar { gap: 16px; }
  .toolbar-group { gap: 10px; }
  .single-tab { font-size: 11px; padding-left: 10px; }
  .toolbar > .action-row { display: flex; flex-wrap: wrap; gap: 8px; }
  .action-row .search-control { flex: 1 1 100%; order: -1; }
  .action-row .store-filter { flex: 1; }
  .store-filter select { width: 100%; min-width: 0; }
  .primary-button, .secondary-button, .danger-button, .icon-button { min-height: 44px; font-size: 13px; }
  .icon-button { width: 40px; }
  .search-control { height: 44px; }
  .store-filter select { height: 42px; }
  .search-control input, .store-filter select { font-size: 16px; }
  .search-clear { width: 36px; height: 36px; }
  .panel-title { padding-inline: 16px; }
  .form-grid, .sale-form { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .field > span { font-size: 13px; }
  .field input, .field select, .field textarea, .summary-form input,
  .summary-form select, .store-setting-row input { min-height: 44px; font-size: 16px; }
  .form-actions { padding-top: 8px; }
  .password-toggle { min-height: 44px; width: 44px; min-width: 44px; }
  .table-card { margin-inline: -16px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  th, td { padding-inline: 10px; }
  .col-actions { width: 112px; }
  tbody td { height: 48px; }
  .row-action { width: 44px; height: 44px; flex-basis: 44px; }
  :is(.sales-table, .expiry-table), :is(.sales-table, .expiry-table) tbody { display: block; width: 100%; min-width: 0; }
  :is(.sales-table, .expiry-table) colgroup { display: none; }
  :is(.sales-table, .expiry-table) thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  :is(.sales-table, .expiry-table) .store-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 92px;
    gap: 4px 12px;
    border-top: 1px solid var(--line);
    padding: 14px 16px;
  }
  :is(.sales-table, .expiry-table) .store-row td { height: auto; min-width: 0; border: 0; padding: 0; }
  :is(.sales-table, .expiry-table) .store-row .number-cell { display: none; }
  :is(.sales-table, .expiry-table) .store-row td:nth-child(2) { grid-row: 1; grid-column: 1; color: var(--ink-strong); font-weight: 600; }
  :is(.sales-table, .expiry-table) .store-row td:nth-child(3) { grid-row: 2; grid-column: 1 / -1; white-space: normal; overflow-wrap: anywhere; }
  :is(.sales-table, .expiry-table) .store-row td:nth-child(4) { grid-row: 3; grid-column: 1 / -1; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
  :is(.sales-table, .expiry-table) .store-row td:nth-child(5) { grid-row: 4; grid-column: 1; }
  :is(.sales-table, .expiry-table) .store-row td:nth-child(6) { grid-row: 5; grid-column: 1; }
  :is(.sales-table, .expiry-table) .store-row td[data-label] { text-align: left; font-size: 12px; }
  :is(.sales-table, .expiry-table) td[data-label]::before { display: inline-block; min-width: 66px; color: var(--muted); content: attr(data-label); }
  .sales-table .store-row td:nth-child(9), .expiry-table .store-row td:nth-child(7) { grid-row: 1; grid-column: 2; text-align: right; font-size: 12px; font-weight: 600; }
  .sales-table .store-row td:nth-child(10) { grid-row: 4 / 6; grid-column: 2; align-self: center; }
  .sales-table .total-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-strong); }
  .sales-table .total-row td { height: auto; border: 0; padding: 0; }
  .sales-table .total-label-compact { display: block; text-align: left; }
  .sales-table .total-row td:last-child { display: none; }
  .table-pagination { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .table-pagination > div { width: 100%; justify-content: space-between; gap: 8px; }
  .table-pagination .secondary-button { min-height: 44px; }
  .panel > .toolbar { padding: 16px; }
  .metrics { padding-bottom: 20px; gap: 24px 0; }
  .metric { padding-inline: 16px; }
  .metric-label { min-height: 36px; }
  .metric-value { margin-top: 4px; font-size: 20px; }
  .summary-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 12px; align-items: end; }
  .summary-form input, .summary-form select { width: 100%; }
  .summary-form .store-filter { width: 100%; }
  .summary-form .store-filter select { height: 42px; min-height: 42px; }
  .summary-form label { min-width: 0; }
  .summary-form label:has(select[name="preset"]) { grid-column: 1 / -1; }
  .summary-form .check-label { min-height: 44px; }
  .summary-form .check-label input { width: 18px; height: 18px; min-height: 18px; }
  .table-card > .toolbar { padding: 20px 16px; }
  .settings-grid { grid-template-columns: 1fr; gap: 24px; padding: 20px 16px; }
  .settings-card + .settings-card { border-left: 0; border-top: 1px solid var(--line); padding: 24px 0 0; }
  .settings-card-heading { flex-wrap: wrap; gap: 12px; }
  .store-settings-list { grid-template-columns: 1fr; }
  .store-setting-row { grid-template-columns: 10px 70px minmax(0, 1fr); gap: 8px; }
  .login-shell { padding: 20px; }
  .login-panel { padding: 28px 24px; }
  .toast { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  select:not([multiple]), .store-filter select, .summary-form .store-filter select {
    -webkit-appearance: auto;
    appearance: auto;
    background-image: none;
    padding-right: 12px;
  }
}
