:root { --primary:#1E40AF; --bg:#F4F6FB; --dim:#5B6472; --border:#E5E7EB; --danger:#B91C1C; --ok:#166534; }
* { box-sizing:border-box; margin:0; }
body { font-family:system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif; background:var(--bg); color:#0f172a; }
/* R6 bilingual panel: sides are written as start/end, so one sheet draws both
   directions. Arabic letters need more room between lines than Latin ones. */
html[lang="ar"] body { line-height:1.7; }
html[lang="ar"] main[lang="en"] { line-height:normal; }
main { max-width:640px; margin:0 auto; padding:24px 16px 64px; }
.topbar { display:flex; justify-content:space-between; align-items:center; background:#fff;
          border-bottom:1px solid var(--border); padding:12px 20px; }
.topbar .brand { font-weight:800; color:var(--primary); text-decoration:none; display:block; line-height:0; }
.topbar .brand img { height:44px; width:auto; display:block; }
.topbar nav { display:flex; gap:4px 18px; align-items:center; flex-wrap:wrap; justify-content:flex-end; }
.topbar a { color:#0f172a; text-decoration:none; font-weight:600; }
.topbar a.lang-switch { color:var(--dim); font-weight:600; border:1px solid var(--border); border-radius:99px;
                        padding:3px 12px; font-size:14px; white-space:nowrap; }
.topbar a.lang-switch:hover { color:var(--primary); border-color:var(--primary); }
/* R6.2: the six-group menu. A group is a <details>; its list drops under it. */
.topbar a.here, .topbar details.menu.here > summary { color:var(--primary); }
.topbar details.menu { position:relative; }
.topbar details.menu > summary { list-style:none; cursor:pointer; font-weight:600; padding:6px 0;
                                 white-space:nowrap; user-select:none; }
.topbar details.menu > summary::-webkit-details-marker { display:none; }
.topbar details.menu > summary::after { content:""; display:inline-block; margin-inline-start:6px;
                                        border:4px solid transparent; border-top-color:currentColor;
                                        transform:translateY(2px); }
.topbar details.menu > summary:focus-visible { outline:2px solid var(--primary); outline-offset:3px; border-radius:4px; }
.menu-list { position:absolute; inset-inline-end:0; top:100%; z-index:20; min-width:210px; display:flex; flex-direction:column;
             background:#fff; border:1px solid var(--border); border-radius:12px; padding:6px;
             box-shadow:0 8px 24px rgba(15,23,42,.12); }
.menu-list a, .menu-list button.link { display:block; width:100%; padding:9px 12px; border-radius:8px;
                                       font:inherit; font-weight:600; color:#0f172a; text-align:start; white-space:nowrap; }
.menu-list a:hover, .menu-list a[aria-current], .menu-list button.link:hover { background:var(--bg); }
.menu-list a[aria-current] { color:var(--primary); }
.menu-list .menu-who { padding:8px 12px; border-bottom:1px solid var(--border); margin-bottom:4px;
                       overflow:hidden; text-overflow:ellipsis; max-width:260px; }
/* The address is Latin (dir="auto" makes its own line left-to-right); in an
   Arabic menu it still lines up with the items under it. */
html[dir="rtl"] .menu-list .menu-who { text-align:right; }
.menu-list form { margin:4px 0 0; padding-top:4px; border-top:1px solid var(--border); }
@media (max-width:760px) {
  .topbar.grouped { flex-direction:column; align-items:flex-start; gap:8px; }
  /* The list hangs from the whole menu, not from its own group, so a group
     near the right edge cannot push its list off the screen. */
  .topbar.grouped nav { justify-content:flex-start; position:relative; align-self:stretch; }
  .topbar.grouped details.menu { position:static; }
  .topbar.grouped .menu-list { inset-inline:0; min-width:0; }
}
h1 { font-size:22px; margin:18px 0 6px; }
/* Tenant's uploaded logo as the page hero. Bounded on BOTH axes and
   object-fit:contain, so a tall square mark and a wide wordmark both land at a
   sane size — the upload is only constrained to 2 MB, not to any shape. */
.hero-logo { display:block; max-height:72px; max-width:240px; width:auto; height:auto;
             object-fit:contain; margin:20px 0 2px; }
.sub { color:var(--dim); margin-bottom:18px; }
.card { background:#fff; border:1px solid var(--border); border-radius:14px; padding:20px; margin-bottom:14px; }
label { display:block; font-weight:600; font-size:14px; margin:12px 0 4px; }
input, select, textarea { width:100%; padding:10px 12px; border:1px solid var(--border);
                          border-radius:10px; font-size:15px; background:#fff; }
textarea { min-height:70px; }
/* An address or a password is typed left to right in either language; in an
   Arabic page it still sits under its label, on the right. */
html[dir="rtl"] main:not([dir]) input[type="email"],
html[dir="rtl"] main:not([dir]) input[type="password"] { direction:ltr; text-align:right; }
/* A sign-in name or a password shown to be copied by hand reads left to right. */
html[dir="rtl"] main:not([dir]) code { direction:ltr; unicode-bidi:isolate; }
button { background:var(--primary); color:#fff; border:0; border-radius:10px;
         padding:11px 18px; font-size:15px; font-weight:700; cursor:pointer; margin-top:14px; }
button:disabled { background:#9CA3AF; }
button.link { background:none; color:var(--primary); padding:0; margin:0; font-weight:600; }
button.secondary { background:#fff; color:var(--primary); border:1px solid var(--primary); }
form.inline { display:inline; }
.error { background:#FEF2F2; border:1px solid #FECACA; color:var(--danger);
         border-radius:10px; padding:10px 14px; margin:10px 0; font-size:14px; }
.notice { background:#F0FDF4; border:1px solid #BBF7D0; color:var(--ok);
          border-radius:10px; padding:10px 14px; margin:10px 0; font-size:14px; }
.warn { background:#FFF7E0; border:1px solid #F0D48A; border-radius:10px; padding:14px; font-size:14px; }
.muted { color:var(--dim); font-size:13px; }
.steps { display:flex; gap:6px; margin:16px 0 20px; flex-wrap:wrap; }
.steps span { font-size:12px; font-weight:700; padding:4px 10px; border-radius:99px;
              background:#E5E7EB; color:var(--dim); }
.steps span.active { background:var(--primary); color:#fff; }
.sub-ok { color:var(--ok); font-size:13px; font-weight:600; }
.sub-bad { color:var(--danger); font-size:13px; font-weight:600; }
.plan { display:flex; justify-content:space-between; align-items:center; gap:12px;
        background:#fff; border:1px solid var(--border); border-radius:14px; padding:16px 18px; margin-bottom:12px; }
.plan .price { color:var(--primary); font-weight:800; font-size:20px; }
table { width:100%; border-collapse:collapse; background:#fff; border:1px solid var(--border); border-radius:12px; }
th, td { text-align:start; padding:10px 12px; border-bottom:1px solid var(--border); font-size:14px; }
th { color:var(--dim); font-size:12px; text-transform:uppercase; }
/* m116: an email address has no space to wrap at, so in a table it set the column's
   width and pushed the Users table past a phone's screen (402 px in 375). It may break
   anywhere; every other word in the row still wraps only between words. */
.email { overflow-wrap:anywhere; }
.status-chip { display:inline-block; padding:4px 12px; border-radius:99px; font-weight:700; font-size:13px;
               background:#E5E7EB; }
.status-chip.active { background:#DCFCE7; color:var(--ok); }
.status-chip.failed { background:#FEE2E2; color:var(--danger); }
/* Backlog #9: tone classes cover every lifecycle state, so past_due /
   suspended / terminated read as problems rather than neutral progress. */
.status-chip.bad { background:#FEE2E2; color:var(--danger); }
/* M50: a tenant on a removal clock is neither fine nor finished. Without
   its own rule 'grace' fell through to the neutral grey default and read,
   in a list of tenants, exactly like a state nobody need look at. */
.status-chip.grace { background:#FEF3C7; color:#92400E; }
.status-chip.ok  { background:#DCFCE7; color:var(--ok); }
/* Payment/support guidance under a bad state — needs to be read, not skimmed. */
#status-help { background:#FEF3C7; border-inline-start:4px solid #D97706; padding:10px 12px;
               border-radius:6px; line-height:1.5; }

/* M10b: edition choice in the wizard */
.edition-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:10px; margin:6px 0 16px; }
.edition-opt { display:block; border:1px solid var(--border); border-radius:12px; padding:12px 14px; cursor:pointer; }
.edition-opt input { margin-inline-end:8px; }
.edition-opt:has(input:checked) { border-color:var(--primary); box-shadow:0 0 0 2px rgba(30,64,175,.15); }
.edition-opt .muted { margin-top:4px; }
