/* صِلة — styles.

   Written right-to-left first: every horizontal rule uses logical properties
   (inline-start / inline-end), so the same sheet lays out English correctly
   when the page flips to dir="ltr", and no rule says "left" or "right". */

@font-face {
  font-family: 'Plex Arabic';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(/vendor/fonts/plex-arabic-arabic-400.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-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: 'Plex Arabic';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url(/vendor/fonts/plex-arabic-arabic-600.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-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: 'Plex Arabic';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(/vendor/fonts/plex-arabic-latin-400.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;
}
@font-face {
  font-family: 'Plex Arabic';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url(/vendor/fonts/plex-arabic-latin-600.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;
}

/* Every colour is defined on bare :root and redefined in the dark block, so
   nothing is left undefined in either theme. */
:root {
  --bg: #f6f3ec;
  --card: #ffffff;
  --ink: #1c1b19;
  --muted: #5e5a52;
  --line: #e4ded2;
  --line-strong: #d6cebe;
  --accent: #0e6b5a;
  --accent-hover: #0a5446;
  --accent-ink: #ffffff;
  --accent-soft: #dcede7;
  --sand: #efeae0;
  --warm-soft: #f8e6d8;
  --warm-line: #e3bfa3;
  --warm-ink: #6b3a15;
  --bad: #b3261e;
  --chip-on: #1c1b19;
  --chip-on-ink: #ffffff;
  --shadow: 0 1px 2px rgba(28, 27, 25, .06), 0 8px 24px rgba(28, 27, 25, .06);
  --r: 16px;
  --font: 'Plex Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --card: #1f1d1a;
    --ink: #ede8df;
    --muted: #aaa396;
    --line: #34302a;
    --line-strong: #4a443b;
    --accent: #4fb89c;
    --accent-hover: #6cc9b0;
    --accent-ink: #0b1f1a;
    --accent-soft: #1e3a33;
    --sand: #2a2723;
    --warm-soft: #3a2a1e;
    --warm-line: #5c4330;
    --warm-ink: #f0c9a8;
    --bad: #ff8a80;
    --chip-on: #ede8df;
    --chip-on-ink: #151412;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
/* A class selector outranks the UA stylesheet's own `[hidden] { display: none }`,
   and several rules below set `display`. Without this, `el.hidden = true`
   leaves the element on the page — in vault that meant the unlocked vault
   rendering straight through its lock screen. */
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 560px; margin: 0 auto; padding: 14px 16px 0;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-height: 44px; }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 22px; font-weight: 600; }
.lang-btn {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--card); cursor: pointer; font-weight: 600; font-size: 15px;
}

/* ---------- layout ---------- */
.layout { max-width: 560px; margin: 0 auto; padding: 8px 16px 40px; }
.view { display: flex; flex-direction: column; gap: 18px; padding-top: 12px; }
.head { display: flex; flex-direction: column; gap: 6px; }
.row-head { flex-direction: row; align-items: center; gap: 6px; margin-inline-start: -8px; }
.center { text-align: center; align-items: center; }
.title { margin: 0; font-size: 30px; line-height: 1.2; font-weight: 600; }
.title-sm { font-size: 24px; }
.lede { margin: 0; font-size: 17px; color: var(--muted); }
.sub { margin: 0; font-size: 14px; color: var(--muted); }
.status { color: var(--muted); padding: 40px 0; }
.grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.label { font-size: 14px; font-weight: 600; color: var(--muted); }
.section { margin: 6px 0 -6px; }
.optional { font-weight: 400; }
.empty { margin: 0; padding: 18px; border-radius: var(--r); background: var(--sand); color: var(--muted); }

/* ---------- fields ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.input {
  height: 52px; border-radius: 14px; border: 1px solid var(--line-strong); padding: 0 16px;
  background: var(--card); font-size: 17px; width: 100%;
}
.ltr-input { text-align: start; }
[dir="rtl"] .ltr-input { text-align: end; }
.input:focus, .slug-input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
select.input { padding: 0 12px; }
.slug-box {
  display: flex; align-items: center; height: 52px; border-radius: 14px; border: 1px solid var(--line-strong);
  background: var(--card); padding: 0 14px; overflow: hidden;
}
.slug-box:focus-within { border-color: var(--accent); outline: 3px solid var(--accent-soft); }
.slug-prefix { color: var(--muted); font-size: 16px; white-space: nowrap; }
.slug-input {
  flex: 1 1 auto; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 17px;
  font-weight: 600; color: var(--accent); padding: 0; outline: none;
}
.slug-input:disabled { color: var(--ink); }
.hint { margin: 0; font-size: 14px; color: var(--muted); min-height: 1.5em; }
.hint.good { color: var(--accent); font-weight: 600; }
.hint.warn { color: var(--warm-ink); font-weight: 600; }
.error {
  margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--warm-soft);
  color: var(--warm-ink); font-size: 15px; font-weight: 600;
}

/* ---------- buttons ---------- */
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions.sticky {
  position: sticky; bottom: 0; padding: 12px 0 16px; margin-bottom: -16px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.btn, .btn2 {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 20px; border-radius: 14px; font-size: 17px; font-weight: 600;
  text-decoration: none; cursor: pointer; text-align: center;
}
.btn { border: 0; background: var(--accent); color: var(--accent-ink); }
.btn:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn2 { border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); }
.btn2:hover { background: var(--sand); color: var(--ink); }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 15px; border-radius: 12px; }
.txt-btn {
  min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--accent);
  font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
}
.txt-btn.danger { color: var(--bad); }
.txt-btn.armed { background: var(--bad); color: #fff; border-radius: 10px; padding: 0 12px; }
.btn-danger {
  min-height: 44px; border: 0; background: transparent; color: var(--bad); font-weight: 600; cursor: pointer;
}
.btn-danger.armed { background: var(--bad); color: #fff; border-radius: 12px; }
.icon-btn {
  width: 44px; height: 44px; flex: none; border: 0; background: transparent; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
/* A back arrow points the way the reader came from: right in Arabic. */
[dir="rtl"] .flip { transform: scaleX(-1); }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px;
}
.link-text { font-weight: 600; font-size: 17px; word-break: break-all; text-align: start; }
.notice {
  display: flex; align-items: center; gap: 10px; background: var(--sand); border-radius: 14px;
  padding: 8px 8px 8px 14px; padding-inline: 14px 8px; font-size: 14px; line-height: 1.45;
}
.notice > span:first-child, .notice .grow { flex: 1 1 auto; }
.done-mark {
  width: 80px; height: 80px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; margin-bottom: 6px;
}
.done-mark.solid { background: var(--accent); color: var(--accent-ink); }
.avatar {
  width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--warm-soft); color: var(--warm-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px;
}
.host-head { flex-direction: row; align-items: center; gap: 14px; }
.host-head .avatar { width: 56px; height: 56px; font-size: 22px; }
.when-card { flex-direction: column; align-items: flex-start; gap: 2px; }
.when-big { font-size: 28px; font-weight: 600; line-height: 1.25; }
.divided { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 8px; width: 100%; }
.info-card .info-icon {
  width: 40px; height: 40px; flex: none; border-radius: 12px; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.ok-card { align-items: flex-start; }
.ok-card .grow span { font-size: 15px; }
.cal-box {
  width: 58px; flex: none; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); text-align: center;
  display: flex; flex-direction: column;
}
.cal-box span { background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; padding: 3px 2px; }
.cal-box strong { font-size: 24px; padding: 4px 0 6px; }
.join-link { font-weight: 600; font-size: 15px; word-break: break-all; min-height: 36px; display: inline-flex; align-items: center; }

/* ---------- chips ---------- */
.chips, .fills { display: flex; flex-wrap: wrap; gap: 8px; }
.fills { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
.fills::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); font-size: 15px;
  font-weight: 600; cursor: pointer; white-space: nowrap; flex: none;
}
.chip.on { background: var(--chip-on); border-color: var(--chip-on); color: var(--chip-on-ink); }
.chip.slot { min-width: 88px; border-radius: 12px; font-variant-numeric: tabular-nums; }
.chip.slot.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.more { border-style: dashed; color: var(--muted); }

/* ---------- week tabs and grid ---------- */
.tabs {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px;
  background: var(--sand); border-radius: 14px;
}
.tab {
  min-height: 52px; border: 0; border-radius: 11px; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--muted);
}
.tab.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tab-name { font-size: 15px; font-weight: 600; }
.tab-dates { font-size: 12px; }
.grid { display: flex; flex-direction: column; gap: 6px; }
.grow-row { display: grid; grid-template-columns: 78px repeat(4, minmax(0, 1fr)); gap: 6px; align-items: center; }
.head-row { align-items: end; }
.part-head { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.part-name { font-size: 13px; font-weight: 600; }
.part-hours { font-size: 12px; color: var(--muted); }
.day-label { display: flex; flex-direction: column; line-height: 1.2; }
.day-wd { font-size: 14px; font-weight: 600; }
.day-num { font-size: 12px; color: var(--muted); }
.past-day .day-label { opacity: .55; }
.today .day-wd { color: var(--accent); }
.cell {
  height: 46px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card);
  display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; color: var(--muted);
}
.cell.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cell.past { background: var(--sand); border-style: dashed; cursor: default; }
.cell.booked { background: var(--warm-soft); border-color: var(--warm-line); color: var(--warm-ink); cursor: default; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.sw-free { background: var(--accent); }
.sw-booked { background: var(--warm-soft); border: 1px solid var(--warm-line); }
.sw-past { background: var(--sand); border: 1px dashed var(--line-strong); }

/* ---------- bookings list ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.booking {
  display: flex; gap: 12px; align-items: flex-start; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px;
}
.bk-name { display: flex; align-items: center; gap: 8px; }
.bk-who { font-size: 17px; }
.bk-when { font-size: 16px; font-weight: 600; color: var(--accent); }
.bk-note { font-size: 15px; color: var(--muted); }
/* Arabic quotes its guillemets; English its curly quotes. */
:lang(ar) q { quotes: '«' '»'; }
.bk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; }
.badge { font-size: 12px; font-weight: 600; color: var(--warm-ink); background: var(--warm-soft); border-radius: 999px; padding: 1px 8px; }

/* ---------- booking page ---------- */
.days { display: flex; flex-direction: column; }
.day { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.day-title { margin: 0; font-size: 17px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; }
.pick-bar {
  position: sticky; bottom: 0; margin: 0 -16px -40px; padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, .05);
}
.pick-text { display: flex; flex-direction: column; gap: 1px; }
.pick-main { font-size: 16px; font-weight: 600; }

/* ---------- toast ---------- */
.toast {
  position: fixed; inset-inline: 16px; bottom: 24px; margin: 0 auto; max-width: 480px;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; font-weight: 600;
  box-shadow: var(--shadow); z-index: 10; text-align: center;
}

@media (min-width: 700px) {
  .layout { padding-top: 24px; }
  .title { font-size: 34px; }
}
