:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: #101620;
  --panel-2: #151d29;
  --line: #263244;
  --text: #edf3f8;
  --muted: #91a0b2;
  --blue: #6f8cff;
  --blue-2: #4c6fff;
  --green: #57d69a;
  --yellow: #f1c95e;
  --red: #ff6b75;
  --shadow: 0 14px 40px rgba(0,0,0,.24);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: radial-gradient(circle at 20% -10%, rgba(76,111,255,.16), transparent 30%), var(--bg); color: var(--text); }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
.page-shell { max-width: 1500px; margin: 0 auto; padding: 28px; }
.app-header { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-bottom:22px; }
.brand-wrap { display:flex; align-items:center; gap:14px; }
.brand-mark { width:48px; height:48px; border-radius:14px; display:grid; place-items:center; font-weight:900; letter-spacing:-.04em; background:linear-gradient(135deg,var(--blue),#8c62ff); box-shadow:0 10px 30px rgba(93,104,255,.25); }
h1,h2,h3,h4,p { margin-top:0; }
h1 { margin-bottom:3px; font-size:30px; letter-spacing:-.03em; }
.app-header p { margin:0; color:var(--muted); font-size:14px; }
.mode-pill { display:flex; align-items:center; gap:8px; padding:10px 14px; border:1px solid var(--line); border-radius:999px; font-size:12px; font-weight:800; letter-spacing:.05em; background:rgba(16,22,32,.85); }
.mode-pill .dot { width:8px; height:8px; border-radius:50%; }
.mode-pill.safe .dot { background:var(--green); box-shadow:0 0 0 5px rgba(87,214,154,.10); }
.mode-pill.danger .dot { background:var(--red); box-shadow:0 0 0 5px rgba(255,107,117,.10); }
.card { background:linear-gradient(180deg,rgba(19,27,39,.96),rgba(14,20,29,.96)); border:1px solid var(--line); border-radius:16px; box-shadow:var(--shadow); }
.connection-strip { padding:18px; margin-bottom:18px; }
.compact-title { margin-bottom:14px !important; }
.connections-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.connection-card { min-height:72px; display:flex; align-items:center; gap:12px; padding:12px 14px; background:rgba(8,12,18,.55); border:1px solid #202b3a; border-radius:13px; }
.service-icon,.mini-icon { display:grid; place-items:center; font-weight:900; color:white; }
.service-icon { width:38px; height:38px; border-radius:10px; flex:0 0 auto; }
.mini-icon { width:22px; height:22px; border-radius:6px; font-size:11px; }
.sonarr-bg { background:linear-gradient(135deg,#4b8dff,#3871d8); }
.radarr-bg { background:linear-gradient(135deg,#d9ad34,#a97713); }
.nas-bg { background:linear-gradient(135deg,#8b62ff,#6945c7); }
.connection-copy { min-width:0; display:flex; flex-direction:column; gap:3px; flex:1; }
.connection-copy strong { font-size:14px; }
.connection-copy span { color:var(--muted); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.health-dot { width:10px; height:10px; border-radius:50%; flex:0 0 auto; }
.health-dot.pending { background:#687485; }
.health-dot.ok { background:var(--green); box-shadow:0 0 0 5px rgba(87,214,154,.08); }
.health-dot.bad { background:var(--red); box-shadow:0 0 0 5px rgba(255,107,117,.08); }
.hero-grid { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(320px,.7fr); gap:18px; margin-bottom:22px; }
.hero-panel { min-height:270px; padding:34px; border:1px solid #33426a; border-radius:18px; background:linear-gradient(135deg,rgba(49,68,123,.72),rgba(24,31,54,.86) 55%,rgba(23,28,41,.96)); box-shadow:var(--shadow); display:flex; flex-direction:column; justify-content:center; }
.hero-panel h2 { max-width:720px; margin:7px 0 12px; font-size:42px; line-height:1.04; letter-spacing:-.045em; }
.hero-panel p { max-width:780px; color:#b7c2d1; line-height:1.6; margin-bottom:22px; }
.hero-actions,.action-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.hero-savings { padding:28px; display:flex; flex-direction:column; justify-content:center; }
.eyebrow { color:#8fa5ff; font-size:11px; letter-spacing:.12em; font-weight:900; }
.big-number { font-size:48px; font-weight:900; letter-spacing:-.05em; margin:8px 0 14px; }
.saving-breakdown { display:grid; gap:8px; padding-top:14px; border-top:1px solid var(--line); }
.saving-breakdown span { display:flex; justify-content:space-between; color:var(--muted); }
.saving-breakdown strong { color:var(--text); }
.muted { color:var(--muted); }
.small-copy { font-size:12px; line-height:1.5; margin:14px 0 0; }
.button { border:1px solid transparent; border-radius:10px; padding:10px 14px; font-weight:800; cursor:pointer; transition:.15s ease; display:inline-flex; align-items:center; justify-content:center; }
.button:hover:not(:disabled) { transform:translateY(-1px); }
.button:disabled { opacity:.45; cursor:not-allowed; transform:none; }
.button.primary { background:linear-gradient(135deg,var(--blue),var(--blue-2)); color:white; box-shadow:0 8px 18px rgba(76,111,255,.18); }
.button.secondary { background:#1a2431; border-color:#2b394b; color:#dce5ef; }
.button.stop { background:transparent; border-color:#7a3840; color:#ff9da5; }
.button.small { padding:8px 11px; font-size:12px; }
.danger-button { background:#a93843; color:white; }
.hidden { display:none !important; }
.notice { padding:14px 16px; border-radius:12px; border:1px solid var(--line); margin:14px 0; font-size:13px; }
.error-notice { background:#32161a; border-color:#6f3038; color:#ffc1c6; }
.info-notice { background:#111d31; border-color:#29436c; color:#bcd3ff; }
.warning-notice { background:#2b2514; border-color:#6a5826; color:#f7dda0; }
.section-nav { position:sticky; top:10px; z-index:8; display:inline-flex; gap:4px; padding:5px; margin:0 0 20px; background:rgba(13,18,26,.88); backdrop-filter:blur(12px); border:1px solid var(--line); border-radius:12px; }
.section-nav a { padding:8px 12px; border-radius:8px; color:#aab6c4; font-size:13px; font-weight:700; }
.section-nav a:hover { background:#1b2532; color:white; }
.content-section { scroll-margin-top:76px; margin-bottom:34px; }
.section-title { display:flex; justify-content:space-between; align-items:flex-end; gap:18px; margin:0 0 16px; }
.section-title h2 { margin:5px 0 5px; font-size:28px; letter-spacing:-.03em; }
.section-title p { margin:0; color:var(--muted); font-size:14px; }
.progress-card { padding:16px 18px; margin-bottom:14px; }
.progress-head { display:flex; justify-content:space-between; gap:16px; margin-bottom:10px; font-size:13px; }
.progress-head span { color:#b8c3d0; font-weight:800; font-variant-numeric:tabular-nums; }
.progress-track { height:12px; border-radius:999px; overflow:hidden; background:#080c12; border:1px solid #283546; }
.progress-bar { height:100%; width:0; border-radius:999px; background:linear-gradient(90deg,#5d7cff,#8d68ff); transition:width .32s ease; }
.progress-bar.indeterminate { width:32% !important; animation:indeterminate 1.15s ease-in-out infinite; }
@keyframes indeterminate { from { transform:translateX(-110%); } to { transform:translateX(330%); } }
.progress-detail { margin-top:8px; color:var(--muted); font-size:12px; }
.stats-grid { display:grid; gap:12px; margin:14px 0; }
.stats-grid.five { grid-template-columns:repeat(5,minmax(0,1fr)); }
.stat-card { padding:16px; background:linear-gradient(180deg,#121a25,#0f151e); border:1px solid var(--line); border-radius:13px; }
.stat-card span { display:block; color:var(--muted); font-size:12px; margin-bottom:8px; }
.stat-card strong { font-size:24px; letter-spacing:-.03em; }
.stat-card.accent { border-color:#40538c; background:linear-gradient(180deg,#17213b,#11182a); }
.stat-card.accent strong { color:#aebcff; }
.meta-row { display:flex; align-items:center; gap:16px; flex-wrap:wrap; color:var(--muted); font-size:12px; margin:12px 2px 16px; }
.meta-row strong { color:#dbe5ef; }
.meta-row form { margin-left:auto; }
.text-button { border:0; background:none; color:#9eb0ff; cursor:pointer; padding:0; font-weight:800; }
.candidate-list,.nas-list { display:grid; gap:14px; }
.candidate-card,.nas-group { overflow:hidden; }
.candidate-toolbar,.nas-group-head { min-height:56px; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:12px 16px; border-bottom:1px solid var(--line); background:rgba(22,30,42,.82); }
.score-wrap,.nas-group-head>div { display:flex; align-items:center; gap:10px; min-width:0; }
.confidence { display:inline-flex; align-items:center; border-radius:999px; padding:5px 9px; font-size:11px; font-weight:900; }
.confidence.high { background:#143727; color:#7be3ae; }
.confidence.likely { background:#18324c; color:#8fc7ff; }
.confidence.possible { background:#3d3318; color:#f1d275; }
.confidence.weak { background:#382629; color:#e9b1b5; }
.score { font-weight:900; }
.matched { color:var(--muted); font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.compare-grid { display:grid; grid-template-columns:minmax(0,1fr) 64px minmax(0,1fr); }
.media-side { padding:22px; min-width:0; }
.media-label { display:flex; align-items:center; gap:8px; color:#91a0b1; font-size:11px; font-weight:900; letter-spacing:.08em; margin-bottom:14px; }
.media-side h3 { font-size:20px; margin-bottom:5px; }
.media-side h3 small { color:#8493a2; font-weight:600; }
.media-side h4 { color:#a2afbc; font-size:14px; font-weight:600; margin-bottom:18px; }
.versus { display:grid; place-items:center; border-left:1px solid var(--line); border-right:1px solid var(--line); background:#0c1118; }
.versus span { width:34px; height:34px; border-radius:50%; display:grid; place-items:center; background:#1a2330; color:#8492a2; font-size:11px; font-weight:900; }
.detail-grid { display:grid; grid-template-columns:92px minmax(0,1fr); gap:8px 12px; align-items:start; }
.detail-grid>span { color:#778697; font-size:12px; }
.detail-grid>strong { font-size:13px; }
code { font-family:"Cascadia Code","SFMono-Regular",Consolas,monospace; font-size:12px; background:#090e14; border:1px solid #1e2a38; color:#b8c7d6; padding:2px 5px; border-radius:5px; overflow-wrap:anywhere; white-space:normal; }
.detail-grid code { display:block; }
.card-footer-note { padding:10px 16px; border-top:1px solid var(--line); color:#8493a3; background:#0b1017; font-size:11px; }
.delete-form { margin-top:16px; display:flex; gap:8px; flex-wrap:wrap; }
.delete-form input { min-width:150px; background:#090e14; border:1px solid #334153; border-radius:9px; padding:9px 10px; color:white; }
.empty-state { padding:34px; text-align:center; margin-top:14px; }
.empty-state h3 { margin:10px 0 6px; }
.empty-state p { color:var(--muted); margin:0; }
.empty-icon { width:48px; height:48px; display:grid; place-items:center; margin:0 auto; border-radius:14px; background:#172234; color:#94a9ff; font-weight:900; }
.nas-meta { display:flex; gap:20px; flex-wrap:wrap; padding:12px 16px; border-bottom:1px solid var(--line); color:var(--muted); font-size:12px; }
.saving-chip { border-radius:999px; padding:6px 10px; background:#143727; color:#7be3ae; font-size:12px; font-weight:900; }
.file-list { padding:8px 0; }
.file-row { display:grid; grid-template-columns:34px minmax(0,1fr); gap:8px; align-items:center; padding:8px 16px; }
.file-row+.file-row { border-top:1px solid rgba(38,50,68,.65); }
.file-index { width:24px; height:24px; display:grid; place-items:center; background:#1a2431; border-radius:7px; color:#8392a2; font-size:11px; font-weight:800; }
.error-list { display:grid; gap:6px; margin-top:10px; }

@media (max-width:1100px) {
  .hero-grid { grid-template-columns:1fr; }
  .stats-grid.five { grid-template-columns:repeat(3,1fr); }
  .connections-grid { grid-template-columns:1fr; }
}
@media (max-width:800px) {
  .page-shell { padding:16px; }
  .app-header,.section-title { align-items:flex-start; flex-direction:column; }
  .hero-panel { padding:24px; }
  .hero-panel h2 { font-size:34px; }
  .stats-grid.five { grid-template-columns:1fr 1fr; }
  .compare-grid { grid-template-columns:1fr; }
  .versus { border-left:0; border-right:0; border-top:1px solid var(--line); border-bottom:1px solid var(--line); padding:8px; }
  .matched { white-space:normal; }
  .candidate-toolbar,.nas-group-head { align-items:flex-start; flex-direction:column; }
}
@media (max-width:520px) {
  .stats-grid.five { grid-template-columns:1fr; }
  .mode-pill { display:none; }
  .section-nav { width:100%; }
  .section-nav a { flex:1; text-align:center; }
}


/* v0.4 review/readability improvements */
.candidate-card,
.candidate-card h2,
.candidate-card h3,
.candidate-card h4,
.candidate-card strong,
.candidate-card .score,
.candidate-card .detail-grid strong {
  color: var(--text) !important;
}
.candidate-card code { color: #c9dcff !important; }
.filtered-out { display: none !important; }

.review-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 190px 190px auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  margin: 0 0 16px;
  box-shadow: none;
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid #2b394b;
  background: #0d131c;
  border-radius: 10px;
  padding: 0 11px;
}
.search-icon { color: #8090a4; font-size: 18px; }
.review-tools input,
.review-tools select {
  width: 100%;
  min-height: 40px;
  border: 1px solid #2b394b;
  background: #0d131c;
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  outline: none;
}
.search-wrap input {
  border: 0;
  background: transparent;
  padding-left: 0;
}
.review-tools input:focus,
.review-tools select:focus,
.search-wrap:focus-within {
  border-color: #5f7dff;
  box-shadow: 0 0 0 3px rgba(95,125,255,.10);
}
.result-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  text-align: right;
}

.candidate-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recommendation {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 900;
  border: 1px solid transparent;
}
.recommendation.radarr { color: #f5d46f; background: #392f12; border-color: #5d4b19; }
.recommendation.sonarr { color: #91c6ff; background: #142e48; border-color: #21496f; }
.recommendation.either { color: #b9c4d0; background: #202832; border-color: #34404d; }

.evidence-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 16px;
  background: #0c1219;
  border-bottom: 1px solid var(--line);
  color: #8f9daf;
  font-size: 11px;
}
.evidence-strip > span:not(.verify-chip) {
  padding-right: 8px;
  border-right: 1px solid #273344;
}
.evidence-strip strong { color: #d8e3ef !important; }
.verify-chip {
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 800;
}
.verify-chip.verified { background: #123727; color: #78e1aa; }
.verify-chip.unverified { background: #352d17; color: #e5cb78; }

.recommendation-panel {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 15px 18px;
  background: linear-gradient(90deg, rgba(77,102,180,.12), rgba(19,27,39,.35));
  border-top: 1px solid var(--line);
}
.recommendation-panel > div:first-child { min-width: 0; }
.recommendation-panel strong {
  display: block;
  margin: 4px 0;
  font-size: 15px;
}
.recommendation-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.recommend-saving {
  text-align: right;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.recommend-saving strong {
  color: #aebcff !important;
  font-size: 18px;
}

@media (max-width: 980px) {
  .review-tools { grid-template-columns: 1fr 1fr; }
  .search-wrap { grid-column: 1 / -1; }
  .result-count { text-align: left; }
}
@media (max-width: 650px) {
  .review-tools { grid-template-columns: 1fr; }
  .search-wrap { grid-column: auto; }
  .candidate-actions { width: 100%; justify-content: space-between; }
  .recommendation-panel { align-items: flex-start; flex-direction: column; }
  .recommend-saving { text-align: left; }
}


/* v0.5 NAS mount manager */
.mount-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0;
  overflow: hidden;
  margin-bottom: 14px;
}
.mount-summary > div {
  padding: 16px 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.mount-summary > div + div { border-left: 1px solid var(--line); }
.mount-summary strong { font-size: 24px; color: var(--text); }
.mount-summary span { color: var(--muted); font-size: 12px; }

.mount-list { display: grid; gap: 12px; margin-bottom: 22px; }
.mount-card { padding: 0; overflow: hidden; }
.mount-card.disabled-mount { opacity: .68; }
.mount-main {
  display: grid;
  grid-template-columns: 44px minmax(0,1fr) auto;
  gap: 14px;
  padding: 16px;
  align-items: start;
}
.mount-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #fff;
}
.mount-copy h3 { margin: 0; font-size: 16px; color: var(--text); }
.mount-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mount-state {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
}
.mount-state.ready { background: #113727; color: #7de3ac; }
.mount-state.pending { background: #382f16; color: #e7cb70; }
.mount-state.warning { background: #43251d; color: #ffb08a; }
.mount-state.muted { background: #202934; color: #9ba8b6; }

.mount-paths { margin-top: 10px; display: grid; gap: 5px; }
.mount-paths span {
  display: grid;
  grid-template-columns: 150px minmax(0,1fr);
  gap: 8px;
  align-items: baseline;
}
.mount-paths b { color: var(--muted); font-size: 11px; font-weight: 700; }
.mount-paths code { overflow-wrap: anywhere; color: #c7d7f7; }
.mount-message { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.mount-actions { display: flex; gap: 7px; align-items: center; }
.env-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 8px;
  background: #202935;
  color: #9eaaba;
  font-size: 10px;
  font-weight: 800;
}
.ghost-danger {
  background: transparent;
  color: #ff9797;
  border: 1px solid #5c2c35;
}
.ghost-danger:hover { background: #32181e; }

.compose-helper {
  padding: 14px 16px 16px 74px;
  background: #0c1219;
  border-top: 1px solid var(--line);
}
.compose-helper summary {
  color: #e4c86c;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.compose-helper p {
  color: var(--muted);
  font-size: 11px;
  max-width: 850px;
}
.snippet-wrap { position: relative; max-width: 780px; }
.snippet-wrap pre {
  margin: 8px 0;
  padding: 13px 90px 13px 13px;
  background: #080d13;
  border: 1px solid #273344;
  border-radius: 9px;
  color: #c9dcff;
  overflow: auto;
  font-size: 11px;
}
.snippet-wrap .copy-snippet { position: absolute; top: 8px; right: 8px; }
.mount-help {
  padding: 12px 16px 12px 74px;
  background: #0c1219;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(3, 7, 12, .78);
  backdrop-filter: blur(7px);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-backdrop.hidden { display: none; }
.modal-card {
  width: min(680px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 0;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 { margin: 4px 0 0; color: var(--text); }
.icon-button {
  width: 36px;
  height: 36px;
  border: 1px solid #2b394b;
  border-radius: 10px;
  background: #111924;
  color: #b9c6d4;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.nas-form { padding: 20px 22px 22px; display: grid; gap: 16px; }
.nas-form label { display: grid; gap: 7px; }
.nas-form label > span { font-size: 12px; font-weight: 800; color: #d6e0eb; }
.nas-form input {
  min-height: 43px;
  border: 1px solid #2b394b;
  border-radius: 10px;
  background: #0c1219;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}
.nas-form input:focus {
  border-color: #647cff;
  box-shadow: 0 0 0 3px rgba(100,124,255,.12);
}
.nas-form small { color: var(--muted); font-size: 10px; }
.modal-note {
  padding: 13px 14px;
  border: 1px solid #2a3b53;
  border-radius: 10px;
  background: #101a28;
}
.modal-note strong { color: #b9c8ff; font-size: 12px; }
.modal-note p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 4px;
}

@media (max-width: 760px) {
  .mount-summary { grid-template-columns: 1fr; }
  .mount-summary > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .mount-main { grid-template-columns: 40px minmax(0,1fr); }
  .mount-actions { grid-column: 1 / -1; padding-left: 54px; }
  .mount-paths span { grid-template-columns: 1fr; gap: 2px; }
  .compose-helper, .mount-help { padding-left: 16px; }
}


/* v0.6 matching evidence */
.evidence-strip {
  row-gap: 7px;
}


/* v0.7 direct SMB + editable NAS */
.mount-state.smb{background:#192b4b;color:#9bbcff;border:1px solid #294775}.nas-form select{min-height:43px;border:1px solid #2b394b;border-radius:10px;background:#0c1219;color:var(--text);padding:10px 12px;outline:none}.nas-form select:focus{border-color:#647cff;box-shadow:0 0 0 3px rgba(100,124,255,.12)}.form-section{display:grid;gap:16px}.form-section.hidden{display:none}.form-grid.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}.nas-form em{color:var(--muted);font-style:normal;font-weight:500}.mount-actions{flex-wrap:wrap;justify-content:flex-end}@media(max-width:650px){.form-grid.two{grid-template-columns:1fr}}


/* v0.8 settings, history and score explanation */
.header-modes { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.text-link { color:#91a8ff; text-decoration:none; font-weight:800; }
.text-link:hover { text-decoration:underline; }

.score-explanation { border-bottom:1px solid var(--line); background:#0b1118; }
.score-explanation > summary {
  cursor:pointer; padding:10px 16px; color:#9db0c6; font-size:11px;
  font-weight:800; list-style:none;
}
.score-explanation > summary::-webkit-details-marker { display:none; }
.score-explanation > summary::before {
  content:'+'; display:inline-grid; place-items:center; width:18px; height:18px;
  margin-right:7px; border-radius:5px; background:#182332; color:#9fb4cf;
}
.score-explanation[open] > summary::before { content:'–'; }
.score-explanation-grid {
  display:grid; grid-template-columns:minmax(0,1fr) 280px; border-top:1px solid #1d2836;
}
.score-components { padding:12px 16px; }
.score-component {
  display:grid; grid-template-columns:165px 70px minmax(0,1fr); gap:8px;
  padding:6px 0; border-bottom:1px solid #182230; align-items:baseline;
}
.score-component:last-child { border-bottom:0; }
.score-component span { color:#9aa9ba; font-size:11px; }
.score-component strong { color:#dce7f3 !important; font-size:12px; }
.score-component strong.positive { color:#7ce1ac !important; }
.score-component strong.negative { color:#ff9c9c !important; }
.score-component small { color:#748398; font-size:10px; }
.score-total {
  padding:14px 16px; border-left:1px solid #1d2836; background:#0d141d;
  display:grid; gap:5px; align-content:start;
}
.score-total > span { color:#8393a6; font-size:10px; text-transform:uppercase; letter-spacing:.06em; }
.score-total > strong { color:#f2f6fa !important; font-size:25px; }
.score-total code { color:#bed2ff; overflow-wrap:anywhere; }
.score-total small { color:#758498; font-size:10px; }
.reason-row { padding:8px 16px 12px; display:flex; gap:6px; flex-wrap:wrap; }
.reason-row span {
  padding:4px 7px; border-radius:999px; background:#172130; color:#93a7bf; font-size:10px;
}
.auto-delete-chip {
  display:inline-flex; padding:6px 9px; border-radius:999px;
  background:#471c25; color:#ffb0b9; font-size:10px; font-weight:900;
}

.history-list { display:grid; gap:10px; }
.history-card { padding:0; overflow:hidden; }
.history-card > summary {
  display:grid; grid-template-columns:130px minmax(0,1fr) 160px 170px;
  gap:14px; align-items:center; padding:14px 16px; cursor:pointer; list-style:none;
}
.history-card > summary::-webkit-details-marker { display:none; }
.history-type {
  justify-self:start; border-radius:999px; padding:5px 8px; font-size:10px; font-weight:900;
}
.history-type.arr { background:#173252; color:#91c5ff; }
.history-type.nas { background:#352760; color:#bfa8ff; }
.history-main { display:grid; gap:3px; min-width:0; }
.history-main strong { color:var(--text); }
.history-main span, .history-saving span, .history-delta span { color:var(--muted); font-size:10px; }
.history-saving { display:grid; gap:3px; }
.history-saving strong { color:#afbcff; }
.history-delta { display:grid; gap:3px; text-align:right; }
.delta-up { color:#ffba76 !important; }
.delta-down { color:#79dda9 !important; }
.history-detail { border-top:1px solid var(--line); background:#0c1219; padding:14px 16px; }
.history-change-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.history-change-grid > div { display:grid; gap:5px; align-content:start; }
.history-change-grid > div > strong { font-size:22px; color:var(--text); }
.history-change-grid code { display:block; color:#aebed0; padding:4px 0; overflow-wrap:anywhere; }
.history-settings {
  margin-top:12px; padding-top:10px; border-top:1px solid #1c2734;
  display:flex; gap:14px; flex-wrap:wrap; color:var(--muted); font-size:10px;
}

.settings-form { display:grid; gap:14px; }
.settings-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.settings-card { display:grid; gap:14px; }
.settings-card-head {
  display:flex; align-items:center; gap:11px; padding-bottom:10px; border-bottom:1px solid var(--line);
}
.settings-card-head h3 { margin:0; color:var(--text); }
.settings-card-head p { margin:3px 0 0; color:var(--muted); font-size:11px; }
.settings-icon {
  width:38px; height:38px; border-radius:10px; display:grid; place-items:center;
  font-weight:900; color:#fff; flex:0 0 auto;
}
.match-bg { background:linear-gradient(135deg,#5950dd,#8a66ef); }
.deletion-bg { background:linear-gradient(135deg,#a93a4c,#6e2636); }
.settings-card label { display:grid; gap:6px; }
.settings-card label > span { color:#d5dfeb; font-size:11px; font-weight:800; }
.settings-card input[type="password"],
.settings-card input[type="number"],
.settings-card input:not([type]),
.settings-card select {
  min-height:41px; border:1px solid #2b394b; border-radius:9px; background:#0c1219;
  color:var(--text); padding:9px 11px; outline:none;
}
.settings-card input:focus, .settings-card select:focus {
  border-color:#647cff; box-shadow:0 0 0 3px rgba(100,124,255,.12);
}
.settings-card small { color:var(--muted); font-size:10px; line-height:1.45; }
.range-line { display:grid; grid-template-columns:1fr 54px; gap:10px; align-items:center; }
.range-line input[type="range"] { width:100%; }
.range-line output {
  background:#111925; border:1px solid #2b394b; border-radius:8px;
  padding:7px; text-align:center; color:#cbd7e6; font-weight:900;
}
.toggle-row { grid-template-columns:auto 1fr !important; gap:10px !important; align-items:start; }
.toggle-row input { margin-top:3px; }
.toggle-row > span { display:grid; gap:3px; }
.toggle-row strong { color:#dce6f0; }
.danger-zone {
  display:grid; gap:12px; padding:13px; border:1px solid #56303a;
  background:#24141a; border-radius:10px;
}
.settings-save {
  display:flex; justify-content:space-between; gap:18px; align-items:center;
}
.settings-save > div { display:grid; gap:3px; }
.settings-save strong { color:var(--text); }
.settings-save span { color:var(--muted); font-size:11px; }

@media (max-width:900px) {
  .score-explanation-grid { grid-template-columns:1fr; }
  .score-total { border-left:0; border-top:1px solid #1d2836; }
  .history-card > summary { grid-template-columns:1fr 1fr; }
  .history-delta { text-align:left; }
  .settings-grid { grid-template-columns:1fr; }
}
@media (max-width:650px) {
  .score-component { grid-template-columns:1fr 60px; }
  .score-component small { grid-column:1 / -1; }
  .history-change-grid { grid-template-columns:1fr; }
  .settings-save { flex-direction:column; align-items:stretch; }
}

.legacy-score-note {
  padding:10px 16px;
  border-bottom:1px solid var(--line);
  background:#0c1219;
  color:#8493a4;
  font-size:10px;
}


/* v0.9 resolver overhaul */
.confidence.confirmed {
  background:#173d2d;
  color:#8ef0bd;
  border:1px solid #276347;
}
.confidence.verified {
  background:#173a55;
  color:#9fd4ff;
  border:1px solid #2a587b;
}
.learned-chip {
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:6px 9px;
  background:#173d2d;
  color:#8ef0bd;
  font-size:10px;
  font-weight:900;
}
.confirm-button {
  background:#173d2d;
  color:#95efc0;
  border:1px solid #2a6649;
}
.confirm-button:hover { background:#20543d; }
.reject-button {
  background:#3b2026;
  color:#ffb0b8;
  border:1px solid #63313b;
}
.reject-button:hover { background:#522a33; }
.resolver-status {
  color:#b9c5d3 !important;
  font-weight:800;
}
.media-bg { background:linear-gradient(135deg,#1d6e73,#2a9b86); }
.learning-bg { background:linear-gradient(135deg,#4365d6,#785cc9); }
.settings-info {
  display:grid;
  gap:4px;
  padding:11px 12px;
  border:1px solid #294053;
  border-radius:9px;
  background:#0e1822;
}
.settings-info strong {
  color:#b9ccdf;
  font-size:11px;
}
.settings-info span {
  color:var(--muted);
  font-size:10px;
  line-height:1.45;
}
.learning-stats {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.learning-stats > div {
  display:grid;
  gap:2px;
  padding:12px;
  border:1px solid #2a3544;
  border-radius:9px;
  background:#0c1219;
}
.learning-stats strong {
  color:#dce7f3;
  font-size:23px;
}
.learning-stats span {
  color:var(--muted);
  font-size:10px;
}
.score-total > strong:first-of-type {
  font-size:14px;
}
.score-component small {
  line-height:1.45;
}
@media (max-width:650px) {
  .learning-stats { grid-template-columns:1fr; }
}

.confirm-match-form {
  display:flex;
  align-items:center;
  gap:6px;
}
.confirm-match-form select {
  min-height:32px;
  max-width:170px;
  border:1px solid #2b4f3c;
  border-radius:8px;
  background:#0d1712;
  color:#a9dfc0;
  padding:5px 7px;
  font-size:10px;
}

.verify-chip.unavailable {
  background:#282d36;
  color:#aeb8c5;
  border:1px solid #39424d;
}


/* v1.0 multi-page application shell */
:root {
  --sidebar-width: 248px;
}
.app-body { margin:0; min-height:100vh; background:#090e14; }
.app-layout { min-height:100vh; display:grid; grid-template-columns:var(--sidebar-width) minmax(0,1fr); }
.sidebar {
  position:fixed; inset:0 auto 0 0; width:var(--sidebar-width); z-index:50;
  display:flex; flex-direction:column; background:#0b1118; border-right:1px solid #1f2a38;
  box-shadow:12px 0 34px rgba(0,0,0,.12);
}
.sidebar-brand { padding:18px 16px 14px; border-bottom:1px solid #1b2633; }
.sidebar-brand-link { display:flex; align-items:center; gap:10px; text-decoration:none; }
.sidebar-brand-link strong { display:block; color:#f2f6fa; font-size:15px; }
.sidebar-brand-link span { display:block; color:#718197; font-size:9px; margin-top:2px; }
.sidebar-nav { padding:12px 9px; display:grid; gap:4px; }
.sidebar-nav a {
  min-height:42px; display:grid; grid-template-columns:28px minmax(0,1fr) auto; gap:9px;
  align-items:center; padding:7px 9px; border-radius:9px; color:#8e9dae; text-decoration:none;
  font-size:11px; font-weight:750; border:1px solid transparent;
}
.sidebar-nav a:hover { background:#111a25; color:#cbd7e4; }
.sidebar-nav a.active { background:#172131; color:#eef4fa; border-color:#29384b; }
.sidebar-nav a b { font-size:9px; padding:3px 6px; border-radius:999px; background:#202d3d; color:#9fb0c3; }
.nav-icon { width:26px; height:26px; display:grid; place-items:center; border-radius:7px; background:#141e2a; color:#889bb2; font-size:9px; font-weight:900; }
.sidebar-nav a.active .nav-icon { background:#263754; color:#b9cbff; }
.sidebar-spacer { flex:1; }
.sidebar-scan-stack { padding:8px 12px 5px; display:grid; gap:7px; }
.sidebar-mini-scan { padding:8px 9px; border:1px solid #1e2936; border-radius:8px; background:#0e151e; }
.sidebar-mini-scan > div:first-child { display:flex; justify-content:space-between; gap:8px; align-items:center; }
.sidebar-mini-scan span { color:#738399; font-size:9px; }
.sidebar-mini-scan strong { color:#a5b3c3; font-size:8px; max-width:116px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-progress-track { margin-top:6px; height:3px; border-radius:99px; overflow:hidden; background:#18222e; }
.sidebar-progress-bar { height:100%; width:0; background:#6e82f5; transition:width .25s ease; }
.sidebar-progress-bar.running { box-shadow:0 0 7px rgba(110,130,245,.55); }
.sidebar-progress-bar.error { background:#cf5b6d; }
.sidebar-health { margin:6px 12px; padding:10px; border-top:1px solid #1b2632; }
.sidebar-health-title { color:#5f7084; font-size:8px; font-weight:900; letter-spacing:.09em; text-transform:uppercase; margin-bottom:7px; }
.sidebar-health-row { display:grid; grid-template-columns:9px 1fr auto; gap:7px; align-items:center; min-height:23px; }
.sidebar-health-row > span:nth-child(2) { color:#9baabb; font-size:9px; }
.sidebar-health-row small { color:#5f7185; font-size:8px; max-width:92px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sidebar-health-row .health-dot { width:7px; height:7px; }
.sidebar-mode { padding:6px 12px 15px; display:flex; flex-wrap:wrap; gap:5px; }
.mode-pill.compact { font-size:8px; padding:5px 7px; }
.main-content { grid-column:2; width:min(1480px, calc(100% - 36px)); margin:0 auto; padding:24px 0 50px; }
.page-header { min-height:72px; display:flex; justify-content:space-between; gap:24px; align-items:flex-start; margin-bottom:18px; }
.page-header h1 { margin:4px 0 4px; color:#f0f4f8; font-size:27px; letter-spacing:-.025em; }
.page-header p { margin:0; color:#78899e; font-size:11px; max-width:740px; }
.page-header-actions { display:flex; gap:8px; align-items:center; }
.mobile-topbar { display:none; }
.sidebar-backdrop { display:none; }

.dashboard-hero {
  min-height:170px; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:30px; align-items:center;
  padding:28px 30px; background:radial-gradient(circle at 70% 0%,rgba(90,105,220,.18),transparent 42%),#101722;
}
.dashboard-hero h2 { margin:6px 0 7px; color:#f2f5f9; font-size:25px; }
.dashboard-hero p { color:#8292a6; max-width:640px; margin:0; }
.dashboard-hero-saving { min-width:220px; display:grid; justify-items:end; gap:3px; }
.dashboard-hero-saving span { color:#7d8ba0; font-size:9px; text-transform:uppercase; letter-spacing:.08em; }
.dashboard-hero-saving strong { color:#c1cbff; font-size:34px; }
.dashboard-hero-saving small { color:#64758a; font-size:9px; }
.dashboard-kpis { display:grid; grid-template-columns:repeat(auto-fit,minmax(165px,1fr)); gap:12px; margin:13px 0; }
.dashboard-kpi { display:grid; gap:4px; text-decoration:none; transition:transform .12s ease,border-color .12s ease; }
.dashboard-kpi:hover { transform:translateY(-1px); border-color:#384b65; }
.dashboard-kpi span { color:#8191a5; font-size:10px; }
.dashboard-kpi strong { color:#eef3f8; font-size:27px; }
.dashboard-kpi small { color:#65768a; font-size:9px; }
.dashboard-grid-two { display:grid; grid-template-columns:1fr 1fr; gap:13px; margin-bottom:13px; }
.dashboard-panel { padding:0; overflow:hidden; }
.panel-heading { min-height:66px; padding:15px 17px; display:flex; justify-content:space-between; gap:12px; align-items:center; border-bottom:1px solid var(--line); }
.panel-heading h2 { margin:3px 0 0; color:#edf2f7; font-size:16px; }
.quick-action-list { padding:7px 17px 15px; display:grid; gap:5px; }
.quick-action-row { min-height:58px; display:flex; align-items:center; justify-content:space-between; gap:15px; border-bottom:1px solid #182330; }
.quick-action-row:last-of-type { border-bottom:0; }
.quick-action-row > div { display:grid; gap:3px; }
.quick-action-row strong { color:#dce5ef; font-size:11px; }
.quick-action-row span { color:#74859a; font-size:9px; }
.compact-progress { margin:4px 0 9px; border:1px solid #223043; border-radius:8px; padding:10px; }
.dashboard-connections { display:grid; gap:8px; padding:14px 17px 17px; }
.dashboard-history-list { display:grid; }
.dashboard-history-row { min-height:52px; display:grid; grid-template-columns:110px minmax(0,1fr) auto; gap:14px; align-items:center; padding:7px 17px; border-bottom:1px solid #182330; }
.dashboard-history-row:last-child { border-bottom:0; }
.dashboard-history-row > div { display:grid; gap:2px; }
.dashboard-history-row > div strong { color:#cfd9e5; font-size:10px; }
.dashboard-history-row small { color:#6c7d90; font-size:9px; }
.dashboard-history-row > strong { color:#aebaff; font-size:11px; }
.empty-inline { padding:20px; color:#74869a; font-size:10px; }

/* Multi-page cleanup: the former sections are now the page body. */
.main-content .content-section { margin-top:0; }
.main-content .content-section > .section-title:first-child { margin-top:0; }

@media (max-width:1100px) {
  .dashboard-kpis { grid-template-columns:1fr 1fr; }
  .dashboard-grid-two { grid-template-columns:1fr; }
}
@media (max-width:780px) {
  .app-layout { display:block; }
  .sidebar { transform:translateX(-105%); transition:transform .2s ease; width:270px; }
  .sidebar.open { transform:translateX(0); }
  .sidebar-backdrop { position:fixed; inset:0; z-index:45; display:block; background:rgba(2,5,9,.66); }
  .sidebar-backdrop.hidden { display:none; }
  .mobile-topbar {
    position:sticky; top:0; z-index:35; min-height:54px; display:grid; grid-template-columns:40px auto 1fr;
    align-items:center; gap:8px; padding:0 12px; background:rgba(10,15,22,.94); backdrop-filter:blur(12px); border-bottom:1px solid #1f2a38;
  }
  .mobile-brand { color:#eff4f9; text-decoration:none; font-size:12px; font-weight:900; }
  .mobile-page-title { color:#74859a; font-size:9px; text-align:right; }
  .main-content { width:calc(100% - 24px); margin:0 12px; padding:17px 0 40px; }
  .page-header { min-height:auto; margin-bottom:14px; }
  .page-header h1 { font-size:23px; }
  .dashboard-hero { grid-template-columns:1fr; padding:20px; }
  .dashboard-hero-saving { justify-items:start; }
  .dashboard-kpis { grid-template-columns:1fr 1fr; }
}
@media (max-width:520px) {
  .dashboard-kpis { grid-template-columns:1fr; }
  .dashboard-history-row { grid-template-columns:1fr auto; }
  .dashboard-history-row .history-type { grid-column:1 / -1; }
  .page-header { flex-direction:column; }
}
/* Page headers replace the duplicated section headings from the legacy single-page layout. */
.main-content > .content-section > .section-title:first-child { display:none; }


/* v1.1 NAS connection verification */
.mount-state.verified {
  background: #113727;
  color: #7de3ac;
  border: 1px solid #1e6444;
}
.mount-state.failed {
  background: #421c25;
  color: #ff9ba7;
  border: 1px solid #6e2b39;
}
.mount-state.testing {
  background: #243047;
  color: #aac2ff;
  border: 1px solid #38517a;
}
.mount-tested {
  margin: 4px 0 0;
  color: #65768a;
  font-size: 10px;
}
.nas-test-result {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid #2b394b;
  border-radius: 10px;
  background: #0d141d;
}
.nas-test-result .test-dot {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 999px;
  background: #718096;
}
.nas-test-result strong {
  color: #d9e3ee;
  font-size: 12px;
}
.nas-test-result p {
  margin: 4px 0 0;
  color: #8190a2;
  font-size: 10px;
  line-height: 1.45;
}
.nas-test-result.success {
  border-color: #235d43;
  background: #0f2119;
}
.nas-test-result.success .test-dot {
  background: #59d69a;
  box-shadow: 0 0 0 4px rgba(89, 214, 154, .11);
}
.nas-test-result.success strong { color: #8ae7b8; }
.nas-test-result.error {
  border-color: #65313c;
  background: #251319;
}
.nas-test-result.error .test-dot {
  background: #ff6f7f;
  box-shadow: 0 0 0 4px rgba(255, 111, 127, .10);
}
.nas-test-result.error strong { color: #ff9eaa; }
.nas-test-result.testing .test-dot {
  background: #8da9ff;
  animation: nas-test-pulse 1s ease-in-out infinite;
}
@keyframes nas-test-pulse {
  0%, 100% { opacity: .45; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1.15); }
}
.modal-actions #nas-submit:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.dashboard-nas-warning { margin-bottom: 14px; }
.error-empty .empty-icon {
  background: #421c25;
  color: #ff9ba7;
}
.connection-copy span {
  overflow-wrap: anywhere;
}


/* v1.4 general-file duplicate scanner */
.files-bg {
  background: linear-gradient(135deg, #357f78, #255a74);
}
.history-type.files {
  background: #173c37;
  color: #8ce3d2;
}
.file-type-chip {
  display: inline-flex;
  margin-left: 8px;
  padding: 4px 7px;
  border-radius: 999px;
  background: #202a36;
  color: #a9bacd;
  font-size: 10px;
  font-weight: 900;
}
.general-file-path {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.general-file-path code {
  overflow-wrap: anywhere;
}
.general-file-path small {
  color: #6f8195;
  font-size: 9px;
}
.general-file-rules {
  margin: 12px 0 14px;
}


/* v1.5 multi-select cross-library review */
.bulk-review-bar {
  position: sticky;
  top: 12px;
  z-index: 45;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  margin: 0 0 14px;
  border-color: #35435a;
  box-shadow: 0 12px 34px rgba(0,0,0,.22);
}
.bulk-selection,
.bulk-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.bulk-selection strong {
  min-width: 75px;
  color: #cdd8e5;
  font-size: 11px;
}
.bulk-action-status {
  color: #7f90a5;
  font-size: 10px;
  margin-left: auto;
}
.candidate-select-wrap {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-right: 4px;
  cursor: pointer;
  border: 1px solid #314052;
  border-radius: 9px;
  background: #0c131c;
}
.candidate-select-wrap input {
  width: 17px;
  height: 17px;
  accent-color: #6b7cff;
  cursor: pointer;
}
.bulk-candidate-action:disabled {
  opacity: .48;
  cursor: not-allowed;
}

/* v1.5 unmanaged / orphan media */
.history-type.orphans {
  background: #402433;
  color: #ffb3d2;
}
.orphan-list {
  display: grid;
  gap: 11px;
}
.orphan-card {
  overflow: hidden;
}
.orphan-card-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.orphan-card-head > div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.orphan-card-head strong {
  color: var(--text);
  overflow-wrap: anywhere;
}
.orphan-chip {
  flex: 0 0 auto;
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: #421c2c;
  color: #ffabc8;
  font-size: 10px;
  font-weight: 900;
}
.orphan-size {
  flex: 0 0 auto;
  color: #9eb3ff !important;
}
.orphan-detail-grid {
  padding: 14px 16px;
}
.orphan-detail-grid code {
  overflow-wrap: anywhere;
}
.stats-grid.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .dashboard-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .stats-grid.six { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .bulk-review-bar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }
  .bulk-action-status { margin-left: 0; }
  .stats-grid.six { grid-template-columns: 1fr 1fr; }
}


/* v1.6 scan scopes and stream language metadata */
.scan-source-picker {
  padding: 0;
  overflow: hidden;
  margin-bottom: 14px;
}
.scan-source-picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}
.scan-source-picker-head > div {
  display: grid;
  gap: 3px;
}
.scan-source-picker-head strong { color: var(--text); }
.source-picker-hint {
  max-width: 520px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}
.scan-source-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 0;
}
.scan-source-option-row {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.scan-source-option-row input {
  width: 17px;
  height: 17px;
  accent-color: #6678ff;
}
.scan-source-option-row > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.scan-source-option-row strong {
  color: #dfe8f2;
  font-size: 11px;
}
.scan-source-option-row small {
  color: #728399;
  overflow-wrap: anywhere;
}
.scan-source-option-row em {
  color: #72daa8;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}
.scan-source-option-row.source-not-ready {
  opacity: .48;
  cursor: not-allowed;
}
.scan-source-option-row.source-not-ready em {
  color: #ff939f;
}

.connection-role-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 9px;
}
.connection-role {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
}
.media-role { background:#193551; color:#92c8ff; }
.file-role { background:#173d37; color:#8ee0cf; }
.orphan-role { background:#402433; color:#ffb1d0; }
.muted-role { background:#202833; color:#8391a2; }

.scan-role-picker {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #29384a;
  border-radius: 10px;
  background: #0d141d;
}
.field-heading {
  color: #d6e0ea;
  font-size: 11px;
  font-weight: 900;
}
.scan-role-picker > small {
  color: #75869a;
  font-size: 10px;
}

.language-list {
  display: flex !important;
  gap: 5px;
  flex-wrap: wrap;
  align-items: center;
}
.language-chip {
  display: inline-flex;
  padding: 4px 7px;
  border-radius: 999px;
  background: #202a36;
  color: #bac8d7;
  font-size: 10px;
  font-weight: 800;
}
.language-chip.english {
  background: #14382a;
  color: #86e5b3;
  border: 1px solid #245f45;
}
.language-chip.unknown {
  background: #302b20;
  color: #cbbd83;
}
.stream-details {
  margin: 12px 16px 0;
  border: 1px solid #273548;
  border-radius: 9px;
  background: #0c131b;
  overflow: hidden;
}
.stream-details summary {
  cursor: pointer;
  padding: 9px 11px;
  color: #a8bad1;
  font-size: 10px;
  font-weight: 900;
}
.stream-track-list {
  display: grid;
  gap: 5px;
  padding: 10px 11px;
  border-top: 1px solid #243143;
}
.stream-track-list span {
  color: #91a1b4;
  font-size: 10px;
}
.stream-track-list b {
  color: #d5e0eb;
  margin-right: 5px;
}

@media (max-width: 720px) {
  .scan-source-picker-head {
    flex-direction: column;
  }
  .source-picker-hint { text-align: left; }
}

.mount-resolved {
  margin: 5px 0 0;
  color: #7f91a8;
  font-size: 10px;
}
.mount-resolved code {
  color: #a8c0ff;
}

.scan-in-progress-note {
  margin: 12px 0 14px;
  border-color: #294765;
  background: #101d2b;
  color: #9eb4ca;
}
.scan-in-progress-note strong {
  color: #cfe2f6;
}
.live-scan-stats .stat-card strong {
  font-size: 22px;
}

#nas-live-result-panel.hidden,
#nas-completed-result-panel.hidden {
  display: none !important;
}


/* v2.0 photo duplicate engine */
.photo-role{background:#3a254f;color:#d8b5ff}.history-type.photos{background:#332550;color:#c9b1ff}.photo-bg{background:linear-gradient(135deg,#7b4ee5,#b25fd6)}
.photo-stats-grid{grid-template-columns:repeat(6,minmax(0,1fr))}.photo-section-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin:24px 0 10px;padding:0 2px}.photo-section-heading>div{display:flex;align-items:center;gap:9px}.photo-section-heading h3{margin:0;color:var(--text)}.photo-section-heading p{margin:0;color:var(--muted);font-size:10px;max-width:680px;text-align:right}
.photo-kind{display:inline-flex;align-items:center;padding:5px 8px;border-radius:999px;font-size:9px;font-weight:900;letter-spacing:.03em;text-transform:uppercase}.photo-kind.exact{background:#173a2a;color:#86e0ad}.photo-kind.same{background:#252e58;color:#aebcff}.photo-kind.near{background:#49361d;color:#ffd190}
.photo-group-list{display:grid;gap:12px}.photo-group{padding:0;overflow:hidden}.photo-group-header{display:flex;align-items:center;justify-content:space-between;gap:15px;padding:13px 15px;border-bottom:1px solid var(--line);background:#101824}.photo-group-header>div:first-child{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.photo-group-header strong{color:var(--text)}.photo-group-header small{color:var(--muted);font-size:9px}.photo-recommendation{display:grid;gap:2px;max-width:440px;text-align:right}.photo-recommendation span,.photo-distance span{color:var(--muted);font-size:9px;text-transform:uppercase;letter-spacing:.05em}.photo-recommendation strong{color:#b8c5ff;font-size:10px}.photo-distance{display:grid;gap:2px;text-align:right}.photo-distance strong{font-size:20px;color:#ffd094}.photo-distance small{color:var(--muted)}
.photo-tile-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(245px,1fr));gap:1px;background:var(--line)}.photo-tile-grid.two-up{grid-template-columns:repeat(2,minmax(0,1fr))}.photo-tile{min-width:0;background:#0c131b;display:grid;grid-template-columns:150px minmax(0,1fr)}.photo-tile>img,.photo-preview-wrap img{width:150px;height:150px;object-fit:cover;display:block;background:#0b1016}.photo-preview-wrap{position:relative}.keep-photo-badge{position:absolute;left:8px;bottom:8px;padding:5px 7px;border-radius:999px;background:rgba(20,65,45,.94);color:#92e7b7;font-size:8px;font-weight:900;border:1px solid rgba(120,225,170,.35)}.photo-tile.recommended-photo{box-shadow:inset 0 0 0 1px #2f7350}.photo-tile-copy{min-width:0;padding:11px 12px;display:grid;gap:5px;align-content:start}.photo-tile-copy strong{color:#e1e8f0;overflow-wrap:anywhere}.photo-tile-copy span{color:#8394a9;font-size:9px}.photo-tile-copy code{color:#9fb2c7;overflow-wrap:anywhere;font-size:9px}.photo-flags{display:flex;gap:5px;flex-wrap:wrap}.photo-flags span,.photo-companion{display:inline-flex;width:max-content;padding:3px 6px;border-radius:999px;background:#211c32;color:#c5b4ec!important;font-size:8px!important;font-weight:800}.photo-companion{margin-top:2px}
@media(max-width:1050px){.photo-stats-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.photo-tile-grid.two-up{grid-template-columns:1fr}}@media(max-width:720px){.photo-section-heading{align-items:flex-start;flex-direction:column}.photo-section-heading p{text-align:left}.photo-tile{grid-template-columns:110px minmax(0,1fr)}.photo-tile>img,.photo-preview-wrap img{width:110px;height:110px}.photo-stats-grid{grid-template-columns:1fr 1fr}.photo-group-header{align-items:flex-start;flex-direction:column}.photo-recommendation,.photo-distance{text-align:left}}

/* v2.0 authentication, live scan log and photo review */
.auth-body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: #080d13;
  color: var(--text);
  font-family: inherit;
}
.auth-shell { width: min(470px, calc(100vw - 32px)); display: grid; gap: 18px; }
.auth-brand { display: flex; gap: 14px; align-items: center; padding: 0 6px; }
.brand-mark.large { width: 54px; height: 54px; border-radius: 15px; font-size: 18px; }
.auth-brand h1 { margin: 0; font-size: 28px; }
.auth-brand p { margin: 3px 0 0; color: var(--muted); }
.auth-card { padding: 24px; }
.auth-card h2 { margin: 6px 0; font-size: 25px; }
.auth-card > p { margin: 0 0 18px; color: var(--muted); }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; }
.auth-form label > span { color: #d8e2ed; font-size: 11px; font-weight: 900; }
.auth-form input, .auth-form select {
  min-height: 44px; border: 1px solid #2b394b; border-radius: 9px;
  background: #0a1119; color: var(--text); padding: 10px 12px;
}
.auth-form small { color: var(--muted); font-size: 10px; }
.auth-form .button { min-height: 44px; margin-top: 4px; }
.auth-footnote { margin-top: 16px; color: #708096; font-size: 10px; line-height: 1.5; }
.auth-error { margin: 12px 0; }

.sidebar-user {
  display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 9px; align-items: center;
  margin: 10px 12px; padding: 9px; border: 1px solid #253244; border-radius: 10px; background: #0d151f;
}
.sidebar-user-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #243758; color: #d9e5ff; font-weight: 900; }
.sidebar-user-copy { display: grid; min-width: 0; }
.sidebar-user-copy strong { color: #dce6f0; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy span { color: #72849a; font-size: 9px; }
.sidebar-logout { border: 0; background: transparent; color: #93a4b8; font-size: 18px; cursor: pointer; padding: 5px; }
.sidebar-logout:hover { color: #fff; }

.live-scan-log { margin: 10px 0 14px; padding: 0; overflow: hidden; }
.live-log-head { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: #0c131c; }
.live-log-head strong { color: #dbe5ef; font-size: 11px; }
.live-log-head span { color: #6f8195; font-size: 9px; }
.live-log-lines { max-height: 165px; overflow: auto; padding: 7px 10px; background: #070c12; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.live-log-line { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 9px; padding: 4px 2px; border-bottom: 1px solid #101923; font-size: 10px; }
.live-log-line:last-child { border-bottom: 0; }
.live-log-line time { color: #62758b; }
.live-log-line span { color: #b4c4d6; overflow-wrap: anywhere; }

.users-layout { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: 14px; align-items: start; }
.user-create-card { padding: 16px; position: sticky; top: 12px; }
.user-create-card h3 { margin: 0 0 14px; }
.compact-form { gap: 11px; }
.user-list { display: grid; gap: 10px; }
.user-card { padding: 14px; }
.user-card-head { display: grid; grid-template-columns: 38px minmax(0,1fr) auto auto; gap: 10px; align-items: center; }
.user-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #29355b; color: #e1e7ff; font-weight: 900; }
.user-card-head > div:nth-child(2) { display: grid; }
.user-card-head > div:nth-child(2) strong { color: var(--text); }
.user-card-head > div:nth-child(2) span { color: var(--muted); font-size: 10px; }
.user-role, .user-status { padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 900; }
.user-role.admin { background: #492232; color: #ffb4cd; }
.user-role.reviewer { background: #193952; color: #9ed0ff; }
.user-role.viewer { background: #252d38; color: #aebbc9; }
.user-status.enabled { background: #123729; color: #82e4b0; }
.user-status.disabled { background: #41212a; color: #ff9daa; }
.user-meta { display: flex; gap: 15px; flex-wrap: wrap; margin: 12px 0; color: #73859a; font-size: 9px; }
.user-meta strong { color: #aebed0; }
.user-actions-grid { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.inline-settings-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-settings-form select, .inline-settings-form input[type="password"] { min-height: 36px; background: #091019; border: 1px solid #2b394b; border-radius: 8px; color: var(--text); padding: 7px 9px; }
.password-reset-form input { min-width: 220px; }
.mini-toggle { display: inline-flex; gap: 6px; align-items: center; color: #aab8c7; font-size: 10px; }

.photo-bg { background: linear-gradient(135deg,#b14778,#673fb1); }
.history-type.photos { background:#41243a; color:#ffb9dc; }
.connection-role.photo-role { background:#3b244d; color:#d8b4ff; }
.photo-group-list { display: grid; gap: 14px; }
.photo-group-card { overflow: hidden; }
.photo-group-head { display:flex; align-items:center; justify-content:space-between; gap:14px; padding:13px 15px; border-bottom:1px solid var(--line); }
.photo-group-head > div { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.photo-group-head strong { color:var(--text); }
.photo-group-head small { color:var(--muted); }
.photo-kind { display:inline-flex; padding:5px 8px; border-radius:999px; font-size:9px; font-weight:900; }
.photo-kind.exact { background:#173e31; color:#86e4b6; }
.photo-kind.same { background:#24365b; color:#a9c6ff; }
.photo-kind.near { background:#4a3820; color:#ffd08d; }
.photo-recommendation { display:grid; grid-template-columns:110px minmax(0,1fr); gap:4px 12px; padding:10px 15px; border-bottom:1px solid var(--line); background:#0d1822; }
.photo-recommendation span { color:#71849a; font-size:9px; text-transform:uppercase; letter-spacing:.05em; }
.photo-recommendation strong { color:#dbe6f2; overflow-wrap:anywhere; }
.photo-recommendation small { grid-column:2; color:#87a0bb; }
.photo-tile-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:1px; background:var(--line); }
.photo-tile-grid.two-up { grid-template-columns:repeat(2,minmax(0,1fr)); }
.photo-tile { display:grid; grid-template-columns:145px minmax(0,1fr); gap:12px; padding:12px; background:#0e151e; min-width:0; }
.photo-tile.recommended { box-shadow: inset 0 0 0 1px #365f4b; background:#101d18; }
.photo-tile img { width:145px; height:145px; object-fit:cover; border-radius:9px; background:#080d12; }
.photo-tile > div { min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:5px; }
.photo-tile strong { color:#e0e8f0; overflow-wrap:anywhere; }
.photo-tile small { color:#8496aa; font-size:9px; }
.photo-tile code { width:100%; color:#9eb1c7; overflow-wrap:anywhere; font-size:9px; }
.photo-meta-chip { display:inline-flex; padding:4px 6px; border-radius:999px; background:#283345; color:#adc0d6; font-size:8px; font-weight:900; }
.photo-meta-chip.keep { background:#17402e; color:#88e7b6; }

@media (max-width: 900px) {
  .users-layout { grid-template-columns:1fr; }
  .user-create-card { position:static; }
  .photo-tile-grid.two-up { grid-template-columns:1fr; }
}
@media (max-width: 620px) {
  .user-card-head { grid-template-columns:38px 1fr; }
  .user-role,.user-status { justify-self:start; }
  .photo-tile { grid-template-columns:100px minmax(0,1fr); }
  .photo-tile img { width:100px; height:100px; }
  .photo-recommendation { grid-template-columns:1fr; }
  .photo-recommendation small { grid-column:1; }
}
.compact-live-log { margin: 0 0 10px; }
.compact-live-log .live-log-lines { max-height: 105px; }

#photos-live-result-panel.hidden,
#photos-completed-result-panel.hidden { display:none !important; }
.photo-group-card .card-footer-note { border-top:1px solid var(--line); }
.photo-group-head .saving-chip { flex:0 0 auto; }
.photo-tile .photo-meta-chip + .photo-meta-chip { margin-left:3px; }
.stats-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1050px) { .stats-grid.four { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 620px) { .stats-grid.four { grid-template-columns: 1fr; } }


.mount-aliases {
  margin: 4px 0 0;
  color: #788ba2;
  font-size: 10px;
}
.mount-aliases code {
  display: inline-flex;
  margin: 1px 2px;
  padding: 2px 5px;
  border-radius: 5px;
  background: #0b121a;
  color: #b5c7ff;
}
