/* ceresify control panel — Apple design language.
   San Francisco system font, #f5f5f7 light surfaces, Apple blue (#0071e3),
   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;

  /* Apple system blue (the accent) */
  --accent: #0071e3;
  --warn: #b25000;
  --accent-hi: #0077ed;
  --accent-ink: #ffffff;
  --accent-dim: rgba(0,113,227,.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);

  /* ---- liquid glass materials ---- */
  --glass: rgba(255,255,255,.55);         /* primary glass surface */
  --glass-2: rgba(255,255,255,.42);       /* nested glass / controls */
  --glass-3: rgba(255,255,255,.30);       /* faint glass */
  --glass-border: rgba(255,255,255,.65);  /* bright glassy rim */
  --glass-hi: rgba(255,255,255,.75);      /* specular top highlight */
  --glass-blur: saturate(180%) blur(22px);
  --glass-shadow: 0 10px 40px -12px rgba(0,0,0,.28), 0 2px 8px rgba(0,0,0,.06);

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

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1d1d1f;
    --card-2: #161617;
    --card-3: #2a2a2c;
    --line: #38383a;
    --line-hi: #48484a;

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

    --accent: #0a84ff;
    --warn: #ff9f0a;
    --accent-hi: #409cff;
    --accent-ink: #ffffff;
    --accent-dim: rgba(10,132,255,.20);

    --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: rgba(50,50,54,.45);
    --glass-2: rgba(70,70,76,.38);
    --glass-3: rgba(90,90,96,.26);
    --glass-border: rgba(255,255,255,.16);
    --glass-hi: rgba(255,255,255,.14);
    --glass-blur: saturate(180%) blur(22px);
    --glass-shadow: 0 12px 44px -10px rgba(0,0,0,.65), 0 2px 10px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(60vw 50vh at 12% -6%, rgba(0,113,227,.18), transparent 60%),
    radial-gradient(52vw 48vh at 100% 4%, rgba(120,80,255,.16), transparent 58%),
    radial-gradient(60vw 55vh at 50% 108%, rgba(0,190,180,.14), transparent 60%),
    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;
}
@media (prefers-color-scheme: dark) {
  body {
    background:
      radial-gradient(60vw 50vh at 12% -6%, rgba(10,132,255,.22), transparent 60%),
      radial-gradient(52vw 48vh at 100% 4%, rgba(140,90,255,.18), transparent 58%),
      radial-gradient(60vw 55vh at 50% 108%, rgba(0,190,180,.14), transparent 60%),
      var(--bg);
    background-attachment: fixed;
  }
}
::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: space-between; 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; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 24px; height: 24px; border-radius: 7px; position: relative;
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  box-shadow: 0 2px 6px rgba(0,113,227,.35);
}
.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.05rem; font-weight: 600; color: var(--text); letter-spacing: -.02em; }
.brand .word b { font-weight: 700; }
.brand .storelogo { width: 28px; height: 28px; border-radius: 8px; 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; }
.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 four tabs scroll sideways on a phone instead of widening the page */
@media (max-width: 560px) {
  .tabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs .tab { flex: none; white-space: nowrap; }
  .appcard { height: 480px; }
}
.topbar nav { display: flex; align-items: center; gap: 22px; }
.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; }
.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.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;
  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 .tab {
  margin: 0; 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; }
@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);
}
a.dlbtn:active { transform: scale(.98); }
.dlbtn b { font-weight: 600; font-size: .9rem; }
.dlbtn small { color: var(--faint); font-size: .74rem; }
a.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 */
.versionpick { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.vpickrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.vpickrow > b { min-width: 70px; font-size: .85rem; }

/* 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; }
