:root {
  --ink: #1b2228;
  --muted: #66717b;
  --line: #d7dde3;
  --panel: #f7f9fb;
  --paper: #ffffff;
  --blue: #2374ab;
  --green: #2f855a;
  --red: #a2393b;
  --gold: #b7791f;
  --violet: #6b46c1;
  --teal: #2c7a7b;
  --shadow: 0 8px 24px rgba(21, 34, 45, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: #e9edf1;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 14px;
}

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

button {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease, border-color .14s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
}

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

.shell.is-locked {
  display: block;
}

.shell.is-locked .sidebar {
  display: none;
}

.shell.is-locked .workspace {
  min-height: 100vh;
}

.sidebar {
  background: #20272e;
  color: #f8fafc;
  border-right: 1px solid #111820;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 20px;
}

.brand span {
  display: block;
  color: #bdc7d1;
  margin-top: 2px;
}

nav {
  padding: 10px;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  background: transparent;
  color: #edf2f7;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  background: #34404a;
}

.button:hover,
.icon-button:hover,
.product-tile:hover,
.tile:hover,
.report-type:hover,
.held-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(21, 34, 45, .10);
}

.button:active,
.icon-button:active,
.product-tile:active,
.tile:active,
.report-type:active,
.held-card-actions button:active {
  transform: translateY(1px) scale(.99);
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
}

#statusText {
  margin-left: auto;
  color: var(--muted);
}

html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] .sidebar {
  border-right: 0;
  border-left: 1px solid #111820;
}

html[dir="rtl"] .nav-button,
html[dir="rtl"] .restaurant-table-tile,
html[dir="rtl"] .product-tile,
html[dir="rtl"] .tile,
html[dir="rtl"] .grid th,
html[dir="rtl"] .grid td {
  text-align: right;
}

html[dir="rtl"] #statusText {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .num,
html[dir="rtl"] input[type="number"] {
  text-align: left;
  direction: ltr;
}

.icon-button {
  min-width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #eef2f6;
  color: var(--ink);
}

.view {
  flex: 1;
  padding: 16px;
  overflow: auto;
}

.login-view {
  min-height: calc(100vh - 56px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.login-users {
  padding: 18px;
  border-right: 1px solid var(--line);
}

html[dir="rtl"] .login-users {
  border-right: 0;
  border-left: 1px solid var(--line);
}

.login-pad {
  padding: 18px;
}

.login-tenant-summary {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.login-tenant-summary strong {
  font-size: 16px;
}

.login-tenant-summary span {
  color: var(--muted);
  font-size: 12px;
}

.login-tenant-summary .button {
  margin-top: 8px;
  justify-self: start;
}

html[dir="rtl"] .login-tenant-summary .button {
  justify-self: end;
}

.printer-note,
.terminal-note {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
}

.printer-note strong,
.terminal-note strong {
  color: var(--ink);
  font-size: 13px;
}

.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.user-button,
.tile {
  min-height: 86px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.08);
  color: white;
  padding: 12px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: inset 0 -24px 42px rgba(0,0,0,.08);
}

.user-button {
  background: var(--blue);
  justify-content: center;
  font-size: 18px;
}

.user-button.selected {
  outline: 3px solid #f6ad55;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 10px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.keypad button {
  height: 50px;
  border-radius: 6px;
  background: #edf2f7;
  border-color: var(--line);
  font-size: 18px;
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.tile {
  min-height: 110px;
}

.tile img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.tile strong {
  font-size: 18px;
  font-weight: 600;
}

.tile span {
  display: block;
  margin-top: 4px;
  color: rgba(255,255,255,.88);
}

.tile.blue { background: var(--blue); }
.tile.green { background: var(--green); }
.tile.red { background: var(--red); }
.tile.gold { background: var(--gold); }
.tile.violet { background: var(--violet); }
.tile.teal { background: var(--teal); }
.tile.dark { background: #334155; }

.section-title {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: #3b4650;
  text-transform: uppercase;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.toolbar .spacer {
  flex: 1;
}

.button {
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 6px;
  border-color: #bdc7d1;
  background: #f8fafc;
  color: var(--ink);
}

.button.primary { background: var(--blue); color: white; border-color: var(--blue); }
.button.success { background: var(--green); color: white; border-color: var(--green); }
.button.danger { background: var(--red); color: white; border-color: var(--red); }
.button.warning { background: var(--gold); color: white; border-color: var(--gold); }

.touch-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}

.touch-square {
  width: 48px;
  min-height: 48px;
  padding: 0;
  font-size: 22px;
  font-weight: 800;
}

.button-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: 0 0 auto;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(21, 34, 45, .04);
}

.grid th,
.grid td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.grid th {
  background: #eef2f6;
  font-weight: 650;
  color: #34404a;
  position: sticky;
  top: 0;
  z-index: 1;
}

.grid tr:hover td {
  background: #f9fbfd;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

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

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid #bdc7d1;
  border-radius: 4px;
  padding: 7px 9px;
  background: white;
  color: var(--ink);
}

input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.restaurant-shell {
  display: grid;
  gap: 12px;
}

.restaurant-toolbar {
  align-items: stretch;
}

.restaurant-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(96px, 1fr));
  gap: 8px;
}

.restaurant-status-strip div {
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.restaurant-status-strip span {
  color: var(--muted);
  font-size: 12px;
}

.restaurant-status-strip strong {
  font-size: 22px;
}

.restaurant-floor-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.restaurant-floor-tabs .tab-button {
  min-width: 150px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.restaurant-floor-tabs .tab-button span {
  min-width: 26px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #edf2f7;
  color: var(--muted);
  font-size: 12px;
}

.restaurant-table-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.restaurant-table-tile {
  min-height: 156px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 14px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 2px 10px rgba(21, 34, 45, .05);
}

.restaurant-table-tile.free {
  border-color: #95d5a5;
  background: #f1fbf5;
}

.restaurant-table-tile.busy {
  border-color: #e9c46a;
  background: #fff8e5;
}

.restaurant-table-tile strong {
  font-size: 22px;
  line-height: 1.08;
}

.restaurant-table-tile > span:not(.restaurant-table-state) {
  color: var(--muted);
}

.restaurant-table-state {
  width: max-content;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(47, 133, 90, .12);
  color: var(--green);
  font-weight: 800;
  font-size: 12px;
}

.restaurant-table-tile.busy .restaurant-table-state {
  background: rgba(183, 121, 31, .15);
  color: #7a4b07;
}

.restaurant-table-facts {
  display: grid;
  gap: 3px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,.08);
}

.restaurant-table-facts span {
  color: var(--muted);
  font-size: 12px;
}

.restaurant-table-facts strong {
  font-size: 16px;
}

.restaurant-order-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #95d5a5;
  border-radius: 6px;
  background: #f1fbf5;
}

.restaurant-order-banner > div:first-child {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.restaurant-order-banner strong,
.restaurant-order-banner span {
  display: block;
}

.restaurant-order-banner span {
  margin-top: 2px;
  color: var(--muted);
}

.restaurant-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 12px;
  height: calc(100vh - 88px);
}

.pos-browser,
.pos-cart {
  min-height: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.pos-header {
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.tile-list {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  overflow: auto;
}

.product-tile {
  min-height: 82px;
  border-radius: 4px;
  border: 1px solid #c8d2dc;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
  padding: 10px;
  animation: riseIn .22s ease both;
}

.product-tile strong {
  display: block;
  font-size: 15px;
}

.product-tile span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.cart-body {
  flex: 1;
  overflow: auto;
}

.cart-product-cell {
  display: grid;
  gap: 3px;
}

.cart-product-cell small,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.order-comment {
  font-style: italic;
}

.order-line-status {
  width: max-content;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 700;
}

.order-line-status.pending {
  background: #fff4d6;
  color: #7a4b07;
}

.order-line-status.sent {
  background: #e8f7ee;
  color: #1f7a4d;
}

.comment-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.comment-chip {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #b9c7d4;
  background: #f8fafc;
  color: var(--ink);
}

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

.held-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.held-card-grid.compact {
  grid-template-columns: 1fr;
}

.held-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  animation: riseIn .22s ease both;
}

.held-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.held-card-main .button-icon {
  width: 36px;
  height: 36px;
}

.held-card-main strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
}

.held-card-main span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.held-card-total {
  font-size: 24px;
  font-weight: 800;
}

.held-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hold-lines {
  display: grid;
  gap: 6px;
}

.hold-lines div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.hold-lines span {
  color: var(--muted);
  white-space: nowrap;
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed #aab6c2;
  border-radius: 6px;
  background: rgba(255,255,255,.7);
  color: var(--muted);
  text-align: center;
}

.empty-state .button-icon {
  width: 54px;
  height: 54px;
  opacity: .74;
}

.total-number {
  font-weight: 750;
  text-align: right;
}

.total-number small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.total-number strong {
  display: block;
  font-size: clamp(24px, 2.4vw, 32px);
  overflow-wrap: anywhere;
}

.dashboard-toolbar {
  margin-bottom: 10px;
  align-items: center;
}

.usd-stats {
  margin-bottom: 16px;
}

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

.replacement-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #f1c96b;
  border-radius: 6px;
  background: #fff7df;
  color: #4f3906;
}

.replacement-banner > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.replacement-banner strong,
.replacement-banner span {
  display: block;
}

.replacement-banner span {
  margin-top: 2px;
  color: #76520b;
}

.receipt-toolbar {
  align-items: center;
  margin-bottom: 12px;
}

.receipt-workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(360px, 440px);
  gap: 12px;
  align-items: start;
}

.receipt-list-panel,
.receipt-side-panel,
.receipt-lines-panel {
  min-width: 0;
}

.receipt-side-panel {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 12px;
}

.receipt-grid th,
.receipt-grid td {
  white-space: normal;
  vertical-align: top;
}

.receipt-grid tr {
  cursor: pointer;
}

.receipt-grid tr.is-selected td {
  background: #edf6fd;
  box-shadow: inset 3px 0 0 var(--blue);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.table-actions .button {
  min-height: 34px;
  padding: 7px 9px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  font-weight: 750;
  font-size: 12px;
}

.status-pill.success {
  border-color: #95d5a5;
  background: #ecfdf3;
  color: #176033;
}

.status-pill.warning {
  border-color: #e9c46a;
  background: #fff7df;
  color: #76520b;
}

.status-pill.danger {
  border-color: #f1a6aa;
  background: #fff1f2;
  color: #9f1d2e;
}

.receipt-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.receipt-detail-head h2 {
  margin: 2px 0 4px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.receipt-detail-head p {
  margin: 0;
  color: var(--muted);
}

.receipt-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.receipt-action-grid .button {
  justify-content: center;
}

.receipt-preview-shell,
.receipt-lines-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.invoice-dialog-preview {
  margin-top: 12px;
}

.partial-payment-dialog {
  display: grid;
  gap: 12px;
}

.payment-ledger-card {
  display: grid;
  gap: 4px;
  padding: 18px;
  border-radius: 6px;
  background: #102a43;
  color: white;
}

.payment-ledger-card span,
.payment-ledger-card small {
  color: rgba(255,255,255,.76);
}

.payment-ledger-card strong {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.total-strip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 6px 6px;
  background: #f8fafc;
}

.total-strip span {
  color: var(--muted);
}

.total-strip strong {
  font-size: 22px;
}

.supplier-register-shell {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(380px, 1.2fr) minmax(360px, .9fr);
  gap: 12px;
  align-items: start;
}

.supplier-register-panel {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.supplier-catalog-panel {
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.supplier-lines-panel {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 104px);
  overflow: auto;
}

.supplier-lines-head,
.supplier-group-head,
.supplier-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.supplier-scan-toolbar input {
  min-width: min(220px, 100%);
}

.supplier-line-options {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.supplier-filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.supplier-filter-chip {
  min-width: 150px;
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid #c8d2dc;
  border-radius: 6px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
}

.supplier-filter-chip.active {
  border-color: var(--blue);
  background: #edf6fd;
  box-shadow: inset 0 -3px 0 var(--blue);
}

.supplier-filter-chip strong,
.supplier-filter-chip span,
.supplier-file-row strong,
.supplier-file-row span {
  overflow-wrap: anywhere;
}

.supplier-filter-chip span {
  color: var(--muted);
  font-weight: 700;
}

.supplier-item-browser,
.supplier-item-group,
.supplier-upload-box,
.supplier-file-list {
  display: grid;
  gap: 10px;
}

.supplier-group-head {
  padding: 6px 2px 0;
  color: var(--muted);
}

.supplier-group-head strong {
  color: var(--ink);
}

.supplier-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 8px;
}

.supplier-item-card {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(92px, 1fr) auto;
  border: 1px solid #c8d2dc;
  border-radius: 6px;
  background: #fbfcfd;
  overflow: hidden;
}

.supplier-item-main {
  width: 100%;
  min-height: 92px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.supplier-item-main strong,
.supplier-item-main span {
  display: block;
  overflow-wrap: anywhere;
}

.supplier-item-main span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.supplier-item-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 10px 10px;
}

.supplier-line-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.supplier-line-table input {
  min-width: 86px;
}

.supplier-attachment-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.supplier-file-row {
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.supplier-file-row span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.supplier-file-list.compact .supplier-file-row {
  min-height: 44px;
}

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

.terminal-config-layout {
  min-width: min(900px, 78vw);
}

.crud-tabs-layout {
  min-width: min(900px, 78vw);
}

.tabs {
  display: grid;
  gap: 6px;
  position: sticky;
  top: 12px;
}

.tab-button {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-align: left;
}

.tab-button:hover,
.tab-button.active {
  border-color: var(--blue);
  background: #edf6fd;
  color: #17486b;
}

.settings-panels {
  min-width: 0;
}

.settings-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
}

.settings-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.settings-actions {
  margin-top: 12px;
}

.payment-dialog {
  width: min(1320px, 100%);
}

.preview-dialog {
  width: min(620px, 100%);
}

.payment-with-preview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 12px;
  align-items: start;
}

.payment-panel {
  display: grid;
  gap: 14px;
}

.payment-workflow {
  min-width: 0;
}

.payment-summary {
  display: grid;
  grid-template-columns: minmax(240px, .9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: stretch;
}

.payment-due {
  display: grid;
  gap: 6px;
  padding: 18px;
  border-radius: 6px;
  background: #102a43;
  color: white;
}

.payment-due span,
.payment-facts span {
  color: rgba(255,255,255,.78);
}

.payment-due strong {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.payment-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.payment-facts div {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 94px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.payment-facts span {
  color: var(--muted);
}

.payment-facts strong {
  font-size: 20px;
}

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

.payment-status-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.pay-status {
  min-height: 72px;
  display: grid;
  gap: 3px;
  padding: 12px;
  border-radius: 6px;
  border: 2px solid var(--line);
  background: white;
  text-align: left;
}

.pay-status strong {
  font-size: 20px;
}

.pay-status span {
  color: var(--muted);
}

.pay-status.active {
  border-color: var(--green);
  background: #edfdf4;
}

.payment-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(118px, 1fr));
  gap: 10px;
}

.payment-fields label,
.invoice-form-grid label {
  min-width: 0;
}

.payment-fields input,
.payment-fields select,
.payment-fields textarea {
  width: 100%;
  min-height: 50px;
  font-size: 18px;
}

.payment-fields textarea {
  resize: vertical;
  min-height: 72px;
  font-size: 16px;
}

.payment-cash-buttons,
.payment-keypad {
  display: grid;
  gap: 8px;
}

.payment-cash-buttons {
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.payment-keypad {
  grid-template-columns: repeat(3, 1fr);
}

.payment-cash-buttons button,
.payment-keypad button,
.modal-number-pad button,
.preset-grid button {
  min-height: 54px;
  border-radius: 6px;
  border-color: var(--line);
  background: #eef2f6;
  font-size: 20px;
  font-weight: 650;
}

.modal-number-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.modal-number-pad [data-number-clear] {
  grid-column: span 3;
}

.cashier-form input,
.cashier-form select {
  min-height: 52px;
  font-size: 18px;
}

.keypad-panel {
  display: grid;
  gap: 12px;
}

.keypad-panel input {
  min-height: 58px;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.payment-primary,
.payment-secondary {
  min-height: 52px;
  min-width: 170px;
  font-size: 17px;
  font-weight: 700;
}

.invoice-toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.invoice-toggle-row .button {
  min-height: 54px;
  min-width: 180px;
  font-weight: 750;
}

.invoice-toggle-row span {
  color: var(--muted);
}

.invoice-section {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  animation: riseIn .16s ease;
}

.invoice-section[hidden] {
  display: none;
}

.invoice-section-title {
  display: grid;
  gap: 3px;
}

.invoice-section-title strong {
  font-size: 18px;
}

.invoice-section-title span {
  color: var(--muted);
}

.invoice-paper-row {
  grid-template-columns: minmax(220px, 320px);
}

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

.invoice-form-grid fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.invoice-form-grid legend {
  padding: 0 6px;
  font-weight: 750;
}

.invoice-form-grid input,
.invoice-form-grid textarea,
.invoice-form-grid select {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.payment-preview-card {
  position: sticky;
  top: 12px;
  max-height: min(720px, 82vh);
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.preview-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.preview-card-head strong {
  font-size: 18px;
}

.preview-card-head span {
  color: var(--muted);
  font-size: 12px;
}

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

.receipt-preview,
.invoice-preview,
.preview-tender {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 12px;
}

.receipt-preview header,
.invoice-preview header {
  display: grid;
  gap: 2px;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px dashed #a9b4bf;
}

.receipt-preview header strong {
  font-size: 22px;
}

.receipt-preview header span,
.receipt-preview footer,
.invoice-preview header span,
.muted-preview span {
  color: var(--muted);
}

.receipt-preview header em {
  justify-self: center;
  margin-top: 4px;
  padding: 3px 8px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-style: normal;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.preview-meta {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 4px 8px;
  padding: 10px 0;
  border-bottom: 1px dashed #a9b4bf;
}

.preview-meta span,
.preview-line small,
.preview-total span,
.preview-tender span,
.invoice-party-grid span,
.invoice-party-grid small {
  color: var(--muted);
}

.preview-meta strong {
  overflow-wrap: anywhere;
}

.preview-lines {
  display: grid;
  gap: 0;
}

.preview-line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid #eef2f6;
}

.preview-line small {
  display: block;
  margin-top: 2px;
}

.invoice-lines .preview-line {
  grid-template-columns: 24px minmax(0, 1fr) auto;
}

.preview-total {
  display: grid;
  gap: 4px;
  padding-top: 8px;
}

.preview-total div,
.preview-tender div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.preview-total .grand {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 2px solid var(--ink);
  font-size: 18px;
}

.receipt-preview footer {
  margin-top: 10px;
  text-align: center;
}

.preview-tender {
  display: grid;
  gap: 6px;
}

.invoice-party-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.invoice-party-grid div {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.muted-preview {
  display: grid;
  gap: 4px;
  text-align: center;
}

.print-preview-modal {
  max-width: 430px;
  margin: 0 auto;
}

.report-shell {
  display: grid;
  gap: 14px;
}

.report-controls,
.report-result {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.report-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.report-type {
  min-height: 78px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #f8fafc;
  text-align: left;
}

.report-type .button-icon {
  width: 34px;
  height: 34px;
  grid-row: span 2;
}

.report-type strong {
  font-size: 16px;
}

.report-type span,
.report-title span {
  color: var(--muted);
}

.report-type.active {
  border-color: var(--blue);
  background: #edf6fd;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto auto;
  gap: 8px;
  align-items: end;
}

.report-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}

.report-title strong {
  display: block;
  font-size: 18px;
}

.report-grid th,
.report-grid td {
  white-space: nowrap;
}

.accounting-shell {
  display: grid;
  gap: 14px;
}

.accounting-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) repeat(2, minmax(150px, 190px)) auto auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.accounting-controls > div {
  display: grid;
  gap: 3px;
}

.accounting-controls strong {
  font-size: 18px;
}

.accounting-controls span {
  color: var(--muted);
}

.accounting-report {
  display: grid;
  gap: 12px;
}

.accounting-report-head,
.accounting-panel,
.accounting-kpi {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.accounting-report-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px;
}

.accounting-report-head h2 {
  margin: 2px 0 0;
  font-size: 22px;
}

.accounting-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 10px;
}

.accounting-kpi {
  display: grid;
  gap: 5px;
  min-height: 112px;
  padding: 13px;
  border-left-width: 5px;
  align-content: center;
}

.accounting-kpi.positive { border-left-color: var(--green); }
.accounting-kpi.negative { border-left-color: var(--red); }
.accounting-kpi.warning { border-left-color: var(--gold); }
.accounting-kpi.neutral { border-left-color: var(--blue); }

.accounting-kpi span,
.accounting-kpi small {
  color: var(--muted);
}

.accounting-kpi span {
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.accounting-kpi strong {
  font-size: 22px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

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

.accounting-panel {
  min-width: 0;
  padding: 12px;
  overflow: auto;
}

.accounting-number {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.accounting-number.positive { color: var(--green); }
.accounting-number.negative { color: var(--red); }
.accounting-number.warning { color: var(--gold); }
.accounting-number.neutral { color: var(--blue); }

.accounting-table th,
.accounting-table td,
.accounting-data-table th,
.accounting-data-table td {
  vertical-align: top;
  white-space: normal;
}

.accounting-table th {
  width: 34%;
  color: var(--ink);
}

.accounting-table td:nth-child(2) {
  min-width: 145px;
  text-align: right;
}

.accounting-table td:nth-child(3) {
  color: var(--muted);
}

.accounting-data-table td {
  min-width: 92px;
}

.accounting-data-table.daily td {
  position: relative;
}

.accounting-bar {
  position: absolute;
  left: 6px;
  right: auto;
  bottom: 4px;
  width: var(--w);
  max-width: calc(100% - 12px);
  height: 3px;
  border-radius: 999px;
  opacity: .45;
}

.accounting-bar.sales {
  background: var(--green);
}

.accounting-bar.expense {
  background: var(--red);
}

.print-choice {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.print-format {
  min-height: 160px;
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  text-align: center;
}

.print-format .button-icon {
  width: 58px;
  height: 58px;
}

.print-format strong {
  font-size: 20px;
}

.print-format span {
  color: var(--muted);
}

.print-format.active,
.print-format:hover {
  border-color: var(--blue);
  background: #edf6fd;
}

.modal[hidden],
.toast[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(12, 18, 24, .48);
  display: grid;
  place-items: center;
  padding: 18px;
}

.dialog {
  width: min(920px, 100%);
  max-height: min(760px, 92vh);
  overflow: auto;
  background: white;
  border-radius: 6px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.dialog.payment-dialog {
  width: min(1500px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dialog.invoice-dialog {
  width: min(1080px, calc(100vw - 20px));
}

.dialog.preview-dialog {
  width: min(620px, calc(100vw - 20px));
}

.dialog.payment-dialog > header,
.dialog.payment-dialog > footer {
  flex: 0 0 auto;
}

.dialog.payment-dialog > .content {
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.dialog.payment-dialog footer {
  padding: 10px 12px;
}

.dialog header,
.dialog footer {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.dialog h2 {
  margin: 0;
  font-size: 18px;
}

.dialog .content {
  padding: 12px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

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

.stat strong {
  display: block;
  margin-top: 6px;
  font-size: clamp(18px, 1.8vw, 24px);
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 6px;
  background: #20272e;
  color: white;
  box-shadow: var(--shadow);
}

.alert-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 14px;
}

.alert-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) minmax(120px, auto);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 6px;
  background: var(--paper);
}

.alert-row.warning { border-left-color: var(--gold); }
.alert-row.danger { border-left-color: var(--red); }
.alert-row em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.inline-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.inline-control select {
  min-width: 74px;
}

.compact-tiles {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 14px;
}

.split-workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, .8fr);
  gap: 12px;
  align-items: start;
}

.side-panel {
  min-width: 0;
  position: sticky;
  top: 12px;
  display: grid;
  gap: 10px;
}

.stock-count-lines {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.stock-count-line {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto 120px minmax(120px, .7fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}

.stock-count-line span {
  color: var(--muted);
}

.modifier-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.modifier-picker .section-title {
  grid-column: 1 / -1;
  margin: 0;
}

.kds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.kds-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 4px 14px rgba(21, 34, 45, .08);
}

.kds-card header,
.kds-meta,
.kds-card footer {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.kds-card header span,
.kds-item span,
.kds-meta {
  color: var(--muted);
}

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

.kds-card footer .button {
  min-height: 34px;
  padding: 7px 9px;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .shell.menu-open {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .shell.menu-open .sidebar {
    display: block;
  }

  .login-box,
  .pos-layout,
  .settings-layout,
  .supplier-register-shell,
  .accounting-controls,
  .accounting-section-grid,
  .receipt-workspace,
  .split-workspace,
  .payment-with-preview,
  .payment-summary,
  .payment-fields,
  .invoice-form-grid,
  .invoice-party-grid,
  .report-filters {
    grid-template-columns: 1fr;
    height: auto;
  }

  .payment-preview-card {
    position: static;
    max-height: none;
  }

  .invoice-toggle-row {
    align-items: stretch;
    flex-direction: column;
  }

  .payment-status-options,
  .payment-facts,
  .payment-cash-buttons {
    grid-template-columns: 1fr;
  }

  .tabs {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .receipt-side-panel {
    position: static;
  }

  .side-panel {
    position: static;
  }

  .alert-row,
  .stock-count-line {
    grid-template-columns: 1fr;
  }

  .supplier-lines-panel,
  .supplier-catalog-panel {
    position: static;
    max-height: none;
  }

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

  .receipt-action-grid {
    grid-template-columns: 1fr;
  }

  .accounting-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-users {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  html[dir="rtl"] .login-users {
    border-left: 0;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  .payment-with-preview {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
  }

  .payment-summary {
    grid-template-columns: minmax(210px, .9fr) minmax(0, 1.1fr);
  }

  .payment-facts {
    grid-template-columns: repeat(3, 1fr);
  }

  .payment-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payment-cash-buttons {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (max-width: 760px) {
  .modal {
    padding: 8px;
  }

  .dialog.payment-dialog {
    width: calc(100vw - 16px);
  }

  .payment-with-preview,
  .payment-summary,
  .payment-fields {
    grid-template-columns: 1fr;
  }

  .payment-cash-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .payment-keypad {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .supplier-lines-head,
  .supplier-file-row {
    grid-template-columns: 1fr;
  }

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

  .accounting-kpi-grid {
    grid-template-columns: 1fr;
  }

  .accounting-report-head {
    display: grid;
  }

  .payment-due strong {
    font-size: 34px;
  }
}
