:root {
  --bg: #dfe3ea;
  --paper: #f7f8fb;
  --paper-soft: #eef2f6;
  --line: #bfc7d3;
  --line-strong: #8e9db1;
  --text: #151b24;
  --muted: #55657b;
  --navy: #24415f;
  --navy-strong: #17304d;
  --blue: #2f5f94;
  --green: #33684f;
  --red: #8c4545;
  --gold: #d7dbe5;
  --shadow: rgba(33, 47, 66, 0.04);
}

html {
  background: #cfd6df;
}

body {
  margin: 0;
  color: var(--text);
  font: 12px/1.28 Tahoma, Verdana, sans-serif;
  background:
    repeating-linear-gradient(0deg,
      rgba(65, 81, 104, 0.04),
      rgba(65, 81, 104, 0.04) 1px,
      transparent 1px,
      transparent 19px),
    var(--bg);
}

body.auth-open {
  overflow: hidden;
}

a {
  color: #2c5e95;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  display: block;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-shell {
  width: calc(100vw - 8px);
  margin: 4px;
  border: 1px solid #6f8097;
  background: var(--paper);
  box-shadow: none;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
  border-bottom: 1px solid #6f8097;
  background:
    linear-gradient(rgba(233, 242, 245, 0.84), rgba(219, 233, 239, 0.84)),
    url("/static/header-blossom.jpg") center 32% / cover no-repeat;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ascii-mark {
  margin: 0;
  color: var(--navy-strong);
  font: 11px/1 "Courier New", monospace;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-icon {
  width: 34px;
  height: 34px;
  border: 1px solid #7388a2;
  background: rgba(249, 251, 254, 0.88);
  object-fit: cover;
  object-position: center;
}

.brand-mark {
  font: 700 16px/1 Tahoma, Verdana, sans-serif;
  letter-spacing: 1px;
  color: var(--navy-strong);
}

.brand-sub {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-size: 10px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-items: end;
}

.top-nav,
.utility-row,
.lang-switch,
.account-pill,
.filter-actions,
.guest-popup-actions,
.auth-tabs {
  display: flex;
  align-items: center;
}

.top-nav {
  flex-wrap: wrap;
  justify-content: end;
  gap: 4px;
}

.top-nav a,
.nav-button,
.lang-switch a,
.ghost-button,
.download-link {
  border: 1px solid #8fa0b5;
  background: linear-gradient(180deg, #fbfcfe, #dde5ef);
  box-shadow: none;
}

.top-nav a {
  padding: 2px 6px;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
}

.nav-button {
  padding: 2px 6px;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
}

.utility-row {
  gap: 6px;
}

.lang-switch {
  gap: 3px;
}

.lang-switch a {
  padding: 2px 5px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.4px;
}

.lang-switch a.active {
  color: var(--navy-strong);
  border-color: var(--blue);
}

.account-pill {
  gap: 6px;
  padding: 2px 6px;
  border: 1px solid #8fa0b5;
  background: #eef3f8;
  color: var(--muted);
}

.account-pill em {
  padding: 2px 6px;
  border: 1px solid #b9cbe2;
  background: #edf4fb;
  color: var(--blue);
  font-style: normal;
  text-transform: uppercase;
  font-size: 10px;
}

.ghost-button,
.mini-button,
.mini-link {
  padding: 2px 6px;
  color: var(--navy);
  background: transparent;
  border: 1px solid var(--line);
}

.mini-link {
  padding: 1px 5px;
}

.danger-button {
  background: var(--red);
  color: white;
  border: none;
}

.danger-button:hover:not(:disabled) {
  background: #6b343e;
}

.danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0;
  margin-bottom: 8px;
}

#bulk-delete-btn {
  margin-left: auto;
}

.ghost-button {
  margin: 0;
}

.signal-strip {
  padding: 3px 8px;
  border-bottom: 1px solid #a1adbd;
  background: #edf1f6;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 10px;
}

.tech-strip {
  padding: 2px 8px;
  border-bottom: 1px solid #b7c1cf;
  background: #f7f9fc;
  color: #4c6078;
  font: 11px/1.15 "Courier New", monospace;
}

.guest-popup {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  width: min(320px, calc(100vw - 36px));
  padding: 8px;
  border: 1px solid #8fa0b5;
  background: #f8fbff;
  box-shadow: 2px 2px 0 rgba(44, 68, 96, 0.14);
}

.upload-progress {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 32;
  width: min(320px, calc(100vw - 36px));
  display: none;
  padding: 8px;
  border: 1px solid #8fa0b5;
  background: #f8fbff;
  box-shadow: 2px 2px 0 rgba(44, 68, 96, 0.14);
}

.upload-progress.is-visible {
  display: block;
}

.upload-progress-title,
.upload-progress-percent {
  color: var(--navy-strong);
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
}

.upload-progress-text {
  margin-top: 4px;
  color: var(--muted);
}

.upload-progress-bar {
  height: 10px;
  margin-top: 6px;
  border: 1px solid #9dafc2;
  background: #edf2f8;
}

.upload-progress-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(180deg, #7ac08e, #49865e);
}

.upload-progress-percent {
  margin-top: 5px;
  text-align: right;
}

.guest-popup-title,
.panel-title,
.subline,
.upload-note,
.empty-row,
.panel-note {
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 10px;
}

.guest-popup-title {
  margin-bottom: 4px;
  color: var(--navy-strong);
}

.guest-popup-actions {
  gap: 8px;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(35, 51, 72, 0.18);
  z-index: 30;
}

.auth-overlay.is-visible {
  display: flex;
}

.quickfind-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: start;
  justify-content: center;
  padding: 24px 10px 10px;
  background: rgba(35, 51, 72, 0.16);
  z-index: 29;
}

.quickfind-overlay.is-visible {
  display: flex;
}

.spectrum-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: start;
  justify-content: center;
  padding: 18px 10px 10px;
  background: rgba(35, 51, 72, 0.28);
  z-index: 31;
}

.spectrum-overlay.is-visible {
  display: flex;
}

.player-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(35, 51, 72, 0.24);
  z-index: 32;
}

.player-overlay.is-visible {
  display: flex;
}

.quickfind-card {
  width: min(860px, 100%);
  border: 1px solid #7f91a7;
  background: #f9fbfe;
  box-shadow: 3px 3px 0 rgba(38, 58, 82, 0.16);
  padding: 8px;
}

.spectrum-card {
  width: min(1280px, 100%);
  border: 1px solid #7f91a7;
  background: #f9fbfe;
  box-shadow: 3px 3px 0 rgba(38, 58, 82, 0.16);
  padding: 8px;
}

.player-card {
  width: min(520px, 100%);
  border: 1px solid #7f91a7;
  background: #f9fbfe;
  box-shadow: 3px 3px 0 rgba(38, 58, 82, 0.16);
  padding: 8px;
}

.spectrum-meta {
  margin-bottom: 6px;
  color: var(--muted);
  font: 11px/1.2 "Courier New", monospace;
}

.player-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font: 11px/1.2 "Courier New", monospace;
}

.player-card audio {
  width: 100%;
}

.spectrum-status {
  min-height: 16px;
  margin-bottom: 6px;
  color: var(--navy);
  font-size: 11px;
}

.spectrum-status.is-error {
  color: var(--red);
}

.spectrum-frame {
  border: 1px solid #a2afbf;
  background: #edf2f8;
  overflow: auto;
  min-height: 120px;
}

.spectrum-frame img {
  width: 100%;
  height: auto;
}

.quickfind-note {
  display: none;
}

.quickfind-grid,
.quick-links-grid {
  display: grid;
  gap: 6px;
}

.quickfind-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 6px;
}

.quickfind-form,
.quick-links-panel {
  border: 1px solid #a2afbf;
  background: #f7f9fc;
  padding: 5px;
}

.quickfind-form {
  display: grid;
  gap: 4px;
}

.quickfind-form label {
  display: grid;
  gap: 2px;
}

.quickfind-form input {
  padding: 2px 4px;
  border: 1px solid #97a6b8;
  background: #fff;
}

.quick-links-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.scroll-pane {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.scroll-pane-short {
  max-height: 240px;
}

.scroll-pane-side {
  max-height: 290px;
}

.auth-card {
  width: min(360px, 100%);
  padding: 8px;
  border: 1px solid #7f91a7;
  background: #f9fbfe;
  box-shadow: 3px 3px 0 rgba(38, 58, 82, 0.16);
}

.auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--navy-strong);
}

.auth-tabs {
  gap: 4px;
  margin-bottom: 8px;
}

.auth-tab {
  flex: 1;
  padding: 3px 6px;
  border: 1px solid var(--line);
  background: #f6f8fb;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.8px;
}

.auth-tab.is-active {
  border-color: var(--blue);
  background: #edf4fb;
  color: var(--navy-strong);
}

.auth-form {
  display: none;
  gap: 10px;
}

.auth-form.is-active {
  display: grid;
}

.dashboard {
  padding: 6px;
  border-bottom: 1px solid #a8b3c1;
  background: #eef2f7;
}

.stats-strip,
.upload-grid,
.filter-grid,
.content-grid {
  display: grid;
  gap: 6px;
}

.stats-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 6px;
  border: 1px solid #a2afbf;
  background: #f9fbfd;
}

.stats-strip span {
  padding: 3px 6px;
  border-left: 1px solid #c2cad5;
  white-space: nowrap;
}

.stats-strip span:first-child {
  border-left: 0;
}

.stats-strip strong {
  color: var(--navy-strong);
}

.upload-panel,
.filter-panel,
.side-panel,
.table-wrap,
.notice-box,
.result-box {
  border: 1px solid #a2afbf;
  background: var(--paper);
}

.stat-label,
.panel-note,
.subline,
.upload-note,
.empty-row {
  color: var(--muted);
}

.upload-panel,
.filter-panel {
  padding: 6px;
  margin-bottom: 6px;
  background: #f7f9fc;
}

.panel-topline {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
  margin-bottom: 4px;
}

.panel-title {
  color: var(--navy-strong);
}

.panel-note {
  display: none;
}

.upload-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.upload-grid label,
.filter-grid label,
.auth-form label {
  display: grid;
  gap: 2px;
}

.upload-grid input[type="text"],
.filter-grid input,
.filter-grid select,
.auth-form input {
  padding: 2px 4px;
  border: 1px solid #97a6b8;
  background: #ffffff;
  color: var(--text);
}

.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 4px;
  padding-top: 14px;
}

.upload-note {
  margin-top: 0;
}

.input-hint {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}

button {
  margin-top: 0;
  padding: 2px 6px;
  border: 1px solid #8c9db2;
  background: linear-gradient(180deg, #fbfcfe, #dde5ef);
  color: var(--navy-strong);
  font-weight: 700;
  text-transform: uppercase;
}

button:disabled,
input:disabled,
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.table-toolbar,
.pager-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.table-toolbar {
  padding: 4px 5px;
  border-bottom: 1px solid #c8d0dc;
  background: #f4f7fb;
  justify-content: flex-start;
  align-self: start;
  min-height: 34px;
}

.selection-tools {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.selection-tools .mini-button {
  min-width: 108px;
  background: linear-gradient(180deg, #fbfcfe, #e5ebf3);
  border-color: #99a8bc;
  color: var(--navy-strong);
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease, opacity 120ms ease;
}

.selection-tools .mini-button:disabled {
  opacity: 0.65;
}

.selection-tools .mini-button.is-ready {
  background: linear-gradient(180deg, #fdfef8, #dfead0);
  border-color: #6f8f46;
  color: #314d11;
  box-shadow: inset 0 0 0 1px #eef5dd, 0 0 0 1px rgba(111, 143, 70, 0.18);
}

.selection-tools .danger-button,
.selection-tools .danger-button.is-ready {
  background: var(--red);
  border-color: #6b343e;
  color: #fff;
  box-shadow: none;
}

.toolbar-quickfind {
  margin-left: auto;
}

.select-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.admin-dashboard {
  display: grid;
  gap: 8px;
}

.admin-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.admin-tab {
  display: inline-block;
  padding: 3px 8px;
  border: 1px solid #9eabbb;
  background: linear-gradient(180deg, #fafcff, #e2e9f1);
  color: var(--navy-strong);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.2px;
}

.admin-tab.is-active {
  background: linear-gradient(180deg, #fffef8, #e6edd7);
  border-color: #748d49;
  color: #35500f;
}

.admin-block {
  border: 1px solid #a2afbf;
  background: #f7f9fc;
  padding: 6px;
}

.admin-table-scroll {
  max-height: 68vh;
}

.admin-filter-panel {
  margin-top: 4px;
  margin-bottom: 6px;
}

.admin-filter-grid {
  grid-template-columns: 1.3fr 160px 160px 180px;
}

.admin-track-filter-grid {
  grid-template-columns: 1.5fr 1fr;
}

.admin-table {
  margin-top: 4px;
}

.inline-form {
  display: inline;
}

.admin-action-stack {
  display: grid;
  gap: 4px;
}

.inline-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 4px;
  border: 1px solid #8fa0b5;
  background: #e8eef6;
  color: var(--navy-strong);
  font-size: 10px;
  text-transform: uppercase;
}

.agent-cell {
  max-width: 280px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.notice-box,
.result-box {
  padding: 4px 6px;
  margin-bottom: 6px;
}

.notice-box {
  background: #eef4fb;
}

.result-box.ok {
  background: #eff8f2;
}

.result-box.bad {
  background: #fbefef;
}

.filter-grid {
  grid-template-columns: 2fr 1fr 1fr 1fr 140px;
}

.filter-actions {
  gap: 6px;
  margin-top: 4px;
}

.content-grid {
  grid-template-columns: 245px minmax(0, 1fr);
  padding: 6px;
}

.sidebar {
  display: grid;
  gap: 10px;
  align-content: start;
}

.side-panel {
  padding: 5px 6px;
  background: #f9fbfd;
}

.side-note {
  color: var(--muted);
  font: 11px/1.2 "Courier New", monospace;
}

.side-link,
.album-link {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  border-top: 1px dotted var(--line);
}

.side-link:first-of-type,
.album-link:first-of-type {
  border-top: 0;
}

.side-link span {
  color: var(--muted);
}

.album-link {
  align-items: center;
  justify-content: start;
}

.album-link img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
}

.album-link span {
  display: grid;
}

.album-link em {
  color: var(--muted);
  font-style: normal;
  font-size: 11px;
}

.table-wrap {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  overflow: hidden;
}

.table-scroll {
  min-height: 0;
  max-height: min(72vh, 980px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.scroll-hint {
  padding: 5px 6px;
  border-top: 1px solid #cfd6e0;
  background: #eef3f8;
  color: var(--muted);
  text-align: right;
  font-size: 10px;
}

.library-table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  table-layout: fixed;
}

.track-main {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.library-table thead th {
  position: sticky;
  top: 0;
  padding: 4px 5px;
  border-bottom: 1px solid #7f91a7;
  background: #dfe6ef;
  text-align: left;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.4px;
  color: var(--navy);
}

.library-table tbody td {
  padding: 3px 5px;
  border-top: 1px solid #d7dfea;
  vertical-align: top;
}

.library-table tbody tr:nth-child(even) {
  background: #f7f9fc;
}

.library-table tbody tr:hover {
  background: #edf3fa;
}

.cover-cell {
  width: 34px;
}

.select-col {
  width: 28px;
  text-align: center;
}

.cover-cell img {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
}

.subline {
  display: block;
  margin-top: 1px;
}

.uploader-credit-cell {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.download-link {
  display: inline-block;
  padding: 1px 5px;
  color: var(--navy-strong);
}

.track-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.spectrum-button {
  border: 1px solid #8fa0b5;
  background: linear-gradient(180deg, #fbfcfe, #dde5ef);
  text-transform: uppercase;
}

.preview-button {
  border: 1px solid #8fa0b5;
  background: linear-gradient(180deg, #fbfcfe, #dde5ef);
  text-transform: uppercase;
}

.download-link.is-locked {
  position: relative;
}

.download-link.is-locked::after {
  content: "lock";
  margin-left: 6px;
  color: var(--red);
  font-size: 10px;
  text-transform: uppercase;
}

.empty-row {
  text-align: center;
  padding: 28px 12px !important;
}

@media (max-width: 1080px) {

  .panel-topline,
  .utility-row {
    flex-direction: column;
    align-items: start;
  }

  .admin-filter-grid,
  .admin-track-filter-grid {
    grid-template-columns: 1fr;
  }

  .admin-table-scroll {
    max-height: none;
  }
}

@media (max-width: 960px) {

  .masthead,
  .stats-strip,
  .upload-grid,
  .filter-grid,
  .content-grid,
  .quickfind-grid,
  .quick-links-grid {
    grid-template-columns: 1fr;
  }

  .masthead {
    display: grid;
  }

  .topbar-tools {
    justify-items: start;
    display: grid;
  }

  .top-nav {
    justify-content: start;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .spectrum-card {
    width: 100%;
  }

  .player-card {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .site-shell {
    width: 100vw;
    margin: 0;
    border-left: 0;
    border-right: 0;
  }

  .brand-lockup,
  .utility-row {
    flex-wrap: wrap;
  }

  .ascii-mark,
  .brand-sub,
  .tech-strip,
  .subline {
    display: none;
  }

  .content-grid {
    padding: 4px;
  }

  .dashboard {
    padding: 4px;
  }

  .library-table th:nth-child(5),
  .library-table td:nth-child(5),
  .library-table th:nth-child(6),
  .library-table td:nth-child(6),
  .library-table th:nth-child(8),
  .library-table td:nth-child(8),
  .library-table th:nth-child(9),
  .library-table td:nth-child(9),
  .library-table th:nth-child(10),
  .library-table td:nth-child(10) {
    display: none;
  }

  .library-table {
    table-layout: auto;
  }

  .library-table th,
  .library-table td {
    font-size: 11px;
  }

  .cover-cell {
    width: 28px;
  }

  .top-nav {
    row-gap: 3px;
  }

  .scroll-pane-short,
  .scroll-pane-side,
  .table-scroll {
    max-height: none;
  }
}
