/* DispaGas Commande — customer pages and back office. System fonts only (nothing loaded from other sites). */
:root {
  --bg: #f6f6f4;
  --card: #ffffff;
  --ink: #0b0d10;
  --ink-2: #2b3038;
  --muted: #646a73;
  --line: #e5e5e1;
  --line-2: #d4d4ce;
  --accent: #f97316;
  --accent-ink: #c2410c;
  --accent-soft: #fff1e6;
  --green: #059669;
  --green-soft: #e7f6f0;
  --red: #dc2626;
  --red-soft: #fdecec;
  --amber: #b45309;
  --amber-soft: #fdf3e2;
  --blue: #2563eb;
  --blue-soft: #e9f0fe;
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans Arabic', 'Geeza Pro', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.55 var(--font); }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
a { color: var(--accent-ink); }
img { max-width: 100%; }
code, .key { font-family: ui-monospace, 'SF Mono', Menlo, monospace; background: var(--bg); padding: .1em .35em; border-radius: 6px; }
.key { font-size: 1.05em; letter-spacing: .05em; user-select: all; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: .4rem 0; }
.warn { color: var(--amber); font-weight: 600; }
.num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- frame */
.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1280px; }
.wrap.narrow { max-width: 520px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { height: 30px; width: auto; display: block; }
.brand .tag { font-size: .75rem; }
.top-nav { display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; font-size: .95rem; }
.top-nav a { color: var(--ink-2); text-decoration: none; padding: 4px 0; }
.top-nav a:hover, .top-nav a[aria-current] { color: var(--accent-ink); }
.top-nav a[aria-current] { font-weight: 700; }
.top-nav .lang { border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 12px; }
.foot { color: var(--muted); font-size: .85rem; padding: 24px 0 40px; text-align: center; }
.foot a { color: inherit; }

/* ---------- blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.narrow-card { max-width: 440px; margin: 40px auto; }
.card.notice, .notice { background: var(--amber-soft); border-color: #f2dcb6; }
p.notice { padding: 10px 14px; border-radius: 10px; }
.card.success { background: var(--green-soft); border-color: #bfe6d6; }
.hero { padding: 8px 0 12px; }
.hero h1 { font-size: 1.9rem; margin-bottom: .25em; }
.hero p { color: var(--ink-2); margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 860px) { .grid2 { grid-template-columns: 1fr 1fr; } .admin-grid { grid-template-columns: 3fr 2fr; } }
.step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .85rem; margin-inline-end: 6px; }

/* ---------- forms */
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; min-width: 0; border: 0; padding: 0; }
.field > span, .field > legend { font-size: .88rem; font-weight: 600; color: var(--ink-2); padding: 0; }
.field.grow { flex: 1 1 220px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number], input[type=search], input[type=date], input[type=time], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input:disabled { background: var(--bg); color: var(--muted); }
input.small { width: 90px; min-height: 36px; padding: 6px 8px; }
textarea { resize: vertical; }
.row { display: flex; gap: 0 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }
.row > .field.qty { flex: 0 0 110px; }
.row.end { align-items: flex-end; }
.row.end > .btn, .row.end > .check { margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin: 6px 0 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 0 18px; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.pill { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 14px; cursor: pointer; background: #fff; min-height: 44px; }
.pill input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.pill:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.line { border: 1px solid var(--line); border-radius: 12px; padding: 14px 14px 4px; margin: 0 0 12px; }
.line .remove { margin-bottom: 10px; }
.locate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
form.inline { display: inline; }
.box { border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px; margin: 10px 0; }
details { margin: 8px 0; }
summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 10px; padding: 10px 18px; min-height: 44px; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { background: #fff; color: var(--accent-ink); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.big { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 4px; }
.btn.danger { background: var(--red); border-color: var(--red); }
.btn.ghost.danger { background: #fff; color: var(--red); border-color: #f3c4c4; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); cursor: pointer; text-decoration: underline; }
.link.danger { color: var(--red); }

/* ---------- messages */
.flash { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; border: 1px solid; }
.flash ul { margin: 0; padding-inline-start: 18px; }
.flash.ok { background: var(--green-soft); border-color: #bfe6d6; color: #065f46; }
.flash.error { background: var(--red-soft); border-color: #f3c4c4; color: #991b1b; }

/* ---------- estimate and amounts */
.estimate { border: 2px solid var(--accent); }
.sum { width: 100%; border-collapse: collapse; margin: 4px 0 8px; }
.sum td, .sum th { padding: 8px 0; border-top: 1px solid var(--line); vertical-align: top; text-align: start; }
.sum th.num, .sum td.num { text-align: end; padding-inline-start: 12px; }
.sum tr:first-child td { border-top: 0; }
.sum tr.total td { font-weight: 800; font-size: 1.1rem; border-top: 2px solid var(--ink); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.big-amount { font-size: 1.6rem; font-weight: 800; display: flex; flex-direction: column; align-items: flex-end; }
.big-amount span { font-size: .85rem; font-weight: 500; }

/* ---------- statuses */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.s-new { background: var(--accent-soft); color: var(--accent-ink); }
.s-confirmed { background: var(--blue-soft); color: #1d4ed8; }
.s-preparing { background: var(--amber-soft); color: var(--amber); }
.s-delivering { background: #f1e9fe; color: #6d28d9; }
.s-delivered { background: var(--green-soft); color: #047857; }
.s-cancelled { background: #eef0f2; color: var(--muted); }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--bg); color: var(--ink-2); border: 1px solid var(--line); vertical-align: middle; }
.tag.danger { background: var(--red-soft); color: #991b1b; border-color: #f3c4c4; }
.tag.warn { background: var(--amber-soft); color: var(--amber); border-color: #f2dcb6; }
.timeline { list-style: none; display: flex; padding: 0; margin: 16px 0 8px; counter-reset: step; }
.timeline li { flex: 1; text-align: center; font-size: .78rem; color: var(--muted); position: relative; padding-top: 30px; }
.timeline li::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; border-radius: 50%;
  background: var(--line); color: var(--muted); display: grid; place-items: center; font-weight: 700; z-index: 1; }
.timeline li::after { content: ''; position: absolute; top: 11px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.timeline li:first-child::after { display: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--green); color: #fff; content: '✓'; }
.timeline li.done::after { background: var(--green); }
.timeline li.current { font-weight: 700; }
[dir=rtl] .timeline li::after { left: auto; right: -50%; }

/* ---------- lists and tables */
.list { list-style: none; padding: 0; margin: 0; }
.list > li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list.compact > li { padding: 6px 0; justify-content: flex-start; }
.list-side { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-card { padding: 0; overflow-x: auto; }
.table-card h2 { padding: 16px 16px 0; }
.table-card .hint { padding: 0 16px 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: 10px 12px; border-top: 1px solid var(--line); text-align: start; vertical-align: top; }
.table thead th { border-top: 0; background: #fafaf8; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table tr.is-new td { background: #fffaf5; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.table .actions { white-space: nowrap; }
.table .actions form + form { margin-inline-start: 10px; }
.scroll-x { overflow-x: auto; }
.price-cell { white-space: nowrap; }
.price-cell input[type=text] { width: 76px; }
.filters { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; padding-bottom: 8px; }
.filters .field { flex: 1 1 140px; }
.filters .btn { margin-bottom: 12px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: .88rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat strong { display: block; font-size: 1.5rem; }
.stat small { color: var(--muted); }
.events { list-style: none; padding: 0; margin: 12px 0 0; font-size: .9rem; }
.events li { padding: 8px 0; border-top: 1px solid var(--line); }
.wa-list { display: flex; flex-direction: column; gap: 10px; }
.wa-btn { background: #128c4b; border-color: #128c4b; width: 100%; justify-content: flex-start; }
.wa-btn:hover { background: #0e6f3b; border-color: #0e6f3b; }
.wa-btn.done { background: #fff; color: #0e6f3b; border-color: #9fd8b8; }
.preview { white-space: pre-wrap; background: var(--bg); padding: 10px; border-radius: 8px; font: .85rem/1.45 var(--font); margin: 6px 0 0; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.placeholders { columns: 2 220px; font-size: .9rem; padding-inline-start: 18px; }
.brand-row { border-top: 1px solid var(--line); padding-top: 10px; }
.brand-logo { height: 40px; width: auto; margin-bottom: 14px; }
.zone-row { border-top: 1px solid var(--line); padding-top: 10px; }
.delete-row { margin: -8px 0 10px; font-size: .85rem; }
.qr { width: 220px; max-width: 100%; margin: 10px auto; }
.qr svg { width: 100%; height: auto; display: block; }

/* ---------- order page: picture tiles, quantity, map */
.lbl { font-size: .88rem; font-weight: 600; color: var(--ink-2); margin: 12px 0 6px; }
.tiles { display: grid; gap: 10px; }
.tiles.sizes { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.tiles.brands { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.tiles.cities { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); margin-bottom: 12px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 10px 8px; cursor: pointer; min-height: 56px;
  transition: border-color .15s, background .15s, transform .1s; }
.tile:hover { border-color: var(--line-2); }
.tile:active { transform: scale(.98); }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.tile:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile:has(input:checked)::after { content: '✓'; position: absolute; top: 6px; inset-inline-end: 8px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: .75rem; font-weight: 800; display: grid; place-items: center; }
.tile.size img { height: 96px; width: auto; max-width: 100%; object-fit: contain; }
.tile.brand img { height: 34px; width: auto; max-width: 90%; object-fit: contain; }
.tile .initials { width: 38px; height: 38px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line-2); display: grid; place-items: center;
  font-weight: 800; font-size: .85rem; color: var(--ink-2); }
.tile .t-label { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.tile .t-sub { font-size: .78rem; color: var(--muted); line-height: 1.25; }
.tile.small { padding: 6px; min-height: 0; flex-direction: row; gap: 8px; }
.tile.small img { height: 22px; }
.tile.small .initials { width: 26px; height: 26px; font-size: .7rem; }
.tile.small .t-label { font-size: .85rem; }
.tile.small:has(input:checked)::after { top: 50%; transform: translateY(-50%); width: 16px; height: 16px; font-size: .65rem; inset-inline-end: 6px; }
.tile.city.soon { opacity: .55; cursor: not-allowed; background: var(--bg); }
.tile.city.soon .t-sub { color: var(--amber); font-weight: 600; }
.line-head { font-weight: 800; font-size: 1rem; padding: 0; }
.line { position: relative; padding: 14px; }
.line .remove { position: absolute; top: 14px; inset-inline-end: 14px; margin: 0; }
.line-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.line-row .choice { margin: 0; }
.choice.big .pill { padding: 10px 16px; font-weight: 600; }
.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: #fff; }
.stepper button { width: 46px; border: 0; background: var(--bg); font-size: 1.4rem; font-weight: 700; color: var(--ink); cursor: pointer; }
.stepper button:active { background: var(--accent-soft); }
.stepper input { width: 56px; border: 0; border-radius: 0; text-align: center; font-weight: 800; font-size: 1.1rem; min-height: 46px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.map { height: 320px; border-radius: 12px; border: 1px solid var(--line-2); margin: 4px 0 8px; z-index: 0; }
.map-small { height: 220px; }
.notice-inline { background: var(--amber-soft); padding: 8px 12px; border-radius: 10px; color: var(--amber); }
.size-thumb { height: 48px; width: auto; display: block; }
.table.edit input.tiny { min-width: 54px; width: 64px; }
.table.edit input[type=time] { min-height: 38px; padding: 6px 8px; width: auto; }
.small-check { font-size: .78rem; margin: 4px 0 0; }
.place-map { padding: 0 16px 16px; }

/* ---------- tables with tick boxes and batch actions */
.table th.pick, .table td.pick { width: 36px; padding-inline-end: 0; }
.pick input { width: 18px; height: 18px; accent-color: var(--accent); vertical-align: middle; }
.table tr.picked td { background: var(--accent-soft); }
.nowrap { white-space: nowrap; }
.table td.num, .table th.num { text-align: end; }
.batch-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafaf8; }
.batch-bar.active { background: var(--accent-soft); }
.batch-bar select, .batch-bar input[type=text] { width: auto; min-height: 38px; padding: 6px 10px; }
.batch-bar .btn { min-height: 38px; padding: 6px 14px; }
.batch-count { font-size: .88rem; font-weight: 600; color: var(--ink-2); min-width: 100px; }
.table.edit td { vertical-align: middle; }
.table.edit input[type=text], .table.edit input[type=number] { min-height: 38px; padding: 6px 8px; min-width: 110px; }
.table.edit input.small { min-width: 70px; width: 90px; }
.table.edit input[type=file] { font-size: .8rem; max-width: 190px; }
.table.edit input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.table tr.new-row td { background: #fcfcfa; border-top: 2px dashed var(--line-2); }
.btn.small-btn { min-height: 36px; padding: 5px 12px; font-size: .88rem; }
.events td { font-size: .88rem; }
.table-card details .table { margin-top: 6px; }

/* ---------- receipt */
.receipt-page { background: #fff; }
.receipt { max-width: 640px; margin: 24px auto; padding: 24px 16px; }
.receipt header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; }
.receipt header img { height: 36px; width: auto; }
.receipt header h1 { margin: 0; text-align: end; }
.receipt header p { margin: 0; text-align: end; color: var(--muted); }
.receipt .who { margin: 0 0 16px; }
.receipt thead th { font-size: .8rem; color: var(--muted); text-transform: uppercase; }
.receipt footer { margin-top: 24px; font-size: .85rem; }
@media print { .no-print { display: none; } .receipt { margin: 0; } }

@media (max-width: 520px) {
  h1 { font-size: 1.4rem; }
  .hero h1 { font-size: 1.6rem; }
  .card { padding: 16px; }
  .brand img { height: 26px; }
  .table th, .table td { padding: 8px; }
  .timeline li { font-size: .68rem; }
}
