﻿:root {
  color-scheme: light;
  --ink: #071124;
  --muted: #667792;
  --line: #dfe6ef;
  --soft: #f3f6fa;
  --panel: #ffffff;
  --bg: #f8fafc;
  --navy: #0b1228;
  --blue: #2563eb;
  --green: #15803d;
  --amber: #a16207;
  --red: #b42318;
  --shadow: 0 1px 2px rgba(8, 15, 30, 0.08), 0 6px 18px rgba(8, 15, 30, 0.05);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.35 system-ui, -apple-system, Segoe UI, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
  font-size: 14px;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  padding: 0 14px;
  background: var(--navy);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

button.secondary {
  background: #eef2f7;
  color: var(--ink);
}

button.danger {
  background: var(--red);
}

button.activate {
  background: var(--green);
}

button.deactivate {
  background: #bfbfbf;
  color: var(--ink);
}

.button-link,
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 9px;
  padding: 0 14px;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button-link.secondary,
.file-button.secondary {
  background: #eef2f7;
  color: var(--ink);
}

.button-link.icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.file-button input {
  display: none;
}

button.icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
}

button.action-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  line-height: 1;
}

button.action-icon.danger {
  border-color: var(--red);
  background: #fff;
  color: var(--red);
}

button.danger-x,
.pos-keypad button.danger-x,
.pos-icon-btn.danger-x {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

button.danger-x:hover:not(:disabled),
.pos-keypad button.danger-x:hover:not(:disabled),
.pos-icon-btn.danger-x:hover:not(:disabled) {
  background: #c81e1e;
  color: #fff;
}

.delete-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.x-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 5;
  stroke-linecap: square;
}

.nav-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hr-tab-icon {
  display: none;
}

.status-toggle {
  position: relative;
  width: 40px;
  min-height: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #d5dfeb;
  border-radius: 999px;
  background: #eef3f8;
  color: transparent;
  vertical-align: middle;
  box-shadow: none;
  transition: background 160ms ease, border-color 160ms ease;
}

.status-toggle span {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-size: 13px;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(8, 15, 30, 0.18);
  transition: transform 180ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 160ms ease;
}

.status-toggle.is-active {
  border-color: #15803d;
  background: #15803d;
  box-shadow: none;
}

.status-toggle.is-active span {
  transform: translateX(18px);
}

.status-toggle:hover {
  border-color: #8ea0b6;
  box-shadow: none;
}

.status-toggle.is-active:hover {
  border-color: #116233;
}

.status-toggle:active span {
  transform: scale(0.94);
}

.status-toggle.is-active:active span {
  transform: translateX(18px) scale(0.94);
}

.status-toggle:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.25);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline-color: #b6c6dd;
}

select {
  padding-right: 34px;
  font-weight: 800;
  text-overflow: ellipsis;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

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

a {
  color: var(--blue);
  font-weight: 750;
}

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

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 12px;
}

.auth-card {
  width: min(426px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.auth-brand {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  justify-items: stretch;
  align-items: center;
  gap: 22px;
  margin-bottom: 22px;
  text-align: left;
}

.auth-brand img {
  width: 104px;
  height: 104px;
  object-fit: contain;
  justify-self: center;
}

.auth-brand-text {
  display: grid;
  gap: 12px;
  align-content: center;
  justify-items: center;
  min-width: 0;
}

.auth-brand h1,
.auth-brand .auth-brand-en,
.auth-brand .auth-brand-ar {
  margin: 0;
  color: #6f432f;
  font-weight: 700;
  letter-spacing: 0;
  text-wrap: balance;
}

.auth-brand-ar {
  font-family: "DecoType Thuluth", "Decotype Thulth", "DecoType Naskh", "Aldhabi", "Arabic Typesetting", "Traditional Arabic", "Times New Roman", serif;
  font-size: 66px;
  line-height: 0.82;
  text-align: center;
}

.auth-brand-en {
  font-family: "Cinzel", "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  font-size: 25px;
  line-height: 1.05;
  text-transform: uppercase;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 24px 0 18px;
  padding: 4px;
  border-radius: 9px;
  background: #eef2f7;
}

.auth-tabs button {
  background: transparent;
  color: var(--muted);
}

.auth-tabs button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.auth form {
  display: grid;
  gap: 14px;
}

.branch-pos-login-card {
  width: min(420px, 100%);
  margin: 32px auto;
}

.branch-shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--bg);
  border-left: 0;
  border-right: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
}

.branch-shell.branch-pos-shell {
  width: 100%;
  max-width: none;
}

.branch-top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 6px 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.branch-title {
  display: grid;
  grid-template-columns: 36px 1fr;
  column-gap: 8px;
  align-items: center;
  min-width: 170px;
  flex: 0 0 auto;
  cursor: pointer;
  border-radius: 8px;
  padding: 2px;
}

.branch-title:hover {
  background: #f1f5f9;
}

.branch-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: none;
  background: rgba(7, 17, 36, 0.34);
}

.branch-side-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 29;
  width: min(255px, 78vw);
  height: 100vh;
  padding: 18px 14px;
  background: #050816;
  color: #fff;
  transform: translateX(-102%);
  transition: transform 160ms ease;
  box-shadow: 18px 0 48px rgba(0, 0, 0, 0.28);
}

.branch-shell.menu-open .branch-side-menu {
  transform: translateX(0);
}

.branch-shell.menu-open .branch-menu-backdrop {
  display: block;
}

.branch-menu-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.branch-menu-list button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  gap: 10px;
  min-height: 38px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  text-align: left;
}

.branch-menu-list button:hover,
.branch-menu-list button:focus-visible {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.78);
  color: #050816;
}

.branch-menu-list button.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.branch-menu-list button.active:hover,
.branch-menu-list button.active:focus-visible {
  background: rgba(255, 255, 255, 0.78);
  color: #050816;
}

.branch-menu-list .menu-logout {
  color: #ff4d4d;
  margin-top: 8px;
}

.branch-menu-list .menu-logout:hover,
.branch-menu-list .menu-logout:focus-visible {
  border-color: rgba(255, 77, 77, 0.62);
  background: rgba(255, 77, 77, 0.14);
  color: #ff6b6b;
}

.branch-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.branch-title strong {
  display: block;
  font-size: 16px;
}

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

.branch-top .inline {
  flex-wrap: nowrap;
  overflow-x: auto;
  justify-content: flex-end;
  min-width: 0;
}

.branch-top .inline button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.branch-top .branch-action {
  width: 42px;
  min-height: 42px;
  border-radius: 10px;
}

.branch-header-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.branch-header-nav button {
  display: inline-grid;
  grid-template-columns: 20px auto;
  align-items: center;
  justify-content: start;
  gap: 8px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  white-space: nowrap;
  flex: 0 0 auto;
}

.branch-header-nav button.active {
  border-color: #cbd7e6;
  background: #eef3f8;
}

.branch-header-nav button:last-child {
  color: var(--red);
}

.branch-content {
  padding: 16px 12px 140px;
  min-width: 0;
}

.branch-pos-shell .branch-content {
  min-height: calc(100vh - 59px);
  padding: 12px clamp(8px, 1.2vw, 18px) 18px;
}

.branch-pos-shell .branch-top {
  padding-left: clamp(12px, 1.4vw, 22px);
  padding-right: clamp(12px, 1.4vw, 22px);
}

.branch-pos-shell .branch-header-nav {
  flex: 0 0 auto;
  width: auto;
}

.search {
  position: relative;
  margin-bottom: 14px;
}

.search input {
  height: 36px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding-left: 36px;
  font-size: 16px;
}

.compact-search {
  width: min(390px, 100%);
}

.catalog-toolbar {
  align-items: center;
}

.catalog-toolbar-actions {
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  min-width: 0;
}

.catalog-toolbar-actions .compact-search {
  flex: 1 1 360px;
  width: auto;
  max-width: 520px;
}

.catalog-toolbar-actions .sort-controls {
  flex: 0 0 auto;
  align-items: center;
}

.report-filters {
  display: grid;
  grid-template-columns: minmax(180px, 1.3fr) repeat(2, minmax(150px, 1fr)) minmax(112px, auto) auto minmax(160px, auto);
  gap: 10px;
  align-items: end;
  margin: 16px 0;
}

.report-action {
  min-width: 0;
  min-height: 38px;
  padding: 0 12px;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: minmax(660px, 1.3fr) minmax(430px, 0.7fr);
  gap: 16px;
}

.report-summary-grid > .panel {
  min-width: 0;
}

.report-orders-table {
  table-layout: fixed;
}

.report-orders-table th:nth-child(1),
.report-orders-table td:nth-child(1) {
  width: 46px;
}

.report-orders-table th:nth-child(2),
.report-orders-table td:nth-child(2) {
  width: 108px;
}

.report-orders-table th:nth-child(3),
.report-orders-table td:nth-child(3) {
  width: 118px;
}

.report-orders-table th:nth-child(n+4):nth-child(-n+7),
.report-orders-table td:nth-child(n+4):nth-child(-n+7) {
  width: 54px;
  text-align: center;
}

.report-orders-table th:last-child,
.report-orders-table td:last-child {
  width: 126px;
  text-align: right;
}

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

.report-orders-table .status {
  white-space: normal;
  text-align: center;
}

.report-orders-table button {
  min-width: 56px;
}

.report-orders-table .row-actions {
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

.search::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 10px;
  z-index: 1;
  width: 10px;
  height: 10px;
  border: 2px solid var(--muted);
  border-radius: 50%;
}

.search::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 24px;
  z-index: 1;
  width: 8px;
  height: 2px;
  background: var(--muted);
  transform: rotate(45deg);
  transform-origin: left center;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 8px;
  background: #eef3f8;
}

.chip {
  min-height: 30px;
  background: transparent;
  color: #52647d;
  padding: 0 10px;
}

.chip.active {
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

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

.product-card {
  min-height: 120px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  align-items: start;
  column-gap: 10px;
  gap: 4px;
}

.image-placeholder {
  display: grid;
  place-items: center;
  grid-row: 1 / 5;
  grid-column: 1;
  width: 96px;
  height: 96px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
}

.product-image {
  grid-row: 1 / 5;
  grid-column: 1;
  width: 96px;
  height: 96px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: #eef2f7;
}

.product-card strong {
  grid-column: 2;
  align-self: end;
  font-size: 15px;
}

.product-card .unit {
  grid-column: 2;
  color: var(--muted);
  font-size: 13px;
}

.product-card .qty-stepper {
  grid-column: 2;
  align-self: end;
}

.qty-stepper {
  display: grid;
  grid-template-columns: 26px 1fr 26px;
  gap: 4px;
  align-items: center;
}

.qty-stepper button {
  width: 26px;
  min-height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.qty-stepper input {
  appearance: textfield;
  -moz-appearance: textfield;
  height: 32px;
  min-height: 32px;
  padding: 0;
  text-align: center;
  line-height: 32px;
  font-size: 14px;
  box-shadow: var(--shadow);
}

.qty-stepper input::-webkit-inner-spin-button,
.qty-stepper input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.submit-bar {
  position: fixed;
  left: calc(50% + 88px);
  bottom: 0;
  transform: translateX(-50%);
  width: min(1064px, calc(100% - 176px));
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.38);
}

.review-modal {
  width: min(560px, 100%);
  max-height: min(680px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.pos-receipt-modal {
  width: min(430px, 100%);
}

.receipt-preview {
  width: min(330px, 100%);
  justify-self: center;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.receipt-head {
  display: grid;
  gap: 3px;
  text-align: center;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
}

.receipt-head strong {
  font-size: 16px;
}

.receipt-lines {
  display: grid;
  gap: 8px;
}

.receipt-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 58px;
  gap: 8px;
  align-items: start;
}

.receipt-line div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.receipt-line span,
.receipt-head span {
  color: var(--muted);
}

.receipt-line > span {
  color: var(--ink);
  text-align: right;
}

.receipt-totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

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

.review-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}

.review-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 34px 34px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.review-line strong,
.review-line span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-stepper {
  grid-template-columns: 30px minmax(52px, 1fr) 30px;
}

.review-line .action-icon {
  width: 34px;
  min-height: 34px;
}

.review-line .is-active-note {
  border-color: #cbd7e6;
  background: #eef3f8;
}

.review-note-input {
  grid-column: 1 / -1;
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.review-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.compact-toolbar {
  margin-top: 14px;
}

.compact-link {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}

.compact-filter-panel {
  padding: 12px 14px;
}

.compact-select {
  min-width: min(340px, 100%);
  max-width: 420px;
}

.compact-select select {
  min-height: 38px;
  height: 38px;
  padding-left: 16px;
  padding-right: 40px;
  font-size: 15px;
}

.compact-backup-panel {
  padding: 12px 14px;
}

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

.backup-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.backup-status.ok {
  background: #e8f7ee;
  color: var(--green);
}

.backup-status.warn {
  background: #fff4e5;
  color: var(--amber);
}

.backup-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.backup-form label {
  gap: 4px;
}

.backup-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.backup-buttons .button-link,
.backup-form button {
  min-height: 34px;
  padding: 0 16px;
  white-space: nowrap;
}

.backup-form input[type="file"] {
  min-height: 34px;
  padding: 5px 8px;
}

.reset-panel {
  padding: 14px;
}

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

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

.reset-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.reset-option input {
  min-height: 20px;
  margin-top: 2px;
}

.reset-option span {
  display: grid;
  gap: 3px;
}

.reset-option small {
  color: var(--muted);
  line-height: 1.35;
}

.reset-confirm-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.reset-confirm-row label {
  margin: 0;
}

.tight-scroll {
  max-height: 220px;
  margin-top: 12px;
}

.small-note {
  margin: 8px 0 0;
  font-size: 12px;
}

.orders-header {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.orders-header button {
  background: #fff;
  color: var(--ink);
  padding: 0;
  min-height: 28px;
}

.pos-register {
  display: grid;
  grid-template-columns: minmax(238px, 0.78fr) minmax(360px, 1.65fr) minmax(218px, 0.68fr);
  gap: 12px;
  align-items: stretch;
  min-height: calc(100vh - 104px);
  margin-bottom: 0;
  width: 100%;
}

.pos-register .panel {
  margin: 0;
  height: 100%;
}

.pos-ticket,
.pos-products,
.pos-pay {
  min-height: 0;
}

.pos-ticket {
  display: flex;
  flex-direction: column;
}

.pos-ticket-head,
.pos-ticket-actions,
.pos-search-row,
.pos-payments {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pos-ticket-head {
  justify-content: space-between;
  margin-bottom: 12px;
}

.pos-ticket-head h2,
.pos-pay h2 {
  margin: 0;
}

.pos-lines {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  max-height: none;
  flex: 1;
  overflow: auto;
  padding-right: 2px;
}

.pos-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
  align-items: center;
  gap: 6px 8px;
  width: 100%;
  min-height: 50px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.pos-line.active {
  border-color: var(--navy);
  background: #eef7fb;
}

.pos-line-name {
  display: grid;
  gap: 3px;
}

.pos-line-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  grid-column: auto;
}

.pos-line-qty {
  width: 40px;
  min-height: 28px;
  height: 28px;
  padding: 4px 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
  appearance: textfield;
  -moz-appearance: textfield;
}

.pos-line-total {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  height: 28px;
  padding: 0 6px;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.pos-line-qty::-webkit-inner-spin-button,
.pos-line-qty::-webkit-outer-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.pos-mini-btn,
.pos-icon-btn {
  min-height: 28px;
  width: 30px;
  padding: 0;
  border-radius: 6px;
  font-weight: 900;
}

.pos-mini-btn.active {
  background: #dcfce7;
  color: var(--green);
}

.pos-icon-btn {
  width: 34px;
  min-height: 32px;
}

.pos-ticket-actions .pos-icon-btn {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.pos-ticket-actions .pos-icon-btn .x-icon {
  width: 15px;
  height: 15px;
  display: block;
  stroke-width: 4;
  stroke-linecap: round;
}

.pos-line small,
.pos-item span {
  color: var(--muted);
  font-size: 12px;
}

.pos-line-gift {
  grid-column: 1 / -1;
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pos-summary {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pos-summary div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.pos-total {
  align-items: baseline;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 20px;
}

.pos-total strong {
  font-size: 26px;
  color: var(--navy);
}

.pos-negative {
  color: var(--red);
}

.pos-products {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.pos-search-row {
  align-items: stretch;
}

.pos-search-row input {
  flex: 1;
}

.pos-barcode-input {
  max-width: 180px;
}

.pos-search-row select {
  width: 150px;
}

.pos-category-row {
  margin: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 2px;
}

.pos-item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(112px, 15vw, 148px), 1fr));
  grid-auto-rows: auto;
  align-content: start;
  align-items: start;
  gap: 8px;
  overflow: auto;
  min-height: 0;
  max-height: none;
  flex: 1;
  padding-right: 2px;
}

.pos-item {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 70px;
  height: auto;
  padding: 10px;
  border: 1px solid #d6e0ea;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.pos-item strong {
  font-size: 13px;
  line-height: 1.2;
}

.pos-item:hover {
  border-color: var(--navy);
  background: #f8fbfd;
}

.pos-pay {
  display: grid;
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
  gap: 8px;
}

.pos-payments button,
.pos-discount-btn {
  min-height: 32px;
  padding: 0 6px;
}

.pos-display {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 24px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

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

.pos-keypad button {
  min-height: 58px;
  border-radius: 8px;
  background: #eef7fb;
  color: var(--navy);
  font-size: 25px;
  box-shadow: inset 0 -2px 0 rgba(15, 23, 42, 0.08);
}

.pos-keypad button.secondary {
  background: #eef2f7;
  color: var(--ink);
}

.pos-keypad button.danger,
.pos-icon-btn.danger {
  background: var(--red);
  color: #fff;
}

.pos-payments {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-content: start;
  gap: 7px;
}

.payment-method {
  min-height: 46px !important;
}

.payment-method:not(.secondary) {
  background: var(--navy);
  color: #fff;
}

.payment-method:not(.secondary) .payment-logo {
  background: transparent;
  color: #fff;
}

button.payment-cash,
button.payment-card {
  grid-column: span 3;
}

button.payment-talabat,
button.payment-noon,
button.payment-keeta,
button.payment-bdhyafa,
button.payment-ysd,
button.payment-belad {
  grid-column: span 2;
}

.pos-cash-input {
  min-height: 32px;
  height: 32px;
  appearance: textfield;
  -moz-appearance: textfield;
}

.pos-cash-input::-webkit-inner-spin-button,
.pos-cash-input::-webkit-outer-spin-button,
.pos-discount-row input::-webkit-inner-spin-button,
.pos-discount-row input::-webkit-outer-spin-button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
}

.pos-discount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 58px;
  gap: 5px;
}

.pos-discount-row input,
.pos-discount-row button {
  min-height: 32px;
  height: 32px;
  padding-inline: 8px;
}

.pos-discount-row input {
  appearance: textfield;
  -moz-appearance: textfield;
}

.payment-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 30px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
  letter-spacing: 0;
}

.payment-logo.payment-cash,
.payment-logo.payment-card {
  background: #fff;
  color: currentColor;
}

.payment-logo.payment-talabat {
  background: #ff4b00;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
}

.payment-logo.payment-noon,
.payment-logo.payment-keeta {
  background: #ffd400;
  color: #111827;
  font-size: 13px;
}

.payment-logo.payment-internal {
  background: #eef2f7;
  color: #0f172a;
  font-size: 12px;
}

@media (max-width: 1180px) and (min-width: 901px) {
  .pos-register {
    grid-template-columns: minmax(220px, 0.72fr) minmax(330px, 1.5fr) minmax(204px, 0.68fr);
    gap: 9px;
  }

  .pos-register .panel {
    padding: 12px;
  }

  .pos-search-row {
    gap: 6px;
  }

  .pos-barcode-input {
    max-width: 142px;
  }

  .pos-item {
    padding: 8px;
  }

  .pos-keypad button {
    min-height: 52px;
  }

  .payment-method {
    min-height: 42px !important;
  }

  .payment-logo {
    height: 27px;
    font-size: 12px;
  }
}

@media (max-height: 820px) and (min-width: 761px) {
  .branch-pos-shell .branch-content {
    padding-top: 8px;
    padding-bottom: 10px;
  }

  .pos-register {
    min-height: calc(100vh - 76px);
    gap: 8px;
  }

  .pos-register .panel {
    padding: 10px;
  }

  .pos-ticket-head {
    margin-bottom: 8px;
  }

  .pos-lines,
  .pos-item-grid {
    gap: 5px;
  }

  .pos-line {
    min-height: 44px;
    padding: 6px 7px;
  }

  .pos-summary {
    gap: 5px;
    margin-top: 7px;
    padding-top: 8px;
  }

  .pos-total {
    font-size: 17px;
  }

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

  .pos-item {
    min-height: 60px;
    padding: 8px;
  }

  .pos-item strong {
    font-size: 12px;
  }

  .pos-display {
    min-height: 40px;
    font-size: 21px;
  }

  .pos-keypad {
    gap: 5px;
  }

  .pos-keypad button {
    min-height: 44px;
    font-size: 23px;
  }

  .pos-cash-input,
  .pos-discount-row input,
  .pos-discount-row button {
    min-height: 30px;
    height: 30px;
  }

  .payment-method {
    min-height: 38px !important;
  }
}

.alert-list {
  display: grid;
}

.alert-list div {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.plain-icon {
  width: 26px;
  min-height: 26px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

.plain-icon:hover {
  color: var(--navy);
  background: transparent;
}

.box-prep-card {
  min-height: 120px;
  grid-template-columns: 96px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
}

.box-prep-card .product-main {
  display: grid;
  gap: 6px;
  grid-column: 2;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  text-align: left;
  padding: 0;
  min-height: auto;
}

.box-prep-card .qty-stepper {
  grid-column: 2;
}

.box-prep-card .product-main strong,
.box-prep-card .product-main span {
  grid-column: auto;
}

.box-prep-grid {
  align-items: stretch;
}

.box-prep-card .unit {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.inline-submit {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  width: 100%;
  margin-top: 14px;
  border-radius: 8px;
}

.inline-submit > div:first-child {
  min-width: 0;
}

.inline-submit > div:first-child span {
  white-space: normal;
}

.pos-done {
  min-height: 38px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 900;
}

.inventory-mini-panel {
  padding-bottom: 10px;
}

.inventory-scroll {
  max-height: 438px;
  overflow: auto;
}

.inventory-scroll table {
  margin-bottom: 0;
}

.inventory-scroll tbody tr {
  height: 38px;
}

.inventory-alert-scroll {
  max-height: 172px;
  overflow: auto;
}

.report-query-bar {
  display: grid;
  grid-template-columns: minmax(160px, 0.65fr) minmax(260px, 1.4fr) auto auto;
  gap: 10px;
  align-items: end;
}

.report-query-bar label {
  margin: 0;
}

.pos-sale-detail-row td {
  background: #f8fafc;
  padding: 0;
}

.pos-sale-drop {
  display: grid;
  grid-template-columns: minmax(320px, 760px) minmax(190px, 240px);
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(226, 232, 240, 0.55);
}

.pos-sale-drop .toolbar {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.pos-sale-drop .receipt-lines {
  display: grid;
  gap: 4px;
  align-self: start;
  width: min(760px, 100%);
}

.pos-sale-drop .receipt-line {
  grid-template-columns: minmax(180px, 1fr) 34px 64px;
  gap: 8px;
}

.pos-sale-drop .receipt-totals {
  justify-self: stretch;
  align-self: start;
  min-width: 0;
  padding-top: 0;
}

.hr-master-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
}

.hr-master-tabs button {
  min-height: 36px;
}

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

.recipe-components {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.recipe-component-row {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(90px, 0.6fr) minmax(120px, 0.7fr);
  gap: 8px;
  align-items: end;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.box-admin-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.box-admin-row img,
.box-admin-row .image-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
}

.box-admin-row > div:nth-child(2) {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pos-hardware-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

@media (max-width: 900px) {
  .pos-register {
    grid-template-columns: minmax(250px, 0.85fr) minmax(330px, 1.15fr);
    min-height: auto;
  }

  .pos-pay {
    grid-column: 1 / -1;
    min-height: auto;
    grid-template-rows: none;
  }

  .pos-item-grid {
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    max-height: 360px;
  }
}

@media (max-width: 760px) {
  .pos-register {
    grid-template-columns: 1fr;
  }

  .pos-ticket,
  .pos-products,
  .pos-pay {
    min-height: auto;
    height: auto;
  }

  .pos-lines {
    min-height: 100px;
    max-height: 220px;
  }

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

  .pos-line-controls {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .box-admin-row {
    grid-template-columns: 60px minmax(0, 1fr);
  }

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

  .box-admin-row .row-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .box-admin-row img,
  .box-admin-row .image-placeholder {
    width: 60px;
    height: 60px;
  }

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

  .catalog-toolbar-actions {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .catalog-toolbar-actions .compact-search,
  .catalog-toolbar-actions .sort-controls,
  .sort-controls label {
    width: 100%;
    max-width: none;
    flex: 1 1 100%;
  }

  .sort-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .pos-image-upload {
    position: static;
    grid-column: 1 / -1;
    justify-self: end;
    top: auto;
    right: auto;
    width: 60px;
    height: 60px;
    min-height: 60px;
  }

  .pos-item-grid {
    max-height: 360px;
  }

  .pos-search-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pos-barcode-input {
    max-width: none;
  }

  .pos-search-row select {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .box-prep-grid {
    grid-template-columns: 1fr;
  }

  .box-prep-card {
    min-height: 104px;
    padding: 8px;
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: auto auto 34px;
    gap: 8px;
  }

  .box-prep-card .product-main {
    gap: 3px;
  }

  .box-prep-card .product-main strong {
    font-size: 13px;
    line-height: 1.18;
  }

  .box-prep-card .product-main span {
    font-size: 11px;
    line-height: 1.25;
  }

  .box-prep-card .qty-stepper {
    grid-column: 1 / -1;
    grid-template-columns: 28px minmax(44px, 1fr) 28px;
  }

  .box-prep-card .qty-stepper button {
    min-height: 28px;
    width: 28px;
  }

  .box-prep-card .qty-stepper input {
    min-height: 28px;
    height: 28px;
    font-size: 12px;
  }

  .inline-submit {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    overflow: hidden;
  }

  .inline-submit > div:first-child strong,
  .inline-submit > div:first-child span {
    white-space: normal;
  }

  .inline-submit .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .inline-submit button {
    min-width: 0;
    width: 100%;
  }
}

.order-card {
  margin: 16px 4px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.order-items {
  display: grid;
  gap: 12px;
}

.order-item-line {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.order-item-line:last-child {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 8px;
  padding: 3px 10px;
  background: #eef2f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-transform: lowercase;
}

.status.Submitted,
.status.Pending {
  background: #eef2f7;
  color: var(--ink);
}

.status.Received {
  background: var(--navy);
  color: #fff;
}

.status.Partially {
  background: #fef3c7;
  color: #92400e;
}

.status.Critical {
  background: #fef3c7;
  color: #92400e;
}

.status.Very {
  background: #ffedd5;
  color: #c2410c;
}

.status.Approved,
.status.Generated,
.status.Fully,
.status.Fulfilled,
.status.Delivered,
.status.Safe {
  background: #dcfce7;
  color: var(--green);
}

.status.Cancelled,
.status.Rejected,
.status.Deactivated,
.status.Not,
.status.Expired {
  background: #fee2e2;
  color: var(--red);
}

.forced-match {
  align-self: end;
  min-height: 20px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}

.backoffice {
  min-height: 100vh;
}

.office-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 1px 0 rgba(8, 15, 30, 0.03);
}

.office-top h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
}

.office-top p {
  margin: 2px 0 0;
  color: var(--muted);
}

.office-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.office-logo-menu {
  width: 54px;
  min-width: 54px;
  min-height: 54px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.office-logo-menu:hover,
.office-logo-menu:focus-visible {
  background: #f3f6fa;
}

.office-logo-menu img,
.office-brand > img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.office-brand > div > strong {
  display: block;
  color: #6f432f;
  font-size: 14px;
}

.office-close-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
}

.office-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: none;
  background: rgba(7, 17, 36, 0.34);
}

.office-side-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 29;
  width: min(238px, 78vw);
  height: 100vh;
  padding: 14px 12px;
  border-right: 1px solid #000;
  background: #050505;
  color: #fff;
  box-shadow: 8px 0 30px rgba(8, 15, 30, 0.22);
  transform: translateX(-105%);
  transition: transform 180ms ease;
  overflow-y: auto;
}

.office-menu-logo {
  display: grid;
  justify-items: end;
  margin-bottom: 10px;
}

.office-menu-logo img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.96;
}

.backoffice.menu-open .office-side-menu {
  transform: translateX(0);
}

.backoffice.menu-open .office-menu-backdrop {
  display: block;
}

.office-side-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  color: #fff;
}

.office-side-head .office-close-button {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.office-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 22px 0;
}

.office-side-menu .office-tabs {
  display: grid;
  padding: 0;
  gap: 6px;
  justify-items: start;
}

.office-tabs button {
  background: #eef2f7;
  color: var(--ink);
}

.office-side-menu .office-tabs button {
  display: flex;
  width: min(190px, 100%);
  justify-content: flex-start;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: #fff;
  text-align: left;
  line-height: 1;
  box-shadow: none;
}

.office-side-menu .office-tabs .menu-logout {
  color: #ff4d4d;
  margin-top: 8px;
}

.office-side-menu .office-tabs .menu-logout:hover,
.office-side-menu .office-tabs .menu-logout:focus-visible {
  border-color: rgba(255, 77, 77, 0.62);
  background: rgba(255, 77, 77, 0.14);
  color: #ff6b6b;
}

.office-side-menu .office-tabs button:hover,
.office-side-menu .office-tabs button:focus-visible {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.78);
  color: #050816;
}

.office-tabs button.active {
  background: var(--navy);
  color: #fff;
}

.office-side-menu .office-tabs button.active {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.office-side-menu .office-tabs button.active:hover,
.office-side-menu .office-tabs button.active:focus-visible {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.78);
  color: #050816;
}

.settings-tabs {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 10px;
}

.settings-tabs button {
  min-height: 32px;
  padding: 0 12px;
  background: #eef2f7;
  color: var(--ink);
}

.settings-tabs button.active {
  background: var(--navy);
  color: #fff;
}

.office-content {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 16px clamp(12px, 1.5vw, 24px) 42px;
}

.backoffice.pos-shell .office-content {
  width: 100%;
  max-width: none;
  padding-inline: clamp(8px, 1.2vw, 18px);
}

.panel,
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

.card {
  padding: 14px;
}

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

.hr-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.hr-critical-panel {
  margin-top: 18px;
}

.dashboard-grid {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
}

.storage-grid {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.metric {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 4px;
}

.metric span {
  color: var(--muted);
  font-weight: 750;
}

.metric strong {
  font-size: 27px;
}

.finance-branch-card {
  align-content: stretch;
}

.finance-branch-card select {
  min-height: 38px;
  height: 38px;
  width: 100%;
  padding-left: 12px;
  padding-right: 34px;
  font-size: 15px;
  font-weight: 800;
}

.check-field {
  grid-template-columns: 20px 1fr;
  align-items: center;
  align-self: center;
}

.check-field input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.pie-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.65fr) minmax(300px, 1.35fr);
  align-items: center;
  gap: 28px;
}

.pie-chart {
  width: min(260px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.pie-chart > div {
  width: 52%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.pie-chart strong {
  font-size: 25px;
}

.pie-chart span,
.pie-legend small {
  color: var(--muted);
}

.pie-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
}

.pie-legend > div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

.pie-legend i {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 3px;
}

.pie-legend strong,
.pie-legend small {
  display: block;
}

.editing-panel {
  border-color: #7b8da8;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12), var(--shadow);
}

.mini-chart {
  height: 190px;
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  align-items: end;
  gap: 10px;
}

.mini-bar {
  height: 100%;
  display: grid;
  grid-template-rows: 22px 1fr 20px;
  gap: 5px;
  text-align: center;
  color: var(--muted);
}

.mini-bar strong {
  color: var(--ink);
  font-size: 13px;
}

.mini-bar-track {
  min-height: 90px;
  display: flex;
  align-items: end;
  justify-content: center;
  background: #f1f4f8;
  border-radius: 5px;
  overflow: hidden;
}

.mini-bar-track span {
  width: 100%;
  min-height: 2px;
  background: var(--blue);
}

.full-chart {
  margin-top: 16px;
}

.vertical-chart {
  min-height: 240px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  align-items: end;
  gap: 10px;
}

.vertical-bar {
  min-width: 0;
  display: grid;
  grid-template-rows: 22px 1fr 34px;
  align-items: end;
  gap: 6px;
  text-align: center;
}

.vertical-bar strong {
  font-size: 12px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.vertical-bar-track {
  min-height: 160px;
  display: flex;
  align-items: end;
  border-radius: 7px;
  background: #eef2f7;
  overflow: hidden;
}

.vertical-bar-track span {
  display: block;
  width: 100%;
  min-height: 4px;
  background: var(--navy);
}

.vertical-bar small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: normal;
  word-break: normal;
}

.weekly-chart {
  min-height: 210px;
  display: grid;
  grid-template-columns: repeat(7, minmax(54px, 1fr));
  align-items: end;
  gap: 10px;
}

.weekly-bar {
  min-width: 0;
  display: grid;
  grid-template-rows: 22px 1fr 22px;
  align-items: end;
  gap: 6px;
  text-align: center;
}

.weekly-bar strong {
  font-size: 12px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.weekly-bar-track {
  min-height: 138px;
  display: flex;
  align-items: end;
  border-radius: 5px;
  background: #eef2f7;
  overflow: hidden;
}

.weekly-bar-track span {
  display: block;
  width: 100%;
  min-height: 2px;
  background: #2563eb;
}

.weekly-bar small {
  color: var(--muted);
  font-size: 12px;
}

.status-mix-bar {
  height: 18px;
  overflow: hidden;
  border-radius: 6px;
  background: #edf1f6;
}

.status-mix .ready { background: #15803d; }
.status-mix .partial { background: #eab308; }
.status-mix .waiting { background: #dc2626; }

.status-mix-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.status-mix-legend > div {
  display: grid;
  grid-template-columns: 11px 1fr auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.status-mix-legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

.status-mix-legend span {
  color: var(--muted);
  font-size: 13px;
}

.status-mix-legend strong {
  white-space: nowrap;
}

.status-mix-legend small {
  margin-left: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.pending-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.item-image-edit {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-image-edit img {
  width: 72px;
  height: 58px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.item-thumb {
  width: 48px;
  height: 40px;
  display: block;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid var(--line);
}

.no-thumb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 40px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--muted);
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.sort-controls label {
  min-width: 126px;
  gap: 0;
}

.sort-controls select {
  min-height: 40px;
  height: 40px;
  width: 100%;
}

.sort-controls button.icon {
  width: 42px;
  font-size: 14px;
}

.sort-controls button.selected {
  background: var(--navy);
  color: #fff;
}

.pos-item-panel {
  position: relative;
}

.pos-image-upload {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 66px;
  height: 66px;
  min-height: 66px;
  display: grid;
  place-items: center;
  border: 2px dashed #cfd8e3;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.pos-image-upload input {
  display: none;
}

.pos-image-upload img {
  display: none;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.pos-image-upload span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0 0 3px;
  font-size: 36px;
  font-weight: 900;
  line-height: 0.8;
}

.pos-image-upload.has-image {
  border-style: solid;
  padding: 2px;
}

.pos-image-upload.has-image img {
  display: block;
}

.pos-image-upload.has-image span {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 24px;
  height: 24px;
  padding: 0 0 2px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.22);
}

.pos-image-upload:hover,
.pos-image-upload:focus-within {
  border-color: #050505;
  background: #f4f7fb;
  color: #050505;
}

.table-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.table-pager button:disabled {
  opacity: 0.4;
  cursor: default;
}

.scroll-box {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.scroll-box table {
  margin: 0;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar h2,
.panel h2,
.panel h3 {
  margin: 0;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

.action-controls {
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: var(--panel);
}

.hr-search-panel {
  margin-bottom: 10px;
  padding: 14px 18px;
}

.hr-search-row {
  display: grid;
  grid-template-columns: auto minmax(300px, 430px) auto minmax(260px, 1fr);
  align-items: center;
  gap: 8px 10px;
}

.hr-search-row h2 {
  margin: 0;
  white-space: nowrap;
}

.hr-search-form {
  display: contents;
}

.hr-search-form .search {
  min-width: 0;
}

.hr-search-form button {
  min-height: 36px;
  width: 76px;
  padding: 0 12px;
}

.hr-search-help {
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.hr-user-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-self: end;
}

.salary-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(260px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.salary-summary,
.salary-payment-form {
  display: grid;
  gap: 10px;
}

.salary-metrics {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.salary-net {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}

.salary-net strong {
  font-size: 24px;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.search-result-row {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.search-result-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.list-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.list-controls select {
  width: auto;
  min-height: 34px;
  padding: 6px 30px 6px 10px;
}

.list-controls button {
  min-height: 34px;
  padding: 0 12px;
}

.list-count {
  margin-left: auto;
  color: var(--ink);
}

.negative-stock td {
  background: #fff1f2;
}

.stock-in {
  color: var(--green);
  font-weight: 800;
}

.stock-out {
  color: var(--red);
  font-weight: 800;
}

.staff-photo-thumb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--soft);
}

.staff-photo-empty {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.staff-photo-picker {
  justify-items: center;
  align-content: center;
  min-width: 92px;
  min-height: 96px;
}

.staff-photo-picker input {
  display: none;
}

.staff-photo-picker small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.staff-photo-avatar {
  position: relative;
  width: 84px;
  height: 84px;
  display: block;
  border: 2px dashed #b7c4b9;
  border-radius: 50%;
  background: #fbfdfb;
  background-position: center;
  background-size: cover;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.staff-photo-avatar::before {
  content: "+";
  position: absolute;
  left: 50%;
  top: 50%;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: #536f5a;
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  transform: translate(-50%, -54%);
}

.staff-photo-avatar::after {
  content: none;
}

.staff-photo-avatar:hover {
  border-color: var(--ink);
  background: #f3f8f4;
}

.staff-photo-avatar.has-photo::before,
.staff-photo-avatar.has-photo::after {
  display: none;
}

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

.staff-form {
  display: grid;
  grid-template-columns: 94px repeat(4, minmax(150px, 1fr));
  gap: 10px 12px;
  align-items: start;
}

.staff-form .staff-photo-picker {
  grid-row: span 2;
}

.staff-form textarea {
  min-height: 80px;
}

.staff-pay-grid {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.staff-pay-grid label {
  min-width: 0;
}

.total-input {
  background: #f4f7fb;
  color: var(--ink);
  font-weight: 800;
}

.staff-form-actions {
  grid-column: 2 / -1;
  display: flex;
  align-items: end;
  justify-content: flex-start;
  gap: 10px;
}

.staff-form-actions label {
  width: 96px;
  flex: 0 0 96px;
}

.staff-form-actions button {
  width: 118px;
  flex: 0 0 118px;
}

.nationality-field,
.company-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.nationality-field select,
.company-field select,
.nationality-tools input,
.nationality-tools select,
.company-tools input,
.company-tools select {
  width: 100%;
  min-width: 0;
}

.nationality-tools,
.company-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.company-tools {
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) 42px;
}

.company-tools select {
  grid-column: 1 / 3;
}

.nationality-tools[hidden],
.company-tools[hidden] {
  display: none;
}

.nationality-tools button.icon,
.company-tools button.icon {
  width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.nationality-tools button.danger,
.company-tools button.danger {
  background: var(--red);
  color: #fff;
}

.hr-doc-list {
  margin-top: 16px;
  overflow-x: auto;
}

.hr-doc-list table {
  min-width: 820px;
}

.hr-doc-list td {
  vertical-align: middle;
}

.hr-doc-list input,
.hr-doc-list select {
  min-width: 150px;
}

.field-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px 40px;
  gap: 6px;
  align-items: center;
}

.field-actions button.icon {
  width: 40px;
  min-height: 40px;
}

.field-actions button.danger {
  background: var(--red);
  color: #fff;
}

.unit-manager {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(190px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.unit-manager > strong,
.unit-manager > .muted {
  grid-column: 1 / -1;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(380px, 1.15fr);
  gap: 14px;
  margin-top: 14px;
}

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

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

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

.compact-data-table {
  table-layout: fixed;
}

.compact-data-table th,
.compact-data-table td {
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.25;
  vertical-align: middle;
}

.compact-data-table th {
  font-size: 11px;
}

.compact-data-table td:last-child,
.compact-data-table th:last-child {
  text-align: right;
}

.branch-snapshot-table th:nth-child(n+2),
.branch-snapshot-table td:nth-child(n+2) {
  width: 74px;
  text-align: center;
}

.branch-report-table th:nth-child(n+3),
.branch-report-table td:nth-child(n+3) {
  width: 86px;
  text-align: center;
}

.analytics-table-panel,
.finance-table-panel {
  overflow-x: auto;
}

.analytics-table-panel .toolbar,
.finance-table-panel .toolbar {
  margin-bottom: 6px;
}

.analytics-data-table td:last-child,
.analytics-data-table th:last-child {
  width: 112px;
  white-space: nowrap;
}

.error,
.success {
  margin: 10px 0;
  padding: 10px;
  border-radius: 9px;
  font-weight: 750;
}

.error {
  background: #fee2e2;
  color: var(--red);
}

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

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
}

.compact-list {
  display: grid;
  gap: 0;
  margin-top: 10px;
}

.manage-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.manage-row > div {
  display: grid;
  gap: 2px;
}

.manage-row button {
  min-height: 32px;
  padding: 4px 8px;
}

.manage-row .action-icon,
.action-controls .action-icon,
.row-actions .action-icon {
  width: 32px;
  min-height: 32px;
}

.manage-row .status-toggle,
.action-controls .status-toggle,
.row-actions .status-toggle {
  flex: 0 0 auto;
}

.row-actions,
.action-controls {
  align-items: center;
}

.row-actions .status-toggle,
.action-controls .status-toggle {
  width: 40px;
  min-width: 40px;
  min-height: 22px;
  height: 22px;
  padding: 0;
  border-radius: 999px;
  overflow: visible;
}

.row-actions .status-toggle span,
.action-controls .status-toggle span {
  width: 18px;
  height: 18px;
}

.order-line {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) 90px 90px minmax(170px, 1fr) auto;
  gap: 8px;
  align-items: end;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.order-line-item {
  align-self: center;
  display: grid;
  gap: 2px;
}

.order-line label {
  gap: 3px;
  font-size: 12px;
}

.order-line-notes {
  display: grid;
  gap: 5px;
}

.branch-line-note {
  display: grid;
  gap: 3px;
  align-self: stretch;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
}

.branch-line-note strong {
  color: var(--muted);
  font-size: 11px;
}

.branch-line-note span {
  color: var(--ink);
}

.order-line input {
  min-height: 34px;
  height: 34px;
  padding: 6px 9px;
}

.order-line button {
  min-height: 34px;
  padding: 6px 11px;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .order-line {
    grid-template-columns: minmax(180px, 1fr) 82px 82px auto;
  }

  .order-line-note {
    grid-column: 1 / 4;
  }

  .report-filters {
    grid-template-columns: 1fr 1fr;
  }

  .pie-layout {
    grid-template-columns: 1fr;
  }

  .status-mix-legend {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .report-summary-grid {
    grid-template-columns: 1fr;
  }

  .staff-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .staff-form-actions {
    grid-column: 1 / -1;
  }

  .staff-pay-grid {
    grid-column: 1 / -1;
  }

  .staff-pay-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .staff-form-actions {
    justify-content: flex-start;
  }

  .nationality-field,
  .company-field {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .list-count {
    margin-left: 0;
    width: 100%;
  }

  .office-content,
  .office-top {
    padding-left: 12px;
    padding-right: 12px;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  td {
    border: 0;
    padding: 6px 0;
  }

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

  .order-line-item,
  .order-line-notes,
  .order-line-note,
  .order-line button {
    grid-column: 1 / -1;
  }

  .report-filters {
    grid-template-columns: 1fr;
  }

  .staff-form,
  .staff-form-actions,
  .nationality-field,
  .nationality-tools {
    grid-template-columns: 1fr;
  }

  .pie-legend {
    grid-template-columns: 1fr;
  }

  .product-grid {
    gap: 10px;
  }

  .product-card {
    min-height: 128px;
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: auto auto 38px;
    align-items: center;
    row-gap: 8px;
  }

  .product-card .image-placeholder,
  .product-card .product-image {
    grid-row: 1 / 3;
    grid-column: 1;
    width: 72px;
    height: 72px;
  }

  .product-card strong,
  .product-card .unit {
    grid-column: 2;
    min-width: 0;
  }

  .product-card .qty-stepper {
    grid-column: 1 / -1;
  }
}

@media (min-width: 560px) and (max-width: 1024px) {
  .branch-shell,
  .submit-bar {
    width: 100%;
  }

  .branch-content {
    padding: 18px 18px 150px;
  }

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

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

  .office-content {
    padding: 16px 16px 38px;
  }

  .panel {
    padding: 16px;
  }

  .form-grid,
  .report-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-action {
    width: 100%;
  }
}

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

  button,
  .button-link,
  .file-button {
    min-height: 42px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .office-top {
    position: sticky;
    top: 0;
    z-index: 8;
    gap: 10px;
    padding: 10px 12px;
  }

  .office-brand {
    min-width: 0;
  }

  .office-logo-menu {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .office-logo-menu img,
  .office-brand > img {
    width: 42px;
    height: 42px;
  }

  .office-brand h1 {
    font-size: 18px;
    line-height: 1.15;
  }

  .office-brand p {
    font-size: 12px;
  }

  .sub-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
    overflow-x: visible;
    padding-left: 0;
    padding-right: 0;
    gap: 6px;
  }

  .sub-tabs button {
    display: grid;
    place-items: center;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 0;
    white-space: nowrap;
    line-height: 1.15;
  }

  .sub-tabs .hr-tab-icon {
    display: grid;
    place-items: center;
  }

  .sub-tabs .nav-icon {
    width: 26px;
    height: 26px;
    stroke-width: 2;
  }

  .sub-tabs .hr-tab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .office-content {
    padding: 12px 12px 34px;
  }

  .panel,
  .card {
    border-radius: 8px;
  }

  .panel {
    padding: 12px;
    overflow-x: auto;
  }

  .report-query-bar {
    grid-template-columns: 1fr;
  }

  .hr-search-panel {
    padding: 12px;
  }

  .hr-search-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .hr-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .hr-search-form .search {
    width: 100%;
  }

  .hr-search-form button {
    width: auto;
    padding: 0 14px;
  }

  .hr-search-form #clearHrSearch {
    grid-column: 1 / -1;
    width: 100%;
  }

  .hr-search-help {
    display: none;
  }

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

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

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

  .metric {
    min-height: 70px;
  }

  .metric strong {
    font-size: 23px;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar h2 {
    font-size: 18px;
  }

  .toolbar > .muted {
    width: 100%;
  }

  .toolbar button,
  .toolbar .button-link,
  .toolbar .file-button {
    width: 100%;
  }

  .form-grid,
  .staff-form,
  .staff-pay-grid,
  .staff-form-actions,
  .salary-layout,
  .hr-user-actions,
  .report-filters,
  .unit-manager {
    grid-template-columns: 1fr;
  }

  .staff-form-actions,
  .hr-user-actions {
    grid-column: 1 / -1;
  }

  .staff-form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .staff-form-actions label,
  .staff-form-actions button {
    width: 100%;
    flex-basis: auto;
  }

  .nationality-tools,
  .company-tools {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .nationality-tools select,
  .company-tools select,
  .company-tools input {
    grid-column: 1 / 2;
  }

  .nationality-tools button.danger,
  .company-tools button.danger {
    grid-column: 2 / 3;
  }

  .hr-doc-list table,
  .panel > table,
  .report-orders-table {
    min-width: 560px;
  }

  table {
    display: table;
    width: max-content;
    min-width: 560px;
    table-layout: auto;
  }

  .compact-data-table {
    width: 100%;
    min-width: 420px;
    table-layout: fixed;
  }

  .analytics-data-table {
    min-width: 360px;
  }

  .branch-snapshot-table {
    min-width: 390px;
  }

  .pos-sale-drop {
    grid-template-columns: 1fr;
  }

  .vertical-chart {
    min-height: 170px;
    grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
    gap: 6px;
  }

  thead {
    display: table-header-group;
  }

  tbody {
    display: table-row-group;
  }

  tr {
    display: table-row;
    padding: 0;
    border-bottom: 0;
  }

  th,
  td {
    display: table-cell;
    padding: 8px 7px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    vertical-align: top;
  }

  td .row-actions,
  td .action-controls {
    white-space: nowrap;
  }

  .branch-shell {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    border-left: 0;
    border-right: 0;
  }

  .branch-top {
    gap: 8px;
    padding: 7px 10px;
    align-items: stretch;
    flex-wrap: wrap;
  }

  .branch-title {
    min-width: 0;
    flex: 1 1 auto;
  }

  .branch-title strong {
    font-size: 15px;
  }

  .branch-title span {
    font-size: 12px;
  }

  .branch-top .branch-action {
    width: 38px;
    min-height: 38px;
  }

  .branch-header-nav {
    order: 2;
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }

  .branch-header-nav button {
    grid-template-columns: 18px auto;
    justify-items: center;
    gap: 5px;
    min-height: 36px;
    padding: 0 9px;
    font-size: 12px;
    text-align: center;
  }

  .branch-header-nav button span {
    display: none;
  }

  .branch-header-nav button {
    grid-template-columns: 1fr;
    width: 40px;
    padding: 0;
  }

  .branch-content {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 12px 10px 170px;
  }

  .chips {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .chip {
    flex: 0 0 auto;
  }

  .submit-bar {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    grid-template-columns: minmax(76px, 0.55fr) minmax(0, 1.45fr);
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }

  .submit-bar > div:first-child {
    min-width: 0;
  }

  .submit-bar > div:first-child strong,
  .submit-bar > div:first-child span {
    white-space: nowrap;
  }

  .submit-bar .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .submit-bar button {
    width: 100%;
  }

  .branch-content .submit-bar.inline-submit {
    position: static;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
    overflow: hidden;
  }

  .branch-content .submit-bar.inline-submit > div:first-child {
    min-width: 0;
  }

  .branch-content .submit-bar.inline-submit > div:first-child strong,
  .branch-content .submit-bar.inline-submit > div:first-child span {
    white-space: normal;
  }

  .branch-content .submit-bar.inline-submit .row-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    width: 100%;
  }

  .branch-content .submit-bar.inline-submit button {
    width: 100%;
    min-width: 0;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .review-modal {
    max-height: calc(100vh - 20px);
    padding: 14px;
    border-radius: 10px 10px 0 0;
  }

  .review-line {
    grid-template-columns: minmax(0, 1fr) 118px 32px 32px;
    gap: 6px;
    padding: 9px;
  }

  .review-line .action-icon {
    width: 32px;
    min-height: 32px;
  }

  .review-stepper {
    grid-template-columns: 28px minmax(44px, 1fr) 28px;
  }

  .review-modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .backup-form {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .backup-actions {
    gap: 8px;
  }

  .compact-backup-panel {
    padding: 12px;
  }

  .backup-buttons {
    gap: 6px;
  }

  .backup-buttons .button-link,
  .backup-form button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .auth-brand {
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 14px;
  }

  .auth-brand img {
    width: 82px;
    height: 82px;
  }

  .auth-brand-ar {
    font-size: 48px;
  }

  .auth-brand-en {
    font-size: 18px;
  }

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

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

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

  .dashboard-grid .metric {
    min-height: 70px;
    padding: 11px;
  }

  .dashboard-grid .metric span {
    font-size: 11px;
  }

  .dashboard-grid .metric strong {
    font-size: 22px;
  }

  .hr-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .hr-summary-grid .metric {
    min-height: 70px;
    padding: 11px;
  }

  .hr-summary-grid .metric span {
    font-size: 11px;
  }

  .hr-summary-grid .metric strong {
    font-size: 22px;
  }

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

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

  .product-card {
    min-height: 120px;
    padding: 8px;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto auto 36px;
    align-items: center;
    gap: 6px 8px;
  }

  .product-card .image-placeholder,
  .product-card .product-image {
    grid-row: 1 / 3;
    grid-column: 1;
    width: 64px;
    height: 64px;
  }

  .product-card strong,
  .product-card .unit {
    grid-column: 2;
    min-width: 0;
  }

  .product-card .qty-stepper {
    grid-column: 1 / -1;
  }

  .product-card strong {
    font-size: 13px;
    line-height: 1.2;
    overflow-wrap: normal;
    word-break: normal;
  }

  .product-card .unit {
    font-size: 12px;
  }

  .qty-stepper {
    grid-template-columns: 28px minmax(0, 1fr) 28px;
    gap: 3px;
  }

  .qty-stepper button {
    width: 28px;
    min-height: 32px;
  }

  .qty-stepper input {
    height: 32px;
    min-height: 32px;
  }

  .box-prep-card {
    min-height: 102px;
    grid-template-columns: 64px minmax(0, 1fr);
    grid-template-rows: auto auto 32px;
  }

  .box-prep-card .product-main {
    grid-column: 2;
  }

  .box-prep-card .qty-stepper {
    grid-column: 1 / -1;
  }

  .box-prep-card .product-main strong {
    font-size: 12px;
  }

  .box-prep-card .product-main span {
    font-size: 11px;
  }

  .branch-top .inline {
    gap: 5px;
  }

  .office-brand {
    grid-template-columns: 40px minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .product-grid.box-prep-grid {
    grid-template-columns: 1fr;
  }
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.settings-role-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.settings-role-card h3 {
  margin: 0;
  font-size: 15px;
}

.settings-package-area {
  border-top: 1px solid var(--line);
  padding-top: 5px;
  margin-top: 5px;
}

.settings-package-area > strong {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.settings-checks {
  display: grid;
  gap: 2px;
}

.check-row {
  display: grid;
  grid-template-columns: 15px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-height: 21px;
  font-size: 11px;
}

.check-row input {
  width: 14px;
  height: 14px;
}

.bar-chart {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 150px) minmax(0, 1fr) 72px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.bar-row > span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef5;
}

.bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--navy);
}

.bar-row strong {
  text-align: right;
  font-size: 12px;
}

.yamalgpt-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
  min-height: calc(100vh - 130px);
  max-width: none;
}

.yamalgpt-chat {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: visible;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.yamalgpt-message {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  max-width: min(760px, 78%);
}

.yamalgpt-message.user {
  justify-self: end;
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.yamalgpt-message.assistant {
  justify-self: start;
  background: #f8fafc;
}

.yamalgpt-message strong {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.yamalgpt-message p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.yamalgpt-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 8px;
  align-items: end;
}

.yamalgpt-form textarea {
  min-height: 52px;
  height: 52px;
  resize: none;
}

.yamalgpt-form button {
  min-height: 52px;
  align-self: end;
}

@media (max-width: 640px) {
  .bar-row {
    grid-template-columns: minmax(70px, 105px) minmax(0, 1fr) 58px;
    gap: 6px;
  }

  .yamalgpt-message {
    max-width: 100%;
  }

  .yamalgpt-form {
    grid-template-columns: 1fr;
  }

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

  .reset-options {
    grid-template-columns: 1fr;
  }
}
