:root {
    --color-page: #08090a;
    --color-surface: #0f1011;
    --color-surface-muted: #161718;
    --color-surface-subtle: #1c1e22;
    --color-text: #e5e5e6;
    --color-text-secondary: #8a8f98;
    --color-text-muted: #62666d;
    --color-text-disabled: #4a4e54;
    --color-border: #23252a;
    --color-border-strong: #383b3f;
    --color-border-focus: #8a8f98;
    --color-brand: #e4f222;
    --color-brand-hover: #d4e21a;
    --color-brand-pressed: #c4d210;
    --color-brand-contrast: #08090a;
    --color-black: #f7f7f2;
    --color-white: #ffffff;
    --color-success: #8fbfa0;
    --color-success-bg: #1c3326;
    --color-warning: #e2c07a;
    --color-warning-bg: #3a3016;
    --color-error: #e7a3a3;
    --color-error-bg: #3a2222;
    --color-info: #9bb8d4;
    --color-info-bg: #1c2a38;
    --font-sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
    --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
    --text-page-title: 32px;
    --text-section-title: 20px;
    --text-body: 15px;
    --text-body-small: 14px;
    --text-caption: 12px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --radius-control: 4px;
    --radius-panel: 6px;
    --radius-small: 3px;
    --content-max-width: 1280px;
    --control-height: 36px;
    --shadow-small: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-panel: 0 8px 24px rgba(0, 0, 0, 0.4);
    --bg-primary: var(--color-page);
    --bg-secondary: var(--color-surface);
    --bg-tertiary: var(--color-surface-subtle);
    --border-color: var(--color-border);
    --text-primary: var(--color-text);
    --text-secondary: var(--color-text-secondary);
    --text-tertiary: var(--color-text-muted);
    --accent: var(--color-brand);
    --accent-hover: var(--color-brand-hover);
    --success: var(--color-success);
    --error: var(--color-error);
    --warning: var(--color-warning);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { color-scheme: dark; background: var(--color-page); }

body {
    min-height: 100vh;
    background: var(--color-page);
    color: var(--color-text);
    font-family: var(--font-sans);
    font-size: var(--text-body);
    font-weight: 400;
    line-height: 1.5;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

a:any-link,
a:visited {
    color: var(--color-text);
    text-decoration-color: var(--color-border-strong);
    text-underline-offset: 2px;
}
a:hover { color: var(--color-black); }

:focus-visible {
    outline: 2px solid var(--color-border-focus);
    outline-offset: 2px;
}

* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: 0; }

.app { min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
    min-height: 56px;
    padding: 0 max(24px, calc((100vw - var(--content-max-width)) / 2));
    border-bottom: 1px solid var(--color-border);
    background: var(--color-page);
}

.brand {
    flex: 0 0 auto;
    margin-right: 8px;
    padding: 8px 14px 8px 0;
    border-right: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
}

.brand:hover { color: var(--color-text); }

.nav {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    min-width: 0;
    overflow: visible;
}

.nav-direct,
.nav-section {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 8px 10px;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    list-style: none;
}

.nav-direct { width: auto; }

.nav-section:hover,
.nav-direct:hover { color: var(--color-text); background: transparent; }

.nav-direct.active {
    color: var(--color-text);
    border-bottom-color: var(--color-brand);
    background: transparent;
    font-weight: 600;
}

.nav-group { position: relative; }
.nav-group[hidden],
.nav-direct[hidden],
.nav-item[hidden] { display: none !important; }

.nav-group > .nav-section { justify-content: space-between; }
.nav-group > .nav-section::-webkit-details-marker { display: none; }
.nav-group > .nav-section::marker { content: ""; }

.nav-group-chevron {
    color: var(--color-text-muted);
    font-size: 12px;
    line-height: 1;
}

.nav-group:not([open]) .nav-group-chevron { display: inline-block; transform: rotate(-90deg); }

.nav-group-items {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 40;
    min-width: 220px;
    max-width: min(320px, calc(100vw - 32px));
    max-height: min(360px, calc(100vh - 120px));
    overflow: auto;
    padding: 4px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    box-shadow: var(--shadow-small);
}

.nav-group[open] > .nav-group-items { display: flex; flex-direction: column; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
}

.nav-item:hover { background: var(--color-surface-subtle); }
.nav-item.active { background: var(--color-surface-subtle); font-weight: 600; }
.nav-item.active::before { content: none; }
.nav-item.nav-direct {
    width: auto;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-weight: 500;
}
.nav-item.nav-direct:hover { background: transparent; color: var(--color-text); }
.nav-item.nav-direct.active {
    background: transparent;
    border-bottom-color: var(--color-brand);
    color: var(--color-text);
    font-weight: 600;
}
.nav-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item-subtitle { display: none; }
.nav-item-icon { display: none; }

.sidebar-footer { flex: 0 0 auto; margin: 0; padding: 0; border: 0; }
.footer-link { color: var(--color-text-secondary); font-size: 14px; text-decoration: none; }
.footer-link:hover { color: var(--color-text); text-decoration: underline; }

.main {
    width: min(var(--content-max-width), 100%);
    margin: 0 auto;
    padding: 0 24px 64px;
}

.topbar {
    position: static;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    margin: 0 -24px;
    padding: 8px 24px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-page);
}

.topbar-actions,
.topbar-user { display: inline-flex; align-items: center; gap: 8px; }
.topbar-actions { flex: 1; justify-content: flex-end; }

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-text-disabled);
    box-shadow: none;
}
.status-dot.success { background: var(--color-success); }
.status-dot.error { background: var(--color-error); }
.status-dot.loading { background: var(--color-warning); }

.global-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 240px;
    max-width: 360px;
    min-height: var(--control-height);
    padding: 0 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    background: var(--color-surface);
}

.global-search:focus-within { border-color: var(--color-border-focus); }
.global-search-label { color: var(--color-text-muted); font-size: 13px; white-space: nowrap; }
.global-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--color-text);
    font-size: 14px;
}
.global-search input:focus { outline: none; }
.global-search kbd {
    padding: 1px 5px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
    color: var(--color-text);
    font-size: 14px;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-surface-subtle);
}
.user-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-provider { width: 16px; height: 16px; display: block; }
.user-provider-wrap { display: inline-flex; align-items: center; color: var(--color-text-secondary); }

.logout-link {
    color: var(--color-text-secondary);
    font-size: 14px;
    text-decoration: none;
}
.logout-link:hover { color: var(--color-text); text-decoration: underline; }

.content { padding-top: 28px; }

.page-header { max-width: 720px; margin: 0 0 24px; }
.page-header h1 {
    color: var(--color-text);
    font-size: var(--text-page-title);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0;
}
.page-subtitle { margin-top: 6px; color: var(--color-text-secondary); font-size: 15px; }

.home-intro { margin: 0 0 20px; }
.eyebrow {
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 500;
}
.home-intro h2 {
    margin-top: 6px;
    font-size: 28px;
    font-weight: 600;
    line-height: 1.2;
}
.home-intro p {
    margin-top: 6px;
    color: var(--color-text-secondary);
    font-size: 15px;
}
.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface-muted);
    color: var(--color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.quick-action:hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface-subtle);
}
.quick-action-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    color: var(--color-text-secondary);
}
.quick-action-copy { min-width: 0; }
.quick-action strong,
.quick-action small { display: block; }
.quick-action strong { font-size: 14px; font-weight: 600; }
.quick-action small {
    margin-top: 2px;
    overflow: hidden;
    color: var(--color-text-secondary);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.quick-action-arrow {
    margin-left: auto;
    color: var(--color-text-muted);
}

.workspace-section { margin-top: 32px; }
.workspace-section:first-child { margin-top: 0; }
.section-title {
    margin: 0 0 4px;
    font-size: var(--text-section-title);
    font-weight: 600;
    line-height: 1.3;
}
.field-label { display: block; margin-bottom: 4px; font-size: 15px; font-weight: 600; }
.field-hint { margin: 0 0 12px; color: var(--color-text-secondary); font-size: 14px; }

.search-row { display: flex; align-items: stretch; gap: 8px; }
.search-row .big-input { flex: 1; min-width: 0; width: auto; }
.search-row .btn { flex: 0 0 auto; }

.tool-list { border-top: 1px solid var(--color-border); }
.tool-row {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) auto;
    gap: 8px 16px;
    align-items: baseline;
    width: 100%;
    padding: 12px 4px;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.tool-row:hover { background: var(--color-surface-muted); }
.tool-row-title { font-weight: 600; }
.tool-row-desc { color: var(--color-text-secondary); font-size: 14px; }
.tool-row-go { color: var(--color-text-muted); font-size: 14px; }

.plain-steps { margin: 8px 0 0 18px; color: var(--color-text); }
.plain-steps li { margin: 8px 0; }
.plain-steps li span { color: var(--color-text-secondary); }

.detect-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    align-items: baseline;
    padding: 12px 0 4px;
    border-top: 1px solid var(--color-border);
}
.detect-k { color: var(--color-text-muted); font-size: 12px; }
.detect-v { font-weight: 600; text-transform: capitalize; }
.detect-link { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }

.empty-state { padding: 8px 0 4px; }
.empty-state strong { display: block; font-weight: 600; }
.empty-state p { margin-top: 4px; color: var(--color-text-secondary); font-size: 14px; }

.table-scroll { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); }
.table-scroll .table { min-width: 520px; border: 0; }

.card {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    box-shadow: none;
}
.card:hover { border-color: var(--color-border); }
.card-head {
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.card-subtitle, .muted, .hint { color: var(--color-text-secondary); }
.card-subtitle { margin-top: 4px; font-size: 14px; }
.card-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hint { font-size: 13px; }

.collapse-stack { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.collapse-card { padding: 0; overflow: hidden; }
.collapse-card > .collapse-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}
.collapse-card > .collapse-summary::-webkit-details-marker { display: none; }
.collapse-card > .collapse-summary::marker { content: ""; }
.collapse-card > .collapse-body { padding: 0 16px 16px; }
.collapse-chevron { color: var(--color-text-muted); transform: rotate(-90deg); }
.collapse-card[open] > .collapse-summary .collapse-chevron { transform: none; }

.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-group label { color: var(--color-text); font-size: 14px; font-weight: 500; }

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group input[type="search"],
.form-group input[type="date"],
.form-group input[type="password"],
.form-group select,
textarea,
.big-input,
.library-comment-input,
.library-sort,
.library-scope-filter,
.gem-tag-select,
.gem-date-filter .gem-date-value,
.gem-date-filter .gem-date-op {
    width: 100%;
    min-height: var(--control-height);
    padding: 8px 10px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    outline: none;
}

textarea, textarea.big-input, .playlist-import-input {
    min-height: 96px;
    resize: vertical;
    line-height: 1.45;
}

.form-group input:focus,
.form-group select:focus,
textarea:focus,
.big-input:focus,
.library-comment-input:focus,
.library-sort:focus,
.gem-tag-select:focus {
    border-color: var(--color-border-focus);
    box-shadow: none;
}

.library-sort,
.library-scope-filter,
.gem-tag-select,
.gem-date-filter .gem-date-op { width: auto; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.inline { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; flex-wrap: wrap; }
.cta { display: grid; gap: 12px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn, .icon-btn, .chip {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    justify-content: center;
    min-height: var(--control-height);
    padding: 7px 12px;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: none;
}
.btn-small { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-primary {
    width: auto;
    border-color: var(--color-brand);
    background: var(--color-brand);
    color: var(--color-brand-contrast);
    font-weight: 600;
}
.btn-primary:hover { background: var(--color-brand-hover); border-color: var(--color-brand-hover); }
.btn-primary:active { background: var(--color-brand-pressed); }
.btn-secondary:hover, .icon-btn:hover, .chip:hover { background: var(--color-surface-subtle); }
.btn-tertiary {
    border-color: transparent;
    background: transparent;
    color: var(--color-text-secondary);
}
.btn-tertiary:hover { background: var(--color-surface-subtle); color: var(--color-text); }
.btn-danger {
    border-color: var(--color-error);
    background: var(--color-surface);
    color: var(--color-error);
}
.btn-danger:hover { background: var(--color-error-bg); }
button:disabled, .btn:disabled { opacity: 0.55; cursor: not-allowed; }

.chip.active {
    border-color: var(--color-border-strong);
    background: var(--color-surface-subtle);
    color: var(--color-text);
    font-weight: 600;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border: 0;
    border-radius: var(--radius-small);
    background: var(--color-surface-subtle);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
}

.results { margin-top: 16px; min-width: 0; overflow-x: auto; }
.results-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.results-title { font-size: 16px; font-weight: 600; }
.human { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.hero {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 0 8px;
    border: 0;
    border-bottom: 1px solid var(--color-border);
    border-radius: 0;
    background: transparent;
}
.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-surface-subtle);
}
.hero-title { font-size: 16px; font-weight: 600; line-height: 1.3; }
.hero-subtitle { margin-top: 2px; color: var(--color-text-secondary); font-size: 14px; overflow-wrap: anywhere; }

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--color-border); }
.kv-item { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--color-border); background: transparent; }
.kv-k { color: var(--color-text-muted); font-size: 12px; font-weight: 500; }
.kv-v { margin-top: 2px; color: var(--color-text); font-size: 14px; font-weight: 500; overflow-wrap: anywhere; }
.identity-copyable {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background .12s ease, color .12s ease;
}
.identity-copyable:hover {
  background: rgba(30, 215, 96, 0.14);
  color: var(--color-text);
}
.identity-copyable:active { background: rgba(30, 215, 96, 0.22); }

.table { width: 100%; border-collapse: collapse; background: var(--color-surface); }
.table th, .table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    text-align: left;
    vertical-align: top;
}
.table th {
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}
.table-sort-th { cursor: pointer; user-select: none; white-space: nowrap; }
.table-sort-th:hover, .table-sort-th.is-active { color: var(--color-text); }
.table td .btn { margin-left: 8px; }

.raw-json { display: none; }
.raw-json.show { display: block; }
.json-box, .admin-live-log, .api-key-masked {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}
.json-box, .admin-live-log {
    max-height: min(52vh, 560px);
    overflow: auto;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface-muted);
    color: var(--color-text);
}
.api-key-masked {
    margin-top: 8px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface-muted);
    color: var(--color-text-secondary);
}
.api-key-active-note { margin-top: 8px; }

.error-message {
    padding: 10px 12px;
    border: 1px solid #5c3434;
    border-radius: var(--radius-control);
    background: var(--color-error-bg);
    color: var(--color-error);
}

.recent-list { display: flex; flex-direction: column; }
.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    background: transparent;
}
.recent-item a { min-width: 0; overflow-wrap: anywhere; }

.chart-card {
    margin-top: 8px;
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid var(--color-border);
    border-radius: 0;
    background: transparent;
}
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chart-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.chart-body, .chart-wrap { width: 100%; }
.chart-frame {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    align-items: stretch;
}
.chart-y {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px 0 28px;
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    text-align: right;
    user-select: none;
}
.chart-main { min-width: 0; }
.chart-svg {
    display: block;
    width: 100%;
    height: 220px;
    overflow: visible;
}
.chart-x {
    position: relative;
    height: 24px;
    margin-top: 6px;
    user-select: none;
}
.chart-x span {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}
.chart-x span.is-start { transform: translateX(0); }
.chart-x span.is-end { transform: translateX(-100%); }
.chart-empty { padding: 12px 0; color: var(--color-text-secondary); }


.dashboard-split { display: grid; grid-template-columns: 1.2fr 0.9fr; gap: 16px; align-items: start; }
.dashboard-right .card { margin-top: 12px; }
.credits-group { margin-top: 12px; }
.description-block { color: var(--color-text); font-size: 14px; }
.description-block + .description-block { margin-top: 8px; }

.gem-preset-bar { display: grid; gap: 6px; width: 100%; }
.gem-preset-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gem-preset-select { min-width: 180px; flex: 1 1 180px; }
.gem-preset-status { font-size: 12px; }
.distributor-menu { position: relative; width: 100%; max-width: 560px; }
.distributor-menu.is-disabled { opacity: 0.55; }
.distributor-menu-button { width: 100%; justify-content: space-between; text-align: left; }
.distributor-menu-button::after { content: "⌄"; margin-left: 12px; color: var(--color-text-muted); }
.distributor-menu-panel {
    display: none;
    position: absolute;
    z-index: 25;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    box-shadow: var(--shadow-small);
}
.distributor-menu.open .distributor-menu-panel { display: block; }
.distributor-search { width: 100%; margin-bottom: 8px; }
.distributor-options { max-height: 280px; overflow-y: auto; }
.distributor-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 6px;
    border-radius: var(--radius-control);
    color: var(--color-text);
    font-size: 14px;
    cursor: pointer;
}
.distributor-option[hidden] { display: none !important; }
.distributor-option:hover { background: var(--color-surface-subtle); }
.distributor-actions-row { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.distributor-guess-result { margin-top: 8px; }

.library-panel {
    margin: 4px 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.library-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.library-column h3 { margin-bottom: 4px; font-size: 16px; font-weight: 600; }
.library-add-row, .library-entry { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.library-add-row .big-input { flex: 1; min-width: 0; width: auto; }
.library-entry { justify-content: space-between; }
.library-entry-info { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.library-entry a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-meta { color: var(--color-text-muted); font-size: 12px; }
.library-comment-edit { display: inline-flex; gap: 6px; width: min(100%, 360px); }
.library-comment-input { min-width: 100px; flex: 1; width: auto; }
.library-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 2px; }
.library-tag-checks { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.library-tag-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 12px;
    cursor: pointer;
}
.library-tag-check input { margin: 0; cursor: pointer; }
.library-list { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--color-border); }
.library-list-title { color: var(--color-text-secondary); font-size: 14px; cursor: pointer; }
.library-list-body { padding-top: 4px; }

.gem-mark { display: inline-flex; margin-right: 6px; color: var(--color-text-secondary); vertical-align: middle; }
.gem-tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 1px 6px;
    border-radius: var(--radius-small);
    border: 1px solid var(--color-border);
    background: var(--color-surface-subtle);
    color: var(--color-text-secondary);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}
.gem-tag-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.gem-tag-label { text-transform: lowercase; }
.gem-tag-dark-green { color: #b7e0c8; background: #163024; border-color: #2d4a38; }
.gem-tag-dark-green .gem-tag-dot { background: #8fbfa0; }
.gem-tag-green { color: #b7e0c8; background: var(--color-success-bg); border-color: #2d4a38; }
.gem-tag-green .gem-tag-dot { background: #287a4b; }
.gem-tag-orange { color: var(--color-warning); background: var(--color-warning-bg); border-color: #5a4a28; }
.gem-tag-orange .gem-tag-dot { background: #956400; }
.gem-tag-red { color: var(--color-error); background: var(--color-error-bg); border-color: #5c3434; }
.gem-tag-red .gem-tag-dot { background: #b94343; }
.gem-credits-sources {
    display: inline;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text);
    font: inherit;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
    max-width: 220px;
    white-space: normal;
    word-break: break-word;
}
.gem-credits-sources:disabled { opacity: 0.7; cursor: wait; text-decoration: none; }

.gem-v2-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin: 12px 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    overflow: hidden;
}
.gem-v2-stat { padding: 10px 12px; border-right: 1px solid var(--color-border); background: transparent; }
.gem-v2-stat:last-child { border-right: 0; }
.gem-v2-stat strong { display: block; font-size: 16px; font-weight: 600; }
.gem-v2-stat span { color: var(--color-text-secondary); font-size: 12px; }
.gem-v2-doom-panel { margin: 12px 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--color-border); }
.gem-filter-section {
    margin: 0 0 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    overflow: hidden;
}
.gem-filter-section > summary.gem-filter-section-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    list-style: none;
    cursor: pointer;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    user-select: none;
}
.gem-filter-section > summary.gem-filter-section-summary::-webkit-details-marker { display: none; }
.gem-filter-section > summary.gem-filter-section-summary::marker { content: ""; }
.gem-filter-section-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; min-width: 0; }
.gem-filter-section-hint { color: var(--color-text-muted); font-size: 13px; font-weight: 400; }
.gem-filter-section-chevron { color: var(--color-text-muted); transition: transform 0.15s ease; }
.gem-filter-section[open] > summary .gem-filter-section-chevron { transform: rotate(180deg); }
.gem-filter-section-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 12px 12px;
    border-top: 1px solid var(--color-border);
}
.gem-filter-section-body > .form-group { margin-bottom: 0; }
.gem-date-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gem-date-filter { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.gem-date-filter .gem-date-op { min-width: 7.25rem; }
.gem-date-filter .gem-date-value { width: 11.75rem; color-scheme: dark; }
.gem-about-cell, .gem-about-line { white-space: nowrap; font-size: 12px; line-height: 1.35; color: var(--color-text-secondary); }
.gem-v2-activity { max-height: 260px; overflow: auto; margin-top: 8px; }
.gem-v2-activity-row {
    display: grid;
    grid-template-columns: 90px 170px 1fr;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 12px;
    color: var(--color-text-secondary);
}
.gem-v2-activity-row strong { color: var(--color-text); }

.blacklisted-results { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--color-border); color: var(--color-text-secondary); }
.blacklisted-results summary { cursor: pointer; }

.admin-subnav-root { display: flex; flex-direction: column; gap: 16px; }
.admin-subnav { display: flex; flex-wrap: wrap; gap: 4px 16px; border-bottom: 1px solid var(--color-border); }
.admin-subnav-tab {
    appearance: none;
    padding: 8px 0;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.admin-subnav-tab:hover { color: var(--color-text); }
.admin-subnav-tab.active { color: var(--color-text); border-bottom-color: var(--color-brand); font-weight: 600; }
.admin-subnav-panels { min-height: 80px; }
.admin-subnav-panel { display: flex; flex-direction: column; gap: 12px; }
.admin-subnav-panel[hidden] { display: none !important; }
.admin-panel-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

.admin-person-list, .admin-actions-list, .admin-activity-list { display: flex; flex-direction: column; }
.admin-person-directory, .admin-actions-list, .admin-activity-list { max-height: 420px; overflow: auto; }
.admin-activity-row {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  padding: 10px 4px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.admin-activity-row:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.gem-saved-scan-list { display: flex; flex-direction: column; margin-top: 8px; max-height: 360px; overflow: auto; }
.gem-saved-scan-list.is-admin { max-height: 480px; }
.gem-saved-scan-row.is-virtual {
  border-color: color-mix(in srgb, var(--color-brand) 35%, var(--border, #333));
}
.gem-saved-scan-row.is-other { opacity: 0.95; }
.gem-saved-scan-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 4px;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}
.gem-saved-scan-row.is-selected { background: color-mix(in srgb, var(--color-brand) 8%, transparent); }
.gem-saved-scan-name { font-weight: 600; }
.gem-saved-scan-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.gem-saved-scan-cell { max-width: 280px; word-break: break-word; }
.admin-activity-name { font-weight: 600; }
.admin-activity-preview {
  margin-top: 6px;
  font-size: 13px;
  word-break: break-all;
}
.admin-person-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.admin-person-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 2px 8px 2px 2px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.admin-person-chip:hover { background: var(--color-surface-subtle); }
.admin-person-avatar, .admin-user-profile-avatar {
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-surface-subtle);
}
.admin-person-avatar { width: 28px; height: 28px; }
.admin-person-avatar-fallback { display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; }
.admin-person-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-person-meta { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.admin-user-profile-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.admin-user-profile-avatar { width: 48px; height: 48px; }
.admin-user-profile-name { font-size: 18px; font-weight: 600; }
.admin-actions-details { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--color-border); }
.admin-actions-details > summary { cursor: pointer; font-weight: 600; list-style: none; }
.admin-actions-details > summary::-webkit-details-marker { display: none; }
.admin-actions-details > summary::before { content: "▸ "; color: var(--color-text-muted); }
.admin-actions-details[open] > summary::before { content: "▾ "; }
.admin-action-row { padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.admin-action-when { margin-bottom: 2px; color: var(--color-text-muted); font-size: 12px; }
.admin-action-label { font-weight: 600; }
.admin-action-detail { margin-top: 4px; font-size: 14px; word-break: break-all; color: var(--color-text-secondary); }

.complete-v2-result, .licensor-track-list { min-width: 0; }
.licensor-row-open { font-weight: 600; }

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}
.modal-overlay.show { display: flex; }
.modal {
    display: flex;
    flex-direction: column;
    width: min(720px, 100%);
    max-height: calc(100vh - 32px);
    overflow: hidden;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    box-shadow: var(--shadow-panel);
}
.modal.modal-wide { width: min(1100px, 100%); }
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { min-height: 0; padding: 16px; overflow: auto; }

.maintenance-banner {
    padding: 10px 16px;
    border-bottom: 1px solid #5c3434;
    background: var(--color-error-bg);
    color: #f0c8c8;
    font-size: 14px;
    font-weight: 500;
}

.copied-notification {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 80;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 14px;
    box-shadow: var(--shadow-small);
}

.lucide-icon { display: block; flex: 0 0 auto; }

/* Owned Releases (per-user portfolio) */
.owned-root { display: flex; flex-direction: column; gap: 16px; }
.owned-privacy-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}
.owned-priv {
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
}
/* Hide: numbers / dates / % — labels stay readable */
.owned-root.is-privacy-on .owned-priv,
.owned-root.is-privacy-on .owned-share-input,
.owned-root.is-privacy-on input[type="date"] {
    filter: blur(0.55em);
    user-select: none;
    pointer-events: none;
}
.owned-root.is-privacy-on .owned-thumb img,
.owned-root.is-privacy-on .owned-detail-cover,
.owned-root.is-privacy-on .owned-chart-body {
    filter: blur(12px);
    user-select: none;
    pointer-events: none;
}
.owned-share-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}
.owned-share-input {
    min-width: 88px;
    width: 88px;
    flex: 0 0 88px;
}
.owned-share-suffix {
    color: var(--color-text-secondary);
    font-size: 13px;
    white-space: nowrap;
}
.owned-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    overflow: hidden;
}
.owned-kpi {
    padding: 12px 14px;
    border-right: 1px solid var(--color-border);
    min-width: 0;
}
.owned-kpi:last-child { border-right: 0; }
.owned-kpi strong {
    display: block;
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.owned-kpi span {
    display: block;
    margin-top: 2px;
    color: var(--color-text-secondary);
    font-size: 12px;
}
.owned-kpi-hint {
    display: block;
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 11px;
    font-style: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.owned-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.owned-chart-card {
    padding: 12px 14px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}
.owned-chart-head { margin-bottom: 4px; }
.owned-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}
.owned-chart-body .chart-card {
    margin-top: 0;
    padding-top: 4px;
    border-top: 0;
}
.owned-add-card .section-title { margin-bottom: 2px; }
.owned-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
}
.owned-add-row .big-input { flex: 1 1 280px; min-width: 0; width: auto; }
.owned-share-select { min-width: 130px; width: auto; }
.owned-add-meta .big-input:not(.owned-since-input) {
    flex: 1 1 200px;
    min-width: 0;
    width: auto;
}
.owned-since-inline {
    flex: 0 0 auto;
    color: var(--color-text-secondary);
    font-size: 13px;
    white-space: nowrap;
}
.owned-since-input {
    flex: 0 0 150px;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
}
.owned-since-presets {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.owned-since-edit {
    display: grid;
    gap: 6px;
}
.owned-upload-hint {
    font-size: 12px;
}
.owned-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 2px 0 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
}
.owned-filter {
    flex: 1 1 220px;
    min-width: 0;
    max-width: none;
    width: auto;
}
.owned-sort {
    flex: 0 1 200px;
    width: auto;
    min-width: 168px;
    cursor: pointer;
}
.owned-filter:hover,
.owned-sort:hover {
    border-color: var(--color-border-strong);
}
.owned-filter:focus,
.owned-sort:focus {
    border-color: var(--color-border-focus);
}
.owned-count {
    margin-left: auto;
    color: var(--color-text-secondary);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.owned-split {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}
.owned-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: min(70vh, 720px);
    overflow-y: auto;
    padding-right: 2px;
}
.owned-release-card {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-surface);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.owned-release-card:hover {
    border-color: var(--color-border-strong);
    background: var(--color-surface-muted);
}
.owned-release-card.is-active {
    border-color: var(--color-brand);
    background: var(--color-surface-subtle);
}
.owned-thumb {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: var(--radius-small);
    background: var(--color-surface-subtle);
    overflow: hidden;
}
.owned-thumb img,
.owned-detail-cover {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.owned-release-meta { min-width: 0; flex: 1; }
.owned-release-title {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.owned-release-title strong {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.owned-badge {
    padding: 1px 6px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-small);
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 500;
}
.owned-badge-share {
    border-color: color-mix(in srgb, var(--color-brand) 35%, var(--color-border));
    color: var(--color-brand);
}
.owned-release-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.owned-release-geo {
    margin-top: 3px;
    color: var(--color-text-secondary);
    font-size: 11px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.owned-owned-val { color: var(--color-brand); font-weight: 600; }
.owned-detail-card { margin-bottom: 0; }
.owned-detail-empty { padding: 24px 16px; }
.owned-detail-hero {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.owned-detail-cover {
    width: 88px;
    height: 88px;
    flex: 0 0 auto;
    border-radius: var(--radius-panel);
    background: var(--color-surface-subtle);
}
.owned-detail-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 8px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}
.owned-detail-controls {
    display: grid;
    gap: 12px;
    margin: 16px 0 8px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
}
.owned-detail-fields {
    display: grid;
    grid-template-columns: minmax(120px, 160px) minmax(140px, 200px);
    gap: 12px;
    align-items: end;
}
.owned-notes-wrap { display: grid; gap: 4px; }
.owned-notes {
    width: 100%;
    min-height: 56px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    background: var(--color-page);
    color: var(--color-text);
    resize: vertical;
}
.owned-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.owned-lb-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.owned-table { font-variant-numeric: tabular-nums; }
.owned-geo-cell { font-size: 0.85em; max-width: 12rem; white-space: normal; }
.owned-rev-band { font-size: 0.78em; line-height: 1.25; margin-top: 2px; }
.owned-revenue-note { margin: 0 0 4px; opacity: 0.85; }
.owned-num-strong { font-weight: 600; color: var(--color-brand); }
.owned-click-row { cursor: pointer; }
.owned-click-row:hover td { background: var(--color-surface-muted); }
.owned-err {
    margin-top: 2px;
    color: var(--color-error);
    font-size: 11px;
}

.upload-copy-out { display: grid; gap: 14px; margin-top: 14px; }
.upload-copy-head {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.upload-copy-cover {
    width: 120px;
    height: 120px;
    flex: 0 0 auto;
    border-radius: var(--radius-panel);
    object-fit: cover;
    background: var(--color-surface-subtle);
}
.upload-copy-cover-empty { border: 1px solid var(--color-border); }
.upload-copy-head-meta { min-width: 0; flex: 1; display: grid; gap: 8px; }
.upload-copy-cover-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-copy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-copy-card { display: grid; gap: 8px; }
.upload-copy-row {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    gap: 8px 12px;
    align-items: start;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}
.upload-copy-label {
    color: var(--color-text-secondary);
    font-size: 13px;
    padding-top: 2px;
}
.upload-copy-value {
    font-size: 14px;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}
.upload-copy-track {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    border-top: 1px solid var(--color-border);
}
.upload-copy-track:first-of-type { border-top: 0; }
.upload-copy-track-idx {
    color: var(--color-text-muted);
    font-size: 13px;
    padding-top: 8px;
    min-width: 1.5rem;
}
.upload-copy-track-body { flex: 1; min-width: 0; display: grid; gap: 0; }
.owned-track-chart-row td {
    padding-top: 0;
    padding-bottom: 12px;
    background: var(--color-page);
}

@media (max-width: 1024px) {
    .gem-v2-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .gem-v2-stat:nth-child(3) { border-right: 0; }
    .dashboard-split, .library-columns, .grid-3 { grid-template-columns: 1fr 1fr; }
    .owned-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .owned-kpi:nth-child(3n) { border-right: 0; }
    .owned-kpi:nth-child(n+4) { border-top: 1px solid var(--color-border); }
    .owned-charts-grid, .owned-lb-grid, .owned-split { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .owned-kpis { grid-template-columns: 1fr 1fr; }
    .owned-kpi { border-right: 1px solid var(--color-border); }
    .owned-kpi:nth-child(2n) { border-right: 0; }
    .owned-kpi:nth-child(n+3) { border-top: 1px solid var(--color-border); }
    .sidebar {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 4px 12px;
        padding: 8px 16px 0;
    }
    .nav {
        flex: 1 1 100%;
        flex-wrap: nowrap;
        order: 3;
        padding-bottom: 4px;
        overflow-x: auto;
    }
    .sidebar-footer { margin-left: auto; }
    .main { padding: 0 16px 48px; }
    .topbar {
        top: 0;
        position: relative;
        flex-wrap: wrap;
        margin: 0 -16px;
        padding: 8px 16px;
    }
    .global-search { order: 3; flex-basis: 100%; max-width: none; }
    .page-header h1 { font-size: 24px; }
    .grid-2, .grid-3, .dashboard-split, .library-columns, .kv, .gem-date-filters { grid-template-columns: 1fr; }
    .gem-v2-activity-row { grid-template-columns: 1fr; gap: 2px; }
    .search-row { flex-direction: column; }
    .search-row .btn,
    .card-body > .btn-primary { width: 100%; min-height: 44px; align-self: stretch; }
    .quick-actions { grid-template-columns: 1fr; }
    .home-intro h2 { font-size: 24px; }
    .tool-row { grid-template-columns: 1fr auto; }
    .tool-row-desc { grid-column: 1 / -1; }
    .table-scroll .table { min-width: 0; }
    .table td, .table th { overflow-wrap: anywhere; }
    .nav-group-items {
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        right: auto;
        width: min(260px, calc(100vw - 32px));
        max-width: none;
    }
}

@media (max-width: 640px) {
    .gem-v2-stats { grid-template-columns: 1fr 1fr; }
    .gem-v2-stat { border-right: 1px solid var(--color-border); }
    .gem-v2-stat:nth-child(2n) { border-right: 0; }
    .sidebar-footer { display: none; }
    .brand { border-right: 0; margin-right: 0; padding-right: 0; }
    .user-name { max-width: 96px; }
    .chart-svg { height: 180px; }
    .chart-frame { grid-template-columns: 48px minmax(0, 1fr); }
    .chart-y { font-size: 11px; padding-bottom: 26px; }
}
