/* The glass look for the dashboard and the platform page: calm surfaces over a soft background, in light and dark.
   Pages opt in with <body class="ui2">; theme.js sets data-theme="light|dark" on <html>.
   Every colour here is a token, so a new screen only has to use var(--…) to work in both themes.
   Logical properties (inline-start/end) keep it right in Arabic. */

:root {
  color-scheme: light;
  /* surfaces */
  --bg: #eef0f3;
  --glass: rgba(255, 255, 255, .62);
  --glass-strong: rgba(255, 255, 255, .86);
  --glass-line: rgba(255, 255, 255, .75);
  --field: rgba(255, 255, 255, .78);
  --surface: #ffffff;           /* an opaque surface (menus, popovers, rows inside a card) */
  --surface-2: #f5f6f8;
  --card: rgba(255, 255, 255, .62);
  --line: rgba(24, 32, 48, .10);
  --shadow: 0 10px 30px rgba(31, 41, 55, .08), 0 1px 2px rgba(31, 41, 55, .05);
  --shadow-lift: 0 16px 40px rgba(31, 41, 55, .13), 0 2px 4px rgba(31, 41, 55, .06);
  /* text */
  --text: #1b2230;
  --muted: #586274;
  /* accent: a warm orange, dark enough for white text */
  --brand: #c2571f;
  --on-brand: #fff;
  --brand-soft: rgba(194, 87, 31, .12);
  /* state colours: a text colour and a soft background each */
  --ok: #17703e;       --ok-bg: rgba(34, 160, 90, .14);
  --danger: #b3261e;   --danger-bg: rgba(220, 60, 50, .12);
  --warn: #8a5300;     --warn-bg: rgba(240, 160, 30, .18);
  --info: #1f5fbf;     --info-bg: rgba(50, 120, 230, .12);
  --bar: #2f7fd6;
  /* shape */
  --r: 18px;
  --r-sm: 12px;
  --blur: 18px;
}

:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #0f1319;
  --glass: rgba(26, 31, 41, .58);
  --glass-strong: rgba(30, 36, 48, .92);
  --glass-line: rgba(255, 255, 255, .10);
  --field: rgba(255, 255, 255, .06);
  --surface: #1b212b;
  --surface-2: #232a36;
  --card: rgba(26, 31, 41, .58);
  --line: rgba(255, 255, 255, .09);
  --shadow: 0 12px 32px rgba(0, 0, 0, .35), 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lift: 0 18px 44px rgba(0, 0, 0, .5), 0 2px 4px rgba(0, 0, 0, .35);
  --text: #e8ecf3;
  --muted: #9aa5b8;
  --brand: #f0894f;
  --on-brand: #1a1208;
  --brand-soft: rgba(240, 137, 79, .16);
  --ok: #5fd08a;       --ok-bg: rgba(60, 200, 120, .15);
  --danger: #ff8b83;   --danger-bg: rgba(255, 110, 100, .15);
  --warn: #f5be63;     --warn-bg: rgba(245, 170, 60, .16);
  --info: #8db8ff;     --info-bg: rgba(90, 150, 255, .16);
  --bar: #5aa2f0;
}

/* ---------- Background: soft, neutral light behind the glass (no image to download) ---------- */

body.ui2 { background: var(--bg); color: var(--text); min-height: 100dvh; }
body.ui2::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(52rem 36rem at 8% -8%, #d9e6f2 0, transparent 62%),
    radial-gradient(46rem 34rem at 104% 4%, #f1e4d6 0, transparent 58%),
    radial-gradient(56rem 44rem at 48% 118%, #d5e6e0 0, transparent 62%);
}
:root[data-theme=dark] body.ui2::before {
  background:
    radial-gradient(52rem 36rem at 8% -8%, #1d3047 0, transparent 62%),
    radial-gradient(46rem 34rem at 104% 4%, #3a2a2a 0, transparent 58%),
    radial-gradient(56rem 44rem at 48% 118%, #17352f 0, transparent 62%);
}

/* ---------- Glass surfaces ---------- */

.ui2 .card, .ui2 .tile, .ui2 .u-rail, .ui2 .u-top, .ui2 .u-pop, .ui2 dialog, .ui2 .u-widget {
  background: var(--glass); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
  box-shadow: var(--shadow);
}
.ui2 .card { border-radius: var(--r); padding: 20px; margin-bottom: 16px; }
.ui2 .card .card { background: var(--field); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Without blur support, or when asked for lighter effects, the glass becomes a plain, slightly see-through surface. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .ui2 .card, .ui2 .tile, .ui2 .u-rail, .ui2 .u-top, .ui2 .u-pop, .ui2 dialog, .ui2 .u-widget { background: var(--glass-strong); }
}
:root[data-effects=lite] .ui2 .card, :root[data-effects=lite] .ui2 .tile, :root[data-effects=lite] .ui2 .u-rail, :root[data-effects=lite] .ui2 .u-top,
:root[data-effects=lite] .ui2 .u-pop, :root[data-effects=lite] .ui2 dialog, :root[data-effects=lite] .ui2 .u-widget {
  -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-strong); box-shadow: none;
}
@media (prefers-reduced-transparency: reduce) {
  .ui2 .card, .ui2 .tile, .ui2 .u-rail, .ui2 .u-top, .ui2 .u-pop, .ui2 dialog, .ui2 .u-widget {
    -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--glass-strong);
  }
}
@media (max-width: 640px) { :root { --blur: 12px; } }

/* ---------- Type and controls ---------- */

.ui2 h1, .ui2 h2, .ui2 h3 { letter-spacing: -.01em; }
.ui2 h2 { font-size: 1.12rem; }
.ui2 h3 { font-size: .98rem; margin: 18px 0 8px; }
.ui2 .muted { color: var(--muted); }
.ui2 a { color: var(--brand); }
.ui2 input, .ui2 select, .ui2 textarea {
  background: var(--field); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm);
  transition: border-color var(--t) var(--ease-soft), box-shadow var(--t) var(--ease-soft), background-color var(--t) var(--ease-soft);
}
.ui2 input::placeholder, .ui2 textarea::placeholder { color: var(--muted); opacity: .8; }
.ui2 input:focus-visible, .ui2 select:focus-visible, .ui2 textarea:focus-visible {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.ui2 :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ui2 input[type=checkbox], .ui2 input[type=radio] { accent-color: var(--brand); width: 17px; height: 17px; }
.ui2 select option { background: var(--glass-strong); color: var(--text); }

.ui2 .btn {
  background: var(--field); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.ui2 .btn:not(:disabled):hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); transform: translateY(-1px); }
.ui2 .btn:not(:disabled):active { transform: scale(.97); }
.ui2 .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 32%, transparent); }
.ui2 .btn.primary:not(:disabled):hover { filter: brightness(1.06); }
.ui2 .btn.ghost { background: transparent; box-shadow: none; }
.ui2 .btn.danger { color: var(--danger); }
.ui2 .error { color: var(--danger); }
.ui2 .ok { color: var(--ok); }

.ui2 .pill { background: var(--field); border: 1px solid var(--line); color: var(--text); }
.ui2 .pill.ready, .ui2 .pill.sub.active { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.ui2 .pill.new, .ui2 .pill.sub.expired { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.ui2 .pill.sub.trial { background: var(--info-bg); border-color: transparent; color: var(--info); }
.ui2 .notice { background: var(--warn-bg); border-color: transparent; color: var(--text); }
.ui2 .sub.trial { background: var(--info-bg); border-color: transparent; }
.ui2 .sub.active { background: var(--ok-bg); border-color: transparent; }
.ui2 .sub.expired { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.ui2 .ai-pill.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.ui2 .ai-pill.full { background: var(--danger-bg); border-color: transparent; color: var(--danger); }

.ui2 table.data th, .ui2 table.data td, .ui2 .top-table th, .ui2 .top-table td { border-bottom: 1px solid var(--line); }
.ui2 table.data th, .ui2 .top-table th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: none; }
.ui2 .meter { background: var(--line); }
.ui2 .meter i { background: var(--ok); }
.ui2 .meter.warn i { background: var(--warn); }
.ui2 .meter.full i { background: var(--danger); }
.ui2 .day-bars i { background: var(--bar); }
.ui2 .ai-row, .ui2 .route-row { border-color: var(--line); }
.ui2 .ai-probe .chip { background: var(--field); border-color: var(--line); color: var(--text); }
.ui2 pre.creds { background: var(--field); color: var(--text); border: 1px solid var(--line); }

.ui2 details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ui2 details.card > summary::-webkit-details-marker { display: none; }
.ui2 details.card > summary:not(:has(.opt-chev))::after {
  content: ''; width: 9px; height: 9px; border-inline-end: 2px solid var(--muted); border-block-end: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform var(--t) var(--ease); flex: none; margin-inline-end: 4px;
}
.ui2 details.card[open] > summary:not(:has(.opt-chev))::after { transform: rotate(-135deg); }
.ui2 details.card > summary h2 { margin: 0; }

.ui2 .toast { background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-line); box-shadow: var(--shadow-lift); -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur)); }
.ui2 .toast.err { background: var(--danger); color: #fff; border-color: transparent; }
.ui2 dialog { color: var(--text); border-radius: var(--r); background: var(--glass-strong); }
.ui2 dialog::backdrop { background: rgba(8, 12, 20, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
:root[data-effects=lite] .ui2 dialog::backdrop { -webkit-backdrop-filter: none; backdrop-filter: none; }

/* Breathing room inside cards: text, then fields, then actions. */
.ui2 .card > p, .ui2 .card > ol, .ui2 .card > ul, .ui2 form > p, .ui2 form > ol { margin-block: 0 12px; }
.ui2 .card ol, .ui2 .card ul { padding-inline-start: 22px; }
.ui2 form > label, .ui2 form > .edit-grid, .ui2 form > .grid { margin-bottom: 12px; }
.ui2 form > .btn, .ui2 .card > .btn, .ui2 .card > .row-form, .ui2 form > .actions { margin-top: 8px; }
.ui2 .row-form, .ui2 .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ui2 .card > .row-form { margin-bottom: 12px; }
.ui2 .toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.ui2 .toolbar input[type=search] { flex: 1 1 220px; }
.ui2 .toolbar :is(select, .pk-select) { flex: 0 1 180px; }

/* ---------- Tiles: the small numbers ---------- */

.ui2 .tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.ui2 .tile { border-radius: var(--r); padding: 16px 18px; gap: 3px; transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease-soft); }
.ui2 .tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.ui2 .tile span { color: var(--muted); }
.ui2 .tile strong { font-size: 1.75rem; letter-spacing: -.02em; }

/* ---------- The shell: a floating rail, a top bar, and the page ---------- */

.u-shell { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; padding: 18px; max-width: 1480px; margin: 0 auto; align-items: start; }
.u-rail {
  position: sticky; top: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px; border-radius: 26px; height: fit-content; max-height: calc(100dvh - 36px); overflow-y: auto; scrollbar-width: none;
}
.u-rail::-webkit-scrollbar { display: none; }
.u-rail .u-logo { width: 44px; height: 44px; display: grid; place-items: center; color: var(--brand); margin-bottom: 4px; }
.u-rail .u-logo .ic { width: 26px; height: 26px; }
.u-rail button, .u-rail a {
  position: relative; width: 46px; height: 46px; border-radius: 16px; border: 0; background: transparent; color: var(--muted);
  display: grid; place-items: center; text-decoration: none; cursor: pointer;
}
.u-rail button .ic, .u-rail a .ic { width: 21px; height: 21px; margin: 0; }
.u-rail button:hover, .u-rail a:hover { background: var(--field); color: var(--text); }
.u-rail button.active, .u-rail a.active { background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 30%, transparent); }
.u-rail .u-sep { width: 26px; height: 1px; background: var(--line); margin: 4px 0; }
/* Names appear next to an icon when it is hovered or focused (and are read out by screen readers). */
.u-rail [data-tip]::after {
  content: attr(data-tip); position: absolute; inset-inline-start: calc(100% + 12px); top: 50%; transform: translateY(-50%) translateX(-4px);
  background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-line); box-shadow: var(--shadow-lift);
  padding: 6px 11px; border-radius: 10px; font-size: .82rem; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity var(--t-fast) var(--ease-soft), transform var(--t) var(--ease); z-index: 60;
}
[dir=rtl] .u-rail [data-tip]::after { transform: translateY(-50%) translateX(4px); }
.u-rail [data-tip]:hover::after, .u-rail [data-tip]:focus-visible::after { opacity: 1; transform: translateY(-50%); }

.u-main { min-width: 0; }
.u-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 22px; margin-bottom: 18px; position: sticky; top: 18px; z-index: 30; }
.u-top .u-hello { display: flex; flex-direction: column; min-width: 0; }
.u-top .u-hello strong { font-size: 1.05rem; letter-spacing: -.01em; }
.u-top .u-hello span { color: var(--muted); font-size: .84rem; }
.u-top .u-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.u-icon-btn { width: 42px; height: 42px; padding: 0 !important; border-radius: 14px !important; }
.u-icon-btn .ic { width: 20px; height: 20px; margin: 0; }
.u-main main { max-width: none; padding: 0; margin: 0; }

/* A page inside the shell: the cards sit in a bento grid when they are widgets */
.u-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.u-widget { border-radius: var(--r); padding: 18px; grid-column: span 4; display: flex; flex-direction: column; gap: 6px; min-width: 0; transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease-soft); }
.u-widget:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.u-widget.w-6 { grid-column: span 6; }
.u-widget.w-8 { grid-column: span 8; }
.u-widget.w-12 { grid-column: span 12; }
.u-widget h3 { margin: 0 0 4px; font-size: .86rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.u-widget h3 .ic { width: 17px; height: 17px; margin: 0; }
.u-widget .big { display: flex; align-items: center; font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.u-widget .sub-line { color: var(--muted); font-size: .84rem; }
.u-widget .u-row { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; padding: 6px 0; border-top: 1px solid var(--line); }
.u-widget .u-row:first-of-type { border-top: 0; }
.u-widget .u-row b { font-variant-numeric: tabular-nums; }
.u-widget .state-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); margin-inline-end: 8px; box-shadow: 0 0 0 4px var(--ok-bg); }
.u-widget .state-dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-bg); }
.u-widget .state-dot.bad { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-bg); }
.u-widget .link-more { margin-top: auto; padding-top: 6px; font-size: .85rem; font-weight: 600; }
@media (max-width: 1100px) { .u-widget, .u-widget.w-8 { grid-column: span 6; } .u-widget.w-12 { grid-column: span 12; } }
@media (max-width: 640px) { .u-widget, .u-widget.w-6, .u-widget.w-8 { grid-column: span 12; } }

.view:not([hidden]) { animation: view-in var(--t) var(--ease) backwards; }

/* Phones and small tablets: the rail becomes a floating dock at the bottom. */
@media (max-width: 899px) {
  .u-shell { grid-template-columns: minmax(0, 1fr); padding: 12px 12px calc(96px + env(safe-area-inset-bottom)); gap: 12px; }
  .u-rail {
    position: fixed; z-index: 55; inset-inline: 12px; inset-block-end: max(12px, env(safe-area-inset-bottom)); top: auto;
    flex-direction: row; justify-content: space-around; gap: 2px; padding: 8px 10px; border-radius: 26px; max-height: none;
    overflow-x: auto; overflow-y: hidden;
  }
  .u-rail .u-logo, .u-rail .u-sep { display: none; }
  .u-rail button, .u-rail a { flex: 1 1 0; min-width: 44px; max-width: 64px; height: 48px; }
  .u-rail [data-tip]::after { display: none; }
  .u-top { top: 12px; border-radius: 20px; padding: 10px 12px; }
  .u-top .u-hello span { display: none; }
}

/* ---------- Appearance panel ---------- */

.u-pop { position: fixed; z-index: 80; width: min(320px, calc(100vw - 24px)); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--glass-strong); }
.u-pop[hidden] { display: none; }
.u-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.u-seg button {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--field); color: var(--muted); font: inherit; font-size: .76rem; font-weight: 600; cursor: pointer;
}
.u-seg button .ic { width: 20px; height: 20px; margin: 0; }
.u-seg button[aria-checked=true] { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.u-time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.u-time-row label { font-size: .8rem; }
.u-pop .check { font-size: .86rem; }

/* ---------- Sign-in screens ---------- */

.ui2 .auth { min-height: 100dvh; }
.ui2 .auth-card { border-radius: 24px; padding: 28px; }

@media (prefers-reduced-motion: reduce) {
  .ui2 .tile, .ui2 .u-widget, .ui2 .btn { transition: none; }
}

/* ---------- The dashboard's older components, in the same tokens ---------- */

.ui2 .sub-banner { background: var(--info-bg); color: var(--text); }
.ui2 .sub-banner.warn, .ui2 .lock-note { background: var(--warn-bg); color: var(--text); }
.ui2 .sub-banner.danger { background: var(--danger-bg); color: var(--danger); }
.ui2 .call-chip { background: var(--danger-bg); border-color: transparent; }
.ui2 .pill.ready, .ui2 .pay-pill.paid, .ui2 .pill.up { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.ui2 .pill.new, .ui2 .pay-pill.unpaid, .ui2 .pill.down, .ui2 .pill.low { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.ui2 .pill.warn, .ui2 .pay-pill.pending { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.ui2 .order.status-new, .ui2 .review.new { border-inline-start-color: var(--danger); }
.ui2 .order.status-preparing { border-inline-start-color: var(--warn); }
.ui2 .soldout-chip input:checked + span { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
.ui2 .ai-btn { background: linear-gradient(135deg, var(--info-bg), var(--brand-soft)); border-color: var(--line); }
.ui2 .stars-static { color: var(--warn); }
.ui2 .stars-static span { color: var(--line); }
.ui2 .star-on { color: var(--warn); fill: var(--warn); }
.ui2 .insight-box .tip { color: var(--warn); }
.ui2 .save-bar.dirty #designStatus { color: var(--warn); }
.ui2 .pi-alert { background: var(--field); border-color: var(--line); }
.ui2 .pi-alert .pi-ico { background: var(--surface-2); color: var(--muted); }
.ui2 .pi-alert.bad { background: var(--danger-bg); border-color: transparent; } .ui2 .pi-alert.bad .pi-ico { background: var(--danger-bg); color: var(--danger); }
.ui2 .pi-alert.warn { background: var(--warn-bg); border-color: transparent; } .ui2 .pi-alert.warn .pi-ico { background: var(--warn-bg); color: var(--warn); }
.ui2 .pi-alert.good { background: var(--ok-bg); border-color: transparent; } .ui2 .pi-alert.good .pi-ico { background: var(--ok-bg); color: var(--ok); }
.ui2 .pi-row, .ui2 .price-card { background: var(--field); border-color: var(--line); }
.ui2 .price-move.up b, .ui2 .price-card .up, .ui2 .deal-result .up, .ui2 .fran-nums .price-move.up { color: var(--ok); }
.ui2 .price-move.down b, .ui2 .price-card .down, .ui2 .deal-result .down, .ui2 .fran-nums .price-move.down { color: var(--danger); }
.ui2 .stock-row.low .stock-step input { color: var(--danger); border-color: var(--danger); }
.ui2 .chart figcaption { color: var(--muted); }
.ui2 .chart .grid { stroke: var(--line); }
.ui2 .chart .tick { fill: var(--muted); }
.ui2 .chart .peak { fill: var(--text); }
.ui2 .chart .bar.hover .hit { fill: var(--brand-soft); }
.ui2 .qr-card .qr-url { color: var(--muted); }
.ui2 .opt-card { background: var(--field); }
.ui2 .opt-card[open] { box-shadow: var(--shadow); }
.ui2 .settings-tabs { background: color-mix(in srgb, var(--surface) 98%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); --top-offset: 18px; }
@media (max-width: 760px) { .ui2 .settings-tabs { --top-offset: 12px; } }
.ui2 .segmented button.active, .ui2 .nav button.active { background: var(--brand-soft); color: var(--brand); }
.ui2 .coach-row, .ui2 .qr-tile { background: var(--field); }

/* ---------- The dashboard frame ---------- */

.ui2 #nav, .ui2 .nav-scrim, .ui2 .nav-toggle, .ui2 .view-title { display: none !important; }   /* the rail and the strip replace them */
.ui2 .shell { display: block; }
.ui2 .u-main main { max-width: 1240px; }
.ui2 .platform-bar { border-radius: 0 0 var(--r-sm) var(--r-sm); }
.ui2 .u-top .brand-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.ui2 .u-top .brand-wrap strong { font-size: 1.05rem; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 36vw; }
.ui2 #locationSwitch { width: auto; max-width: 200px; padding: 7px 10px; }
.ui2 .u-rail .u-dot { position: absolute; top: 9px; inset-inline-end: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--glass-strong); }

/* The strip of screens inside a section */
.u-tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 16px; padding: 5px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--glass-line); box-shadow: var(--shadow); width: fit-content; max-width: 100%;
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%); backdrop-filter: blur(var(--blur)) saturate(150%);
}
.u-tabs::-webkit-scrollbar { display: none; }
.u-tabs[hidden] { display: none; }
.u-tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; border-radius: 13px; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-weight: 700; font-size: .92rem; white-space: nowrap; cursor: pointer; text-decoration: none; flex: none;
}
.u-tab .ic { width: 16px; height: 16px; margin: 0; }
.u-tab:hover { background: var(--field); color: var(--text); }
.u-tab.active { background: var(--brand); color: var(--on-brand); box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent); }
.u-tab.locked { opacity: .55; }
.u-tab .badge-count { margin-inline-start: 2px; }

/* Home */
.u-hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; align-items: stretch; padding: 26px; }
.u-hero h1 { font-size: 1.6rem; letter-spacing: -.02em; margin: 0 0 2px; }
.u-hero-nums { display: flex; gap: 34px; flex-wrap: wrap; margin-top: 18px; }
.u-hero-nums span { display: block; color: var(--muted); font-size: .84rem; font-weight: 600; }
.u-hero-nums strong { display: block; font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.u-hero-nums small { color: var(--muted); font-size: .84rem; }
.u-hero-chart { display: flex; flex-direction: column; gap: 8px; min-height: 130px; }
.u-bars { flex: 1; display: flex; align-items: flex-end; gap: 7px; min-height: 100px; }
.u-bars i { flex: 1; border-radius: 8px 8px 4px 4px; background: color-mix(in srgb, var(--brand) 28%, transparent); min-height: 4px; transition: height var(--t-slow) var(--ease); }
.u-bars i.today { background: var(--brand); }
.u-trend { font-weight: 700; }
.u-trend.up { color: var(--ok); }
.u-trend.down { color: var(--danger); }
.u-widget .big.small-big { font-size: 1.3rem; line-height: 1.25; }
.u-steps { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 10px; }
.u-steps li { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.u-steps li.done { color: var(--muted); }
.u-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; }
.u-steps .done .u-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.u-check .ic { width: 14px; height: 14px; margin: 0; stroke-width: 3; }
@media (max-width: 760px) { .u-hero { grid-template-columns: minmax(0, 1fr); padding: 20px; } .u-hero-nums { gap: 22px; } }

.u-more-only { display: none !important; }
.u-menu { width: auto; min-width: 200px; padding: 8px; gap: 2px; }
.u-menu button { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; text-align: start; border-radius: 12px; cursor: pointer; }
.u-menu button:hover { background: var(--field); }
.u-menu .ic { width: 18px; height: 18px; margin: 0; color: var(--muted); }
@media (max-width: 640px) {
  .u-more-only { display: inline-flex !important; }
  .ui2 .u-top .top-actions > [data-lang-switch], .ui2 .u-top #viewMenuLink, .ui2 .u-top #accountBtn, .ui2 .u-top #logoutBtn { display: none; }
  .ui2 .u-top .brand-wrap strong { max-width: 46vw; }
}
@media (max-width: 899px) {
  .u-tabs { margin-bottom: 12px; border-radius: 16px; }
  .ui2 .u-top .brand-wrap strong { max-width: 30vw; }
  .ui2 .u-top .top-actions { gap: 4px; }
  .ui2 .u-top [data-install] { display: none; }
}

.ui2 .sub-banner { border-radius: var(--r-sm); margin: 0 0 14px; border: 1px solid var(--glass-line); }
.ui2 .sub-banner a { font-weight: 700; }

.ui2 .pi-c { background: color-mix(in srgb, var(--brand, #1F6F6B) calc(var(--v) * 100%), var(--surface-2)); }
.ui2 .save-bar { background: var(--glass-strong); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(var(--blur)); backdrop-filter: blur(var(--blur)); }

/* The design screen's save bar floats at the bottom of the page instead of reaching across it. */
.ui2 .save-bar { margin: 16px 0 0; bottom: 16px; border-radius: var(--r); border-top: 1px solid var(--glass-line); box-shadow: var(--shadow-lift); }

/* ---------- Standalone pages (sign-up, setup guide, monthly report) ---------- */

/* The setup guide and report use their own variable names; point them at the theme. */
body.ui2 { --ink: var(--text); }
.ui2 .wiz .card, .ui2 .sheet, .ui2 .bar { background: var(--glass-strong); border-color: var(--glass-line); color: var(--text); }
.ui2 .bar :is(select, .pk-select), .ui2 .bar .btn:not(.primary), .ui2 .wiz .btn:not(.primary) { background: var(--field); color: var(--text); border-color: var(--glass-line); }
.ui2 .found { background: var(--ok-bg); border-color: var(--glass-line); color: var(--text); }
.ui2 .partial { background: var(--warn-bg); border-color: var(--glass-line); color: var(--text); }
.ui2 .track { background: var(--surface-2); }
.ui2 .ai { background: var(--surface-2); }
.ui2 .wiz input[type=text], .ui2 .wiz input[type=url], .ui2 .wiz input:not([type]) { background: var(--field); color: var(--text); border-color: var(--glass-line); }
.ui2 .big-pick, .ui2 .cat { background: var(--glass); }
@media print { body.ui2 { background: #fff; color: #1f1a17; } .ui2 .sheet, .ui2 .bar { background: #fff; color: #1f1a17; } }
/* A QR code must stay dark on white to scan, in dark mode too. */
.ui2 .qr-card img { background: #fff; padding: 12px; border-radius: var(--r-sm); }
/* Links on the setup guide follow the text colour: the owner's chosen brand colour can be too dark to read on dark glass. */
.ui2 .wiz .link, .ui2 .wiz .alts a { color: var(--text); }

/* ---------- Phone: nothing sits under the bottom bar, and nothing shows through the bars ---------- */

/* The top bar and the bottom bar are nearly solid: text scrolling under them must not show through. */
.ui2 .u-top, .ui2 .u-rail { background: color-mix(in srgb, var(--surface) 97%, transparent); }
@media (max-width: 899px) {
  .u-shell { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  /* The AI helper button floats above the bottom bar instead of hiding behind it. */
  .ui2 .helper-fab { bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 60; }
  /* The design save bar floats above the bottom bar too, and its words wrap instead of being cut off. */
  .ui2 .save-bar { bottom: calc(92px + env(safe-area-inset-bottom)); flex-wrap: wrap; justify-content: flex-end; }
  .ui2 .save-bar #designStatus { flex: 1 1 100%; margin: 0 0 2px; font-size: .88rem; }
  /* Three buttons fit one row, so the bar stays low and the helper button can sit clear above it. */
  .ui2 .save-bar { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 6px; padding: 10px 12px; }
  .ui2 .save-bar .btn { min-height: 40px; padding: 0 10px; font-size: .92rem; }
  .ui2 .save-bar #designStatus { grid-column: 1 / -1; }
  body.ds-menu .helper-fab { bottom: calc(92px + 112px + env(safe-area-inset-bottom)); }
}

/* ---------- The design preview ---------- */

/* On a phone the preview fills the screen: the bars and the helper button step aside. */
body.preview-open { overflow: hidden; }
body.preview-open .u-rail, body.preview-open .u-top, body.preview-open .helper-fab, body.preview-open .save-bar, body.preview-open .u-tabs { display: none !important; }
@media (max-width: 900px) {
  .ui2 .design-preview { z-index: 90; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
}
/* On a computer it stays in one place beside the form, below the top bar, and as tall as the window allows. */
@media (min-width: 901px) {
  /* Tall enough to use, short enough to stay clear of the save bar, so it never gets pushed up at the end of the form. */
  .ui2 .design-preview { position: sticky; top: 104px; display: flex; flex-direction: column; height: calc(100dvh - 214px); min-height: 440px; }
  .ui2 .design-preview .phone { flex: 1; height: auto; min-height: 0; }
}

/* ---------- The helper on a computer: a panel in the corner, not a phone sheet ---------- */
@media (min-width: 900px) {
  .helper-sheet { margin-block: auto 24px; margin-inline: auto 24px; width: 440px; height: min(680px, calc(100dvh - 48px)); border-radius: 18px; box-shadow: var(--shadow-lift, 0 20px 50px rgba(0,0,0,.3)); }
  .helper-sheet::backdrop { background: rgba(0, 0, 0, .12); }
}
/* On the design screen the helper button waits above the floating save bar instead of covering Save. */
@media (min-width: 900px) {
  body.ds-menu .helper-fab { bottom: 104px; }
}

/* The AI helper slides in and out (a bottom sheet on a phone, a side panel on a computer) instead of snapping shut. */
@keyframes helper-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes helper-out { to { opacity: 0; transform: translateY(24px); } }
@keyframes helper-fade { from { opacity: 0; } }
@keyframes helper-fade-out { to { opacity: 0; } }
.ui2 .helper-sheet[open] { animation: helper-in .22s cubic-bezier(.2, .8, .2, 1); }
.ui2 .helper-sheet[open]::backdrop { animation: helper-fade .22s ease; }
.ui2 .helper-sheet.closing { animation: helper-out .2s ease forwards; }
.ui2 .helper-sheet.closing::backdrop { animation: helper-fade-out .2s ease forwards; }
@media (prefers-reduced-motion: reduce) { .ui2 .helper-sheet[open], .ui2 .helper-sheet[open]::backdrop { animation: none; } }
.glass-toggle { margin-top: 14px; }

/* Groups of fields: a grid with room between the fields (two a row when there is space), and space between loose ones. */
.ui2 .edit-grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin-bottom: 12px; }
.ui2 .card > label, .ui2 .card > .edit-grid + label { margin-top: 12px; }
.ui2 .card > h2 + label, .ui2 .card > h2 + .edit-grid, .ui2 .card > p + label { margin-top: 0; }

/* The login card never wider than the screen (its padding counts inside the width), and no blank gap while there is no error. */
.ui2 .auth-card { box-sizing: border-box; }
.ui2 .auth-card .error:empty { display: none; }

.ui2 .passkey-confirm { margin: 12px 0; }
.ui2 .redirect-row { align-items: end; } .ui2 .redirect-row .btn { min-height: 44px; }

/* Arabic letters join: no tightening of headings and big numbers' labels */
html[lang="ar"] .ui2 :is(h1, h2, h3, h4, strong) { letter-spacing: 0; }
