@font-face {
  font-family: "Modam";
  src: url("/fonts/modam/Modam-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Modam";
  src: url("/fonts/modam/Modam-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Modam";
  src: url("/fonts/modam/Modam-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand colours are defined as an RGB triplet + a hex + a lightened variant;
     EVERY tint/shadow/gradient below derives from the triplet, so overriding
     just `--*-rgb` (and the hex/lite) in hub.js recolours the entire hub. */
  --primary-rgb: 52, 81, 94;
  --primary: #34515E;
  --primary-lite: #98D0DE;
  --primary-soft: rgba(var(--primary-rgb), 0.10);
  --primary-glow: rgba(var(--primary-rgb), 0.22);

  --accent-rgb: 52, 81, 94;
  --accent: #34515E;
  --accent-lite: #98D0DE;
  --accent-soft: rgba(var(--accent-rgb), 0.07);

  --violet-rgb: 152, 208, 222;
  --violet: #98D0DE;
  --violet-lite: #c3e3ec;
  --violet-soft: rgba(var(--violet-rgb), 0.12);
  --violet-glow: rgba(var(--violet-rgb), 0.22);

  --success: #16a34a;
  --success-soft: rgba(22, 163, 74, 0.10);

  /* Ambient background / orb tints — derived from the brand colours above so a
     per-user theme (applied via JS in hub.js) recolours the whole scene. */
  --bg-warm: rgba(var(--primary-rgb), 0.16);
  --bg-cool: rgba(var(--violet-rgb), 0.13);
  --bg-deep: rgba(var(--accent-rgb), 0.10);
  --orb-warm: rgba(var(--primary-rgb), 0.40);
  --orb-warm-soft: rgba(var(--primary-rgb), 0.08);
  --orb-cool: rgba(var(--violet-rgb), 0.32);
  --orb-cool-soft: rgba(var(--violet-rgb), 0.06);
  --orb-deep: rgba(var(--accent-rgb), 0.20);

  /* The "surface" colour — the white of the glass cards and the page base.
     Themeable per-user via hub.js (--surface-rgb + --page-bg*). */
  --surface-rgb: 255, 255, 255;
  --glass: rgba(var(--surface-rgb), 0.60);
  --glass-strong: rgba(var(--surface-rgb), 0.82);
  --glass-border: rgba(var(--surface-rgb), 0.70);
  --glass-border-strong: rgba(var(--surface-rgb), 0.90);
  --glass-shadow: rgba(var(--accent-rgb), 0.10);
  --glass-shadow-deep: rgba(var(--accent-rgb), 0.16);

  --page-bg: #eef5f8;
  --page-bg-hi: #f7fbfc;
  --page-bg-lo: #e2eef2;

  --text: #000000;
  --text-muted: #34515E;
  --text-faint: #6b8591;

  /* Semantic stacking scale (sticky app bar → peek sheet → add-card modal). */
  --z-appbar: 40;
  --z-peek: 80;

  --blur: 24px;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;

  --transition-fast: 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-card: 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Modam", system-ui, sans-serif;
  color: var(--text);
  background: var(--page-bg);
  /* `clip` (not `hidden`) so the body doesn't become a scroll container —
     that would break `position: sticky` on the mobile app bar. */
  overflow-x: clip;
}

/* ─── Background ──────────────────────────────── */

.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 10% 8%,  var(--bg-warm), transparent 55%),
    radial-gradient(ellipse 65% 50% at 88% 12%, var(--bg-cool), transparent 52%),
    radial-gradient(ellipse 80% 60% at 50% 105%, var(--bg-deep), transparent 55%),
    linear-gradient(160deg, var(--page-bg-hi) 0%, var(--page-bg) 50%, var(--page-bg-lo) 100%);
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.50;
  animation: float 20s ease-in-out infinite;
}

.orb--1 {
  width: 500px;
  height: 500px;
  top: -120px;
  right: -80px;
  background: radial-gradient(circle, var(--orb-warm), var(--orb-warm-soft));
}

.orb--2 {
  width: 420px;
  height: 420px;
  bottom: 5%;
  left: -100px;
  background: radial-gradient(circle, var(--orb-cool), var(--orb-cool-soft));
  animation-delay: -7s;
}

.orb--3 {
  width: 300px;
  height: 300px;
  top: 44%;
  left: 40%;
  background: radial-gradient(circle, var(--orb-deep), transparent);
  animation-delay: -13s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(28px, -20px) scale(1.05); }
  66%       { transform: translate(-18px, 14px) scale(0.97); }
}

.noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.028;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ─── Shell ───────────────────────────────────── */

.shell {
  position: relative;
  z-index: 2;
  width: min(1220px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.5rem 0 3.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ─── Glass base ──────────────────────────────── */

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 2px 4px rgba(var(--accent-rgb), 0.04),
    0 8px 24px var(--glass-shadow),
    0 32px 64px rgba(var(--accent-rgb), 0.06),
    inset 0 1px 0 rgba(var(--surface-rgb), 0.85),
    inset 0 -1px 0 rgba(var(--accent-rgb), 0.04);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
}

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

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-xl);
  animation: rise 0.65s ease both;
  position: relative;
  overflow: hidden;
}

/* Top shimmer line */
.header::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--surface-rgb),0.9) 30%,
    rgba(var(--primary-rgb), 0.5) 55%,
    rgba(var(--surface-rgb),0.9) 80%,
    transparent 100%
  );
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.brand__logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: contain;
  background: var(--glass-strong);
  padding: 7px;
  box-shadow:
    0 0 0 1px rgba(var(--surface-rgb),0.8),
    0 4px 12px rgba(var(--accent-rgb), 0.10),
    0 0 0 4px rgba(var(--primary-rgb), 0.08);
  transition: box-shadow var(--transition-fast), transform var(--transition-fast);
}

.brand__logo:hover {
  transform: scale(1.04);
  box-shadow:
    0 0 0 1px rgba(var(--surface-rgb),0.9),
    0 6px 18px rgba(var(--accent-rgb), 0.14),
    0 0 0 5px rgba(var(--primary-rgb), 0.14);
}

.brand__title {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.45;
}

.brand__title--hero {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.4rem;
}

.hero-phrase__warm { color: var(--primary); }
.hero-phrase__cool { color: var(--accent); }

.hero-phrase__caret {
  display: inline-block;
  width: 2px;
  height: 0.88em;
  margin-inline-start: 2px;
  vertical-align: middle;
  background: var(--primary);
  border-radius: 1px;
  animation: caret-blink 1.1s step-end infinite;
}

.hero-dots {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.3rem;
  padding-bottom: 0.12rem;
}

.hero-dots[hidden] { display: none; }

@keyframes typing-dot-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%            { opacity: 1;   transform: translateY(-4px); }
}

.typing-dot {
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--primary);
  animation: typing-dot-bounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes caret-blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .typing-dot          { animation: none; opacity: 1; }
  .hero-phrase__caret  { display: none; }
  .orb                 { animation: none; }
}

/* ─── Performance mode ───────────────────────────
   Opt-in toggle (Settings → نمایش) for slower devices. Strips every expensive
   effect: backdrop-filter blur, the animated orbs, the noise overlay, big
   drop-shadows, hover transforms and all animation/transition work. */
[data-perf="on"] {
  --blur: 0px;
}

/* Kill the animated background outright rather than just dimming it. */
[data-perf="on"] .orb,
[data-perf="on"] .noise {
  display: none !important;
}

/* No backdrop blur on any frosted surface — the single biggest paint cost. */
[data-perf="on"] .glass {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14) !important;
}

/* Freeze hover lifts/scales that force GPU compositing. */
[data-perf="on"] .app-card:hover,
[data-perf="on"] .app-card:hover .app-card__icon {
  transform: none !important;
}

[data-perf="on"] * {
  animation: none !important;
  transition-duration: 0.001s !important;
  will-change: auto !important;
  filter: none !important;
}

/* ─── Settings: display section + toggle switch ─── */
.sec-section {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--glass-border, rgba(255,255,255,0.08));
}
.sec-section__title {
  margin: 0 0 0.6rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-muted);
}
.sec-switch {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  cursor: pointer;
}
.sec-switch__text { flex: 1; }
.sec-switch__title {
  display: block;
  font-weight: 600;
  color: var(--text);
}
.sec-switch__desc {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-faint, var(--text-muted));
}
.sec-switch__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.sec-switch__track {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--glass-strong, rgba(120,120,120,0.35));
  border: 1px solid var(--glass-border, rgba(255,255,255,0.12));
  transition: background var(--transition-fast), border-color var(--transition-fast);
}
.sec-switch__thumb {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-fast);
}
.sec-switch__input:checked + .sec-switch__track {
  background: var(--primary);
  border-color: var(--primary);
}
.sec-switch__input:checked + .sec-switch__track .sec-switch__thumb {
  transform: translateX(-18px);
}
.sec-switch__input:focus-visible + .sec-switch__track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.brand__text p {
  margin: 0.18rem 0 0;
  color: var(--text-faint);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}

.header__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.9rem 0.42rem 0.75rem;
  border-radius: 999px;
  font-size: 0.80rem;
  font-weight: 500;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid rgba(22, 163, 74, 0.20);
  letter-spacing: 0.01em;
}

.status-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(22, 197, 94, 0.20);
  animation: pulse-dot 2.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(22, 197, 94, 0.20); }
  50%       { box-shadow: 0 0 0 5px rgba(22, 197, 94, 0.10); }
}

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

.hero {
  padding: 2.25rem 2rem 2rem;
  border-radius: var(--radius-xl);
  animation: rise 0.72s ease 0.07s both;
  position: relative;
  overflow: hidden;
}

/* Decorative diagonal stripe */
.hero::after {
  content: "";
  position: absolute;
  top: -60px;
  left: -40px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-glow), transparent 70%);
  pointer-events: none;
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.32rem 0.75rem 0.32rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  margin-bottom: 1.1rem;
}

.hero__eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

.hero h2 {
  margin: 0;
  font-size: clamp(1.7rem, 3.8vw, 2.55rem);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.03em;
  max-width: 20ch;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-lite) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  margin: 1rem 0 0;
  max-width: 55ch;
  color: var(--text-muted);
  line-height: 1.85;
  font-size: 0.97rem;
}

/* Compact hero — everything on one line */
.hero--compact {
  padding: 1.1rem 1.5rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.hero--compact::after { display: none; }

.hero--compact .hero__eyebrow { margin-bottom: 0; }

.hero--compact h2 {
  font-size: 1.15rem;
  line-height: 1.4;
  max-width: none;
  white-space: nowrap;
}

.hero--compact p {
  margin: 0;
  max-width: none;
  line-height: 1.4;
  font-size: 0.85rem;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .hero--compact {
    flex-wrap: wrap;
    white-space: normal;
  }
  .hero--compact h2,
  .hero--compact p {
    white-space: normal;
  }
}

/* ─── Toolbar ─────────────────────────────────── */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  animation: rise 0.78s ease 0.11s both;
}

.toolbar__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search {
  position: relative;
  width: min(340px, 100%);
}

.search input {
  width: 100%;
  padding: 0.78rem 2.8rem 0.78rem 1rem;
  border: 1.5px solid rgba(var(--surface-rgb), 0.80);
  border-radius: 999px;
  background: rgba(var(--surface-rgb), 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.06), inset 0 1px 0 rgba(var(--surface-rgb),0.9);
}

.search input::placeholder { color: var(--text-faint); }

.search input:focus {
  border-color: rgba(var(--primary-rgb), 0.40);
  background: rgba(var(--surface-rgb), 0.82);
  box-shadow:
    0 0 0 4px rgba(var(--primary-rgb), 0.10),
    0 2px 8px rgba(var(--accent-rgb), 0.06),
    inset 0 1px 0 rgba(var(--surface-rgb),0.9);
}

.search svg {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-faint);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.search:focus-within svg { color: var(--primary); }

/* ─── Apps grid ───────────────────────────────── */

.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.15rem;
}

/* Zoned view: the container stops being a card grid and becomes a vertical
   stack of category zones instead. */
.apps-grid--zoned {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* ─── Category zone (wide rectangle holding one category's cards) ───────── */

.apps-zone {
  position: relative;
  padding: 1.15rem 1.2rem 1.3rem;
  border-radius: var(--radius-xl);
  border: 1.5px solid rgba(var(--accent-rgb), 0.10);
  background: rgba(var(--surface-rgb), 0.28);
  animation: rise 0.6s ease both;
  transition: border-color var(--transition-fast), background var(--transition-fast),
    box-shadow var(--transition-fast), transform var(--transition-fast);
}

/* Highlight a zone while a card is being dragged over it. */
.apps-zone.is-drop-target {
  border-color: rgba(var(--primary-rgb), 0.55);
  background: rgba(var(--primary-rgb), 0.06);
}

.apps-zone__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  user-select: none;
}

.apps-zone__grip {
  display: none; /* shown only for reorderable zones */
  align-items: center;
  color: var(--text-faint);
  cursor: grab;
}

.apps-zone__grip svg { width: 15px; height: 15px; }

.apps-zone--draggable .apps-zone__grip { display: inline-flex; }
.apps-zone--draggable .apps-zone__head {
  cursor: grab;
  touch-action: none; /* let the pointer drag own the gesture on touch */
}

/* The block being dragged is lifted onto <body>, follows the pointer (its
   translate/scale is set inline), and reads as raised via a tinted border and
   deep shadow. The gap it left is held open by .apps-zone-placeholder. */
.apps-zone.is-zone-dragging {
  border-color: rgba(var(--primary-rgb), 0.55);
  background: rgba(var(--primary-rgb), 0.10);
  box-shadow: 0 22px 50px -18px rgba(var(--primary-rgb), 0.55);
  cursor: grabbing;
  animation: none; /* skip the entry "rise" while lifted */
}

/* Holds the dragged block's old slot open so surrounding zones stay put. */
.apps-zone-placeholder {
  border-radius: var(--radius-xl);
  border: 1.5px dashed rgba(var(--primary-rgb), 0.35);
  background: rgba(var(--primary-rgb), 0.05);
  /* a flex item in the zoned stack — the column's gap handles spacing */
}

.apps-zone__title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.apps-zone__count {
  display: inline-grid;
  place-items: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.10);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.apps-zone__rule {
  flex: 1;
  height: 1px;
  background: rgba(var(--accent-rgb), 0.12);
}

/* Inner card grid — reuses .apps-grid so every card + mobile-launcher rule
   still applies inside a zone. */
.apps-zone__grid {
  position: relative;
  min-height: 92px;
}

/* Empty-zone rectangle: the zone still exists as a drop target with a hint. */
.apps-zone__empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  border-radius: var(--radius-lg);
  border: 1.5px dashed rgba(var(--accent-rgb), 0.18);
  color: var(--text-faint);
  font-size: 0.82rem;
  text-align: center;
  padding: 1rem;
}

/* Hide the hint as soon as the zone holds a card (or a drag placeholder). */
.apps-zone__grid:has(.app-card) .apps-zone__empty,
.apps-zone__grid:has(.app-card-placeholder) .apps-zone__empty { display: none; }

/* Slot the lifted card leaves behind while dragging. Transparent to the
   pointer so elementFromPoint reads the card/zone underneath, not the gap. */
.app-card-placeholder {
  border-radius: var(--radius-lg);
  border: 1.5px dashed rgba(var(--primary-rgb), 0.4);
  background: rgba(var(--primary-rgb), 0.05);
  pointer-events: none;
}

/* The card being dragged (lifted onto <body>, following the pointer). */
.app-card.is-dragging {
  box-shadow:
    0 22px 44px rgba(var(--accent-rgb), 0.28),
    0 44px 88px rgba(var(--accent-rgb), 0.16);
  cursor: grabbing;
}

@media (prefers-reduced-motion: reduce) {
  .apps-zone { animation: none; }
}

/* ─── App card ────────────────────────────────── */

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 244px; /* fixed so every card is exactly the same size */
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  cursor: pointer;
  transition:
    transform var(--transition-card),
    box-shadow var(--transition-card),
    border-color var(--transition-card);
  animation: rise 0.72s ease both;
}

/* Inner light sheen */
.app-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(var(--surface-rgb),0.55) 0%, rgba(var(--surface-rgb),0.10) 50%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition-card);
  pointer-events: none;
  z-index: 0;
}

/* Colored bottom glow on hover */
.app-card::after {
  content: "";
  position: absolute;
  inset-inline: 20%;
  bottom: -8px;
  height: 32px;
  border-radius: 50%;
  filter: blur(16px);
  opacity: 0;
  transition: opacity var(--transition-card);
  pointer-events: none;
}

.app-card:hover {
  transform: translateY(-7px) scale(1.01);
  box-shadow:
    0 2px 4px rgba(var(--accent-rgb),0.04),
    0 16px 40px rgba(var(--accent-rgb),0.12),
    0 40px 80px rgba(var(--accent-rgb),0.08),
    inset 0 1px 0 rgba(var(--surface-rgb),0.95);
}

.app-card:hover::before { opacity: 1; }
.app-card:hover::after  { opacity: 1; background: var(--glow-color, transparent); }

.app-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

/* Tone-specific hover glow */
.app-card:has(.app-card__icon--coral):hover::after  { background: rgba(var(--primary-rgb), 0.45); }
.app-card:has(.app-card__icon--violet):hover::after { background: rgba(var(--violet-rgb), 0.45); }
.app-card:has(.app-card__icon--navy):hover::after   { background: rgba(var(--accent-rgb), 0.35); }
.app-card:has(.app-card__icon--teal):hover::after   { background: rgba(13, 148, 136, 0.40); }
.app-card:has(.app-card__icon--green):hover::after  { background: rgba(22, 163, 74, 0.40); }
.app-card:has(.app-card__icon--amber):hover::after  { background: rgba(217, 119, 6, 0.40); }
.app-card:has(.app-card__icon--indigo):hover::after { background: rgba(79, 70, 229, 0.40); }

.app-card--disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

/* Card sections — stacked properly */
.app-card__top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
}

.app-card__icon {
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  flex-shrink: 0;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.app-card__icon svg { width: 33px; height: 33px; }

.app-card__icon--coral {
  background: linear-gradient(140deg, var(--primary-lite), var(--primary));
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.32), 0 2px 6px rgba(var(--primary-rgb), 0.20);
}

.app-card__icon--violet {
  background: linear-gradient(140deg, var(--violet-lite), var(--violet));
  box-shadow: 0 8px 24px rgba(var(--violet-rgb), 0.32), 0 2px 6px rgba(var(--violet-rgb), 0.20);
}

.app-card__icon--navy {
  background: linear-gradient(140deg, var(--accent-lite), var(--accent));
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.28), 0 2px 6px rgba(var(--accent-rgb), 0.16);
}

.app-card__icon--teal {
  background: linear-gradient(140deg, #2dd4bf, #0d9488);
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.32), 0 2px 6px rgba(13, 148, 136, 0.20);
}

.app-card__icon--green {
  background: linear-gradient(140deg, #4ade80, #16a34a);
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.32), 0 2px 6px rgba(22, 163, 74, 0.20);
}

.app-card__icon--amber {
  background: linear-gradient(140deg, #fbbf24, #d97706);
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.32), 0 2px 6px rgba(217, 119, 6, 0.20);
}

.app-card:hover .app-card__icon--coral  { transform: scale(1.08); box-shadow: 0 12px 32px rgba(var(--primary-rgb), 0.42); }
.app-card:hover .app-card__icon--violet { transform: scale(1.08); box-shadow: 0 12px 32px rgba(var(--violet-rgb), 0.42); }
.app-card:hover .app-card__icon--navy   { transform: scale(1.08); box-shadow: 0 12px 32px rgba(var(--accent-rgb), 0.38); }
.app-card:hover .app-card__icon--teal   { transform: scale(1.08); box-shadow: 0 12px 32px rgba(13, 148, 136, 0.42); }
.app-card:hover .app-card__icon--green  { transform: scale(1.08); box-shadow: 0 12px 32px rgba(22, 163, 74, 0.42); }
.app-card:hover .app-card__icon--amber  { transform: scale(1.08); box-shadow: 0 12px 32px rgba(217, 119, 6, 0.42); }
.app-card:hover .app-card__icon--indigo { transform: scale(1.08); box-shadow: 0 12px 32px rgba(79, 70, 229, 0.42); }

.app-card__icon--indigo {
  background: linear-gradient(140deg, #818cf8, #4f46e5);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.32), 0 2px 6px rgba(79, 70, 229, 0.20);
}

.app-card__badge {
  padding: 0.26rem 0.65rem;
  border-radius: 999px;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid rgba(var(--primary-rgb), 0.18);
  white-space: nowrap;
  flex-shrink: 0;
}

.app-card__badge--active {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.22);
}

.app-card__badge--inactive {
  color: #64748b;
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(100, 116, 139, 0.22);
}

.app-card__badge--new {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgba(var(--primary-rgb), 0.18);
}

.app-card__body {
  position: relative;
  z-index: 1;
  flex: 1;
}

.app-card__body h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  /* Card text follows the theme's "رنگ عمق" (depth/accent colour) so a per-user
     palette recolours the card copy too. */
  color: var(--accent);
}

.app-card__body p {
  margin: 0.5rem 0 0;
  color: rgba(var(--accent-rgb), 0.68);
  font-size: 0.875rem;
  line-height: 1.75;
  /* Clamp to a fixed number of lines so long/short descriptions never change
     the card's height — every card stays exactly the same size. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card__footer {
  position: relative;
  z-index: 1;
  margin-top: 1.4rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(var(--accent-rgb), 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.app-card__status {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.80rem;
  color: rgba(var(--accent-rgb), 0.5);
  font-weight: 500;
}

.app-card__status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

.app-card--disabled .app-card__status::before {
  background: #94a3b8;
}

.app-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  transition: color var(--transition-fast), gap var(--transition-fast);
}

.app-card__cta svg {
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.app-card:hover .app-card__cta {
  color: var(--primary);
  gap: 0.5rem;
}

.app-card:hover .app-card__cta svg {
  transform: translateX(3px);
}

/* ─── Empty state ─────────────────────────────── */

.empty-state {
  display: none;
  padding: 3.5rem 2rem;
  text-align: center;
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.empty-state.is-visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.empty-state__icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text-faint);
  margin-bottom: 0.25rem;
}

.empty-state__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.empty-state__desc {
  font-size: 0.875rem;
  color: var(--text-faint);
  margin: 0;
}

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

.footer {
  padding: 0.9rem 1.35rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text-faint);
  font-size: 0.80rem;
  animation: rise 0.85s ease 0.18s both;
  letter-spacing: 0.01em;
}

.footer a {
  color: var(--text-faint);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer a:hover { color: var(--primary); }

/* ─── Animations ──────────────────────────────── */

@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Responsive ──────────────────────────────── */

/* ── Mobile: native-app launcher ──────────────────────────────────────────
   Phones get an icon-first home screen: a sticky compact app bar, the
   marketing hero dropped, and cards collapsed to icon + label tiles. Tapping
   a tile opens the .peek bottom sheet (setupAppPeek) rather than navigating. */
@media (max-width: 768px) {
  .shell {
    padding-top: 0;
    padding-bottom: 2rem;
    gap: 0.85rem;
  }

  /* Sticky "app bar" — brand + live status stay pinned while the launcher
     scrolls underneath, the way a native top bar behaves. */
  .header {
    position: sticky;
    top: 0;
    z-index: var(--z-appbar);
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 0.7rem;
    padding: 0.55rem 1rem;
    padding-top: calc(0.55rem + env(safe-area-inset-top));
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    background: var(--glass-strong);
    box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.10);
  }

  .brand { gap: 0.6rem; }
  .brand__logo { width: 34px; height: 34px; border-radius: 10px; padding: 5px; }
  .brand__title--hero { font-size: 1rem; line-height: 1.3; }
  .brand__text p { display: none; }

  /* Collapse the status pill to just its pulsing dot to save the app bar's width. */
  .header__meta { margin-inline-start: auto; }
  .status-pill {
    padding: 0.3rem;
    gap: 0;
    font-size: 0;
    background: transparent;
    border: 0;
  }

  /* App feel: no marketing hero — the launcher grid is the home screen. */
  .hero,
  .hero--compact { display: none; }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  .toolbar__title { display: none; }
  .search { width: 100%; }

  /* Icon launcher: four tiles per row, like a phone home screen. */
  .apps-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem 0.4rem;
  }

  /* Zones become lightweight groupings on phones: no heavy rectangle chrome,
     just a labelled section above its launcher tiles. */
  .apps-grid--zoned { gap: 0.4rem; }
  .apps-zone {
    padding: 0.35rem 0 0.6rem;
    border: 0;
    background: transparent;
    border-radius: 0;
  }
  .apps-zone__head { margin-bottom: 0.55rem; }
  .apps-zone__grid { min-height: 0; }
  .apps-zone__empty { min-height: 64px; }

  .apps-grid .app-card {
    height: auto;
    min-height: 0;
    padding: 0.3rem 0.15rem;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: var(--radius-md);
    align-items: center;
    text-align: center;
    gap: 0.5rem;
    overflow: visible;
    animation-duration: 0.5s;
  }
  .apps-grid .app-card::before,
  .apps-grid .app-card::after { display: none; }

  .apps-grid .app-card__top {
    position: relative;
    width: 100%;
    margin: 0;
    justify-content: center;
  }
  .apps-grid .app-card__icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    transition: transform var(--transition-fast);
  }
  .apps-grid .app-card__icon svg { width: 31px; height: 31px; }
  /* Press feedback — the icon dips like a home-screen app. */
  .apps-grid .app-card:active .app-card__icon { transform: scale(0.9); }

  .apps-grid .app-card__body { flex: 0 0 auto; width: 100%; }
  .apps-grid .app-card__body h3 {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .apps-grid .app-card__body p,
  .apps-grid .app-card__footer { display: none; }

  /* No badges on the compact tiles. The label ("جدید" / "فعال" / "غیر فعال")
     doesn't fit, and shrinking it to an unlabelled corner dot just raises a
     question the tile can't answer. Desktop keeps the full text pill. */
  .apps-grid .app-card__badge { display: none; }

  /* Card management lives on desktop; keep the launcher tiles clean. */
  .apps-grid .app-card__admin { display: none; }

  .apps-grid .app-card--disabled { opacity: 0.5; }
  .apps-grid .app-card--disabled .app-card__icon { filter: grayscale(0.45); }
}

/* ── Mobile app peek (bottom sheet) ───────────────────────────────────────── */
.peek {
  position: fixed;
  inset: 0;
  z-index: var(--z-peek);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.peek[hidden] { display: none; }

.peek__scrim {
  position: absolute;
  inset: 0;
  background: rgba(var(--accent-rgb), 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.peek.is-open .peek__scrim { opacity: 1; }

.peek__sheet {
  position: relative;
  width: min(520px, 100%);
  padding: 0.75rem 1.4rem calc(1.5rem + env(safe-area-inset-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--glass-strong);
  box-shadow: 0 -12px 40px rgba(var(--accent-rgb), 0.20);
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  /* the sheet owns the swipe-to-dismiss gesture */
  touch-action: none;
}
.peek.is-open .peek__sheet { transform: translateY(0); }
.peek__sheet:focus { outline: none; }

.peek__grabber {
  width: 40px;
  height: 4px;
  margin: 0.25rem auto 1.1rem;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.22);
}

.peek__head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.peek__head .app-card__icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}
.peek__head .app-card__icon svg { width: 30px; height: 30px; }
.peek__headtext { min-width: 0; }

.peek__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--accent);
}
.peek__status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.32rem;
  font-size: 0.8rem;
  color: rgba(var(--accent-rgb), 0.55);
}
.peek__status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}
.peek--disabled .peek__status::before { background: #94a3b8; }

.peek__desc {
  margin: 0 0 1.35rem;
  font-size: 0.92rem;
  line-height: 1.85;
  color: rgba(var(--accent-rgb), 0.72);
}
.peek__desc:empty { display: none; }

.peek__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.95rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-lite), var(--primary));
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(var(--primary-rgb), 0.34);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.peek__cta:active { transform: scale(0.98); }
.peek__cta.peek__cta--hidden { display: none; }

@media (prefers-reduced-motion: reduce) {
  .peek__scrim { transition: opacity 0.01ms; }
  .peek__sheet { transition: none; }
}

@media (max-width: 400px) {
  .shell {
    width: calc(100% - 1.5rem);
  }
}

/* ── Easter egg trigger ──────────────────────────────────────────────────── */
#egg-trigger {
  cursor: default;
  user-select: none;
  display: inline-block;
}

@keyframes egg-pop {
  0%   { transform: scale(1);    opacity: 1; }
  40%  { transform: scale(1.55); opacity: 0.55; }
  100% { transform: scale(1);    opacity: 1; }
}

#egg-trigger.egg--pop {
  animation: egg-pop 0.22s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ── Toolbar actions / add-card button ─────────────────────────────────── */

.toolbar__actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: nowrap;
}

/* Search takes the flexible space; the add-card button sits right beside it. */
.toolbar__actions .search {
  flex: 0 1 340px;
  min-width: 0;
}

.toolbar__actions .add-card-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.add-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(140deg, var(--primary-lite), var(--primary));
  box-shadow: 0 6px 18px rgba(var(--primary-rgb), 0.30), 0 2px 6px rgba(var(--primary-rgb), 0.20);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.add-card-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(var(--primary-rgb), 0.38); }
.add-card-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.add-card-btn--ghost {
  color: var(--text);
  background: rgba(var(--accent-rgb), 0.07);
  box-shadow: none;
}

.add-card-btn--ghost:hover { background: rgba(var(--accent-rgb), 0.12); box-shadow: none; }


/* ── Category management modal ─────────────────────────────────────────── */

.category-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  max-height: 40vh;
  overflow-y: auto;
}

.category-list__empty {
  padding: 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), 0.05);
  color: var(--text-faint);
  font-size: 0.85rem;
  text-align: center;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(var(--surface-rgb), 0.6);
  border: 1.5px solid rgba(var(--accent-rgb), 0.10);
}

.category-row__order {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.category-row__order button,
.category-row__delete {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 7px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text-faint);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.category-row__order button:hover { background: rgba(var(--accent-rgb), 0.12); color: var(--text); }
.category-row__order button:disabled { opacity: 0.35; cursor: default; }
.category-row__order button:disabled:hover { background: rgba(var(--accent-rgb), 0.06); }

.category-row__title {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.category-row__title:focus {
  border-color: rgba(var(--primary-rgb), 0.45);
  background: rgba(var(--surface-rgb), 0.85);
}

.category-row__delete:hover { background: rgba(220, 38, 38, 0.12); color: #dc2626; }

.category-add-form {
  display: flex;
  gap: 0.5rem;
}

.category-add-form input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid rgba(var(--accent-rgb), 0.12);
  border-radius: var(--radius-sm);
  background: rgba(var(--surface-rgb), 0.70);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.category-add-form input:focus {
  border-color: rgba(var(--primary-rgb), 0.45);
  background: rgba(var(--surface-rgb), 0.88);
}

.category-add-form__btn {
  display: grid;
  place-items: center;
  width: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(140deg, var(--primary-lite), var(--primary));
  color: #fff;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.category-add-form__btn:hover { transform: translateY(-1px); }

/* ── Modal ──────────────────────────────────────────────────────────────── */

[hidden] { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(var(--accent-rgb), 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal {
  width: min(460px, 100%);
  max-height: min(88vh, 720px);
  overflow-y: auto;
  padding: 1.75rem;
  border-radius: var(--radius-xl);
  background: var(--glass-strong);
  animation: rise 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.modal__header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.modal__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--text-faint);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.modal__close:hover { background: rgba(var(--accent-rgb), 0.1); color: var(--text); }
.modal__close:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Form primitives (shared by the add-card modal) ────────────────────── */

.card-form, .login-form {
  display: flex;
  flex-direction: column;
  gap: 1.05rem;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.22);
  color: #b91c1c;
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.form-info {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(var(--primary-rgb, 58, 123, 213), 0.09);
  border: 1px solid rgba(var(--primary-rgb, 58, 123, 213), 0.22);
  color: var(--primary, #2563eb);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ── Login settings modal ─────────────────────────────────────────────── */
.sec-modal { max-width: 30rem; }

.sec-lead {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-muted, #64748b);
  margin: 0 0 1rem;
}

.sec-methods { display: flex; flex-direction: column; gap: 0.7rem; }

.sec-method { display: block; cursor: pointer; }
.sec-method input { position: absolute; opacity: 0; pointer-events: none; }

.sec-method__box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm, 12px);
  border: 1.5px solid rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.05);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.sec-method:hover .sec-method__box { border-color: rgba(var(--primary-rgb, 58, 123, 213), 0.5); }
.sec-method input:checked + .sec-method__box {
  border-color: var(--primary, #2563eb);
  background: rgba(var(--primary-rgb, 58, 123, 213), 0.08);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 58, 123, 213), 0.12);
}
.sec-method input:focus-visible + .sec-method__box { outline: 2px solid var(--primary, #2563eb); outline-offset: 2px; }

.sec-method__title { font-weight: 700; font-size: 0.92rem; }
.sec-method__desc { font-size: 0.8rem; line-height: 1.6; color: var(--text-muted, #64748b); }

.sec-active {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(22, 163, 74, 0.09);
  border: 1px solid rgba(22, 163, 74, 0.24);
  color: #15803d;
  font-size: 0.85rem;
  font-weight: 600;
}
.sec-active svg { flex: none; }

.sec-enroll { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.9rem; }
.sec-enroll__lead { font-size: 0.83rem; line-height: 1.7; color: var(--text-muted, #64748b); margin: 0; }

.sec-enroll__grid {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.sec-qr {
  flex: none;
  padding: 8px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  line-height: 0;
}
.sec-qr img { display: block; width: 168px; height: 168px; }

.sec-key { display: flex; flex-direction: column; gap: 0.4rem; min-width: 11rem; flex: 1; }
.sec-key__label { font-size: 0.78rem; color: var(--text-muted, #64748b); }
.sec-key__row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm, 10px);
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.24);
}
.sec-key__row code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  word-break: break-all;
  flex: 1;
}

.icon-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-muted, #64748b);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--primary, #2563eb); color: #fff; border-color: transparent; }

#sec-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.5em;
  text-align: center;
  font-size: 1.15rem;
}

[data-mode="dark"] .sec-method__box { background: rgba(148, 163, 184, 0.06); }
[data-mode="dark"] .icon-btn { background: rgba(255, 255, 255, 0.06); }
[data-mode="dark"] .sec-key__row { background: rgba(255, 255, 255, 0.05); }

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.field__control--plain input,
.field__control--plain textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid rgba(var(--accent-rgb), 0.12);
  border-radius: var(--radius-sm);
  background: rgba(var(--surface-rgb), 0.70);
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.field__control--plain input::placeholder,
.field__control--plain textarea::placeholder { color: var(--text-faint); }

.field__control--plain input:focus,
.field__control--plain textarea:focus {
  border-color: rgba(var(--primary-rgb), 0.45);
  background: rgba(var(--surface-rgb), 0.88);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.10);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  position: absolute;
  opacity: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.checkbox__box {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.2);
  background: rgba(var(--surface-rgb), 0.7);
  display: grid;
  place-items: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.checkbox__box svg {
  width: 12px;
  height: 12px;
  color: #fff;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.checkbox input:checked + .checkbox__box {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox input:checked + .checkbox__box svg {
  opacity: 1;
  transform: scale(1);
}

.checkbox input:focus-visible + .checkbox__box {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.submit-btn {
  position: relative;
  min-height: 50px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(140deg, var(--primary-lite), var(--primary));
  color: #fff;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.32), 0 2px 6px rgba(var(--primary-rgb), 0.20);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.submit-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(var(--primary-rgb), 0.40); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.submit-btn:disabled { cursor: default; opacity: 0.85; transform: none; }

.submit-btn__spinner {
  display: none;
  position: absolute;
  top: 50%;
  right: 50%;
  translate: 50% -50%;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(var(--surface-rgb), 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.submit-btn[data-loading="true"] .submit-btn__label { opacity: 0; }
.submit-btn[data-loading="true"] .submit-btn__spinner { display: block; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Icon / tone pickers ────────────────────────────────────────────────── */

.icon-picker, .tone-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.icon-picker__item {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.12);
  background: rgba(var(--surface-rgb), 0.6);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.icon-picker__item svg { width: 19px; height: 19px; }

.icon-picker__item:hover { background: rgba(var(--surface-rgb), 0.85); }

.icon-picker__item[aria-pressed="true"] {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.icon-picker__item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.tone-picker__item {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.tone-picker__item:hover { transform: scale(1.08); }

.tone-picker__item[aria-pressed="true"] {
  border-color: var(--accent);
}

.tone-picker__item[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
}

.tone-picker__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.app-card__admin {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 2;
  display: flex;
  gap: 0.35rem;
}

.app-card__manage,
.app-card__delete {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.app-card__manage {
  background: rgba(var(--accent-rgb), 0.10);
  color: var(--primary-strong, var(--accent));
}

.app-card__delete {
  background: rgba(220, 38, 38, 0.10);
  color: #dc2626;
}

.app-card:hover .app-card__manage,
.app-card:hover .app-card__delete { opacity: 1; }
.app-card__manage:hover { background: rgba(var(--accent-rgb), 0.18); }
.app-card__delete:hover { background: rgba(220, 38, 38, 0.18); }
.app-card__manage:focus-visible { opacity: 1; outline: 2px solid var(--primary); outline-offset: 2px; }
.app-card__delete:focus-visible { opacity: 1; outline: 2px solid #dc2626; outline-offset: 2px; }

/* ── Drag-and-drop reordering (GSAP Draggable sortable grid) ───────────────
   Ported from https://codepen.io/osublake/pen/jrqjdy — cards become freely
   draggable, absolutely-positioned grid items; grabbing one and crossing into
   a neighbour's cell swaps them, with every card easing to its new spot. */
.app-card--draggable {
  cursor: grab;
  touch-action: none;
  /* GSAP owns `transform` on these cards — kill the entry `rise` animation
     (its `both` fill would otherwise override GSAP's inline transform and
     stack every card at top-left) and drop transform from the CSS transition
     so it can't fight GSAP's per-frame updates. */
  animation: none;
  transition: box-shadow var(--transition-card), border-color var(--transition-card);
}
.app-card--draggable.is-dragging { cursor: grabbing; }
/* Hover lift is transform-based; let GSAP keep sole control of transform. */
.app-card--draggable:hover { transform: none; }

/* Lifted "picked up" state while GSAP drives its x/y — scale and shadow are
   set inline by JS (to animate in step with the drag), this just clears the
   card's own hover transform so it doesn't fight GSAP's transform. */
.app-card.is-dragging {
  transition: none;
  will-change: transform, box-shadow;
}
.app-card.is-dragging::before,
.app-card.is-dragging::after { opacity: 0 !important; }

/* ── Icon picker: search + pagination ───────────────────────────────────── */
.icon-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  margin-bottom: 0.6rem;
  border-radius: 12px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.12);
  background: rgba(var(--surface-rgb), 0.6);
}

.icon-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

.icon-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--text);
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 0.5rem;
  min-height: 116px;
  align-content: start;
}

.icon-picker__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.4rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.icon-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  margin-top: 0.7rem;
}

.icon-pager__btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.14);
  background: rgba(var(--surface-rgb), 0.7);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast);
}

.icon-pager__btn:hover:not(:disabled) { background: rgba(var(--surface-rgb), 0.95); }
.icon-pager__btn:disabled { opacity: 0.35; cursor: default; }
.icon-pager__info { font-size: 0.82rem; color: var(--text-muted); min-width: 3.2rem; text-align: center; }

/* ── Colour: preset tones + HSL picker ──────────────────────────────────── */
.color-field {
  display: flex;
  gap: 0.9rem;
  align-items: stretch;
}

.color-preview {
  width: 56px;
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(var(--surface-rgb), 0.25);
}

.color-field__body { flex: 1; display: flex; flex-direction: column; gap: 0.7rem; }

.tone-picker.is-inactive .tone-picker__item { opacity: 0.55; }

.hsl-picker { display: flex; flex-direction: column; gap: 0.45rem; }

/* ── Hex / colour-code input ─────────────────────────────────────────────── */
.hex-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.hex-swatch {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  padding: 0;
  border: 1.5px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 10px;
  background: none;
  cursor: pointer;
  transition: border-color var(--transition-fast);
}
.hex-swatch:hover { border-color: rgba(var(--primary-rgb), 0.4); }
.hex-swatch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.hex-swatch::-webkit-color-swatch-wrapper { padding: 3px; }
.hex-swatch::-webkit-color-swatch { border: none; border-radius: 6px; }
.hex-swatch::-moz-color-swatch { border: none; border-radius: 6px; }

.hex-input {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.85rem;
  border: 1.5px solid rgba(var(--accent-rgb), 0.12);
  border-radius: var(--radius-sm);
  background: rgba(var(--surface-rgb), 0.70);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
.hex-input__hash { color: var(--text-faint); font-size: 0.9rem; }
.hex-input input {
  flex: 1;
  min-width: 0;
  padding: 0.62rem 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  outline: none;
}
.hex-input input::placeholder { text-transform: none; letter-spacing: normal; color: var(--text-faint); }
.hex-input:focus-within {
  border-color: rgba(var(--primary-rgb), 0.45);
  background: rgba(var(--surface-rgb), 0.88);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.10);
}
.hex-input:has(input.is-invalid) {
  border-color: rgba(220, 38, 38, 0.5);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08);
}

.hsl-picker__row {
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.hsl-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.14);
  outline: none;
  cursor: pointer;
}

.hsl-slider--h {
  background: linear-gradient(to right, hsl(0 80% 50%), hsl(60 80% 50%), hsl(120 80% 50%), hsl(180 80% 50%), hsl(240 80% 50%), hsl(300 80% 50%), hsl(360 80% 50%));
}

.hsl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

.hsl-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  cursor: pointer;
}

.color-readout {
  font-size: 0.78rem;
  color: var(--text-muted);
  direction: ltr;
  text-align: right;
}

/* ── Badge toggle ───────────────────────────────────────────────────────── */
.badge-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.badge-picker__item {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.14);
  background: rgba(var(--surface-rgb), 0.6);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast), background var(--transition-fast);
}

.badge-picker__item:hover { background: rgba(var(--surface-rgb), 0.9); }

.badge-picker__item[aria-pressed="true"] {
  color: #fff;
  border-color: transparent;
}
.badge-picker__item--new[aria-pressed="true"]      { background: var(--primary); }
.badge-picker__item--active[aria-pressed="true"]   { background: #16a34a; }
.badge-picker__item--inactive[aria-pressed="true"] { background: #64748b; }
.badge-picker__item--none[aria-pressed="true"]     { background: #334155; }

.badge-picker__item:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Dark-mode toggle (header) ──────────────────────────────────────────────
   A sun/moon button next to the status pill. hub.js only unhides it on the
   default palette; the [aria-pressed] state swaps which glyph shows. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text-muted);
  cursor: pointer;
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  transition: color var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
}
.theme-toggle:hover { color: var(--text); background: var(--glass-strong); }
.theme-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.theme-toggle svg { width: 18px; height: 18px; transition: transform 480ms cubic-bezier(0.4, 0, 0.2, 1); }
/* Show the moon in light mode (tap → go dark), the sun in dark mode. */
.theme-toggle .theme-toggle__sun { display: none; }
.theme-toggle[aria-pressed="true"] .theme-toggle__moon { display: none; }
.theme-toggle[aria-pressed="true"] .theme-toggle__sun { display: block; }
/* Spin the icon a half-turn on press, echoing the circular page reveal. */
.theme-toggle:active svg { transform: rotate(180deg) scale(0.85); }

/* ── Install / download menu ────────────────────────────────────────────────
   Sits next to the theme toggle and shares its pill shape. Hidden entirely
   when the hub is already running as an installed app. */
.install { position: relative; display: inline-flex; }

/* Fixed + moved to <body> by pwa.js, because .header sets overflow:hidden
   (for the shimmer line and the hero text) and would otherwise clip the menu.
   position:fixed alone isn't enough — .glass sets backdrop-filter, which makes
   the header a containing block for fixed descendants. Coordinates come from
   the button's bounding rect. */
.install__menu {
  position: fixed;
  /* Physical top/left on purpose: pwa.js writes both from the button's rect.
     The logical inset-inline-start resolves to `right` in this RTL document,
     which combined with a fixed width over-constrains the box and makes the
     browser discard the JS-set `left` — pinning the menu to the page edge. */
  top: 0;
  left: 0;
  right: auto;
  z-index: 120;
  width: 15.5rem;
  padding: 0.55rem;
  border-radius: 1rem;
  border: 1px solid var(--glass-border);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(var(--blur));
  backdrop-filter: blur(var(--blur));
  box-shadow: 0 18px 40px -18px rgba(8, 15, 40, 0.55);
  animation: install-in 160ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes install-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.install__title {
  margin: 0.15rem 0.5rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.install__item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 0;
  border-radius: 0.7rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.install__item:hover { background: var(--glass); }
.install__item:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Set by install.js when the APK hasn't been published yet — the row stays
   visible so the option is discoverable, but can't be clicked into a 404. */
.install__item[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.install__item-icon { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-muted); }
.install__item-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.install__item-name { font-size: 0.83rem; font-weight: 600; }
.install__item-desc { font-size: 0.7rem; color: var(--text-muted); }

.install__hint {
  margin: 0.35rem 0.6rem 0.2rem;
  font-size: 0.7rem;
  line-height: 1.8;
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .install__menu { animation: none; }
}

/* ── Dark/light switch: circular reveal via the View Transitions API ────────
   The new mode is painted over the old one, then clipped in from the toggle
   button by hub.js. Kill the browser's default cross-fade so only the circle
   drives the transition; keep the old snapshot static underneath. */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
@media (prefers-reduced-motion: reduce) {
  .theme-toggle svg { transition: none; }
}

/* ── Dark mode — DEFAULT THEME ONLY ─────────────────────────────────────────
   Applied by hub.js as html[data-mode="dark"], and ONLY when the viewer has no
   custom per-user palette (a custom theme keeps its own light surfaces). The
   whole hub derives from the variables below, so flipping the page surface +
   text variables recolours it wholesale. The brand hues (primary/accent/violet)
   stay put so the navy icon tiles and gradients keep their look; the few spots
   that use --accent as *foreground text* are remapped to --text further down so
   card/peek copy stays legible on dark glass. Ambient orbs/gradient keep their
   default (light-tuned) intensity — boosting them for dark made the backdrop
   busy, so the scene just stays calm/subtle instead. */
html[data-mode="dark"] {
  /* Dark glass base — every --glass* derives from this triplet. */
  --surface-rgb: 30, 38, 58;
  --glass: rgba(var(--surface-rgb), 0.55);
  --glass-strong: rgba(var(--surface-rgb), 0.80);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-strong: rgba(255, 255, 255, 0.16);
  --glass-shadow: rgba(0, 0, 0, 0.38);
  --glass-shadow-deep: rgba(0, 0, 0, 0.52);

  --page-bg: #0b1120;
  --page-bg-hi: #141d33;
  --page-bg-lo: #070c18;

  --text: #e7ecf6;
  --text-muted: #a7b2c6;
  --text-faint: #6b7890;
}

/* Foreground copy that uses the brand "depth" colour (--accent, a dark navy)
   would be dark-on-dark now, so follow the light text variables instead. */
html[data-mode="dark"] .hero-phrase__cool,
html[data-mode="dark"] .app-card__body h3,
html[data-mode="dark"] .app-card__cta,
html[data-mode="dark"] .peek__title { color: var(--text); }

html[data-mode="dark"] .app-card__body p,
html[data-mode="dark"] .peek__desc { color: var(--text-muted); }

html[data-mode="dark"] .app-card__status,
html[data-mode="dark"] .peek__status { color: var(--text-faint); }

/* ═══════════════════════════════════════════════════════════════════════
   NEUMORPHISM
   Overrides the glassmorphism layer above. Everything shares ONE solid
   background colour and is shaped purely with a light shadow (top-left) +
   dark shadow (bottom-right): raised = extruded, inset = pressed / carved.
   Palette: slate #34515E / cyan #98D0DE / white / black.
   ═══════════════════════════════════════════════════════════════════════ */
:root {
  --nm-bg: #e4ecf0;
  --nm-dark: #c1ccd3;   /* bottom-right shadow */
  --nm-light: #ffffff;  /* top-left highlight  */
  --nm-raise:    7px 7px 15px var(--nm-dark), -7px -7px 15px var(--nm-light);
  --nm-raise-lg: 11px 11px 24px var(--nm-dark), -11px -11px 24px var(--nm-light);
  --nm-raise-sm: 4px 4px 9px var(--nm-dark), -4px -4px 9px var(--nm-light);
  --nm-inset:    inset 5px 5px 11px var(--nm-dark), inset -5px -5px 11px var(--nm-light);
  --nm-inset-sm: inset 3px 3px 6px var(--nm-dark), inset -3px -3px 6px var(--nm-light);
}
html[data-mode="dark"] {
  --nm-bg: #33505d;
  --nm-dark: #273e48;
  --nm-light: #40626f;
}

body { background: var(--nm-bg) !important; }

/* Flat backdrop — no floating orbs, blur or noise in neumorphism. */
.bg-scene { background: var(--nm-bg) !important; }
.orb, .noise { display: none !important; }

/* ── Raised surfaces ─────────────────────────────────────────── */
.glass,
.app-card,
.modal,
.peek__sheet,
.install__menu,
.empty-state {
  background: var(--nm-bg) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: none !important;
  box-shadow: var(--nm-raise) !important;
}

/* Cards lift further on hover; drop the glass sheen/glow pseudo-layers. */
.app-card::before,
.app-card::after { display: none !important; }
.app-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--nm-raise-lg) !important;
}
.app-card:active { box-shadow: var(--nm-inset) !important; transform: translateY(0); }

/* ── Buttons: raised, press to inset ─────────────────────────── */
.submit-btn,
.add-card-btn,
.category-add-form__btn {
  background: var(--nm-bg) !important;
  color: var(--primary) !important;
  border: none !important;
  box-shadow: var(--nm-raise-sm) !important;
}
.submit-btn:hover,
.add-card-btn:hover,
.category-add-form__btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--nm-raise) !important;
}
.submit-btn:active,
.add-card-btn:active,
.category-add-form__btn:active {
  box-shadow: var(--nm-inset-sm) !important;
  transform: translateY(0);
}
.add-card-btn--ghost { color: var(--text-muted) !important; }

/* Round icon buttons */
.theme-toggle,
.modal__close,
.icon-btn,
.icon-pager__btn {
  background: var(--nm-bg) !important;
  border: none !important;
  box-shadow: var(--nm-raise-sm) !important;
}
.theme-toggle:hover,
.modal__close:hover,
.icon-btn:hover,
.icon-pager__btn:hover { box-shadow: var(--nm-raise) !important; }
.theme-toggle:active,
.modal__close:active,
.icon-btn:active,
.icon-pager__btn:active { box-shadow: var(--nm-inset-sm) !important; }

/* ── Inputs & recessed elements: carved in (inset) ───────────── */
.search,
.icon-search,
.field__control--plain,
.hex-input,
.status-pill,
.sec-switch__track,
.category-add-form input {
  background: var(--nm-bg) !important;
  border: none !important;
  box-shadow: var(--nm-inset) !important;
}
.status-pill,
.sec-switch__track { box-shadow: var(--nm-inset-sm) !important; }
.search input,
.icon-search input,
.field__control--plain input,
.field__control--plain textarea,
.category-add-form input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.search:focus-within,
.field__control--plain:focus-within { box-shadow: var(--nm-inset), 0 0 0 2px rgba(var(--primary-rgb), 0.35) !important; }

/* ── Small chips: badge & icon picker tiles ──────────────────── */
.badge-picker__item,
.icon-picker button,
.tone-picker button {
  background: var(--nm-bg) !important;
  border: none !important;
  box-shadow: var(--nm-raise-sm) !important;
}
.badge-picker__item:hover,
.icon-picker button:hover,
.tone-picker button:hover { box-shadow: var(--nm-raise) !important; }
.icon-picker button[aria-pressed="true"],
.tone-picker button[aria-pressed="true"] { box-shadow: var(--nm-inset-sm) !important; }

/* App-card icons keep their colour but trade the drop-shadow for a soft
   raised puck so they sit in the neumorphic surface. */
.app-card__icon { box-shadow: var(--nm-raise-sm) !important; }
