/* F9 Tweak control panel — Apple design language in the F9 brand.
   San Francisco system font, #f5f5f7 light surfaces, F9 violet (#7C3AED → #2563EB),
   generous whitespace, soft rounded cards, pill buttons. Full dark-mode support
   via prefers-color-scheme (Apple dark: true black + #1d1d1f surfaces).
   All tokens live in :root so the whole panel re-skins from here. */

:root {
  /* surfaces (Apple light) */
  --bg: #f5f5f7;
  --card: #ffffff;
  --card-2: #f5f5f7;
  --card-3: #ececef;
  --line: #d2d2d7;
  --line-hi: #c7c7cc;

  /* ink */
  --text: #1d1d1f;
  --white: #ffffff;
  --dim: #6e6e73;
  --faint: #86868b;

  /* F9 blue (the accent, matches the logo); yellow is the highlight/warn color */
  --accent: #2563EB;
  --warn: #B8860B;
  --accent-hi: #3B82F6;
  --accent-ink: #ffffff;
  --accent-dim: rgba(37,99,235,.12);

  /* status */
  --danger: #ff3b30;
  --ok: #34c759;

  /* chrome tint used by the nav bar */
  --bar: rgba(255,255,255,.72);
  --bar-line: rgba(0,0,0,.10);
  --shadow: rgba(0,0,0,.08);
  --shadow-2: rgba(0,0,0,.12);

  /* ---- flat app-screen surfaces (taste-skill: colour on data, not chrome;
         surfaces are flat, separated by a 1px line, not glass/glow/shadow) ---- */
  --glass: var(--card);        /* primary surface — solid, no translucency */
  --glass-2: var(--card-2);    /* nested surface / controls */
  --glass-3: var(--card-3);    /* faint surface */
  --glass-border: var(--line); /* quiet 1px rule, not a bright rim */
  --glass-hi: transparent;     /* no specular top highlight */
  --glass-blur: none;          /* no backdrop blur */
  --glass-shadow: 0 1px 2px rgba(0,0,0,.06);  /* at most one faint step */

  --r: 12px;
  --r-xl: 18px;
  --pill: 980px;
  --font: 'SF Pro Text', 'SF Pro Display', 'SF Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Monaco, monospace;
}

/* Dark palette (black + blue, yellow highlights). Applied when the OS is dark and
   no choice is saved, OR when the top-bar toggle forces dark. The two blocks below
   hold the SAME tokens — keep them in sync. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #000000;
    --card: #1d1d1f;
    --card-2: #161617;
    --card-3: #2a2a2c;
    --line: #38383a;
    --line-hi: #48484a;

    --text: #f5f5f7;
    --white: #ffffff;
    --dim: #a1a1a6;
    --faint: #86868b;

    --accent: #3B82F6;
    --warn: #FFC400;
    --accent-hi: #60A5FA;
    --accent-ink: #ffffff;
    --accent-dim: rgba(59,130,246,.22);

    --danger: #ff453a;
    --ok: #30d158;

    --bar: rgba(29,29,31,.62);
    --bar-line: rgba(255,255,255,.12);
    --shadow: rgba(0,0,0,.5);
    --shadow-2: rgba(0,0,0,.6);

    --glass: var(--card);
    --glass-2: var(--card-2);
    --glass-3: var(--card-3);
    --glass-border: var(--line);
    --glass-hi: transparent;
    --glass-blur: none;
    --glass-shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --card: #1d1d1f;
  --card-2: #161617;
  --card-3: #2a2a2c;
  --line: #38383a;
  --line-hi: #48484a;

  --text: #f5f5f7;
  --white: #ffffff;
  --dim: #a1a1a6;
  --faint: #86868b;

  --accent: #3B82F6;
  --warn: #FFC400;
  --accent-hi: #60A5FA;
  --accent-ink: #ffffff;
  --accent-dim: rgba(59,130,246,.22);

  --danger: #ff453a;
  --ok: #30d158;

  --bar: rgba(29,29,31,.62);
  --bar-line: rgba(255,255,255,.12);
  --shadow: rgba(0,0,0,.5);
  --shadow-2: rgba(0,0,0,.6);

  --glass: var(--card);
  --glass-2: var(--card-2);
  --glass-3: var(--card-3);
  --glass-border: var(--line);
  --glass-hi: transparent;
  --glass-blur: none;
  --glass-shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  /* Flat ground, no glow (taste-skill app-screen rule). Colour lives on data/actions. */
  background: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px; line-height: 1.55; font-weight: 400;
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
::selection { background: var(--accent-dim); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- icons ---- */
.ic { width: 1.05em; height: 1.05em; flex: 0 0 auto; vertical-align: -.15em; }
.ic-spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- top bar: Apple translucent nav ---- */
.topbar {
  display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  max-width: 980px; margin: 14px auto 0; padding: 11px 22px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--pill);
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
  position: sticky; top: 14px; z-index: 10;
}
/* Before a store signs in (no brand yet): just the word, centred. */
.topbar.plain { justify-content: center; }
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); flex: none; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 24px; height: 24px; border-radius: 7px; position: relative;
  background: var(--accent);
}
/* Light/dark toggle in the top bar: shows the icon of the mode you'd switch TO. */
.themetoggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; padding: 0; margin: 0; border-radius: var(--pill);
  background: var(--glass-2); border: 1px solid var(--glass-border);
  -webkit-appearance: none; appearance: none;
  color: var(--text); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.themetoggle:hover { border-color: var(--accent); background: var(--accent-dim); }
/* The two icons are DIRECT children of the button (same shape as .navtoggle/.opbell,
   which centre correctly). The old <span> wrappers made Safari mis-baseline the button
   and drop it ~10px; removing them is the real fix. Only the active icon is shown. */
.themetoggle .ic { width: 20px; height: 20px; }
.themetoggle .t-sun, .themetoggle .t-moon { display: none; }
.themetoggle[data-mode="light"] .t-moon,
.themetoggle[data-mode="dark"] .t-sun { display: block; }
.brand .mark::after {
  content: ""; position: absolute; inset: 0;
  margin: auto; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 2.5px rgba(255,255,255,.35);
}
.brand .word { font-size: 1.3rem; font-weight: 700; color: var(--text); letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand .word b { font-weight: 700; }
.brand .f9logo { width: 44px; height: 44px; border-radius: 10px; }
.topbar nav a.topbal { display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-border); font-size: .8rem; color: var(--dim); white-space: nowrap; }
.topbal b { color: var(--accent); font-size: .95rem; }
.topplus { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 50%; background: var(--accent); color: #fff; }
.topplus .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.topbar nav a.topbal:hover { border-color: var(--accent); }
.topbar nav a.opbell { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--pill); background: var(--glass-2);
  border: 1px solid var(--glass-border); color: var(--text); }
.topbar nav a.opbell:hover { border-color: var(--accent); background: var(--accent-dim); }
.opbell .ic { width: 20px; height: 20px; }
.opbellnum { position: absolute; top: -6px; inset-inline-end: -8px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; }
.opbellnum[hidden] { display: none; }
.opbell.ringing .ic { animation: bellring .9s ease-in-out 3; transform-origin: 50% 10%; }
@keyframes bellring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); }
  45% { transform: rotate(10deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); } }
@media (max-width: 560px) { .topbar nav { gap: 12px; } .topbal { font-size: .72rem; } }
.brand .storelogo { width: 42px; height: 42px; border-radius: 11px; object-fit: cover; background: #0003; }

/* store panel: identity preview + merged-app share link */
.storecard { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; padding: 12px 14px;
  border: 1px solid var(--glass-border); border-radius: 14px; }
.storecard img, .storecard .appicon { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; flex: none; }
.storecard a { font-size: .85rem; }

/* store panel «التطبيقات»: equal-height app cards; long feature lists scroll inside */
.appsnote { margin: 0 4px 14px; font-size: .85rem; }
.appgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 16px; }
.appcard .linkbtn, .appcard .linkbtn:hover { color: var(--accent); white-space: nowrap; }
.appcard { display: flex; flex-direction: column; gap: 12px; height: 520px; margin: 0; }
.apphead { display: flex; align-items: center; gap: 12px; }
.appimg { width: 56px; height: 56px; border-radius: 14px; flex: none; object-fit: contain;
  background: #fff; padding: 4px; box-sizing: border-box; }
.appimg.ph { display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1.4rem; }
img.appimg[src*="/apps/"], img.appimg[src*="/appicon/"] { background: none; padding: 0; object-fit: cover; }
.appname h2 { margin: 0; font-size: 1.1rem; }
.appname .muted { font-size: .78rem; }
.featbox { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  border: 1px solid var(--glass-border); border-radius: 12px; padding: 10px 12px; }
.feathead { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 600; margin-bottom: 6px; }
.feathead .linkbtn { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; }
.feats { list-style: none; margin: 0; padding: 0 0 0 4px; overflow-y: auto; flex: 1 1 auto; min-height: 0;
  scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }
.feats::-webkit-scrollbar { width: 6px; }
.feats::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.feats li { position: relative; padding: 5px 16px 5px 0; font-size: .84rem; border-bottom: 1px solid var(--glass-border); }
.feats li:last-child { border-bottom: 0; }
.feats li::before { content: ""; position: absolute; right: 2px; top: 12px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); }
.appout { display: flex; flex-direction: column; gap: 6px; }
.appout[hidden], .appmsg[hidden] { display: none; }
.appout .appdl { flex-direction: row; align-items: center; justify-content: center; gap: 6px; font-weight: 600; }
.linkrow { display: flex; gap: 8px; align-items: center; }
.linkrow .sharelink { flex: 1 1 auto; min-width: 0; width: auto; font-size: .75rem; margin: 0; }
.appexp, .appmsg { font-size: .78rem; }
.appform { margin: 0; }
/* export progress bar (app cards + package rows) */
.xbar { display: flex; flex-direction: column; gap: 5px; }
.xbar[hidden] { display: none; }
.xbar-track { display: block; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.xbar-fill { display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi)); transition: width .6s ease; }
.xbar-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .8rem; }
.xbar-pct { font-variant-numeric: tabular-nums; }
.xbar-eta { font-size: .75rem; min-height: 1em; }
.xbar-inline { width: min(260px, 100%); }
.appform button { width: 100%; margin: 0; }
/* «التخصيص»: عام / تخصيص أداة switch, tool header, picker + copy windows */
.lookhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.looktabs { margin-top: 0; }
.looktool { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; padding: 10px 12px;
  border: 1px solid var(--glass-border); border-radius: 14px; }
.looktool .appimg { width: 44px; height: 44px; border-radius: 11px; }
.looktool .pickagain { margin-inline-start: auto; color: var(--accent); }
.storerow { display: flex; align-items: center; gap: 12px; }
.storerow img, .storerow .appimg { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; }
.storerow .muted { font-size: .78rem; }
.storerow .badge { margin-inline-start: auto; font-size: .7rem; display: inline-flex; align-items: center; gap: 4px; }
.copydesign { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 4px; }
.modal { width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow-y: auto;
  padding: 18px; border: 1px solid var(--line-hi); border-radius: 18px;
  background: var(--card); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal::backdrop { background: rgba(0,0,0,.55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modalhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modalhead h2 { margin: 0; }
.modal .linkbtn { color: var(--accent); }
.modal .linkbtn:focus:not(:focus-visible), .pickagain:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pickitem { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; padding: 14px 8px;
  border-radius: 14px; height: auto; }
.pickitem .appimg { width: 52px; height: 52px; }
.pickitem small { font-size: .75rem; }
.pickitem .badge { font-size: .68rem; }
.copylist { display: flex; flex-direction: column; gap: 4px; }
.copylist label[hidden] { display: none; }
.modalfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; }
.modalfoot .primary { margin: 0; }
/* the store panel's tabs scroll sideways (see .tabs) instead of widening the page */
@media (max-width: 560px) {
  .appcard { height: 480px; }
}
.topbar nav { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; }
/* login/signup (plain, no brand/bell): keep the brand + toggle centred, don't stretch. */
.topbar.plain nav { flex: 0 1 auto; }
/* store panel: logout sits alone at the far (inline-end) side; everything else groups
   next to the brand. */
.topbar nav a.ghost { margin-inline-start: auto; }
.topbar nav a { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 500; font-size: .88rem; }
a.logout { display: inline-flex; align-items: center; gap: 6px; }
.topbar nav a:hover { color: var(--accent); text-decoration: none; }
.topbar nav a.ghost { color: var(--dim); }

.wrap { max-width: 980px; margin: 26px auto 90px; padding: 0 16px; }

/* ---- cards ---- */
.card {
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--r-xl);
  padding: 24px 24px 28px; margin-bottom: 16px;
  box-shadow: var(--glass-shadow), inset 0 1px 0 var(--glass-hi);
}
.card.narrow { max-width: 410px; margin: 12vh auto; }
.auth-alt { margin: 18px 0 0; text-align: center; font-size: .88rem; color: var(--dim); }
.auth-alt a { color: var(--accent); font-weight: 600; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } }

/* ---- type ---- */
h1 { font-size: 1.7rem; font-weight: 700; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 0 0 6px; letter-spacing: -.01em; }
h3 { font-size: .74rem; font-weight: 600; margin: 24px 0 10px; color: var(--faint);
     text-transform: uppercase; letter-spacing: .06em; }
.muted { color: var(--dim); }
code { font-family: var(--mono); font-size: .85em; color: var(--dim); }

/* ---- form controls ---- */
label { display: block; margin: 18px 0 0; font-size: .84rem; font-weight: 500; color: var(--text); }
input, textarea, select {
  width: 100%; margin-top: 8px; padding: 11px 14px; font: inherit; font-size: .95rem; color: var(--text);
  background: var(--card); border: 1px solid var(--line-hi); border-radius: var(--r);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
textarea { resize: vertical; min-height: 72px; line-height: 1.55; }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--dim) 50%),
                    linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position: left 14px center, left 9px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .two { grid-template-columns: 1fr; } }
.colorrow { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.colorrow code { color: var(--dim); }
input[type=color] {
  width: 48px; height: 34px; padding: 0; margin-top: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background: transparent; border: 1px solid var(--line-hi); border-radius: 9px;
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 8px; }
input[type=color]::-moz-color-swatch { border: none; border-radius: 8px; }

/* iOS-style switch (replaces the square checkbox everywhere) */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: 0 0 auto;
  position: relative; width: 44px; height: 26px; border-radius: 999px; cursor: pointer;
  background: var(--line-hi); border: none; transition: background .2s ease;
}
input[type=checkbox]::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: inset-inline-start .2s ease;
}
input[type=checkbox]:checked { background: var(--accent); }
input[type=checkbox]:checked::after { inset-inline-start: 21px; }
input[type=checkbox]:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-dim); }

/* file input: rounded, with a pill selector button */
input[type=file] { padding: 8px 12px; cursor: pointer; }
input[type=file]::file-selector-button {
  margin: 0 0 0 12px; padding: 7px 15px; font: inherit; font-size: .85rem; font-weight: 500;
  border: 1px solid var(--line-hi); border-radius: var(--pill);
  background: var(--card-2); color: var(--text); cursor: pointer; transition: background .2s ease;
}
input[type=file]::file-selector-button:hover { background: var(--card-3); }

/* ---- buttons: Apple pills ---- */
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 20px; padding: 10px 20px; font: inherit; font-size: .92rem; font-weight: 500;
  border: 1px solid var(--glass-border); border-radius: var(--pill);
  background: var(--glass-2); color: var(--text);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 1px 0 var(--glass-hi);
  cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .08s ease, box-shadow .2s ease;
}
button:hover { background: var(--glass); }
button:active { transform: scale(.98); }
button:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-dim); }
button.primary {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
}
button.primary:hover { background: var(--accent-hi); border-color: transparent; }
button.danger { background: var(--danger); color: #fff; border-color: transparent; }
button.danger:hover { background: var(--danger); filter: brightness(.92); border-color: transparent; }
button.accent {
  background: var(--accent); color: var(--accent-ink); border-color: transparent; width: 100%;
  font-size: 1.04rem; font-weight: 500; padding: 15px;
}
button.accent:hover { background: var(--accent-hi); }
button[disabled] { opacity: .4; cursor: default; transform: none; box-shadow: none; }

/* ---- alerts, links list ---- */
.alert {
  background: rgba(255,59,48,.14); border: 1px solid rgba(255,59,48,.32);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  color: var(--danger); padding: 11px 14px; border-radius: var(--r); margin: 14px 0; font-size: .9rem;
}
/* Amber heads-up (e.g. exported files expire): softer than .alert, louder than .muted. */
.notice {
  display: flex; align-items: flex-start; gap: 9px;
  background: rgba(255,159,10,.13); border: 1px solid rgba(255,159,10,.38);
  color: var(--text); padding: 11px 14px; border-radius: var(--r); margin: 0 0 14px; font-size: .9rem; line-height: 1.6;
}
.notice svg { flex: none; margin-top: 3px; color: var(--warn); }
.notice b { color: var(--warn); }
.appexp { color: var(--warn); font-weight: 500; }
.switch { margin-top: 18px; color: var(--dim); }
ul.builds { list-style: none; padding: 0; margin: 0; }
ul.builds li {
  display: flex; align-items: center; gap: 12px; padding: 13px 15px;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 8px;
}
.bid { font-family: var(--mono); font-weight: 500; color: var(--faint); }
.when { color: var(--faint); font-size: .82rem; }
.status { margin-inline-start: auto; }
.s-done a { font-weight: 600; }
.s-error { color: var(--danger); font-size: .82rem; }
.dot { box-shadow: 0 0 0 3px var(--card); }

/* packages tab: label · state · export button (button pinned to the end) */
ul.pkglist li { flex-wrap: wrap; }
.pkglist .pkgstate { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pkglist .pkgform { margin: 0; margin-inline-start: auto; }
.pkglist .pkgdl { font-weight: 600; }
.pkgmeta { font-size: .8rem; }
.pkgfmts { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.pkgfmts .badge { font-size: .7rem; }

/* ---- rows / toggles ---- */
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > label { flex: 1 1 140px; }
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; color: var(--text); }
.toggle input { margin: 0; }

/* ---- tabs: Apple segmented control ---- */
.tabs {
  display: inline-flex; gap: 2px; margin-top: 20px; padding: 3px;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;   /* scroll sideways, never spill */
  background: var(--glass-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--pill);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab {
  margin: 0; flex: none; white-space: nowrap;
  background: transparent; color: var(--text); border: 1px solid transparent;
  border-radius: var(--pill); padding: 7px 18px; font-weight: 500; font-size: .88rem;
  box-shadow: none; transition: background .2s ease, box-shadow .2s ease;
}
.tabs .tab:hover { background: transparent; }
.tabs .tab.active {
  background: var(--glass); color: var(--text); border-color: var(--glass-border);
  box-shadow: 0 2px 8px var(--shadow-2), inset 0 1px 0 var(--glass-hi);
}

.tabpane[hidden] { display: none; }
.tabpane { animation: rise .25s ease both; }

/* ---- side-drawer navigation (store «لوحتي» + operator «لوحة المتاجر») ---- */
/* The menu button lives in the top bar (base.html topnav block), same row/level as
   the brand, theme toggle and bell — see .topstart. */
.navtoggle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; padding: 0; margin: 0; border-radius: var(--pill);
  background: var(--glass-2); border: 1px solid var(--glass-border); color: var(--text);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.navtoggle:hover { border-color: var(--accent); background: var(--accent-dim); }
.navtoggle .ic { width: 20px; height: 20px; }

.navscrim {
  position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.5);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.navscrim.open { opacity: 1; pointer-events: auto; }

.navmenu {
  position: fixed; top: 0; right: 0; z-index: 201;
  height: 100vh; height: 100dvh; width: min(290px, 84vw);
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  margin: 0; padding: 16px; overflow-y: auto;
  background: var(--card); border-inline-start: 1px solid var(--glass-border);
  box-shadow: -12px 0 44px var(--shadow-2);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}
.navmenu.open { transform: translateX(0); }
.navclose { align-self: flex-end; margin: 0 0 6px; padding: 6px; background: none; border: none; color: var(--dim); cursor: pointer; }
.navclose .ic { width: 1.4em; height: 1.4em; }
.navmenu .tab {
  display: flex; align-items: center; gap: 8px; width: 100%; margin: 0;
  text-align: start; justify-content: flex-start; padding: 12px 14px;
  background: transparent; color: var(--text); border: 1px solid transparent; border-radius: 12px;
  box-shadow: none; font-weight: 500; font-size: .95rem; cursor: pointer; transition: background .15s ease;
}
.navmenu .tab:hover { background: var(--glass-2); }
.navmenu .tab.active { background: var(--accent-dim); border-color: var(--glass-border); color: var(--text); font-weight: 600; }
.navmenu .tab .badge { margin-inline-start: auto; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .74rem; padding: 3px 10px; border-radius: var(--pill); font-weight: 500;
  background: var(--card-3); border: 1px solid var(--line); color: var(--dim);
}
.badge.ok { color: var(--ok); border-color: rgba(52,199,89,.4); }
.badge.err { color: var(--danger); border-color: rgba(255,59,48,.4); }

/* ---- override group headers + pill ---- */
.grouphead {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line);
}
.grouphead > span {
  font-size: .74rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text); display: inline-flex; align-items: center;
}
.grouphead > span::before {
  content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--accent);
  margin-inline-end: 9px;
}
.pill {
  display: inline-flex; align-items: center; gap: 7px; margin: 0;
  font-size: .78rem; font-weight: 500; color: var(--dim);
  background: var(--glass-2); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-radius: var(--pill); padding: 5px 13px; cursor: pointer;
}
.pill:hover { color: var(--accent); border-color: var(--accent); }
.pill input { margin: 0; transform: scale(.82); }

/* ---- theming inset box ---- */
.themebox {
  margin-top: 18px; padding: 16px;
  background: var(--glass-3);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--r);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.themebox .toggle { margin-top: 12px; font-size: .9rem; }
.themebox .toggle:first-of-type { margin-top: 8px; }

/* ---- per-tool cards: app tiles (operator cockpit) ---- */
.toolgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
.toolgrid > .card { margin-bottom: 0; }
@media (max-width: 820px) { .toolgrid { grid-template-columns: 1fr; } }

/* app-tile header: icon + name + status */
.tool .toolhead {
  display: flex; align-items: center; gap: 13px;
  padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.appicon {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 13px;  /* iOS squircle-ish */
  object-fit: cover; box-shadow: 0 2px 8px var(--shadow), inset 0 0 0 1px rgba(0,0,0,.06);
}
.appicon.ph {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.5rem; text-transform: uppercase;
}
.toolmeta { min-width: 0; margin-inline-end: auto; }
.toolmeta h2 { margin: 0; font-size: 1.12rem; line-height: 1.2; }
.toolmeta code { font-size: .74rem; color: var(--faint); }

/* kill switch highlighted at the top of the card */
.killswitch {
  margin-top: 16px; padding: 11px 14px; border-radius: var(--r);
  background: var(--glass-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); font-size: .92rem;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}

/* collapsible customization */
.customize { margin-top: 14px; border: 1px solid var(--glass-border); border-radius: var(--r); overflow: hidden; }
.customize > summary {
  list-style: none; cursor: pointer; padding: 12px 15px; font-weight: 500; font-size: .92rem;
  color: var(--text); background: var(--glass-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  display: flex; align-items: center; gap: 8px;
}
.customize > summary::-webkit-details-marker { display: none; }
.customize > summary::before {
  content: "⌄"; font-size: 1rem; color: var(--dim); transition: transform .2s ease;
  display: inline-block; line-height: 1;
}
.customize[open] > summary::before { transform: rotate(180deg); }
.customize > summary:hover { color: var(--accent); }
.customize-body { padding: 4px 15px 16px; }
.customize-body .grouphead:first-of-type { margin-top: 14px; }

/* downloads grid */
.downloads {
  margin-top: 18px; padding: 16px;
  background: var(--glass-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-radius: var(--r);
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.dlhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dlhead > span:first-child { font-weight: 600; font-size: .92rem; }
.dlgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.dlbtn {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--glass-border);
  background: var(--glass-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  color: var(--text); transition: border-color .15s ease, background .15s ease, transform .08s ease;
  box-shadow: inset 0 1px 0 var(--glass-hi);
}
.dlbtn:active { transform: scale(.98); }
.dlbtn b { font-weight: 600; font-size: .9rem; }
.dlbtn small { color: var(--faint); font-size: .74rem; }
.dlbtn:hover { text-decoration: none; border-color: var(--accent); background: var(--accent-dim); }
.dlbtn.off { opacity: .5; }
.dlbtn.soon { opacity: .55; cursor: default; }
.dlbtn.soon small { color: var(--accent); }
.dlactions { margin-top: 12px; }

/* ---- stores table ---- */
.tablewrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r); }
.stable { width: 100%; border-collapse: collapse; font-size: .9rem; }
.stable th, .stable td { padding: 12px 14px; text-align: start; white-space: nowrap; }
.stable thead th {
  color: var(--faint); font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  background: var(--card-2); border-bottom: 1px solid var(--line);
}
.stable tbody td { border-bottom: 1px solid var(--line); }
.stable tbody tr:last-child td { border-bottom: none; }
.stable tbody tr:hover { background: var(--card-2); }
.swatch { width: 15px; height: 15px; border-radius: 5px; display: inline-block; vertical-align: middle;
  box-shadow: 0 0 0 1px var(--line-hi); }
.linkbtn { margin: 0; padding: 0; background: none; border: none; color: var(--danger);
  cursor: pointer; font: inherit; font-weight: 500; font-size: .85rem; }
.linkbtn:hover { background: none; text-decoration: underline; color: var(--danger); }

/* ---- export progress ---- */
progress { -webkit-appearance: none; appearance: none; height: 6px; border-radius: var(--pill); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--card-3); border-radius: var(--pill); }
progress::-webkit-progress-value { background: var(--accent); border-radius: var(--pill); }
progress::-moz-progress-bar { background: var(--accent); }

/* ---- scrollbar ---- */
* { scrollbar-width: thin; scrollbar-color: var(--line-hi) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-hi); border-radius: var(--pill); border: 3px solid var(--bg); }

hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- versions tab ---- */
.vstate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.vop { margin-top: 12px; }
.vlog { margin: 8px 0 0; padding: 10px 12px; max-height: 180px; overflow: auto; white-space: pre-wrap;
  font-family: var(--mono); font-size: .76rem; background: var(--card-2); border: 1px solid var(--line);
  border-radius: var(--r); color: var(--dim); }
.vlog:empty { display: none; }
.vhist { margin-top: 14px; }
.vhist summary { cursor: pointer; font-weight: 500; }
.vsubj { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.vhist.onlytags tr.vplain { display: none; }

/* ---- store tool chips (show/hide a tool per store) ---- */
.storetoolcell { white-space: normal !important; min-width: 220px; }
.stool { margin: 2px; opacity: .45; cursor: pointer; font-size: .74rem; }
.stool.on { opacity: 1; }

/* ---- credits rows editor ---- */
.crow { display: flex; gap: 8px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.crow:first-child { border-top: none; }
.crow-fields { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.crow-fields input, .crow-fields select { margin: 0; }
.crow-tools { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.crow-tools .linkbtn { color: var(--dim); }
.crow-tools .c-del { color: var(--danger); }
.crow-pinned .crow-fields { opacity: .7; }
@media (max-width: 520px) { .crow-fields { grid-template-columns: 1fr; } }

/* User counts (templates/users.html) */
.userblock { display: flex; flex-direction: column; gap: 10px; }
.userhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.usernum { font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.userday { font-size: .8rem; }
.usertools { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr)); gap: 8px; }
.usertool { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--card-2); font-size: .82rem; }
.usertool b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.usertool small { font-size: .72rem; }
.usernote { font-size: .78rem; }
.userscell b { font-variant-numeric: tabular-nums; }

/* «عام» alert targeting by version */
/* «لمن يطلع التنبيه؟» radio options: radio pinned to the start of each row, the label
   (and its version hint) stacked beside it so long hints never scatter the radios. */
.alerttarget-q { font-size: .85rem; margin-bottom: 10px; }
.vopts { display: flex; flex-direction: column; gap: 10px; }
.vopt { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-weight: 500; color: var(--text); font-size: .9rem; }
.vopt input { margin: 3px 0 0; flex: none; }
.vopt > span { display: flex; flex-direction: column; gap: 3px; line-height: 1.45; }
.vhint { font-size: .76rem; font-weight: normal; line-height: 1.7; }
/* per-tool version picker: tool name in a fixed column, its versions flowing beside it. */
.versionpick { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--glass-border); }
.vpickrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.vpickrow > b { min-width: 74px; font-size: .85rem; }
.vpickopts { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 60%; }

/* alert composer: horizontal target chips + its collapsible color box */
.alertscope { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 10px; direction: rtl; }
.scopechip { display: flex; direction: rtl; justify-content: flex-start; align-items: center; gap: 10px;
  margin: 0; padding: 10px 14px; border-radius: var(--r); background: var(--glass-2);
  border: 1px solid var(--glass-border); cursor: pointer; font-size: .9rem; font-weight: 500;
  color: var(--text); text-align: right; }
.scopechip input { width: auto; flex: 0 0 auto; margin: 0; padding: 0; border: 0; background: none; border-radius: 0; }
.scopechip > span { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scopechip:hover { border-color: var(--accent); }
.scopechip:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.scopevers { margin: 0 0 8px; }
.alertcustom { margin: 10px 0; }
.alertcustom > summary { cursor: pointer; font-size: .9rem; font-weight: 500; color: var(--accent); margin-bottom: 8px; }
/* alert status bar: current state on one side, actions («تعديل» / «إطفاء») on the other */
.alertbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-radius: var(--r); background: var(--glass-2);
  border: 1px solid var(--glass-border); margin: 2px 0 6px; }
.alertbar-info { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; font-size: .88rem; }
.alertbar-text { font-weight: 500; }
.alertbar-actions { display: flex; align-items: center; gap: 16px; flex: none; }
.alertbar-actions .linkbtn { display: inline-flex; align-items: center; gap: 4px; }

/* credits row: its own image */
.crow .c-imgbtn { flex: none; width: 48px; height: 48px; margin-top: 2px; padding: 0; border-radius: 50%;
  border: 1.5px dashed var(--line-hi); background: var(--card-2); color: var(--dim); font-size: .68rem;
  display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; }
.crow .c-imgbtn:hover { border-color: var(--accent); color: var(--accent); }
.crow .c-imgprev { width: 100%; height: 100%; object-fit: cover; }
.crow-tools .c-imgdel { color: var(--danger); font-size: .75rem; }

/* «المتاجر»: one row per store — logo + name at the start, balance at the end. */
.storelist { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.storerow { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r); }
.storemain { display: flex; align-items: center; justify-content: flex-start; gap: 12px; flex: 1; min-width: 0;
  background: none; border: 0; padding: 0; box-shadow: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.storemain:hover, .storemain:active { background: none; transform: none; }
.storemain:hover b { color: var(--accent); }
.storeid { align-items: flex-start; }
.storelogo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; flex: none; }
.storeid { display: flex; flex-direction: column; min-width: 0; }
.storeid b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storeid .muted { font-size: .78rem; }
.storebal { display: flex; align-items: center; gap: 10px; flex: none; }
.balnum { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.balnum b { font-size: 1.15rem; }
.balnum small { font-size: .7rem; }

/* «البكجات»: package cards (image on top, name, details) — both panels. */
.bundlegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.bundlegrid > .card { margin-bottom: 0; }
.bundlecard { padding: 0; overflow: hidden; }
.bundleimg { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--glass); }
.bundleimg.ph { display: flex; align-items: center; justify-content: center; font-size: 2.4rem; font-weight: 700; color: var(--accent); }
.bundlebody { padding: 14px 16px 16px; }
.bundlebody h2 { margin: 0 0 6px; font-size: 1.1rem; }
.bundleprice { display: inline-block; margin: 0 0 8px; padding: 3px 10px; border-radius: 999px; background: var(--glass); color: var(--accent); font-weight: 700; font-size: .95rem; }
.bundlebuy { margin-top: 12px; width: 100%; }
.bundlelow { margin: 6px 0 0; font-size: .8rem; }
.buysum { display: grid; gap: 8px; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; background: var(--glass); }
.buysum > div { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.buysum > div:last-child { border-top: 1px solid var(--glass-border); padding-top: 8px; }
.notice.ok { background: rgba(52,199,89,.13); border-color: rgba(52,199,89,.38); }
.notice.ok svg, .notice.ok b { color: var(--ok); }
.bundledetails { margin: 0; white-space: pre-line; color: var(--dim); font-size: .9rem; line-height: 1.6; }
.bundlemeta { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 8px; font-size: .8rem; align-items: center; }
.bundlemeta .ic { width: 14px; height: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

/* «الإشعارات» feed (operator) */
.notiflist { display: flex; flex-direction: column; gap: 8px; }
.notifrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); }
.notifrow:hover { border-color: var(--accent); text-decoration: none; }
.notifrow.pending { border-inline-start: 3px solid var(--accent); }
.notific { flex: none; width: 38px; height: 38px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; background: var(--glass-2); color: var(--text); }
.notific .ic { width: 19px; height: 19px; }
.notif-topup { color: var(--accent); } .notif-settle { color: var(--accent); }
.notif-signup { color: #30b0c7; } .notif-buy { color: var(--ok); } .notif-later { color: #8a6d00; }
.notifbody { flex: 1 1 auto; min-width: 0; }
.notiftop { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.notifmeta { display: flex; flex-wrap: wrap; gap: 2px 6px; font-size: .78rem; margin-top: 2px; }

/* «شحن المحفظة» (store) + «الإشعارات» (operator) — topup.py */
.paymethods { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.paymethod { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--card-2); }
.paymethod:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.paymethod input { width: auto; margin: 0; }
.paymethod span { display: grid; gap: 2px; }
.paymethod small { font-size: .75rem; }
.paydetails { margin-top: 12px; }
.paydetailsbox { white-space: pre-line; padding: 12px 14px; border-radius: 12px; background: var(--glass);
  border: 1px dashed var(--glass-border); line-height: 1.7; user-select: all; }
.topuplist { display: grid; gap: 12px; }
.topupitem { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card-2); }
.topuphead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.topupamt { color: var(--accent); font-size: 1.15rem; }
.topuprcpt { display: inline-block; margin-top: 10px; }
.topuprcpt img { max-width: 220px; max-height: 260px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.topupform { margin-top: 12px; }
.paymethodedit { display: grid; gap: 6px; margin-bottom: 14px; }

/* store «عام» tab: wallet / certificates / pay-later tiles */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; align-items: stretch; }
.statgrid > .card { margin-bottom: 0; }
.stat { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.statnum { font-size: 2rem; line-height: 1.1; color: var(--text); }
.statnum small { font-size: .9rem; color: var(--dim); font-weight: 500; }
.statsub { font-size: .85rem; }
.stat .dlbtn { margin-top: auto; }
.statbad { border-color: rgba(255,59,48,.45); }
.graceb { width: 100%; height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.graceb > div { height: 100%; background: var(--accent); border-radius: 3px; }
.notice.danger { background: rgba(255,59,48,.12); border-color: rgba(255,59,48,.4); }
.notice.danger svg, .notice.danger b { color: var(--danger); }
.paymethod.off { opacity: .5; cursor: not-allowed; }
.teamform { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; }
.teamform label { flex: 1; }
.teamform input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .05em; text-transform: uppercase; }
.teamform button { margin: 0; white-space: nowrap; }

/* operator «شهادات المتاجر»: totals box, one row per store, per-store details window */
.certstats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 4px; }
.certstat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--r);
  background: var(--glass-2); border: 1px solid var(--glass-border); }
.certstat b { font-size: 1.9rem; line-height: 1.1; font-weight: 700; color: var(--text); }
.certstat span { font-size: .85rem; color: var(--dim); }
.certstat.bad b { color: var(--danger); }
.certstat.good b { color: var(--ok); }
.certstores { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.certrow { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r);
  border: 1px solid var(--glass-border); background: var(--glass); }
.certrow .storelogo { width: 40px; height: 40px; border-radius: 10px; }
.certname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.certname b, .certname .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.certname .muted { font-size: .78rem; }
.certcount { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-size: .9rem; }
.certcount .badge { font-size: .7rem; }
.certrow .linkbtn, .certrow .linkbtn:hover { color: var(--accent); font-weight: 600; white-space: nowrap; }
.certitem { padding: 12px; border-radius: var(--r); border: 1px solid var(--glass-border); background: var(--glass-2); }
.certitem + .certitem { margin-top: 8px; }
.certitem.ended { opacity: .8; }
.certitemhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.certmeta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0 0; font-size: .85rem; }
.certmeta dt { color: var(--dim); }
.certmeta dd { margin: 0; text-align: start; }
.certact { margin: 10px 0 0; }
.certmodal .linkbtn.danger, .certmodal .linkbtn.danger:hover {
  color: #fff; background: var(--danger); padding: 7px 14px; border-radius: var(--pill);
  font-weight: 600; text-decoration: none; }
.certmodal .linkbtn.danger:hover { filter: brightness(.92); }
/* «شهادات المتاجر»: revoked / expired / frozen = a solid red box with white text */
#pane-certs .badge.err { background: var(--danger); color: #fff; border-color: transparent; font-weight: 600; }
.badge.warnb { color: var(--warn); border-color: rgba(184,134,11,.45); }
@media (max-width: 520px) {
  .certstat { padding: 10px; } .certstat b { font-size: 1.4rem; } .certstat span { font-size: .75rem; }
  .certcount .badge { display: none; }
}
