@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/cairo-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}

@font-face {
  font-family: "Cairo";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/cairo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: "Cairo", "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, monospace;

  --white: #ffffff;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #475569;
  --ink-4: #64748b;

  --brand: #059669;
  --brand-hover: #047857;
  --brand-active: #065f46;
  --brand-soft: #ecfdf5;
  --brand-tint: #d1fae5;
  --brand-ink: #065f46;
  --on-brand: #ffffff;

  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-tint: #fde68a;
  --amber-ink: #92400e;

  --red: #dc2626;
  --red-hover: #b91c1c;
  --red-soft: #fef2f2;
  --red-tint: #fecaca;
  --red-ink: #991b1b;

  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --blue-tint: #bfdbfe;
  --blue-ink: #1e40af;

  --gray-soft: #f1f5f9;
  --gray-ink: #334155;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-brand: 0 6px 18px rgba(5, 150, 105, 0.28);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --ring: 0 0 0 3px rgba(5, 150, 105, 0.35);
  --ring-offset: 0 0 0 2px #ffffff, 0 0 0 4px #059669;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 160ms;
  --header-h: 64px;
  --container: 1200px;
  --z-header: 50;
  --z-modal: 100;
  --z-toast: 200;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  line-height: 1.35;
  font-weight: 800;
  color: var(--ink);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: var(--brand-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }
table { border-collapse: collapse; width: 100%; }
[hidden] { display: none !important; }
[dir="ltr"], .ltr { direction: ltr; unicode-bidi: isolate; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }

::selection { background: var(--brand-tint); color: var(--brand-active); }

:focus { outline: none; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-xs); }

.skip-link {
  position: absolute;
  inset-block-start: -100px;
  inset-inline-start: var(--space-4);
  z-index: 999;
  background: var(--ink);
  color: var(--white);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { inset-block-start: var(--space-3); color: var(--white); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}
.container-sm { max-width: 720px; }
.container-md { max-width: 960px; }
.container-fluid { max-width: none; }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-1 { gap: var(--space-1); }
.stack-2 { gap: var(--space-2); }
.stack-3 { gap: var(--space-3); }
.stack-4 { gap: var(--space-4); }
.stack-5 { gap: var(--space-5); }
.stack-6 { gap: var(--space-6); }
.stack-8 { gap: var(--space-8); }

.row { display: flex; flex-direction: row; align-items: center; gap: var(--space-3); }
.row-wrap { flex-wrap: wrap; }
.row-1 { gap: var(--space-1); }
.row-2 { gap: var(--space-2); }
.row-3 { gap: var(--space-3); }
.row-4 { gap: var(--space-4); }
.row-6 { gap: var(--space-6); }
.row-start { align-items: flex-start; }
.row-end { align-items: flex-end; }
.between { justify-content: space-between; }
.center { justify-content: center; }
.end { justify-content: flex-end; }
.grow { flex: 1 1 0; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.wrap { flex-wrap: wrap; }

.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

@media (max-width: 960px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .container { padding-inline: var(--space-4); }
  h1 { font-size: var(--text-2xl); }
  h2 { font-size: var(--text-xl); }
}

.text-center { text-align: center; }
.text-start { text-align: start; }
.text-end { text-align: end; }
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.fw-400 { font-weight: 400; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.muted { color: var(--ink-3); }
.subtle { color: var(--ink-4); }
.text-ink { color: var(--ink); }
.text-brand { color: var(--brand-ink); }
.text-danger { color: var(--red-ink); }
.text-warning { color: var(--amber-ink); }
.text-info { color: var(--blue-ink); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.mt-2 { margin-block-start: var(--space-2); }
.mt-4 { margin-block-start: var(--space-4); }
.mt-6 { margin-block-start: var(--space-6); }
.mt-8 { margin-block-start: var(--space-8); }
.mb-2 { margin-block-end: var(--space-2); }
.mb-4 { margin-block-end: var(--space-4); }
.mb-6 { margin-block-end: var(--space-6); }
.mx-auto { margin-inline: auto; }
.ms-auto { margin-inline-start: auto; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.block { display: block; }

@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .stack-sm { flex-direction: column; align-items: stretch; }
}
@media (min-width: 641px) {
  .show-sm-only { display: none !important; }
}

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--border-strong);
  --btn-bg-hover: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1.2;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), color var(--dur) var(--ease);
  position: relative;
}
.btn:hover { background: var(--btn-bg-hover); color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring-offset); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; box-shadow: none; }
.btn svg { width: 1.15em; height: 1.15em; flex-shrink: 0; }
.btn i[class*="fa-"] { font-size: 1em; line-height: 1; flex-shrink: 0; }

.btn-primary {
  --btn-bg: var(--brand);
  --btn-fg: var(--on-brand);
  --btn-bd: var(--brand);
  --btn-bg-hover: var(--brand-hover);
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { border-color: var(--brand-hover); }
.btn-primary:active { background: var(--brand-active); }

.btn-secondary {
  --btn-bg: var(--brand-soft);
  --btn-fg: var(--brand-ink);
  --btn-bd: var(--brand-tint);
  --btn-bg-hover: var(--brand-tint);
  box-shadow: none;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink-2);
  --btn-bd: transparent;
  --btn-bg-hover: var(--surface-2);
  box-shadow: none;
}

.btn-danger {
  --btn-bg: var(--red);
  --btn-fg: var(--white);
  --btn-bd: var(--red);
  --btn-bg-hover: var(--red-hover);
  box-shadow: none;
}

.btn-danger-soft {
  --btn-bg: var(--red-soft);
  --btn-fg: var(--red-ink);
  --btn-bd: var(--red-tint);
  --btn-bg-hover: var(--red-tint);
  box-shadow: none;
}

.btn-warning {
  --btn-bg: var(--amber-soft);
  --btn-fg: var(--amber-ink);
  --btn-bd: var(--amber-tint);
  --btn-bg-hover: var(--amber-tint);
  box-shadow: none;
}

.btn-sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { min-height: 54px; padding: 0 var(--space-8); font-size: var(--text-lg); border-radius: var(--radius-lg); }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }
.btn-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--brand-ink);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.btn-link:hover { color: var(--brand-hover); }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.2em;
  height: 1.2em;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-inline-end-color: transparent;
  color: var(--btn-fg);
  animation: spin 0.7s linear infinite;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after, .btn.is-loading:not(.btn-primary):not(.btn-danger)::after { color: var(--ink-3); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}
.card-flat { box-shadow: none; }
.card-sm { padding: var(--space-4); border-radius: var(--radius); }
.card-lg { padding: var(--space-8); border-radius: var(--radius-xl); }
.card-hover { transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.card-hover:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); }
.card-brand { background: var(--brand-soft); border-color: var(--brand-tint); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-block-end: var(--space-4); }
.card-title { font-size: var(--text-lg); font-weight: 800; }

.field { display: flex; flex-direction: column; gap: var(--space-2); }
.label { font-size: var(--text-sm); font-weight: 700; color: var(--ink-2); }
.label .req { color: var(--red); margin-inline-start: 2px; }
.hint { font-size: var(--text-xs); color: var(--ink-3); }
.field-error { font-size: var(--text-sm); color: var(--red-ink); font-weight: 600; display: none; }
.field.has-error .field-error, .field-error:not(:empty) { display: block; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--red); background: var(--red-soft); }

.input, .select, .textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 0 var(--space-4);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
  appearance: none;
  -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-4); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input:disabled, .select:disabled, .textarea:disabled { background: var(--surface-2); color: var(--ink-4); cursor: not-allowed; }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--red); background: var(--red-soft); }
.textarea { padding-block: var(--space-3); min-height: 96px; resize: vertical; line-height: 1.6; }
.select {
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  background-size: 16px;
  cursor: pointer;
}
.select-sm, .input-sm { min-height: 38px; font-size: var(--text-sm); border-radius: var(--radius-sm); }
.input-lg { min-height: 56px; font-size: var(--text-xl); border-radius: var(--radius-lg); }
.input-code { font-family: var(--mono); letter-spacing: 0.1em; text-align: center; direction: ltr; }
.input-group { display: flex; gap: var(--space-2); }
.input-group .input { flex: 1; min-width: 0; }

.check { display: flex; align-items: flex-start; gap: var(--space-3); cursor: pointer; font-size: var(--text-sm); color: var(--ink-2); }
.check input {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  display: grid;
  place-content: center;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.check input::after {
  content: "";
  width: 12px;
  height: 7px;
  border-inline-start: 2.5px solid #fff;
  border-block-end: 2.5px solid #fff;
  transform: rotate(-45deg) scale(0);
  margin-block-start: -2px;
  transition: transform var(--dur) var(--ease);
}
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after { transform: rotate(-45deg) scale(1); }
.check input:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.switch { position: relative; display: inline-flex; width: 48px; height: 28px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch-track { position: absolute; inset: 0; background: var(--border-strong); border-radius: var(--radius-full); transition: background-color var(--dur) var(--ease); }
.switch-track::after {
  content: "";
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  width: 22px;
  height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(-20px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--brand); outline-offset: 2px; }

.segmented { display: inline-flex; padding: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); gap: 4px; }
.segmented button {
  min-height: 38px;
  padding: 0 var(--space-4);
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"], .segmented button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 0 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  color: var(--gray-ink);
  background: var(--gray-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}
.badge-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success, .badge-ready { color: var(--brand-ink); background: var(--brand-soft); border-color: var(--brand-tint); }
.badge-warning, .badge-waiting, .badge-preparing { color: var(--amber-ink); background: var(--amber-soft); border-color: var(--amber-tint); }
.badge-danger, .badge-cancelled { color: var(--red-ink); background: var(--red-soft); border-color: var(--red-tint); }
.badge-info, .badge-acknowledged { color: var(--blue-ink); background: var(--blue-soft); border-color: var(--blue-tint); }
.badge-neutral, .badge-completed { color: var(--gray-ink); background: var(--gray-soft); border-color: var(--border); }
.badge-lg { min-height: 32px; padding: 0 14px; font-size: var(--text-sm); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex-shrink: 0; }
.dot-success { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }
.dot-warning { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-tint); }
.dot-danger { background: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }
.dot-pulse { animation: pulse 1.6s ease-in-out infinite; }

.alert {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--text-sm);
  font-weight: 600;
}
.alert-success { background: var(--brand-soft); border-color: var(--brand-tint); color: var(--brand-ink); }
.alert-warning { background: var(--amber-soft); border-color: var(--amber-tint); color: var(--amber-ink); }
.alert-danger { background: var(--red-soft); border-color: var(--red-tint); color: var(--red-ink); }
.alert-info { background: var(--blue-soft); border-color: var(--blue-tint); color: var(--blue-ink); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  overflow-y: auto;
  animation: fade-in 160ms var(--ease);
}
.modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 32px);
  margin: auto;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: pop-in 200ms var(--ease);
}
.modal:focus { outline: none; }
.modal-sm { max-width: 400px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 960px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-6); border-block-end: 1px solid var(--border); }
.modal-title { font-size: var(--text-xl); font-weight: 800; }
.modal-body { padding: var(--space-6); overflow-y: auto; flex: 1 1 auto; -webkit-overflow-scrolling: touch; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-3); padding: var(--space-4) var(--space-6); border-block-start: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius-xl) var(--radius-xl); }
.modal-close { flex-shrink: 0; }
body.modal-open { overflow: hidden; }

@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; max-height: 92dvh; border-radius: var(--radius-xl) var(--radius-xl) 0 0; animation: sheet-in 240ms var(--ease); }
  .modal-footer { border-radius: 0; }
  .modal-footer .btn { flex: 1 1 auto; }
}

.toast-region {
  position: fixed;
  inset-block-end: var(--space-5);
  inset-inline: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: min(100%, 440px);
  padding: var(--space-3) var(--space-4);
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-sm);
  font-weight: 600;
  pointer-events: auto;
  border-inline-start: 4px solid var(--ink-4);
  animation: toast-in 240ms var(--ease);
}
.toast.is-leaving { animation: toast-out 200ms var(--ease) forwards; }
.toast-success { border-inline-start-color: #34d399; }
.toast-error { border-inline-start-color: #f87171; }
.toast-warning { border-inline-start-color: #fbbf24; }
.toast-info { border-inline-start-color: #60a5fa; }
.toast-message { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-close { flex-shrink: 0; width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; color: #cbd5e1; border-radius: var(--radius-xs); font-size: 20px; line-height: 1; }
.toast-close:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }

.tabs { display: flex; gap: var(--space-1); border-block-end: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 46px;
  padding: 0 var(--space-4);
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-weight: 700;
  white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab[aria-selected="true"], .tab.is-active { color: var(--brand-ink); }
.tab[aria-selected="true"]::after, .tab.is-active::after {
  content: "";
  position: absolute;
  inset-inline: var(--space-3);
  inset-block-end: -1px;
  height: 3px;
  background: var(--brand);
  border-radius: 3px 3px 0 0;
}
.tab-count { min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center; font-size: var(--text-xs); background: var(--surface-3); color: var(--ink-2); border-radius: var(--radius-full); }
.tab[aria-selected="true"] .tab-count { background: var(--brand); color: #fff; }
.tab-panel { padding-block-start: var(--space-4); }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table { font-size: var(--text-sm); }
.table th {
  padding: var(--space-3) var(--space-4);
  text-align: start;
  font-weight: 800;
  font-size: var(--text-xs);
  color: var(--ink-3);
  background: var(--surface-2);
  border-block-end: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: var(--space-3) var(--space-4); border-block-end: 1px solid var(--border); color: var(--ink-2); vertical-align: middle; }
.table tbody tr:last-child td { border-block-end: 0; }
.table tbody tr:hover td { background: var(--bg); }

.stat { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) var(--space-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.stat-label { font-size: var(--text-sm); font-weight: 600; color: var(--ink-3); }
.stat-value { font-size: var(--text-3xl); font-weight: 800; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-note { font-size: var(--text-xs); color: var(--ink-4); }
.stat-brand .stat-value { color: var(--brand-ink); }
.stat-warning .stat-value { color: var(--amber-ink); }
.stat-danger .stat-value { color: var(--red-ink); }

.meter { height: 10px; background: var(--surface-3); border-radius: var(--radius-full); overflow: hidden; }
.meter-bar { height: 100%; width: 0; background: var(--brand); border-radius: var(--radius-full); transition: width 400ms var(--ease); }
.meter-bar.is-warning { background: var(--amber); }
.meter-bar.is-danger { background: var(--red); }
.progress { width: 100%; height: 10px; appearance: none; -webkit-appearance: none; border: 0; border-radius: var(--radius-full); overflow: hidden; background: var(--surface-3); }
.progress::-webkit-progress-bar { background: var(--surface-3); }
.progress::-webkit-progress-value { background: var(--brand); border-radius: var(--radius-full); }
.progress::-moz-progress-bar { background: var(--brand); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-10) var(--space-5); text-align: center; color: var(--ink-3); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.empty-state-icon { width: 56px; height: 56px; display: grid; place-items: center; font-size: 28px; color: var(--ink-4); background: var(--surface-2); border-radius: 50%; }
.empty-state-title { font-size: var(--text-lg); font-weight: 800; color: var(--ink); }
.empty-state-text { font-size: var(--text-sm); max-width: 360px; }

.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--surface-3); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 44px; height: 44px; border-width: 4px; }
.loading-block { display: flex; align-items: center; justify-content: center; gap: var(--space-3); padding: var(--space-10); color: var(--ink-3); font-weight: 600; }

.kbd { display: inline-block; min-width: 24px; padding: 1px 7px; font-family: var(--mono); font-size: var(--text-xs); font-weight: 700; line-height: 1.6; text-align: center; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--border-strong); border-block-end-width: 2px; border-radius: var(--radius-xs); direction: ltr; }

.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: var(--radius-sm); min-height: 16px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent); transform: translateX(100%); animation: shimmer 1.4s infinite; }
.skeleton-text { height: 14px; width: 100%; }
.skeleton-title { height: 22px; width: 50%; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }

.divider { height: 1px; background: var(--border); border: 0; margin: var(--space-4) 0; }
.avatar { width: 40px; height: 40px; display: inline-grid; place-items: center; font-weight: 800; color: var(--brand-ink); background: var(--brand-tint); border-radius: 50%; flex-shrink: 0; }
.logo-mark { width: 40px; height: 40px; display: grid; place-items: center; font-size: var(--text-xl); font-weight: 800; color: #fff; background: linear-gradient(135deg, #10b981, #047857); border-radius: 12px; box-shadow: var(--shadow-brand); flex-shrink: 0; }
.brand { display: inline-flex; align-items: center; gap: var(--space-3); font-size: var(--text-xl); font-weight: 800; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }

.topbar { position: sticky; inset-block-start: 0; z-index: var(--z-header); background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-block-end: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--header-h); }

.qr-box { display: inline-grid; place-items: center; padding: var(--space-3); background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.qr-box svg, .qr-box canvas { display: block; width: 100%; height: auto; }

.logo-picker {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.logo-picker-preview {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-picker-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.logo-picker-placeholder {
  color: var(--ink-4);
  font-size: 1.35rem;
}

.rating { display: inline-flex; flex-direction: row-reverse; gap: var(--space-1); }
.rating button { width: 48px; height: 48px; display: grid; place-items: center; border: 0; background: transparent; font-size: 34px; line-height: 1; color: var(--border-strong); border-radius: var(--radius-sm); transition: color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.rating button:hover, .rating button:hover ~ button, .rating button.is-on, .rating button[aria-checked="true"], .rating button[aria-checked="true"] ~ button { color: #f59e0b; }
.rating button:active { transform: scale(0.92); }

.status-ready { color: var(--brand-ink); }
.status-preparing { color: var(--amber-ink); }

.visually-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }

.print-only { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes shimmer { to { transform: translateX(-100%); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.96); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .spinner, .btn.is-loading::after { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
}

@media (forced-colors: active) {
  .btn, .input, .select, .textarea, .card, .badge { border: 1px solid CanvasText; }
  .btn:focus-visible { outline: 3px solid Highlight; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; color: #000 !important; min-height: 0; }
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; inset-inline: 0; inset-block-start: 0; width: 100%; display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 8mm; text-align: center; padding: 10mm; }
  .print-area .qr-box { border: 2px solid #000; border-radius: 6mm; padding: 6mm; width: 120mm; }
  .print-title { font-size: 34pt; font-weight: 800; color: #000; }
  .print-sub { font-size: 18pt; color: #000; }
  .print-only { display: block; }
  .no-print, .toast-region, .modal-backdrop .modal-footer, .topbar { display: none !important; }
  .card { box-shadow: none; border-color: #000; }
}
