:root {
  --ink: #171714;
  --muted: #716f68;
  --paper: #f5f0e6;
  --paper-2: #ebe3d4;
  --orange: #e85b33;
  --orange-dark: #bd3f21;
  --line: rgba(23, 23, 20, .13);
  --shadow: 0 24px 70px rgba(54, 41, 25, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }

.language-switcher { display: flex; align-items: center; gap: .45rem; margin-bottom: 2rem; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .08em; }
.language-switcher a { min-width: 36px; min-height: 36px; display: grid; place-items: center; border: 1px solid transparent; color: inherit; text-decoration: none; }
.language-switcher a:hover, .language-switcher a:focus-visible { border-color: var(--line); color: var(--orange-dark); }
.language-switcher a[aria-current="true"] { border-color: var(--orange); color: var(--orange-dark); }
.language-switcher-dark { margin: 1rem 0 .25rem; color: #929089; }
.language-switcher-dark a:hover, .language-switcher-dark a:focus-visible { border-color: #504e49; color: white; }
.language-switcher-dark a[aria-current="true"] { border-color: var(--orange); color: white; }

.login-page {
  background:
    radial-gradient(circle at 14% 22%, rgba(232, 91, 51, .1), transparent 25rem),
    linear-gradient(115deg, var(--paper) 0 53%, #efe8dc 53% 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
  align-items: center;
  gap: clamp(3rem, 8vw, 9rem);
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 6rem);
}

.brand-panel { max-width: 590px; }
.brand-mark { height: 52px; display: flex; align-items: center; gap: 7px; margin-bottom: 3rem; }
.brand-mark span { display: block; width: 5px; border-radius: 99px; background: var(--orange); }
.brand-mark span:nth-child(1), .brand-mark span:nth-child(5) { height: 14px; }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(4) { height: 31px; }
.brand-mark span:nth-child(3) { height: 49px; }
.eyebrow { margin: 0 0 1rem; text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 800; color: var(--orange-dark); }
.brand-panel h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(4.25rem, 9vw, 8.5rem); line-height: .76; letter-spacing: -.07em; font-weight: 600; }
.brand-panel h1 em { color: var(--orange); font-weight: 500; }
.brand-copy { max-width: 430px; margin: 2.5rem 0 2.25rem; color: var(--muted); font-family: Georgia, serif; font-size: 1.2rem; line-height: 1.6; }
.signal-line { width: 148px; height: 1px; background: var(--orange); position: relative; }
.signal-line::after { content: ""; position: absolute; right: 0; top: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); }

.login-card { background: rgba(255,255,255,.72); border: 1px solid rgba(255,255,255,.9); box-shadow: var(--shadow); padding: clamp(2rem, 5vw, 4.75rem); max-width: 510px; backdrop-filter: blur(18px); }
.lock-badge { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--paper); margin-bottom: 2rem; font-size: 1.65rem; }
.login-card h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.4rem, 4vw, 3.5rem); letter-spacing: -.04em; font-weight: 500; }
.muted { color: var(--muted); line-height: 1.55; margin: .8rem 0 2.5rem; }
.login-form { display: grid; gap: .65rem; }
.login-form label { font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.password-label { display: flex; justify-content: space-between; align-items: baseline; margin-top: .85rem; }
.password-label span { color: var(--muted); font-size: .68rem; }
.login-form input { border: 1px solid var(--line); background: #fffdf9; min-height: 52px; padding: .8rem 1rem; outline: none; transition: border .2s, box-shadow .2s; }
.login-form input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,91,51,.12); }
.login-form button { margin-top: 1.2rem; border: 0; min-height: 54px; padding: .9rem 1.2rem; background: var(--orange); color: white; font-weight: 800; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: background .2s, transform .2s; }
.login-form button:hover { background: var(--orange-dark); transform: translateY(-1px); }
.privacy-note { margin: 2rem 0 0; text-align: center; color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.form-error { margin: 0 0 .8rem; padding: .8rem 1rem; background: #fff1ed; color: #9c311c; border-left: 3px solid var(--orange); font-size: .85rem; }
.form-success { margin: 0 0 1rem; padding: .8rem 1rem; background: #e7f4ed; color: #24674f; border-left: 3px solid #4b9b79; font-size: .85rem; line-height: 1.5; }

/* Authenticated application */
.app-page { background: #f4f0e8; color: var(--ink); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: #191918; color: #eee9df; padding: 2rem 1.25rem; display: flex; flex-direction: column; z-index: 10; }
.mini-brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: .8rem; padding: 0 .55rem; }
.mini-brand strong { font-family: Georgia, serif; font-size: 1.2rem; line-height: .88; letter-spacing: -.03em; }
.mini-brand em { color: var(--orange); font-weight: 500; }
.mini-bars { width: 24px; height: 27px; display: flex; align-items: center; gap: 3px; }
.mini-bars i { display: block; width: 3px; height: 12px; border-radius: 3px; background: var(--orange); }
.mini-bars i:nth-child(2) { height: 25px; }
.side-nav { margin-top: 3.25rem; display: grid; gap: .45rem; }
.side-nav a { color: #aaa79f; text-decoration: none; display: flex; align-items: center; gap: .75rem; padding: .8rem .9rem; border-radius: 7px; font-size: .86rem; font-weight: 650; }
.side-nav a:hover, .side-nav a.active { color: white; background: rgba(255,255,255,.08); }
.side-nav a.active { box-shadow: inset 3px 0 var(--orange); }
.side-nav span { font-size: 1.05rem; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 1.2rem .55rem 0; }
.user-chip { display: flex; align-items: center; gap: .75rem; }
.user-chip > span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--orange); color: white; font-weight: 800; }
.user-chip div { display: grid; min-width: 0; }
.user-chip strong { font-size: .83rem; overflow: hidden; text-overflow: ellipsis; }
.user-chip small { color: #8e8b85; font-size: .7rem; }
.text-button { border: 0; background: none; padding: .6rem 0; color: #929089; cursor: pointer; font-size: .75rem; }
.text-button:hover { color: var(--orange); }
.text-button.danger { color: #b33a28; }
.logout-icon { display: none; }
.app-main { min-width: 0; padding: 2.5rem clamp(1.5rem, 4vw, 4rem) 9rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 2rem; margin-bottom: 2.2rem; }
.topbar h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.25rem, 4vw, 4rem); font-weight: 500; letter-spacing: -.045em; }
.topbar .eyebrow { margin-bottom: .45rem; }
.account-topbar { margin-bottom: 1.2rem; }
.account-card { width: min(100%, 620px); padding: clamp(1.4rem, 4vw, 2.5rem); background: rgba(255,255,255,.72); border: 1px solid white; box-shadow: 0 12px 36px rgba(54,41,25,.06); }
.account-card h2 { margin: 0; font-family: Georgia, serif; font-size: clamp(1.8rem, 3vw, 2.4rem); font-weight: 500; }
.account-form { display: grid; gap: .55rem; }
.account-form label { margin-top: .6rem; color: var(--ink); font-size: .75rem; font-weight: 800; }
.account-form input { width: 100%; min-height: 48px; padding: .7rem .8rem; border: 1px solid var(--line); background: #fffdfa; }
.account-form input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,91,51,.12); }
.account-form small { color: var(--muted); font-size: .72rem; }
.account-form button { width: fit-content; margin-top: 1rem; }
.search-box { width: min(460px, 44vw); display: flex; align-items: center; gap: .7rem; padding: .1rem 1rem; background: rgba(255,255,255,.7); border: 1px solid var(--line); }
.search-box input { width: 100%; min-height: 46px; border: 0; outline: 0; background: transparent; }
.library-switcher { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem; margin-bottom: 1.5rem; }
.library-pill { appearance: none; border: 1px solid var(--line); background: rgba(255,255,255,.5); padding: .9rem 1rem; display: flex; align-items: center; gap: .9rem; text-align: left; cursor: pointer; border-radius: 8px; }
.library-pill:hover, .library-pill.active { background: white; border-color: rgba(232,91,51,.5); box-shadow: 0 8px 24px rgba(63,45,28,.07); }
.library-pill > span:last-child { display: grid; }
.library-pill strong { font-size: .88rem; }
.library-pill small { color: var(--muted); margin-top: .15rem; }
.library-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 5px; background: var(--orange); color: white; font-family: Georgia, serif; font-size: 1.2rem; }
.library-icon.lafesse { background: #3f7588; }
.library-icon.all { background: var(--ink); }
.library-icon.favorites { background: #a94758; }
.catalog-panel { background: rgba(255,255,255,.62); border: 1px solid rgba(255,255,255,.92); box-shadow: 0 16px 50px rgba(54,41,25,.08); }
.catalog-toolbar { padding: 1rem 1.2rem; display: flex; gap: 1rem; justify-content: space-between; border-bottom: 1px solid var(--line); }
.filter-row, .shuffle-actions, .action-stack { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
select, .admin-form input { border: 1px solid var(--line); background: #fffdfa; min-height: 40px; padding: .55rem .75rem; color: var(--ink); }
.outline-button, .accent-button, .load-more { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; border: 1px solid var(--line); min-height: 40px; padding: .55rem .85rem; background: #fffdfa; color: var(--ink); font: inherit; font-size: .78rem; font-weight: 750; cursor: pointer; }
.accent-button { border-color: var(--orange); background: var(--orange); color: white; }
.outline-button:hover, .load-more:hover { border-color: var(--orange); color: var(--orange-dark); }
.accent-button:hover { background: var(--orange-dark); }
.shuffle-actions button.active { border-color: var(--orange-dark); box-shadow: inset 0 0 0 2px rgba(232,91,51,.2); }
.track-header, .track-row { display: grid; grid-template-columns: minmax(260px, 2fr) minmax(100px,.7fr) 105px 70px 115px 90px; gap: 1rem; align-items: center; padding: .75rem 1.2rem; }
.track-header { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .61rem; font-weight: 800; border-bottom: 1px solid var(--line); }
.track-row { border-bottom: 1px solid rgba(23,23,20,.07); min-height: 68px; transition: background .15s; }
.track-row:hover, .track-row.playing { background: #fff; }
.track-title { min-width: 0; display: flex; align-items: center; gap: .8rem; }
.row-play { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: white; cursor: pointer; }
.track-title div { min-width: 0; display: grid; }
.track-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .88rem; }
.track-title small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .69rem; }
.library-tag, .heard-state { width: fit-content; padding: .28rem .48rem; border-radius: 99px; background: #efe8dd; font-size: .67rem; font-weight: 700; }
.heard-state.heard { color: #287259; background: #e0f1e8; }
.row-muted { color: var(--muted); font-size: .75rem; }
.track-actions { display: flex; justify-content: flex-end; gap: .35rem; }
.row-action { width: 38px; height: 38px; border: 1px solid transparent; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.row-action:hover, .row-action:focus-visible { border-color: var(--line); background: white; color: var(--orange-dark); }
.row-action.active { color: #a62f48; }
.empty-state, .empty-copy { padding: 3.5rem 1.2rem; text-align: center; color: var(--muted); }
.load-more { margin: 1rem auto; display: block; }
.player-dock { position: fixed; left: 245px; right: 0; bottom: 0; z-index: 20; min-height: 96px; padding: .9rem clamp(1.2rem, 3vw, 3rem); display: grid; grid-template-columns: minmax(210px, .75fr) minmax(300px, 1.35fr) minmax(320px, 1fr); align-items: center; gap: 2rem; background: rgba(25,25,24,.97); color: #f8f4eb; box-shadow: 0 -8px 40px rgba(0,0,0,.16); }
.now-playing { min-width: 0; display: flex; gap: .8rem; align-items: center; }
.cover-mark { width: 46px; height: 46px; display: grid; place-items: center; background: var(--orange); color: white; font-size: 1.3rem; }
.now-playing div { min-width: 0; display: grid; }
.now-playing small { color: #9b9891; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.now-playing strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .83rem; }
.player-center { display: grid; gap: .6rem; }
.transport { display: flex; justify-content: center; align-items: center; gap: .65rem; }
.transport button { border: 0; background: transparent; color: white; font-size: 1.55rem; cursor: pointer; }
.transport .play-button { width: 40px; height: 40px; border-radius: 50%; background: #f8f4eb; color: #191918; font-size: .85rem; padding-left: .3rem; }
.timeline { display: grid; grid-template-columns: 38px 1fr 38px; align-items: center; gap: .5rem; font-size: .65rem; color: #a7a49d; }
input[type="range"] { accent-color: var(--orange); }
.player-actions { display: flex; align-items: center; justify-content: flex-end; gap: .55rem; }
.heard-button { border: 1px solid #504e49; background: transparent; color: #bbb8b0; padding: .55rem .7rem; font-size: .7rem; cursor: pointer; }
.heard-button.active { border-color: #5b9c81; color: #8ed0b3; }
.player-icon-button { min-height: 38px; border: 1px solid #504e49; background: transparent; color: #bbb8b0; padding: .5rem .65rem; font-size: .7rem; cursor: pointer; white-space: nowrap; }
.player-icon-button:not(:disabled) { border-color: #77736b; color: #f8f4eb; }
.player-icon-button.active { border-color: #b95165; color: #ef8fa2; }
.player-icon-button:disabled, .heard-button:disabled { opacity: .45; cursor: default; }
.volume { display: flex; align-items: center; gap: .3rem; }
.volume input { width: 74px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1rem; }
.stats-grid article { background: #fffdfa; border: 1px solid var(--line); padding: 1.2rem; display: grid; }
.stats-grid span { color: var(--muted); font-size: .72rem; }
.stats-grid strong { font-family: Georgia, serif; font-size: 2.2rem; font-weight: 500; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.admin-card { background: rgba(255,255,255,.68); border: 1px solid white; padding: 1.4rem; box-shadow: 0 12px 36px rgba(54,41,25,.06); }
.admin-card.wide { grid-column: 1 / -1; }
.admin-card h2 { margin: 0 0 1.2rem; font-family: Georgia, serif; font-weight: 500; font-size: 1.65rem; }
.section-heading { display: flex; justify-content: space-between; }
.admin-form { display: grid; gap: .9rem; }
.admin-form label { display: grid; gap: .35rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.admin-form .check { display: flex; align-items: center; }
.library-checks { margin: 0; padding: .8rem; display: flex; flex-wrap: wrap; gap: .55rem 1rem; border: 1px solid var(--line); }
.library-checks legend { padding: 0 .35rem; color: var(--muted); font-size: .7rem; font-weight: 700; }
.library-checks.compact { padding: .45rem .6rem; gap: .35rem .7rem; }
.library-access-form { display: flex; align-items: center; gap: .5rem; }
.access-summary { color: var(--muted); font-size: .72rem; }
.file-drop { padding: 1rem; border: 1px dashed #b9b0a1; background: #fffdfa; }
.job-list { margin-top: 1.2rem; border-top: 1px solid var(--line); }
.schedule-panel { margin-top: 1.2rem; padding: 1rem; border: 1px solid var(--line); background: #fffdfa; }
.schedule-panel h3 { margin: 0; font-family: Georgia, serif; font-size: 1.15rem; font-weight: 600; }
.schedule-panel > div > p { margin: .35rem 0 1rem; color: var(--muted); font-size: .75rem; line-height: 1.5; }
.schedule-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(170px, .8fr); align-items: end; gap: .7rem 1rem; }
.schedule-form > label:not(.check) { display: grid; gap: .35rem; color: var(--muted); font-size: .7rem; font-weight: 700; }
.schedule-form .check { display: flex; align-items: center; gap: .4rem; color: var(--ink); font-size: .73rem; }
.schedule-form button { width: fit-content; }
.schedule-status { margin: .9rem 0 0; display: flex; flex-wrap: wrap; gap: .3rem; color: var(--muted); font-size: .7rem; }
.job-list article, .duplicate-row, .user-table article { display: flex; align-items: center; gap: .8rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.job-list article > div, .duplicate-row > div { display: grid; flex: 1; }
.job-list small, .duplicate-row small { color: var(--muted); }
.job-list time { color: var(--muted); font-size: .68rem; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #a7a29a; }
.status-dot.running { background: #e5a024; box-shadow: 0 0 0 4px rgba(229,160,36,.14); }
.status-dot.complete { background: #4b9b79; }
.status-dot.failed { background: #c44736; }
.error-text { color: #b33a28 !important; }
.count-badge { min-width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: white; }
.user-table article { justify-content: space-between; }
.account-menu { position: relative; font-size: .72rem; }
.account-menu summary { cursor: pointer; color: var(--muted); }
.account-menu form { position: absolute; right: 0; top: 1.5rem; z-index: 3; display: flex; gap: .4rem; width: 290px; padding: .6rem; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
.account-menu input { min-width: 0; border: 1px solid var(--line); padding: .45rem; }
.state { padding: .25rem .45rem; border-radius: 99px; font-size: .65rem; background: #e1f1e9; color: #287259; }
.state.disabled { background: #eee8de; color: #817a71; }
.duplicate-review { padding: .3rem 0 1.2rem; border-bottom: 1px solid var(--line); }
.duplicate-audio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .7rem; }
.duplicate-audio { display: grid; gap: .25rem; padding: .9rem; border: 1px solid var(--line); background: #fffdfa; border-left: 4px solid #d9aa57; }
.duplicate-audio.keep { border-left-color: #4b9b79; }
.duplicate-audio span { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: .62rem; font-weight: 800; }
.duplicate-audio small { color: var(--muted); }
.duplicate-audio audio { width: 100%; height: 38px; margin-top: .5rem; }
.inventory-list form { display: grid; grid-template-columns: 45px minmax(220px, 1fr) 150px 135px 70px 135px; gap: .6rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.inventory-list input { min-height: 36px; padding: .4rem .6rem; border: 1px solid var(--line); background: white; }
.inventory-list span, .inventory-list small { color: var(--muted); font-size: .7rem; }
.event-log article { display: grid; grid-template-columns: 115px 135px 1fr; gap: .8rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.event-log time { color: var(--muted); font-size: .68rem; }
.event-log p { margin: 0; font-size: .78rem; }

@media (max-width: 1100px) and (min-width: 821px) {
  .app-main { padding-bottom: 11rem; }
  .player-dock { grid-template-columns: minmax(180px, .8fr) minmax(320px, 1.2fr); gap: .75rem 1.5rem; }
  .player-center { grid-column: 1 / -1; grid-row: 2; }
  .player-actions { grid-column: 2; grid-row: 1; }
  .volume { display: none; }
}

@media (max-width: 820px) {
  .login-page { background: var(--paper); }
  .login-shell { grid-template-columns: 1fr; gap: 3rem; padding: 2rem 1.25rem 3rem; }
  .brand-panel h1 { font-size: clamp(4rem, 20vw, 6.5rem); }
  .brand-copy { margin-top: 2rem; }
  .brand-mark { margin-bottom: 2rem; }
  .login-card { max-width: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: sticky; padding: .45rem .75rem; flex-direction: row; align-items: center; gap: .25rem; }
  .side-nav { margin: 0 0 0 auto; display: flex; }
  .side-nav a { font-size: 0; min-width: 44px; min-height: 44px; justify-content: center; padding: .65rem; }
  .side-nav a span { font-size: 1.1rem; }
  .sidebar-bottom { margin: 0; border: 0; padding: 0; display: flex; align-items: center; gap: .1rem; }
  .sidebar-bottom .language-switcher { margin: 0; }
  .sidebar-bottom .language-switcher span { display: none; }
  .sidebar-bottom .language-switcher a[aria-current="true"] { display: none; }
  .sidebar-bottom .language-switcher a { min-width: 44px; min-height: 44px; }
  .sidebar-bottom .user-chip { display: none; }
  .sidebar-bottom .logout-button { display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0; color: #d3cfc6; font-size: 1.15rem; }
  .logout-label { display: none; }
  .logout-icon { display: inline; }
  .app-main { padding: 1.35rem 1rem 11.5rem; }
  .topbar { align-items: stretch; flex-direction: column; gap: 1rem; margin-bottom: 1.35rem; }
  .search-box { width: 100%; }
  .library-switcher { display: flex; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: .3rem; }
  .library-pill { min-width: min(78vw, 280px); scroll-snap-align: start; }
  .catalog-toolbar { align-items: stretch; flex-direction: column; }
  .filter-row > *, .shuffle-actions > * { flex: 1 1 150px; min-height: 44px; }
  .track-header { display: none; }
  .track-row { grid-template-columns: minmax(0, 1fr) auto; gap: .45rem; padding: .8rem; }
  .track-row > *:nth-child(2), .track-row > *:nth-child(3), .track-row > *:nth-child(4) { display: none; }
  .track-row > *:nth-child(5) { grid-column: 1; margin-left: 56px; }
  .track-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
  .row-play { width: 44px; height: 44px; }
  .player-dock { left: 0; grid-template-columns: 1fr; gap: .7rem; padding: .8rem 1rem; }
  .now-playing { padding-right: 0; }
  .player-center { grid-row: 2; }
  .player-actions { position: static; grid-row: 3; justify-content: center; flex-wrap: wrap; }
  .transport button { min-width: 44px; min-height: 44px; }
  .heard-button { min-height: 44px; }
  .volume { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-card.wide { grid-column: auto; }
  .admin-form input, .admin-form select, .admin-form button { width: 100%; min-height: 44px; }
  .account-form input, .account-form button { min-height: 44px; }
  .job-list article, .duplicate-row, .user-table article { align-items: flex-start; flex-wrap: wrap; }
  .schedule-form { grid-template-columns: 1fr; }
  .schedule-form button { width: 100%; min-height: 44px; }
  .user-table article > .user-chip { flex: 1 1 100%; }
  .library-access-form { flex: 1 1 100%; flex-wrap: wrap; }
  .account-menu { position: static; }
  .account-menu form { position: static; width: min(100%, 320px); margin-top: .5rem; flex-wrap: wrap; }
  .inventory-list form { grid-template-columns: 35px 1fr; }
  .inventory-list form > *:nth-child(n+3) { grid-column: 2; }
  .event-log article { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .login-shell { gap: 2rem; padding: 1.25rem 1rem 2rem; }
  .brand-mark { height: 38px; margin-bottom: 1.25rem; }
  .brand-panel > .language-switcher { margin-bottom: 1rem; }
  .brand-mark span:nth-child(3) { height: 38px; }
  .brand-panel h1 { font-size: clamp(3.25rem, 19vw, 5rem); }
  .brand-copy { margin: 1.25rem 0; font-size: 1rem; }
  .login-card { padding: 1.5rem 1.1rem; }
  .lock-badge { margin-bottom: 1.2rem; }
  .mini-brand strong { display: none; }
  .sidebar { padding: .3rem .45rem; gap: 0; }
  .mini-brand { width: 44px; height: 44px; justify-content: center; padding: 0; }
  .side-nav { gap: 0; }
  .app-main { padding-inline: .7rem; }
  .topbar h1 { font-size: 2.25rem; }
  .catalog-toolbar, .admin-card { padding: 1rem; }
  .account-card { padding: 1.15rem; }
  .account-form button { width: 100%; }
  .filter-row, .shuffle-actions { display: grid; grid-template-columns: 1fr; }
  .filter-row > *, .shuffle-actions > * { width: 100%; }
  .track-title small { max-width: 56vw; }
  .heard-state { white-space: nowrap; }
  .player-dock { padding: .65rem .75rem max(.65rem, env(safe-area-inset-bottom)); }
  .now-playing { padding-right: 0; max-width: 100%; }
  .cover-mark { width: 38px; height: 38px; }
  .player-actions { position: static; grid-row: 3; display: grid; grid-template-columns: 1fr 1fr; justify-content: center; width: 100%; }
  .heard-button { width: 100%; }
  .player-actions .heard-button { grid-column: 1 / -1; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid article { padding: .9rem; }
  .duplicate-row form, .duplicate-row button { width: 100%; }
  .duplicate-audio-grid { grid-template-columns: minmax(0, 1fr); }
  .event-log p { overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* Optional account MFA */
.mfa-card { margin-top: 1.5rem; }
.mfa-card p, .mfa-login-shell p { line-height: 1.5; }
.mfa-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin: .7rem 0; }
.mfa-key-list { padding: 0; list-style: none; }
.mfa-key-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); }
.mfa-card code, .mfa-card pre { overflow-wrap: anywhere; white-space: pre-wrap; }
.mfa-card pre { padding: 1rem; background: white; font-size: .8rem; }
#mfa-qr { max-width: 100%; height: auto; background: white; }
#mfa-message:not(:empty) { padding: .8rem; background: #fff1df; }
.mfa-login-shell { max-width: 560px; margin: 5vh auto; padding: 1rem; }
.mfa-login-shell .login-card { width: 100%; }
.mfa-card [hidden], .mfa-login-shell [hidden] { display: none !important; }

/* MFA settings show one verification/setup step at a time. */
#mfa-account [hidden] { display: none !important; }
#mfa-account button:disabled { opacity: .6; cursor: wait; }
#mfa-setup-title:focus { outline: none; }
#mfa-done { display: block; margin-top: 1.5rem; }
#mfa-overview h3 { margin-top: 1.5rem; }
#mfa-setup .account-form { margin-top: 1rem; }
.account-topbar > .outline-button { align-self: flex-start; text-align: center; }
.mfa-configure-link { display: inline-block; margin-top: 1rem; text-decoration: none; }
