/* Shared dashboard components. S2 owns routing, drawer breakpoints and table semantics. */
body {
  line-height: var(--line-body);
  font-variant-numeric: tabular-nums;
}
.main {
  max-width: var(--content-width);
}
.s2-sidebar-brand {
  border-bottom: 1px solid var(--border);
  padding-block: var(--space-4);
}
.sidebar-group h2,
.s2-brand small,
.s2-user-card small {
  color: var(--text-secondary);
}
.sidebar-group + .sidebar-group {
  border-block-start: 1px solid var(--divider);
  padding-block-start: var(--space-2);
}
.sidebar-nav a:hover {
  background: var(--panel-tint);
}
.s2-logo {
  border-end-start-radius: var(--space-1);
}
.s2-user-card {
  background: var(--panel-tint);
  border: 1px solid var(--border);
}
.page-head,
.counter-heading {
  border-block-end: 1px solid var(--border);
  padding-block-end: var(--space-4);
  margin-block-end: var(--space-5);
  gap: var(--space-4);
  flex-wrap: wrap;
}
.page-head h1,
.counter-heading h1 {
  font-size: clamp(var(--text-xl), 2vw, var(--text-title));
  line-height: var(--line-title);
  color: var(--brand-deep);
}
.card,
.counter-orders,
.s2-filters,
.s2-kpis .counter-cell {
  box-shadow: var(--shadow) !important;
}
.s2-panel-head,
.card > .card__head.s2-panel-head {
  background: var(--surface);
  border-start-start-radius: var(--radius);
  border-start-end-radius: var(--radius);
}
.s2-panel-head h2 {
  font-size: var(--text-base);
  line-height: var(--line-title);
  color: var(--brand-deep);
}
.table-wrap {
  max-width: 100%;
  min-width: 0;
}
table {
  font-variant-numeric: tabular-nums;
}
thead th {
  background: var(--panel-tint);
  color: var(--text-secondary);
  font-weight: 700;
}
@media (min-width: 861px) {
  .table-wrap:not(:has(#ordersTable)):has(> table tbody tr:nth-child(9)) {
    max-height: 70vh;
    overflow: auto;
    isolation: isolate;
  }
  thead th {
    position: sticky;
    inset-block-start: 0;
    z-index: 1;
  }
}
@media (hover: hover) {
  tbody tr:hover > td {
    background-color: var(--row-hover);
  }
}
.num,
bdi {
  font-variant-numeric: tabular-nums;
}
.counter-pill,
.tag {
  max-width: none;
  text-overflow: clip;
  line-height: var(--line-title);
}
.btn:not(:disabled):hover {
  filter: brightness(0.96);
}
.btn:disabled,
button[aria-busy='true'] {
  cursor: wait;
}
button:disabled:not([aria-busy='true']) {
  cursor: not-allowed;
}
input:not([type='checkbox'], [type='radio'], [type='file'], [type='hidden']),
select,
textarea {
  border-color: var(--control-edge);
  background-color: var(--surface);
}
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
dialog,
.modal__card {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-raised) !important;
  overscroll-behavior: contain;
}
.modal__head {
  background: var(--panel-tint);
}
.empty,
.counter-empty {
  color: var(--text-secondary);
  padding-block: var(--space-6);
}
.toast {
  box-shadow: var(--shadow-raised) !important;
  max-inline-size: calc(100vw - var(--space-8));
}
.dashboard-loading {
  border-inline-start: 4px solid var(--brand);
}
.s2-image {
  background: var(--neutral-surface);
  outline: 1px solid var(--border);
  outline-offset: -1px;
}
@media (max-width: 600px) {
  .main {
    padding-inline: var(--space-3);
  }
  .page-head {
    gap: var(--space-2);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Daily overview */
.counter-overview .counter-heading {
  background: var(--brand-deep);
  color: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-6);
  border-inline-start: var(--space-1) solid var(--action);
}
.counter-overview .counter-heading h1,
.counter-overview .counter-heading p {
  color: var(--surface);
}
.counter-overview .counter-heading button {
  background: var(--surface);
  color: var(--brand-deep);
}
.backup-reminder {
  border-inline-start-width: var(--space-1);
  gap: var(--space-4);
}
.s2-kpis .counter-cell-value {
  font-size: clamp(var(--text-xl), 2.1vw, 32px);
  line-height: var(--line-title);
}
.s2-health-row {
  margin-block: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
}
.s2-bars {
  border-block-end: 1px solid var(--border);
}
@media (max-width: 600px) {
  .counter-overview .counter-heading {
    padding: var(--space-4);
  }
  .s2-kpis .counter-cell-value {
    font-size: var(--text-xl);
  }
}

/* Order search and transaction detail */
.s2-filter-row {
  gap: var(--space-3);
}
.s2-filters .status-chips {
  padding-block-end: var(--space-3);
  border-block-end: 1px solid var(--divider);
  margin-block-end: var(--space-3);
}
#ordersTable .order-status-cell {
  line-height: var(--line-body);
}
.order-detail-grid {
  gap: var(--space-5);
  align-items: start;
}
.order-payment dl {
  padding: var(--space-4);
  background: var(--panel-tint);
  border-radius: var(--radius-sm);
  row-gap: var(--space-2);
}
.order-payment dd {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}
.order-detail-grid tfoot {
  border-block-start: 2px solid var(--brand);
}
@media (min-width: 861px) and (max-width: 1250px) {
  #ordersTable {
    min-inline-size: 900px;
  }
  .table-wrap:has(#ordersTable) {
    overflow: auto;
  }
}

/* Menu catalogue */
.chips {
  gap: var(--space-2);
}
.chip.is-on {
  background: var(--brand);
  color: var(--surface);
}
.prod-row .name {
  font-weight: 700;
}
.prod-row .name small {
  color: var(--text-secondary);
  font-weight: 400;
}
.prod-row.is-off td {
  opacity: 1;
}
.prod-row.is-off {
  opacity: 1;
  background: var(--surface-muted);
}
.thumb--lg {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.actions {
  gap: var(--space-2);
}
.banner__preview {
  border-radius: var(--radius) var(--radius) 0 0;
}
.banner__body {
  border-block-start: 1px solid var(--border);
}
.form-grid label {
  color: var(--heading);
}
@media (max-width: 600px) {
  .card__head:has(.search) {
    align-items: stretch;
  }
  .chips {
    row-gap: var(--space-2);
  }
}

/* Reports: a single ledger with a highlighted net figure */
.reports-strip {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow) !important;
}
.reports-strip .counter-cell:first-child {
  background: var(--brand-deep);
  color: var(--surface);
}
.reports-strip
  .counter-cell:first-child
  :is(.counter-cell-value, .counter-cell-label, .counter-cell-detail, small, strong, bdi) {
  color: var(--surface);
}
.sales-chart {
  border-block-end: 1px solid var(--divider);
}
.grid2 .table-wrap tfoot td {
  font-weight: 700;
}
@media (max-width: 600px) {
  .page-head .toolbar {
    max-inline-size: 100%;
  }
  .grid2 {
    gap: var(--space-4);
  }
}

/* Administration and restricted forms */
.backup-panel form,
.device-create,
.log-filter {
  max-inline-size: 100%;
}
.backup-panel form {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-tint);
}
.backup-panel .backup-filename {
  overflow-wrap: anywhere;
}
.system-card p,
.payment-settings-row {
  border-block-end: 1px solid var(--divider);
}
.system-card p:last-child,
.payment-settings-row:last-child {
  border-block-end: 0;
}
.log-stack,
details pre {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--panel-tint);
}
#pwForm,
#userForm {
  row-gap: var(--space-4);
}

.backup-panel form {
  max-inline-size: min(100%, 34rem);
}
.device-create > .s2-panel-head {
  margin-inline: 0;
  flex-basis: 100%;
  border-radius: var(--radius-sm);
}

/* Sign-in and lockout share one card and keep the focus order. */
.login--entry {
  background: linear-gradient(165deg, var(--brand-deep) 0 36%, var(--canvas) 36%);
}
.login__layout {
  max-width: 420px;
}
.login__card {
  border-radius: var(--radius);
  border-block-start: var(--space-1) solid var(--action);
  padding: clamp(var(--space-5), 4vw, var(--space-8));
  box-shadow: var(--shadow-raised) !important;
}
.login__card .login-mark {
  border-radius: var(--radius-sm);
  background: var(--brand-deep);
  color: var(--surface);
}
.login__card h1 {
  color: var(--brand-deep);
  line-height: var(--line-title);
}
.login__note {
  border-block-start: 1px solid var(--divider);
  padding-block-start: var(--space-3);
}

/* Section spacing belongs to the layout parent. */
.counter-overview,
.receipt-sections {
  display: grid;
  gap: var(--space-6);
}
.counter-overview > *,
.receipt-sections > .card,
.order-detail-grid > .card {
  margin-block: 0;
}
.receipt-sections {
  min-inline-size: 0;
  align-content: start;
}
.order-detail-grid {
  gap: var(--space-6);
}
.order-detail-grid table {
  margin: 0;
}
.order-payment,
.manual-refund-note {
  overflow-wrap: anywhere;
}
.table-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-inline-size: 0;
}
#ordersTable .table-row-actions {
  gap: var(--space-1);
}
#ordersTable .table-row-actions > .btn {
  flex: none;
  white-space: nowrap;
  font-size: var(--text-xs);
  padding-inline: var(--space-1);
  line-height: var(--line-title);
  margin: 0;
}
@media (min-width: 861px) {
  #ordersTable th,
  #ordersTable td {
    padding-inline: var(--space-1);
  }
  /* Size the column from its primary value, then truncate its secondary metadata. */
  #ordersTable td small {
    inline-size: 0;
    min-inline-size: 100%;
  }
}
@media (min-width: 1281px) {
  #ordersTable .order-items {
    min-width: 5.5rem;
  }
  #ordersTable .table-row-actions {
    flex-wrap: nowrap;
    min-inline-size: max-content;
  }
}
@media (min-width: 861px) and (max-width: 1280px) {
  #ordersTable .table-row-actions {
    min-inline-size: 12rem;
  }
}
#ordersTable tbody td {
  vertical-align: middle;
}
@media (min-width: 861px) {
  #ordersTable .order-actions-cell {
    padding-block: var(--space-2);
  }
  #ordersTable tbody td {
    padding-block: var(--space-2);
  }
}
.sidebar-nav a[aria-current='page'] {
  background: var(--brand-deep);
  color: var(--surface);
}
.sidebar-nav a[aria-current='page']::after {
  display: none;
}
.page-head h1 {
  font-size: clamp(var(--text-xl), 2.3vw, 34px);
}
.s2-panel-head h2 {
  font-size: var(--text-lg);
  font-weight: 700;
}
.s2-panel-head,
.card > .card__head.s2-panel-head {
  border-block-end-color: var(--divider);
  padding-block: var(--space-3);
}
.counter-overview .s2-kpis .counter-cell-value {
  font-weight: 750;
  font-size: clamp(var(--text-xl), 2.4vw, 36px);
}
@media (max-width: 860px) {
  .table-row-actions {
    justify-content: flex-end;
  }
  .counter-overview,
  .receipt-sections,
  .order-detail-grid {
    gap: var(--space-4);
  }
}

/* Inset headings stay in normal flow and inherit each panel's own padding. */
.card > .s2-panel-head,
.card > .card__head.s2-panel-head {
  margin: 0 0 var(--space-4);
  padding: 0 0 var(--space-3);
  border-radius: 0;
}
.card.table-wrap > .s2-panel-head,
.table-wrap > .s2-panel-head {
  margin: 0;
  padding: var(--space-3) var(--space-4);
}

/* Allow the Arabic font ascenders and descenders inside single-line ellipses. */
.s2-order-items .order-items-text,
.s2-top-product p,
#ordersTable .technical-reference,
#ordersTable td small {
  line-height: 2.25;
}
