/* ============================================================================
   WaveStore Console — Material 3 Expressive
   Same language as the storefront: capsule chrome, tonal segmented surfaces,
   shape-morphing controls, spring spatial / emphasized effect motion.
   ========================================================================== */

:root {
  --md-sys-color-primary: #0E6BB7;
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-primary-container: #D5EBFF;
  --md-sys-color-on-primary-container: #04223C;
  --md-sys-color-secondary: #486275;
  --md-sys-color-on-secondary: #FFFFFF;
  --md-sys-color-secondary-container: #DCEBF7;
  --md-sys-color-on-secondary-container: #122734;
  --md-sys-color-tertiary: #2C8FE0;
  --md-sys-color-tertiary-container: #CFE9FF;
  --md-sys-color-on-tertiary-container: #06283F;
  --md-sys-color-error: #B3261E;
  --md-sys-color-on-error: #FFFFFF;
  --md-sys-color-error-container: #F9DEDC;
  --md-sys-color-on-error-container: #410002;
  --md-sys-color-surface: #F5FAFF;
  --md-sys-color-surface-dim: #D3E2F0;
  --md-sys-color-surface-bright: #F5FAFF;
  --md-sys-color-surface-container-lowest: #FFFFFF;
  --md-sys-color-surface-container-low: #EFF6FD;
  --md-sys-color-surface-container: #E8F2FB;
  --md-sys-color-surface-container-high: #E0EDF8;
  --md-sys-color-surface-container-highest: #D7E6F4;
  --md-sys-color-on-surface: #101A22;
  --md-sys-color-on-surface-variant: #3F4B56;
  --md-sys-color-outline: #6B7A88;
  --md-sys-color-outline-variant: #BCCBD8;
  --md-sys-color-outline-alpha: rgba(188, 203, 216, 0.5);
  --md-sys-color-header-bg: rgba(239, 246, 253, 0.9);
  --md-sys-color-scrim: rgba(0, 0, 0, 0.5);

  --md-custom-color-amber-container: #FFE0B8;
  --md-custom-color-on-amber-container: #2C1600;

  --md-shape-xs: 8px;
  --md-shape-sm: 12px;
  --md-shape-md: 16px;
  --md-shape-lg: 24px;
  --md-shape-xl: 32px;
  --md-shape-full: 9999px;

  --md-motion-spring-fast: cubic-bezier(0.38, 1.24, 0.22, 1);
  --md-motion-spring-spatial: cubic-bezier(0.34, 1.56, 0.64, 1);
  --md-motion-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-ease-spring: var(--md-motion-spring-spatial);
  --md-ease-emphasized: var(--md-motion-emphasized);

  --md-font-brand: 'Roboto Flex', 'Google Sans Flex', 'Inter', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
  --md-font-body: system-ui, -apple-system, 'Segoe UI', 'Roboto Flex', Roboto, 'PingFang SC', 'Noto Sans SC', sans-serif;

  --md-elevation-1: 0 1px 3px rgba(14, 30, 44, 0.08), 0 1px 2px rgba(14, 30, 44, 0.05);
  --md-elevation-2: 0 4px 14px -2px rgba(14, 30, 44, 0.1), 0 2px 6px rgba(14, 30, 44, 0.05);
  --md-elevation-3: 0 14px 36px -6px rgba(14, 30, 44, 0.16), 0 4px 12px rgba(14, 30, 44, 0.06);

  --side-width: 252px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --md-sys-color-primary: #8FC7F8;
    --md-sys-color-on-primary: #04263E;
    --md-sys-color-primary-container: #0A3A5C;
    --md-sys-color-on-primary-container: #CFE7FF;
    --md-sys-color-secondary: #B3C8D8;
    --md-sys-color-secondary-container: #24394A;
    --md-sys-color-on-secondary-container: #DBEBF7;
    --md-sys-color-tertiary: #86C6F2;
    --md-sys-color-tertiary-container: #0F3E5E;
    --md-sys-color-on-tertiary-container: #CFE9FF;
    --md-sys-color-error: #F2B8B5;
    --md-sys-color-on-error: #601410;
    --md-sys-color-error-container: #8C1D18;
    --md-sys-color-on-error-container: #F9DEDC;
    --md-sys-color-surface: #0C1319;
    --md-sys-color-surface-dim: #0C1319;
    --md-sys-color-surface-bright: #333B42;
    --md-sys-color-surface-container-lowest: #070C10;
    --md-sys-color-surface-container-low: #141C24;
    --md-sys-color-surface-container: #18222B;
    --md-sys-color-surface-container-high: #202B35;
    --md-sys-color-surface-container-highest: #293641;
    --md-sys-color-on-surface: #DEE7EE;
    --md-sys-color-on-surface-variant: #BFCDD9;
    --md-sys-color-outline: #8797A5;
    --md-sys-color-outline-variant: #3B4A57;
    --md-sys-color-outline-alpha: rgba(59, 74, 87, 0.55);
    --md-sys-color-header-bg: rgba(20, 28, 36, 0.9);
    --md-sys-color-scrim: rgba(0, 0, 0, 0.65);
    --md-custom-color-amber-container: #563506;
    --md-custom-color-on-amber-container: #FFDFBE;
    --md-elevation-1: 0 2px 6px rgba(0, 0, 0, 0.32);
    --md-elevation-2: 0 8px 22px -4px rgba(0, 0, 0, 0.44);
    --md-elevation-3: 0 20px 50px -8px rgba(0, 0, 0, 0.62);
  }
}

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

html {
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: var(--md-font-body);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
body { min-height: 100vh; background: var(--md-sys-color-surface); overflow-x: hidden; }
body.nav-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
svg { display: block; flex-shrink: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
::selection { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
:focus-visible { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }

/* ---- shell ---- */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 10px;
}

.main { grid-column: 1; min-width: 0; padding-bottom: 32px; }
.page { display: flex; flex-direction: column; gap: 16px; max-width: 1120px; }

/* ---- top bar (content capsule) ---- */
.topbar {
  grid-column: 1;
  position: sticky;
  top: 10px;
  z-index: 30;
  display: flex;
  height: 48px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--md-sys-color-outline-alpha);
  border-radius: 24px;
  background: var(--md-sys-color-header-bg);
  padding: 0 10px;
  margin-bottom: 14px;
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
}
.nav-toggle {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 17px;
  background: var(--md-sys-color-primary-container);
  transition: border-radius 200ms var(--md-ease-emphasized);
}
.nav-toggle:hover { border-radius: 10px; }
.nav-toggle img { display: none; }
.nav-toggle::before {
  content: "";
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--md-sys-color-on-primary-container);
  box-shadow: 0 -5px 0 var(--md-sys-color-on-primary-container), 0 5px 0 var(--md-sys-color-on-primary-container);
}
.topbar-text { display: flex; min-width: 0; flex-direction: column; line-height: 1.15; }
.topbar-text strong { font-family: var(--md-font-brand); font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; }
.topbar-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.6875rem; color: var(--md-sys-color-on-surface-variant); }
.topbar-user { display: inline-flex; flex-shrink: 0; margin-left: auto; border-radius: 13px; }
.topbar-user .avatar { width: 34px; height: 34px; border-radius: 13px; font-size: 0.8125rem; }
.topbar-user:hover .avatar, .topbar-user:focus-visible .avatar { box-shadow: 0 0 0 2px var(--md-sys-color-outline-alpha); }

/* ---- side rail ---- */
.side {
  position: fixed;
  top: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 50;
  display: flex;
  width: calc(100vw - 40px);
  max-width: 300px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  border: 1px solid var(--md-sys-color-outline-alpha);
  border-radius: 28px;
  background: var(--md-sys-color-surface-container-low);
  padding: 10px;
  box-shadow: var(--md-elevation-3);
  transform: translateX(calc(-100% - 20px));
  transition: transform 300ms var(--md-ease-emphasized);
}
body.nav-open .side { transform: none; }

.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-brand {
  display: inline-flex;
  min-width: 0;
  height: 40px;
  align-items: center;
  gap: 9px;
  border-radius: 20px;
  background: var(--md-sys-color-primary-container);
  padding: 0 12px 0 8px;
  color: var(--md-sys-color-on-primary-container);
  transition: border-radius 200ms var(--md-ease-emphasized);
}
.side-brand:hover { border-radius: 12px; }
.side-brand img { width: 26px; height: 26px; border-radius: 50%; }
.side-brand span { display: flex; flex-direction: column; font-family: var(--md-font-brand); font-size: 0.8125rem; font-weight: 600; line-height: 1.15; }
.side-brand small { font-family: var(--md-font-body); font-size: 0.625rem; font-weight: 500; opacity: 0.72; }
.side-close {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  color: var(--md-sys-color-on-surface-variant);
  transition: background-color 180ms var(--md-ease-emphasized), border-radius 180ms var(--md-ease-emphasized);
}
.side-close:hover { border-radius: 9px; background: var(--md-sys-color-surface-container-high); }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  margin: 12px 10px 4px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-sys-color-on-surface-variant);
  opacity: 0.7;
}
.side-nav a {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border-radius: 20px;
  padding: 0 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--md-sys-color-on-surface-variant);
  transition:
    border-radius 200ms var(--md-ease-emphasized),
    background-color 180ms var(--md-ease-emphasized),
    color 180ms var(--md-ease-emphasized);
}
.side-nav a svg { width: 18px; height: 18px; opacity: 0.85; }
.side-nav a:hover { border-radius: 12px; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.side-nav a.active { border-radius: 12px; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); font-weight: 600; }
.side-nav a.active svg { opacity: 1; }

.side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding: 12px 6px 4px;
}
.side-user { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; padding: 0 4px; }
.side-user strong { font-size: 0.8125rem; }
.side-user span { font-size: 0.6875rem; color: var(--md-sys-color-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: var(--md-sys-color-scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--md-ease-emphasized);
}
body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }

@media (min-width: 1000px) {
  .shell { grid-template-columns: var(--side-width) minmax(0, 1fr); grid-template-rows: auto 1fr; padding: 12px; gap: 16px; }
  .side { grid-column: 1; grid-row: 1 / span 2; align-self: start; position: sticky; top: 12px; left: auto; bottom: auto; max-width: none; width: auto; height: calc(100vh - 24px); transform: none; box-shadow: none; }
  .topbar, .main { grid-column: 2; }
  .topbar { display: none; }
  .side-close, .nav-toggle { display: none; }
  .nav-scrim { display: none; }
  .topbar { top: 12px; }
}

/* ---- typography ---- */
h1, h2, h3 { letter-spacing: -0.02em; }
h1 { font-size: 1.5rem; font-weight: 650; }
h2 { font-size: 1.0625rem; font-weight: 650; }
h3 { font-size: 0.9375rem; font-weight: 600; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 4px 4px 0; }
.page-title { font-size: clamp(24px, 3.4vw, 32px); font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; }
.page-sub { margin-top: 3px; font-size: 0.8125rem; color: var(--md-sys-color-on-surface-variant); }
.meta { font-size: 0.8125rem; color: var(--md-sys-color-on-surface-variant); }
.hint { margin-top: 4px; font-size: 0.75rem; line-height: 1.5; color: var(--md-sys-color-on-surface-variant); }
.description { white-space: pre-line; line-height: 1.7; color: var(--md-sys-color-on-surface-variant); overflow-wrap: anywhere; word-break: break-word; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 22px 8px; text-align: center; font-size: 0.875rem; color: var(--md-sys-color-on-surface-variant); }
.ok { color: var(--md-sys-color-primary); }
.bad { color: var(--md-sys-color-error); }

/* ---- cards & stacks ---- */
.card {
  border-radius: 26px;
  background: var(--md-sys-color-surface-container-low);
  padding: 18px;
  min-width: 0;
}
@media (min-width: 720px) { .card { padding: 22px; } }
.card > h2:first-child { margin-bottom: 2px; }
.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.divider { height: 1px; background: var(--md-sys-color-outline-variant); }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 21px;
  padding: 0 18px;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
  transition:
    border-radius 240ms var(--md-ease-emphasized),
    transform 340ms var(--md-ease-spring),
    background-color 200ms var(--md-ease-emphasized),
    color 200ms var(--md-ease-emphasized),
    box-shadow 220ms var(--md-ease-emphasized);
}
.btn:hover { border-radius: 13px; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.btn:active { border-radius: 10px; transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn.primary { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.btn.primary:hover { background: var(--md-sys-color-primary); filter: brightness(1.06); box-shadow: var(--md-elevation-2); }
.btn.ghost { background: transparent; color: var(--md-sys-color-on-surface-variant); }
.btn.ghost:hover { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.btn.danger { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.btn.danger:hover { background: var(--md-sys-color-error); color: var(--md-sys-color-on-error); }
.btn.sm { min-height: 34px; padding: 0 13px; font-size: 0.75rem; border-radius: 17px; }
.btn.wide { width: 100%; }

/* ---- chips / pills / notices ---- */
.chip, .pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 5px;
  border-radius: 13px;
  background: var(--md-sys-color-surface-container-high);
  padding: 2px 10px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}
.chip { min-height: 30px; border-radius: 15px; padding: 3px 6px 3px 11px; }
.chip button { display: inline-flex; width: 20px; height: 20px; align-items: center; justify-content: center; border-radius: 50%; color: inherit; opacity: 0.7; }
.chip button:hover { opacity: 1; background: rgba(0, 0, 0, 0.08); }
.chip.active, .pill.ok { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.pill.bad { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.pill.warn { background: var(--md-custom-color-amber-container); color: var(--md-custom-color-on-amber-container); }

.notice {
  border-radius: 18px;
  background: var(--md-sys-color-secondary-container);
  padding: 12px 16px;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--md-sys-color-on-secondary-container);
}
.notice.bad { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 20px;
  background: var(--md-sys-color-primary-container);
  padding: 12px 16px;
  color: var(--md-sys-color-on-primary-container);
  font-size: 0.8125rem;
}

/* ---- stats ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 18px;
  background: var(--md-sys-color-surface-container);
  padding: 16px;
  transition: border-radius 240ms var(--md-ease-emphasized), background-color 200ms var(--md-ease-emphasized);
}
.stat:hover { border-radius: 12px; background: var(--md-sys-color-surface-container-high); }
.stat span { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }
.stat strong { font-size: 1.625rem; font-weight: 650; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }

/* ---- lists ---- */
.list { display: flex; flex-direction: column; gap: 6px; }
.item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  border-radius: 16px;
  background: var(--md-sys-color-surface);
  padding: 12px 14px;
  transition: border-radius 220ms var(--md-ease-emphasized), background-color 200ms var(--md-ease-emphasized);
}
.item:hover { border-radius: 10px; background: var(--md-sys-color-surface-container-high); }
.notice-item { align-items: flex-start; }
.notice-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 12px;
  object-fit: cover;
  background: var(--md-sys-color-surface-container);
}
.notice-thumb--empty {
  display: grid;
  place-items: center;
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
}
.item-main { display: flex; min-width: 0; flex: 1 1 220px; align-items: center; gap: 12px; }
.item-main > div, .item-main > span:not([class]) { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item-name { display: block; font-size: 0.875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { display: block; font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
img.thumb { width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px; object-fit: cover; background: var(--md-sys-color-surface-container); display: block; }

/* ---- tables ---- */
.table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 0.8125rem; }
.table th {
  padding: 4px 12px;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--md-sys-color-on-surface-variant);
}
.table td { padding: 11px 12px; background: var(--md-sys-color-surface); }
.table td:first-child { border-radius: 12px 0 0 12px; }
.table td:last-child { border-radius: 0 12px 12px 0; }
.table tbody tr:hover td { background: var(--md-sys-color-surface-container-high); }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: 0.75rem; font-weight: 600; color: var(--md-sys-color-on-surface-variant); }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 14px;
  background: transparent;
  padding: 0 14px;
  font-size: 0.875rem;
  outline: none;
  appearance: none;
  transition: border-color 180ms var(--md-ease-emphasized), box-shadow 180ms var(--md-ease-emphasized), border-radius 240ms var(--md-ease-emphasized);
}
.field textarea { min-height: 112px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--md-sys-color-on-surface); }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
  border-radius: 10px;
}
.field input::placeholder, .field textarea::placeholder { color: var(--md-sys-color-on-surface-variant); opacity: 0.75; }
.field select {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 20px, calc(100% - 14px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }

/* ---- 胶囊单选（分类、适配范围） ----
   移动端原生 select 会弹出整屏的系统列表，改成平铺的胶囊按钮组，点一下就选中。 */
.field-tag {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 9px;
  background: var(--md-custom-color-amber-container);
  color: var(--md-custom-color-on-amber-container);
  font-size: 0.625rem;
  font-weight: 700;
  vertical-align: 1px;
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-opt { position: relative; display: inline-flex; max-width: 100%; }
.pills .pill-opt input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.pill-opt > span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-shape-full);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition:
    background-color 180ms var(--md-ease-emphasized),
    border-color 180ms var(--md-ease-emphasized),
    color 180ms var(--md-ease-emphasized),
    border-radius 260ms var(--md-ease-emphasized),
    transform 320ms var(--md-ease-spring),
    box-shadow 200ms var(--md-ease-emphasized);
}
.pill-opt > span:hover { border-color: var(--md-sys-color-primary); color: var(--md-sys-color-primary); }
.pill-opt > span:active { transform: scale(0.96); border-radius: 14px; }
.pill-opt input:checked + span {
  background: var(--md-sys-color-primary);
  border-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-elevation-1);
}
.pill-opt input:checked + span:hover { color: var(--md-sys-color-on-primary); }
.pill-opt input:focus-visible + span { outline: 2px solid var(--md-sys-color-primary); outline-offset: 2px; }
.field-label { font-size: 0.75rem; font-weight: 600; color: var(--md-sys-color-on-surface-variant); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 0.8125rem; color: var(--md-sys-color-on-surface-variant); }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--md-sys-color-primary); }
.agree-note { font-size: 0.75rem; line-height: 1.6; color: var(--md-sys-color-on-surface-variant); }
.agree-note a { color: var(--md-sys-color-primary); font-weight: 600; }

/* ---- segmented control ---- */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  border-radius: 22px;
  background: var(--md-sys-color-surface-container);
  padding: 3px;
}
.seg button, .seg a {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  border-radius: 16px;
  padding: 0 13px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  transition: border-radius 200ms var(--md-ease-emphasized), background-color 180ms var(--md-ease-emphasized);
}
.seg button:hover, .seg a:hover { border-radius: 10px; background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.seg .active, .seg .on, .seg button[aria-pressed="true"] { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.seg .on:hover, .seg .active:hover { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); border-radius: 16px; }

/* ---- wizard / steps ---- */
.wizard { display: flex; flex-direction: column; gap: 14px; }
.steps {
  list-style: none;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0;
  padding: 0;
  scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }
.steps li {
  flex: 1 1 0;
  min-width: 118px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 16px;
  background: var(--md-sys-color-surface-container);
  padding: 9px 12px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.78125rem;
  font-weight: 620;
  white-space: nowrap;
  cursor: pointer;
  transition: border-radius 200ms var(--md-ease-emphasized), background-color 180ms var(--md-ease-emphasized), color 180ms var(--md-ease-emphasized);
}
.steps li:hover { border-radius: 11px; background: var(--md-sys-color-surface-container-high); }
.steps li b {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.6875rem;
}
.steps li.active { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.steps li.active b { background: rgba(255, 255, 255, 0.24); color: inherit; }
.steps li.done b { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.step { display: none; }
.step.active { display: grid; gap: 14px; }
.wizard-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.wizard-foot #step-hint { flex: 1; text-align: center; font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }

/* ---- uploads / previews ---- */
.apk-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
  border-radius: 18px;
  background: var(--md-sys-color-surface);
  padding: 14px 16px;
}
/* ---- uploads / previews ---- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px dashed var(--md-sys-color-outline);
  border-radius: 20px;
  padding: 22px 16px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface-variant);
  transition: border-color 180ms var(--md-ease-emphasized), background-color 180ms var(--md-ease-emphasized), border-radius 240ms var(--md-ease-emphasized);
}
.dropzone:hover { border-color: var(--md-sys-color-primary); border-radius: 14px; background: var(--md-sys-color-surface-container); }
.shots { display: flex; flex-wrap: wrap; gap: 8px; }
.shots img {
  width: auto;
  height: 176px;
  max-width: 100%;
  display: block;
  object-fit: cover;
  border-radius: 14px;
  background: var(--md-sys-color-surface-container);
}
.shots.review { flex-direction: row; flex-wrap: wrap; gap: 8px; padding: 0; background: transparent; }
.shots.review img { height: 240px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
figure.thumb { position: relative; margin: 0; width: auto; height: auto; flex: 0 0 auto; }
figure.thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; background: var(--md-sys-color-surface-container); display: block; }
.thumb-x {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-error);
  font-size: 0.875rem;
}
.shots .thumb img { width: 96px; height: 96px; }
.icon-row { display: flex; align-items: center; gap: 12px; }
img.icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: block;
  object-fit: cover;
  border-radius: 15px;
  background: var(--md-sys-color-surface-container);
}
.icon-fallback { display: grid; place-items: center; width: 52px; height: 52px; flex-shrink: 0; border-radius: 15px; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); font-weight: 650; }
.icon.lg { width: 64px; height: 64px; border-radius: 18px; }
.icon-fallback.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 1.375rem; }
.batch-icon .icon, .batch-icon .icon-fallback { width: 44px; height: 44px; border-radius: 13px; }
.avatar {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 20px;
  object-fit: cover;
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  font-weight: 650;
  font-size: 1.25rem;
  overflow: hidden;
}
img.avatar { background: var(--md-sys-color-surface-container); }
.member .avatar { width: 36px; height: 36px; border-radius: 12px; font-size: 0.875rem; }
.avatar-row { display: flex; align-items: center; gap: 14px; }
.avatar-side { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---- members ---- */
.members { display: flex; flex-direction: column; gap: 6px; }
.member { display: flex; align-items: center; gap: 10px; border-radius: 16px; background: var(--md-sys-color-surface); padding: 10px 14px; }
.member-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.member-role { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }
.member-add { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }

/* ---- charts ---- */
.chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  font-variant-numeric: tabular-nums;
}
.chart line { stroke: var(--md-sys-color-outline-variant); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart text { fill: var(--md-sys-color-on-surface-variant); font-size: 11px; font-family: inherit; }
.chart polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart polyline:nth-of-type(1) { stroke: var(--md-sys-color-primary); }
.chart polyline:nth-of-type(2) { stroke: var(--md-sys-color-tertiary); stroke-dasharray: 4 3; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
i.mk-dl { background: var(--md-sys-color-primary); }
i.mk-user { background: var(--md-sys-color-tertiary); }
.readout { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); font-variant-numeric: tabular-nums; }

/* ---- review / batch ---- */
.review { display: flex; flex-direction: column; gap: 8px; border-radius: 18px; background: var(--md-sys-color-surface); padding: 14px 16px; }
.batch-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.batch-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.batch-info { font-size: 0.75rem; color: var(--md-sys-color-on-surface-variant); }
.draft-pick { display: flex; flex-direction: column; gap: 4px; border-radius: 16px; background: var(--md-sys-color-surface); padding: 12px 14px; }
dl.mk-dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 12px; font-size: 0.8125rem; }
dl.mk-dl dt { color: var(--md-sys-color-on-surface-variant); }
.qq-form, .qq-bind { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 6px; margin: 0; }
.facts > div { min-width: 0; border-radius: 14px; background: var(--md-sys-color-surface); padding: 10px 12px; font-size: 0.8125rem; }
.facts dt { font-size: 0.6875rem; color: var(--md-sys-color-on-surface-variant); margin-bottom: 3px; }
.facts dd { margin: 0; color: var(--md-sys-color-on-surface); overflow-wrap: anywhere; }
.facts strong { display: block; font-size: 0.8125rem; color: var(--md-sys-color-on-surface); margin-bottom: 2px; }
.sort-item { display: flex; align-items: center; gap: 8px; border-radius: 14px; background: var(--md-sys-color-surface); padding: 8px 10px; }
.grip { color: var(--md-sys-color-on-surface-variant); cursor: grab; }

/* ---- auth ---- */
.auth { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-radius: 30px;
  background: var(--md-sys-color-surface-container-low);
  padding: 28px 24px;
  box-shadow: var(--md-elevation-2);
}
.auth-brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--md-font-brand); font-size: 0.9375rem; font-weight: 600; }
.auth-brand img { width: 26px; height: 26px; border-radius: 8px; }
.auth-card h1 { font-size: 1.625rem; font-weight: 650; }
.auth-card .hint { margin-top: 4px; font-size: 0.8125rem; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-links { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.8125rem; }
.auth-links a { color: var(--md-sys-color-primary); font-weight: 600; }
.auth-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---- toast ---- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  transform: translate(-50%, 12px);
  max-width: min(92vw, 420px);
  border-radius: 18px;
  background: var(--md-sys-color-surface-container-highest);
  padding: 12px 18px;
  font-size: 0.8125rem;
  color: var(--md-sys-color-on-surface);
  box-shadow: var(--md-elevation-3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--md-ease-emphasized), transform 320ms var(--md-ease-spring);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }

/* ---- misc ---- */
.editor { display: flex; flex-direction: column; gap: 12px; }
.wait { opacity: 0.6; pointer-events: none; }
.sm { font-size: 0.75rem; }
.lg { font-size: 1rem; }

@media (max-width: 640px) {
  .shell { padding: 8px; }
  .topbar { top: 8px; height: 46px; border-radius: 23px; }
  .card { border-radius: 22px; padding: 16px; }
  .page { gap: 13px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg { display: flex; width: 100%; }
  .seg > * { flex: 1 1 0; justify-content: center; padding: 0 8px; }
  dl.mk-dl { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ambient shapes behind the auth screen */
.auth { position: relative; isolation: isolate; overflow: hidden; }
.auth::before,
.auth::after {
  content: "";
  position: fixed;
  z-index: -1;
  opacity: 0.55;
  background: var(--md-sys-color-primary-container);
  animation: authDrift 24s ease-in-out infinite alternate;
}
.auth::before {
  top: -56px;
  left: -48px;
  width: 208px;
  height: 208px;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M32 6C41 6 46 12 50 12C54 12 59 6 68 6C82 6 94 18 94 32C94 41 88 46 88 50C88 54 94 59 94 68C94 82 82 94 68 94C59 94 54 88 50 88C46 88 41 94 32 94C18 94 6 82 6 68C6 59 12 54 12 50C12 46 6 41 6 32C6 18 18 6 32 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M32 6C41 6 46 12 50 12C54 12 59 6 68 6C82 6 94 18 94 32C94 41 88 46 88 50C88 54 94 59 94 68C94 82 82 94 68 94C59 94 54 88 50 88C46 88 41 94 32 94C18 94 6 82 6 68C6 59 12 54 12 50C12 46 6 41 6 32C6 18 18 6 32 6Z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.auth::after {
  right: -40px;
  bottom: -54px;
  width: 184px;
  height: 184px;
  background: var(--md-sys-color-tertiary-container);
  animation-delay: -8s;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 2L58.5 11.2L70.5 7.5L74.2 19.5L86.8 21.8L85.2 34.3L96 41.2L89.5 52L96 62.8L85.2 69.7L86.8 82.2L74.2 84.5L70.5 96.5L58.5 92.8L50 100L41.5 92.8L29.5 96.5L25.8 84.5L13.2 82.2L14.8 69.7L4 62.8L10.5 52L4 41.2L14.8 34.3L13.2 21.8L25.8 19.5L29.5 7.5L41.5 11.2L50 2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 2L58.5 11.2L70.5 7.5L74.2 19.5L86.8 21.8L85.2 34.3L96 41.2L89.5 52L96 62.8L85.2 69.7L86.8 82.2L74.2 84.5L70.5 96.5L58.5 92.8L50 100L41.5 92.8L29.5 96.5L25.8 84.5L13.2 82.2L14.8 69.7L4 62.8L10.5 52L4 41.2L14.8 34.3L13.2 21.8L25.8 19.5L29.5 7.5L41.5 11.2L50 2Z'/%3E%3C/svg%3E") center / contain no-repeat;
  stroke-linejoin: round;
}
@keyframes authDrift {
  from { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  to { transform: translate3d(18px, 14px, 0) rotate(12deg) scale(1.05); }
}

#toast.error { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }

/* keyword chips + inline keyword input */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
#kw-input, #up-kw-input {
  min-height: 38px;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 14px;
  background: transparent;
  padding: 0 12px;
  font-size: 0.8125rem;
  outline: none;
  transition: border-color 180ms var(--md-ease-emphasized), box-shadow 180ms var(--md-ease-emphasized), border-radius 240ms var(--md-ease-emphasized);
}
#kw-input:focus, #up-kw-input:focus {
  border-color: var(--md-sys-color-primary);
  box-shadow: inset 0 0 0 1px var(--md-sys-color-primary);
  border-radius: 10px;
}
#kw-input::placeholder, #up-kw-input::placeholder { color: var(--md-sys-color-on-surface-variant); opacity: 0.7; }

/* ghost buttons still need an affordance */
.btn.ghost { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface); }
.btn.ghost:hover { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
