/* Dashboard + admin surfaces. Builds on site.css tokens; denser spacing, mono numerals. */
.app-main { padding-block: clamp(36px, 5vw, 64px) 80px; }
.app-head { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px clamp(32px, 5vw, 72px); align-items: end; padding-bottom: 36px; }
.app-head h1 { margin-top: 18px; font-size: clamp(2.5rem, 5vw, 4.25rem); letter-spacing: -.045em; }
.app-head .lede { margin-top: 18px; font-size: 1rem; }

.skeleton { display: inline-block; max-width: 100%; border-radius: 4px; color: transparent !important; background: linear-gradient(90deg, var(--surface-2) 25%, #262b32 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton-row { height: 92px; margin: 10px 0; border-radius: 10px; background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; list-style: none; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Control panel */
.control { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); box-shadow: inset 0 1px 0 rgb(255 255 255 / .03); }
.control-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.control-grid > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.control-grid > div:not(:last-child) { padding-right: 12px; }
.control-grid dt { color: var(--dim); font: 500 .6875rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.control-grid dd { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: .875rem; font-weight: 500; }
.control-action { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding-top: 16px; }
.control-note { flex: 1 1 200px; color: var(--muted); font-size: .8125rem; }
[data-run-status]:not(:empty) { margin-top: 14px; }
.job-line { display: flex; gap: 10px; align-items: baseline; color: var(--muted); font-size: .875rem; }
.job-line .dot { transform: translateY(-1px); }
.job-line strong { color: var(--text); font-weight: 600; }

/* Metrics: divided strip, not boxed cards */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.5fr); border-block: 1px solid var(--line); }
.metrics > div { padding: 20px 20px 20px 0; }
.metrics > div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.metric-label { display: block; color: var(--dim); font: 500 .6875rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.metrics b { display: block; margin-top: 12px; font-size: clamp(1.6rem, 2.6vw, 2.1rem); font-weight: 500; letter-spacing: -.04em; line-height: 1; }
.metrics .metric-wide b { font-size: 1rem; font-weight: 500; letter-spacing: 0; line-height: 1.4; margin-top: 14px; }
.metric-sub { color: var(--muted); font-weight: 400; }
.run-status { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; }
.run-status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ''; }
.run-status.is-ok { color: var(--lime); }
.run-status.is-warn { color: var(--warn); }
.run-status.is-bad { color: var(--danger); }

/* Workspace */
.workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: clamp(24px, 3vw, 44px); margin-top: 40px; align-items: start; }
.filters { position: sticky; top: 92px; display: grid; gap: 18px; }
.filters-head { display: flex; align-items: center; justify-content: space-between; }
.filters-head h2, .results-head h2, .panel-head h2 { font-size: 1.05rem; letter-spacing: -.02em; }
.filters .field label { display: flex; justify-content: space-between; color: var(--muted); font-size: .8125rem; }
.filters .field input, .filters .field select { min-height: 42px; font-size: .875rem; }
.filters input[type='range'] { min-height: 0; padding: 0; border: 0; background: none; accent-color: var(--lime); box-shadow: none; }
.link-btn { border: 0; background: none; color: var(--lime); font-size: .8125rem; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.results-head p { color: var(--dim); font-size: .8125rem; }

.opp-list { list-style: none; padding: 0; }
.opp { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 20px; align-items: start; padding: 22px 0; border-bottom: 1px solid var(--line); animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.score b { display: block; font-size: 1.5rem; font-weight: 500; letter-spacing: -.04em; line-height: 1; color: var(--lime); }
.bar { display: block; height: 3px; margin-top: 8px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--lime); }
.opp-title { padding: 0; border: 0; background: none; color: var(--text); font-size: 1.0625rem; font-weight: 600; letter-spacing: -.02em; text-align: left; overflow-wrap: anywhere; }
.opp-title:hover { color: var(--lime); }
.opp-summary { display: -webkit-box; margin-top: 6px; overflow: hidden; color: var(--muted); font-size: .9rem; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.opp-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 12px; color: var(--dim); font-size: .8125rem; }
.tag { padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--muted); font-size: .75rem; }
.conf { font-size: .8125rem; }
.conf::before { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--dim); vertical-align: 1px; content: ''; }
.conf-high::before { background: var(--lime); }
.conf-medium::before { background: var(--warn); }
.opp-actions { display: flex; align-items: center; gap: 8px; }
.icon-link, .icon-btn { display: grid; width: 36px; height: 36px; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; background: transparent; color: var(--muted); transition: color .2s, border-color .2s, transform .3s var(--ease); }
.icon-link:hover, .icon-btn:hover { color: var(--lime); border-color: var(--lime-line); }
.icon-link:active, .icon-btn:active { transform: scale(.95); }
.icon-link svg, .icon-btn svg { width: 15px; height: 15px; }
.empty { padding: 56px 0; list-style: none; text-align: left; }
.empty h3 { font-size: 1.25rem; }
.empty p { max-width: 56ch; margin: 8px 0 18px; color: var(--muted); }
.empty-inline { padding: 22px 0; color: var(--muted); }

/* Panels / tables */
.panel { margin-top: 56px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.panel-head p { color: var(--dim); font-size: .8125rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); color: var(--dim); font: 500 .6875rem/1 var(--mono); letter-spacing: .08em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); color: var(--muted); vertical-align: top; }
.table td:first-child { color: var(--text); white-space: nowrap; }
.table .num { text-align: right; }
.table th:nth-child(n + 3) { text-align: right; }

/* Detail dialog */
.detail { width: min(760px, 100% - 24px); max-height: min(88dvh, 920px); margin: auto; padding: 0; border: 1px solid var(--line-2); border-radius: 18px; background: var(--bg-2); color: var(--text); box-shadow: 0 40px 80px -20px rgb(0 0 0 / .8); }
.detail::backdrop { background: rgb(5 6 7 / .72); backdrop-filter: blur(4px); }
.detail[open] { animation: rise .45s var(--ease) both; }
.detail-inner { display: grid; gap: 22px; padding: clamp(20px, 4vw, 36px); }
.detail-head { display: flex; justify-content: space-between; gap: 16px; }
.detail-head h2 { margin-top: 12px; font-size: clamp(1.5rem, 3vw, 2rem); overflow-wrap: anywhere; }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; color: var(--muted); font-size: .875rem; }
.detail-meta .score { width: 64px; }
.detail .btn { justify-self: start; }
.detail-section { padding-top: 18px; border-top: 1px solid var(--line); }
.detail-section h3 { color: var(--dim); font: 500 .6875rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.detail-section p { margin-top: 10px; color: var(--muted); white-space: pre-line; }
.breakdown { display: grid; gap: 10px; margin-top: 14px; }
.breakdown > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 14px; align-items: center; font-size: .875rem; }
.breakdown dt { color: var(--muted); }
.breakdown dd { display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 12px; align-items: center; }
.breakdown .bar { margin: 0; height: 4px; }
.breakdown b { font-weight: 500; text-align: right; }
.evidence { display: grid; gap: 8px; margin-top: 12px; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.detail-foot { color: var(--dim); font-size: .8125rem; }

/* ---------- Admin ---------- */
.admin-shell { max-width: 1180px; }
.signin { max-width: 460px; margin: clamp(40px, 8vw, 96px) auto; }
.signin h1 { margin-top: 16px; font-size: 2.25rem; }
.signin p { margin-top: 12px; color: var(--muted); }
.signin form { display: grid; gap: 16px; margin-top: 28px; }
.tabs { display: flex; gap: 4px; margin: 28px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab { position: relative; min-height: 44px; padding: 0 16px; border: 0; background: none; color: var(--muted); font-weight: 500; white-space: nowrap; }
.tab[aria-selected='true'] { color: var(--text); }
.tab[aria-selected='true']::after { position: absolute; right: 12px; bottom: -1px; left: 12px; height: 2px; background: var(--lime); content: ''; }
.tab .count { margin-left: 6px; font-family: var(--mono); color: var(--dim); font-size: .75rem; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; }
.admin-bar h1 { margin-top: 14px; font-size: clamp(2rem, 4vw, 3rem); }
.admin-who { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .875rem; }
.inbox { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 0; min-height: 520px; margin-top: 20px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.inbox-list { list-style: none; padding: 0; border-right: 1px solid var(--line); max-height: 72dvh; overflow-y: auto; }
.inbox-item button { display: grid; width: 100%; gap: 4px; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; transition: background-color .2s; }
.inbox-item button:hover { background: rgb(255 255 255 / .025); }
.inbox-item button[aria-current='true'] { background: var(--surface); box-shadow: inset 2px 0 0 var(--lime); }
.inbox-item .top { display: flex; justify-content: space-between; gap: 10px; font-size: .875rem; }
.inbox-item .who { overflow: hidden; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item .when { flex: none; color: var(--dim); font-size: .75rem; }
.inbox-item .what { color: var(--muted); font-size: .8125rem; }
.inbox-item .preview { overflow: hidden; color: var(--dim); font-size: .8125rem; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item.is-new .who::before { display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--lime); vertical-align: 2px; content: ''; }
.reader { padding: clamp(20px, 3vw, 32px); }
.reader h2 { font-size: 1.5rem; overflow-wrap: anywhere; }
.reader-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin-top: 18px; font-size: .875rem; }
.reader-meta dt { color: var(--dim); }
.reader-meta dd { color: var(--muted); overflow-wrap: anywhere; }
.reader-body { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.reader-empty { display: grid; place-content: center; min-height: 300px; color: var(--dim); text-align: center; }
.admin-section { margin-top: 28px; }
.admin-section h2 { font-size: 1.05rem; }
.admin-section + .admin-section { margin-top: 44px; }
.err-list { min-width: 260px; max-width: 560px; white-space: normal; overflow-wrap: anywhere; margin: 6px 0 0; padding-left: 16px; color: var(--danger); font-size: .8125rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .metrics .metric-wide { grid-column: 1 / -1; padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .app-head, .workspace { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .filters-head, .filters .field:first-of-type { grid-column: 1 / -1; }
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox-list { max-height: 360px; border-right: 0; border-bottom: 1px solid var(--line); }
}
@media (max-width: 767px) {
  .control-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .control-grid > div + div { padding-left: 0; border-left: 0; }
  .control-grid dd { margin-top: 6px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .metrics > div:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .opp { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; }
  .opp-actions { grid-column: 2; }
  .score b { font-size: 1.25rem; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .table td { padding: 0; border: 0; text-align: left !important; }
  .table td::before { display: block; color: var(--dim); font: 500 .625rem/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; content: attr(data-label); }
  .breakdown > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}
