/* ============================================================ Kapela Apps
   "Today" — Apple-grade storefront.
   Grayscale chrome · system blue actions only · SF Pro · frosted materials.
   Auto light/dark (prefers-color-scheme) + manual override on <html>.
   ========================================================================= */

:root {
  /* light — Apple grays */
  --bg:          #f5f5f7;
  --surface:     #ffffff;
  --surface-2:   #f0f0f3;
  --elevated:    #ffffff;
  --ink:         #1d1d1f;
  --ink-2:       #6e6e73;
  --ink-3:       #86868b;
  --hairline:    #d2d2d7;
  --hairline-2:  #c7c7cc;
  --accent:      #0071e3;          /* system blue */
  --accent-2:    #0077ed;
  --accent-tint: rgba(0,113,227,.10);
  --nav-bg:      rgba(245,245,247,.72);
  --bar-tint:    rgba(255,255,255,.18);
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06);
  --shadow-md:   0 6px 24px -10px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.05);
  --shadow-lg:   0 30px 60px -24px rgba(0,0,0,.28), 0 8px 24px -12px rgba(0,0,0,.12);
  --icon-ring:   inset 0 0 0 .5px rgba(0,0,0,.08), inset 0 1px 1px rgba(255,255,255,.4);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", Helvetica, "Segoe UI", system-ui, Roboto, Arial, sans-serif;

  --maxw: 1024px;
  --r-card: 18px;
  --r-today: 28px;
  --r-tile: 22.5%;            /* iOS app-icon golden radius */
  --ease: cubic-bezier(.32,.72,0,1);
}

/* dark — shared by auto (media) + forced (attribute) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #000000;
    --surface:     #1d1d1f;
    --surface-2:   #2c2c2e;
    --elevated:    #2c2c2e;
    --ink:         #f5f5f7;
    --ink-2:       #a1a1a6;
    --ink-3:       #86868b;
    --hairline:    #38383a;
    --hairline-2:  #48484a;
    --accent:      #2997ff;
    --accent-2:    #0a84ff;
    --accent-tint: rgba(41,151,255,.16);
    --nav-bg:      rgba(0,0,0,.7);
    --bar-tint:    rgba(255,255,255,.14);
    --shadow-sm:   0 1px 3px rgba(0,0,0,.5);
    --shadow-md:   0 8px 28px -12px rgba(0,0,0,.7);
    --shadow-lg:   0 36px 70px -28px rgba(0,0,0,.85), 0 8px 24px rgba(0,0,0,.5);
    --icon-ring:   inset 0 0 0 .5px rgba(255,255,255,.1), inset 0 1px 1px rgba(255,255,255,.12);
  }
}
:root[data-theme="dark"] {
  --bg:          #000000;
  --surface:     #1d1d1f;
  --surface-2:   #2c2c2e;
  --elevated:    #2c2c2e;
  --ink:         #f5f5f7;
  --ink-2:       #a1a1a6;
  --ink-3:       #86868b;
  --hairline:    #38383a;
  --hairline-2:  #48484a;
  --accent:      #2997ff;
  --accent-2:    #0a84ff;
  --accent-tint: rgba(41,151,255,.16);
  --nav-bg:      rgba(0,0,0,.7);
  --bar-tint:    rgba(255,255,255,.14);
  --shadow-sm:   0 1px 3px rgba(0,0,0,.5);
  --shadow-md:   0 8px 28px -12px rgba(0,0,0,.7);
  --shadow-lg:   0 36px 70px -28px rgba(0,0,0,.85), 0 8px 24px rgba(0,0,0,.5);
  --icon-ring:   inset 0 0 0 .5px rgba(255,255,255,.1), inset 0 1px 1px rgba(255,255,255,.12);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; color-scheme: light dark; }

body {
  margin: 0; min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  letter-spacing: -.01em;
}
::selection { background: var(--accent); color: #fff; }

/* --------------------------------------------------------------- nav */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: 18px; height: 52px; padding: 0 clamp(16px, 5vw, 40px);
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--hairline);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none;
         color: inherit; min-width: 0; }
.brand__mark {
  width: 24px; height: 24px; flex: none; display: grid; place-items: center;
  border-radius: 6px; background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 700; }
.brand__name { font-size: 18px; font-weight: 600; letter-spacing: -.02em; }
.brand__sub { font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
              color: var(--ink-3); font-weight: 600; align-self: center; }

.search { position: relative; justify-self: center; width: min(420px, 100%); }
.search__icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; fill: none; stroke: var(--ink-3); stroke-width: 2;
  stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 34px; padding: 0 14px 0 36px;
  font: inherit; font-size: 14px; color: var(--ink); letter-spacing: -.01em;
  background: var(--surface-2); border: .5px solid transparent;
  border-radius: 10px; transition: background .2s, box-shadow .2s; }
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-tint), inset 0 0 0 1px var(--accent); }

.topbar__actions { display: flex; align-items: center; gap: 8px; justify-self: end; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px;
  border-radius: 999px; font-size: 12px; font-weight: 500; color: var(--ink-2);
  background: var(--surface-2); white-space: nowrap; }
.status-pill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status-pill.is-live .status-pill__dot { background: #34c759;
  box-shadow: 0 0 0 0 rgba(52,199,89,.5); animation: breathe 3s var(--ease) infinite; }
@keyframes breathe { 0%,100%{ box-shadow: 0 0 0 0 rgba(52,199,89,.5);} 50%{ box-shadow: 0 0 0 5px transparent;} }

.btn { font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  letter-spacing: -.01em; border-radius: 999px; border: none;
  transition: background .18s, color .18s, transform .12s, box-shadow .18s; }
.btn:active { transform: scale(.97); }
.btn--ghost { height: 28px; padding: 0 14px; color: var(--accent); background: transparent; }
.btn--ghost:hover { background: var(--accent-tint); }
.btn--ghost[aria-pressed="true"] { color: #fff; background: var(--accent); }
.btn--icon { width: 28px; height: 28px; display: grid; place-items: center;
  color: var(--ink-2); background: var(--surface-2); font-size: 14px; }
.btn--icon:hover { color: var(--ink); }
.btn--primary { height: 38px; padding: 0 22px; color: #fff; background: var(--accent);
  font-weight: 500; font-size: 15px; }
.btn--primary:hover { background: var(--accent-2); }
.btn--soft { height: 34px; padding: 0 16px; color: var(--accent); background: var(--accent-tint); }
.btn--soft:hover { filter: brightness(.97); }
.theme-glyph { font-size: 15px; line-height: 1; }

.btn:focus-visible, .search input:focus-visible, .input:focus-visible,
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* --------------------------------------------------------------- layout */
.wrap { max-width: var(--maxw); margin: 0 auto;
        padding: clamp(28px, 5vw, 60px) clamp(16px, 5vw, 22px) 40px; }

/* ----------------------------------------------- featured "Today" card */
.featured:empty { display: none; }
.today {
  position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center;
  gap: clamp(20px, 4vw, 52px); padding: clamp(24px, 3.5vw, 44px) clamp(26px, 4vw, 48px);
  border-radius: var(--r-today); overflow: hidden; color: #fff; box-shadow: var(--shadow-lg);
  background: linear-gradient(150deg, var(--tint-a, #3a3a3f), var(--tint-b, #1d1d1f));
  isolation: isolate;
}
.today::after {  /* gentle vignette for text legibility */
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(110% 120% at 0 0, rgba(0,0,0,.28), transparent 62%); }
.today__text { position: relative; z-index: 1; min-width: 0; }
.today__eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: rgba(255,255,255,.8); }
.today__title { margin: 8px 0 0; font-size: clamp(26px, 3.6vw, 42px); font-weight: 600;
  letter-spacing: -.025em; line-height: 1.05; max-width: 16ch;
  text-shadow: 0 1px 20px rgba(0,0,0,.16); }
.today__sub { margin: 12px 0 0; max-width: 44ch; font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.42; color: rgba(255,255,255,.9);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.today__actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; }
.today__tag { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.82);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today__visual { position: relative; z-index: 1; }
.today__visual .tile { width: clamp(96px, 15vw, 148px);
  box-shadow: var(--icon-ring), 0 18px 40px -12px rgba(0,0,0,.4); }
.today .get { background: #fff; color: #1d1d1f; }
.today .get:hover { background: rgba(255,255,255,.88); }

/* ----------------------------------------------------------- sections */
.sections { margin-top: clamp(40px, 6vw, 68px); display: grid; gap: clamp(40px, 6vw, 60px); }
.section__head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 20px;
  padding-bottom: 14px; border-bottom: .5px solid var(--hairline); }
.section__title { margin: 0; font-size: clamp(22px, 3vw, 30px); font-weight: 600;
  letter-spacing: -.02em; }
.section__count { font-size: 17px; color: var(--ink-3); font-weight: 400; }
.section__rule { display: none; }

.grid { display: grid; gap: clamp(12px, 1.6vw, 16px);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

/* App-Store list-row card */
.card {
  position: relative; display: flex; align-items: center; gap: 15px; padding: 16px 16px;
  text-decoration: none; color: inherit;
  background: var(--surface); border-radius: var(--r-card); box-shadow: var(--shadow-sm);
  opacity: 0; transform: translateY(8px) scale(.99);
  animation: rise .5s var(--ease) forwards;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease); }
@keyframes rise { to { opacity: 1; transform: none; } }
a.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
a.card:active { transform: scale(.99); }
a.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.card.is-draft { cursor: default; }

.card__main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.card__name { font-size: 16px; font-weight: 600; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card__desc { font-size: 13px; line-height: 1.4; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__foot { display: flex; align-items: center; gap: 9px; margin-top: 4px; }
.chip { font-size: 12px; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.chip::after { content: ""; }
.live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px;
  font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.live::before { content: "·"; margin-right: 4px; color: var(--hairline-2); }
.live__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.is-online .live { color: #2da44e; }
.is-online .live__dot { background: #34c759;
  box-shadow: 0 0 0 0 rgba(52,199,89,.5); animation: breathe 3s var(--ease) infinite; }

/* GET-style pill */
.get { flex: none; font-size: 13px; font-weight: 700; letter-spacing: .01em;
  color: var(--accent); background: var(--accent-tint); text-decoration: none;
  padding: 7px 18px; border-radius: 999px; white-space: nowrap; cursor: pointer;
  transition: background .18s, color .18s, transform .12s; }
a.card:hover .get { background: var(--accent); color: #fff; }
.get:hover { background: var(--accent); color: #fff; }
.get:active { transform: scale(.94); }
.get--soft { color: var(--ink-3); background: var(--surface-2); }
a.card:hover .get--soft { background: var(--surface-2); color: var(--ink-3); }

/* ------------------------------------------------------------- tile (icon) */
.tile { position: relative; flex: none; width: 60px; aspect-ratio: 1;
  border-radius: var(--r-tile); overflow: hidden;
  box-shadow: var(--icon-ring), var(--shadow-sm); display: grid; place-items: center;
  background: var(--surface-2); }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile__emoji { font-size: 28px; line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.tile__mono { font-weight: 600; color: #fff; font-size: 24px; letter-spacing: -.01em;
  text-shadow: 0 1px 2px rgba(0,0,0,.22); }
.tile--offline { filter: saturate(.5) opacity(.8); }

/* edit affordance */
.edit-badge { position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 30px; height: 30px; border-radius: 50%; display: none; place-items: center;
  cursor: pointer; color: var(--ink);
  background: rgba(255,255,255,.7); border: .5px solid var(--hairline);
  box-shadow: var(--shadow-sm); backdrop-filter: blur(10px) saturate(180%);
  transition: transform .15s; }
.today .edit-badge { color: #1d1d1f; background: rgba(255,255,255,.85); border-color: transparent; }
.edit-badge:hover { transform: scale(1.1); }
.edit-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
body.editing .edit-badge { display: grid; }
body.editing a.card { cursor: default; }

/* --------------------------------------------------------------- skeleton */
.grid--skeleton span { height: 92px; border-radius: var(--r-card);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%);
  background-size: 220% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }

.empty { text-align: center; padding: 72px 20px; color: var(--ink-2);
  background: var(--surface); border-radius: var(--r-today); }
.empty h2 { font-weight: 600; color: var(--ink); margin: 0 0 10px; font-size: 24px;
  letter-spacing: -.02em; }
.empty code, .foot code { font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: .88em; color: var(--accent); background: var(--accent-tint);
  padding: 2px 7px; border-radius: 6px; }

/* ----------------------------------------------------------------- foot */
.foot { max-width: var(--maxw); margin: 0 auto;
  padding: 22px clamp(16px,5vw,22px) 48px; display: flex; gap: 16px;
  align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--ink-3); border-top: .5px solid var(--hairline); }
.foot__sync { display: inline-flex; align-items: center; gap: 7px; }
.foot__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.foot__dot.live { background: #34c759; }

/* ----------------------------------------------------------------- sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: grid; place-items: end center; }
.sheet[hidden] { display: none; }
@media (min-width: 700px) { .sheet { place-items: center; } }
.sheet__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4);
  backdrop-filter: blur(2px); animation: fade .2s ease; }
.sheet__panel { position: relative; width: min(540px, 100%); max-height: 92vh;
  display: flex; flex-direction: column; background: var(--surface);
  border-radius: 26px 26px 0 0; box-shadow: var(--shadow-lg);
  animation: sheet-up .34s var(--ease); }
@media (min-width: 700px) { .sheet__panel { border-radius: 22px; animation: sheet-pop .26s var(--ease); } }
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(28px); opacity: 0; } }
@keyframes sheet-pop { from { transform: scale(.96); opacity: 0; } }

.sheet__head { display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px 16px; }
.sheet__title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.sheet__body { padding: 4px 24px 20px; overflow-y: auto; display: grid; gap: 20px; }
.sheet__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px 22px; border-top: .5px solid var(--hairline); }
.sheet__actions { display: flex; gap: 10px; }
.sheet__msg { font-size: 13px; color: var(--ink-2); }
.sheet__msg.is-err { color: #ff453a; }

.field { display: grid; gap: 8px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field__hint, .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.field__default { font-size: 11.5px; color: var(--ink-3); }
.input { width: 100%; font: inherit; font-size: 15px; color: var(--ink); letter-spacing: -.01em;
  padding: 11px 13px; background: var(--surface-2); border: .5px solid transparent;
  border-radius: 12px; transition: box-shadow .18s, background .18s; resize: vertical; }
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-tint), inset 0 0 0 1px var(--accent); }
.input--emoji { width: 78px; text-align: center; font-size: 26px; }

.icon-edit { display: flex; gap: 16px; align-items: flex-start; }
.icon-edit__preview .tile { width: 76px; }
.icon-edit__controls { flex: 1; min-width: 0; display: grid; gap: 12px; }
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-2);
  border-radius: 9px; }
.seg__btn { flex: 1; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink);
  transition: background .18s, box-shadow .18s; }
.seg__btn[aria-selected="true"] { background: var(--surface); box-shadow: var(--shadow-sm); }
.emoji-row { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-row button { font-size: 20px; line-height: 1; cursor: pointer; width: 36px; height: 36px;
  border-radius: 9px; border: .5px solid var(--hairline); background: var(--surface-2); }
.emoji-row button:hover { border-color: var(--accent); }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track { width: 46px; height: 28px; flex: none; border-radius: 999px;
  background: var(--hairline-2); position: relative; transition: background .25s var(--ease); }
.switch__thumb { position: absolute; top: 2px; left: 2px; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: transform .25s var(--ease); }
.switch input:checked + .switch__track { background: #34c759; }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch__track { outline: 3px solid var(--accent); outline-offset: 2px; }
.switch__label { font-size: 15px; font-weight: 500; }

/* --------------------------------------------------------- responsive */
@media (max-width: 640px) {
  .topbar { grid-template-columns: auto auto; height: auto; padding: 8px 16px; gap: 10px; }
  .search { grid-column: 1 / -1; order: 3; justify-self: stretch; width: 100%; }
  .brand__sub { display: none; }
  .grid { grid-template-columns: 1fr; }
  .today { grid-template-columns: 1fr; gap: 20px; }
  .today__visual { order: -1; }
  .today__visual .tile { width: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important;
    animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .card { opacity: 1; transform: none; }
}

/* ==================================================================== LOGIN */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login__card { width: min(380px, 100%); display: grid; gap: 14px;
  padding: clamp(28px, 5vw, 40px) clamp(24px, 5vw, 34px);
  background: var(--surface); border-radius: var(--r-today); box-shadow: var(--shadow-lg);
  animation: sheet-pop .3s var(--ease); }
.login__mark { width: 46px; height: 46px; display: grid; place-items: center; margin: 0 auto 4px;
  border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 24px; font-weight: 700; }
.login__title { margin: 0; text-align: center; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.login__sub { margin: 0 0 8px; text-align: center; font-size: 14px; color: var(--ink-2); }
.login__submit { width: 100%; margin-top: 4px; }
.login__err { margin: 0; font-size: 13px; color: #ff453a; text-align: center; }
.login__foot { margin: 6px 0 0; text-align: center; font-size: 11px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3); }

/* ============================================================ account chip + menu */
.account { position: relative; }
.account__chip { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px 0 4px;
  border: none; border-radius: 999px; background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .18s; }
.account__chip:hover { background: var(--hairline); }
.account__avatar { width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; }
.account__name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account__caret { width: 15px; height: 15px; fill: none; stroke: var(--ink-3); stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 640px) { .account__name { display: none; } }

.menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; width: 250px;
  padding: 8px; background: var(--elevated); border: .5px solid var(--hairline);
  border-radius: 16px; box-shadow: var(--shadow-lg); animation: sheet-pop .18s var(--ease); }
.menu__head { padding: 8px 10px 10px; border-bottom: .5px solid var(--hairline); margin-bottom: 6px; }
.menu__who { display: block; font-size: 14px; font-weight: 600; }
.menu__role { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.menu__profiles { display: flex; flex-wrap: wrap; gap: 5px; padding: 2px 8px 8px; }
.menu__profiles:empty { display: none; }
.menu__item { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left; padding: 9px 10px; border: none; border-radius: 9px;
  background: transparent; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer;
  text-decoration: none; transition: background .14s; }
.menu__item:hover { background: var(--surface-2); }
.menu__item--danger { color: #ff453a; }
.menu__flag { color: var(--accent); font-weight: 700; }

/* tags (profile chips) */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.tag__dot, .pill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); flex: none; }
.tag--accent { background: var(--accent-tint); color: var(--accent); }
.tag--muted { color: var(--ink-3); }

/* ============================================================ profile filter pills */
.pillbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: clamp(20px, 3vw, 28px); }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 15px;
  border: .5px solid var(--hairline); border-radius: 999px; background: var(--surface);
  color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .16s, color .16s, border-color .16s; }
.pill:hover { color: var(--ink); border-color: var(--hairline-2); }
.pill.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* section colour dot */
.section__dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; }

/* ==================================================================== ADMIN */
.admin__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 22px; flex-wrap: wrap; }
.admin__title { margin: 0; font-size: clamp(24px, 4vw, 32px); font-weight: 600; letter-spacing: -.02em; }
.admin__sub { margin: 6px 0 0; font-size: 14px; color: var(--ink-2); }
.seg--tabs { display: inline-flex; width: 100%; max-width: 420px; margin-bottom: 24px; }
.admin__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.admin__count { font-size: 13px; color: var(--ink-3); }
.admin__empty { padding: 40px; text-align: center; color: var(--ink-3); }
.btn--sm { height: 30px; padding: 0 14px; font-size: 13px; }

.rows { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 12px 14px; border: .5px solid var(--hairline); border-radius: var(--r-card);
  background: var(--surface); color: inherit; font: inherit; cursor: pointer;
  transition: box-shadow .18s, transform .12s, border-color .18s; }
.row:hover:not(:disabled) { box-shadow: var(--shadow-sm); border-color: var(--hairline-2); }
.row:disabled { cursor: default; opacity: .8; }
.row__avatar { width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; font-weight: 700; }
.row__dot { width: 14px; height: 14px; flex: none; border-radius: 50%; background: var(--hairline-2); }
.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.row__name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.row__sub { font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.row__tags { display: flex; flex-wrap: wrap; gap: 5px; }
.row__chev { color: var(--ink-3); font-size: 20px; flex: none; }

/* picks (profile multi-select) */
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2); font-size: 14px; cursor: pointer; }
.pick input { accent-color: var(--accent); width: 16px; height: 16px; }
.field--row { grid-template-columns: 1fr 1fr; display: grid; gap: 14px; }
.field--row .field { gap: 8px; }
.input--color { padding: 4px; height: 44px; cursor: pointer; }

/* assignment matrix */
.matrix-wrap { overflow-x: auto; border: .5px solid var(--hairline); border-radius: var(--r-card); }
.matrix { border-collapse: collapse; width: 100%; min-width: max-content; }
.matrix th, .matrix td { padding: 10px 14px; border-bottom: .5px solid var(--hairline); text-align: center; }
.matrix thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.matrix__corner, .matrix__app { text-align: left; white-space: nowrap; }
.matrix__app { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; }
.matrix__app .tile { width: 30px; }
.matrix__profname { font-size: 12.5px; font-weight: 600; writing-mode: horizontal-tb; }
.matrix__cell input { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.matrix tbody tr:hover { background: var(--surface-2); }

@media (max-width: 640px) {
  .admin__head { align-items: flex-start; }
  .field--row { grid-template-columns: 1fr; }
}
