/* Basel Hub Tailor — shared design system ("ink & thread"). RTL-first.
   Used by the shop app, the owner console, the commercial pages and the public
   site so they read as one product. Ink-navy base, one warm brass accent,
   linen-white surfaces. Class names are a contract: restyle, never rename. */
@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 {
  color-scheme: light;
  /* text */
  --ink: #141b2b;
  --ink-2: #454f63;
  --ink-3: #636c7f;          /* hints, placeholders: AA on paper and surface */
  /* surfaces (linen) */
  --paper: #f5f3ee;          /* page */
  --surface: #ffffff;        /* cards */
  --surface-2: #f0ede6;      /* wells, table heads */
  --surface-3: #f9f8f5;      /* hover, quiet fills */
  --line: #e5e1d8;
  --line-strong: #cbc5b7;
  --field-line: #979183;     /* input boundary: 3:1 on white */
  /* primary: deep ink navy */
  --primary: #18233a;
  --primary-600: #26365a;
  --primary-50: #e9edf5;
  --deep: #111a2c;           /* navigation, featured tiles */
  --on-deep: #ffffff;
  --on-deep-2: rgba(255,255,255,.66);
  /* accent: brass thread, used sparingly */
  --brass: #9a6b1e;
  --brass-ink: #74500f;      /* brass as text on light tints */
  --brass-lit: #d8b06a;      /* brass on deep surfaces */
  --brass-50: #f6ecd8;
  /* status (always paired with words) */
  --ok: #17663f;   --ok-50: #e3f2e9;
  --warn: #855000; --warn-50: #fbefd8;
  --bad: #a8231c;  --bad-50: #fbe7e4;
  --info: #1f5687; --info-50: #e5eef8;
  /* legacy names kept for every stylesheet that builds on this file */
  --green: var(--primary);
  --green-600: var(--primary-600);
  --green-50: var(--primary-50);
  --muted: var(--ink-2);
  /* shape */
  --radius-lg: 18px; --radius: 14px; --radius-sm: 10px; --radius-xs: 7px;
  /* spacing scale (4px grid) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 44px;
  --space: 16px;
  --tap: 44px;               /* minimum touch target */
  /* type scale */
  --t-xs: .76rem; --t-sm: .86rem; --t-md: 1rem; --t-lg: 1.12rem; --t-xl: 1.5rem; --t-2xl: 1.95rem;
  /* elevation */
  --shadow-1: 0 1px 2px rgba(20,27,43,.05);
  --shadow: 0 1px 2px rgba(20,27,43,.04), 0 4px 16px -6px rgba(20,27,43,.10);
  --shadow-2: 0 2px 6px rgba(20,27,43,.06), 0 16px 36px -12px rgba(20,27,43,.22);
  --shadow-3: 0 24px 70px -12px rgba(10,15,28,.42);
  --ring: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
  --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%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.65 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 700; letter-spacing: 0; }
h1 { font-size: var(--t-xl); } h2 { font-size: 1.14rem; } h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--primary); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--brass) 28%, transparent); }
summary { cursor: pointer; }
summary:focus-visible, details > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* 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; line-height: 1.6; }
a.hint { font-weight: 600; text-decoration: none; }
a.hint:hover { color: var(--primary); text-decoration: underline; }
.text-link { color: var(--primary); font-weight: 600; font-size: .9rem; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

/* ── controls ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: var(--tap); padding: 0 18px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer;
  font-weight: 600; font-size: .95rem; line-height: 1.2; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-1); white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .05s; }
.btn:hover { border-color: var(--ink-3); background: var(--surface-3); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible, .field:focus-visible, a:focus-visible, [tabindex]:focus-visible, .chip:focus-visible, .stat:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(20,27,43,.2), inset 0 1px 0 rgba(255,255,255,.1); }
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 38%, var(--line)); }
.btn.danger:hover { background: var(--bad-50); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn.ghost:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); border-color: transparent; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: .88rem; border-radius: var(--radius-xs); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.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(--primary) transparent var(--primary) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { width: 100%; min-height: var(--tap); padding: 9px 13px; border: 1px solid var(--field-line); border-radius: var(--radius-sm); background-color: var(--surface);
  box-shadow: inset 0 1px 1px rgba(20,27,43,.03); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.field:hover { border-color: var(--ink-2); }
.field:focus { border-color: var(--primary); box-shadow: var(--ring); outline: 0; }
.field:focus-visible { outline: 0; }
.field::placeholder { color: var(--ink-3); opacity: 1; }
.field[aria-invalid="true"] { border-color: var(--bad); background-color: var(--bad-50); }
.field[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
.field:disabled, .field[readonly] { background-color: var(--surface-2); color: var(--ink-2); }
.field:disabled { cursor: not-allowed; }
textarea.field { min-height: 88px; resize: vertical; line-height: 1.6; }
select.field:not([multiple]):not([size]) { appearance: none; -webkit-appearance: none; padding-inline-end: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23454f63' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: left 12px center; }
[dir="ltr"] select.field:not([multiple]):not([size]) { background-position: right 12px center; }
input[type="search"].field { -webkit-appearance: none; appearance: none; padding-inline-start: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='9' cy='9' r='5.5' fill='none' stroke='%23636c7f' stroke-width='1.6'/%3E%3Cpath d='m13.2 13.2 3.6 3.6' stroke='%23636c7f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 18px; background-position: right 13px center; }
[dir="ltr"] input[type="search"].field { background-position: left 13px center; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
:where([dir="rtl"]) input.field:where(.num, .phone, .code, [type="number"], [type="tel"], [inputmode="decimal"], [inputmode="numeric"], [inputmode="tel"]) { text-align: right; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
input[type="file"].field { padding: 7px 10px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; font-size: .86rem; margin-inline-end: 10px; padding: 5px 12px; border-radius: var(--radius-xs); border: 1px solid var(--line-strong); background: var(--surface-3); color: var(--ink); cursor: pointer; }
label.lbl, .lbl { display: block; font-weight: 600; font-size: .88rem; color: var(--ink); margin-bottom: 6px; }
.field-error { color: var(--bad); font-size: .85rem; font-weight: 500; margin-top: 5px; }
.form-grid { display: grid; gap: 16px 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; font-weight: 700; }
kbd { font: 600 .72rem/1 var(--font); padding: 3px 6px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink-2); }
.btn.primary kbd { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.24); color: #fff; }

/* ── surfaces ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card > h2, .card > h3 { margin-bottom: 12px; }
.stack { display: grid; gap: var(--space); }
.stack > * { min-width: 0; }
.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)); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { letter-spacing: -.01em; }
.page-head p { color: var(--ink-2); margin-top: 2px; max-width: 70ch; }

/* 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;
  box-shadow: var(--shadow-1); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.stat:hover { border-color: var(--ink-3); box-shadow: var(--shadow); }
.stat .stat-label, .stat .stat-value, .stat .stat-note { display: block; }
.stat .stat-label { font-size: .84rem; color: var(--ink-2); font-weight: 500; }
.stat .stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.3; margin-top: 2px; direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; text-align: end; }
.stat .stat-value small { font-size: .5em; font-weight: 500; color: var(--ink-3); margin-inline-start: .3em; }
.stat .stat-note { font-size: .8rem; color: var(--ink-3); }
.stat.static { cursor: default; box-shadow: none; } .stat.static:hover { border-color: var(--line); box-shadow: none; }

/* status always carries its name, never colour alone */
.badge { display: inline-flex; align-items: center; gap: .45em; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; line-height: 1.7; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.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-ink); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); -webkit-overflow-scrolling: touch; }
.card .table-wrap { box-shadow: none; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: .78rem; font-weight: 600; color: var(--ink-3); background: var(--surface-3); padding: 10px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl thead + tbody tr:first-child td { border-top: 0; }
.tbl td.end, .tbl th.end { text-align: end; }
.tbl tr.clickable { cursor: pointer; } .tbl tr.clickable td { transition: background .12s var(--ease); }
.tbl tr.clickable:hover td { background: var(--surface-3); }
.tbl tr.clickable:focus-within td { background: var(--primary-50); }
.tbl tfoot td { font-weight: 700; background: var(--surface-3); border-top: 1px solid var(--line-strong); }

/* ── states ── */
.notice { border-radius: var(--radius-sm); padding: 11px 14px; border: 1px solid var(--line); background: var(--surface-3); font-size: .92rem; line-height: 1.6; color: var(--ink-2); }
.notice.ok { background: var(--ok-50); border-color: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.notice.warn { background: var(--warn-50); border-color: color-mix(in srgb, var(--warn) 24%, transparent); color: var(--warn); }
.notice.bad { background: var(--bad-50); border-color: color-mix(in srgb, var(--bad) 24%, transparent); color: var(--bad); }
.notice.info { background: var(--info-50); border-color: color-mix(in srgb, var(--info) 22%, transparent); color: var(--info); }
.notice .btn { margin-inline-start: 6px; }
.notice .btn:not(.primary) { color: var(--ink); }
.notice a:not(.btn) { color: inherit; font-weight: 600; }
.empty { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 40px 16px; color: var(--ink-2); font-size: .93rem; }
.empty strong { display: block; color: var(--ink); font-size: 1rem; }
/* a threaded needle: the "nothing here yet" mark */
.empty:has(> strong)::before { content: ""; width: 52px; height: 52px; margin-bottom: 8px; border-radius: 50%; border: 1.5px dashed var(--line-strong);
  background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke-linecap='round'%3E%3Cpath d='M5 18c4.5-.5 3.5-9.5 8-9.5s3.5 5.5 7 5' stroke='%239a6b1e' stroke-width='1.4' stroke-dasharray='2 2.2'/%3E%3Cpath d='M17.5 4.5 7 19' stroke='%23454f63' stroke-width='1.5'/%3E%3C/svg%3E") center / 28px no-repeat; }
.skeleton { border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toasts { position: fixed; inset-inline: 0; bottom: 20px; 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(--deep); color: #fff; padding: 11px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow-2); font-weight: 500; font-size: .93rem; animation: rise .22s var(--ease); }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow-3); color: var(--ink); background: var(--surface); overflow: hidden; }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .2s var(--ease); }
dialog.modal::backdrop { background: rgba(13,19,33,.5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.modal-head { flex: none; padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.modal-head h2 { font-size: 1.08rem; }
.modal-head [data-close] { min-width: 40px; min-height: 40px; padding: 0; border-radius: 50%; margin-inline-end: -8px; color: var(--ink-2); }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 20px; display: grid; gap: 16px; align-content: start; overflow: auto; overscroll-behavior: contain; }
.modal-body > * { min-width: 0; }
.modal-foot { flex: none; padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-start; background: var(--surface-3); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; font-weight: 600; font-size: .88rem; text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"], .chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.env-banner { background: var(--brass-50); color: var(--brass-ink); text-align: center; font-size: .78rem; font-weight: 600; padding: 3px 12px; border-bottom: 1px solid color-mix(in srgb, var(--brass) 22%, transparent); }

/* fingers need more room than pointers */
@media (pointer: coarse) {
  .btn.small, .chip { min-height: var(--tap); }
  .btn.small { padding: 0 14px; }
}
@media (max-width: 560px) {
  .card { padding: 16px; }
  .page-head { margin-bottom: 16px; }
  h1 { font-size: 1.35rem; }
  /* dialogs become bottom sheets */
  dialog.modal { width: 100vw !important; max-width: 100vw; max-height: calc(100dvh - 20px); margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  dialog.modal[open] { animation-name: sheet-in; }
  .modal-body { padding: 16px; }
  .modal-head { padding: 12px 16px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-body .btn:not(.small), .modal-foot .btn { flex: 1 1 auto; }
}
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }

@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, .table-wrap, .btn { box-shadow: none; }
}
