/* El Mimar Store — base stylesheet.
   Dependency-free on purpose: the storefront must render fast and identically
   on a customer's shared host with no CDN reachable. */

:root {
  color-scheme: light dark;

  --bg:        #f7f8fa;
  --surface:   #ffffff;
  --surface-2: #f1f3f7;
  --border:    #e2e6ee;
  --text:      #12161f;
  --muted:     #5b6474;

  --accent:      #b3853a;
  --accent-soft: #f5ecdc;
  --accent-text: #7a5716;

  --ok:     #16794c;
  --warn:   #9a6a00;
  --danger: #b3261e;
  --info:   #1f5f9e;

  /* Layout */
  --container:        1120px;
  --container-narrow: 760px;

  /* Spacing scale. Every gap, padding and margin in the components below is
     one of these, so a preset that wants a denser or airier site changes a
     handful of numbers here rather than hunting through rules. */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;

  /* Type scale. `--scale` is the one knob the appearance screen exposes
     (compact / regular / large); every size derives from it. */
  --scale: 1;
  --text-xs:   calc(13px * var(--scale));
  --text-sm:   calc(14px * var(--scale));
  --text-ui:   calc(15px * var(--scale));
  --text-base: calc(16px * var(--scale));
  --text-md:   calc(18px * var(--scale));
  --text-lg:   calc(20px * var(--scale));
  --text-xl:   calc(24px * var(--scale));
  --text-2xl:  calc(30px * var(--scale));
  --text-3xl:  clamp(calc(30px * var(--scale)), 5vw, calc(46px * var(--scale)));
  --lh:        1.7;
  --lh-tight:  1.2;
  --lh-loose:  1.9;

  --radius: 12px;
  --radius-sm:   calc(var(--radius) * .66);
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);

  /* Text placed ON the accent (buttons, active pills). Dark enough to read on
     every preset's accent, light or dark. */
  --on-accent: #1a1205;

  --font: "Segoe UI", "Noto Kufi Arabic", "Cairo", system-ui, -apple-system, Tahoma, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0f1115;
    --surface:   #171a21;
    --surface-2: #1e222b;
    --border:    #2a303c;
    --text:      #e8eaed;
    --muted:     #97a0b0;

    --accent:      #d8ab5c;
    --accent-soft: #2a2113;
    --accent-text: #e8c48a;

    --ok:     #4ec38a;
    --warn:   #e0b355;
    --danger: #f08a83;
    --info:   #6cb2ec;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--text-base)/var(--lh) var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

.container { width: min(var(--container), 100% - var(--space-6)); margin-inline: auto; }

/* ── Header ─────────────────────────────────────────────── */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .bar {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}

.brand {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--text-md);
}

.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: var(--text-ui);
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { color: var(--accent-text); background: var(--accent-soft); }

.header-actions { display: flex; align-items: center; gap: 8px; }

/* The collapsible half of the header. On desktop it is invisible plumbing:
   a flex row that carries nav + actions exactly as before. */
.site-menu { display: flex; align-items: center; gap: 24px; flex: 1; min-width: 0; }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  margin-inline-start: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  place-items: center;
}
.nav-toggle-bars { display: grid; gap: 4px; }
.nav-toggle-bars i { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Phones and small tablets: the bar wraps, the brand and the toggle share the
   first row, and the menu takes a full-width row beneath — stacked, tappable,
   and never wider than the screen. */
@media (max-width: 860px) {
  .site-header .bar { flex-wrap: wrap; gap: 12px; }
  .nav-toggle { display: grid; }
  .site-menu {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 6px 0 14px;
    border-top: 1px solid var(--border);
  }
  /* Only hide when JS has taken over; without it the menu stays open. */
  html.js .site-menu:not(.is-open) { display: none; }
  .site-menu .nav { flex-direction: column; gap: 2px; }
  .site-menu .nav a { padding: 12px 12px; font-size: var(--text-base); }
  .site-menu .header-actions { flex-wrap: wrap; gap: 8px; }
  .site-menu .header-actions .btn { flex: 1 1 auto; text-align: center; }
  .site-menu .header-actions form { display: contents; }
  .site-menu .lang-switch { margin-inline-start: 0; width: 100%; justify-content: stretch; }
  .site-menu .lang-switch a { flex: 1; text-align: center; }
  .site-header.layout-centered .nav-row { display: none; }
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-ui);
  font-weight: 600;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover { filter: brightness(1.06); background: var(--accent); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: var(--text-sm); }

/* ── Cards, grid ────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 4px; font-size: var(--text-md); }
.card .sub { margin: 0 0 20px; color: var(--muted); font-size: var(--text-sm); }

.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.stat { text-align: start; }
.stat .label { color: var(--muted); font-size: var(--text-sm); margin-bottom: 6px; }
.stat .value { font-size: var(--text-2xl); font-weight: 700; line-height: 1.2; }

/* ── Forms ──────────────────────────────────────────────── */

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: var(--text-sm); font-weight: 600; }

.input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: var(--text-ui);
}
.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.help { color: var(--muted); font-size: var(--text-xs); margin-top: 6px; }

/* ── Alerts ─────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  margin-bottom: 20px;
  font-size: var(--text-ui);
}
.alert-success { border-color: var(--ok);     color: var(--ok); }
.alert-danger  { border-color: var(--danger); color: var(--danger); }
.alert-warning { border-color: var(--warn);   color: var(--warn); }
.alert-info    { border-color: var(--info);   color: var(--info); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.badge-accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* ── Layout shells ──────────────────────────────────────── */

.page { padding: var(--space-6) 0 calc(var(--space-6) * 2); }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0 0 4px; font-size: var(--text-xl); }
.page-head p  { margin: 0; color: var(--muted); }

.shell { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  position: sticky;
  top: 88px;
}
.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: var(--text-ui);
}
.sidebar a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* ── Hero ───────────────────────────────────────────────── */

.hero { padding: var(--space-8) 0 var(--space-7); text-align: center; }
.hero h1 { font-size: var(--text-3xl); margin: 0 0 14px; letter-spacing: -.02em; }
.hero p  { font-size: var(--text-md); color: var(--muted); max-width: 620px; margin: 0 auto 28px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Auth ───────────────────────────────────────────────── */

.auth-wrap { min-height: 78vh; display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: min(420px, 100%); }

/* ── Footer ─────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  color: var(--muted);
  font-size: var(--text-sm);
}
.site-footer .bar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ── Error pages ────────────────────────────────────────── */

.error-page { min-height: 72vh; display: grid; place-items: center; text-align: center; padding: 40px 16px; }
.error-page .code { font-size: 76px; font-weight: 800; color: var(--accent); line-height: 1; }
.error-page h1 { margin: 12px 0 8px; font-size: 22px; }
.error-page p  { color: var(--muted); margin: 0 0 24px; }

/* --- Google sign-in --------------------------------------------------- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 16px;
    color: var(--muted);
    font-size: var(--text-xs);
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    font-weight: 600;
}
.btn-google:hover { background: #f7f8f8; border-color: #c9ccd0; }
.btn-google svg { flex: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* --- Language switcher ------------------------------------------------ */
.lang-switch {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.lang-switch a {
    padding: 5px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.4;
    color: var(--muted);
    text-decoration: none;
    background: var(--surface);
}
.lang-switch a + a { border-inline-start: 1px solid var(--border); }
.lang-switch a:hover { color: var(--text); }
.lang-switch a.is-on { background: var(--accent); color: #fff; }

/* --- Per-locale field groups ------------------------------------------ */
.lang-block {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px 4px;
    margin: 0 0 16px;
}
.lang-block > legend {
    padding: 0 8px;
    font-weight: 600;
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: 8px;
}
.tone-danger-text { color: var(--danger, #a63d31); }

/* --- Knowledge base --------------------------------------------------- */
.kb-search { display: flex; gap: 10px; margin: 18px 0 24px; }
.kb-search .input { flex: 1; }
.kb-result h2, .kb-result h3 { margin: 0 0 6px; font-size: var(--text-md); }
.kb-result .sub { margin: 0; }
.kb-suggest { border-inline-start: 3px solid var(--accent); }
.kb-suggest-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.kb-suggest-list a { font-weight: 600; }
.kb-suggest-list p { margin: 2px 0 0; }
.kb-vote .btn-row { margin-top: 8px; }

/* --- Product tabs ------------------------------------------------------
   Without JavaScript every panel is visible and the bar is a table of
   contents — a working page. `.js-tabs` is added by the script, and only
   then are the inactive panels hidden.                                   */
.tabs-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.tab-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    font-weight: 600;
    font-size: var(--text-ui);
    color: var(--muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab-link:hover { color: var(--text); }
.tab-link.is-on { color: var(--accent); border-bottom-color: var(--accent); }
.tab-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.tab-panel { padding-block: 8px; }
.tab-title { margin: 0 0 16px; }

/* Scroll-margin so an anchor jump does not tuck the heading under a
   sticky header. */
.tab-anchor { display: block; scroll-margin-top: 90px; }

.js-tabs .tab-panel { display: none; }
.js-tabs .tab-panel.is-on { display: block; }
/* With JavaScript the bar names the section, so the repeated heading is
   redundant — it stays in the markup for the no-JS and print cases. */
.js-tabs .tab-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 640px) {
    .tabs-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .tabs-bar::-webkit-scrollbar { display: none; }
    .tab-link { white-space: nowrap; }
}

/* --- Header and footer variants --------------------------------------- */
.site-header.is-sticky { position: sticky; top: 0; z-index: 40; }

.site-header.layout-centered .bar { flex-wrap: wrap; justify-content: center; }
.site-header.layout-centered .nav-row { display: flex; justify-content: center; padding-bottom: 8px; }
.site-header.layout-centered .nav-row .nav { justify-content: center; }

.footer-cols {
    display: grid;
    grid-template-columns: 1.4fr repeat(auto-fit, minmax(150px, 1fr));
    gap: 28px;
    padding-block: 24px;
}
.footer-col h3 { font-size: var(--text-sm); margin: 0 0 10px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { font-size: var(--text-sm); color: var(--muted); text-decoration: none; }
.footer-col a:hover { color: var(--text); }
.footer-brand p { margin: 6px 0 0; font-size: var(--text-sm); }
.footer-social { display: inline-flex; gap: 12px; }
.footer-social a { color: var(--muted); text-decoration: none; font-size: var(--text-xs); }
.footer-social a:hover { color: var(--accent); }

/* --- Preset picker (admin) -------------------------------------------- */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.preset {
    display: block;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}
.preset.is-on { border-color: var(--accent); }
.preset input { position: absolute; opacity: 0; pointer-events: none; }
.preset strong { display: block; margin-top: 10px; }
.preset .help { margin: 4px 0 0; }
.preset-swatches { display: flex; gap: 0; border-radius: 6px; overflow: hidden; }
.preset-swatches span { flex: 1; height: 34px; }

@media (max-width: 640px) {
    .footer-cols { grid-template-columns: 1fr; gap: 20px; }
}

/* --- Product page: raw HTML mode --------------------------------------
   A container, not a reset. The pasted markup brings its own styling; all
   this does is stop it running edge to edge and give it the same tokens
   the rest of the site uses, so a page written here follows the theme and
   its dark mode without extra work.                                     */
.product-html {
    max-width: 100%;
    overflow-x: auto;
}

/* --- Product admin: screen nav and mode switch ------------------------ */
.product-admin-nav { margin-bottom: 22px; }

.mode-switch { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.mode-switch .mode {
    display: block;
    padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}
.mode-switch .mode.is-on { border-color: var(--accent); }
.mode-switch .mode.is-locked { opacity: .55; cursor: not-allowed; }
.mode-switch .mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode-switch .mode strong { display: block; }
.mode-switch .mode .help { display: block; margin-top: 4px; }

.code-editor {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: var(--text-xs);
    line-height: 1.7;
    tab-size: 2;
}

/* ─── Pagination ─────────────────────────────────────────────
   Built from the same tokens as everything else, so a theme preset
   restyles it without touching this block. */
.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: var(--text-sm);
}
.pagination .pages { display: flex; flex-wrap: wrap; gap: 4px; }
.pagination .pages a,
.pagination .pages .current {
    display: inline-block;
    min-width: 34px;
    padding: 5px 9px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) / 2);
    text-decoration: none;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.pagination .pages a:hover { border-color: var(--accent); color: var(--accent-text); }
.pagination .pages .current { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.pagination .muted { color: var(--muted); }

/* Search bar in an admin list header. */
.search-bar { display: flex; gap: 6px; align-items: center; }
.search-bar .input { min-width: 200px; }

/* The global box in the admin header. Full width because what gets pasted
   into it is a licence key or a URL, and a 200px field hides both. */
.admin-search { margin-bottom: 16px; }
.admin-search .input { flex: 1; min-width: 0; }

/* ═══ Blocks, catalogue, builder ═══════════════════════════════════════════ */

.container-narrow { width: min(var(--container-narrow), 100% - var(--space-6)); margin-inline: auto; }

.block { padding: 56px 0; }
.block-tight { padding: 24px 0; }
.block-title { text-align: center; font-size: clamp(calc(22px * var(--scale)), 3vw, var(--text-2xl)); margin: 0 0 8px; }
.block-sub   { text-align: center; color: var(--muted); margin: 0 auto 32px; max-width: 620px; }
.block-note  { text-align: center; color: var(--muted); font-size: var(--text-sm); margin-top: 20px; }

.block-hero { padding: 80px 0 56px; text-align: center; }
.block-hero.is-start { text-align: start; }
.block-hero h1 { font-size: var(--text-3xl); margin: 14px 0; letter-spacing: -.02em; }
.block-hero .lead { font-size: var(--text-md); color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.block-hero.is-start .lead { margin-inline: 0; }
.block-hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.block-hero.is-start .cta { justify-content: flex-start; }
.hero-image { margin-top: 40px; border-radius: var(--radius); border: 1px solid var(--border); }

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.feature-icon { font-size: var(--text-xl); margin-bottom: 10px; }
.feature h3 { margin: 0 0 6px; font-size: var(--text-md); }
.feature p  { margin: 0; color: var(--muted); font-size: var(--text-ui); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.step  { display: flex; gap: 16px; align-items: flex-start; padding: 18px 22px; }
.step h3 { margin: 0 0 4px; font-size: var(--text-base); }
.step p  { margin: 0; color: var(--muted); font-size: var(--text-ui); }
.step-num {
  flex: 0 0 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700;
}

.faq { display: grid; gap: 10px; }
.faq-item { padding: 0; }
.faq-item summary { cursor: pointer; padding: 16px 22px; font-weight: 600; list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; float: inline-end; color: var(--muted); }
.faq-item[open] summary::after { content: "\2212"; }
.faq-item p { margin: 0; padding: 0 22px 18px; color: var(--muted); }

.quote p { margin: 0 0 14px; font-size: var(--text-ui); }
.quote footer { font-size: var(--text-sm); }

.shot img { border-radius: 8px; border: 1px solid var(--border); display: block; }
.shot figcaption { margin-top: 10px; font-size: var(--text-sm); color: var(--muted); }

.video-frame { padding: 0; overflow: hidden; }
.video-frame iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }

.prose { line-height: 1.9; }
.prose h3 { margin: 24px 0 8px; font-size: var(--text-md); }
.prose h3:first-child { margin-top: 0; }
.prose p  { margin: 0 0 14px; }
.prose ul { padding-inline-start: 22px; }

.cta-band {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; background: var(--accent-soft); border-color: transparent;
}
.cta-band h2 { margin: 0 0 6px; font-size: var(--text-lg); color: var(--accent-text); }
.cta-band p  { margin: 0; color: var(--muted); }

/* ── Tables ─────────────────────────────────────────────── */

.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-ui); }
.table th, .table td { padding: 14px 18px; text-align: start; border-bottom: 1px solid var(--border); }
.table thead th { background: var(--surface-2); font-size: var(--text-sm); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .is-us { color: var(--accent-text); font-weight: 600; }
.muted { color: var(--muted); }

/* ── Plans ──────────────────────────────────────────────── */

.plans { align-items: stretch; }
.plan { display: flex; flex-direction: column; position: relative; }
.plan.is-default { border-color: var(--accent); }
.plan.is-sold-out { opacity: .6; }
.plan-badge { position: absolute; inset-block-start: -10px; inset-inline-end: 20px; }
.plan-name { margin: 0 0 12px; font-size: var(--text-md); }
.plan-price { margin-bottom: 18px; }
.plan-price .amount { font-size: var(--text-2xl); font-weight: 700; display: block; }
.plan-price .cycle  { color: var(--muted); font-size: var(--text-sm); }

.plan-meta { list-style: none; padding: 0; margin: 0 0 18px; font-size: var(--text-sm); }
.plan-meta li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.plan-meta li:last-child { border-bottom: 0; }
.plan-meta span { color: var(--muted); }

.plan-features { list-style: none; padding: 0; margin: 0 0 18px; font-size: var(--text-ui); }
.plan-features li { padding: 5px 0; }
.plan-features li::before { content: "\2713\00a0"; color: var(--ok); font-weight: 700; }

.plan-remaining { font-size: var(--text-xs); color: var(--warn); margin: 0 0 14px; }
.plan-remaining.is-out { color: var(--danger); }
.plan .btn { margin-top: auto; }

.pricing-group { margin-bottom: 56px; }

/* ── Product cards ──────────────────────────────────────── */

.product-card { display: block; color: inherit; padding: 0; overflow: hidden; }
.product-card:hover { text-decoration: none; border-color: var(--accent); }
.product-thumb { width: 100%; display: block; border-bottom: 1px solid var(--border); }
.product-body { padding: 22px 24px; }
.product-body h3 { margin: 10px 0 6px; font-size: var(--text-md); }
.product-body p  { margin: 0; color: var(--muted); font-size: var(--text-ui); }
.product-price { margin-top: 16px; }
.product-price .from { color: var(--muted); font-size: var(--text-xs); display: block; }
.product-price strong { font-size: var(--text-lg); }

/* ── Footer ─────────────────────────────────────────────── */

.footer-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-meta { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); font-size: var(--text-xs); }
.footer-meta a { color: var(--muted); padding: 0 4px; }
.footer-meta a.is-current { color: var(--accent-text); font-weight: 700; }

/* ── Admin forms ────────────────────────────────────────── */

.toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.form-actions { display: flex; gap: 10px; margin: 20px 0; }
.row-actions { display: flex; gap: 8px; }
.switches { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 8px; font-size: var(--text-ui); }
.switches label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.btn.is-danger { border-color: var(--danger); color: var(--danger); }
.btn.is-danger:hover { background: var(--danger); color: #fff; }

.plan-editor { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; }
.plan-editor > summary { padding: 14px 18px; cursor: pointer; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.plan-editor > form { padding: 0 18px 18px; }

/* ── Builder ────────────────────────────────────────────── */

.builder-block { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; background: var(--bg); }
.builder-block-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); border-radius: 10px 10px 0 0;
}
.builder-block-title { font-weight: 600; font-size: var(--text-ui); }
.builder-block-tools { display: flex; gap: 4px; }
.builder-block-body { padding: 16px; }

.icon-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 7px; width: 30px; height: 30px; cursor: pointer; font: inherit; font-size: var(--text-sm);
}
.icon-btn:hover { color: var(--text); }
.icon-btn.is-danger { color: var(--danger); border-color: var(--danger); }

.builder-picker { display: flex; gap: 10px; margin-top: 16px; }
.builder-picker select { max-width: 320px; }

.repeater { border-inline-start: 3px solid var(--border); padding-inline-start: 14px; }
.repeater-items { margin-bottom: 10px; }
.repeater-item { border: 1px dashed var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.repeater-head { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.repeater-head .muted { margin-inline-end: auto; font-size: var(--text-xs); }

/* ═══ Checkout, orders, invoices, licences ═══════════════════════════════════════════ */

.checkout-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 860px) { .checkout-grid { grid-template-columns: 1fr; } }

.summary { position: sticky; top: 88px; }
.summary-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 14px 0; margin: 6px 0 16px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.summary-total strong { font-size: var(--text-xl); }

.coupon-row { display: flex; gap: 8px; }
.coupon-row .input { flex: 1; }

.help.is-ok  { color: var(--ok); }
.help.is-err { color: var(--danger); }

.addon-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px dashed var(--border); cursor: pointer;
}
.addon-row:last-child { border-bottom: 0; }
.addon-row > span { flex: 1; font-size: var(--text-ui); }
.addon-price { white-space: nowrap; }

/* ── Status tones ───────────────────────────────────────── */

.badge.tone-success { background: color-mix(in srgb, var(--ok) 14%, transparent);     color: var(--ok);     border-color: transparent; }
.badge.tone-danger  { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-color: transparent; }
.badge.tone-warning { background: color-mix(in srgb, var(--warn) 16%, transparent);   color: var(--warn);   border-color: transparent; }
.badge.tone-info    { background: color-mix(in srgb, var(--info) 14%, transparent);   color: var(--info);   border-color: transparent; }

/* ── Tables ─────────────────────────────────────────────── */

.table-flush { margin: 0; }
.table-flush td { padding: 12px 0; }
.table-flush tr:last-child td { border-bottom: 0; }
.table .is-total td { border-top: 2px solid var(--border); border-bottom: 0; }
.nowrap { white-space: nowrap; }

/* ── Filters ────────────────────────────────────────────── */

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: var(--text-sm);
}
.filter:hover { text-decoration: none; color: var(--text); }
.filter.is-active { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; font-weight: 600; }
.filter .count {
  display: inline-block; margin-inline-start: 6px; padding: 0 7px;
  border-radius: 999px; background: var(--surface-2); font-size: 12px;
}


/* ── Timeline, lists ────────────────────────────────────── */

.timeline { list-style: none; padding: 0; margin: 0; font-size: var(--text-ui); }
.timeline li { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .muted { margin-inline-end: 10px; font-size: var(--text-xs); }

.tight-list { margin: 8px 0 0; padding-inline-start: 20px; }
.tight-list li { margin: 4px 0; }

.notif-list { list-style: none; padding: 0; margin: 0; font-size: var(--text-ui); }
.notif-list li { padding: 10px 0; border-bottom: 1px dashed var(--border); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list a { margin-inline-start: 8px; }

.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.stat.is-alert { border-color: var(--warn); }
.stat .btn { margin-top: 10px; }

/* M3 — payment methods */

.method { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.method > summary { padding: 12px 16px; cursor: pointer; font-weight: 600; }
.method > *:not(summary) { padding-inline: 16px; }
.method > form { padding-bottom: 16px; }

.pay-details {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px; margin: 0 16px 14px; font-size: var(--text-sm);
  font-family: ui-monospace, Consolas, monospace; white-space: pre-wrap; overflow-x: auto;
}

/* M4 — licences */

.license-key {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 16px;
}
.license-key code {
  font-size: var(--text-md); font-weight: 700; letter-spacing: .06em;
  font-family: ui-monospace, Consolas, monospace;
}

/* M5 — releases */

.changelog { margin-top: 6px; }
.changelog > summary { cursor: pointer; font-size: var(--text-xs); color: var(--muted); }
.changelog pre {
  white-space: pre-wrap; font-size: var(--text-xs); margin: 8px 0 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}

/* ═══ Support tickets ═══════════════════════════════════════════ */

.ticket-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 980px) { .ticket-layout { grid-template-columns: 1fr; } }

.thread { display: grid; gap: 12px; margin-bottom: 20px; }

.thread-msg {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px; box-shadow: var(--shadow);
}
.thread-msg header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.thread-msg header .muted { margin-inline-start: auto; font-size: var(--text-xs); }

/* Staff replies lean on the accent so a customer can tell at a glance
   which messages are ours. */
.thread-msg.is-staff { border-inline-start: 3px solid var(--accent); }

/* Internal notes are visually loud on purpose — an agent must never mistake
   one for something the customer can read. */
.thread-msg.is-internal {
  background: color-mix(in srgb, var(--warn) 8%, var(--surface));
  border-inline-start: 3px solid var(--warn);
}

.thread-body { line-height: 1.9; font-size: var(--text-ui); word-break: break-word; }

.thread-files { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

.thread-system {
  text-align: center; font-size: var(--text-xs); color: var(--muted);
  padding: 6px 0;
}

.table tr.is-breached td { background: color-mix(in srgb, var(--danger) 6%, transparent); }

.ctx-title {
  font-size: var(--text-xs); text-transform: none; color: var(--muted);
  margin: 18px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.ctx-title:first-of-type { margin-top: 0; }

.ctx-list { list-style: none; padding: 0; margin: 0; font-size: var(--text-sm); }
.ctx-list li { padding: 7px 0; border-bottom: 1px dashed var(--border); }
.ctx-list li:last-child { border-bottom: 0; }
.ctx-list .muted { font-size: 12px; margin-top: 2px; }

/* ═══ Installer ═══════════════════════════════════════════ */

.progress {
  height: 10px; border-radius: 999px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 10px;
}
.progress-bar {
  height: 100%; background: var(--accent);
  transition: width .4s ease;
}

.install-log {
  background: #0b0d11; color: #b9c4d2;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin: 0; max-height: 420px; overflow: auto;
  font-family: ui-monospace, Consolas, monospace; font-size: var(--text-xs); line-height: 1.7;
  white-space: pre-wrap; word-break: break-word; direction: ltr; text-align: left;
}

/* The consent card must not look like ordinary body copy — the customer is
   about to hand over server credentials. */
.alert-card {
  border-inline-start: 4px solid var(--warn);
  background: color-mix(in srgb, var(--warn) 6%, var(--surface));
}
.alert-card h2 { color: var(--warn); }

/* ═══ AI services ═══════════════════════════════════════════ */

.ai-output {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px; margin: 0;
  max-height: 620px; overflow: auto;
  font-family: inherit; font-size: var(--text-ui); line-height: 2;
  white-space: pre-wrap; word-break: break-word;
}

.credit-up   { color: var(--ok);     font-weight: 700; }
.credit-down { color: var(--danger); font-weight: 700; }

/* ═══ Utilities ══════════════════════════════════════════════
   The only place a template may reach for a one-off adjustment. Each maps to
   a token, so "a little more space" is still the same space as everywhere
   else — and none of it lives in a style attribute. */
.m-0  { margin: 0; }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: var(--space-5); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.pt-0 { padding-top: 0; }
.details-body { padding: 0 18px 18px; }
.max-w-2xs { max-width: 200px; }
.max-w-xs  { max-width: 280px; }
.max-w-sm  { max-width: 420px; }
.max-w-md  { max-width: 460px; }
.inline-form { display: inline; }
.is-spread { justify-content: space-between; }
.self-end  { align-self: end; }
.text-end  { text-align: end; }
.text-xs   { font-size: var(--text-xs); }
.pre-wrap  { white-space: pre-wrap; }
.scroll-x  { overflow-x: auto; }
.scroll-box { max-height: 420px; overflow: auto; }
