/* Regona Upload — design system implementation.
   Source of truth: design-system/regona-upload/MASTER.md. Components use tokens only (no raw hex below :root). */

/* ============================================================ tokens */
:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --bg-elevated: #0f0f16;
  --sidebar: #0c0c12;
  --surface: #13131b;
  --surface-2: #0e0e15;
  --surface-hover: #191922;
  --surface-selected: #1d1830;
  --border-subtle: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .10);
  --border-strong: rgba(255, 255, 255, .18);
  --text: #ececf3;
  --text-2: #b6b6c8;
  --text-3: #8d8da3;
  --accent: #7c3aed;
  --accent-hover: #6d2ee0;
  --accent-pressed: #5b21b6;
  --accent-text: #c4b5fd;
  --accent-soft: rgba(124, 58, 237, .16);
  --accent-line: rgba(167, 139, 250, .55);
  --success: #34d399;
  --success-soft: rgba(52, 211, 153, .12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .12);
  --error: #f87171;
  --error-soft: rgba(248, 113, 113, .12);
  --info: #7aa2ff;
  --info-soft: rgba(122, 162, 255, .12);
  --neutral-soft: rgba(255, 255, 255, .06);
  --focus: #a78bfa;
  --overlay: rgba(4, 4, 8, .72);
  --shadow-1: 0 12px 40px -12px rgba(0, 0, 0, .75), 0 0 0 1px rgba(255, 255, 255, .06);
  --on-accent: #ffffff;

  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 18px; --fs-2xl: 22px; --fs-3xl: 28px;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --r-container: 16px; --r-control: 10px; --r-sm: 8px; --r-pill: 999px;

  --dur-fast: 120ms; --dur-base: 180ms; --dur-slow: 280ms; --dur-page: 320ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1); --ease-in: cubic-bezier(.4, 0, 1, 1);

  --sidebar-w: 256px;
  --control-h: 40px;
  --touch: 44px;
  --topbar-h: 56px;
}

/* ============================================================ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + var(--s4)); }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font: 400 var(--fs-md)/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.01em; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; }
svg { width: 1.15em; height: 1.15em; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; left: var(--s3); top: -80px; z-index: 200; padding: var(--s2) var(--s4); border-radius: var(--r-control); background: var(--accent); color: var(--on-accent); font-weight: 600; }
.skip-link:focus { top: var(--s3); }
.mono { font-family: var(--mono); font-size: var(--fs-sm); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.nowrap { white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-width: 0; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.stack { display: grid; gap: var(--s4); min-width: 0; }
.stack--sm { gap: var(--s2); }
.stack > *, .layout-2 > * { min-width: 0; }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.divider { height: 1px; border: 0; background: var(--border-subtle); margin: var(--s4) 0; }

/* ============================================================ shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--sidebar); border-right: 1px solid var(--border-subtle); overflow-y: auto; padding: var(--s5) var(--s3) var(--s3); }
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s5); color: var(--text); }
.brand:hover { text-decoration: none; }
.brand__mark { width: 36px; height: 36px; border-radius: var(--r-control); display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.brand__mark svg { width: 20px; height: 20px; }
.brand__name { font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.02em; line-height: 1.2; }
.brand__sub { display: block; font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; letter-spacing: 0; }
.nav { display: grid; gap: 2px; }
.nav__label { padding: var(--s4) var(--s3) var(--s2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.nav__link { position: relative; display: flex; align-items: center; gap: var(--s3); min-height: var(--touch); padding: 0 var(--s3); border-radius: var(--r-control); color: var(--text-2); font-weight: 500; transition: background var(--dur-fast), color var(--dur-fast); }
.nav__link svg { width: 18px; height: 18px; }
.nav__link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
.nav__link:focus-visible { outline-offset: -2px; }
.nav__link[aria-current="page"] { background: var(--surface-selected); color: var(--text); }
.nav__link[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-text); }
.nav__count { margin-left: auto; min-width: 22px; padding: 0 var(--s2); border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-size: var(--fs-xs); font-weight: 600; text-align: center; line-height: 20px; }
.userbox { margin-top: auto; display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s2) 0; border-top: 1px solid var(--border-subtle); }
.userbox__who { flex: 1; min-width: 0; }
.userbox__name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbox__role { font-size: var(--fs-xs); color: var(--text-3); }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; background: var(--surface-hover); color: var(--text-2); font-weight: 600; }
.avatar--lg { width: 64px; height: 64px; font-size: var(--fs-2xl); }
.main { min-width: 0; }
#main:focus { outline: none; } /* programmatic focus target after route change / skip link */
.topbar { display: none; position: sticky; top: 0; z-index: 40; align-items: center; gap: var(--s2); height: var(--topbar-h); padding: 0 var(--s2) 0 max(var(--s2), env(safe-area-inset-left)); background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle); }
.topbar__title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__bell { position: relative; }
.topbar__dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-text); box-shadow: 0 0 0 2px var(--bg-elevated); }
.page { max-width: 1320px; margin: 0 auto; padding: var(--s8) var(--s8) 96px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6); }
.page-head h1 { font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.025em; }
.page-head p { margin-top: var(--s1); color: var(--text-2); max-width: 70ch; }
.crumbs { display: flex; flex-wrap: wrap; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-3); margin-bottom: var(--s3); }
.crumbs a { color: var(--text-2); }
.scrim { position: fixed; inset: 0; z-index: 45; background: var(--overlay); animation: fade-in var(--dur-slow) var(--ease-out); }

/* ============================================================ controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--control-h); padding: 0 var(--s4); border-radius: var(--r-control); border: 1px solid var(--border); background: var(--surface-hover); color: var(--text); font-weight: 600; white-space: nowrap; text-decoration: none; transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast); -webkit-tap-highlight-color: transparent; }
.btn:hover { background: var(--surface-selected); border-color: var(--border-strong); text-decoration: none; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn--primary:active:not(:disabled) { background: var(--accent-pressed); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-hover); color: var(--text); border-color: transparent; }
.btn--danger { background: var(--error-soft); border-color: transparent; color: var(--error); }
.btn--danger:hover { background: var(--error-soft); border-color: var(--error); }
.btn--sm { min-height: 32px; padding: 0 var(--s3); font-size: var(--fs-sm); border-radius: var(--r-sm); }
.btn--lg { min-height: 48px; padding: 0 var(--s6); font-size: var(--fs-lg); }
.btn--icon { width: var(--control-h); padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn--block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }

.field { display: grid; gap: 6px; min-width: 0; }
.field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.field__label .req { color: var(--warning); margin-left: 2px; }
.field__help { font-size: var(--fs-xs); color: var(--text-3); overflow-wrap: anywhere; }
.label-presets { display: grid; gap: var(--s2); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; width: fit-content; max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-control); background: var(--surface-2); }
.seg__btn { min-height: 36px; padding: 0 var(--s4); border: 0; border-radius: calc(var(--r-control) - 4px); background: none; color: var(--text-2); font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; transition: background var(--dur-fast), color var(--dur-fast); }
.seg__btn:hover { color: var(--text); background: var(--surface-hover); }
.seg__btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg__btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.field__error { font-size: var(--fs-sm); color: var(--error); font-weight: 500; display: flex; gap: 6px; align-items: flex-start; }
.field__error svg { margin-top: 2px; width: 14px; height: 14px; }
.input, .select, .textarea { width: 100%; min-height: var(--control-h); padding: 0 var(--s3); border-radius: var(--r-control); background: var(--surface-2); border: 1px solid var(--border); color: var(--text); transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.textarea { min-height: 96px; padding: var(--s2) var(--s3); resize: vertical; }
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: var(--border-strong); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--error); }
.input:disabled, .select:disabled { opacity: .55; cursor: not-allowed; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b6b6c8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; text-overflow: ellipsis; }
.select option { background: var(--surface); color: var(--text); }
.search { position: relative; min-width: 0; }
.search > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 38px; }
.check { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.form-grid .span-2 { grid-column: 1 / -1; }

/* ============================================================ badges / status */
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 var(--s2); border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 600; background: var(--neutral-soft); color: var(--text-2); white-space: nowrap; }
.badge svg { width: 13px; height: 13px; }
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--err { background: var(--error-soft); color: var(--error); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--accent { background: var(--accent-soft); color: var(--accent-text); }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-2); }
.tag__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dist, var(--text-3)); }
.status { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 2px var(--s2); align-items: start; min-width: 0; }
.status__icon { grid-row: span 2; width: 18px; height: 18px; margin-top: 1px; }
.status__label { font-size: var(--fs-xs); color: var(--text-3); line-height: 1.3; }
.status__value { font-size: var(--fs-sm); font-weight: 600; color: var(--text); line-height: 1.35; overflow-wrap: anywhere; }
.tone-ok { --tone: var(--success); --tone-soft: var(--success-soft); }
.tone-warn { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.tone-err { --tone: var(--error); --tone-soft: var(--error-soft); }
.tone-info { --tone: var(--info); --tone-soft: var(--info-soft); }
.tone-neutral { --tone: var(--text-3); --tone-soft: var(--neutral-soft); }
.status .status__icon { color: var(--tone, var(--text-3)); }
.status-line { display: inline-flex; align-items: flex-start; gap: var(--s2); font-weight: 600; font-size: var(--fs-md); line-height: 1.35; color: var(--text); }
.status-line svg { width: 18px; height: 18px; margin-top: 1px; color: var(--tone, var(--text-3)); }

/* ============================================================ panels / alerts / issue */
.panel { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r-container); padding: var(--s5); min-width: 0; }
.panel--flush { padding: 0; overflow: hidden; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.panel__title { font-size: var(--fs-lg); font-weight: 600; }
.panel__desc { color: var(--text-2); font-size: var(--fs-sm); margin-top: var(--s1); max-width: 70ch; }
.panel__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s3); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--border-subtle); }
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-control); background: var(--tone-soft, var(--neutral-soft)); border-left: 3px solid var(--tone, var(--border-strong)); font-size: var(--fs-md); color: var(--text); }
.alert > svg { width: 18px; height: 18px; margin-top: 2px; color: var(--tone, var(--text-2)); }
.alert__title { display: block; font-weight: 600; margin-bottom: 2px; color: var(--text); }
.alert__body { min-width: 0; flex: 1; color: var(--text-2); }
.alert__body ul { margin: var(--s2) 0 0; padding-left: 18px; }
.alert__actions { margin-top: var(--s3); display: flex; flex-wrap: wrap; gap: var(--s2); }
.issue { border-radius: var(--r-container); border: 1px solid var(--border-subtle); background: var(--surface); overflow: hidden; }
.issue__head { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4) var(--s5); background: var(--tone-soft); border-bottom: 1px solid var(--border-subtle); }
.issue__head > svg { width: 22px; height: 22px; color: var(--tone); margin-top: 1px; }
.issue__title { font-size: var(--fs-lg); font-weight: 600; }
.issue__body { padding: var(--s4) var(--s5); display: grid; gap: var(--s3); color: var(--text-2); }
.issue__action { color: var(--text); font-weight: 500; }
.issue__note { font-size: var(--fs-sm); color: var(--text-3); }
.conflicts { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.conflicts th, .conflicts td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--border-subtle); color: var(--text); }
.conflicts th { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
details.tech { border-top: 1px solid var(--border-subtle); padding: var(--s2) var(--s5) var(--s3); font-size: var(--fs-sm); }
details.tech summary { cursor: pointer; color: var(--text-2); font-weight: 600; min-height: 36px; display: flex; align-items: center; }
details.tech pre { margin: var(--s2) 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); color: var(--text-2); }

/* ============================================================ empty / skeleton */
.empty { display: grid; justify-items: center; gap: var(--s2); text-align: center; padding: var(--s10) var(--s5); border: 1px dashed var(--border); border-radius: var(--r-container); color: var(--text-2); }
.empty__icon { width: 44px; height: 44px; border-radius: var(--r-control); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: var(--s1); }
.empty__icon svg { width: 22px; height: 22px; }
.empty__title { color: var(--text); font-size: var(--fs-lg); font-weight: 600; }
.empty p { max-width: 46ch; }
.empty .btn { margin-top: var(--s2); }
.sk { position: relative; overflow: hidden; background: var(--neutral-soft); border-radius: var(--r-sm); }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .05), transparent); animation: shimmer 1.4s infinite; }
.sk-line { height: 12px; margin: 6px 0; }

/* ============================================================ progress / timeline */
.progress { height: 6px; border-radius: var(--r-pill); background: var(--neutral-soft); overflow: hidden; }
.progress__bar { height: 100%; width: 100%; border-radius: inherit; background: var(--accent-text); transform-origin: left center; transform: scaleX(var(--p, 0)); transition: transform 600ms var(--ease-out); }
.progress--indeterminate .progress__bar { transform: scaleX(.35); animation: indeterminate 1.3s ease-in-out infinite; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.tl { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s3); padding-bottom: var(--s4); position: relative; }
.tl::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.tl:last-child::before { display: none; }
.tl__node { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); z-index: 1; }
.tl__node svg { width: 14px; height: 14px; }
.tl__title { font-weight: 600; color: var(--text-3); }
.tl__state { font-size: var(--fs-xs); color: var(--text-3); margin-left: var(--s2); font-weight: 500; }
.tl__meta { font-size: var(--fs-xs); color: var(--text-3); }
.tl--sub .tl__title { font-weight: 500; }
.tl--done .tl__node { background: var(--success-soft); border-color: transparent; color: var(--success); }
.tl--done .tl__title { color: var(--text); }
.tl--now .tl__node { background: var(--info-soft); border-color: var(--info); color: var(--info); }
.tl--now .tl__title { color: var(--text); }
.tl--fail .tl__node { background: var(--error-soft); border-color: var(--error); color: var(--error); }
.tl--fail .tl__title { color: var(--error); }

/* ============================================================ menu / popover */
.menu-wrap { position: relative; display: inline-flex; }
.menu { position: absolute; z-index: 70; right: 0; top: calc(100% + 6px); min-width: 220px; max-width: min(320px, calc(100vw - 24px)); max-height: 60vh; overflow-y: auto; padding: var(--s1); border-radius: var(--r-control); background: var(--surface); box-shadow: var(--shadow-1); animation: menu-in var(--dur-base) var(--ease-out); }
.menu[data-placement="top"] { top: auto; bottom: calc(100% + 6px); }
.menu__item { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 40px; padding: 0 var(--s3); border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); text-align: left; font-size: var(--fs-md); text-decoration: none; }
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-hover); text-decoration: none; outline: none; }
.menu__item svg { width: 16px; height: 16px; color: var(--text-2); }
.menu__sep { height: 1px; margin: var(--s1) 0; background: var(--border-subtle); }

/* ============================================================ modal / toast */
.overlay { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; align-items: center; padding: var(--s5); background: var(--overlay); animation: fade-in var(--dur-slow) var(--ease-out); }
.modal { min-width: 0; width: min(780px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-container); box-shadow: var(--shadow-1); animation: modal-in var(--dur-slow) var(--ease-out); }
.modal--sm { width: min(480px, 100%); }
.modal > * { min-width: 0; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border-subtle); }
.modal__title { font-size: var(--fs-xl); font-weight: 600; }
.modal__body { position: relative; padding: var(--s5); overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.modal__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s5); border-top: 1px solid var(--border-subtle); }
.steps { position: relative; list-style: none; display: flex; gap: var(--s1); margin: 0; padding: var(--s3) var(--s5) 0; overflow-x: auto; }
.steps__item { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s3) 6px 6px; border-radius: var(--r-pill); font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; }
.steps__num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 600; background: var(--neutral-soft); }
.steps__num svg { width: 12px; height: 12px; }
.steps__item[aria-current="step"] { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.steps__item[aria-current="step"] .steps__num { background: var(--accent); color: var(--on-accent); }
.steps__item.is-done { color: var(--text-2); }
.steps__item.is-done .steps__num { background: var(--success-soft); color: var(--success); }
.toasts { position: fixed; right: var(--s5); bottom: var(--s5); z-index: 120; display: grid; gap: var(--s2); width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r-control); background: var(--surface); box-shadow: var(--shadow-1); border-left: 3px solid var(--tone, var(--border-strong)); animation: toast-in var(--dur-base) var(--ease-out); }
.toast > svg { width: 18px; height: 18px; color: var(--tone); margin-top: 2px; }
.toast__text { flex: 1; min-width: 0; color: var(--text-2); }
.toast__text b { display: block; color: var(--text); }
.toast.is-leaving { animation: toast-out var(--dur-base) var(--ease-in) forwards; }

/* ============================================================ toolbar / pager / tabs / kv / tables */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
.toolbar__group { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); min-width: 0; }
.toolbar__count { font-size: var(--fs-md); color: var(--text-2); padding-bottom: 10px; min-width: 96px; }
.toolbar .field { min-width: 180px; }
.toolbar .search { width: 300px; }
.pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }
.tabs { position: relative; display: flex; gap: var(--s1); border-bottom: 1px solid var(--border-subtle); margin-bottom: var(--s5); overflow-x: auto; scrollbar-width: thin; }
.tabs__tab { min-height: var(--touch); padding: 0 var(--s4); border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-2); font-weight: 600; white-space: nowrap; }
.tabs__tab:hover { color: var(--text); }
.tabs__tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent-text); }
.kv { display: grid; grid-template-columns: minmax(120px, 170px) minmax(0, 1fr); gap: var(--s2) var(--s4); margin: 0; }
.kv dt { color: var(--text-3); font-size: var(--fs-sm); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.table-wrap { position: relative; border: 1px solid var(--border-subtle); border-radius: var(--r-container); overflow-x: auto; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.table th { text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: var(--s3) var(--s4); background: var(--surface-2); border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.table td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--dur-fast); }
.table tbody tr:hover { background: var(--surface-hover); }
.table--cards th:last-child, .table--cards td:last-child { position: sticky; right: 0; background: var(--surface); box-shadow: -1px 0 0 var(--border-subtle); }
.table--cards th:last-child { background: var(--surface-2); }
.table--cards tbody tr:hover td:last-child { background: var(--surface-hover); }
/* Card tables below large desktop so row actions never hide behind horizontal scroll */
@media (max-width: 1199px) {
  .table-wrap--cards { border: 0; background: none; overflow: visible; }
  .table--cards thead { display: none; }
  .table--cards, .table--cards tbody, .table--cards tr, .table--cards td { display: block; width: 100%; }
  .table--cards tr { margin-bottom: var(--s3); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r-container); }
  .table--cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: var(--s3); text-align: right; }
  .table--cards td[data-label]::before { content: attr(data-label); color: var(--text-3); font-size: var(--fs-xs); flex: none; text-align: left; }
  .table--cards td.cell-lead { display: block; text-align: left; }
}
@media (max-width: 1199px) {
  .table--cards td:last-child { position: static; box-shadow: none; background: none; }
  .table--cards tbody tr:hover td:last-child { background: none; }
}
@media (min-width: 768px) and (max-width: 1199px) {
  .table--cards tbody { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .table--cards tr { margin-bottom: 0; }
}
.cell-title { font-weight: 600; overflow-wrap: anywhere; }
.cell-sub { font-size: var(--fs-xs); color: var(--text-3); }
pre.json { position: relative; margin: 0; max-height: 420px; overflow: auto; padding: var(--s4); background: var(--surface-2); border-radius: var(--r-control); font: var(--fs-xs)/1.5 var(--mono); color: var(--text-2); }

/* ============================================================ release rows (Approved Releases) */
.rlist { display: grid; gap: var(--s3); }
/* Release row: calm, scannable. Art · title/artist/meta · state (4 icon checks + one status) · one action + menu */
.rrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) minmax(300px, 380px) auto; grid-template-areas: "art main state actions"; gap: var(--s5); align-items: center; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r-container); transition: background var(--dur-fast), border-color var(--dur-fast); }
.rrow:hover { background: var(--surface-hover); border-color: var(--border); }
.rrow__art { grid-area: art; width: 64px; aspect-ratio: 1; border-radius: var(--r-control); overflow: hidden; background: var(--surface-2); display: grid; place-items: center; color: var(--text-3); box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset; }
.rrow__art img { width: 100%; height: 100%; object-fit: cover; }
.rrow__art > svg { width: 22px; height: 22px; }
.rrow__main { grid-area: main; min-width: 0; display: grid; gap: 2px; }
.rrow__title { display: flex; align-items: center; gap: var(--s2); min-width: 0; font-size: var(--fs-md); font-weight: 650; line-height: 1.35; }
.rrow__title a { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow__title a::after { content: ""; position: absolute; inset: 0; }
.rrow__title .badge { flex: none; }
.rrow__sub { color: var(--text-2); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s3); margin-top: 4px; font-size: var(--fs-xs); color: var(--text-3); }
.rrow__type { color: var(--text-2); }
.rrow__note { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 260px; }
.rrow__note svg { width: 13px; height: 13px; flex: none; }
.rrow__note-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow__state { grid-area: state; min-width: 0; display: flex; align-items: center; gap: var(--s4); }
.rrow__checks { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex: none; }
.chk { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--tone); background: var(--tone-soft); }
.chk svg { width: 15px; height: 15px; }
.chk.tone-ok { color: var(--text-3); background: var(--surface-2); }
.chk.tone-ok svg { color: var(--success); opacity: .8; }
.rrow__rn { min-width: 0; flex: 1; display: grid; gap: 4px; padding-left: var(--s4); border-left: 1px solid var(--border-subtle); }
.rrow__rn .status-line { font-size: var(--fs-sm); }
.rrow__rn-hint, .rrow__blocker { font-size: var(--fs-xs); line-height: 1.45; color: var(--text-3); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.rrow__blocker { color: var(--text-2); }
.rrow__actions { grid-area: actions; position: relative; z-index: 1; display: flex; justify-content: flex-end; }
.rrow__actions-row { display: flex; gap: var(--s1); align-items: center; }
.rrow__actions-row > .btn:first-child { min-width: 150px; }
.rrow { position: relative; }
.rrow__meta [title], .rrow__checks, .rrow__rn { position: relative; z-index: 1; }
.rrow:has(.rrow__title a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.rrow--compact { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "art main actions"; padding: var(--s3); gap: var(--s4); }
.rrow--compact .rrow__art { width: 48px; }
.rrow--compact .rrow__actions-row > .btn:first-child { min-width: 0; }
.type-chip { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 600; background: rgba(0, 0, 0, .75); color: var(--text); }

/* ============================================================ release detail */
.detail-head { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto; gap: var(--s5); align-items: center; margin-bottom: var(--s6); }
.detail-head__art { width: 112px; aspect-ratio: 1; border-radius: var(--r-container); overflow: hidden; background: var(--surface-2); }
.detail-head__art img { width: 100%; height: 100%; object-fit: cover; }
.detail-head h1 { font-size: var(--fs-3xl); font-weight: 700; letter-spacing: -.025em; overflow-wrap: anywhere; }
.detail-head__meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s2); color: var(--text-2); }
.detail-head__actions { display: grid; justify-items: end; gap: var(--s2); }
.tracklist { list-style: none; margin: 0; padding: 0; }
.track { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--border-subtle); }
.track:last-child { border-bottom: 0; }
.track__num { width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); font-weight: 600; }
.track__title { font-weight: 600; overflow-wrap: anywhere; }
.track__meta { font-size: var(--fs-xs); color: var(--text-3); display: flex; flex-wrap: wrap; gap: 4px var(--s3); }
.track--excluded .track__title { color: var(--text-2); }
@media (max-width: 767px) { .track { grid-template-columns: 32px minmax(0, 1fr); row-gap: var(--s1); } .track > :nth-child(n+3) { grid-column: 2; justify-self: start; } }
.subhead { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); margin: var(--s5) 0 var(--s2); }
.composer { padding: var(--s4); border-radius: var(--r-control); background: var(--surface-2); border: 1px solid var(--border-subtle); display: grid; gap: var(--s3); }
.composer[data-status="needs_input"] { border-color: var(--warning-soft); }
.composer__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--s3); border-radius: var(--r-pill); border: 1px solid var(--border); background: transparent; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.option-list { display: grid; gap: var(--s2); }
.option { display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 56px; padding: var(--s2) var(--s3); border: 1px solid var(--border-subtle); border-radius: var(--r-control); background: var(--surface-2); text-align: left; transition: border-color var(--dur-fast), background var(--dur-fast); }
.option:hover { border-color: var(--border-strong); }
.option[aria-pressed="true"] { border-color: var(--accent-line); background: var(--surface-selected); }
.option__body { flex: 1; min-width: 0; }
.option__title { font-weight: 600; display: block; overflow-wrap: anywhere; }
.option__sub { font-size: var(--fs-sm); color: var(--text-2); }
.option__sub.is-warn { color: var(--warning); }
.option__check { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border-strong); color: transparent; flex: none; }
.option[aria-pressed="true"] .option__check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.option__check svg { width: 13px; height: 13px; }
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--s3); }
.cover-pick { position: relative; padding: 0; border: 2px solid transparent; border-radius: var(--r-control); background: var(--surface-2); overflow: hidden; text-align: left; }
.cover-pick img, .cover-pick .cover-ph { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface-2); }
.cover-pick__cap { display: block; padding: 6px var(--s2); font-size: var(--fs-xs); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cover-pick[aria-pressed="true"] { border-color: var(--accent-text); }
.cover-pick__tick { position: absolute; right: 6px; top: 6px; width: 24px; height: 24px; border-radius: 50%; display: none; place-items: center; background: var(--accent); color: var(--on-accent); }
.cover-pick[aria-pressed="true"] .cover-pick__tick { display: grid; }
.cover-pick__tick svg { width: 14px; height: 14px; }
.cover-pick:disabled { opacity: .6; cursor: not-allowed; }

/* ============================================================ wizard */
.store-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s2); max-height: 340px; overflow-y: auto; padding: 2px; }
.store { display: flex; align-items: center; gap: var(--s3); min-height: var(--touch); padding: 0 var(--s3); border: 1px solid var(--border-subtle); border-radius: var(--r-control); background: var(--surface-2); cursor: pointer; }
.store:has(input:checked) { border-color: var(--accent-line); background: var(--surface-selected); }
.store:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.store input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.store.is-disabled { opacity: .5; cursor: not-allowed; }
.store__name { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.store__note { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); }
.radio-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.radio-card { position: relative; display: grid; gap: 4px; padding: var(--s3) var(--s4); border: 1px solid var(--border); border-radius: var(--r-control); background: var(--surface-2); cursor: pointer; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:has(input:checked) { border-color: var(--accent-line); background: var(--surface-selected); }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.radio-card.is-disabled { opacity: .5; cursor: not-allowed; }
.radio-card__title { font-weight: 600; }
.radio-card__sub { font-size: var(--fs-sm); color: var(--text-2); }
.country-list { position: relative; max-height: 280px; overflow-y: auto; border: 1px solid var(--border-subtle); border-radius: var(--r-control); }
.country { display: flex; align-items: center; gap: var(--s3); min-height: var(--touch); padding: 0 var(--s3); border-bottom: 1px solid var(--border-subtle); cursor: pointer; }
.country:last-child { border-bottom: 0; }
.country:hover { background: var(--surface-hover); }
.country input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.country__id { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); font-family: var(--mono); }

/* ============================================================ artists / covers / dropzone */
.list-rows { display: grid; gap: var(--s2); }
.lrow { display: grid; grid-template-columns: 48px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, .9fr) auto; gap: var(--s4); align-items: center; padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r-container); }
.lrow__title { font-weight: 600; overflow-wrap: anywhere; }
.lrow__sub { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.lrow__sub.is-warn { color: var(--warning); }
.dropzone { display: grid; place-items: center; gap: var(--s2); text-align: center; min-height: 168px; padding: var(--s6) var(--s4); border: 2px dashed var(--border); border-radius: var(--r-container); background: var(--surface-2); cursor: pointer; transition: border-color var(--dur-fast), background var(--dur-fast); }
.dropzone:hover, .dropzone.is-over { border-color: var(--accent-line); background: var(--surface-selected); }
.dropzone svg { width: 28px; height: 28px; color: var(--accent-text); }
.dropzone__title { font-weight: 600; color: var(--text); }
.finder-form { margin-bottom: var(--s5); }
.finder-form__row { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: var(--s3); align-items: start; }
.finder-form__row > .btn { margin-top: 26px; }
.finder-url { position: relative; display: inline-block; max-width: min(520px, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: var(--text-2); }
.finder-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.finder-item { position: relative; }
.finder-item .cover-pick { width: 100%; }
.finder-zoom { position: absolute; left: 6px; top: 6px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: rgba(0, 0, 0, .6); color: #fff; opacity: 0; transition: opacity var(--dur-fast); }
.finder-zoom svg { width: 15px; height: 15px; }
.finder-item:hover .finder-zoom, .finder-zoom:focus-visible { opacity: 1; }
@media (hover: none) { .finder-zoom { opacity: 1; } }
@media (max-width: 767px) {
  .finder-form__row { grid-template-columns: minmax(0, 1fr); }
  .finder-form__row > .btn { margin-top: 0; }
  .finder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finder-zoom { width: 44px; height: 44px; }
}
.cover-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s4); }
.cover-card { background: var(--surface); border: 1px solid var(--border-subtle); border-radius: var(--r-container); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.cover-card__img { position: relative; aspect-ratio: 1; background: var(--surface-2); }
.cover-card__img img { width: 100%; height: 100%; object-fit: cover; }
.cover-card__ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-3); }
.cover-card__state { position: absolute; left: var(--s2); top: var(--s2); }
.cover-card__body { padding: var(--s3) var(--s4) var(--s4); display: grid; gap: 4px; flex: 1; }
.cover-card__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cover-card__foot { margin-top: auto; padding-top: var(--s2); display: flex; justify-content: space-between; align-items: center; gap: var(--s2); }
.upload-item { display: grid; gap: 6px; padding: var(--s3) var(--s4); border-radius: var(--r-control); background: var(--surface); border: 1px solid var(--border-subtle); }

/* ============================================================ dashboard / notifications */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-bottom: var(--s6); border-radius: var(--r-container); overflow: hidden; background: var(--border-subtle); border: 1px solid var(--border-subtle); }
.kpi { display: grid; gap: 2px; padding: var(--s4) var(--s5); background: var(--surface); color: var(--text); text-decoration: none; transition: background var(--dur-fast); min-width: 0; }
.kpi:hover { background: var(--surface-hover); text-decoration: none; }
.kpi__value { font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi__label { font-size: var(--fs-sm); color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi__label svg { width: 15px; height: 15px; color: var(--tone, var(--text-3)); }
.feed { list-style: none; margin: 0; padding: 0; display: grid; }
.feed__item { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: var(--s3) 0; border-bottom: 1px solid var(--border-subtle); color: var(--text); }
.feed__item:hover { text-decoration: none; }
.feed__item:last-child { border-bottom: 0; }
.feed__item > svg { width: 18px; height: 18px; margin-top: 2px; color: var(--tone, var(--text-3)); }
.feed__title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.feed__body { font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.feed__time { font-size: var(--fs-xs); color: var(--text-3); white-space: nowrap; }
.notif { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border-subtle); }
.notif:last-child { border-bottom: 0; }
.notif > svg { width: 18px; height: 18px; margin-top: 2px; color: var(--tone); }
.notif.is-unread { background: var(--surface-selected); }
.notif__title { font-weight: 600; overflow-wrap: anywhere; }
.notif__body { color: var(--text-2); overflow-wrap: anywhere; }
.notif__actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ============================================================ login */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.login__card { width: min(420px, 100%); padding: var(--s8) var(--s6); border-radius: var(--r-container); background: var(--surface); border: 1px solid var(--border-subtle); }
.login__card .brand { justify-content: center; padding-bottom: var(--s4); }
.login__title { text-align: center; font-size: var(--fs-2xl); font-weight: 700; }
.login__sub { text-align: center; color: var(--text-2); margin: var(--s1) 0 var(--s6); }

/* ============================================================ motion */
.enter { animation: rise var(--dur-page) var(--ease-out) both; animation-delay: calc(min(var(--i, 0), 7) * 40ms); }
.spin { animation: spin 1s linear infinite; }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes indeterminate { 0% { transform: translateX(-100%) scaleX(.35); } 100% { transform: translateX(290%) scaleX(.35); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .progress--indeterminate .progress__bar { transform: scaleX(1); opacity: .6; }
}

/* ============================================================ responsive */
@media (max-width: 1399px) {
  .rrow { grid-template-columns: 64px minmax(0, 1fr) minmax(260px, 320px) auto; gap: var(--s4); }
  .layout-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1199px) {
  .rrow { grid-template-columns: 64px minmax(0, 1fr) auto; grid-template-areas: "art main actions" "art state state"; row-gap: var(--s3); }
}
@media (max-width: 1023px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 50; top: 0; left: 0; bottom: 0; width: min(300px, 86vw); height: auto; transform: translateX(-100%); visibility: hidden; transition: transform var(--dur-slow) var(--ease-out), visibility 0s linear var(--dur-slow); padding-top: max(var(--s5), env(safe-area-inset-top)); }
  .shell.nav-open .sidebar { transform: none; visibility: visible; transition: transform var(--dur-slow) var(--ease-out); }
  .topbar { display: flex; }
  .page { padding: var(--s5) var(--s5) 80px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lrow { grid-template-columns: 48px minmax(0, 1fr) auto; }
  .lrow > :nth-child(3), .lrow > :nth-child(4) { grid-column: 2 / 3; }
}
@media (max-width: 767px) {
  .seg { width: 100%; }
  .seg__btn { flex: 1; min-height: var(--touch); }
  .rrow { grid-template-areas: "art main" "state state" "actions actions"; grid-template-columns: 56px minmax(0, 1fr); padding: var(--s4); gap: var(--s3) var(--s4); }
  .rrow__art { width: 56px; }
  .rrow__state { padding-top: var(--s3); border-top: 1px solid var(--border-subtle); gap: var(--s3); }
  .rrow__rn { padding-left: var(--s3); }
  .rrow__actions-row { width: 100%; }
  .rrow__actions-row > .btn:first-child { flex: 1; }
  .rrow--compact { grid-template-areas: "art main" "actions actions"; grid-template-columns: 48px minmax(0, 1fr); }
  .toolbar .search, .toolbar__group, .toolbar .field:has(.search) { width: 100%; }
  .toolbar__group--filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .field { min-width: 0; }
  .toolbar__count { padding-bottom: 0; }
  .detail-head { grid-template-columns: 72px minmax(0, 1fr); }
  .detail-head__art { width: 72px; }
  .detail-head h1 { font-size: var(--fs-2xl); }
  .detail-head__actions { grid-column: 1 / -1; justify-items: stretch; }
  .form-grid, .grid-2, .radio-cards { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dt { margin-top: var(--s2); }
  .page-head h1 { font-size: var(--fs-2xl); }
  .panel { padding: var(--s4); }
  .overlay { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 94vh; border-radius: var(--r-container) var(--r-container) 0 0; animation: sheet-in var(--dur-slow) var(--ease-out); padding-bottom: env(safe-area-inset-bottom); }
  .modal__body { padding: var(--s4); }
  .modal__head, .modal__foot { padding-left: var(--s4); padding-right: var(--s4); }
  .menu.is-sheet { position: fixed; left: 0; right: 0; top: auto; bottom: 0; max-width: none; border-radius: var(--r-container) var(--r-container) 0 0; padding: var(--s2) var(--s2) max(var(--s3), env(safe-area-inset-bottom)); animation: sheet-in var(--dur-slow) var(--ease-out); }
  .menu__item { min-height: var(--touch); }
  .btn, .btn--sm { min-height: var(--touch); min-width: var(--touch); }
  .btn--icon, .btn--icon.btn--sm { width: var(--touch); }
  .input, .select { min-height: var(--touch); font-size: 16px; }
  .toasts { left: var(--s4); right: var(--s4); bottom: max(var(--s4), env(safe-area-inset-bottom)); width: auto; }
  .notif { padding: var(--s4); grid-template-columns: 20px minmax(0, 1fr); }
  .notif__actions { grid-column: 2; justify-content: flex-start; }
  .cover-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
  .lrow { grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s3); }
}
@media (max-width: 399px) {
  .page { padding-left: var(--s4); padding-right: var(--s4); }
  .cover-cards { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: var(--s3) var(--s4); }
}
