@import url("/fonts/fonts.css");

/* Tokens. Brand colours (--ink, --paper, --accent…) come from brand.js through <style id="brand">;
   everything else is derived here. Light from straight above (x = 0), so nothing flips in RTL. */
:root {
  --font-body: "Inter", "Plex Arabic", system-ui, sans-serif;
  --font-display: "Inter", "Display AR", "Plex Arabic", sans-serif;

  --sand-0: #ffffff; --sand-1: var(--paper); --sand-2: #efe7da; --sand-3: #e6dccd;
  --text-1: var(--ink); --text-2: #4a4137; --text-3: #6e655a;
  --line-a: #00000012; --line-b: #0000001f;
  --brand-3: #f6e3d9; --brand-9: var(--accent); --brand-10: #9c4324; --brand-11: #9c4324; --brand-on-dark: #f0a27f;
  --ok-fg: var(--leaf); --ok-bg: #e4f2ea;
  --needs-fg: #b45309; --needs-bg: #fef3c7;
  --error-fg: #c62828; --error-bg: #fdecec;

  --ink-0: #161412; --ink-1: #211e1a; --ink-2: #2c2823; --ink-3: #37322b; --ink-4: #433d35;
  --ink-line: #ffffff0d; --ink-line-2: #ffffff14; --ink-line-3: #ffffff1f;
  --ink-text-1: #f7f2ea; --ink-text-2: #d6ccbd; --ink-text-3: #a89c8c;

  --r-control: 8px; --r-card: 12px; --r-card-web: 20px; --r-shot: 16px; --r-pill: 9999px;

  --shadow-color: 30 20% 12%;
  --ring: 0 0 0 1px hsl(var(--shadow-color) / .08);
  --e-card: var(--ring), 0 1px 2px hsl(var(--shadow-color) / .05), 0 4px 12px -2px hsl(var(--shadow-color) / .06);
  --e-float: 0 0 0 1px hsl(var(--shadow-color) / .05), 0 1px 1px -.5px hsl(var(--shadow-color) / .05),
    0 3px 3px -1.5px hsl(var(--shadow-color) / .05), 0 6px 6px -3px hsl(var(--shadow-color) / .05),
    0 12px 12px -6px hsl(var(--shadow-color) / .05), 0 24px 24px -12px hsl(var(--shadow-color) / .05);
  --e-pop: var(--ring), 0 7px 24px hsl(var(--shadow-color) / .10);
  --e-dark-card: inset 0 1px 0 #ffffff14, 0 0 0 1px #ffffff0d, 0 8px 24px #0006;
  --e-dark-shot: 0 0 0 1px #ffffff1a, inset 0 1px #ffffff26, 0 30px 60px -10px #000a, 0 18px 40px #0005;

  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --t-fast: 100ms; --t-menu: 180ms; --t-panel: 250ms;

  /* old names the pages still use */
  --card: var(--sand-0);
  --ink-2: var(--text-2);
  --accent-soft: var(--brand-3);
  --leaf-soft: var(--brand-3);
  --warn: var(--needs-fg); --warn-soft: var(--needs-bg);
  --danger: var(--error-fg); --danger-soft: var(--error-bg);
  --wa: #25d366;
  --radius: var(--r-card);
  --shadow: var(--e-card);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 400 14px/22px var(--font-body);
  background: var(--sand-1);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:lang(ar) { letter-spacing: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, .display { font-family: var(--font-display); font-weight: 700; line-height: 1.35; }
.num, .price, td.n { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.muted { color: var(--text-3); }
.small { font-size: 13px; line-height: 20px; }
bdi { unicode-bidi: isolate; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--r-control); height: 38px; padding: 0 16px; font-weight: 600; font-size: 14px; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast) ease, box-shadow var(--t-fast) ease, transform var(--t-fast) ease, opacity var(--t-fast);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-accent { background: var(--brand-9); color: #fff; }
.btn-accent:hover { background: var(--brand-10); }
.btn-ink { background: var(--text-1); color: #fff; }
.btn-ink:hover { background: #2c2823; }
.btn-ghost { background: var(--sand-0); box-shadow: var(--ring), 0 1px 2px hsl(var(--shadow-color) / .05); }
.btn-ghost:hover { background: var(--sand-2); }
.btn-danger { background: transparent; color: var(--error-fg); box-shadow: 0 0 0 1px var(--error-bg); }
.btn-danger:hover { background: var(--error-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: 10px; }

.logo { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 800; font-size: 21px; text-decoration: none; white-space: nowrap; }
.logo-mark { width: 30px; height: 30px; flex: none; }
.logo-img { height: 40px; width: auto; display: block; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-weight: 500; font-size: 13px; color: var(--text-2); }
.field > small { color: var(--text-3); font-size: 12.5px; margin-top: -2px; }
.input, select.input, textarea.input {
  width: 100%; border: 0; background: var(--sand-0); border-radius: var(--r-control); padding: 9px 12px; outline: none; font-size: 16px; line-height: 24px;
  box-shadow: inset 0 0 0 1px var(--line-b), 0 1px 2px hsl(var(--shadow-color) / .04);
  transition: box-shadow var(--t-fast);
}
.input:focus { box-shadow: inset 0 0 0 1px var(--brand-9), 0 0 0 3px var(--brand-3); }
textarea.input { resize: vertical; min-height: 88px; }
@media (min-width: 821px) { .input, select.input, textarea.input { font-size: 14px; line-height: 22px; } }

.card { background: var(--sand-0); border-radius: var(--r-card); padding: 18px; box-shadow: var(--e-card); }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; line-height: 18px; font-weight: 600; padding: 1px 8px; border-radius: var(--r-pill); white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.tag.no-dot::before { display: none; }
.tag-ok { background: var(--ok-bg); color: var(--ok-fg); }
.tag-warn { background: var(--needs-bg); color: var(--needs-fg); }
.tag-bad { background: var(--error-bg); color: var(--error-fg); }
.tag-accent { background: var(--brand-3); color: var(--brand-11); }
.tag-plain { background: var(--sand-2); color: var(--text-2); }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink-3); color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 100; font-size: 14px; box-shadow: var(--e-dark-card); max-width: calc(100% - 32px);
  animation: toast-in var(--t-panel) var(--ease-out);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: opacity .2s !important; } }
