:root {
  --bg: #0a0c0d;
  --surface: #121516;
  --surface-raised: #181c1d;
  --surface-soft: #0f1213;
  --line: #293031;
  --line-strong: #3a4344;
  --text: #f2f5ef;
  --muted: #919c98;
  --accent: #c8ff5a;
  --accent-soft: rgb(200 255 90 / 10%);
  --warning: #ffba66;
  --danger: #ff7272;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 64px;
  padding: 0 clamp(16px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgb(10 12 13 / 92%);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: #101500; background: var(--accent); font-weight: 900; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.connection-state { margin-right: 8px; color: var(--muted); font-size: 12px; }
.connection-state.online::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

#app-main { width: min(1460px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0 72px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(34px, 4vw, 52px); line-height: 1.02; letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: clamp(23px, 2.5vw, 30px); letter-spacing: -.035em; }
.eyebrow { margin-bottom: 9px; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .18em; }
.lede, .muted, .page-description, .section-description { color: var(--muted); }
.lede { max-width: 540px; font-size: 18px; line-height: 1.55; }
.page-description { margin-bottom: 0; font-size: 14px; line-height: 1.5; }
.section-description { max-width: 620px; margin: 8px 0 0; font-size: 13px; line-height: 1.55; }

.login-panel { min-height: calc(100vh - 128px); display: grid; grid-template-columns: 1.25fr minmax(300px, 420px); align-items: center; gap: clamp(48px, 10vw, 150px); width: min(1120px, 100%); margin: 0 auto; }
.login-panel h1 { max-width: 700px; font-size: clamp(42px, 7vw, 76px); }
.login-form { padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 32px 90px rgb(0 0 0 / 34%); }
label { display: grid; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 12px; font-weight: 650; }
input, textarea, select { width: 100%; padding: 12px 13px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; outline: 0; }
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { min-height: 18px; margin: 14px 0 0; color: var(--danger); font-size: 12px; }
.form-message { min-height: 18px; margin: 13px 2px 0; color: var(--accent); font-size: 12px; }
.form-message.error { color: var(--danger); }

.button { min-height: 38px; padding: 9px 14px; border: 1px solid transparent; border-radius: 9px; color: var(--text); background: var(--surface-raised); font-weight: 720; font-size: 12px; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.button:hover { border-color: var(--line-strong); }
.button:focus-visible, .nav-item:focus-visible, summary:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; }
.button:disabled { cursor: wait; opacity: .55; }
.button.primary { width: 100%; color: #151a08; background: var(--accent); }
.button.primary:hover { border-color: var(--accent); background: #d2ff77; }
.button.secondary { border-color: var(--line); }
.button.ghost { color: var(--muted); background: transparent; }
.button.danger { color: var(--danger); background: transparent; border-color: rgb(255 114 114 / 30%); }

.dashboard-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: clamp(26px, 4vw, 56px); align-items: start; }
.sidebar { min-height: calc(100vh - 128px); padding: 14px; display: flex; flex-direction: column; justify-content: space-between; position: sticky; top: 96px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); }
.nav-label { margin: 8px 10px 10px; color: #68716e; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.sidebar-nav { display: grid; gap: 4px; }
.nav-item { width: 100%; padding: 11px 10px; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 9px; align-items: center; color: var(--muted); text-align: left; border: 1px solid transparent; border-radius: 11px; background: transparent; }
.nav-item:hover { color: var(--text); background: var(--surface); }
.nav-item[aria-current="page"] { color: var(--text); border-color: var(--line); background: var(--surface-raised); }
.nav-item[aria-current="page"] .nav-icon { color: #151a08; background: var(--accent); }
.nav-item strong, .nav-item small { display: block; }
.nav-item strong { font-size: 13px; }
.nav-item small { margin-top: 2px; color: #707b77; font-size: 10px; }
.nav-icon { display: grid; place-items: center; width: 26px; height: 26px; color: #78827f; border-radius: 8px; background: var(--surface); font-size: 9px; font-weight: 850; }
.account-card { padding: 12px 10px 4px; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); }
.account-card strong, .account-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.account-card strong { font-size: 12px; }
.account-card small { margin-top: 2px; color: var(--muted); font-size: 10px; text-transform: capitalize; }
.account-avatar { flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px; color: #151a08; border-radius: 50%; background: var(--accent); font-size: 12px; font-weight: 850; }

.workspace { min-width: 0; }
.workspace-header { min-height: 112px; margin: 4px 0 30px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.workspace-header h1 { margin-bottom: 8px; }
.updated-at { flex: 0 0 auto; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.dashboard-page { display: grid; gap: 22px; }
.panel { padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); }
.section-heading { margin-bottom: 22px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading.compact { margin-top: 30px; }
.section-heading.compact h3 { margin: 0; font-size: 17px; }
.pill { flex: 0 0 auto; padding: 6px 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: 11px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric { min-height: 126px; padding: 18px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.metric-label { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .09em; }
.metric-value { margin-top: auto; overflow: hidden; text-overflow: ellipsis; font-size: clamp(24px, 3vw, 34px); font-weight: 770; letter-spacing: -.04em; }
.metric-detail { margin-top: 3px; color: var(--muted); font-size: 10px; }
.metric.accent { color: #101500; background: var(--accent); border-color: var(--accent); }
.metric.accent .metric-label, .metric.accent .metric-detail { color: #45531f; }
.overview-note { padding: 18px 20px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); }
.overview-note strong { font-size: 13px; }
.overview-note p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.health-indicator { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }

.sync-card { padding: 20px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); }
.sync-icon { display: grid; place-items: center; width: 44px; height: 44px; color: #151a08; border-radius: 13px; background: var(--accent); font-size: 24px; font-weight: 800; }
.sync-copy .eyebrow { margin-bottom: 5px; }
.sync-copy h2 { font-size: 20px; }
.sync-copy .section-description { margin-top: 5px; }
.sync-actions { display: flex; align-items: center; gap: 9px; }
.sync-actions .button.primary { width: auto; min-width: 96px; }
.sync-actions .pill.active { color: #151a08; border-color: var(--accent); background: var(--accent); }
.sync-actions .pill.failed { color: var(--danger); border-color: rgb(255 114 114 / 35%); }

.import-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.import-card { min-width: 0; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.import-card h3 { margin: 8px 0 7px; font-size: 17px; }
.import-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.import-card label { margin: 0; }
.import-card .button.primary { width: auto; align-self: flex-start; }
.card-kicker { color: var(--accent); font-size: 9px; font-weight: 850; letter-spacing: .15em; }
.file-field input { padding: 10px; }

.create-user-panel { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.create-user-panel summary { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; list-style: none; }
.create-user-panel summary::-webkit-details-marker { display: none; }
.create-user-panel summary::after { content: "+"; color: var(--accent); font-size: 22px; line-height: 1; }
.create-user-panel[open] summary::after { content: "−"; }
.create-user-panel summary span, .create-user-panel summary small { display: block; }
.create-user-panel summary span { font-size: 13px; font-weight: 750; }
.create-user-panel summary small { margin-left: auto; color: var(--muted); font-size: 11px; }
.user-form { padding: 0 18px 18px; display: grid; grid-template-columns: minmax(130px, 1fr) minmax(160px, 1fr) 140px auto; gap: 10px; align-items: end; }
.user-form label { margin: 0; }
.user-form .button.primary { width: auto; }
.user-row { align-items: start; }
.permission-list { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.permission-chip { width: auto; margin: 0; padding: 6px 9px; display: inline-flex; grid-template-columns: none; align-items: center; gap: 6px; color: var(--text); border: 1px solid var(--line); border-radius: 999px; background: var(--bg); cursor: pointer; }
.permission-chip input { width: 13px; height: 13px; margin: 0; padding: 0; accent-color: var(--accent); }
.permission-chip:has(input:checked) { color: #151a08; background: var(--accent); border-color: var(--accent); }
.permission-chip:has(input:disabled) { cursor: default; opacity: .72; }
.permission-chip span { font-size: 10px; font-weight: 750; }

.settings-form { max-width: 760px; padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.settings-form label { margin: 0; }
.settings-form label span { color: #68716e; font-size: 10px; font-weight: 500; }
.settings-submit { grid-column: 1 / -1; padding-top: 4px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); }
.settings-submit .section-description { margin: 0; }
.settings-submit .button.primary { width: auto; flex: 0 0 auto; }
.provider-status-card { padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.provider-status-copy { min-width: 0; display: flex; align-items: center; gap: 13px; }
.provider-status-copy h3 { margin: 0; font-size: 14px; }
.provider-status-copy p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.provider-indicator { width: 11px; height: 11px; flex: 0 0 auto; border-radius: 50%; background: #5e6865; }
.provider-indicator.online { background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.provider-indicator.failed { background: var(--danger); }
.provider-facts { margin: 0; display: flex; gap: 24px; }
.provider-facts div { min-width: 70px; }
.provider-facts dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.provider-facts dd { margin: 4px 0 0; font-size: 12px; font-weight: 750; }
.integration-hint { margin: 14px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.integration-hint code { padding: 2px 5px; color: var(--text); border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }

.search-form { margin-bottom: 4px; padding: 18px; display: grid; grid-template-columns: minmax(220px, 1fr) 120px auto; gap: 10px; align-items: end; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.search-form label { margin: 0; }
.search-form .button.primary { width: auto; min-width: 92px; }
.search-results { margin-top: 18px; }
.search-result { grid-template-columns: minmax(0, 1fr) minmax(240px, auto) auto; align-items: start; }
.search-result .search-add { width: auto; align-self: center; white-space: nowrap; }
.search-actions { display: flex; align-items: center; gap: 7px; }
.search-result-title { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.search-path { margin: 7px 0 0; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; line-height: 1.45; }
.search-peer-facts { min-width: 270px; margin: 0; display: grid; grid-template-columns: minmax(90px, 1.4fr) repeat(2, minmax(58px, .7fr)); gap: 14px; }
.search-peer-facts div { min-width: 0; }
.search-peer-facts dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.search-peer-facts dd { margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; font-size: 11px; font-weight: 700; }
.search-match-list { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.search-matches { grid-column: 1 / -1; }
.search-matches summary { color: var(--accent); cursor: pointer; font-size: 10px; font-weight: 750; }
.search-matches[open] summary { margin-bottom: 10px; }
.search-match-list li { padding: 10px 2px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.search-match-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.search-match-list span, .search-match-list small { display: block; }
.search-match-list span { font-size: 11px; font-weight: 700; }
.search-match-list small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.search-match-list .button { width: auto; flex: none; white-space: nowrap; }
.album-preview { grid-column: 1 / -1; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.album-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.album-preview-heading h4 { margin: 5px 0; font-size: 14px; }
.album-preview-heading p { margin: 0; color: var(--muted); font-size: 10px; }
.album-preview-heading .button { width: auto; white-space: nowrap; }
.album-track-list { max-height: 280px; margin: 14px 0 0; padding: 0; overflow: auto; list-style: none; border-top: 1px solid var(--line); }
.album-track-list li { padding: 9px 2px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); font-size: 11px; }
.album-track-list small { flex: none; color: var(--muted); }

.activity-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.activity-stat { min-height: 116px; padding: 17px 18px; display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, var(--surface) 0%, var(--surface-soft) 100%); }
.activity-stat > span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.activity-stat > strong { align-self: center; font-size: 31px; line-height: 1; letter-spacing: -.045em; }
.activity-stat > small { color: #6e7875; font-size: 9px; }
.activity-stat.accent { border-color: rgb(200 255 90 / 35%); background: linear-gradient(145deg, rgb(200 255 90 / 14%), var(--surface)); }
.activity-stat.warning { border-color: rgb(255 186 102 / 35%); }
.activity-stat.warning > strong { color: var(--warning); }
.activity-stat.danger { border-color: rgb(255 114 114 / 35%); }
.activity-stat.danger > strong { color: var(--danger); }

.activity-panel { overflow: hidden; }
.activity-feed { display: grid; gap: 18px; }
.activity-group { display: grid; gap: 10px; }
.activity-group + .activity-group { padding-top: 18px; border-top: 1px solid var(--line); }
.activity-group-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.activity-group-heading h3 { margin: 0; font-size: 14px; }
.activity-group-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.activity-group-heading > span { min-width: 25px; height: 25px; padding: 0 8px; display: grid; place-items: center; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: 10px; }
.activity-download-list { display: grid; gap: 8px; }
.activity-download { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.activity-download-accent { border-left: 3px solid var(--accent); }
.activity-download-warning { border-left: 3px solid var(--warning); }
.activity-download-danger { border-left: 3px solid var(--danger); }
.activity-download-heading { margin-bottom: 13px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.provider-mark { width: 34px; height: 34px; display: grid; place-items: center; color: #111600; border-radius: 10px; background: var(--accent); font-size: 9px; font-weight: 900; }
.activity-download-copy { min-width: 0; }
.activity-download-copy h3, .activity-history-copy h3, .support-file-row h3, .network-source-copy h3, .source-copy h3 { margin: 0; overflow-wrap: anywhere; font-size: 13px; }
.activity-download-copy p { margin: 4px 0 0; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.download-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 15px; }
.status { color: var(--accent); font-size: 11px; white-space: nowrap; }
.status.failed { color: var(--danger); }
.state-chip { padding: 5px 8px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: 9px; font-weight: 750; white-space: nowrap; }
.state-cached, .state-downloading, .state-transcoding { color: var(--accent); border-color: rgb(200 255 90 / 24%); background: var(--accent-soft); }
.state-failed, .state-cancelled { color: var(--danger); border-color: rgb(255 114 114 / 28%); background: rgb(255 114 114 / 8%); }
.state-waiting, .state-queued { color: var(--warning); border-color: rgb(255 186 102 / 28%); background: rgb(255 186 102 / 8%); }
.progress { height: 5px; overflow: hidden; border-radius: 99px; background: var(--line); }
.progress > span { display: block; height: 100%; background: var(--accent); }
.progress.indeterminate > span { animation: progress-slide 1.4s ease-in-out infinite; }
@keyframes progress-slide { from { transform: translateX(-120%); } to { transform: translateX(320%); } }
@media (prefers-reduced-motion: reduce) { .progress.indeterminate > span { animation: none; transform: translateX(90%); } }
.download-status-detail { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.download-status-detail.stalled { color: var(--warning); }
.activity-download-metrics { margin-top: 13px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.activity-download-metrics span { min-width: 0; }
.activity-download-metrics small, .network-stats small, .network-source-facts small { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .06em; }
.activity-download-metrics strong, .network-source-facts strong { display: block; margin-top: 3px; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.activity-error { margin: 12px 0 0; color: var(--danger); font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.activity-calm { min-height: 82px; padding: 18px; display: flex; align-items: center; gap: 13px; border: 1px dashed var(--line); border-radius: 13px; background: rgb(200 255 90 / 2%); }
.activity-calm > span { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px rgb(200 255 90 / 55%); }
.activity-calm strong { font-size: 12px; }
.activity-calm p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }

.activity-history, .network-source-drawer { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.activity-history > summary, .network-source-drawer > summary { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; cursor: pointer; list-style: none; }
.activity-history > summary::-webkit-details-marker, .network-source-drawer > summary::-webkit-details-marker { display: none; }
.activity-history > summary > span:first-child strong, .activity-history > summary > span:first-child small { display: block; }
.activity-history > summary strong { font-size: 12px; }
.activity-history > summary small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.activity-history > summary > span:last-child, .network-source-drawer > summary > span:last-child { color: var(--muted); font-size: 10px; }
.activity-history > summary > span:last-child::after, .network-source-drawer > summary > span:last-child::after { content: "+"; margin-left: 9px; color: var(--accent); font-size: 15px; }
.activity-history[open] > summary > span:last-child::after, .network-source-drawer[open] > summary > span:last-child::after { content: "−"; }
.activity-history-list, .support-file-list, .network-source-list { border-top: 1px solid var(--line); }
.activity-history-row, .support-file-row { padding: 12px 16px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.activity-history-row:last-child, .support-file-row:last-child { border-bottom: 0; }
.history-kind { width: 27px; height: 27px; display: grid; place-items: center; color: var(--accent); border-radius: 8px; background: var(--accent-soft); font-size: 13px; }
.activity-history-copy, .support-file-row > div { min-width: 0; }
.activity-history-copy p, .support-file-row p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.activity-history-row .download-actions { margin: 0; }
.support-file-row { grid-template-columns: minmax(0, 1fr) auto; }

.network-overview { display: grid; gap: 15px; }
.network-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.network-stats > span { min-width: 0; padding: 15px 17px; border-right: 1px solid var(--line); }
.network-stats > span:last-child { border-right: 0; }
.network-stats strong { display: block; margin-top: 5px; overflow: hidden; font-size: 17px; text-overflow: ellipsis; }
.network-source-list { display: grid; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.network-source-drawer .network-source-list { border: 0; border-top: 1px solid var(--line); border-radius: 0 0 13px 13px; }
.network-source-row { padding: 13px 15px; display: grid; grid-template-columns: minmax(210px, 1fr) minmax(260px, auto) auto; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.network-source-row:last-child { border-bottom: 0; }
.network-source-copy { min-width: 0; display: flex; align-items: center; gap: 10px; }
.network-source-copy > div { min-width: 0; }
.network-source-copy h3, .network-source-copy p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.network-source-copy p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.network-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--line-strong); }
.network-dot.online { background: var(--accent); box-shadow: 0 0 10px rgb(200 255 90 / 48%); }
.network-source-facts { display: grid; grid-template-columns: repeat(3, minmax(62px, 1fr)); gap: 13px; }

.activity-drawer { border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); }
.activity-drawer > summary { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; list-style: none; }
.activity-drawer > summary::-webkit-details-marker { display: none; }
.activity-drawer > summary strong, .activity-drawer > summary small { display: block; }
.activity-drawer > summary strong { font-size: 12px; }
.activity-drawer > summary small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.drawer-action { color: var(--accent); font-size: 10px; font-weight: 750; }
.drawer-action::after { content: "+"; margin-left: 10px; font-size: 16px; }
.activity-drawer[open] .drawer-action::after { content: "−"; }
.activity-drawer-content { padding: 18px; border-top: 1px solid var(--line); }

.source-row { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }

.source-list { display: grid; gap: 8px; }
.source-row { padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.source-copy { min-width: 0; }
.source-meta { margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 7px 13px; color: var(--muted); font-size: 10px; }
.source-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.tag { color: var(--warning); }
.tag.pinned { color: var(--accent); }
.empty-state { padding: 44px 18px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 13px; }
.empty-icon { display: block; margin-bottom: 9px; color: var(--accent); font-size: 24px; }
.empty-state p { margin-bottom: 0; font-size: 12px; }

@media (max-width: 1080px) {
  .dashboard-shell { grid-template-columns: 200px minmax(0, 1fr); gap: 26px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .activity-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-form { grid-template-columns: 1fr 1fr; }
  .network-source-row { grid-template-columns: minmax(180px, 1fr) minmax(220px, auto); }
  .network-source-row > .state-chip { grid-column: 2; justify-self: end; }
}

@media (max-width: 780px) {
  #app-main { width: min(100% - 24px, 1460px); padding-top: 16px; }
  .login-panel { grid-template-columns: 1fr; align-content: center; gap: 30px; }
  .dashboard-shell { display: block; }
  .sidebar { min-height: 0; margin-bottom: 26px; padding: 7px; display: block; overflow-x: auto; position: sticky; top: 72px; z-index: 10; border-radius: 14px; box-shadow: 0 10px 28px rgb(0 0 0 / 28%); }
  .sidebar-nav { display: flex; gap: 5px; }
  .nav-label, .account-card { display: none; }
  .nav-item { min-width: max-content; padding: 9px 12px; display: flex; }
  .nav-item small, .nav-icon { display: none; }
  .workspace-header { min-height: 0; margin: 0 0 24px; align-items: start; }
  .updated-at { margin-top: 6px; }
  .sync-card { grid-template-columns: auto minmax(0, 1fr); }
  .sync-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .provider-status-card { grid-template-columns: 1fr; }
  .provider-facts { padding-top: 16px; border-top: 1px solid var(--line); }
  .import-grid { grid-template-columns: 1fr; }
  .source-row { grid-template-columns: 1fr; }
  .source-actions { justify-content: flex-start; }
  .search-form { grid-template-columns: minmax(0, 1fr) 110px; }
  .search-form .button.primary { grid-column: 1 / -1; width: 100%; }
  .search-peer-facts { min-width: 0; }
  .album-preview-heading { align-items: stretch; flex-direction: column; }
  .album-preview-heading .button { width: 100%; }
  .search-match-list li { align-items: stretch; flex-direction: column; }
  .search-match-list .button { width: 100%; }
  .activity-download-metrics { grid-template-columns: 1fr 1fr; }
  .network-stats { grid-template-columns: 1fr 1fr; }
  .network-stats > span:nth-child(2) { border-right: 0; }
  .network-stats > span:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .network-source-row { grid-template-columns: minmax(0, 1fr) auto; }
  .network-source-facts { grid-column: 1 / -1; padding-left: 18px; }
}

@media (max-width: 520px) {
  .topbar { padding: 0 12px; }
  .brand > span:last-child, .connection-state { display: none; }
  .workspace-header { display: block; }
  .updated-at { margin: 12px 0 0; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 108px; padding: 15px; }
  .metric-value { font-size: 25px; }
  .activity-stat { min-height: 102px; padding: 14px; }
  .activity-stat > strong { font-size: 27px; }
  .panel { padding: 18px 14px; }
  .section-heading { align-items: start; }
  .activity-panel .section-heading { flex-direction: column; }
  .activity-panel .section-heading .pill { align-self: flex-start; }
  .sync-card { padding: 16px 14px; }
  .sync-icon { width: 38px; height: 38px; font-size: 20px; }
  .sync-actions { justify-content: space-between; }
  .user-form { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 1fr; }
  .settings-submit { display: grid; }
  .settings-submit .button.primary { width: 100%; }
  .provider-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .search-form { grid-template-columns: 1fr; }
  .search-form .button.primary { grid-column: auto; }
  .search-peer-facts { grid-template-columns: 1fr 1fr 1fr; }
  .create-user-panel summary small { display: none; }
  .activity-download { padding: 14px; }
  .activity-download-heading { grid-template-columns: auto minmax(0, 1fr); }
  .activity-download-heading > .state-chip { grid-column: 2; justify-self: start; }
  .activity-download-copy p { white-space: normal; }
  .activity-history-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .activity-history-row .download-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .network-source-row { grid-template-columns: 1fr; }
  .network-source-row > .state-chip { grid-column: auto; justify-self: start; margin-left: 18px; }
  .network-source-facts { grid-column: auto; padding-left: 18px; }
  .activity-drawer > summary small { max-width: 230px; }
}
