/* ============================================================================
   APPLE-MINIMAL — a portable design system
   Extracted from the Clever Albums UI. Drop this file into a project and use
   it as the single source of truth for look & feel.

   ── HOW TO USE THIS FILE (for a coding agent) ──────────────────────────────
   1. Link this file FIRST, before any component CSS.
   2. Never hardcode a color, radius, shadow or duration — use the tokens in
      :root. If a value is missing, add a token instead of a literal.
   3. Compose UI out of the primitives below (.pill-btn, .icon-btn, .card,
      .field, .menu, .modal-card, .chip, .segmented …). Only write new CSS for
      what is genuinely product-specific, and match the conventions here.
   4. Keep the rules in "DESIGN LAWS" — they are what makes it feel Apple-like.

   ── DESIGN LAWS ────────────────────────────────────────────────────────────
   • Restraint. One accent color (blue), one danger color (red), everything
     else is greyscale. No gradients except on the logo/brand mark.
   • Hierarchy through weight and color, not size. Body text is small (13px
     UI / 14.5px prose); headings are heavy (600–700) and tightly tracked
     (letter-spacing: -0.01em … -0.022em).
   • Surfaces are white on #f5f5f7. Depth comes from hairline borders
     (rgba(0,0,0,.09)) + soft two-layer shadows — never from heavy strokes.
   • Chrome (headers, bars, popovers, overlays) is frosted glass:
     translucent white + backdrop-filter blur + saturate. Always ship the
     -webkit- prefix.
   • Radii: 6–8px for small controls, 10–16px for cards/modals, 980px for
     pills and anything capsule-shaped, 50% for round buttons/avatars.
   • Motion is fast and subtle: 0.12–0.18s for hover/press, 0.22–0.28s for
     appearance, 0.5–0.6s for the on-load entrance of page content, 0.7s+ only
     for scroll-reveal. Easing is cubic-bezier(0.2,0.9,0.3,1) family; never
     linear, never bouncy above 1.2.
   • Feedback on every interactive element: hover tint, :active scale(0.97),
     focus = accent border (not an outline ring).
   • Empty states get a dashed-outline icon + one quiet sentence + one action.
   • Text that can be long (translations, user input) must be allowed to wrap
     or ellipsis — flex-wrap and min-width: 0 everywhere.
   • Prose is centered on a max-width: 640px column with text-wrap: balance
     on headings and intros.
   ========================================================================= */

/* ---------------------------------------------------------------- TOKENS -- */

:root {
  /* surface */
  --bg: #f5f5f7;
  --panel: #ffffff;
  --border: rgba(0, 0, 0, 0.09);
  --border-soft: rgba(0, 0, 0, 0.05);

  /* ink */
  --text: #1d1d1f;
  --text-2: #86868b;          /* secondary / labels / meta */
  --text-prose: #45454c;      /* body copy, and any grey over a photo */

  /* action */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --accent-soft-hover: rgba(0, 113, 227, 0.16);
  --danger: #ff3b30;
  --danger-hover: #e0342b;
  --danger-soft: rgba(255, 59, 48, 0.08);

  /* neutral washes — hover states on light surfaces */
  --wash-1: rgba(0, 0, 0, 0.04);
  --wash-2: rgba(0, 0, 0, 0.06);
  --wash-3: rgba(0, 0, 0, 0.09);
  --placeholder: #ececf0;     /* image / media placeholder */

  /* shape */
  --radius-xs: 6px;
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-pill: 980px;

  /* depth */
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.07);
  --shadow-big: 0 2px 6px rgba(0, 0, 0, 0.08), 0 18px 50px rgba(0, 0, 0, 0.14);
  --shadow-accent: 0 10px 30px rgba(0, 113, 227, 0.35);

  /* glass */
  --glass: rgba(255, 255, 255, 0.82);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --glass-blur: blur(20px) saturate(1.6);
  --scrim: rgba(40, 40, 44, 0.38);
  --scrim-blur: blur(22px) saturate(1.4);

  /* type */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  --fs-ui: 13px;              /* app chrome default */
  --fs-prose: 14.5px;         /* marketing / documentation copy */

  /* motion */
  --ease: cubic-bezier(0.2, 0.9, 0.3, 1);
  --ease-glide: cubic-bezier(0.3, 0.8, 0.3, 1);
  --ease-reveal: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 0.12s;
  --t: 0.15s;
  --t-med: 0.22s;
  --t-slow: 0.7s;
  --t-enter: 0.55s;           /* on-load entrance of page content */
  --stagger: 60ms;            /* delay step between staggered entrance items */
  --enter-y: 14px;            /* how far entrance content travels */

  /* chrome metrics */
  --header-h: 56px;           /* site pages */
  --toolbar-h: 50px;          /* app toolbar */
}

/* ------------------------------------------------------------ BASE / RESET */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: var(--fs-ui);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;   /* mobile Safari must not inflate text */
}

/* App shells (not documents) additionally set:
   body { overflow: hidden; user-select: none; } */

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
button:disabled { opacity: 0.35; cursor: default; }

input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; }

/* ------------------------------------------------------------- TYPOGRAPHY */

.page-title   { font-size: 30px;   font-weight: 700; letter-spacing: -0.022em; }
.section-title{ font-size: 20px;   font-weight: 700; letter-spacing: -0.015em; }
.card-title   { font-size: 16px;   font-weight: 700; letter-spacing: -0.02em; }
.panel-title  { font-size: 13px;   font-weight: 600; letter-spacing: -0.01em; }
.sec-title    { font-size: 12px;   font-weight: 600; letter-spacing: -0.01em; }

.lead {
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
  text-wrap: balance;
}
.prose {
  font-size: var(--fs-prose);
  line-height: 1.6;
  color: var(--text-prose);
}
.meta      { font-size: 11.5px; color: var(--text-2); }
.hint-text { font-size: 11px; color: var(--text-2); line-height: 1.5; }
.tabular   { font-variant-numeric: tabular-nums; }

/* the article column */
.article { max-width: 640px; margin: 0 auto; }
.article h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.article h3 { margin-top: 24px; font-size: 14.5px; font-weight: 600; }
.article p  { margin-top: 12px; font-size: var(--fs-prose); line-height: 1.6; color: var(--text-prose); }
.article section { margin-top: 52px; }

/* ----------------------------------------------------------------- GLASS */

/* Any bar, popover or floating surface that sits over content. */
.glass {
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

/* Sticky page header. Keep z-index above scrolling content — cards and
   transformed elements create their own stacking contexts. */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}

/* Dense app toolbar variant. */
.app-toolbar {
  height: var(--toolbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: var(--glass);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}

.brand-mark {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #3a3a3c, #1d1d1f);
  flex: 0 0 auto;
}

.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

/* --------------------------------------------------------------- BUTTONS */

/* The workhorse: a capsule button in four tones. */
.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 12.5px;
  text-decoration: none;
  transition: background var(--t) ease, transform 0.1s ease;
}
.pill-btn:active { transform: scale(0.97); }
.pill-btn.ghost { color: var(--text); }
.pill-btn.ghost:hover { background: var(--wash-2); }
.pill-btn.accent { background: var(--accent); color: #fff; }
.pill-btn.accent:hover { background: var(--accent-hover); }
.pill-btn.accent-ghost { color: var(--accent); background: var(--accent-soft); }
.pill-btn.accent-ghost:hover { background: var(--accent-soft-hover); }
.pill-btn.danger { background: var(--danger); color: #fff; }
.pill-btn.danger:hover { background: var(--danger-hover); }

/* Hero call-to-action. */
.cta-big {
  font-size: 16.5px;
  font-weight: 600;
  padding: 15px 34px;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-accent);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.cta-big:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(0, 113, 227, 0.42); }

/* Square icon button — toolbars, panel heads. */
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--text);
  transition: background var(--t) ease;
}
.icon-btn:not(:disabled):hover { background: var(--wash-2); }
.icon-btn.on { background: rgba(0, 0, 0, 0.07); }
.icon-btn.tiny { width: 22px; height: 22px; border-radius: var(--radius-xs); }

/* Small tinted button — inside panels, next to titles. */
.mini-btn {
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.045);
  transition: background var(--t) ease;
}
.mini-btn:hover { background: var(--wash-3); }
.mini-btn.accent-text { color: var(--accent); background: var(--accent-soft); }
.mini-btn.danger-text { color: var(--danger); background: var(--danger-soft); }

/* Nav links: constant font-weight so the active state never nudges the row. */
.nav-link {
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--t) ease, background var(--t) ease;
}
.nav-link:hover,
.nav-link.active { color: var(--text); }

/* Round floating button over media (close / delete / duplicate). */
.round-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  display: grid;
  place-items: center;
  transition: opacity var(--t) ease, color var(--t) ease;
}
.round-btn:hover { color: var(--text); }
.round-btn.danger-hover:hover { color: var(--danger); }

/* ----------------------------------------------------------------- CHIPS */

.chip-row { display: flex; flex-wrap: wrap; gap: 6px 4px; }
.chip {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--wash-1);
  transition: all var(--t) ease;
}
.chip.active { background: var(--text); color: #fff; }

/* ------------------------------------------------------ SEGMENTED CONTROL */

/* iOS-style switch: pill track, white raised thumb on the active item. */
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.05);
}
.segmented button {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  color: var(--text-2);
  transition: background var(--t) ease, color var(--t) ease;
}
.segmented button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Bordered button group (toolbars inside inspectors). */
.btn-group {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.btn-group button {
  flex: 1;
  min-width: 0;
  height: 26px;
  border-left: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  display: grid;
  place-items: center;
}
.btn-group button:first-child { border-left: 0; }
.btn-group button:hover:not(:disabled) { background: var(--accent-soft); }
.btn-group button.active { background: var(--text); color: #fff; }
.btn-group button:disabled { opacity: 0.3; cursor: default; }

/* ----------------------------------------------------------------- FORMS */

/* A labelled control. The label row is flex so the live value sits right. */
.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field-val { color: var(--text); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: border-color var(--t) ease;
}
.text-input:focus { border-color: var(--accent); }

.num-input {
  width: 62px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 5px 7px;
  font-size: 12px;
  outline: none;
}
.num-input:focus { border-color: var(--accent); }

.textarea {
  width: 100%;
  resize: vertical;
  min-height: 56px;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12.5px;
  background: var(--bg);
  color: var(--text);
}
.textarea:focus { outline: none; border-color: var(--accent); }

/* Inline editable title — invisible until hovered. */
.ghost-input {
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  outline: none;
  transition: background var(--t) ease;
}
.ghost-input:hover { background: var(--wash-1); }
.ghost-input:focus { background: var(--wash-2); }

.select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 4px 6px;
  font-size: 12px;
  outline: none;
}
.select.wide { width: 100%; padding: 6px 8px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.1);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

input[type="color"] {
  width: 24px; height: 24px;
  border: none;
  border-radius: 50%;
  overflow: hidden;
  padding: 0;
  background: none;
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 50%; }

.swatch-row { display: flex; gap: 7px; align-items: center; }
.swatch {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }

.check-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
}

/* --------------------------------------------------------------- SURFACES */

.panel {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 6px;
  flex-wrap: wrap;          /* long labels drop to a second line, never clip */
  padding: 12px 12px 8px;
}
.panel-section {
  padding: 14px 14px 16px;
  border-bottom: 1px solid var(--border-soft);
}

/* Collapsible section: chevron rotates, everything but the title hides. */
.collapsible > .sec-title { cursor: pointer; user-select: none; display: flex;
  align-items: center; justify-content: space-between; gap: 6px 8px; flex-wrap: wrap; }
.chev { color: var(--text-2); flex: 0 0 auto; transition: transform 0.18s ease, color var(--t) ease; }
.collapsible > .sec-title:hover .chev { color: var(--text); }
.collapsible.collapsed .chev { transform: rotate(-90deg); }
.collapsible.collapsed > :not(.sec-title) { display: none; }

/* Content card — the grid tile. Lifts on hover. */
.card {
  position: relative;
  background: var(--panel);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-big); }
.card-cover {
  aspect-ratio: 2 / 1;
  background: var(--placeholder) center/cover no-repeat;
  border-bottom: 1px solid var(--border-soft);
}
.card-body { padding: 11px 13px 12px; }
.card-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Hover-revealed controls on a card */
.card .round-btn { position: absolute; top: 8px; right: 8px; opacity: 0; }
.card:hover .round-btn { opacity: 1; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px;
  align-content: start;
}

/* Frosted hero card over a photo backdrop. */
.glass-card {
  padding: 40px 36px 44px;
  border-radius: var(--radius-2xl);
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(30px) saturate(1.7);
  -webkit-backdrop-filter: blur(30px) saturate(1.7);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.13);
}

.avatar {
  width: 128px; height: 128px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  user-select: none;
}

/* --------------------------------------------------------------- POPOVERS */

.menu-anchor { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 170px;
  background: var(--glass-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-big);
  padding: 5px;
  z-index: 50;
}
.menu.scrollable { max-height: 340px; overflow-y: auto; }
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}
.menu-item:hover { background: var(--accent); color: #fff; }
.menu-item.active { background: var(--accent-soft); color: var(--accent); }
.menu-item.active:hover { color: #fff; }

/* --------------------------------------------------- OVERLAYS & DIALOGS -- */

/* Full-screen scrim. The blur is what makes it read as Apple, not the dim. */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  place-items: center;
}
.overlay[hidden] { display: none !important; }
.overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--scrim);
  backdrop-filter: var(--scrim-blur);
  -webkit-backdrop-filter: var(--scrim-blur);
}

.modal-card {
  position: relative;
  z-index: 2;                 /* above the ::before scrim */
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-big);
  animation: pop-in var(--t-med) cubic-bezier(0.2, 0.9, 0.3, 1.05);
  max-width: 92vw;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 10px 20px;
}
.modal-title { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 16px;
}
.foot-spacer { flex: 1; }

/* Confirm / prompt dialog — a modal-card with fixed width. */
.dialog { width: 400px; max-width: 92vw; padding: 22px 22px 16px; }
.dialog-title {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  text-wrap: balance;
}
.dialog-body {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-2);
  white-space: pre-line;      /* keep authored paragraph breaks */
}
.dialog-foot { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.dialog-foot::before { content: ""; flex: 1; }   /* push actions right */
.dialog-foot .pill-btn { padding: 7px 16px; }

/* ----------------------------------------------------------------- TOAST */

.toast {
  position: fixed;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(29, 29, 31, 0.92);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-big);
  animation: toast-in 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  pointer-events: none;
  white-space: nowrap;
}

/* ---------------------------------------------------------- EMPTY STATES */

.empty-hint {
  color: var(--text-2);
  text-align: center;
  font-size: 12.5px;
  line-height: 1.6;
  padding: 34px 16px;
}
.empty-icon {
  width: 44px; height: 44px;
  margin: 0 auto 10px;
  border: 1.5px dashed rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: rgba(0, 0, 0, 0.3);
  background: none;
  transition: border-color var(--t) ease, color var(--t) ease, background var(--t) ease;
}
button.empty-icon:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
/* Centered full-panel empty state */
.empty-state {
  min-height: 52vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}
.empty-state .cta-big { margin-top: 22px; }

/* ------------------------------------------------------- LISTS & KEY CAPS */

/* Numbered steps with quiet circled digits, Apple-doc style. */
.steps { list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 40px;
  margin-top: 14px;
  font-size: var(--fs-prose);
  line-height: 1.55;
  color: var(--text-prose);
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
}

.bullets { list-style: none; }
.bullets li {
  position: relative;
  padding-left: 18px;
  margin-top: 9px;
  font-size: var(--fs-prose);
  line-height: 1.55;
  color: var(--text-prose);
}
.bullets li::before {
  content: "";
  position: absolute;
  left: 2px; top: 0.62em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-2);
}

/* Two-column shortcut table with macOS-style key caps. */
.key-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 9px 0;
}
.key-row + .key-row { border-top: 1px solid var(--border-soft); }
kbd {
  display: inline-block;
  padding: 2px 7px 3px;
  border-radius: var(--radius-xs);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
}

/* ---------------------------------------------------------------- FOOTER */

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 22px 26px 26px;
  margin-top: 24px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-2);
  font-size: 12.5px;
}

/* ------------------------------------------------------ MOTION & REVEAL -- */

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.95); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(-6px); }
  to   { opacity: 1; transform: none; }
}

/* On-load entrance. Deliberately a CSS `animation` and not a JS-toggled class:
   an animation finishes by itself, so a page can never be left blank because a
   script failed or is switched off. Order the sequence with an index on the
   element — style="--i:3" — and use .fade-only on anything sticky: a transform
   makes a pinned element travel away from where it is pinned.
   Fill is `backwards`, never `forwards`: a forwards fill would pin
   transform:none on the element for good and silently kill its :hover/:active
   feedback. */
@property --i {
  syntax: "<number>";
  inherits: false;        /* an index belongs to one element, not to its subtree */
  initial-value: 0;
}

@keyframes enter-up {
  from { opacity: 0; transform: translateY(var(--enter-y)); }
  to   { opacity: 1; transform: none; }
}

.enter {
  animation: enter-up var(--t-enter) var(--ease-reveal) backwards;
  animation-delay: calc(var(--i) * var(--stagger));   /* the shorthand above resets it */
}
.enter.fade-only { --enter-y: 0px; }

/* Scroll-reveal: add .in via IntersectionObserver when the section enters. */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--t-slow) ease, transform var(--t-slow) var(--ease-reveal);
}
.reveal.fade-only { transform: none; }
.reveal.in { opacity: 1; transform: none; }

/* Collapsing side panels: animate width, and keep the inner content at a
   fixed width so nothing reflows during the transition. */
.collapsible-panel {
  transition: width 0.28s var(--ease-glide);
  overflow: hidden;
  min-width: 0;
  flex: 0 0 auto;
}
.collapsible-panel .panel-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
}

/* Zeroing the durations is not enough: a staggered entrance holds its first
   frame for the length of its delay, so without this the reader who asked for
   less motion is the one who waits on a blank element. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
  .reveal { opacity: 1; transform: none; }
  .enter  { animation: none !important; }
}

/* ------------------------------------------------------------- UTILITIES */

.row      { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.spacer   { flex: 1; }
.truncate { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.balance  { text-wrap: balance; }
[hidden]  { display: none !important; }

/* -------------------------------------------------------------- RESPONSIVE */

/* Single breakpoint: phone. Chrome tightens, headings shrink one step,
   two-column rows stack, and bottom padding respects the home indicator. */
@media (max-width: 700px) {
  .app-header { padding: 0 14px; }
  .nav-link { padding: 6px 7px; font-size: 12.5px; }
  .page-title { font-size: 24px; }
  .card-title { font-size: 15px; }
  .cta-big { font-size: 15px; padding: 13px 28px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .key-row { grid-template-columns: 1fr; gap: 4px; }
  .glass-card { padding: 32px 20px 36px; }
  .avatar { width: 104px; height: 104px; }
  .page-footer {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  }
}

/* ---------------------------------------------------------------- RTL --- */

:root[dir="rtl"] .ghost-input,
:root[dir="rtl"] .text-input,
:root[dir="rtl"] .menu-item,
:root[dir="rtl"] .field > label,
:root[dir="rtl"] .dialog-title,
:root[dir="rtl"] .dialog-body { text-align: right; }
:root[dir="rtl"] .menu { left: 0; right: auto; }
