/* AM Gallery - premium minimalist print system */
:root {
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --ink: #141414;
  --ink-2: #4a4843;
  --muted: #8a867d;
  --line: #e4ded2;
  --lime: #c9f23c;
  --lime-ink: #2f3a00;
  --coral: #ff6b57;
  --coral-soft: #ffe3de;
  --ok: #2f7d32;
  --warn: #b26a00;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(20, 20, 20, .04), 0 8px 30px rgba(20, 20, 20, .06);
  --font-head: "Space Grotesk", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
[dir="rtl"] { --font-head: "IBM Plex Sans Arabic", system-ui, sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: -.02em; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 700; }
h2 { font-size: 1.35rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }
a { color: inherit; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: end; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-family: "Space Grotesk", sans-serif; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--lime);
  display: grid; place-items: center; font-weight: 700; font-size: .8rem; letter-spacing: -.04em;
}
.brand-name { font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em; }
.brand-name span { color: var(--muted); font-weight: 500; }

/* Surfaces */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.pill {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .7rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; background: var(--line); color: var(--ink-2); white-space: nowrap;
}
.pill.lime { background: var(--lime); color: var(--lime-ink); }
.pill.coral { background: var(--coral-soft); color: #a3281a; }
.pill.dark { background: var(--ink); color: #fff; }
.pill.warn { background: #fff0d6; color: var(--warn); }
.pill.ok { background: #e3f3e1; color: var(--ok); }
.dot { width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; display: inline-block; }

/* Buttons & inputs */
.btn {
  appearance: none; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font: 600 1rem var(--font-body); padding: .8rem 1.3rem; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; text-decoration: none;
  transition: transform .08s ease, background .15s ease; min-height: 48px;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.lime { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.btn.coral { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.sm { padding: .4rem .9rem; font-size: .88rem; min-height: 36px; }
.btn.block { width: 100%; }
.btn.link { background: none; border: none; color: var(--ink-2); text-decoration: underline; padding: .2rem; min-height: 0; }

label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: .35rem; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=tel], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .7rem .85rem; min-height: 46px;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.field { margin-bottom: 1rem; }
.help { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; }
.check input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; accent-color: var(--ink); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.stepper button {
  width: 40px; height: 40px; border: 0; background: none; font-size: 1.3rem; cursor: pointer; color: var(--ink);
  border-radius: 50%;
}
.stepper button:disabled { opacity: .3; }
.stepper input { width: 3.2rem; border: 0; text-align: center; font-weight: 700; padding: 0; min-height: 40px; background: none; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.flash { border-radius: var(--radius-sm); padding: .8rem 1rem; margin-bottom: 1rem; font-weight: 500; }
.flash.ok { background: #e9f7d0; color: #2c3d00; }
.flash.error { background: var(--coral-soft); color: #8f2215; }
.alert { border-radius: var(--radius-sm); padding: .9rem 1rem; background: #fff0d6; color: #6b4000; }
.alert.coral { background: var(--coral-soft); color: #8f2215; }

/* ===================== CUSTOMER ===================== */
.c-wrap { max-width: 640px; margin: 0 auto; padding: 1rem 1rem 8rem; }
.c-top { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0 1.25rem; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.lang button { border: 0; background: none; padding: .45rem .85rem; font: 600 .85rem var(--font-body); cursor: pointer; color: var(--ink-2); }
.lang button[aria-pressed=true] { background: var(--ink); color: #fff; }

.hero { background: var(--ink); color: #fff; border-radius: 24px; padding: 1.5rem; position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset-inline-end: -40px; top: -40px; width: 160px; height: 160px;
  border-radius: 50%; background: var(--lime); opacity: .95;
}
.hero > * { position: relative; z-index: 1; }
.hero .label { font-size: .85rem; color: #cfcac0; text-transform: uppercase; letter-spacing: .08em; }
.hero .big { font-family: "Space Grotesk", sans-serif; font-size: 4rem; font-weight: 700; line-height: 1; letter-spacing: -.04em; }
.hero .sub { color: #cfcac0; font-size: .92rem; }
.hero .code { font-family: "Space Grotesk", monospace; letter-spacing: .05em; color: var(--lime); font-weight: 600; }

.section { margin-top: 1.5rem; }
.section-title { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .75rem; }
.section-title .num {
  width: 26px; height: 26px; border-radius: 50%; background: var(--lime); color: var(--ink);
  display: inline-grid; place-items: center; font: 700 .85rem "Space Grotesk", sans-serif; flex: none;
}

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  border: 2px dashed #cfc8b9; border-radius: var(--radius); padding: 2rem 1rem; text-align: center;
  background: var(--surface); cursor: pointer; position: relative;
}
.drop:hover { border-color: var(--ink); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop .plus { width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: var(--lime); display: grid; place-items: center; font-size: 1.8rem; }

.items { display: grid; gap: .9rem; }
.item { display: grid; grid-template-columns: 112px 1fr; gap: .9rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; }
.item canvas, .item .thumb { width: 112px; border-radius: 8px; background: #eee; display: block; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.item .meta { display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.item .actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.uploading { opacity: .6; }
.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ink); width: 0; transition: width .2s; }

.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .5rem; }
.picker button { border: 2px solid transparent; padding: 0; border-radius: 10px; overflow: hidden; background: none; position: relative; aspect-ratio: 1; cursor: pointer; }
.picker img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker button[aria-pressed=true] { border-color: var(--ink); }
.picker .badge { position: absolute; top: 4px; inset-inline-start: 4px; background: var(--lime); color: var(--ink); border-radius: 50%; width: 22px; height: 22px; font-weight: 700; font-size: .75rem; display: grid; place-items: center; }

.bar {
  position: fixed; inset-inline: 0; bottom: 0; background: rgba(255, 253, 248, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom));
  z-index: 20;
}
.bar-inner { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; }
.bar .total { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.2rem; }
.bar .total.over { color: var(--coral); }

.jobs { display: grid; gap: .5rem; }
.job { display: flex; align-items: center; gap: .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: .55rem .7rem; }
.job img, .job .ph { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.job .grow { min-width: 0; }
.st-queued { background: var(--line); color: var(--ink-2); }
.st-printing { background: var(--lime); color: var(--lime-ink); }
.st-sent { background: #e6efff; color: #1f4aa8; }
.st-printed { background: #e3f3e1; color: var(--ok); }
.st-problem { background: var(--coral-soft); color: #a3281a; }
.st-cancelled { background: #eee; color: #888; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20, 20, 20, .55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal-box { background: var(--surface); width: 100%; max-width: 640px; border-radius: 24px 24px 0 0; padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom)); max-height: 94vh; overflow: auto; }
@media (min-width: 700px) { .modal { align-items: center; } .modal-box { border-radius: 24px; } }

.cropper { position: relative; width: 100%; background: #222; border-radius: 12px; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.cropper canvas { width: 100%; display: block; }
.cropper .grid { position: absolute; inset: 0; pointer-events: none; background:
  linear-gradient(to right, transparent 33.2%, rgba(255,255,255,.35) 33.3%, transparent 33.5%, transparent 66.5%, rgba(255,255,255,.35) 66.6%, transparent 66.8%),
  linear-gradient(to bottom, transparent 33.2%, rgba(255,255,255,.35) 33.3%, transparent 33.5%, transparent 66.5%, rgba(255,255,255,.35) 66.6%, transparent 66.8%); }
input[type=range] { width: 100%; accent-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: #fff; }
.seg button { border: 0; background: none; padding: .45rem .9rem; border-radius: 999px; font: 600 .88rem var(--font-body); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--ink); color: #fff; }

.toast { position: fixed; top: 1rem; inset-inline: 1rem; margin: 0 auto; max-width: 520px; z-index: 60; background: var(--ink); color: #fff; padding: .85rem 1rem; border-radius: 14px; box-shadow: var(--shadow); }
.toast.error { background: var(--coral); }

.pay-card { border: 2px solid var(--ink); border-radius: var(--radius); padding: 1rem; background: var(--surface); }
.pay-card .amount { font-family: "Space Grotesk", sans-serif; font-size: 2rem; font-weight: 700; }

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.center-page .card { max-width: 440px; width: 100%; text-align: center; }

/* ===================== ADMIN ===================== */
.a-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.a-side { background: var(--ink); color: #fff; padding: 1.25rem 1rem; position: sticky; top: 0; height: 100vh; overflow: auto; display: flex; flex-direction: column; }
.a-side .brand-mark { background: var(--lime); color: var(--ink); }
.a-side nav { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 2px; }
.a-side nav a { text-decoration: none; color: #cfcac0; padding: .6rem .8rem; border-radius: 10px; font-weight: 500; display: flex; justify-content: space-between; align-items: center; }
.a-side nav a:hover { background: #262624; color: #fff; }
.a-side nav a.on { background: #fff; color: var(--ink); }
.a-side nav .sep { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: #77736b; margin: 1rem .8rem .3rem; }
.a-side .who { margin-top: auto; font-size: .85rem; color: #a7a298; padding-top: 1rem; border-top: 1px solid #2c2c2a; }
.a-main { padding: 1.5rem 2rem 4rem; min-width: 0; }
.a-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.a-head h1 { font-size: 1.8rem; margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.kpi .k { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .v { font-family: "Space Grotesk", sans-serif; font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; }
.kpi.lime { background: var(--lime); border-color: var(--lime); }
.kpi.lime .k { color: var(--lime-ink); }
.kpi.coral { background: var(--coral-soft); border-color: #ffc9c0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th { text-align: start; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .55rem .6rem; border-bottom: 1px solid var(--line); }
td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.inline-form { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input, .inline-form select { width: auto; min-height: 36px; padding: .35rem .6rem; }
.status { font-weight: 600; }
.printer-box { display: flex; align-items: center; gap: .8rem; }
.printer-box .dot { width: .8rem; height: .8rem; }
.state-ok { color: var(--ok); } .state-bad { color: var(--coral); } .state-warn { color: var(--warn); }
details summary { cursor: pointer; font-weight: 600; }
.ticket-page { background: #fff; }
.ticket { width: 76mm; margin: 0 auto; padding: 4mm 2mm; text-align: center; font-family: "Space Grotesk", sans-serif; color: #000; }
.ticket img { width: 60mm; height: 60mm; image-rendering: pixelated; }
.ticket .code { font-size: 20pt; font-weight: 700; letter-spacing: .04em; }
.ticket .ar { font-family: "IBM Plex Sans Arabic", sans-serif; direction: rtl; }
@media print { .no-print { display: none !important; } body { background: #fff; } @page { margin: 0; } }

@media (max-width: 860px) {
  .a-shell { grid-template-columns: 1fr; }
  .a-side { position: static; height: auto; }
  .a-side nav { flex-direction: row; flex-wrap: wrap; }
  .a-side nav .sep { display: none; }
  .a-main { padding: 1rem; }
}
.left { text-align: start; }
.narrow { max-width: 480px; }
.wide-input { min-width: 12rem; }
.break { overflow-wrap: anywhere; }
.a-side .btn.link { color: #cfcac0; }
.a-side a { color: #cfcac0; }

/* permanent-QR booking entry */
.entry-top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.entry h1 { font-size: 1.55rem; line-height: 1.2; margin: .5rem 0 0; }
.entry-form { text-align: start; }
.entry-form label { display: block; font-weight: 600; margin-bottom: .35rem; }
.entry-form input { width: 100%; font-size: 1.1rem; letter-spacing: .02em; }
