/* App shell: fixed top bar, then three full-height panels (برة / فوق / داخل) that each scroll on their own. */
  :root {
    --bg: #FFF4EA;
    --panel: #FBE9DC;
    --field: #FFFBF7;
    --card: #F5DAC6;
    --ink: #571D25;
    --muted: #8E6468;
    --line: #E3CABF;
    --line-soft: #EEDBD0;
    --danger: #B3261E;
    --accent: #C9822B;
    --called: #F0C77E;
    --called-soft: #FFF0D2;
    --scrim: rgba(40, 12, 16, .42);
    --shadow: 0 1px 2px rgba(87, 29, 37, .06), 0 6px 16px -8px rgba(87, 29, 37, .22);
    --ring: rgba(87, 29, 37, .16);
    --font-ui: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
    --logo-img: url("logo-admin.png");
    color-scheme: light;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #1E0E10; --panel: #2A1316; --field: #371B1F; --card: #47262B; --ink: #F3E1D5; --muted: #B99A98;
      --line: #55393C; --line-soft: #46292D; --danger: #FF8A80; --accent: #E3A857; --called: #7A5A23; --called-soft: #43301B;
      --scrim: rgba(0, 0, 0, .6); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 16px -8px rgba(0, 0, 0, .5); --ring: rgba(243, 225, 213, .22);
      color-scheme: dark;
    }
  }
  :root[data-theme="dark"] {
    --bg: #1E0E10; --panel: #2A1316; --field: #371B1F; --card: #47262B; --ink: #F3E1D5; --muted: #B99A98;
    --line: #55393C; --line-soft: #46292D; --danger: #FF8A80; --accent: #E3A857; --called: #7A5A23; --called-soft: #43301B;
    --scrim: rgba(0, 0, 0, .6); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 16px -8px rgba(0, 0, 0, .5); --ring: rgba(243, 225, 213, .22);
    color-scheme: dark;
  }

  [hidden] { display: none !important; }
  * { box-sizing: border-box; }
  html, body { height: 100%; }
  html { -webkit-text-size-adjust: 100%; }
  body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-ui); font-size: 15px; line-height: 1.5; overflow: hidden; -webkit-tap-highlight-color: transparent; }
  button, input, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; -webkit-appearance: none; appearance: none; touch-action: manipulation; }
  :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

  /* Scrollbars: thin, rounded, quiet; scrolling stays inside each panel/sheet. */
  .col, .sheet, .gate {
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  * { scrollbar-width: none; -ms-overflow-style: none; }
  *::-webkit-scrollbar { display: none; width: 0; height: 0; }
  .col::-webkit-scrollbar, .sheet::-webkit-scrollbar, .gate::-webkit-scrollbar { width: 0; }
  .col::-webkit-scrollbar-track, .sheet::-webkit-scrollbar-track, .gate::-webkit-scrollbar-track { background: transparent; }
  .col::-webkit-scrollbar-thumb, .sheet::-webkit-scrollbar-thumb, .gate::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }
  .col::-webkit-scrollbar-thumb:hover { background: var(--muted); }

  #app { height: 100%; height: 100dvh; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }

  /* ---- Top bar ---- */
  .bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--bg); }
  .logo { flex: none; height: 38px; aspect-ratio: 1.7910; margin-inline: 4px 8px; font-size: 0; background: var(--ink); -webkit-mask: var(--logo-img) center / contain no-repeat; mask: var(--logo-img) center / contain no-repeat; }
  .new { flex: none; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; white-space: nowrap; border: 0; border-radius: 14px; padding: 0 18px 0 22px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 16px; }
  .new .plus { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .2); font-size: 20px; line-height: 1; font-weight: 500; }
  .tabs { flex: none; display: flex; align-items: center; gap: 4px; }
  .tab { height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; border: 0; border-radius: 12px; padding: 0 16px; background: none; color: var(--muted); font-size: 16px; font-weight: 600; }
  .tab.on { background: var(--panel); color: var(--ink); }
  .tab b { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--panel); color: var(--ink); font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
  .tab.on b { background: var(--ink); color: var(--bg); }
  .search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 520px; height: 44px; display: flex; align-items: center; margin-inline: 4px; }
  .search .cc { position: absolute; inset-block: 0; inset-inline-start: 12px; display: flex; align-items: center; gap: 7px; direction: ltr; font-size: 14px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; pointer-events: none; }
  .search .cc i { width: 14px; height: 14px; border-radius: 50%; background: #1E9E5A; }
  .search input { width: 100%; height: 44px; min-height: 0; margin: 0; padding: 0 84px 0 38px; font-size: 16px; background: var(--panel); border: 1px solid transparent; border-radius: 14px; color: var(--ink); direction: rtl; -webkit-appearance: none; appearance: none; }
  .search input::-webkit-search-cancel-button { display: none; }
  .search input::placeholder { color: var(--muted); font-size: 14px; }
  .search input:focus { outline: none; background: var(--field); border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
  .search-x { position: absolute; inset-block: 0; inset-inline-end: 4px; width: 32px; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); padding: 0; }
  .title { flex: none; margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
  .fs-btn { flex: none; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 14px; background: var(--panel); color: var(--ink); }
  .fs-btn svg { width: 22px; height: 22px; }

  /* ---- Panels ---- */
  .grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px; padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)); }
  .col { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; padding: 0 10px 18px; background: var(--panel); border-radius: 22px; }
  .col h2 { position: sticky; top: 0; z-index: 2; flex: none; margin: 0 -10px; padding: 10px 10px 6px; background: var(--panel); border-radius: 22px 22px 0 0; font-family: var(--font-ui); font-size: 20px; font-weight: 600; line-height: 1.2; }
  .col h2 .hd { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 52px; padding: 5px 16px; background: var(--card); border-radius: 16px; }
  .col h2 .ttl { text-align: center; }
  .col h2 small { justify-self: start; display: grid; grid-template-columns: auto auto; justify-content: start; column-gap: 10px; font-size: 20px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
  .col h2 small b { grid-column: 1 / -1; justify-self: center; font-weight: 600; }
  .col h2 small.none { visibility: hidden; }
  .col h2 small span { font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--muted); white-space: nowrap; }
  .col h2 .mn { justify-self: end; width: 22px; height: 16px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'%3E%3Cpath d='M1 2h20M1 8h20M1 14h20' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'%3E%3Cpath d='M1 2h20M1 8h20M1 14h20' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
  .list { display: flex; flex-direction: column; gap: 10px; }
  .empty { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 13px; }

  /* ---- Reservation cards ---- */
  .col { container-type: inline-size; }
  .card { position: relative; width: 100%; min-width: 0; display: grid; background: var(--field); border: 1px solid var(--line-soft); border-radius: 18px; text-align: start; box-shadow: var(--shadow); overflow: hidden; }
  /* After "تواصل" only the top strip of the card changes color */
  .card.called .top { padding-top: 0; background: var(--called); color: var(--ink); }
  .card.called .top .nt, .card.called .top .nt svg { color: var(--ink); }
  .card .top { display: flex; align-items: center; gap: 6px; min-width: 0; height: 34px; padding: 8px 12px 0; font-size: 15px; font-weight: 600; color: var(--accent); }
  .card .no { flex: none; font-variant-numeric: tabular-nums; }
  .card .tag { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card .nt { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 5px; color: var(--ink); }
  .card .nt svg { flex: none; width: 15px; height: 15px; color: var(--muted); }
  .card .nt span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card .body { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info party" "acts acts"; align-items: center; gap: 10px 0; padding: 6px 12px 12px; }
  .card .info { grid-area: info; min-width: 0; display: grid; gap: 4px; padding: 0; border: 0; background: none; text-align: start; color: var(--ink); }
  .card .n { min-width: 0; font-size: 17px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
  .card .p { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; line-height: 20px; color: var(--muted); }
  .card .p i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #1E9E5A; }
  .card .dist { flex: none; display: flex; align-items: center; gap: 4px; white-space: nowrap; unicode-bidi: isolate; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
  .card .dist svg { flex: none; width: 14px; height: 14px; }
  .card .dist.near, #d-dist.near { color: #1E9E5A; font-weight: 800; }
  .card .dist.mid, #d-dist.mid { color: #D98A0B; font-weight: 800; }
  .card .dist.far, #d-dist.far { color: #D64545; font-weight: 700; }
  .card .dist { transition: color .6s ease; }
  .card .p .ph { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
  .card .party { grid-area: party; align-self: stretch; display: grid; place-content: center; justify-items: center; gap: 2px; margin: 0; padding: 0 14px; border: 0; border-inline-start: 1px solid var(--line-soft); background: none; color: var(--ink); }
  .card .party .gn { display: flex; align-items: center; gap: 4px; font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
  .card .party svg { width: 20px; height: 20px; }
  .card .party small { font-size: 12px; font-weight: 500; color: var(--accent); }
  .card .acts { grid-area: acts; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .card .acts button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 6px; border: 0; border-radius: 12px; font-size: 15px; font-weight: 600; }
  .card .acts svg { flex: none; width: 16px; height: 16px; }
  .card .c-call { background: var(--card); color: var(--ink); }
  .card .c-done { background: var(--ink); color: var(--bg); }
  .card .foot { display: flex; align-items: center; gap: 12px; min-height: 36px; padding: 6px 12px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--muted); }
  .card .tm { display: flex; align-items: center; gap: 5px; font-weight: 500; font-variant-numeric: tabular-nums; direction: ltr; }
  .card .tm svg { flex: none; width: 15px; height: 15px; }
  .card .ct { display: flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 8px; background: var(--called); color: var(--ink); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr; }
  .card .ct svg { flex: none; width: 13px; height: 13px; }
  .card .ct .lim { font-weight: 400; opacity: .7; }
  /* Expandable options under the card: arrow centered in the footer, options as icon tile + label */
  .card .foot { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 6px; }
  .card .fl { display: flex; align-items: center; gap: 8px; min-width: 0; justify-self: start; }
  .card .fr { display: flex; align-items: center; min-width: 0; justify-self: end; }
  .card .top { position: relative; }
  .card .top .ct { position: absolute; left: 10px; top: 0; bottom: 0; margin: 0; padding: 0; background: none; }
  .card.called .top { padding-left: 100px; }
  @container (max-width: 170px) { .card.called .top { padding-left: 58px; } }
  .card .nti { flex: none; width: 24px; height: 24px; padding: 0; display: grid; place-items: center; border: 0; background: none; color: var(--accent); }
  .card .nti svg { width: 17px; height: 17px; }
  .card .tg { flex: none; width: 44px; height: 30px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--ink); }
  .card .tg svg { width: 16px; height: 16px; }
  .card .tg.open svg { transform: rotate(180deg); }
  .card .more { display: grid; gap: 10px; padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); }
  .card .m-notes { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--panel); color: var(--ink); font-size: 14px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
  .card .m-notes svg { flex: none; width: 16px; height: 16px; margin-top: 3px; color: var(--accent); }
  .card .more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 10px; }
  .card .mrow { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: start; text-decoration: none; cursor: pointer; }
  .card .mic { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--ink); color: var(--bg); }
  .card .mic svg { width: 21px; height: 21px; }
  .card .mic svg.noans { width: 26px; height: 26px; }   /* الهاتف بنفس حجم أيقونة الاتصال، والدائرة تحيط به */
  .card .ml { min-width: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
  .card .mrow.called .mic { background: var(--called); color: var(--ink); }
  .card .mrow.on .mic { background: var(--accent); }
  .card .msg-edit { min-height: 84px; }
  .card .msg-send { min-height: 42px; border: 0; border-radius: 12px; background: var(--ink); color: var(--bg); font: inherit; font-size: 15px; font-weight: 600; }
  .card .msg-send:disabled { opacity: .6; }
  .rlist { display: grid; gap: 10px; }
  .rlist button { min-height: 52px; border: 0; border-radius: 14px; background: var(--card); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600; }
  .rlist button:active { background: var(--danger); color: var(--bg); }
  .rname { margin: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
  .card .reasons { display: grid; gap: 8px; padding: 10px; border-radius: 12px; background: var(--panel); }
  .card .reasons .rt { font-size: 13px; font-weight: 600; color: var(--muted); }
  .card .reasons button { min-height: 42px; border: 0; border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; }
  .card .reasons button:active { background: var(--danger); color: var(--bg); }
  .card .mrow.cancel.on .mic { background: var(--danger); }
  .card .mrow.cancel.on .ml { color: var(--danger); }
  @container (max-width: 170px) { .card .more-grid { grid-template-columns: minmax(0, 1fr); } }
  @media (prefers-reduced-motion: no-preference) {
    .card .tg svg { transition: transform .18s ease; }
  }
  /* Wide column: info | party | buttons in one row, like a ticket */
  @container (min-width: 300px) {
    .card .body { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "info party acts"; gap: 0; }
    .card .acts { grid-template-columns: 1fr; width: 96px; padding-inline-start: 12px; border-inline-start: 1px solid var(--line-soft); }
  }
  /* Very narrow column: stack everything */
  @container (max-width: 170px) {
    .card .body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "info" "party" "acts"; gap: 8px; }
    .card .party { padding: 6px 0 0; border-inline-start: 0; border-top: 1px solid var(--line-soft); grid-auto-flow: column; justify-content: center; gap: 8px; }
    .card .party .gn { font-size: 20px; }
    .card .ct .lim { display: none; }
  }

  /* ---- Sheets ---- */
  .scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; }
  .sheet { width: 100%; max-width: 460px; max-height: 92dvh; background: var(--bg); border-radius: 26px 26px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 14px; align-content: start; box-shadow: 0 -10px 40px -12px rgba(0, 0, 0, .35); }
  @media (min-width: 600px) {
    .scrim { align-items: center; }
    .sheet { border-radius: 26px; padding-bottom: 18px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45); }
  }
  .sheet-head { display: flex; align-items: center; justify-content: space-between; }
  .sheet-head h3 { margin: 0; font-size: 18px; font-weight: 600; }
  .x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--panel); font-size: 20px; line-height: 1; padding: 0; display: grid; place-items: center; }
  .sheet-head .d-name { font-size: 21px; overflow-wrap: anywhere; }

  .d-meta { display: grid; gap: 4px; padding: 6px 14px; background: var(--panel); border-radius: 16px; }
  .d-row { display: flex; justify-content: space-between; gap: 12px; padding-block: 8px; font-size: 15px; }
  .d-row + .d-row { border-top: 1px solid var(--line-soft); }
  .d-row span { color: var(--muted); }
  .d-notes { flex-direction: column; gap: 4px; }
  .d-notes strong { font-weight: 400; white-space: pre-wrap; overflow-wrap: anywhere; }
  .d-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .btn-set, .btn-in { min-height: 50px; border-radius: 14px; border: 0; font-size: 16px; font-weight: 600; }
  .btn-set { background: var(--card); color: var(--ink); }
  .btn-set.on { background: var(--called); }
  .btn-in { background: var(--ink); color: var(--bg); }
  .d-status { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
  .d-timerbox { display: grid; justify-items: center; gap: 2px; padding-block: 8px; background: var(--panel); border-radius: 16px; }
  .d-timer { font-size: 38px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
  .d-timerbox small { color: var(--muted); font-size: 13px; }
  .link-btn { border: 0; background: none; color: var(--muted); font-size: 14px; text-decoration: underline; padding: 6px; }

  /* "تم" list */
  .dlist { display: grid; gap: 10px; }
  .drow { display: grid; gap: 8px; padding: 12px; background: var(--field); border: 1px solid var(--line-soft); border-radius: 16px; box-shadow: var(--shadow); }
  .drow .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .drow .dn { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; }
  .drow .dt { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; direction: rtl; }
  .drow .dp { font-size: 14px; color: var(--muted); direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
  .drow .dm { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
  .drow .dm span { padding: 1px 10px; border-radius: 999px; background: var(--card); }
  .drow .dm .st { font-weight: 600; }
  .drow .dm .st-entered { background: var(--ink); color: var(--bg); }
  .drow .dm .st-cancel { background: var(--danger); color: var(--bg); }
  .drow .dm .st-noanswer { background: var(--called); color: var(--ink); }
  .drow .dm .cause { background: var(--panel); }
  .drow .dm .st-expired { background: var(--called); color: var(--ink); }
  .drow .dnote { font-size: 13px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
  .drow .dbtns { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .drow .dbtns button { min-height: 40px; border-radius: 12px; border: 0; background: var(--card); font-size: 14px; font-weight: 600; }
  .drow .dbtns .restore { background: var(--ink); color: var(--bg); }
  .drow .dbtns .del { background: none; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--line); }

  /* ---- Phone: country dropdown + number ---- */
  .phone-row { display: flex; gap: 8px; }
  .phone-row input { flex: 1 1 auto; min-width: 0; }
  #f-cc {
    flex: none; width: 112px; min-height: 46px; padding: 8px 12px 8px 30px; font-size: 17px; color: var(--ink);
    background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238E6468' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat left 10px center / 12px;
    border: 1px solid var(--line); border-radius: 12px; -webkit-appearance: none; appearance: none; cursor: pointer;
  }
  #f-cc:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }

  /* ---- Add/edit sheet: side by side on wide screens ----
     Right column: phone, name, notes. Left column: area, booking type, guest count. */
  .fcol { display: grid; gap: 14px; align-content: start; min-width: 0; }
  @media (min-width: 700px), (orientation: landscape) {
    #form.sheet { max-width: 960px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; }
    #form .sheet-head, #form .actions { grid-column: 1 / -1; }
    #form .sheet-head { grid-row: 1; }
    #form .fcol-r { grid-column: 1; grid-row: 2; }
    #form .fcol-l { grid-column: 2; grid-row: 2; }
    #form .actions { grid-row: 3; }
    #form textarea { min-height: 110px; }
    @media (min-width: 600px) { .scrim:has(#form) { align-items: center; } }
  }


  .account-wrap{position:relative;display:flex;align-items:center}
  .account-btn{width:40px;height:40px;border:1px solid var(--line);border-radius:12px;background:var(--panel);color:var(--ink);display:grid;place-items:center}
  .account-btn svg{width:21px;height:21px}
  /* Profile: centered popup with switches */
  #account-menu.scrim { align-items: center; padding: 16px; }
  #account-menu .sheet { max-height: calc(100dvh - 32px); overflow-y: auto; -webkit-overflow-scrolling: touch; border-radius: 26px; max-width: 380px; padding-bottom: 18px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45); }
  .branch-label { margin: 0; color: var(--muted); font-size: 14px; }
  .sw-list { display: grid; gap: 10px; }
  .sw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 58px; padding: 0 16px; border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600; text-align: start; cursor: pointer; }
  .sw { position: relative; flex: none; width: 48px; height: 22px; border-radius: 999px; direction: ltr; background: color-mix(in srgb, var(--ink) 22%, var(--bg)); }
  .sw::after { content: ""; position: absolute; top: 50%; left: 22px; width: 28px; height: 28px; margin-top: -14px; border-radius: 50%; background: #F4F4F5; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
  .sw-row[aria-checked="true"] .sw::after { left: -2px; background: var(--ink); box-shadow: 0 0 0 4px var(--ring), 0 1px 4px rgba(0, 0, 0, .35); }
  @media (prefers-reduced-motion: no-preference) { .sw::after { transition: left .16s ease, background-color .16s ease; } }
  .sw-row:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
  #account-menu button.menu-fullscreen, #account-menu button.menu-action { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 50px; padding: 0 16px; border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; }
  #account-menu button.menu-action svg, #account-menu button.menu-fullscreen svg { width: 20px; height: 20px; flex: none; }
  .account-form{display:grid;gap:10px}
  .account-form input{width:100%;min-height:46px;padding:10px 13px;border:1px solid var(--line);border-radius:12px;background:var(--field);font:inherit;color:var(--ink)}
  .account-form .primary{min-height:48px;border:0;border-radius:12px;background:var(--ink);color:var(--bg);font:inherit;font-weight:600}
  .account-error{color:var(--danger);font-size:13px}

  /* ---- Toast ---- */
  .toast {
    position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 30;
    max-width: 440px; margin-inline: auto; padding: 13px 16px; border-radius: 16px;
    background: var(--ink); color: var(--bg); font-size: 14px; line-height: 1.5; text-align: center; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45);
  }
  .toast-btn { margin-inline-start: 12px; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }

  #cred-form { display: grid; gap: 12px; }
  .cred-tools { display: flex; justify-content: space-between; gap: 8px; }
  #cred-form input[type="text"], #cred-form input[type="password"] { direction: ltr; text-align: right; }
  .gate-box form { display: grid; gap: 12px; text-align: start; }
  .gate-box .btn-in { width: 100%; }
  /* ---- Password gate ---- */
  .gate { height: 100%; display: grid; place-items: center; padding: 24px 16px; }
  .gate-box { width: 100%; max-width: 340px; display: grid; gap: 14px; text-align: center; padding: 28px 22px; background: var(--panel); border-radius: 26px; }
  .gate-logo { height: 72px; aspect-ratio: 1.7910; font-size: 0; margin-inline: auto; background: var(--ink); -webkit-mask: var(--logo-img) center / contain no-repeat; mask: var(--logo-img) center / contain no-repeat; }
  .gate-box p { margin: 0; color: var(--muted); font-size: 14px; }

  /* ---- Forms ---- */
  label.f, .f-label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
  input[type="text"], input[type="tel"], input[type="time"], input[type="password"], textarea {
    width: 100%; min-height: 46px; padding: 8px 14px; font-size: 16px;
    background: var(--field); border: 1px solid var(--line); border-radius: 12px; color: var(--ink);
  }
  input[type="text"]:focus, input[type="tel"]:focus, input[type="time"]:focus, input[type="password"]:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
  textarea { resize: vertical; min-height: 68px; }
  .err { color: var(--danger); font-size: 13px; }
  input[aria-invalid="true"] { border-color: var(--danger); }

  .stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--field); min-height: 46px; }
  .stepper button { flex: none; width: 46px; align-self: stretch; border: 0; background: none; font-size: 20px; color: var(--ink); }
  .stepper output { flex: 1; text-align: center; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }

  .seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--field); }
  .seg input { position: absolute; opacity: 0; pointer-events: none; }
  .seg label { text-align: center; padding: 12px 4px; font-size: 15px; color: var(--ink); cursor: pointer; }
  .seg label + label { border-inline-start: 1px solid var(--line); }
  .seg input:checked + label { background: var(--ink); color: var(--bg); font-weight: 500; }
  .opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .opt { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 8px 6px; color: var(--ink); font-size: 15px; cursor: pointer; background: none; border: 0; border-radius: 12px; }
  .opt input { position: absolute; opacity: 0; pointer-events: none; }
  .dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; }
  .opt input:checked + .dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
  .opt:has(input:checked) { font-weight: 600; }
  .opt:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 2px; }
  .seg input:focus-visible + label { outline: 2px solid var(--ink); outline-offset: -4px; }

  .opts.four { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .opts.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .box { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--ink); display: grid; place-items: center; }
  .opt input:checked + .box { background: var(--ink); }
  .opt input:checked + .box::after { content: ""; width: 10px; height: 5px; margin-top: -2px; border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg); transform: rotate(-45deg); }
  .nums { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); row-gap: 2px; }
  .num { position: relative; isolation: isolate; min-height: 52px; padding: 0; display: grid; place-items: center; border: 0; background: none; color: var(--ink); font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
  .num::before { content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: min(44px, 88%); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 1.5px solid var(--line); background: transparent; }
  .num.on { color: var(--bg); font-weight: 600; }
  .num.on::before { background: var(--ink); border-color: var(--ink); }
  .check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; }
  .check input { width: 20px; height: 20px; accent-color: var(--ink); }

  .actions { display: grid; gap: 8px; }
  .primary { border: 0; border-radius: 14px; min-height: 50px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 16px; }
  .danger { border: 0; border-radius: 14px; min-height: 46px; background: none; color: var(--danger); font-size: 15px; box-shadow: inset 0 0 0 1.5px var(--line); }
  .danger.armed { background: var(--danger); box-shadow: none; color: var(--bg); }

  /* ---- Motion: only in response to a tap ---- */
  @media (prefers-reduced-motion: no-preference) {
    .new, .tab, .primary, .card .acts button, .btn-in, .btn-set { transition: transform .12s ease, opacity .12s ease; }
    .num { transition: color .15s ease; }
    .num::before { transition: background-color .15s ease, border-color .15s ease; }
    .num:active, .new:active, .tab:active, .primary:active, .card .acts button:active, .btn-in:active, .btn-set:active { transform: scale(.97); opacity: .85; }
    .scrim:not([hidden]) .sheet { animation: sheet-in .22s ease-out; }
    @keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
  }

  /* ---- Phones ---- */
  @media (max-width: 700px) {
    .bar { gap: 8px; padding: 10px 10px 8px; }
    .logo { display: none; }
    .new { height: 40px; padding: 0 10px 0 12px; font-size: 14px; border-radius: 12px; gap: 6px; }
    .new .plus { width: 20px; height: 20px; font-size: 17px; }
    .tabs { gap: 2px; }
    .tab { height: 40px; padding: 0 9px; font-size: 14px; border-radius: 10px; gap: 5px; }
    .tab b { min-width: 18px; padding: 0 5px; font-size: 11px; }
    .search { height: 40px; margin-inline: 0; }
    .search .cc { inset-inline-start: 8px; gap: 5px; font-size: 12px; }
    .search .cc i { width: 11px; height: 11px; }
    .search input { height: 40px; padding: 0 64px 0 28px; font-size: 15px; border-radius: 12px; }
    .search input::placeholder { font-size: 12px; }
    .title { gap: 6px; }
    .fs-btn { width: 40px; height: 40px; border-radius: 12px; }
    .grid { gap: 6px; padding: 0 6px calc(6px + env(safe-area-inset-bottom, 0px)); }
    .col { padding: 0 6px 14px; border-radius: 18px; gap: 8px; }
    .col h2 { margin: 0 -6px; padding: 8px 6px 4px; font-size: 16px; border-radius: 18px 18px 0 0; }
    .col h2 .hd { grid-template-columns: auto 1fr auto; gap: 6px; min-height: 42px; padding: 4px 10px; border-radius: 13px; }
    .col h2 small { font-size: 15px; }
    .col h2 small { column-gap: 6px; }
    .col h2 small span { font-size: 12px; }
    .col h2 .mn { display: none; }
    .card { border-radius: 14px; }
    .card .top { height: 28px; padding: 6px 8px 0; font-size: 12px; gap: 4px; }    .card .body { padding: 4px 8px 8px; }
    .card .n { font-size: 14px; }
    .card .p { font-size: 12px; gap: 5px; line-height: 18px; }
    .card .p i { width: 8px; height: 8px; }
    .card .party .gn { font-size: 20px; }
    .card .party svg { width: 16px; height: 16px; }
    .card .party small { font-size: 11px; }
    .card .acts { grid-template-columns: minmax(0, 1fr); gap: 5px; }
    .card .acts button { font-size: 13px; gap: 3px; min-height: 38px; border-radius: 10px; }
    .card .acts svg { width: 13px; height: 13px; }
    .card .foot { min-height: 30px; padding: 4px 8px; gap: 6px; font-size: 11px; }
    .card .tm svg { width: 12px; height: 12px; }
    .card .ct { font-size: 11px; padding: 1px 5px; gap: 3px; }
  }
  /* ---- Top bar (queue-app style): avatar, add button, tabs, phone search, tools at the end ---- */
  .bar { direction: rtl; gap: 12px; padding: 12px 16px; align-items: center; }
  .logo { display: none; }
  .account-wrap { flex: none; }
  .account-btn { width: 52px; height: 52px; border-radius: 50%; border: 2.5px solid var(--ink); background: transparent; color: var(--ink); }
  .account-btn svg { width: 26px; height: 26px; }
  .new { direction: rtl; height: 48px; padding: 0 10px 0 22px; gap: 12px; border-radius: 14px; font-size: 16px; }
  .new .plus { width: 30px; height: 30px; font-size: 22px; background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); }
  .tabs { direction: rtl; gap: 2px; }
  .tab { height: 48px; padding: 0 14px; border-radius: 12px; background: none; color: var(--ink); font-size: 16px; font-weight: 500; }
  .tab.on { background: none; color: var(--accent); font-weight: 600; }
  .tab.on b { background: var(--accent); color: var(--bg); }
  .search { direction: ltr; flex: 1 1 auto; max-width: 460px; height: 50px; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
  .search:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
  .search .cc { inset-inline-start: 12px; gap: 8px; font-size: 15px; }
  .search .cc i { width: 28px; height: 28px; }
  .search .cc::after { content: ""; margin-inline-start: 2px; border: 4px solid transparent; border-top: 5px solid var(--muted); border-bottom: 0; }
  .search input { height: 100%; padding: 0 40px 0 136px; direction: ltr; text-align: left; background: transparent; border: 0; border-radius: 14px; }
  .search input:focus { background: transparent; border: 0; box-shadow: none; outline: none; }
  .search-x { inset-inline-end: 6px; }
  .tools { flex: none; margin-inline-start: auto; display: flex; gap: 10px; }
  .tools .fs-btn { width: 50px; height: 50px; border-radius: 14px; border: 1px solid var(--line); }
  .tools .fs-btn span { display: none; }
  .fs-btn.spin svg { animation: bar-spin .7s linear; }
  @keyframes bar-spin { to { transform: rotate(360deg); } }
  /* Page filter under each section title: 1-4, 5-8, ... or all */
  .col h2 .flt { grid-column: 1 / -1; display: flex; align-items: center; gap: 2px; margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .col h2 .flt::-webkit-scrollbar { display: none; }
  .col h2 .flt svg { flex: none; width: 22px; height: 22px; margin-inline: 4px 8px; color: var(--ink); }
  .col h2 .flt button { flex: none; min-width: 34px; height: 34px; padding: 0 9px; border: 0; border-radius: 10px; background: none; color: var(--ink); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
  .col h2 .flt button.on { background: var(--ink); color: var(--bg); font-weight: 600; }
  /* Header: menu bars on the right, title in the middle, booking count on the left */
  .col h2 .hd .mn { grid-column: 1; grid-row: 1; justify-self: start;  width: 17px; height: 12px; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'%3E%3Cpath d='M1 2h20M1 8h20M1 14h20' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 16'%3E%3Cpath d='M1 2h20M1 8h20M1 14h20' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
  .col h2 .hd .ttl { grid-column: 2; grid-row: 1; font-size: 17px; font-weight: 400; }
  @media (max-width: 700px) { .col h2 .hd .ttl { font-size: 14px; } }
  .col h2 .hd small { grid-column: 3; grid-row: 1; justify-self: end; }
  .card { grid-template-columns: minmax(0, 1fr); }
  @media (max-width: 900px) and (min-height: 501px) {
    .bar { flex-wrap: wrap; gap: 8px; padding: 10px; }
    .search { order: 5; flex: 1 1 220px; max-width: none; height: 44px; }
    .tools { order: 6; margin-inline-start: 0; }
  }
  @media (max-height: 500px) {
    .bar { gap: 8px; padding: 8px 10px; }
    .account-btn, .tools .fs-btn { width: 42px; height: 42px; }
    .tools { gap: 6px; }
    .new { height: 42px; padding: 0 8px 0 14px; gap: 8px; font-size: 14px; }
    .tab { height: 42px; padding: 0 8px; font-size: 14px; }
    .search { min-width: 200px; }
    .search .cc i { width: 20px; }
    .search input { padding-left: 116px; }
  }
  .view-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  /* Stacked view: the three sections one above the other, the page scrolls */
  .grid[data-view="stack"] { overflow-anchor: none; grid-template-columns: minmax(0, 1fr); grid-auto-rows: max-content; align-content: start; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .grid[data-view="stack"] .col { overflow: visible; min-height: 120px; }
  @media (max-width: 700px) {
    .bar { flex-wrap: wrap; gap: 8px; padding: 10px; }
    .account-btn { width: 42px; height: 42px; }
    .account-btn svg { width: 22px; height: 22px; }
    .new { height: 42px; padding: 0 8px 0 14px; gap: 8px; font-size: 14px; }
    .new .plus { width: 26px; height: 26px; font-size: 19px; }
    .tab { height: 42px; padding: 0 8px; font-size: 14px; }
    .tools { gap: 6px; }
    .tools .fs-btn { width: 42px; height: 42px; }
    .search { order: 5; flex: 1 1 220px; min-width: 0; max-width: none; height: 44px; }
    .tools { order: 6; margin-inline-start: 0; }
    .search .cc { font-size: 14px; }
    .search .cc i { width: 22px; height: 22px; }
    .search input { padding: 0 36px 0 118px; font-size: 15px; }
  }
  /* No visible scrollbar on the sections (they still scroll) */
  .col, .grid { scrollbar-width: none; -ms-overflow-style: none; }
  .col::-webkit-scrollbar, .grid::-webkit-scrollbar { display: none; width: 0; height: 0; }
  /* Performance: off-screen cards are not rendered until scrolled near */
  .card { content-visibility: auto; contain-intrinsic-size: auto 150px; }
  .drow { content-visibility: auto; contain-intrinsic-size: auto 110px; }
  /* Country picker: real flag images (search boxes + booking form) */
  .search .cc { pointer-events: auto; cursor: pointer; background: none; border: 0; padding: 0; font-family: inherit; }
  .search .cc i, .ccb i, .ccm i { flex: none; height: auto; aspect-ratio: 4 / 3; border-radius: 3px; background-color: transparent; background-size: cover; background-position: center; background-repeat: no-repeat; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
  .ccb { flex: none; width: 122px; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; direction: ltr; padding: 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--ink); font: inherit; font-size: 17px; font-variant-numeric: tabular-nums; cursor: pointer; }
  .ccb i { width: 26px; }
  .ccb::after { content: ""; margin-inline-start: 2px; border: 4px solid transparent; border-top: 5px solid var(--muted); border-bottom: 0; }
  .ccb:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
  #f-cc { display: none; }
  .ccm { position: fixed; z-index: 60; min-width: 230px; padding: 6px; display: grid; gap: 2px; direction: rtl; background: var(--field); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .5); }
  .ccm[hidden] { display: none; }
  .ccm button { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; font-size: 15px; text-align: start; cursor: pointer; }
  .ccm button:hover, .ccm button:active { background: var(--panel); }
  .ccm button[aria-selected="true"] { background: var(--panel); font-weight: 600; }
  .ccm i { width: 30px; }
  .ccm .cd { margin-inline-start: auto; direction: ltr; color: var(--muted); font-variant-numeric: tabular-nums; }

  .load-more { flex: none; min-height: 44px; margin: 4px 0 0; border: 0; border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; }
  .dlist .load-more { width: 100%; }
  /* ---- Top bar: fits every screen (phones, tablets, desktop, landscape, notches) ---- */
  .bar { flex-wrap: wrap; row-gap: 8px; padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); }
  .grid { padding-right: max(12px, env(safe-area-inset-right, 0px)); padding-left: max(12px, env(safe-area-inset-left, 0px)); }
  .account-wrap, .new, .tools { flex: none; }
  .tabs { flex: 0 1 auto; min-width: 0; }
  .search { order: 0; flex: 1 1 200px; min-width: 0; margin-inline: 0; }
  /* Tablets / small laptops: first row = avatar, add, tabs, tools; search takes the whole second row */
  @media (max-width: 900px) {
    .bar { gap: 8px; padding-top: 10px; padding-bottom: 8px; }
    .tools { order: 4; margin-inline-start: auto; gap: 8px; }
    .search { order: 5; flex: 1 1 100%; max-width: none; height: 44px; }
    .search input { padding: 0 36px 0 124px; }
  }
  /* Phones: smaller controls, search shares the second row with the tools */
  @media (max-width: 560px) {
    .bar { gap: 6px; row-gap: 6px; padding-right: max(10px, env(safe-area-inset-right, 0px)); padding-left: max(10px, env(safe-area-inset-left, 0px)); }
    .account-btn { width: 40px; height: 40px; border-width: 2px; }
    .account-btn svg { width: 21px; height: 21px; }
    .new { height: 40px; padding: 0 8px 0 10px; gap: 6px; font-size: 13px; }
    .new .plus { width: 22px; height: 22px; font-size: 16px; }
    .tabs { flex: 1 0 auto; justify-content: flex-end; gap: 0; }
    .tab { height: 40px; padding: 0 7px; font-size: 13px; gap: 4px; }
    .tab b { min-width: 16px; padding: 0 4px; font-size: 10px; }
    .tools { order: 6; margin-inline-start: 0; gap: 4px; }
    .tools .fs-btn { width: 38px; height: 38px; border-radius: 11px; }
    .tools .fs-btn svg { width: 19px; height: 19px; }
    .search { order: 5; flex: 1 1 190px; height: 40px; }
    .search input { height: 40px; padding: 0 30px 0 104px; font-size: 14px; }
    .search .cc { inset-inline-start: 8px; gap: 5px; font-size: 13px; }
    .search .cc i { width: 20px; height: 20px; }
    .search .cc::after { margin-inline-start: 0; }
    .grid { padding-right: max(6px, env(safe-area-inset-right, 0px)); padding-left: max(6px, env(safe-area-inset-left, 0px)); }
  }
  /* Very narrow phones */
  @media (max-width: 360px) {
    .new { padding: 0 6px 0 8px; font-size: 12px; gap: 4px; }
    .tab { padding: 0 5px; font-size: 12px; }
    .tools .fs-btn { width: 34px; height: 34px; }
  }
  /* Short landscape screens (phones turned sideways): one compact row */
  @media (max-height: 500px) and (min-width: 561px) {
    .bar { flex-wrap: nowrap; gap: 8px; padding-top: 6px; padding-bottom: 6px; }
    .tools { order: 0; margin-inline-start: auto; }
    .search { order: 0; flex: 1 1 160px; max-width: 360px; height: 40px; }
    .search input { height: 40px; padding: 0 30px 0 104px; font-size: 14px; }
    .account-btn, .tools .fs-btn { width: 40px; height: 40px; }
    .new, .tab { height: 40px; }
  }

  /* ---- Language switch (profile) + English / LTR adjustments ---- */
  .lang-label { margin: 2px 0 -4px; color: var(--muted); font-size: 14px; }
  .lang-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 16px; background: var(--panel); direction: ltr; }
  .lang-row button { min-height: 44px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; }
  .lang-row button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
  .ta-end { text-align: right; }
  html[dir="ltr"] .ta-end { text-align: left; }
  html[dir="ltr"] .bar, html[dir="ltr"] .new, html[dir="ltr"] .tabs, html[dir="ltr"] .ccm, html[dir="ltr"] .drow .dt { direction: ltr; }
  html[dir="ltr"] .drow .dp { text-align: left; }
  html[dir="ltr"] #cred-form input[type="text"], html[dir="ltr"] #cred-form input[type="password"] { text-align: left; }
  html[dir="ltr"] .card .top .ct { left: auto; right: 10px; }
  html[dir="ltr"] .card.called .top { padding-left: 12px; padding-right: 100px; }
  @container (max-width: 170px) { html[dir="ltr"] .card.called .top { padding-left: 12px; padding-right: 58px; } }
  @media (max-width: 700px) { html[dir="ltr"] .card.called .top { padding-left: 8px; } }
  html[dir="ltr"] .new { padding: 0 22px 0 10px; }
  @media (max-height: 500px) { html[dir="ltr"] .new { padding: 0 14px 0 8px; } }
  @media (max-width: 700px) { html[dir="ltr"] .new { padding: 0 14px 0 8px; } }
  @media (max-width: 560px) { html[dir="ltr"] .new { padding: 0 10px 0 8px; } }
  @media (max-width: 360px) { html[dir="ltr"] .new { padding: 0 8px 0 6px; } }

/* Account menu: sign-out action */
#account-menu button.logout-action {
  margin-top: 8px;
  background: rgba(179, 38, 30, .08);
  color: var(--danger, #B3261E);
}
#account-menu button.logout-action:disabled {
  opacity: .6;
  cursor: wait;
}

/* Keep the sign-out button always reachable inside the profile popup */
#account-menu button.logout-action { flex: none; position: relative; z-index: 1; pointer-events: auto; }


/* ===== Profile popup (4 buttons) + Settings popup (two columns on wide screens) ===== */
#account-menu.scrim, #settings-scrim.scrim { align-items: flex-end; padding: 0; }
#account-menu .sheet, #settings-scrim .sheet { max-width: 460px; max-height: 92dvh; overflow-y: auto; border-radius: 26px 26px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -10px 40px -12px rgba(0, 0, 0, .35); }
@media (min-width: 600px) {
  #account-menu.scrim, #settings-scrim.scrim { align-items: center; }
  #account-menu .sheet, #settings-scrim .sheet { border-radius: 26px; padding-bottom: 18px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45); }
}
#account-menu .sheet { max-width: 400px; }
.acct-col { display: grid; gap: 14px; align-content: start; min-width: 0; }
.acct-list { display: grid; gap: 10px; }
.acct-list .sw-row { min-height: 50px; font-size: 15px; }
#account-menu .acct-list button.logout-action { margin-top: 0; }
@media (min-width: 700px), (orientation: landscape) {
  #settings-scrim .sheet { max-width: 960px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 28px; }
  #settings-scrim .sheet-head { grid-column: 1 / -1; }
}
/* the settings buttons look like the profile buttons */
#settings-scrim button.menu-action { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 50px; padding: 0 16px; border: 0; border-radius: 16px; background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; }
#settings-scrim button.menu-action svg { width: 20px; height: 20px; flex: none; }
#settings-scrim .sw-row { min-height: 50px; font-size: 15px; }

/* Never let the browser's scroll anchoring move the booking lists by itself (they are restored by main.js) */
.col { overflow-anchor: none; }

/* "Tap to return to full screen" - shown after the dialer / a reload took the page out of full screen */
.fs-return { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 8px; padding: 12px 18px; border: 0; border-radius: 999px; background: var(--ink); color: var(--bg); font: inherit; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5); }

/* Working hours + themes cards */
.acct-card { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: var(--panel); }
.acct-card h4 { margin: 0; font-size: 15px; font-weight: 600; }
.acct-card .sw-row { background: var(--field); min-height: 54px; }
.wh-times { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wh-times.is-off { opacity: .5; }
.wh-times label { display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
.wh-times input { width: 100%; min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--field); color: var(--ink); font: inherit; font-size: 16px; direction: ltr; text-align: center; }
.wh-times input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
.wh-times input:disabled { cursor: not-allowed; }
.wh-status { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.wh-status.on { color: #25824f; }
.wh-status.off { color: var(--danger); }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.theme-opt { display: grid; gap: 7px; justify-items: center; padding: 11px 6px 9px; border: 2px solid transparent; border-radius: 14px; background: var(--field); color: var(--ink); font-size: 13px; font-weight: 600; }
.theme-opt[aria-checked="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
.theme-opt:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.th-dots { display: flex; direction: ltr; }
.th-dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--field); box-shadow: 0 0 0 1px var(--line); margin-inline-start: -7px; }
.th-dots i:first-child { margin-inline-start: 0; }


/* ===== الأقسام الديناميكية ===== */
/* أكثر من 4 أقسام: تُعرض بجانب بعض مع تمرير أفقي بدل تضييق البطاقات */
.grid[data-many="1"]:not([data-view="stack"]) { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(300px, 1fr); overflow-x: auto; overscroll-behavior-x: contain; }
.opts.areas { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 4px; }
.num:disabled, .num.dis { opacity: .28; cursor: not-allowed; }
.opt.chk.is-off { opacity: .4; cursor: not-allowed; }
.opt.chk.is-off input { cursor: not-allowed; }

/* محرر الأقسام داخل الإعدادات */
.sec-list { display: grid; gap: 10px; }
.sec-row { display: grid; gap: 8px; padding: 10px; border-radius: 14px; background: var(--field); border: 1px solid var(--line-soft, var(--line)); }
.sec-top { display: flex; align-items: center; gap: 6px; }
.sec-name { flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; font-size: 16px; font-weight: 600; }
.sec-name:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
.sec-mv { display: flex; flex: none; }
.sec-mv button, .sec-del { flex: none; display: grid; place-items: center; width: 36px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: none; color: var(--ink); }
.sec-mv button:disabled, .sec-del:disabled { opacity: .25; cursor: not-allowed; }
.sec-mv svg, .sec-del svg { width: 19px; height: 19px; }
.sec-del { color: var(--danger, #B3261E); }
.sec-del.armed { background: var(--danger, #B3261E); color: #fff; }
.sec-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sec-opts label { display: grid; gap: 4px; min-width: 0; color: var(--muted); font-size: 13px; }
.sec-opts select { width: 100%; min-height: 42px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; font-size: 15px; }
.sec-opts select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring); }
#sec-card .sec-add:disabled, #sec-card .btn-in:disabled { opacity: .5; cursor: not-allowed; }

/* مطعم بدون أقسام: رسالة وزر لإضافة أول قسم */
.no-sections { grid-column: 1 / -1; align-self: center; justify-self: center; display: grid; gap: 12px; text-align: center; max-width: 420px; padding: 40px 16px; }
.no-sections h3 { margin: 0; font-size: 20px; }
.no-sections p { margin: 0; color: var(--muted); }
.no-sections .btn-in { padding: 0 24px; cursor: pointer; }

/* شعار المطعم في أعلى لوحته (بدل شعار حُب الثابت) */
.bar .logo:not(.has-img):not(.is-text) { visibility: hidden; }
.bar .logo.has-img, .bar .logo.is-text { -webkit-mask: none; mask: none; background: none; aspect-ratio: auto; }
.bar .logo.has-img, .bar .logo.is-text { display: block; }   /* كانت مخفية بقاعدة .logo{display:none} أعلاه، فلم تظهر الصورة في لوحة المدير */
.bar .logo.has-img { margin-inline: 0 2px; }
.bar .logo.has-img img { display: block; width: 48px; height: 48px; object-fit: cover; border-radius: 12px; }
.bar .logo.is-text { font-size: 16px; font-weight: 600; line-height: 38px; color: var(--ink); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* نافذة «قديم»: زر الإغلاق (×) والبحث ثابتان أعلى النافذة في كل الشاشات، والقائمة وحدها تتمرر */
#done-scrim .sheet { display: flex; flex-direction: column; gap: 12px; overflow: hidden; max-height: 92dvh; }
#done-scrim .sheet-head, #done-scrim .done-search { flex: none; }
#done-scrim .dlist { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; align-content: start; }
#done-scrim .empty { flex: none; }



/* «قديم»: نفس أقسام شاشة الحجوزات، وتحت كل قسم الحجوزات المنتهية مع سبب الانتهاء */
#done-scrim .dlist { gap: 16px; }
.dgrp { display: grid; gap: 10px; align-content: start; }
.dsec { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; padding: 4px 14px; border-radius: 13px; background: var(--card); box-shadow: 0 0 0 6px var(--bg); font-size: 16px; font-weight: 600; }
.dsec b { min-width: 28px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 10px; background: var(--tile, var(--ink)); color: #fff; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.drow .dwhy { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; padding: 8px 10px; border-radius: 12px; background: var(--panel); font-size: 13px; }
.drow .dwhy-l { color: var(--muted); }
.drow .dwhy strong { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.drow .dwhy-cancel strong { color: var(--danger); }
