/* BXM Portal — design system
   Palette: cool paper background, petrol teal accent (interactive),
   amber reserved only for ownership-share emphasis (functional, not decorative).
   Type: Fraunces for headings, Inter for UI/body, IBM Plex Mono for data
   (IDs, percentages, catalog numbers) — monospace used because this content
   is literally tabular data, not for stylistic effect. */

:root {
  --paper: #EDF1F0;
  --panel: #FFFFFF;
  --ink: #1A2421;
  --ink-muted: #5B6663;
  --hairline: #D7DEDC;
  --teal: #14615A;
  --teal-dark: #0E4A45;
  --teal-tint: #E4EEEC;
  --amber: #B5791F;
  --danger: #A5301F;
  --danger-tint: #F7E9E7;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

h1, h2, h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

a { color: var(--teal); }

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--hairline);
  background: var(--panel);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.topnav {
  display: flex;
  gap: 18px;
}

.topnav a {
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.topnav a:hover, .topnav a.active {
  color: var(--teal);
}

.topbar .brand {
  font-size: 1.15rem;
}

.topbar .brand .tag {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-left: 10px;
}

.topbar .account {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.topbar .account a {
  color: var(--ink-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
}

.topbar .account a:hover { color: var(--teal); border-color: var(--teal); }

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: calc(100vh - 61px);
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
}

.sidebar {
  border-right: 1px solid var(--hairline);
  padding: 24px;
  background: var(--panel);
}

.main {
  padding: 28px 36px;
}

/* ---------- Search ---------- */

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--panel);
  color: var(--ink);
}

input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}

.btn {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  background: var(--teal);
  color: #fff;
  font-size: 0.92rem;
  font-family: inherit;
  cursor: pointer;
}

.btn:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn-secondary {
  background: transparent;
  color: var(--teal);
}
.btn-secondary:hover { background: var(--teal-tint); }

/* ---------- Results list ---------- */

.track-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.track-item {
  padding: 10px 4px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}

.track-item:hover .track-title { color: var(--teal); }

.track-title { font-weight: 600; }
.track-meta { color: var(--ink-muted); font-size: 0.87rem; margin-top: 1px; }

.sync-panel {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.sync-panel .btn { width: 100%; margin-bottom: 8px; }

/* ---------- Detail panel ---------- */

.detail-header {
  margin-bottom: 4px;
}

.detail-meta {
  color: var(--ink-muted);
  margin-top: 4px;
}

.section-label {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-muted);
  margin: 28px 0 10px;
}

.ledger {
  border-top: 1px solid var(--hairline);
}

.ledger-group {
  border-bottom: 1px solid var(--hairline);
  padding: 14px 0;
}

.ledger-group h3 {
  font-size: 0.95rem;
  margin-bottom: 8px;
}

table.fields {
  width: 100%;
  border-collapse: collapse;
}

table.fields td {
  padding: 3px 0;
  font-size: 0.9rem;
  vertical-align: top;
}

table.fields td.field-name {
  color: var(--ink-muted);
  width: 45%;
  padding-right: 12px;
}

table.fields td.field-value {
  font-weight: 500;
}

/* Ownership/share percentages get the amber accent — functional emphasis only */
td.field-value.share {
  color: var(--amber);
  font-weight: 600;
}

/* ---------- States ---------- */

.status { color: var(--ink-muted); font-style: italic; }
.error-text { color: var(--danger); }

.empty-state {
  padding: 40px 0;
  color: var(--ink-muted);
}

.alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  margin-bottom: 14px;
}

.alert-error {
  background: var(--danger-tint);
  color: var(--danger);
  border: 1px solid #E3C4BE;
}

/* ---------- Data tables (import history, review lines, statements) ---------- */

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 28px;
}

table.data-table th {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 8px 10px;
  border-bottom: 1px solid var(--hairline);
}

table.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.9rem;
  vertical-align: top;
}

table.data-table tbody tr:hover { background: var(--teal-tint); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-auto { background: var(--teal-tint); color: var(--teal-dark); }
.badge-manual { background: #EAF0E8; color: #3D6B33; }
.badge-unmatched { background: var(--danger-tint); color: var(--danger); }
.badge-skipped { background: #ECECEC; color: var(--ink-muted); }

.upload-card {
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 480px;
  margin-bottom: 28px;
}

.match-resolver {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.match-resolver input[type="text"] { max-width: 260px; }

.candidate-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  max-width: 420px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  max-height: 180px;
  overflow-y: auto;
}
.candidate-list li {
  padding: 6px 10px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  font-size: 0.88rem;
}
.candidate-list li:last-child { border-bottom: none; }
.candidate-list li:hover { background: var(--teal-tint); }

.composer-card { padding: 0; overflow: hidden; border: 1px solid var(--hairline); border-radius: var(--radius); margin-bottom: 12px; }
.composer-card .composer-detail-wrap { padding: 0 20px 18px; }

.composer-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
}
.composer-summary:hover { background: var(--teal-tint); }

.composer-chevron {
  display: inline-block;
  transition: transform 0.15s ease;
  color: var(--teal);
  font-size: 2.4rem;
  font-weight: 700;
  width: 28px;
  text-align: center;
  line-height: 1;
}
.composer-card.expanded .composer-chevron { transform: rotate(90deg); }

.composer-summary .composer-name { font-weight: 600; flex: 1; }
.composer-summary .composer-meta { color: var(--ink-muted); font-size: 0.85rem; }

.composer-total {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  color: var(--amber);
  font-size: 1.05rem;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  color: var(--teal);
  text-decoration: none;
  font-size: 1rem;
}
.btn-icon:hover { background: var(--teal-tint); }

.composer-card .composer-detail-wrap { display: none; }
.composer-card.expanded .composer-detail-wrap { display: block; }

.month-picker {
  display: flex;
  gap: 8px;
  align-items: end;
  margin-bottom: 20px;
}
.month-picker .field { margin-bottom: 0; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 32px 28px;
}

.login-card h1 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.login-card .subtitle {
  color: var(--ink-muted);
  font-size: 0.88rem;
  margin-bottom: 22px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: 5px;
}

.login-card .btn { width: 100%; margin-top: 6px; }


/* ---------- Tool switcher (logos, home, SyncX) ---------- */

.topbar { flex-wrap: wrap; gap: 12px 24px; }
.topbar-left { flex-wrap: wrap; gap: 14px 22px; }

.topbar .brand-logo { display: flex; align-items: center; }
.topbar .brand-logo img { height: 28px; width: auto; display: block; }

.topbar .section-logo { display: flex; align-items: center; }
.topbar .section-logo img { height: 22px; width: auto; display: block; }

.topbar-sep { width: 1px; height: 22px; background: var(--hairline); }

.topbar .account a.switch-tool {
  color: var(--teal);
  border-bottom-color: transparent;
  font-weight: 500;
}
.topbar .account a.switch-tool:hover { border-bottom-color: var(--teal); }

.login-logo { display: block; width: 210px; max-width: 100%; height: auto; margin: 0 0 18px; }

/* Home: choose a tool */
.home { max-width: 860px; margin: 0 auto; padding: 56px 28px 72px; }
.home-title { font-family: 'Fraunces', serif; font-weight: 600; font-size: 2rem; margin: 0 0 6px; color: var(--ink); }
.home-sub { margin: 0 0 32px; color: var(--ink-muted); font-size: 0.95rem; }

.tool-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 30px 28px 24px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.tool-card:hover, .tool-card:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 6px 22px rgba(20, 97, 90, 0.12);
  transform: translateY(-2px);
  outline: none;
}
.tool-logo { height: 34px; width: auto; align-self: flex-start; }
.tool-desc { margin: 0; flex: 1; color: var(--ink-muted); font-size: 0.93rem; line-height: 1.5; }
.tool-go { color: var(--teal); font-weight: 600; font-size: 0.9rem; }

/* SyncX overview cards */
.module-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 22px; }
.module-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
}
a.module-card:hover { border-color: var(--teal); }
.module-card p { margin: 0 0 8px; flex: 1; color: var(--ink-muted); font-size: 0.9rem; line-height: 1.45; }
.module-title { font-weight: 600; font-size: 1.02rem; }
.module-card-soon { background: transparent; border-style: dashed; }
.module-card-soon .module-title { color: var(--ink-muted); }
.module-tag {
  align-self: flex-start;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.module-tag-live { color: var(--teal); }

@media (max-width: 720px) {
  .tool-grid, .module-grid { grid-template-columns: 1fr; }
  .home { padding: 36px 18px 56px; }
  .topbar { padding: 14px 18px; }
}


/* ---------- SyncX: projects, quotes, forms ---------- */

input[type="date"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--panel);
  color: var(--ink);
}
input[type="date"]:focus, select:focus, textarea:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
  border-color: var(--teal);
}
input:disabled { background: var(--paper); color: var(--ink-muted); }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head h2, .page-head h3 { margin: 0; }
.crumbs { margin: 0 0 10px; font-size: 0.88rem; }
.crumbs a { color: var(--ink-muted); text-decoration: none; }
.crumbs a:hover { color: var(--teal); }
.alert-ok { background: #E4EEEC; color: #0E4A45; }
.empty-state { padding: 36px 20px; text-align: center; border: 1px dashed var(--hairline); border-radius: var(--radius); color: var(--ink-muted); }
.empty-state p { margin: 0 0 14px; }
[hidden] { display: none !important; }

/* Tile grid */
.grid-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 20px; }
.grid-controls input[type="text"] { flex: 1 1 220px; max-width: 360px; }
.grid-controls label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--ink-muted); }
.grid-controls select { width: auto; }

.poster-grid { --tile-w: 220px; display: grid; grid-template-columns: repeat(auto-fill, var(--tile-w)); gap: 40px; justify-content: start; }
.poster-tile { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; min-width: 0; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; transition: box-shadow 0.15s, transform 0.15s; }
.poster-frame { display: block; aspect-ratio: 2 / 3; background: var(--paper); overflow: hidden; }
.poster-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.poster-tile:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16); transform: translateY(-2px); }
.poster-tile:focus-visible { outline: 2px solid var(--teal); outline-offset: 4px; }
.poster-info { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px 11px; }
.poster-name { font-weight: 700; font-size: 0.9rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster-meta { font-size: 0.8rem; color: var(--ink-muted); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.35em; }
.poster-date { display: flex; justify-content: space-between; gap: 8px; }
.poster-tile-done { opacity: 0.6; }

/* Project page */
.project-head { display: grid; grid-template-columns: 200px 1fr; gap: 8px 28px; align-items: start; margin-bottom: 26px; }
.project-poster { width: 200px; aspect-ratio: 2 / 3; object-fit: cover; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--paper); }
.project-info h2 { margin: 0 0 4px; }
.term-list { margin: 12px 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 20px; }
.term-list div { min-width: 0; }
.term-list dt { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.term-list dd { margin: 2px 0 0; font-size: 0.95rem; }
.totals { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; }
.total-box { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); }
.total-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-muted); }
.total-value { font-size: 1.35rem; font-weight: 600; }
.total-sub { font-size: 0.82rem; color: var(--ink-muted); }

.table-wrap { overflow-x: auto; }
.quote-table td, .quote-table th { vertical-align: top; }
.quote-table .num, .data-table .num { text-align: right; white-space: nowrap; }
.row-actions { white-space: nowrap; }
.row-actions a { margin-right: 10px; }
.inline-form { display: inline; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.pill-open { background: #F3EBD3; color: #6B5413; }
.pill-licensed { background: #E4EEEC; color: #0E4A45; }
.link-danger, .link-plain { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.link-danger { color: var(--danger); }
.link-plain { color: var(--teal); }
.danger-zone { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--hairline); }

/* Forms */
.form-card { padding: 22px 24px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.radio, .check { display: block; margin: 4px 0; font-size: 0.95rem; cursor: pointer; color: var(--ink); }
.radio input, .check input { width: auto; margin-right: 6px; }
.field .radio { display: inline-block; margin-right: 18px; color: var(--ink); }
.legacy-id { margin: 6px 0 0; }
.legacy-id summary { cursor: pointer; font-size: 0.88rem; color: var(--ink-muted); margin-bottom: 10px; }

.typeahead { position: relative; }
.typeahead-list, .tmdb-results { list-style: none; margin: 0; padding: 0; }
.typeahead-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; max-height: 300px; overflow-y: auto; background: var(--panel); border: 1px solid var(--teal); border-top: 0; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12); }
.typeahead-list li { padding: 8px 12px; cursor: pointer; display: flex; flex-direction: column; border-bottom: 1px solid var(--hairline); }
.typeahead-list li span { font-size: 0.82rem; color: var(--ink-muted); }
.typeahead-list li[data-id]:hover { background: var(--teal-tint); }
.typeahead-empty { color: var(--ink-muted); font-style: italic; cursor: default !important; }

.poster-fieldset { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 12px 16px 16px; margin: 4px 0 0; }
.poster-fieldset legend { padding: 0 6px; font-size: 0.85rem; color: var(--ink-muted); }
.poster-pick-row { display: flex; gap: 20px; align-items: flex-start; }
.poster-preview { width: 110px; aspect-ratio: 2 / 3; object-fit: cover; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--paper); flex: none; }
.poster-choices { flex: 1; min-width: 0; }
.tmdb-results { margin-top: 8px; max-height: 280px; overflow-y: auto; }
.tmdb-results li { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border: 1px solid var(--hairline); border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; font-size: 0.9rem; }
.tmdb-results li[data-i]:hover { background: var(--teal-tint); }
.tmdb-results li.picked { border-color: var(--teal); background: var(--teal-tint); }
.tmdb-results img, .no-thumb { width: 36px; height: 54px; object-fit: cover; flex: none; background: var(--paper); border-radius: 2px; }

/* Lists page */
.settings-sections { display: flex; flex-direction: column; gap: 12px; }
.list-card { padding: 4px 18px; }
.list-card[open] { padding-bottom: 16px; }
.list-card-head { cursor: pointer; padding: 12px 0; display: flex; align-items: baseline; gap: 12px; font-size: 1.02rem; }
.list-card[open] > .list-card-head { margin-bottom: 4px; border-bottom: 1px solid var(--hairline); }
.lookup-use { white-space: nowrap; min-width: 120px; text-align: right; }
.lookup-rename input[type="text"] { flex: 1; min-width: 0; }
.lookup-list { list-style: none; margin: 0 0 12px; padding: 0; }
.lookup-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--hairline); }
.lookup-list li.retired input[type="text"] { color: var(--ink-muted); font-style: italic; }
.lookup-rename { display: flex; gap: 6px; flex: 1; min-width: 0; }
.lookup-add { display: flex; gap: 8px; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }

@media (max-width: 720px) {
  .project-head { grid-template-columns: 110px 1fr; gap: 8px 16px; }
  .project-poster { width: 110px; }
  .totals { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px; }
  .main { padding: 20px 16px; }
  .poster-pick-row { flex-direction: column; }
}
a.btn { text-decoration: none; }
.project-overview { margin: 10px 0 0; max-width: 70ch; font-size: 0.92rem; line-height: 1.55; color: var(--ink); }
.pick-album { color: var(--ink-muted); }

/* ---------- SyncX: album tiers ---------- */
.tier-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; margin: 14px 0 20px; font-size: 0.9rem; }
.tier-count { display: inline-flex; align-items: center; gap: 6px; }
.tier-count-needs { color: var(--danger); }
.tier-count-needs.is-zero { color: var(--ink-muted); }
.tier-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; border: 1px solid transparent; }
.tier-rhodium   { background: #E3EAF2; color: #2F4A66; border-color: #B9C8D9; }
.tier-platinum  { background: #E9EAEE; color: #3C4048; border-color: #C5C8D0; }
.tier-gold      { background: #F6EBC8; color: #6B4E06; border-color: #E2CD8A; }
.tier-palladium { background: #E1ECEA; color: #24504B; border-color: #B1CBC6; }
.tier-silver    { background: #EEF0F2; color: #4A5058; border-color: #CDD1D6; }
.tier-bronze    { background: #F2E1D2; color: #6E3F1B; border-color: #DDB894; }

.needs-panel { border: 1px solid var(--danger); border-left-width: 4px; border-radius: var(--radius); background: #FBF1EF; padding: 14px 18px 8px; }
.needs-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; color: var(--danger); margin-bottom: 8px; }
.needs-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow-y: auto; }
.needs-list li { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid rgba(181, 52, 36, 0.18); }
.needs-list .album-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 6px 0 10px; font-size: 0.88rem; }
.bulk-bar select { width: auto; }
.bulk-bar .check { margin: 0; }
.tier-select { width: auto; min-width: 150px; padding: 6px 10px; font-size: 0.9rem; }
.album-table .check-col { width: 34px; }
.tier-cell { white-space: nowrap; }
.btn-link { background: none; border: 0; padding: 0 2px; margin-left: 4px; color: var(--teal-dark, #14756d); font: inherit; font-size: 0.85rem; cursor: pointer; text-decoration: underline; }
.btn-link:hover { text-decoration: none; }
.tier-view[hidden], .tier-editor[hidden] { display: none; }
.save-note { font-size: 0.82rem; color: var(--teal); margin-left: 8px; }
.save-note.is-error { color: var(--danger); }
input.row-check, .bulk-bar input[type="checkbox"] { width: auto; }

@media (max-width: 720px) {
  .needs-list li { flex-wrap: wrap; }
  .needs-list .album-main { flex: 1 1 55%; }
}

.album-art { width: 44px; height: 44px; object-fit: cover; border-radius: 2px; border: 1px solid var(--hairline); background: var(--paper); flex: none; display: block; }
.album-art-none { background: var(--paper); }
.album-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.album-main .album-name { flex: none; }
.album-table .art-col { width: 56px; padding-right: 0; }
.album-title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.album-sub { display: block; font-size: 0.82rem; }
.album-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 0.8rem; color: var(--ink-muted); max-width: 52ch; margin-top: 2px; }
.nowrap { white-space: nowrap; }
.art-notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; background: #F3EBD3; color: #6B5413; margin: 14px 0 0; }

/* SyncX rate cards */
.add-rate, .vendor-panel { border: 1px solid var(--border, #d6dedc); border-radius: var(--radius); background: #fff; padding: 10px 16px; margin-bottom: 18px; }
.add-rate summary, .vendor-panel summary { cursor: pointer; font-weight: 600; }
.add-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 16px; margin-top: 14px; align-items: end; }
.add-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--ink-muted); }
.add-grid select, .add-grid input { width: 100%; }
.add-actions { display: flex; align-items: center; gap: 12px; }
.rate-table td { vertical-align: middle; }
.rate-table select { width: 100%; min-width: 110px; padding: 5px 8px; font-size: 0.88rem; }
.rate-table .rate-input { width: 100px; text-align: right; padding: 5px 8px; }
.rate-table tr.is-editing td { background: #F2F8F7; }
.rate-table tr.just-added td { background: #EEF6E8; }
.rate-err { color: var(--danger); margin-top: 4px; white-space: normal; }
.rate-filters { margin: 8px 0 14px; }
.rate-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 12px; }
.rate-toolbar input[type="search"] { flex: 1 1 320px; min-width: 0; }
.rate-toolbar .btn.is-on { background: var(--teal-tint); }
.filter-badge { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--teal-dark); color: #fff; font-size: 0.75rem; line-height: 18px; text-align: center; }
.rate-panel { border: 1px solid var(--border, #d6dedc); border-radius: var(--radius); background: #fff; padding: 4px 16px 16px; margin-bottom: 12px; }
.rate-panel[hidden] { display: none; }
.rate-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin: 4px 0 10px; }
.rate-meta .status { flex: 1 1 200px; }
.page-size { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--ink-muted); }
.page-size select { width: auto; padding: 5px 8px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pager button { min-width: 34px; padding: 5px 10px; border: 1px solid var(--hairline); border-radius: 6px; background: #fff; color: var(--ink); font: inherit; font-size: 0.85rem; cursor: pointer; }
.pager button:hover:not(:disabled) { background: var(--teal-tint); }
.pager button:disabled { opacity: 0.45; cursor: default; }
.pager button.is-current { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.pager-gap { padding: 0 4px; color: var(--ink-muted); }
.pager-bottom { justify-content: flex-end; margin: 14px 0 0; }
.vendor-list { list-style: none; margin: 10px 0; padding: 0; }
.vendor-list li { display: flex; align-items: center; gap: 14px; padding: 6px 0; border-top: 1px solid rgba(0, 0, 0, 0.07); }
.vendor-list .vendor-name { flex: 1; font-weight: 600; }
.btn-link:disabled { opacity: 0.4; cursor: default; text-decoration: none; }
.vendor-add { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 8px; }
.vendor-add input { max-width: 260px; }

/* Project form: company suggestions, project type */
.company-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 8px; }
.company-chips[hidden] { display: none; }
.chip { padding: 3px 12px; border: 1px solid var(--hairline); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 0.82rem; cursor: pointer; }
.chip:hover { background: var(--teal-tint); }
.pill-type { background: var(--teal-tint); color: var(--teal-dark); }

/* New project chooser */
.start-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 12px; }
.start-card { display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); color: var(--ink); text-decoration: none; }
.start-card strong { font-size: 1.1rem; }
.start-card span { font-size: 0.9rem; color: var(--ink-muted); line-height: 1.45; }
a.start-card:hover { border-color: var(--teal); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); }
.start-card-off { opacity: 0.6; }
.match-actions { display: flex; gap: 8px; margin: 10px 0; }
#projectForm[hidden], #searchPanel[hidden] { display: none; }
#projectForm { margin-top: 14px; }

/* Company typeahead */
.field:has(#company_name), .field:has(input[data-contact-picker]) { position: relative; }
.company-menu { position: absolute; z-index: 20; left: 0; right: 0; margin: 0; padding: 4px 0; list-style: none; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,0.12); max-height: 240px; overflow-y: auto; }
.company-menu[hidden] { display: none; }
.company-menu li { padding: 8px 12px; cursor: pointer; }
.company-menu li:hover, .company-menu li.active { background: var(--teal-soft, rgba(0,128,128,0.1)); }

.project-extras span + span::before { content: ' · '; }

/* Contacts sync icon */
.contacts-sync { background: none; border: 0; padding: 6px; border-radius: 50%; cursor: pointer; color: var(--ink-muted); display: inline-flex; align-items: center; }
.contacts-sync:hover { color: var(--teal); background: var(--teal-tint); }
.contacts-sync[data-state="off"] { opacity: 0.55; }
.contacts-sync.spinning svg { animation: contacts-spin 0.9s linear infinite; }
@keyframes contacts-spin { to { transform: rotate(360deg); } }
.contacts-msg { font-size: 0.85rem; color: var(--ink-muted); }
.contacts-msg.bad { color: #b3261e; }

/* Contacts sync dialog */
.sync-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(20, 24, 28, 0.55); padding: 16px; }
.sync-dialog { background: var(--panel); color: var(--ink); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); padding: 24px 28px; width: 100%; max-width: 420px; }
.sync-dialog h3 { margin: 0 0 12px; }
.sync-body { margin: 0 0 18px; display: flex; align-items: center; gap: 10px; line-height: 1.45; }
.sync-body.bad { color: #b3261e; }
.sync-actions { display: flex; justify-content: flex-end; }
.sync-spinner { width: 18px; height: 18px; border: 2px solid var(--hairline); border-top-color: var(--teal); border-radius: 50%; animation: contacts-spin 0.8s linear infinite; flex: none; }

/* Quote builder + quotes on the project page */
.qb-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 18px; }
.qb-group { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 8px 12px 10px; margin: 0; min-width: 0; }
.qb-group legend { font-weight: 600; padding: 0 6px; }
.qb-all { display: block; font-size: 0.8rem; margin-bottom: 4px; }
.qb-check { display: block; padding: 2px 0; cursor: pointer; }
.qb-track-search { position: relative; max-width: 560px; }
.qb-section { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); margin: 16px 0; padding: 12px 14px; }
.qb-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.qb-problem { color: #b3261e; margin: 6px 0; }
.qb-table input.qb-price { width: 110px; text-align: right; }
.qb-table tr.qb-zero td { background: rgba(179, 38, 30, 0.12); }
.qb-table tr.qb-zero input.qb-price { border-color: #b3261e; color: #b3261e; }
.qb-x { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--ink-muted); cursor: pointer; padding: 0 6px; }
.qb-x:hover { color: #b3261e; }
.quote-group { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); margin: 10px 0; }
.quote-group > summary { display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer; flex-wrap: wrap; list-style-position: inside; }
.quote-group .quote-track { flex: 1 1 220px; }
.quote-group .quote-total { font-weight: 600; }
.quote-group .table-wrap { padding: 0 14px; }
.quote-group .quote-delete { padding: 6px 14px 12px; }

/* Quote options panel */
.qb-opts { padding: 0; margin-bottom: 18px; }
.qb-opts > summary { cursor: pointer; padding: 12px 16px; list-style-position: inside; }
.qb-opts-title { font-weight: 600; }
.qb-sum-lines { display: none; margin-top: 6px; }
.qb-opts:not([open]) .qb-sum-lines { display: block; }
.qb-sum-line { display: block; font-size: 0.9rem; line-height: 1.5; color: var(--ink-muted); }
.qb-sum-line strong { color: var(--ink); font-weight: 600; }
.qb-sum-val.qb-none { color: #b3261e; }
.qb-opts .qb-options { padding: 0 16px 16px; margin-bottom: 0; }

/* Play buttons */
.play-btn { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--ink-muted); background: transparent; color: var(--ink-muted); cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin-right: 8px; flex: none; }
.play-btn::before { content: ''; border-style: solid; border-width: 6px 0 6px 10px; border-color: transparent transparent transparent currentColor; margin-left: 2px; }
.play-btn:hover:not(:disabled) { color: var(--teal); border-color: var(--teal); }
.play-btn.is-playing::before { border: 0; width: 10px; height: 12px; margin: 0; background: linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%); }
.play-btn.is-loading { opacity: 0.6; }
.play-btn:disabled { opacity: 0.3; cursor: default; }
.play-btn.play-error { border-color: #b3261e; color: #b3261e; }

/* Quote builder search results */
.qb-results { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); margin-top: 8px; max-height: 420px; overflow-y: auto; }
.qb-results-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--hairline); }
.qb-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--ink-muted); cursor: pointer; }
.qb-results-empty { padding: 10px 12px; margin: 0; }
.qb-results-table { margin: 0; }
.qb-results-table td { vertical-align: middle; }
.qb-add { width: 32px; height: 32px; border-radius: 6px; border: 1.5px solid var(--teal); background: transparent; color: var(--teal); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0; }
.qb-add:hover:not(:disabled) { background: var(--teal); color: #fff; }
.qb-add.is-added { border-color: var(--hairline); color: var(--ink-muted); cursor: default; }
.qb-track-search { max-width: none; }

/* One table for the whole quote */
.qb-table-wrap { margin: 16px 0; }
.qb-group-row td { background: rgba(0, 0, 0, 0.045); border-top: 2px solid var(--hairline); padding: 8px 12px; }
.qb-group-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.qb-frozen td { color: var(--ink-muted); }
.qb-line-code { white-space: nowrap; }
.qb-edit-add { margin: 0 0 12px; }
.qb-total { margin-left: 12px; }
.quote-group .quote-actions { margin: 8px 14px; }

.quote-group .quote-delete-x { margin-left: auto; }

/* Inline quote editing on the project page */
.quote-group .quote-update { margin-left: auto; }
.quote-group .quote-update + .quote-delete-x { margin-left: 0; }
.quote-group.is-editing .quote-update, .quote-group.is-editing .quote-delete-x { display: none; }
.quote-edit-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px 14px; flex-wrap: wrap; }
.quote-edit-bar[hidden] { display: none; }
.q-error { color: #b3261e; font-size: 0.9rem; }
.quote-table .q-price { width: 100px; text-align: right; }
.quote-table tr.q-new td { background: rgba(0, 128, 128, 0.06); }

/* ---- Bottom audio player ---- */
body.has-audio-bar { padding-bottom: 84px; }
.ap-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--panel); border-top: 1px solid var(--hairline); box-shadow: 0 -4px 14px rgba(26, 36, 33, 0.10); }
.ap-bar[hidden] { display: none; }
.ap-toggle { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--teal); color: #fff; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ap-toggle:hover { background: var(--teal-dark); }
.ap-toggle::before { content: ''; border-style: solid; border-width: 7px 0 7px 12px; border-color: transparent transparent transparent currentColor; margin-left: 3px; }
.ap-toggle.is-playing::before { border: 0; width: 12px; height: 14px; margin: 0; background: linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65% 100%); }
.ap-meta { width: 210px; flex: none; min-width: 0; }
.ap-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-artist { font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-time { font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; flex: none; min-width: 34px; text-align: center; }
.ap-wave { flex: 1; min-width: 0; height: 44px; position: relative; display: flex; align-items: center; }
.ap-wave-ws { width: 100%; cursor: pointer; }
.ap-simple { width: 100%; height: 8px; background: var(--hairline); border-radius: 4px; cursor: pointer; overflow: hidden; }
.ap-simple-fill { height: 100%; width: 0; background: var(--teal); }
.ap-close { width: 30px; height: 30px; border: 0; background: transparent; color: var(--ink-muted); font-size: 22px; line-height: 1; cursor: pointer; flex: none; border-radius: var(--radius); }
.ap-close:hover { background: var(--teal-tint); color: var(--ink); }
@media (max-width: 720px) {
  .ap-bar { gap: 8px; padding: 8px 10px; flex-wrap: wrap; }
  .ap-meta { width: auto; flex: 1; }
  .ap-wave { order: 5; flex-basis: 100%; }
  .ap-time { display: none; }
  body.has-audio-bar { padding-bottom: 130px; }
}

/* Inline quote editing: compact, matching heights for the dropdowns and the price box */
.quote-table .q-price { box-sizing: border-box; height: 30px; padding: 3px 8px; font-size: 0.88rem; line-height: 1.2; }
.dd { display: inline-block; max-width: 100%; }
.dd-btn { box-sizing: border-box; height: 30px; max-width: 150px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; font-size: 0.88rem; cursor: pointer; }
.dd-btn::after { content: ''; flex: none; width: 6px; height: 6px; border-right: 1.5px solid var(--ink-muted); border-bottom: 1.5px solid var(--ink-muted); transform: rotate(45deg) translateY(-2px); }
.dd-btn:hover, .dd-btn.open, .dd-btn:focus-visible { border-color: var(--teal); outline: none; }
.dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-menu { position: fixed; z-index: 1000; margin: 0; padding: 4px; list-style: none; width: max-content; max-width: calc(100vw - 16px); max-height: 260px; overflow-y: auto; overflow-x: hidden; background: var(--panel); border: 1px solid var(--hairline); border-radius: 6px; box-shadow: 0 8px 24px rgba(26, 36, 33, 0.16); font-size: 0.9rem; }
.dd-menu li { padding: 7px 10px; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.dd-menu li:hover, .dd-menu li.hot { background: var(--teal-tint); }
.dd-menu li.sel { color: var(--teal); font-weight: 600; }

.row-x { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--ink-muted); cursor: pointer; padding: 0 6px; }
.row-x:hover { color: #b3261e; }
.quote-table .c-actions { text-align: right; white-space: nowrap; }
.qb-table input.qb-timing, .quote-table input.q-timing { box-sizing: border-box; width: 110px; height: 30px; padding: 3px 8px; font-size: 0.88rem; }

/* "no rate" link and vendor rate popup in the quote builder */
.qb-norate { background: none; border: 0; padding: 0; font: inherit; font-size: 0.85rem; color: var(--teal); text-decoration: underline dotted; cursor: pointer; }
.qb-norate:hover { color: var(--teal-dark); text-decoration: underline; }
.qb-norate.is-vendor { color: var(--ink); font-size: inherit; text-decoration: underline dotted; }
.vr-menu { padding: 0; min-width: 240px; }
.vr-head { padding: 9px 12px 7px; font-size: 0.78rem; font-weight: 600; color: var(--ink-muted); border-bottom: 1px solid var(--hairline); text-transform: none; }
.vr-body { padding: 10px 12px; }
.vr-list { padding: 4px; }
.vr-list ul { list-style: none; margin: 0; padding: 0; }
.vr-list li { display: flex; justify-content: space-between; gap: 24px; padding: 7px 10px; border-radius: 4px; cursor: pointer; }
.vr-list li:hover, .vr-list li:focus { background: var(--teal-tint); outline: none; }

/* Quote Tracks: options on the left, track search on the right */
.qb-top { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.qb-top .qb-opts { margin-bottom: 0; }
.qb-top .qb-track-search { margin: 0; }
.qb-top .qb-results { max-height: 420px; }
.qb-top .qb-results-table { font-size: 0.9rem; }
.qb-top .qb-results-table td, .qb-top .qb-results-table th { padding-left: 8px; padding-right: 8px; }
@media (max-width: 1050px) { .qb-top { grid-template-columns: minmax(0, 1fr); } }
/* Options as toggle chips so long lists (Rights) wrap sideways instead of running down the page */
.qb-opts .qb-options { display: block; padding: 4px 16px 16px; }
.qb-opts .qb-group { position: relative; margin: 0 0 12px; padding: 10px 12px 4px; }
.qb-opts .qb-group:last-child { margin-bottom: 0; }
.qb-opts .qb-all { position: absolute; top: -10px; right: 10px; margin: 0; padding: 0 6px; background: var(--panel); }
.qb-opts .qb-check { position: relative; display: inline-block; margin: 0 4px 8px 0; padding: 4px 11px; border: 1px solid var(--hairline); border-radius: 999px; font-size: 0.88rem; line-height: 1.3; background: var(--panel); user-select: none; }
.qb-opts .qb-check input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.qb-opts .qb-check:hover { border-color: var(--teal); }
.qb-opts .qb-check:has(input:checked) { background: var(--teal); border-color: var(--teal); color: #fff; }
.qb-opts .qb-check:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }

/* Quote Tracks table: column headings sit directly above each track's lines; price and timing boxes match */
.qb-table .qb-colhead th { background: transparent; border-top: 0; padding-top: 8px; padding-bottom: 4px; }
.qb-table input.qb-price, .qb-table input.qb-timing { box-sizing: border-box; height: 30px; padding: 3px 8px; font-size: 0.88rem; line-height: 1.2; }
.qb-table input.qb-price { width: 110px; text-align: right; }
.qb-table input.qb-timing { width: 110px; }

/* One-time write-in values on the Quote Tracks options */
.qb-opts .qb-addslot { display: inline-block; margin: 0 4px 8px 0; vertical-align: top; }
.qb-opts .qb-addpill { padding: 4px 11px; border: 1px dashed var(--teal); border-radius: 999px; background: transparent; color: var(--teal); font: inherit; font-size: 0.88rem; line-height: 1.3; font-weight: 600; letter-spacing: 0.02em; cursor: pointer; }
.qb-opts .qb-addpill:hover { background: var(--teal-tint); }
.qb-opts .qb-addinput { box-sizing: border-box; width: 220px; max-width: 100%; height: 30px; padding: 3px 12px; border: 1px solid var(--teal); border-radius: 999px; font: inherit; font-size: 0.88rem; }
.qb-opts .qb-custom { padding-right: 6px; }
.qb-opts .qb-custom .qb-cx { margin-left: 4px; padding: 0 5px; border: 0; background: none; color: inherit; opacity: 0.75; font-size: 1.05rem; line-height: 1; cursor: pointer; }
.qb-opts .qb-custom .qb-cx:hover { opacity: 1; }

.dd-menu li.dd-write { margin-top: 4px; border-top: 1px solid var(--hairline); border-radius: 0 0 4px 4px; padding-top: 9px; color: var(--teal); font-weight: 600; }
.dd-menu li.dd-write.editing { cursor: default; padding: 8px 6px 4px; }
.dd-menu li.dd-write:hover { background: var(--teal-tint); }
.dd-menu li.dd-write.editing:hover { background: transparent; }
.dd-write-input { box-sizing: border-box; width: 100%; min-width: 220px; height: 30px; padding: 3px 10px; border: 1px solid var(--teal); border-radius: 6px; font: inherit; font-size: 0.9rem; }

/* Edit project: title row and the TMDb Sync popup */
.title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.title-row h2 { margin: 0; }
.tm-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-start; justify-content: center; background: rgba(20, 24, 28, 0.55); padding: 8vh 16px 16px; overflow-y: auto; }
.tm-dialog { background: var(--panel); color: var(--ink); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); padding: 20px 24px 22px; width: 100%; max-width: 520px; }
.tm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.tm-head h3 { margin: 0; }
.tm-x { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--ink-muted); cursor: pointer; }
.tm-x:hover { color: var(--ink); }
.tm-results { max-height: 340px; }
.tm-confirm { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.tm-confirm img, .tm-bigthumb { width: 92px; flex: none; border-radius: 3px; }
.tm-bigthumb { height: 138px; display: block; }
.tm-confirm p { margin: 0 0 8px; }
.tm-confirm ul { margin: 0 0 8px; padding-left: 18px; font-size: 0.92rem; }
.tm-confirm li { margin-bottom: 4px; }
.tm-warn { color: #b3261e; font-weight: 600; }


/* Add as Promo dialog */
.pr-dialog { max-width: 620px; }
.pr-price { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.pr-price-in { box-sizing: border-box; width: 130px; height: 34px; padding: 4px 10px; text-align: right; font-size: 1rem; }
.pr-table { margin-bottom: 6px; }
.pr-table .pr-uses { box-sizing: border-box; width: 80px; height: 32px; padding: 3px 8px; text-align: right; }
.pr-table tfoot td { border-top: 1px solid var(--hairline); border-bottom: 0; }
.pr-actions { justify-content: flex-end; display: flex; gap: 8px; margin-top: 10px; }
.pr-error { min-height: 1.2em; margin: 6px 0 0; }

/* promo lines: the price is price x uses */
.quote-table .promo-note{white-space:nowrap}
input.q-price.is-promo{cursor:pointer;background:var(--surface-2,#f3f6f5)}

.quote-table .blanket-note{background:none;border:0;padding:0;font:inherit;font-size:.85em;color:var(--link,#1b6b5e);cursor:pointer;text-decoration:underline dotted;white-space:nowrap}

.qb-notice{padding:.4rem .75rem;font-size:.85em;color:var(--muted,#6b7b78);background:var(--warn-bg,#fff8e6);border-left:3px solid var(--warn,#e0a800)}

/* Quote Metadata dialog */
.head-actions{display:flex;gap:8px;align-items:center}
.qm-dialog{max-width:1100px;box-sizing:border-box}
.qm-scroll{max-height:50vh;overflow:auto;margin:8px 0}
.qm-table th:first-child,.qm-table td:first-child{width:32px}
.qm-msg.is-ok{color:var(--teal,#1b6b5e)}
.qm-text{width:100%;box-sizing:border-box;white-space:pre-wrap;font-family:ui-monospace,Menlo,Consolas,monospace;font-size:.8rem;margin:6px 0}
.tm-overlay[hidden]{display:none}

.qm-table{width:100%}
.qm-table td,.qm-table th{overflow-wrap:anywhere}
.qm-text{min-height:15em}

/* Sync menu (top bar icon) and the Last Source Audio Sync note */
.sync-menu-wrap{position:relative;display:inline-flex}
.sync-menu{position:absolute;right:0;top:calc(100% + 6px);z-index:60;margin:0;padding:4px;list-style:none;min-width:190px;background:var(--panel);border:1px solid var(--hairline);border-radius:var(--radius);box-shadow:0 8px 24px rgba(0,0,0,.14)}
.sync-menu[hidden]{display:none}
.sync-menu button{display:block;width:100%;text-align:left;background:none;border:0;padding:8px 12px;font:inherit;color:var(--ink);cursor:pointer;border-radius:6px}
.sync-menu button:hover,.sync-menu button:focus-visible{background:var(--teal-tint);outline:0}
.sa-sync{position:fixed;left:12px;bottom:10px;z-index:30;font-size:.78rem;color:var(--ink-muted);background:var(--panel);border:1px solid var(--hairline);border-radius:999px;padding:3px 10px;opacity:.92;pointer-events:none}
.sa-sync[data-state="stale"]{color:#8a5a00;border-color:#e0a800}
.sa-sync[data-state="failed"]{color:#b3261e;border-color:#b3261e}
.sa-sync[data-state="running"]{color:var(--teal)}
body.has-audio-bar .sa-sync{bottom:94px}
@media (max-width:700px){body.has-audio-bar .sa-sync{bottom:140px}}
body{padding-bottom:34px}
body.has-audio-bar{padding-bottom:84px}

.settings-link{display:inline-flex;align-items:center;padding:6px;border-radius:50%;color:var(--ink-muted)}
.settings-link:hover,.settings-link.active{color:var(--teal);background:var(--teal-tint)}

/* the gear picture is used as a mask so it takes the same colours as the sync icon */
.gear-icon{display:block;width:18px;height:18px;background:currentColor;-webkit-mask:url(img/gear.png) center/contain no-repeat;mask:url(img/gear.png) center/contain no-repeat}

/* Users page */
.role-list { margin: 8px 0 0 18px; padding: 0; line-height: 1.6; }
.user-add { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; align-items: start; margin-bottom: 22px; }
.user-add .field { margin: 0; }
.user-add .field input, .user-add .field select { width: 100%; box-sizing: border-box; }
.user-add .field .status { display: block; margin-top: 4px; font-size: 12px; line-height: 1.3; }
.user-add .form-actions { grid-column: 1 / -1; }
.users-table input[type=text], .users-table select { width: 100%; min-width: 110px; }
.users-table tr.retired td { opacity: .55; }

/* Invoicing */
.inv-dialog { max-width: 980px; }
.inv-dialog.inv-wide { max-width: 1180px; }
.inv-scroll { max-height: 62vh; overflow: auto; margin-bottom: 8px; }
.inv-scroll.short { max-height: 44vh; }
.inv-table input { box-sizing: border-box; width: 100%; min-width: 90px; height: 32px; padding: 3px 8px; }
.inv-table input[type=checkbox] { width: auto; min-width: 0; height: auto; }
.inv-table .il-amt { text-align: right; min-width: 100px; }
.inv-done td { color: var(--ink-muted); }
.inv-sub { margin: 16px 0 6px; }
.inv-total { text-align: right; font-size: 1.05rem; margin: 6px 0; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 16px; align-items: start; }
.inv-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.inv-f { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.inv-f > span { font-size: .85rem; color: var(--ink-muted); }
.inv-f input, .inv-f select, .inv-f textarea { box-sizing: border-box; width: 100%; }
.inv-f.wide { grid-column: 1 / -1; }
.inv-pick { display: flex; gap: 6px; align-items: center; }
.inv-pick input[name=qb_customer_name] { flex: 1; min-width: 0; }
.inv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.inv-switch { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.inv-ac { position: relative; }
.inv-ac-list { position: absolute; z-index: 5; left: 0; right: 0; background: var(--panel); border: 1px solid var(--hairline); border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-height: 220px; overflow: auto; padding: 4px; }
.inv-ac-list[hidden] { display: none; }
.inv-ac-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 8px; cursor: pointer; color: var(--ink); }
.inv-ac-list button:hover { background: var(--hairline); }
.inv-picker { z-index: 1100; }
.inv-pick-dialog { max-width: 520px; }
.inv-pick-bar { display: flex; gap: 8px; margin-bottom: 8px; }
.inv-pick-bar input { flex: 1; min-width: 0; }
.inv-pick-table tbody tr { cursor: pointer; }
.inv-pick-table tbody tr:hover, .inv-pick-table tbody tr:focus { background: var(--hairline); outline: 0; }
.inv-actions { white-space: nowrap; }
.inv-state.inv-paid { background: #dff3e4; color: #1d5b2f; }
.inv-state.inv-unpaid { background: #fff0d6; color: #7a4b00; }
.inv-state.inv-locked { background: #e3e6ea; color: #333; }
.inv-state.inv-draft { background: #eef0f2; color: #555; }
.inv-table select { box-sizing: border-box; width: 100%; min-width: 110px; height: 32px; padding: 3px 6px; }

/* Invoice sheet: plain values you click to edit */
.inv-sheet .inv-scroll { max-height: 78vh; }
.inv-top { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 28px; margin-bottom: 18px; }
.inv-h { margin: 0 0 10px; font-size: 1rem; font-weight: 600; }
.ie-row { display: flex; gap: 14px; align-items: baseline; min-height: 28px; padding: 2px 0; }
.ie-l { flex: 0 0 120px; color: var(--ink-muted); font-size: .92rem; }
.ie-val { flex: 1; min-width: 0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ie-sep { border-top: 1px solid var(--hairline); margin: 10px 0; }
.ie-v { color: var(--ink); text-decoration: none; border-bottom: 1px dashed transparent; cursor: pointer; }
.ie-v:hover, .ie-v:focus-visible { border-bottom-color: var(--ink-muted); outline: 0; }
.ie-v.empty { color: var(--ink-muted); }
.ie.ro { color: var(--ink); }
.ie .ie-c { box-sizing: border-box; min-width: 140px; height: 30px; padding: 2px 8px; }
.ie textarea.ie-c { height: auto; width: 100%; min-width: 220px; }
.inv-addr { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-content: start; }
.inv-addr .ie-l { flex-basis: 110px; }
.inv-lic-head { display: flex; align-items: center; gap: 14px; min-height: 28px; margin-bottom: 10px; flex-wrap: wrap; }
.inv-lic-head .inv-h { margin: 0; }
.inv-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink-muted); }
.inv-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.inv-sw { position: relative; width: 38px; height: 20px; border-radius: 10px; background: #b9c0c7; transition: background .15s; flex: none; }
.inv-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.inv-switch input:checked + .inv-sw { background: #1f7a6a; }
.inv-switch input:checked + .inv-sw::after { transform: translateX(18px); }
.inv-switch input:focus-visible + .inv-sw { outline: 2px solid #1f7a6a; outline-offset: 2px; }
.inv-btns { display: flex; gap: 8px; margin-top: 4px; }
.inv-lines .ln { color: var(--ink-muted); width: 32px; }
.inv-lines td { vertical-align: middle; }
.inv-lines .ie .ie-c { min-width: 110px; }
.inv-foot { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-top: 14px; }
.inv-notes { display: flex; gap: 12px; align-items: flex-start; flex: 1; }
.inv-notes textarea { box-sizing: border-box; width: 100%; max-width: 520px; }
.inv-foot .inv-total { font-size: 1.1rem; white-space: nowrap; }
@media (max-width: 900px) { .inv-top, .inv-addr { grid-template-columns: 1fr; } }
.inv-sums { min-width: 260px; }
.inv-sums .ie-row { justify-content: flex-end; }
.inv-sum { display: flex; justify-content: flex-end; gap: 18px; padding: 3px 0; }
.inv-sum span { color: var(--ink-muted); }
.inv-sum strong { min-width: 110px; text-align: right; }
.inv-grand { font-size: 1.1rem; border-top: 1px solid var(--hairline); margin-top: 4px; padding-top: 6px; }
.inv-grand span { color: var(--ink); }
.inv-quote { color: var(--ink-muted); }

/* Pickers open right where they were clicked */
.tm-overlay.inv-popwrap { background: transparent; padding: 0; display: block; overflow: visible; }
.inv-pop { position: fixed; z-index: 1101; display: flex; flex-direction: column; box-sizing: border-box; width: 460px; max-width: calc(100vw - 16px); background: var(--panel); color: var(--ink); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.3); padding: 10px 12px 8px; }
.inv-pop.wide { width: 680px; }
.inv-pop .inv-pick-bar { margin-bottom: 6px; }
.inv-pop .inv-scroll { max-height: none; flex: 1; min-height: 0; overflow: auto; margin-bottom: 4px; }
.inv-pop .data-table { margin: 0; }
.inv-pop .q-error { margin: 2px 0 0; min-height: 0; }
.inv-lines td a.ie-v { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* Quotes on the project page: collapsed tracks read like table rows (Track, Album, Quote, Invoice) */
.quote-cols, .quote-group > summary { display: grid; grid-template-columns: 28px minmax(160px, 2fr) minmax(120px, 1.4fr) 110px 110px 170px; gap: 14px; align-items: center; }
.quote-cols { padding: 0 15px; margin-top: 12px; font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.quote-cols .num, .quote-group .quote-total, .quote-group .quote-invoiced { text-align: right; }
.quote-group > summary { flex-wrap: nowrap; }
.quote-group .quote-album { color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-group .quote-invoiced { font-weight: 600; }
.quote-group .quote-acts { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.quote-group .quote-acts .quote-update, .quote-group .quote-acts .quote-delete-x { margin-left: 0; }
.quote-table .c-invoiced { color: var(--ink); }
@media (max-width: 760px) {
  .quote-cols { display: none; }
  .quote-group > summary { grid-template-columns: 28px 1fr auto; }
  .quote-group .quote-album, .quote-group .quote-invoiced { display: none; }
}
/* the browser's own disclosure triangle would take a grid column: hide it and draw one in the left margin */
.quote-group > summary { list-style: none; position: relative; padding: 12px 14px 12px 34px; }
.quote-group > summary::-webkit-details-marker { display: none; }
.quote-group > summary::marker { content: ""; }
.quote-group > summary::before { content: ""; position: absolute; left: 14px; top: 50%; width: 0; height: 0; margin-top: -5px; border-left: 7px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .12s; }
.quote-group[open] > summary::before { transform: rotate(90deg); }
.quote-cols { padding: 0 15px 0 35px; }

/* Quote rows: edit icon, × delete, composers under the title */
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--ink-muted); cursor: pointer; }
.icon-btn:hover, .icon-btn:focus-visible { color: var(--ink); border-color: var(--hairline); background: var(--panel); outline: 0; }
.quote-group .quote-track { display: block; min-width: 0; }
.quote-group .quote-composers { display: block; margin-top: 2px; font-size: .8rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-group .quote-acts .qb-x { padding: 0 4px; }
.quote-group .quote-acts { min-width: 70px; }
.quote-cols, .quote-group > summary { grid-template-columns: 28px minmax(160px, 2fr) minmax(120px, 1.4fr) 110px 110px 80px; }
.quote-group .quote-acts { justify-content: flex-start; min-width: 0; gap: 8px; }

/* Project header: totals sit up beside the title to save a row */
.project-info .info-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 4px; }
.project-info .totals { grid-column: auto; display: flex; gap: 10px; margin: 0; flex-wrap: wrap; }
.project-info .total-box { padding: 7px 14px; min-width: 150px; }
.project-info .total-value { font-size: 1.15rem; }
.inv-actions .icon-btn { margin-right: 4px; vertical-align: middle; }
.inv-actions .qb-x { vertical-align: middle; }

/* By-album summaries under quotes and invoices */
.album-split { max-width: 560px; margin: 4px 0 22px; }
.album-split h4 { margin: 0 0 4px; font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.album-split table.data-table { margin: 0; font-size: .92rem; }
.album-split table.data-table td, .album-split table.data-table th { padding-top: 6px; padding-bottom: 6px; }
.album-split tfoot td { font-weight: 600; border-top: 1px solid var(--hairline); border-bottom: 0; }
.album-row { display: flex; gap: 12px 32px; flex-wrap: wrap; align-items: flex-start; margin: 0 0 18px; }
.album-row .album-split { flex: 1 1 320px; max-width: 520px; margin: 0; }

/* Project page sections: each is a card with a titled header */
.psec { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px 14px; margin: 0 0 18px; }
.psec-head { display: flex; justify-content: space-between; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--hairline); }
.psec-head h3, .album-panel > summary h3 { margin: 0; font-size: 1.1rem; }
.psec-count { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--paper); color: var(--ink-muted); font-size: .8rem; font-weight: 600; vertical-align: middle; }
.psec-empty { margin: 4px 0 2px; color: var(--ink-muted); }
.psec .quote-cols { margin-top: 0; }
.psec .inv-list { margin: 2px 0 0; }
.psec .head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.album-panel { padding: 10px 16px; }
.album-panel > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.album-panel > summary::-webkit-details-marker { display: none; }
.album-panel > summary::before { content: ""; width: 0; height: 0; border-left: 7px solid var(--ink-muted); border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .12s; }
.album-panel[open] > summary::before { transform: rotate(90deg); }
.album-panel .album-row { margin: 12px 0 4px; }
.album-split h4 { text-transform: none; letter-spacing: 0; font-size: .86rem; }

/* Quote lines: fixed column widths so edit mode fits without a horizontal scrollbar */
.quote-group .table-wrap { overflow-x: auto; }
.quote-table { table-layout: fixed; width: 100%; min-width: 720px; }
.quote-table th, .quote-table td { padding-left: 6px; padding-right: 6px; overflow-wrap: anywhere; }
.quote-table th:nth-child(1) { width: 17%; }
.quote-table th:nth-child(2) { width: 14%; }
.quote-table th:nth-child(3) { width: 12%; }
.quote-table th:nth-child(4) { width: 12%; }
.quote-table th:nth-child(5) { width: 10%; }
.quote-table th:nth-child(6) { width: 10%; }
.quote-table th:nth-child(7) { width: 12%; }
.quote-table th:nth-child(8) { width: 9%; }
.quote-table th:nth-child(9) { width: 4%; }
.quote-table .dd { display: block; width: 100%; }
.quote-table .dd-btn { width: 100%; max-width: none; }
.quote-table .dd-label { flex: 1 1 auto; min-width: 0; text-align: left; }
.quote-table input.q-timing, .quote-table .q-price { width: 100%; min-width: 0; }
.quote-table .c-created { white-space: nowrap; }

/* Invoice popups: wider so every column is visible without sideways scrolling */
.inv-dialog { max-width: min(1240px, 96vw); }
.inv-dialog.inv-wide { max-width: min(1320px, 96vw); }
.inv-table th, .inv-table td { padding-left: 8px; padding-right: 8px; }
.inv-table td { white-space: nowrap; }
.inv-table .il-amt { min-width: 90px; }
.inv-table td:nth-child(2), .inv-table td:nth-child(3) { white-space: normal; }

/* Site-wide calendar (assets/datepicker.js) */
input[type=date]::-webkit-calendar-picker-indicator { display: none; }
.bdp { position: fixed; z-index: 3000; width: 272px; padding: 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--hairline); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.28); font-size: .92rem; }
.bdp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.bdp-title { display: flex; gap: 6px; flex: 1; justify-content: center; }
.bdp select { font: inherit; font-weight: 600; padding: 5px 6px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--panel); color: var(--ink); cursor: pointer; }
.bdp-nav { width: 32px; height: 32px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.bdp-nav:hover, .bdp-day:hover { background: var(--teal-tint); }
.bdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.bdp-dow { text-align: center; font-size: .78rem; font-weight: 600; text-transform: uppercase; color: var(--ink-muted); padding: 4px 0; }
.bdp-day { height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; cursor: pointer; }
.bdp-day.today { box-shadow: inset 0 0 0 1.5px var(--teal); }
.bdp-day.sel { background: var(--teal); color: #fff; font-weight: 600; }
.bdp-foot { display: flex; justify-content: space-between; margin-top: 10px; }
.bdp-link { background: none; border: 0; padding: 6px 4px; font: inherit; font-size: .9rem; color: var(--teal); cursor: pointer; }
.bdp-link:hover { text-decoration: underline; }

/* License To: heading on the same line as Bill To, switch on the right */
.inv-lic-head { flex-wrap: nowrap; justify-content: space-between; margin-bottom: 10px; }
.inv-lic-head .inv-h { order: -1; margin: 0; }
.inv-addr-col > .inv-h { margin-bottom: 10px; min-height: 28px; display: flex; align-items: center; }
.inv-lic-head { justify-content: flex-start; gap: 18px; }

/* Keep the Info / Bill To / License To headings the same height so the rows beneath line up */
.inv-info > .inv-h, .inv-addr-col > .inv-h, .inv-lic-head { box-sizing: border-box; height: 34px; min-height: 34px; margin: 0 0 8px; display: flex; align-items: center; }
.inv-lic-head .inv-h { height: auto; min-height: 0; margin: 0; }
.inv-state[class*="inv-unpaid"] { background: #fff0d6; color: #7a4b00; }
.inv-state[class*="inv-unpaid-(unlocked"] { background: #fde2c2; }

/* Non-track invoices */
.nt-dialog { max-width: 920px; }
.nt-table th:nth-child(1) { width: 24%; } .nt-table th:nth-child(2) { width: 36%; } .nt-table th:nth-child(3) { width: 11%; }
.nt-table th:nth-child(4) { width: 14%; } .nt-table th:nth-child(5) { width: 12%; } .nt-table th:nth-child(6) { width: 3%; }
.nt-table td { white-space: normal; vertical-align: middle; }
.nt-table input { min-width: 0; }
.nt-table input.nt-qty, .nt-table input.nt-rate { text-align: right; }
.nt-add { margin: 8px 0 4px; }
.nt-lines .il-desc { min-width: 220px; }
.nt-lines td { white-space: normal; vertical-align: top; }
.nt-lines td.num { white-space: nowrap; }
.nt-lines .ie-v { white-space: pre-wrap; }

/* Settings: contact groups */
#contact-groups > p { margin: 8px 0; }
.cg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 12px 0; }
.cg-group { margin: 0; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--radius); max-height: 260px; overflow: auto; }
.cg-group legend { padding: 0 6px; font-weight: 600; }
.cg-opt { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }

/* Void invoices */
.inv-state.inv-void { background: #e9e9ec; color: #6a6a72; text-decoration: line-through; }
.btn-danger { color: #b3261e; border-color: #e3b5b1; }
.btn-danger:hover { background: #fbeceb; }
.inv-info .ie-l { flex-basis: 135px; white-space: nowrap; }
.inv-sheet .tm-head { align-items: center; gap: 14px; }
.inv-sheet .tm-head h3 { flex: 1; min-width: 0; }
.inv-sheet .tm-head .inv-btns { margin: 0; }

/* Composer bills (statements page) */
.bill-badge { font-size: 0.8rem; color: var(--ink-muted); margin-right: 10px; }
.bill-badge.bb-paid { color: #1e7a46; }
.bill-badge.bb-draft { color: var(--ink-muted); }
.bill-badge.bb-unpaid { color: #9a5b00; }
.composer-detail-wrap .btn + .btn { margin-left: 8px; }
.bill-sheet { max-width: 860px; }
.bill-sheet .tm-head { align-items: center; gap: 14px; }
.bill-sheet .tm-head h3 { flex: 1; min-width: 0; }
.bill-state { font-size: 0.8rem; font-weight: 500; color: var(--ink-muted); margin-left: 8px; }
.bill-msg { min-height: 18px; font-size: 0.85rem; margin-bottom: 8px; color: var(--ink-muted); }
.bill-msg.bad { color: #b3261e; }
.bill-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 16px; margin-bottom: 14px; }
.bill-grid .bill-vendor, .bill-grid .bill-memo { grid-column: 1 / -1; }
.bill-vendor { position: relative; }
.bill-vlist { position: absolute; z-index: 5; left: 0; right: 0; top: 62px; max-height: 220px; overflow-y: auto; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.bill-v { display: block; width: 100%; text-align: left; padding: 7px 10px; background: none; border: 0; cursor: pointer; font: inherit; color: inherit; }
.bill-v:hover { background: var(--teal-tint); }
.bs-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.bs-row select { min-width: 280px; }

/* History / activity log */
.hist-dialog { max-width: 680px; }
.hist-body { max-height: 65vh; overflow-y: auto; }
.hist-list { list-style: none; margin: 0; padding: 0; }
.hist-row { padding: 10px 0; border-bottom: 1px solid var(--hairline); }
.hist-row:last-child { border-bottom: 0; }
.hist-who { font-weight: 600; }
.hist-when { color: var(--ink-muted); font-size: 0.82rem; margin-left: 8px; }
.hist-sum { margin-top: 2px; }
.hist-lab { color: var(--ink-muted); }
.hist-det { margin: 4px 0 0 18px; padding: 0; font-size: 0.85rem; color: var(--ink-muted); }
.act-filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin: 12px 0 16px; }
.act-filters .field { margin: 0; }

.tier-notier { background: #F0F0F0; color: #555; border-color: #D0D0D0; }

.tier-pill { font: inherit; cursor: pointer; background: transparent; border: 1px solid currentColor; border-radius: 999px; padding: 3px 12px; }
.tier-pill.is-zero { border-color: var(--hairline); }
.tier-pill.is-active { background: var(--danger); border-color: var(--danger); color: #fff; }
.tier-pill.is-zero.is-active { background: var(--ink-muted); border-color: var(--ink-muted); }

/* All-invoices page */
.inv-list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.inv-list-tools { display: flex; gap: 10px; align-items: center; }
.inv-list-filters { display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap; font-size: 0.85rem; margin: 4px 0 6px; }
.inv-list-filters label { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.inv-list-filters select { width: 200px; margin: 0; }
table.inv-list th[data-sort] { cursor: pointer; user-select: none; }
table.inv-list th.sorted-asc::after { content: " ▲"; font-size: 0.65rem; }
table.inv-list th.sorted-desc::after { content: " ▼"; font-size: 0.65rem; }
table.inv-list tr.inv-lines:hover { background: transparent; }

.inv-arrow { position: relative; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; color: inherit; }
.inv-arrow::before { content: ""; position: absolute; left: 8px; top: 50%; width: 0; height: 0; margin-top: -5px; border-left: 7px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .12s; }
.inv-arrow.is-open::before { transform: rotate(90deg); }

.qb-vendor { margin: 0 0 12px; max-width: 560px; }
.qb-vendor select { width: auto; min-width: 220px; }
.qb-vendor .status { display: block; margin-top: 4px; font-size: 0.8rem; }

/* Albums page: one panel per catalog */
.cat-panels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 8px 0 22px; }
.cat-panel { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); padding: 12px 14px; min-width: 0; }
.cat-panel h3 { margin: 0 0 8px; font-size: 0.95rem; line-height: 1.25; overflow-wrap: anywhere; }
.cat-panel dl { margin: 0; }
.cat-panel dl > div { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; font-size: 0.85rem; border-top: 1px solid var(--hairline); }
.cat-panel dt { color: var(--ink-muted); }
.cat-panel dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .cat-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.top-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0 12px; }
.top-panel ol { list-style: none; margin: 0; padding: 0; }
.top-panel li { display: grid; grid-template-columns: minmax(0, 1fr) auto 5.5em; gap: 10px; align-items: baseline; padding: 4px 0; border-top: 1px solid var(--hairline); font-size: 0.85rem; }
.top-panel .top-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-panel .top-amt { font-weight: 600; font-variant-numeric: tabular-nums; }
.top-panel .top-n { color: var(--ink-muted); text-align: right; }
@media (max-width: 700px) { .top-panels { grid-template-columns: minmax(0, 1fr); } }

/* Mild panel colours: each catalog panel gets its own soft hue; the two top-5 panels are distinct from the catalogs */
.cat-panel { --pc: #EEF1F0; --pb: #D5DCDA; background: var(--pc); border-color: var(--pb); }
.cat-panel dl > div, .top-panel li { border-top-color: var(--pb); }
.top-quoted   { --pc: #E1EEEC; --pb: #BCD6D2; }
.top-invoiced { --pc: #F4EBD2; --pb: #E0D3AA; }
.cat-panels .cat-panel:nth-child(8n+1) { --pc: #E4EAF3; --pb: #C6D2E4; }
.cat-panels .cat-panel:nth-child(8n+2) { --pc: #EAE5F3; --pb: #D2C9E4; }
.cat-panels .cat-panel:nth-child(8n+3) { --pc: #F4E6E3; --pb: #E4CBC6; }
.cat-panels .cat-panel:nth-child(8n+4) { --pc: #E5F0E3; --pb: #C8DDC4; }
.cat-panels .cat-panel:nth-child(8n+5) { --pc: #F5E9DB; --pb: #E4D1B8; }
.cat-panels .cat-panel:nth-child(8n+6) { --pc: #E2EEF0; --pb: #C2DADE; }
.cat-panels .cat-panel:nth-child(8n+7) { --pc: #F2E4EC; --pb: #E2C8D6; }
.cat-panels .cat-panel:nth-child(8n+8) { --pc: #EDEBDD; --pb: #D9D5BC; }

/* Time-frame pills on the Albums page */
.year-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.pill-filter { display: inline-block; padding: 4px 14px; border: 1px solid var(--hairline); border-radius: 999px; background: #fff; color: var(--ink); font-size: 0.85rem; text-decoration: none; }
.pill-filter:hover { background: var(--teal-tint); }
.pill-filter.is-on { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }

/* Albums page: cover grid */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 22px 18px; margin: 14px 0 30px; }
.album-tile { display: flex; flex-direction: column; min-width: 0; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.album-tile[hidden] { display: none; }
.album-cover { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--paper); }
.album-info { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px 10px; min-width: 0; }
.album-name { font-weight: 700; font-size: 0.9rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-code { font-size: 0.8rem; color: var(--ink-muted); }
.album-date { display: flex; justify-content: space-between; gap: 8px; font-size: 0.78rem; color: var(--ink-muted); }
.album-info .tier-cell { margin-top: 6px; font-size: 0.8rem; }
.tier-pill-tier { color: var(--ink); }
.tier-pill-tier.is-active { background: var(--teal-tint); border-color: var(--teal-dark); }

.album-grid { grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); }
.album-date { white-space: nowrap; }

/* Tier filter pills: the tier chip is the pill, so no second outline around it */
.tier-pill.tier-pill-tier { border-color: transparent; padding: 2px 8px 2px 2px; color: var(--ink); }
.tier-pill.tier-pill-tier:hover { background: var(--teal-tint); }
.tier-pill.tier-pill-tier.is-active { background: var(--teal-tint); border-color: var(--teal-dark); }

.tier-chip.tier-all { background: #fff; border-color: var(--hairline); color: var(--ink); }

/* Album editor popup */
.album-tile { cursor: pointer; transition: box-shadow 0.15s, transform 0.15s; }
.album-tile:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16); transform: translateY(-2px); }
.album-tile:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.ae-overlay { padding-top: 4vh; }
.ae-dialog { max-width: 1180px; }
.ae-code { color: var(--ink-muted); font-weight: 500; margin-right: 6px; }
.ae-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 26px; align-items: start; }
.ae-cover { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--hairline); background: var(--paper); }
.ae-stats { margin: 16px 0 12px; }
.ae-stats > div { padding: 8px 0; border-top: 1px solid var(--hairline); }
.ae-stats dt { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-muted); }
.ae-stats dd { margin: 2px 0 0; font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.ae-stats dd span { margin-left: 8px; font-size: 0.8rem; font-weight: 400; color: var(--ink-muted); }
.ae-meta { font-size: 0.85rem; }
.ae-meta > div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.ae-meta span { color: var(--ink-muted); }
.ae-tier-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hairline); font-size: 0.85rem; }
.ae-tier-row > span:first-child { color: var(--ink-muted); }
.ae-tier-row select { width: auto; min-width: 140px; }
.ae-main { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ae-panel { border: 1px solid var(--hairline); border-radius: var(--radius); padding: 10px 12px 8px; min-width: 0; background: var(--paper); }
.ae-panel:first-child { grid-column: 1 / -1; }
.ae-panel h4 { margin: 0 0 6px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
.ae-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.ae-table th { text-align: left; font-weight: 500; color: var(--ink-muted); padding: 3px 6px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.ae-table td { padding: 4px 6px; border-bottom: 1px solid var(--hairline); font-variant-numeric: tabular-nums; }
.ae-table .num { text-align: right; white-space: nowrap; }
.ae-table .ae-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ae-table tbody tr:last-child td { border-bottom: 0; }
.ae-q { color: #1F6F6A; }
.ae-i { color: #8A6A12; }
.ae-q span, .ae-i span { color: var(--ink-muted); }
.ae-note { grid-column: 1 / -1; margin: 2px 0 0; font-size: 0.78rem; }
@media (max-width: 900px) { .ae-body { grid-template-columns: 1fr; } .ae-main { grid-template-columns: 1fr; } .ae-cover { max-width: 260px; } }

/* Album editor tables: fixed columns so long names are cut off with "…" instead of pushing the numbers out of the panel */
.ae-table { table-layout: fixed; }
.ae-table th:nth-child(2), .ae-table td:nth-child(2) { width: 92px; }
.ae-table th:nth-child(3), .ae-table td:nth-child(3) { width: 92px; }
.ae-table th:nth-child(4), .ae-table td:nth-child(4) { width: 78px; }
.ae-table .ae-name { max-width: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }
.ae-table th { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .ae-table th:nth-child(2), .ae-table td:nth-child(2), .ae-table th:nth-child(3), .ae-table td:nth-child(3) { width: 92px; } }

.ae-years { margin: 0 0 14px; }
button.pill-filter { font: inherit; font-size: 0.85rem; cursor: pointer; }
.ae-body.is-loading { opacity: 0.55; transition: opacity 0.1s; }

/* Licensed tracks table in the album editor */
.ae-lic { grid-column: 1 / -1; }
.ae-lic-table th:nth-child(1), .ae-lic-table td:nth-child(1) { width: 92px; }
.ae-lic-table th:nth-child(6), .ae-lic-table td:nth-child(6), .ae-lic-table th:nth-child(7), .ae-lic-table td:nth-child(7) { width: 92px; }
.ae-lic-table th:nth-child(4), .ae-lic-table td:nth-child(4), .ae-lic-table th:nth-child(5), .ae-lic-table td:nth-child(5) { width: 15%; }
.ae-lic-table td:nth-child(1) { white-space: nowrap; }
.ae-lic-table .ae-name a { color: inherit; text-decoration: underline; }
.ae-date { display: block; font-size: 0.72rem; color: var(--ink-muted); }
.ae-lic-pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }
.ae-lic-body.is-loading { opacity: 0.55; }

/* Licensed tracks table: its own warm colour with alternating rows, so it reads as a different kind of list */
.ae-panel.ae-lic { background: #F8F2E0; border-color: #E3D6AE; }
.ae-lic .ae-table th { border-bottom-color: #E3D6AE; }
.ae-lic .ae-table td { border-bottom: 0; }
.ae-lic .ae-table tbody tr:nth-child(odd) { background: #FFFBEE; }
.ae-lic .ae-table tbody tr:nth-child(even) { background: #F0E6C8; }
.ae-lic .ae-table td:first-child { border-radius: 4px 0 0 4px; }
.ae-lic .ae-table td:last-child { border-radius: 0 4px 4px 0; }

/* project shown in a window over the album editor */
.ae-proj-overlay { z-index: 1100; padding-top: 3vh; }
.ae-proj-dialog { max-width: 1180px; padding-bottom: 14px; }
.ae-proj-frame { display: block; width: 100%; height: 82vh; border: 1px solid var(--hairline); border-radius: var(--radius); background: #fff; }

/* Dashboard */
.dash-soon { opacity: 0.45; cursor: default; }
.dash-soon:hover { background: #fff; }
.dash-panel { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px 22px 20px; --dq: #1B4FD8; --di: #C9701F; --dn: #C2543F; --dp: #4E8A22; }
.dash-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.dash-head h2 { margin: 0; font-size: 0.95rem; letter-spacing: 0.18em; text-transform: uppercase; }
.dash-tools { display: flex; align-items: center; gap: 10px; }
.dash-toggle { display: inline-flex; border: 1px solid var(--hairline); border-radius: 999px; overflow: hidden; }
.dash-toggle a { padding: 5px 16px; font-size: 0.85rem; color: var(--ink-muted); text-decoration: none; }
.dash-toggle a.is-on { background: var(--teal-dark); color: #fff; }
.dash-range { position: relative; }
.dash-range-btn { border: 1px solid var(--hairline); background: #fff; border-radius: var(--radius); padding: 5px 12px; cursor: pointer; font-size: 0.95rem; }
.dash-range-btn.is-on { border-color: var(--teal-dark); background: var(--teal-tint); }
.dash-range-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; background: #fff; border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: 0 6px 20px rgba(0,0,0,0.12); padding: 12px; display: grid; gap: 8px; min-width: 220px; }
.dash-range-pop[hidden] { display: none; }
.dash-range-pop { grid-template-columns: 1fr; min-width: 250px; }
.dash-presets { display: grid; gap: 2px; border-top: 1px solid var(--hairline); padding-top: 8px; margin-top: 2px; }
.dash-presets a { padding: 5px 8px; border-radius: var(--radius); color: var(--ink); text-decoration: none; font-size: 0.85rem; }
.dash-presets a:hover { background: var(--teal-tint); }
.dash-presets a.is-on { background: var(--teal-dark); color: #fff; }
.dash-range-pop label { display: grid; gap: 3px; font-size: 0.8rem; color: var(--ink-muted); }
.dash-scroll { max-height: 560px; overflow-y: auto; border-top: 1px solid var(--hairline); }
.dash-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.dash-table th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 12px 10px; background: var(--paper); position: sticky; top: 0; }
.dash-table td { padding: 14px 10px; border-bottom: 1px solid var(--hairline); font-size: 1.05rem; font-variant-numeric: tabular-nums; vertical-align: top; }
.dash-table th:first-child, .dash-table td:first-child { width: 24%; }
.dash-date { color: var(--ink-muted); }
.dash-sw { display: inline-block; width: 11px; height: 11px; margin-right: 8px; vertical-align: -1px; }
.dash-quoted { background: var(--dq); } .dash-invoiced { background: var(--di); } .dash-nontrack { background: var(--dn); } .dash-paid { background: var(--dp); }
.dash-quoted-t { color: var(--dq); } .dash-invoiced-t { color: var(--di); } .dash-nontrack-t { color: var(--dn); } .dash-paid-t { color: var(--dp); }
.dash-foot { margin-top: 6px; border-top: 2px solid var(--hairline); }
.dash-foot td { border-bottom: 0; }
.dash-cur td { font-weight: 700; padding-bottom: 4px; }
.dash-cur .dash-date { color: var(--ink); }
.dash-prev .dash-date { color: var(--ink); }
.dash-pct { display: block; font-size: 0.9rem; margin-top: 2px; }
.dash-up { color: #1F8A3B; } .dash-down { color: #D62E22; } .dash-flat { color: var(--ink-muted); }
@media (max-width: 700px) { .dash-table td, .dash-table th { padding: 10px 4px; font-size: 0.85rem; } .dash-head { flex-wrap: wrap; } }

/* Dashboard: recent activity */
.dash-recent { margin-top: 18px; }
.dash-act th.num, .dash-act td.num { text-align: right; }
.dash-act td { font-size: 0.92rem; padding: 10px; }
.dash-act th:nth-child(1), .dash-act td:nth-child(1) { width: 100px; }
.dash-act th:nth-child(4), .dash-act td:nth-child(4) { width: 120px; }
.dash-act th:nth-child(5), .dash-act td:nth-child(5) { width: 130px; }
.dash-act tr[hidden] { display: none; }
.dash-clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-clip a { color: var(--teal-dark); text-decoration: none; }
.dash-clip a:hover { text-decoration: underline; }
.dash-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.dash-badge-quote { background: #E3EAFB; color: #1B4FD8; }
.dash-badge-confirm { background: #E4F1D9; color: #3F7A17; }

/* Dashboard layout: stats and recent activity side by side, snapshot chart underneath */
.dash-main { max-width: 1500px; margin: 0 auto; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: stretch; }
.dash-grid .dash-panel { margin: 0; display: flex; flex-direction: column; min-width: 0; }
.dash-grid .dash-scroll { max-height: 520px; flex: 1 1 auto; }
.dash-recent { margin-top: 0; }
.dash-snap { margin-top: 18px; }
.dash-legend { display: flex; gap: 18px; font-size: 0.85rem; color: var(--ink-muted); margin-bottom: 6px; }
.dash-chart svg { width: 100%; height: auto; display: block; }
.dash-sub { display: block; font-size: 0.78rem; color: var(--ink-muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; }
.dash-act th:nth-child(1), .dash-act td:nth-child(1) { width: 110px; }
.dash-act th:nth-child(3), .dash-act td:nth-child(3) { width: 100px; }
.dash-act th:nth-child(2), .dash-act td:nth-child(2) { width: auto; }
.dash-act td { vertical-align: middle; }
@media (max-width: 1300px) { .dash-grid { grid-template-columns: 1fr; } .dash-recent { margin-top: 0; } }

/* Dashboard: values that download a CSV */
.dash-dl { color: inherit; text-decoration: none; border-bottom: 1px dotted currentColor; }
.dash-dl:hover { border-bottom-style: solid; }

/* Dashboard: albums view */
.dash-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.dash-card { display: flex; gap: 16px; align-items: flex-start; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 18px; min-width: 0; }
.dash-cover { flex: 0 0 auto; width: 112px; height: 112px; object-fit: cover; border: 1px solid var(--hairline); border-radius: 2px; background: var(--paper); display: block; }
.dash-cover-none { background: var(--paper); }
.dash-card-body { min-width: 0; flex: 1 1 auto; }
.dash-card-body h3 { margin: 0; font-size: 1rem; font-weight: 500; line-height: 1.25; }
.dash-card-quoted h3 { color: #1B4FD8; } .dash-card-invoiced h3 { color: #C9701F; }
.dash-card-span { font-size: 0.85rem; color: var(--ink-muted); margin: 3px 0 12px; }
.dash-card-name { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.35; overflow-wrap: anywhere; }
.dash-card-val { font-size: 1.9rem; font-weight: 600; line-height: 1.15; margin-top: 8px; font-variant-numeric: tabular-nums; }
.dash-card-count { font-size: 0.8rem; color: var(--ink-muted); margin-top: 2px; }
@media (max-width: 1300px) { .dash-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .dash-cards { grid-template-columns: 1fr; } }

/* Dashboard: company view */
.dash-seg { display: inline-flex; align-items: stretch; border: 1px solid var(--hairline); border-radius: 999px; overflow: hidden; max-width: 100%; }
.dash-seg-arrow { border: 0; background: #fff; padding: 0 14px; font-size: 1.2rem; cursor: pointer; color: var(--ink); }
.dash-seg-arrow:hover { background: var(--teal-tint); }
.dash-seg-track { display: flex; overflow-x: auto; scrollbar-width: none; width: 400px; max-width: 100%; border-left: 1px solid var(--hairline); border-right: 1px solid var(--hairline); }
.dash-seg-track::-webkit-scrollbar { display: none; }
.dash-seg-track a { flex: 0 0 80px; text-align: center; padding: 6px 0; font-size: 0.85rem; color: var(--ink-muted); text-decoration: none; border-right: 1px solid var(--hairline); }
.dash-seg-track a:last-child { border-right: 0; }
.dash-seg-track a.is-on { background: var(--teal-dark); color: #fff; }
.dash-co th.num, .dash-co td.num { text-align: right; width: 150px; }
.dash-co td { font-size: 0.95rem; padding: 11px 10px; }
.dash-co th:first-child, .dash-co td:first-child { width: auto; }
.dash-co-total td { font-weight: 700; border-top: 2px solid var(--hairline); background: var(--paper); }
.dash-legend-wrap { flex-wrap: wrap; row-gap: 6px; }
.dash-legend-wrap span { cursor: default; padding: 2px 6px; border-radius: 3px; }
.dash-legend-wrap span:hover { background: var(--teal-tint); }

/* Dashboard: export buttons at the top */
.dash-topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dash-exports { position: relative; display: flex; gap: 8px; margin: 4px 0 14px; }
.dash-export-pop { min-width: 250px; }
.dash-export-title { font-weight: 600; font-size: 0.9rem; }
.dash-export-custom { display: grid; gap: 8px; border-top: 1px solid var(--hairline); padding-top: 8px; }
.dash-export-custom label { display: grid; gap: 3px; font-size: 0.8rem; color: var(--ink-muted); }

/* Composers page */
.comp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.comp-head h2 { margin: 0; }
.comp-head input[type=search] { width: 260px; max-width: 100%; }
.comp-note { margin: 10px 0 12px; }
.comp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.comp-card { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.comp-card h3 { margin: 0 0 10px; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-line { display: grid; grid-template-columns: 64px 1fr auto; align-items: baseline; gap: 6px; padding: 4px 0; font-variant-numeric: tabular-nums; }
.comp-lab { font-size: 0.78rem; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.comp-amt { font-size: 1.15rem; font-weight: 600; }
.comp-cnt { font-size: 0.8rem; color: var(--ink-muted); }
.comp-q .comp-amt { color: #1B4FD8; } .comp-l .comp-amt { color: #C9701F; }
.comp-foot { margin-top: 18px; }

/* Composers: contact link line and chooser */
.comp-card h3 { margin-bottom: 2px; }
.comp-sub { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 0.8rem; min-height: 1.3em; }
.comp-email { color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.comp-linkbtn { border: 0; background: none; padding: 0; font: inherit; font-size: 0.8rem; cursor: pointer; text-decoration: underline; flex: 0 0 auto; }
.comp-warn { color: var(--amber); }
.comp-change { color: var(--teal); }
.cmp-overlay { position: fixed; inset: 0; background: rgba(20, 30, 28, 0.45); z-index: 1200; display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.cmp-dialog { background: #fff; border-radius: var(--radius); width: min(560px, 92vw); max-height: 78vh; overflow: auto; padding: 18px 20px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
.cmp-dialog h3 { margin: 0 0 6px; }
.cmp-dialog input[type=search] { width: 100%; margin: 6px 0 10px; }
.cmp-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--hairline); }
.cmp-info { display: grid; min-width: 0; }
.cmp-info span { font-size: 0.82rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

.comp-tools { display: flex; align-items: center; gap: 10px; }

.comp-idle .comp-amt { color: var(--ink-muted); }
.comp-idle h3 { font-weight: 500; }

.cmp-likely { font-style: normal; font-weight: 500; font-size: 0.72rem; color: var(--amber); background: #FBF1DE; border-radius: 999px; padding: 1px 8px; margin-left: 4px; }

.comp-filter { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 12px 0 0; }
.comp-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; cursor: pointer; }

.comp-filter .comp-sort { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; font-size: 0.9rem; white-space: nowrap; margin: 0; }
.comp-filter .comp-sort select { width: auto; flex: 0 0 auto; }
.comp-filter input[type=search] { width: 240px; flex: 0 0 auto; }
.comp-filter .comp-check { white-space: nowrap; }

/* Composer popup */
.comp-click { cursor: pointer; }
.comp-click:hover { border-color: var(--teal-dark); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.comp-click:focus-visible { outline: 2px solid var(--teal-dark); outline-offset: 2px; }
.cd-dialog { width: min(1120px, 96vw); max-height: 90vh; display: flex; flex-direction: column; padding: 0; }
.cd-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--hairline); }
.cd-head h3 { margin: 0; font-size: 1.2rem; }
.cd-close { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-muted); }
.cd-body { overflow-y: auto; padding: 8px 20px 20px; }
.cd-sec { padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.cd-sec:last-child { border-bottom: 0; }
.cd-sec h4 { margin: 0 0 10px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); }
.cd-row { display: flex; gap: 12px; padding: 3px 0; font-size: .92rem; }
.cd-lab { flex: 0 0 90px; color: var(--ink-muted); }
.cd-val a { color: var(--teal-dark); }
.cd-sec .comp-sub { margin-top: 8px; }
.cd-seg { margin: 0 0 12px; }
.cd-sum { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cd-stat { flex: 1 1 200px; border: 1px solid var(--hairline); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; }
.cd-stat strong { font-size: 1.5rem; }
.cd-stat-lab, .cd-stat-cnt { font-size: .8rem; color: var(--ink-muted); }
.cd-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cd-table th, .cd-table td { padding: 5px 8px; border-bottom: 1px solid var(--hairline); text-align: left; }
.cd-table .num { text-align: right; white-space: nowrap; }
.cd-dim { color: var(--ink-muted); }
.cd-msg, .cd-note { font-size: .82rem; color: var(--ink-muted); margin: 8px 0 0; }

.cd-top { display: grid; grid-template-columns: 1.4fr 1fr; gap: 0; border-bottom: 1px solid var(--hairline); }
.cd-top .cd-sec { border-bottom: 0; }
@media (max-width: 640px) { .cd-top { grid-template-columns: 1fr; } }
.cd-top .cd-sec + .cd-sec { border-left: 1px solid var(--hairline); padding-left: 32px; }
.cd-top .cd-sec:first-child { padding-right: 32px; }
@media (max-width: 640px) { .cd-top .cd-sec + .cd-sec { border-left: 0; padding-left: 0; border-top: 1px solid var(--hairline); } .cd-top .cd-sec:first-child { padding-right: 0; } }

.cd-hint { margin: -4px 0 8px; font-size: .8rem; color: var(--ink-muted); }
.cd-scroll { max-height: 340px; overflow-y: auto; border: 1px solid var(--hairline); border-radius: 8px; }
.cd-scroll .cd-table th { position: sticky; top: 0; background: #fff; z-index: 1; }
.cd-album { display: flex; align-items: center; gap: 10px; }
.cd-art { width: 36px; height: 36px; flex: none; border: 1px solid var(--hairline); border-radius: 3px; background: var(--paper); overflow: hidden; }
.cd-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* popup: colour-coded cards so each table reads as its own thing */
.cd-body { background: var(--paper); padding: 16px 20px 20px; }
.cd-body > .cd-top, .cd-body > .cd-sec { background: #fff; border: 1px solid var(--hairline); border-radius: 10px; margin-bottom: 14px; }
.cd-body > .cd-sec { padding: 14px 18px; }
.cd-top .cd-sec { padding: 14px 18px; }
.cd-card { background: #fff; border: 1px solid var(--hairline); border-top: 4px solid var(--acc, var(--teal)); border-radius: 10px; margin-bottom: 14px; padding: 12px 18px 16px; }
.cd-a-projects { --acc: #14615A; --acc-tint: #E4EEEC; }
.cd-a-tracks { --acc: #5B4BB7; --acc-tint: #EEEBFA; }
.cd-a-albums { --acc: #B4852A; --acc-tint: #F7F0DF; }
.cd-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.cd-card-head h4 { margin: 0; font-size: 1.05rem; text-transform: none; letter-spacing: 0; color: var(--acc); }
.cd-chip { background: var(--acc-tint); color: var(--acc); font-size: .72rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.cd-card .cd-hint { margin: 0 0 10px; }
.cd-card .cd-scroll { border: 0; border-radius: 6px; }
.cd-card .cd-table th { background: var(--acc-tint); color: var(--ink); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; border-bottom: 0; }
.cd-card .cd-table tbody tr:nth-child(even) td { background: #FAFBFB; }
.cd-card .cd-table tbody tr:hover td { background: var(--acc-tint); }
.cd-card .cd-table th.cd-qh { color: #1B4FD8; } .cd-card .cd-table th.cd-ih { color: #C9701F; }
.cd-q { color: #1B4FD8; font-weight: 600; } .cd-i { color: #C9701F; font-weight: 600; } .cd-zero { color: #B3BBB9 !important; font-weight: 400; }
.cd-strong { font-weight: 600; }
.cd-pct { position: relative; min-width: 90px; }
.cd-bar { position: absolute; right: 8px; bottom: 3px; height: 3px; background: var(--acc); opacity: .45; border-radius: 2px; }
.cd-note { margin: 4px 2px 0; }

/* best genres */
.cd-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cd-tag { background: var(--teal-tint); color: var(--teal-dark); font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.cd-tag-more { background: var(--paper); color: var(--ink-muted); }
.comp-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.cd-gover { z-index: 1300; }
.cd-gdialog { width: min(720px, 94vw); max-height: 86vh; display: flex; flex-direction: column; padding: 0; }
.cd-gbody { padding: 14px 20px; overflow-y: auto; flex: 1; }
.cd-gsearch { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--hairline); border-radius: 8px; font-size: .9rem; margin-bottom: 8px; }
.cd-glist h5 { margin: 14px 0 6px; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
.cd-ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.cd-gitem { display: flex; align-items: center; gap: 8px; border: 1px solid var(--hairline); border-radius: 8px; padding: 6px 10px; font-size: .86rem; cursor: pointer; }
.cd-gitem:hover { border-color: var(--teal); }
.cd-gitem.is-on { background: var(--teal-tint); border-color: var(--teal); font-weight: 600; }
.cd-gitem em { margin-left: auto; font-style: normal; font-size: .72rem; color: var(--ink-muted); font-weight: 400; }
.cd-gfoot { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--hairline); }
.cd-gcount { margin-right: auto; font-size: .82rem; color: var(--ink-muted); }

.cd-autonote { margin-top: 4px; font-size: .74rem; color: var(--ink-muted); }
.cd-gsmall { width: min(460px, 94vw); }

/* Contacts page */
.ct-sync { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ct-synced { font-size: .85rem; color: var(--ink-muted); }
.ct-syncmsg { margin: 4px 0 12px; }
.ct-syncmsg.bad { color: #B3261E; }
.ct-tabs { margin: 8px 0 14px; }
.ct-tabs a { display: inline-flex; align-items: center; gap: 8px; }
.ct-n { font-size: .72rem; background: var(--teal-tint); color: var(--teal-dark); padding: 1px 7px; border-radius: 999px; }
.ct-tabs a.is-on .ct-n { background: rgba(255,255,255,.2); color: #fff; }
.ct-none { color: var(--ink-muted); font-style: italic; }
.ct-org { margin-top: 4px; font-size: .8rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-list { display: flex; flex-direction: column; gap: 3px; }
.ct-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ct-type { font-size: .72rem; text-transform: capitalize; }
.ct-addr { white-space: pre-line; }
.ct-notes { white-space: pre-wrap; margin: 0; font-size: .9rem; }

.ct-pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
.ct-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--hairline); border-radius: 999px; padding: 4px 12px; font-size: .82rem; color: var(--ink-muted); text-decoration: none; background: #fff; }
.ct-pill:hover { border-color: var(--teal); color: var(--teal-dark); }
.ct-pill.is-on { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.ct-pill-n { font-size: .7rem; background: var(--teal-tint); color: var(--teal-dark); padding: 0 6px; border-radius: 999px; }
.ct-pill.is-on .ct-pill-n { background: rgba(255,255,255,.2); color: #fff; }

/* label pills: a colour each, in the same palette as the popups and charts */
.ct-pill { --pc: var(--teal-dark); --pt: var(--teal-tint); font-weight: 600; }
.ct-pill.ct-c0 { --pc: #14615A; --pt: #E4EEEC; }
.ct-pill.ct-c1 { --pc: #5B4BB7; --pt: #EEEBFA; }
.ct-pill.ct-c2 { --pc: #B4852A; --pt: #F7F0DF; }
.ct-pill.ct-c3 { --pc: #1B4FD8; --pt: #E8EEFC; }
.ct-pill.ct-c4 { --pc: #C9701F; --pt: #FBEEE0; }
.ct-pill.ct-c5 { --pc: #B23A5E; --pt: #FBE9EF; }
.ct-pill:not(.ct-all) { background: var(--pt); border-color: var(--pc); color: var(--pc); }
.ct-pill:not(.ct-all) .ct-pill-n { background: #fff; color: var(--pc); }
.ct-pill:not(.ct-all):hover { filter: brightness(.97); border-color: var(--pc); color: var(--pc); }
.ct-pill:not(.ct-all).is-on { background: var(--pc); border-color: var(--pc); color: #fff; }
.ct-pill:not(.ct-all).is-on .ct-pill-n { background: rgba(255,255,255,.25); color: #fff; }
.ct-pill.ct-all { background: #fff; color: var(--ink); border-color: var(--ink-muted); }
.ct-pill.ct-all .ct-pill-n { background: var(--paper); color: var(--ink); }
.ct-pill.ct-all.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.ct-pill.ct-all.is-on .ct-pill-n { background: rgba(255,255,255,.25); color: #fff; }

.cd-head .ct-edit { margin-left: auto; margin-right: 14px; font-size: .82rem; padding: 5px 12px; white-space: nowrap; }

/* cleanup */
.comp-filter .ct-clean { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
.ct-clean-n { font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: #E3F1E8; color: #1E6B3A; }
.ct-clean.has-issues .ct-clean-n { background: #FBEEE0; color: #C9701F; }
.cd-a-rose { --acc: #B23A5E; --acc-tint: #FBE9EF; }
.cd-a-blue { --acc: #1B4FD8; --acc-tint: #E8EEFC; }
.cd-a-orange { --acc: #C9701F; --acc-tint: #FBEEE0; }
.ct-grouprow td { background: var(--acc-tint); color: var(--acc); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px; }
.cd-card .cd-table tbody tr.ct-grouprow:hover td { background: var(--acc-tint); }
.ct-flag { font-size: .8rem; color: var(--acc, var(--ink-muted)); }
.ct-wrap { word-break: break-all; max-width: 340px; }

.cd-card .cd-table tbody tr.ct-totalrow td { background: var(--acc-tint); border-top: 2px solid var(--acc); font-weight: 700; }
.cd-card .cd-table tbody tr.ct-totalrow:hover td { background: var(--acc-tint); }

.comp-line.ct-zero .comp-amt { color: var(--ink-muted); font-weight: 400; }

/* Contacts: QuickBooks customer link */
.ct-qbrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.ct-qbname { font-size: 15px; }
.ct-qbpick { margin-top: 10px; border: 1px solid var(--line, #e3e1da); border-radius: 8px; padding: 8px; background: var(--surface, #fff); }
.ct-qbsearch { width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--line, #d8d5cc); border-radius: 6px; font: inherit; margin-bottom: 6px; }
.ct-qblist { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.ct-qbitem { text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; font: inherit; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.ct-qbitem:hover, .ct-qbitem.is-on { background: rgba(27, 79, 216, .09); }
.ct-qbtag { font-size: 11px; font-weight: 600; color: #14615A; background: rgba(20, 97, 90, .12); padding: 1px 7px; border-radius: 999px; }
.ct-qbtag-dim { color: #6b6b6b; background: rgba(0, 0, 0, .07); }

/* Import page */
.im-lead { margin: 4px 0 14px; color: var(--muted, #5b6b69); max-width: 70ch; }
.im-card { margin-bottom: 16px; }
.im-card h3 { display: flex; align-items: center; gap: 12px; margin: 0 0 10px; }
.im-files { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end; }
.im-files label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.im-small { font-size: 13px; color: var(--muted, #5b6b69); }
.im-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.im-stat { border: 1px solid var(--line, #e3e1da); border-radius: 8px; padding: 8px 14px; min-width: 120px; display: flex; flex-direction: column; }
.im-stat b { font-size: 20px; }
.im-stat span { font-size: 12px; color: var(--muted, #5b6b69); }
.im-fix { margin-top: 16px; }
.im-ok { color: #14615A; font-weight: 600; }
.im-err { color: #B23A5E; }
.im-pick input { width: 100%; box-sizing: border-box; padding: 6px 9px; border: 1px solid var(--line, #d8d5cc); border-radius: 6px; font: inherit; }
.im-results { max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; }
.im-res { text-align: left; background: none; border: 0; padding: 5px 8px; border-radius: 5px; font: inherit; cursor: pointer; }
.im-res:hover { background: rgba(27, 79, 216, .09); }
.im-sub { color: var(--muted, #5b6b69); font-size: 12px; }
.im-step { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(120px, 1fr) auto auto; gap: 8px 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line, #e3e1da); }
.im-step .status { grid-column: 1 / -1; margin: 0; }
.im-bar { height: 8px; background: rgba(0, 0, 0, .08); border-radius: 999px; overflow: hidden; }
.im-fill { height: 100%; background: #14615A; width: 0; }

/* Projects page paging */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 10px; margin: 26px 0 8px; }
.pager-info { font-size: 0.85rem; color: var(--ink-muted); padding: 0 8px; }

/* A track quoted more than once in a project: one entry that opens to each quote */
.quote-multi { border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--panel); margin: 10px 0; }
.quote-multi > summary { display: grid; grid-template-columns: 28px minmax(160px, 2fr) minmax(120px, 1.4fr) 110px 110px 80px; gap: 14px; align-items: center; cursor: pointer; list-style: none; position: relative; padding: 12px 14px 12px 34px; }
.quote-multi > summary::-webkit-details-marker { display: none; }
.quote-multi > summary::marker { content: ""; }
.quote-multi > summary::before { content: ""; position: absolute; left: 14px; top: 50%; width: 0; height: 0; margin-top: -5px; border-left: 7px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; transition: transform .12s; }
.quote-multi[open] > summary::before { transform: rotate(90deg); }
.quote-multi .quote-track { display: block; min-width: 0; }
.quote-multi .quote-composers { display: block; margin-top: 2px; font-size: .8rem; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-multi .quote-album { color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quote-multi .quote-total, .quote-multi .quote-invoiced { text-align: right; font-weight: 600; }
.quote-times { margin-left: 4px; font-size: .75rem; }
.quote-multi-body { padding: 0 0 10px 22px; border-top: 1px solid var(--hairline); }
.quote-multi-body > .quote-group { margin: 8px 0 0; background: var(--paper); }
@media (max-width: 760px) {
  .quote-multi > summary { grid-template-columns: 28px 1fr auto; }
  .quote-multi .quote-album, .quote-multi .quote-invoiced { display: none; }
}

/* Change a quote's track */
.q-trackpanel { margin: 8px 14px 12px; padding: 10px 12px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--paper); }
.q-trackpanel input { width: 100%; box-sizing: border-box; margin-top: 6px; }
.q-trackres { display: flex; flex-direction: column; max-height: 220px; overflow-y: auto; margin-top: 6px; }
.q-trackpick { text-align: left; background: none; border: 0; padding: 6px 8px; border-radius: 5px; font: inherit; cursor: pointer; }
.q-trackpick:hover { background: rgba(27, 79, 216, .09); }

/* Pull a single track from SourceAudio */
.q-pull { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hairline); }
.q-pull .q-pull-id { width: 160px; margin-top: 0; }
.q-pull-out { margin-top: 6px; }

.sync-single-id { margin: 10px 6px 0 0; width: 170px; }
.sync-single-out { margin-top: 10px; }
.sync-single-out.bad { color: #b3261e; }

.dash-yoy { display: inline-block; margin-right: 10px; font-weight: 700; font-size: 1.05rem; line-height: 1; cursor: help; }

/* Royalty check */
.rc-cards { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.rc-card { border: 1px solid var(--line, #d7dedc); border-radius: 8px; padding: 10px 14px; min-width: 130px; }
.rc-card-n { font-size: 1.25rem; font-weight: 700; }
.rc-card-l { font-size: 0.82rem; color: var(--ink-muted, #5b6663); }
.rc-up { color: #1F8A3B; font-weight: 600; } .rc-down { color: #D62E22; font-weight: 600; }
.rc-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.8rem; background: #eef1f0; }
.rc-badge.rc-differs { background: #fdeccd; } .rc-badge.rc-sheet_only { background: #fbd9d5; } .rc-badge.rc-syncx_only { background: #dbe6fb; } .rc-badge.rc-match { background: #dcf1e2; }
.rc-warn { color: #B3261E; font-weight: 600; }
.rc-in { width: 100%; min-width: 220px; }
.rc-vendors { margin: 12px 0; }
.rc-vendors summary { cursor: pointer; font-weight: 600; }
.rc-lines > td { background: rgba(0, 0, 0, 0.03); padding: 10px 14px; }
.rc-sub { margin-bottom: 6px; font-size: 0.88rem; color: var(--ink-muted, #5b6663); }
.rc-lt { margin: 0; }
td.num, th.num { text-align: right; }

.rc-badge.rc-shifted { background: #e6e0f5; } .rc-note { font-size: 0.78rem; color: var(--ink-muted, #5b6663); margin-top: 2px; }

.rc-badge.rc-t-match { background: #dcf1e2; } .rc-badge.rc-t-less { background: #fbd9d5; } .rc-badge.rc-t-more { background: #dbe6fb; }

.bill-datefixed { padding: 9px 12px; border: 1px solid var(--line, #d7dedc); border-radius: 6px; background: rgba(0,0,0,0.03); }
.rc-badge.rc-invoices { background: #fdf3c8; }

/* ---- Search box (top bar), results and track card ---- */
.gsearch { position: relative; flex: 1 1 260px; max-width: 420px; margin: 0 16px; }
.gsearch input[type="search"] { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--hairline); border-radius: var(--radius); background: var(--paper); font: inherit; font-size: 0.9rem; color: var(--ink); }
.gsearch input[type="search"]:focus { outline: 2px solid var(--teal); outline-offset: 0; background: var(--panel); }
.gs-drop { position: absolute; top: calc(100% + 6px); left: 0; width: min(560px, 92vw); max-height: 75vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(26, 36, 33, .18); z-index: 60; text-align: left; }
.gs-drop[hidden] { display: none; }
.gs-group { padding: 4px 0 6px; }
.gs-group + .gs-group { border-top: 1px solid var(--hairline); }
.gs-head { padding: 8px 14px 4px; font-size: 0.72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 7px 14px; color: var(--ink); text-decoration: none; font-size: 0.9rem; cursor: pointer; border-bottom: 0 !important; }
.gs-item:hover, .gs-item.gs-active { background: var(--teal-tint); color: var(--ink); }
.gs-static { cursor: default; }
.gs-static:hover { background: none; }
.gs-main { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-side { flex: 0 0 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-muted); font-size: 0.82rem; }
.gs-dim { color: var(--ink-muted); font-weight: 400; }
.gs-poster { width: 30px; height: 44px; object-fit: cover; border-radius: 2px; background: var(--hairline); flex: 0 0 30px; }
.gs-tag { display: inline-block; padding: 1px 6px; border-radius: 9px; background: var(--paper); border: 1px solid var(--hairline); font-size: 0.72rem; color: var(--ink-muted); }
.gs-tag.gs-paid { background: var(--teal-tint); color: var(--teal-dark); border-color: var(--teal-tint); }
.gs-plus { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--teal); color: var(--teal); font-size: 1.1rem; line-height: 1; }
.gs-item:hover .gs-plus { background: var(--teal); color: #fff; }
.gs-note { padding: 8px 14px; color: var(--ink-muted); font-size: 0.85rem; }
.gs-more, .gs-footer { display: block; padding: 6px 14px; font-size: 0.82rem; color: var(--teal); text-decoration: none; border-bottom: 0 !important; }
.gs-more:hover, .gs-footer:hover, .gs-more.gs-active, .gs-footer.gs-active { background: var(--teal-tint); }
.gs-footer { text-align: center; border-top: 1px solid var(--hairline); padding: 10px 14px; font-weight: 500; position: sticky; bottom: 0; background: var(--panel); }
#gsFull .gs-group { background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); margin-bottom: 16px; padding-bottom: 6px; }
#gsFull .gs-group + .gs-group { border-top: 1px solid var(--hairline); }
.gs-overlay { position: fixed; inset: 0; background: rgba(26, 36, 33, .45); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px; }
.gs-card { position: relative; background: var(--panel); border-radius: var(--radius); width: min(560px, 100%); max-height: 86vh; overflow-y: auto; padding: 22px 26px 24px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.gs-card h3 { margin: 0 28px 2px 0; font-size: 1.2rem; }
.gs-card h4 { margin: 18px 0 6px; font-size: 0.78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.gs-card p { margin: 2px 0; }
.gs-close { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--ink-muted); }
.gs-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 12px 0 0; font-size: 0.9rem; }
.gs-dl dt { color: var(--ink-muted); }
.gs-dl dd { margin: 0; }
.gs-list { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }
.gs-list li { padding: 3px 0; }
@media (max-width: 760px) { .gsearch { order: 3; flex: 1 1 100%; max-width: none; margin: 0; } }

/* Sync single track: a roomier dialog, with the ID box and button on their own row under the text */
.sync-dialog-wide { max-width: 560px; padding: 28px 32px 26px; }
.sync-dialog-wide h3 { margin-bottom: 14px; }
.sync-dialog-wide .sync-body { display: block; margin-bottom: 22px; }
.sync-dialog-wide .sync-single-id { width: 240px; margin: 16px 10px 0 0; padding: 9px 12px; }
.sync-dialog-wide .sync-single-go { margin-top: 16px; }

/* Search sits under the logo, so the top bar is taller but nothing is pushed off to the right */
.topbar .brand-col { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.topbar .gsearch { flex: none; width: 270px; max-width: 100%; margin: 0; }
@media (max-width: 760px) { .topbar .gsearch { order: 0; flex: none; width: 100%; } .topbar .brand-col { width: 100%; } }
.topbar .gsearch { width: 250px; }
.topbar .account { margin-left: auto; }

/* ---- Top bar, one layout at every width: logo with the search always under it on the left, menu links beside them
   (collapsing into a dropdown when they don't fit), account links on the right. ---- */
.topbar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; column-gap: 28px; row-gap: 0; padding: 14px 28px 16px; }
.topbar .topbar-left { display: contents; }
.topbar .brand-col { grid-column: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.topbar .nav-wrap { grid-column: 2; position: relative; min-width: 0; height: 36px; display: flex; align-items: center; }
.topbar .account { grid-column: 3; margin-left: 0; height: 36px; display: flex; align-items: center; }
.topbar .topnav { display: flex; flex-wrap: nowrap; gap: 18px; white-space: nowrap; }
.topbar .nav-toggle { display: none; font: inherit; font-size: 0.92rem; color: var(--ink); background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 7px 12px; cursor: pointer; }
.topbar .nav-toggle:hover { border-color: var(--teal); color: var(--teal); }
.topbar.nav-collapsed .nav-toggle { display: inline-flex; gap: 6px; align-items: center; }
.topbar.nav-collapsed .topnav { display: none; position: absolute; top: calc(100% + 4px); left: 0; z-index: 70; flex-direction: column; gap: 0; min-width: 200px; background: var(--panel); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(26, 36, 33, .18); padding: 6px 0; }
.topbar.nav-collapsed.nav-open .topnav { display: flex; }
.topbar.nav-collapsed .topnav a { padding: 9px 16px; border-bottom: 0; }
.topbar.nav-collapsed .topnav a:hover { background: var(--teal-tint); }
.topbar .gsearch { width: 250px; }
@media (max-width: 900px) { .topbar .account > span { display: none; } }
@media (max-width: 620px) {
  /* Narrow: logo on top, menu and account links in the middle, search along the bottom of the header */
  .topbar { grid-template-columns: minmax(0, 1fr) auto; row-gap: 10px; padding: 12px 16px 14px; }
  .topbar .brand-col { display: contents; }
  .topbar .brand-logo { grid-column: 1 / -1; grid-row: 1; justify-self: start; }
  .topbar .nav-wrap { grid-column: 1; grid-row: 2; }
  .topbar .account { grid-column: 2; grid-row: 2; }
  .topbar .gsearch { grid-column: 1 / -1; grid-row: 3; width: 100%; }
}

/* Collapsed menu: a hamburger button next to the settings gear; the links drop down under it, lined up with its right edge */
.topbar { position: relative; }
.topbar .nav-toggle { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-muted); cursor: pointer; }
.topbar .nav-toggle:hover, .topbar .nav-toggle[aria-expanded="true"] { background: var(--teal-tint); color: var(--teal); border: 0; }
.topbar.nav-collapsed .nav-toggle { display: inline-flex; }
.topbar.nav-collapsed .nav-wrap { display: contents; }
.topbar.nav-collapsed .topnav { position: absolute; left: auto; min-width: 210px; border-radius: var(--radius); padding: 8px 0; }
.topbar.nav-collapsed .topnav a { padding: 10px 20px; font-size: 0.95rem; }
.topbar.nav-collapsed .topnav a.active { color: var(--teal); font-weight: 600; background: var(--teal-tint); }
@media (max-width: 620px) {
  .topbar.nav-collapsed .brand-logo { grid-column: 1; grid-row: 1; }
  .topbar.nav-collapsed .account { grid-column: 2; grid-row: 1; }
  .topbar.nav-collapsed .gsearch { grid-row: 2; }
}

/* Projects: spread the card columns so the last column's edge lines up with the right edge of the page (and the New project button) */
.poster-grid { justify-content: space-between; }
@media (max-width: 760px) { .poster-grid { justify-content: stretch; } }

/* Invoices list: search box styled like the Projects filter, and a tighter page-number row */
#invSearch { width: 280px; max-width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--hairline); border-radius: var(--radius); font: inherit; font-size: 0.95rem; background: var(--panel); color: var(--ink); -webkit-appearance: none; appearance: none; }
#invSearch:focus { outline: 2px solid var(--teal); outline-offset: 0; }
.inv-list-tools .btn { height: 38px; box-sizing: border-box; }
.rate-meta { gap: 10px 16px; }
.rate-meta .pager, .pager.pager-bottom { margin: 0; justify-content: flex-end; gap: 4px; }
.pager.pager-bottom { margin-top: 12px; }
.rate-meta .pager button, .pager-bottom button { box-sizing: border-box; height: 32px; min-width: 32px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; line-height: 1; }
.rate-meta .pager-gap, .pager-bottom .pager-gap { padding: 0 2px; }
.rate-meta .page-size select { height: 32px; box-sizing: border-box; }

/* Composers, Contacts and Rate cards: search boxes styled like the Projects filter box */
#compSearch, #ctSearch, #rateSearch, .comp-filter input[type="search"] { box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--hairline); border-radius: var(--radius); font: inherit; font-size: 0.95rem; background: var(--panel); color: var(--ink); -webkit-appearance: none; appearance: none; }
#compSearch:focus, #ctSearch:focus, #rateSearch:focus, .comp-filter input[type="search"]:focus { outline: 2px solid var(--teal); outline-offset: 0; }

/* Wide header: the logo's column is only as wide as the logo, so the top links can run left above the search box (which sits on the second row) */
@media (min-width: 761px) {
  .topbar .brand-col { display: contents; }
  .topbar .brand-logo { grid-column: 1; grid-row: 1; align-self: center; height: 36px; }
  .topbar .nav-wrap { grid-column: 2; grid-row: 1; }
  .topbar .account { grid-column: 3; grid-row: 1; }
  .topbar .gsearch { grid-column: 1 / 3; grid-row: 2; justify-self: start; margin-top: 10px; }
}
