:root {
  --bg: #f3f5f9; --panel: #ffffff; --ink: #1a2233; --muted: #626b7d; --line: #dde2ec;
  --accent: #182b58; --accent-ink: #fff; --brand: #182b58; --ok: #2f7a4a; --err: #b3261e; --warn: #8a6a00;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1422; --panel: #172033; --ink: #e8ecf5; --muted: #9aa4b8; --line: #2a3550;
    --accent: #6f8fd8; --accent-ink: #0d1530; --brand: #182b58; --ok: #6cc28a; --err: #ff8a80; --warn: #e5c14b;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .6rem; }
main { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
code { background: var(--line); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 8px 16px; background: #fff; color: var(--brand); position: sticky; top: 0; z-index: 10; flex-wrap: wrap; border-bottom: 3px solid var(--brand); box-shadow: 0 2px 10px rgba(24,43,88,.08); }
.brand { display: flex; align-items: center; }
.brand img { height: 46px; width: auto; display: block; }
.brand:hover { text-decoration: none; }
.disc { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle, var(--bg) 0 3px, #333 3px 6px, var(--accent) 6px 7.5px, #333 7.5px); display: inline-block; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a { color: var(--brand); font-weight: 600; padding: 7px 12px; border-radius: 6px; }
.topbar nav a:hover { background: #e8ecf5; text-decoration: none; }
.topbar nav a.on { background: var(--brand); color: #fff; text-decoration: none; }


.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); }
.flash.ok { border-left: 4px solid var(--ok); }
.flash.err { border-left: 4px solid var(--err); }
.flash.warn { border-left: 4px solid var(--warn); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

input, select, textarea, button, .btn { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=url], input[type=file], select, textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 90px; resize: vertical; }
.btn, button { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover, button:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger, button.danger { color: var(--err); }
.btn.sm, button.sm { padding: 4px 10px; font-size: .85rem; }

/* căutare */
.searchbar { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-bottom: 10px; }
.searchbar input[type=search] { font-size: 1.05rem; padding: 10px 14px; }
details.filters { margin-bottom: 14px; }
details.filters summary { cursor: pointer; color: var(--muted); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 10px; }
.stats { display: flex; gap: 18px; color: var(--muted); font-size: .9rem; margin: 6px 0 14px; flex-wrap: wrap; align-items: center; }
.stats b { color: var(--ink); }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 18px; }
.card { display: block; color: inherit; }
.card:hover { text-decoration: none; }
.card:hover .cover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.cover { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--line); display: block; transition: .15s; }
.nocover { display: grid; place-items: center; background: linear-gradient(135deg, #1d2e5a, #2c3f6e); }
.nocover span { width: 58%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #cfc6b6 0 7%, #1b1814 7% 12%, #222 12% 48%, #2d2923 48% 50%, #1b1814 50%); }
.card .t { font-weight: 600; margin-top: 8px; line-height: 1.25; }
.card .a { color: var(--muted); font-size: .9rem; }
.card .m { color: var(--muted); font-size: .8rem; }

/* tabel */
table.list { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg); }
table.list tr:hover td { background: var(--bg); }
table.list .thumb { width: 44px; height: 44px; }
.table-wrap { overflow-x: auto; }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.pager a, .pager span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.pager .cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* detaliu */
.detail { display: grid; grid-template-columns: 300px 1fr; gap: 28px; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } .detail .cover { max-width: 320px; } }
dl.meta { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; }
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
ol.tracks { padding-left: 0; list-style: none; margin: 0; columns: 2 260px; }
ol.tracks li { padding: 4px 0; border-bottom: 1px dashed var(--line); break-inside: avoid; }

/* formular */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); }
label.f > * { color: var(--ink); font-size: .95rem; }
.edit-layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
@media (max-width: 760px) { .edit-layout { grid-template-columns: 1fr; } .edit-layout > aside { max-width: 220px; } }

/* rezultate online */
.results { display: flex; flex-direction: column; gap: 10px; }
.result { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.result .cover { width: 64px; height: 64px; }
.result .t { font-weight: 600; }
.badge { display: inline-block; font-size: .72rem; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); vertical-align: middle; }
.badge.own { background: var(--ok); color: #fff; border-color: var(--ok); }
.badge.discogs { border-color: #888; }
.badge.musicbrainz { border-color: #ba478f; color: #ba478f; }
@media (max-width: 560px) { .result { grid-template-columns: 56px 1fr; } .result .actions { grid-column: 1 / -1; } }

/* scanner */
.scan-layout { display: grid; grid-template-columns: minmax(280px, 460px) 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .scan-layout { grid-template-columns: 1fr; } }
#reader:empty { display: none; }
#reader { width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; min-height: 60px; }
#reader video { border-radius: var(--radius); }
.mode-switch { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mode-switch label { flex: 1; text-align: center; padding: 8px; cursor: pointer; }
.mode-switch input { display: none; }
.mode-switch input:checked + span { font-weight: 700; color: var(--accent); }
.scanlog { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.scanlog li { padding: 6px 0; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.hint { font-size: .85rem; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* import */
.map-table select { min-width: 150px; }
.preview { font-size: .85rem; }
.preview td { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }

/* progres + foldere */
.progress { height: 12px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.chip { padding: 4px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--panel); color: var(--ink); font-size: .85rem; }
.chip:hover { text-decoration: none; border-color: var(--muted); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip small { color: var(--muted); margin-left: 4px; }
.chip.on small { color: inherit; opacity: .7; }
.card .obs { font-size: .75rem; color: var(--warn); }
.badge.folder { background: var(--bg); }
label.f > .hint { font-size: .8rem; color: var(--muted); }

/* grilă: 7 pe rând, coperți 150×150 */
.grid { grid-template-columns: repeat(7, 150px); gap: 24px 16px; justify-content: space-between; }
@media (max-width: 1200px) { .grid { grid-template-columns: repeat(auto-fill, 150px); justify-content: space-evenly; } }
@media (max-width: 400px) { .grid { grid-template-columns: repeat(2, 150px); gap: 16px 8px; } }
.grid .card { width: 150px; }
.grid .cover { width: 150px; height: 150px; aspect-ratio: auto; }
.grid .card .t, .grid .card .a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .88rem; }
.grid .card .a { -webkit-line-clamp: 1; font-size: .82rem; }
.grid .card .m { font-size: .74rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pp a, .pp b { padding: 2px 6px; border-radius: 5px; }
.pp .pp-on { background: var(--ink); color: var(--bg); }
.price { font-weight: 700; color: var(--ok); font-size: .9rem; margin-top: 2px; }
.price.none { color: var(--muted); font-weight: 400; font-size: .78rem; }
.card-actions { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.card-actions .btn, .card-actions button { padding: 2px 8px; font-size: .75rem; }
button.follow.on { background: #f5c518; border-color: #d9a900; color: #1f1c18; font-weight: 600; }

/* sub-tab-uri Tools */
.subtabs { display: flex; gap: 0; border-bottom: 2px solid var(--line); margin: -4px 0 18px; }
.subtabs a { padding: 9px 18px; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.subtabs a:hover { color: var(--accent); text-decoration: none; }
.subtabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
h1 { color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pp .pp-on { background: var(--accent); color: var(--accent-ink); }
