html {
  font-size: 15px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: #f4f6f3;
  color: #17211c;
  font-family: "Almarai", "Segoe UI", Tahoma, Arial, sans-serif;
}

button,
input,
select,
textarea,
.btn {
  font-family: inherit;
}

.app-shell {
  display: flex;
}

.app-sidebar {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  width: 280px;
  padding: 18px;
  background: #17211c;
  color: #fff;
  overflow-y: auto;
}

.sidebar-toggle,
.sidebar-close,
.sidebar-backdrop {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  padding: 10px 8px 20px;
}

.brand small {
  display: block;
  color: #a9b8af;
  margin-top: 4px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #f5a524;
  color: #1d1d1b;
  font-weight: 800;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav__home {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dfe8e2;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-weight: 800;
}

/* Icon badges: a glossy "wrapped" sphere for group headers (the visual anchor of each section), and a
   flatter tinted-glyph version for individual links and dashboard tiles - full gloss on ~90 small link
   icons would compete with itself instead of reading as one system. */
.nav-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  font-size: 15px;
  color: #d7ffe9;
  background: linear-gradient(160deg, #2a9d5c, #17683b);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.25),
    inset 0 1px 1px rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.nav-icon--sm {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.06);
  color: #9fd9b9;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.08);
}

.side-nav a:hover .nav-icon--sm,
.side-nav a.active .nav-icon--sm {
  background: linear-gradient(160deg, #2a9d5c, #17683b);
  color: #fff;
}

/* Groups collapse with <details>, so the markers below replace the browser's default triangle. */
.side-nav__group {
  border-radius: 10px;
}

.side-nav__group[open] {
  background: rgba(255, 255, 255, 0.03);
  padding-bottom: 6px;
}

.side-nav__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  border-radius: 8px;
  color: #a9bcb1;
  font-size: 0.82rem;
  font-weight: 800;
  user-select: none;
}

.side-nav__title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-nav__summary::-webkit-details-marker {
  display: none;
}

.side-nav__summary:hover,
.side-nav__summary:focus-visible {
  background: #26352e;
  color: #fff;
}

.side-nav__chevron {
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  padding: 3px;
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  opacity: 0.7;
}

.side-nav__group[open] .side-nav__chevron {
  transform: rotate(-135deg);
}

/* The daily action, sitting directly under its group heading. */
.side-nav__quick {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 8px 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(31, 185, 120, 0.14);
  border: 1px solid rgba(31, 185, 120, 0.32);
  color: #7ce0b0;
  font-weight: 800;
  font-size: 0.85rem;
  text-decoration: none;
}

.side-nav__quick:hover,
.side-nav__quick:focus {
  background: rgba(31, 185, 120, 0.24);
  color: #fff;
}

.side-nav__quick-plus {
  font-size: 1.05rem;
  line-height: 1;
}

.side-nav__links {
  display: grid;
  gap: 3px;
  padding: 0 6px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dfe8e2;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 0.9rem;
}

.side-nav__links a {
  padding-inline-start: 20px;
}

.side-nav a:hover,
.side-nav a:focus,
.side-nav a.active {
  background: #26352e;
  color: #fff;
}

.side-nav a.active {
  border-color: rgba(95, 191, 147, 0.32);
  box-shadow: inset 4px 0 0 #1fb978;
}

/* A group containing the current page stays visibly marked even while collapsed. */
.side-nav__group:has(a.active) > .side-nav__summary {
  color: #fff;
}

.side-nav-plan {
  margin: 14px 10px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  display: grid;
  gap: 2px;
}

.side-nav-plan__label {
  color: #8da094;
  font-size: 0.72rem;
  font-weight: 700;
}

.side-nav-plan__name {
  color: #fff;
  font-size: 0.95rem;
}

.side-nav-plan__link {
  color: #7ce0b0;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.app-main {
  min-height: 100vh;
  width: 100%;
  margin-inline-start: 280px;
}

.auth-main {
  margin-inline-start: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 26px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #dde5df;
  backdrop-filter: blur(10px);
}

.topbar span {
  display: block;
  color: #66746c;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.content {
  padding: 26px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}

.page-header h1,
.panel h1 {
  margin: 0 0 6px;
  font-size: 1.8rem;
  font-weight: 800;
}

.page-header p,
.login-brand p,
.panel p {
  margin: 0;
  color: #67756d;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel,
.login-panel {
  background: #fff;
  border: 1px solid #dde5df;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(23, 33, 28, 0.06);
}

.metric-card {
  padding: 16px;
  border-inline-start-width: 5px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: #64736b;
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 1.7rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-grid > div {
  min-height: 72px;
  padding: 14px;
  border: 1px solid #dbe5df;
  border-radius: 12px;
  background: #f8faf8;
}

.summary-grid span {
  display: block;
  color: #64736b;
  font-size: 0.86rem;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  color: #17211c;
  font-size: 1.15rem;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
}

/* Finance dashboard charts: plain divs sized by inline percentage/height, not a JS charting library -
   this renders identically every time with zero extra script weight and no CDN dependency, consistent
   with the rest of this app's server-rendered pages. */
.finance-chart-panel {
  min-height: 320px;
  display: flex;
  flex-direction: column;
}

.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 220px;
  padding: 0 4px;
  flex: 1;
}

.trend-chart__month {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.trend-chart__bars {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.trend-chart__bar {
  width: 30%;
  max-width: 22px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.2s ease;
}

.trend-chart__bar--revenue {
  background: #17683b;
}

.trend-chart__bar--expense {
  background: #c0392b;
}

.trend-chart__label {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #64736b;
  white-space: nowrap;
}

.composition-bar {
  display: flex;
  width: 100%;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f2f0;
  margin-top: 12px;
}

.composition-bar__segment {
  height: 100%;
  transition: width 0.2s ease;
}

.composition-bar__segment--cogs {
  background: #e0a30d;
}

.composition-bar__segment--expenses {
  background: #c0392b;
}

.composition-bar__segment--profit {
  background: #17683b;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: #3c463f;
  justify-content: center;
}

.chart-legend--wrap {
  flex-wrap: wrap;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-inline-end: 5px;
}

.legend-dot--revenue { background: #17683b; }
.legend-dot--expense { background: #c0392b; }
.legend-dot--cogs { background: #e0a30d; }
.legend-dot--expenses { background: #c0392b; }
.legend-dot--profit { background: #17683b; }

.loss-indicator {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  background: #fdeaea;
  color: #9d1c1c;
  text-align: center;
}

.loss-indicator strong {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.table {
  margin-bottom: 0;
}

.table tbody tr:hover {
  background: #fbfcfb;
}

.table thead th {
  color: #55625b;
  background: #f6f8f6;
  font-weight: 700;
}

.empty-cell {
  color: #79877f;
  text-align: center;
  padding: 24px !important;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #e9f6ef;
  color: #17683b !important;
  font-weight: 700;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 430px);
  padding: 28px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-brand h1 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 800;
}

.login-form {
  display: grid;
  gap: 10px;
}

.narrow-panel {
  max-width: 620px;
}

.pos-screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  min-height: calc(100vh - 120px);
}

.pos-sale,
.pos-summary {
  background: #fff;
  border: 1px solid #dde5df;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(23, 33, 28, 0.06);
}

.pos-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(180px, 1fr) minmax(150px, .7fr);
  gap: 10px;
  margin-bottom: 12px;
}

.pos-invoice-discount {
  display: flex;
  gap: 10px;
}

.pos-invoice-discount select {
  flex: 1.2;
}

.pos-invoice-discount input {
  flex: 1;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.pos-status {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f6f8f6;
  color: #56625c;
  font-weight: 700;
}

.pos-status.success {
  background: #e9f6ef;
  color: #17683b;
}

.pos-status.warning {
  background: #fff5df;
  color: #8a5b00;
}

.pos-status.danger {
  background: #fdeaea;
  color: #9d1c1c;
}

.search-item {
  min-height: 88px;
  padding: 12px;
  text-align: start;
  border: 1px solid #dbe5df;
  border-radius: 8px;
  background: #f9fbf9;
}

.search-item span,
.search-item small {
  display: block;
}

.search-item strong {
  display: block;
  margin: 4px 0;
  color: #17683b;
}

.search-empty {
  padding: 12px;
  color: #7b877f;
  background: #f7f8f7;
  border-radius: 8px;
}

.pos-cart-table td strong,
.pos-cart-table td small {
  display: block;
}

/* Category quick-filter chips above the product grid. */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.category-chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid #dbe5df;
  background: #f9fbf9;
  font-weight: 700;
  font-size: 0.85rem;
  color: #3c463f;
  cursor: pointer;
}

.category-chip.active {
  background: #17683b;
  border-color: #17683b;
  color: #fff;
}

/* The product grid itself: image-first tiles a cashier taps instead of typing. */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
  max-height: 46vh;
  overflow-y: auto;
  padding-inline-end: 2px;
}

.catalog-tile {
  display: flex;
  flex-direction: column;
  border: 1px solid #dbe5df;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.catalog-tile:hover,
.catalog-tile:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(23, 33, 28, 0.12);
}

.catalog-tile:active {
  transform: translateY(0);
}

.catalog-tile__media {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.catalog-tile__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* No photo yet: a coloured initial tile (using the item's category colour) instead of a broken
   image icon, so the grid looks finished on day one before anyone uploads real photos. */
.catalog-tile__initial {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.3rem;
}

.catalog-tile__name {
  padding: 6px 6px 2px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #17211c;
  line-height: 1.25;
  min-height: 2.4em;
}

.catalog-tile__price {
  padding: 0 6px 8px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #17683b;
}

.catalog-tile__stock {
  padding: 0 6px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #68756e;
}

.catalog-tile__stock--low {
  color: #a15c00;
}

.catalog-tile__stock--out {
  color: #b3261e;
  font-weight: 800;
}

.catalog-empty,
.catalog-loading {
  grid-column: 1 / -1;
  padding: 24px;
  text-align: center;
  color: #7b877f;
  background: #f7f8f7;
  border-radius: 8px;
}

/* Held-sale recall panel. */
.held-sales-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  padding: 20px;
}

.held-sales-panel {
  width: min(640px, 100%);
  max-height: 80vh;
  background: #fff;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.held-sales-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e6ece8;
}

.held-sales-list {
  overflow-y: auto;
  padding: 8px 12px 16px;
  display: grid;
  gap: 8px;
}

.held-sale-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e6ece8;
  border-radius: 8px;
}

.held-sale-row__info strong {
  display: block;
}

.held-sale-row__info small {
  display: block;
  color: #7b877f;
}

/* Open-shift panel - same overlay/panel chrome as the held-sales recall, but a plain form instead of a
   native window.prompt(), which some kiosk/tablet browsers block outright and which never shows an
   inline validation message. */
.open-shift-panel {
  width: min(360px, 100%);
}

.open-shift-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.open-shift-error {
  color: #c0392b;
  font-size: 14px;
}

/* App dialog - replaces window.confirm()/window.prompt() everywhere: a kiosk/tablet browser can block
   native dialogs outright and gives zero control over styling, RTL layout, or inline validation. One
   overlay handles both the yes/no and the single-input case; JS toggles [hidden] on the input row. */
.app-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 18, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.app-dialog-overlay.is-open {
  opacity: 1;
}

.app-dialog {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px 20px;
  text-align: center;
  box-shadow:
    0 1px 2px rgba(15, 23, 18, 0.06),
    0 10px 15px -3px rgba(15, 23, 18, 0.12),
    0 24px 48px -12px rgba(15, 23, 18, 0.28);
  transform: translateY(10px) scale(0.97);
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.app-dialog-overlay.is-open .app-dialog {
  transform: translateY(0) scale(1);
}

.app-dialog__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  background: linear-gradient(160deg, #1f8a4c, #145530);
  box-shadow:
    0 4px 6px -1px rgba(23, 104, 59, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -3px 6px rgba(0, 0, 0, 0.2);
}

.app-dialog--danger .app-dialog__icon {
  background: linear-gradient(160deg, #e0564a, #b23327);
  box-shadow:
    0 4px 6px -1px rgba(178, 51, 39, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -3px 6px rgba(0, 0, 0, 0.2);
}

.app-dialog--warning .app-dialog__icon {
  background: linear-gradient(160deg, #e0a83c, #b5791f);
  box-shadow:
    0 4px 6px -1px rgba(181, 121, 31, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -3px 6px rgba(0, 0, 0, 0.2);
}

.app-dialog__title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #17211c;
  margin: 0 0 6px;
}

.app-dialog__message {
  font-size: 0.92rem;
  color: #5b665f;
  line-height: 1.6;
  margin: 0 0 18px;
}

.app-dialog__input {
  width: 100%;
  padding: 10px 14px;
  margin: -4px 0 18px;
  border: 1px solid #d7ded9;
  border-radius: 10px;
  font-size: 0.95rem;
  text-align: center;
  background: #f9faf8;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-dialog__input:focus {
  outline: none;
  border-color: #17683b;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(23, 104, 59, 0.15);
}

.app-dialog__error {
  color: #c0392b;
  font-size: 0.82rem;
  margin: -12px 0 14px;
  min-height: 1em;
}

.app-dialog__actions {
  display: flex;
  gap: 10px;
}

.app-dialog__actions button {
  flex: 1;
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.app-dialog__confirm {
  color: #fff;
  background: linear-gradient(160deg, #1f8a4c, #17683b);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.12),
    0 6px 12px -2px rgba(23, 104, 59, 0.45);
}

.app-dialog--danger .app-dialog__confirm {
  background: linear-gradient(160deg, #e0564a, #c0392b);
  box-shadow:
    0 2px 0 rgba(0, 0, 0, 0.12),
    0 6px 12px -2px rgba(192, 57, 43, 0.45);
}

.app-dialog__confirm:hover {
  transform: translateY(-2px);
  filter: brightness(1.05);
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.12),
    0 10px 18px -3px rgba(23, 104, 59, 0.5);
}

.app-dialog--danger .app-dialog__confirm:hover {
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.12),
    0 10px 18px -3px rgba(192, 57, 43, 0.5);
}

.app-dialog__confirm:active {
  transform: translateY(0);
  filter: brightness(0.97);
}

.app-dialog__cancel {
  color: #45514a;
  background: #eef1ee;
}

.app-dialog__cancel:hover {
  background: #e2e7e2;
  transform: translateY(-1px);
}

.app-dialog__cancel:active {
  transform: translateY(0);
}

/* Password visibility toggle - typing a password blind is exactly how a fat-fingered character makes
   it into a saved credential unnoticed. */
.password-field {
  position: relative;
}

.password-field .form-control {
  padding-inline-end: 64px;
}

.password-toggle {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: none;
  color: #17683b;
  font-size: 13px;
  padding: 4px 6px;
  cursor: pointer;
}

.password-toggle:hover {
  text-decoration: underline;
}

/* Customer/supplier statement of account - debit and credit read at a glance instead of two identical
   plain black columns the reader has to compare by hand every row. */
.statement-table .statement-debit {
  color: #c0392b;
  font-weight: 600;
}

.statement-table .statement-credit {
  color: #17683b;
  font-weight: 600;
}

.statement-table .statement-balance {
  font-weight: 700;
}

.statement-balance--debit {
  color: #c0392b;
}

.statement-balance--credit {
  color: #17683b;
}

.statement-row--opening {
  background: #f4f7f5;
}

.statement-type-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #eef2f0;
  color: #3c4a41;
  font-size: 12.5px;
  white-space: nowrap;
}

.statement-type-badge--opening {
  background: #dbe7e0;
  color: #17683b;
  font-weight: 600;
}

.held-sales-empty {
  padding: 24px;
  text-align: center;
  color: #7b877f;
}


.qty-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.qty-stepper .qty-input {
  width: 64px;
  text-align: center;
  padding-inline: 2px;
}

.qty-stepper button {
  width: 30px;
  height: 30px;
  padding: 0;
  line-height: 1;
  font-weight: 800;
}

.qty-input {
  width: 110px;
}

.pos-summary {
  display: grid;
  align-content: start;
  gap: 12px;
}

.summary-line,
.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: #f6f8f6;
}

.summary-total {
  background: #17211c;
  color: #fff;
}

.summary-total strong {
  font-size: 2rem;
}

.payment-actions {
  display: grid;
  gap: 10px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.module-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 108px;
  padding: 18px 14px;
  border: 1px solid #dbe5df;
  border-radius: 14px;
  background: #fff;
  color: #17211c;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 18, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.module-tile .nav-icon {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-size: 20px;
}

.module-tile:hover {
  border-color: #bfe0cd;
  color: #17683b;
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -8px rgba(23, 104, 59, 0.25);
}

.module-tile.muted {
  color: #a3aea6;
  background: #f9fbf9;
}

.module-tile.muted .nav-icon {
  background: #e7ece8;
  color: #a3aea6;
  box-shadow: none;
}

.list-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.wide-toolbar {
  grid-template-columns: minmax(220px, 1fr) 180px 160px 160px auto;
}

.editor-form {
  display: grid;
  gap: 18px;
}

.procurement-section {
  margin-bottom: 18px;
}

.procurement-actions,
.form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.reject-form {
  display: grid;
  grid-template-columns: minmax(130px, 190px) auto;
  gap: 6px;
}

.procurement-lines {
  display: grid;
  gap: 10px;
}

.procurement-line {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(120px, 0.7fr) minmax(180px, 1.2fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbe5df;
  border-radius: 8px;
  background: #f8faf8;
}

.compact-number {
  min-width: 120px;
  max-width: 180px;
}

.count-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, .5fr) minmax(220px, 1fr);
  gap: 10px;
}

.count-table-wrap {
  max-height: 65vh;
  border: 1px solid #dde5df;
}

.count-table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.batch-grid {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 145px 145px;
  gap: 6px;
  min-width: 430px;
}

.simple-line {
  grid-template-columns: minmax(260px, 2fr) minmax(140px, .7fr) auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.span-2 {
  grid-column: span 2;
}

.checks-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px;
  border: 1px solid #dde5df;
  border-radius: 8px;
  background: #f9fbf9;
}

.readonly-box,
.json-box {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #dbe5df;
  border-radius: 8px;
  background: #f8faf8;
  color: #26352e;
}

.json-box {
  max-height: 320px;
  overflow: auto;
  direction: ltr;
  text-align: left;
  white-space: pre-wrap;
}

.form-actions,
.pager-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.actions-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.actions-row form {
  margin: 0;
}

.color-swatch {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-inline-end: .35rem;
  vertical-align: middle;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.permission-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.permission-group h2 {
  font-size: 1rem;
  margin: 0 0 12px;
}

.permission-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.permission-check small,
.permission-check code {
  display: block;
  color: var(--muted);
}

.danger-panel {
  border-color: #f1b9b9;
}

.table td small {
  display: block;
  color: #68756e;
}

.btn-primary {
  --bs-btn-bg: #17683b;
  --bs-btn-border-color: #17683b;
  --bs-btn-hover-bg: #125731;
  --bs-btn-hover-border-color: #125731;
}

/* --- "Wrapped" 3D buttons ------------------------------------------------------------------
   Every SOLID Bootstrap variant (primary/secondary/success/danger/warning/info/dark) gets a glossy,
   embossed treatment built entirely from its own --bs-btn-bg via color-mix(), so one rule covers every
   color the app already uses instead of hand-writing a gradient per variant. Outline and link buttons
   stay flat by design - an outline button that suddenly turned into a filled 3D pill on load would read
   as a different, heavier action than the one actually being offered. */
.btn {
  --bs-btn-border-radius: 11px;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.btn-check:checked + .btn,
.btn.btn-primary, .btn.btn-secondary, .btn.btn-success, .btn.btn-danger,
.btn.btn-warning, .btn.btn-info, .btn.btn-dark {
  border: none;
  background-color: var(--bs-btn-bg);
  background-image: linear-gradient(165deg, color-mix(in srgb, var(--bs-btn-bg) 70%, #fff), var(--bs-btn-bg) 55%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -3px 5px rgba(0, 0, 0, 0.18),
    0 3px 0 color-mix(in srgb, var(--bs-btn-bg) 55%, #000),
    0 9px 16px -6px color-mix(in srgb, var(--bs-btn-bg) 65%, transparent);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn.btn-primary:hover, .btn.btn-secondary:hover, .btn.btn-success:hover, .btn.btn-danger:hover,
.btn.btn-warning:hover, .btn.btn-info:hover, .btn.btn-dark:hover {
  transform: translateY(-2px);
  filter: brightness(1.04);
  background-color: var(--bs-btn-hover-bg, var(--bs-btn-bg));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.35),
    inset 0 -3px 5px rgba(0, 0, 0, 0.18),
    0 4px 0 color-mix(in srgb, var(--bs-btn-bg) 55%, #000),
    0 14px 22px -6px color-mix(in srgb, var(--bs-btn-bg) 60%, transparent);
}

.btn.btn-primary:active, .btn.btn-secondary:active, .btn.btn-success:active, .btn.btn-danger:active,
.btn.btn-warning:active, .btn.btn-info:active, .btn.btn-dark:active,
.btn.btn-primary:focus:active {
  transform: translateY(1px);
  filter: brightness(0.97);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.25),
    inset 0 -2px 4px rgba(0, 0, 0, 0.22),
    0 1px 0 color-mix(in srgb, var(--bs-btn-bg) 55%, #000);
}

.btn.btn-primary:disabled, .btn.btn-primary.disabled,
.btn.btn-success:disabled, .btn.btn-success.disabled,
.btn.btn-danger:disabled, .btn.btn-danger.disabled,
.btn.btn-secondary:disabled, .btn.btn-secondary.disabled {
  filter: grayscale(0.4) brightness(1.05);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.2);
  transform: none;
}

/* Outline buttons: flat, but with the same rounder corners and a lift on hover so the whole button
   family still reads as one system. */
.btn[class*="btn-outline-"] {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.btn[class*="btn-outline-"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -6px rgba(15, 23, 18, 0.25);
}

.btn[class*="btn-outline-"]:active {
  transform: translateY(0);
}

.btn-sm {
  --bs-btn-border-radius: 9px;
}

.form-control:focus,
.form-check-input:focus,
.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(23, 104, 59, 0.2);
}

.notification-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
}

.notification-list {
  display: grid;
  gap: 10px;
}

.notification-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-inline-start: 4px solid #9aa8a0;
  border-radius: 8px;
  background: #fff;
}

.notification-item.is-unread {
  border-inline-start-color: #17683b;
  background: #f6fbf8;
}

.notification-item-head,
.notification-item-actions,
.device-status-panel,
.device-status-list,
.device-token-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.api-scope-fieldset {
  border: 1px solid var(--border);
  padding: 1rem;
}

.api-scope-fieldset legend {
  float: none;
  width: auto;
  margin: 0;
  padding: 0 .35rem;
  font-size: .9rem;
  font-weight: 700;
}

.api-scope-fieldset .form-check {
  min-width: min(100%, 18rem);
}

.notification-item-head,
.device-status-panel {
  justify-content: space-between;
}

.notification-item-head > div,
.notification-item-actions,
.device-token-actions {
  flex-wrap: wrap;
}

.notification-item p {
  margin: 10px 0;
}

.notification-item time,
.notification-item-actions .text-muted {
  color: var(--muted);
  font-size: .875rem;
}

.bridge-token {
  margin-top: 8px;
  padding: 10px;
  overflow-wrap: anywhere;
  border: 1px solid #e0b85f;
  border-radius: 6px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  user-select: all;
}

.device-status-panel h2 {
  font-size: 1rem;
  margin: 0 0 8px;
}

@media (max-width: 1100px) {
  .metrics-grid,
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    position: fixed;
    z-index: 50;
    inset-block: 0;
    inset-inline-start: 0;
    width: min(320px, 88vw);
    max-height: 100vh;
    transform: translateX(105%);
    transition: transform 180ms ease;
    box-shadow: -18px 0 42px rgba(11, 21, 16, 0.24);
  }

  .sidebar-open {
    overflow: hidden;
  }

  .sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .sidebar-toggle,
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    padding: 0;
    border: 1px solid #cdd8d1;
    border-radius: 6px;
    background: #fff;
    color: #17211c;
    font-size: 1.4rem;
    line-height: 1;
  }

  .sidebar-close {
    position: absolute;
    z-index: 1;
    inset-block-start: 14px;
    inset-inline-end: 14px;
    border-color: rgba(255, 255, 255, 0.28);
    background: #26352e;
    color: #fff;
  }

  .sidebar-backdrop {
    position: fixed;
    z-index: 45;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(9, 17, 13, 0.48);
  }

  .sidebar-backdrop:not([hidden]) {
    display: block;
  }

  .brand {
    padding-inline-end: 54px;
  }

  .app-main {
    margin-inline-start: 0;
  }

  .topbar,
  .page-header,
  .filters,
  .list-toolbar,
  .form-grid,
  .notification-item-head,
  .device-status-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar-heading {
    align-items: center;
  }

  .topbar-actions {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .content {
    padding: 18px 16px;
  }

  .list-toolbar,
  .wide-toolbar,
  .form-grid,
  .procurement-line,
  .pos-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .pos-screen,
  .pos-sale,
  .pos-summary,
  .pos-toolbar > * {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .pos-sale .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  .reject-form {
    grid-template-columns: 1fr auto;
    width: 100%;
  }

  .count-toolbar,
  .batch-grid,
  .simple-line {
    grid-template-columns: 1fr;
  }

  .batch-grid {
    min-width: 260px;
  }

  .span-2 {
    grid-column: auto;
  }

  .metrics-grid,
  .dashboard-grid,
  .summary-grid,
  .module-grid,
  .pos-screen {
    grid-template-columns: 1fr;
  }

  .search-results {
    grid-template-columns: 1fr;
  }

  .catalog-grid {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    max-height: 34vh;
  }

  .held-sales-panel {
    max-height: 90vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-sidebar {
    transition: none;
  }
}

/* --- Flatpickr date/time picker theming: match the app's green + Almarai look ------------------ */
.flatpickr-calendar {
  font-family: "Almarai", "Segoe UI", Tahoma, Arial, sans-serif;
  direction: rtl;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  overflow: hidden;
}

.flatpickr-months .flatpickr-month,
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-weekdays {
  background: #17683b;
  color: #fff;
  fill: #fff;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
  background: transparent;
}

.flatpickr-weekday {
  background: #17683b;
  color: rgba(255, 255, 255, 0.85);
}

span.flatpickr-weekday {
  color: rgba(255, 255, 255, 0.85);
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: #17683b;
  border-color: #17683b;
}

.flatpickr-day.today {
  border-color: #17683b;
}

.flatpickr-day:hover {
  background: color-mix(in srgb, #17683b 12%, #fff);
}

.flatpickr-time input:hover,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:focus {
  background: color-mix(in srgb, #17683b 10%, #fff);
}

.numInputWrapper span.arrowUp:after {
  border-bottom-color: #17683b;
}

.numInputWrapper span.arrowDown:after {
  border-top-color: #17683b;
}
