/* Basel Hub Tailor — shared design system. RTL-first. Used by the shop app,
   the owner console and the public site so they read as one product. */
@font-face { font-family: "Thmanyah Sans"; font-weight: 400; font-display: swap; src: url("/assets/fonts/thmanyahsans-Regular.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Sans"; font-weight: 500; font-display: swap; src: url("/assets/fonts/thmanyahsans-Medium.woff2") format("woff2"); }
@font-face { font-family: "Thmanyah Sans"; font-weight: 600 800; font-display: swap; src: url("/assets/fonts/thmanyahsans-Bold.woff2") format("woff2"); }

:root {
  /* cloth, thread, brass */
  --ink: #16241d;            /* text */
  --ink-2: #47564e;          /* secondary text */
  --ink-3: #7b877f;          /* hints, placeholders */
  --paper: #f6f4ee;          /* page */
  --surface: #ffffff;        /* cards */
  --surface-2: #efece3;      /* wells, table heads */
  --line: #e2ded2;
  --line-strong: #cfc9b8;
  --green: #1d4a39;          /* primary */
  --green-600: #24604a;
  --green-50: #e8f0eb;
  --brass: #a9772b;          /* accent, sparingly */
  --brass-50: #f6ecd9;
  --ok: #1f7a4d;   --ok-50: #e3f3ea;
  --warn: #a35f00; --warn-50: #fbeed6;
  --bad: #b3261e;  --bad-50: #fbe5e3;
  --info: #235e8f; --info-50: #e3eef7;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(22,36,29,.05), 0 6px 20px rgba(22,36,29,.05);
  --space: 16px;
  --font: "Thmanyah Sans", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.65 var(--font); }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; letter-spacing: 0; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; }
p { margin: 0; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* numbers, phones, order codes: always left-to-right, aligned digits */
.num, .money, .phone, .code { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.money { font-weight: 600; white-space: nowrap; }
.money small { font-weight: 500; color: var(--ink-3); margin-inline-start: .3em; font-size: .78em; }
.muted { color: var(--ink-2); } .hint { color: var(--ink-3); font-size: .86rem; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 42px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer;
  font-weight: 600; text-decoration: none; color: var(--ink); transition: background .15s var(--ease), border-color .15s var(--ease), transform .05s; }
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .field:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 45%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-600); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 34px; padding: 0 11px; font-size: .9rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: #fff transparent #fff transparent; animation: spin .7s linear infinite; }
.btn:not(.primary).busy::after { border-color: var(--green) transparent var(--green) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); }
.field::placeholder { color: var(--ink-3); }
.field[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-50); }
textarea.field { min-height: 84px; resize: vertical; }
label.lbl { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field-error { color: var(--bad); font-size: .85rem; margin-top: 4px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.stack { display: grid; gap: var(--space); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }

/* a number that explains itself and opens its details */
.stat { display: block; text-align: start; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; text-decoration: none; color: inherit; }
.stat:hover { border-color: var(--green); }
.stat .stat-label { font-size: .86rem; color: var(--ink-2); font-weight: 500; }
.stat .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.25; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; text-align: end; }
.stat .stat-note { font-size: .8rem; color: var(--ink-3); }
.stat.static { cursor: default; } .stat.static:hover { border-color: var(--line); }

/* status always carries its name, never colour alone */
.badge { display: inline-flex; align-items: center; gap: .4em; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-50); color: var(--ok); } .badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.bad { background: var(--bad-50); color: var(--bad); } .badge.info { background: var(--info-50); color: var(--info); }
.badge.brass { background: var(--brass-50); color: var(--brass); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: .82rem; font-weight: 600; color: var(--ink-2); background: var(--surface-2); padding: 10px 14px; white-space: nowrap; }
.tbl td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl td.end, .tbl th.end { text-align: end; }
.tbl tr.clickable { cursor: pointer; } .tbl tr.clickable:hover td { background: var(--green-50); }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); }

/* states */
.notice { border-radius: var(--radius-sm); padding: 10px 14px; border: 1px solid var(--line); background: var(--surface-2); font-size: .93rem; }
.notice.ok { background: var(--ok-50); border-color: transparent; color: var(--ok); }
.notice.warn { background: var(--warn-50); border-color: transparent; color: var(--warn); }
.notice.bad { background: var(--bad-50); border-color: transparent; color: var(--bad); }
.notice.info { background: var(--info-50); border-color: transparent; color: var(--info); }
.empty { text-align: center; padding: 36px 16px; color: var(--ink-2); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2), #f7f5ee, var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toasts { position: fixed; inset-inline: 0; bottom: 18px; display: grid; gap: 8px; justify-items: center; z-index: 60; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 520px; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 500; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }

dialog.modal { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog.modal::backdrop { background: rgba(22,36,29,.45); }
.modal-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-body { padding: 18px; display: grid; gap: 14px; overflow: auto; }
.modal-foot { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-start; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 36px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 500; font-size: .9rem; }
.chip[aria-pressed="true"], .chip.active { background: var(--green); border-color: var(--green); color: #fff; }

.env-banner { background: var(--brass-50); color: var(--brass); text-align: center; font-size: .82rem; font-weight: 600; padding: 4px 10px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .card { box-shadow: none; border-color: #999; }
}

.stat .stat-label, .stat .stat-value, .stat .stat-note { display: block; }
.stat .stat-value small { font-size: .5em; font-weight: 500; color: var(--ink-3); margin-inline-start: .3em; }
