/* Scanner's layer over the Kinetic UI kit (static/kit/, unmodified).
   Only what the kit has no part for. Tokens come from the kit. */

a { color: inherit; }
.shell .brand { display: block; text-decoration: none; }
.shell nav a { display: block; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .credit { margin-bottom: var(--s2); }
.side-foot .credit a { color: var(--muted); }
.side-foot .account { margin-bottom: var(--s2); }
.side-foot .account b { color: var(--fg); font-weight: var(--fw-medium); }

.subject {
  font-family: var(--serif);
  font-weight: var(--fw-medium);
  font-size: var(--fs-d2);
  margin: 10px 0 var(--s5);
  overflow-wrap: anywhere;
}

.band { margin-bottom: 14px; }
.band .k { line-height: var(--lh-snug); }
.band .v.mute.alert { color: var(--bad); }

.panel-head { display: flex; justify-content: space-between; gap: var(--s4); align-items: baseline; flex-wrap: wrap; }
.panel-head h4 { margin-bottom: var(--s4); }
.chart-range, .feed-status, .scan-status, .scan-foot, .project-meta, .m-meta, .m-theme, .m-time, .chart-range {
  font-size: var(--fs-sm);
  color: var(--dim);
}
.chart-range, .feed-status, .scan-status, .m-time, .theme-n { font-family: var(--mono); }
.scan-status.error, .feed-status.error { color: var(--bad); }
.scan-status.warning { color: var(--warn); }
.sub-head { margin-top: var(--s5); }

/* overview */
.read-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 14px; align-items: stretch; }
.read-grid .panel { min-width: 0; }

.chart { display: flex; flex-direction: column; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 220px; border-bottom: 1px solid var(--line-s); }
.bars .col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.stack { width: 100%; min-height: 2px; display: flex; flex-direction: column; border-radius: 2px 2px 0 0; overflow: hidden; }
.stack.zero { min-height: 0; }
.seg.pos, .swatch.pos { background: var(--chart-1); }
.seg.neu, .swatch.neu { background: var(--dim); }
.seg.neg, .swatch.neg { background: var(--bad); }
.xaxis { display: flex; gap: 2px; height: var(--s6); }
.xaxis span { flex: 1 1 0; min-width: 0; position: relative; }
.xaxis b {
  position: absolute; top: var(--s2); left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: var(--fs-2xs); font-weight: var(--fw-regular); color: var(--dim); white-space: nowrap;
}
.xaxis .first b { left: 0; transform: none; }
.xaxis .last b { left: auto; right: 0; transform: none; }

.meter { position: relative; display: flex; height: var(--s2); border-radius: 2px; background: var(--surface-2); margin: var(--s2) 0 var(--s4); }
.meter .seg:first-child { border-radius: 2px 0 0 2px; }
.meter .seg:nth-child(3) { border-radius: 0 2px 2px 0; }
.needle { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--fg); }
.legend { list-style: none; font-size: var(--fs-base); color: var(--muted); }
.legend li { display: flex; align-items: center; gap: var(--s2); padding: var(--s1) 0; }
.legend b { margin-left: auto; font-family: var(--mono); font-size: var(--fs-md); font-weight: var(--fw-regular); color: var(--fg); }
.swatch { width: var(--s2); height: var(--s2); border-radius: 50%; }
.panel p.top-theme { color: var(--fg); font-size: var(--fs-base-5); overflow-wrap: anywhere; }

.themes { list-style: none; }
.theme-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 40px; gap: var(--s4); align-items: center; padding: 6px 0; font-size: var(--fs-base); color: var(--muted); }
.theme-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.theme-bar { height: 6px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.theme-bar span { display: block; height: 100%; background: var(--chart-2); }
.theme-n { text-align: right; font-size: var(--fs-md); color: var(--fg); }

/* mentions */
.feed-section { margin-top: var(--s5); }
.feed-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
.filters { display: flex; gap: var(--s3); flex-wrap: wrap; }
.table-panel { padding: 0; overflow: hidden; }
#feed { transition: opacity var(--t-fast); }
.m-body { min-width: 320px; }
.m-title { color: var(--fg); font-weight: var(--fw-medium); margin-bottom: 2px; }
.m-text { overflow-wrap: anywhere; }
.m-meta { display: flex; gap: var(--s3); flex-wrap: wrap; margin-top: var(--s1); }
.m-link { color: var(--green-b); text-decoration: none; }
.m-link:hover { text-decoration: underline; }
.m-theme, .m-time { white-space: nowrap; }
tr.ent-empty.error td { color: var(--bad); }

/* manage */
[hidden] { display: none !important; }
.scan-panel .field, .inline-form .field { margin-bottom: 0; }
.scan-primary { display: flex; align-items: flex-end; gap: var(--s3); flex-wrap: wrap; }
.scan-primary .field { flex: 1 1 280px; }
.scan-actions, .inline-form, .project-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.source-picker { border: 0; margin-top: var(--s5); }
.source-picker legend {
  font-family: var(--mono); font-size: var(--fs-2xs); font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label); color: var(--muted); text-transform: uppercase; margin-bottom: var(--s2);
}
.source-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 var(--s4); }
.source-options small { color: var(--dim); font-size: var(--fs-sm); }
.scan-foot { display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-top: var(--s3); }
.project-summary { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.project-summary strong { display: block; font-weight: var(--fw-medium); font-size: var(--fs-base-5); }
.project-actions { margin-top: var(--s3); }
.project-panel .tagchip-group { margin-top: var(--s3); }
.project-panel a.tagchip-label { text-decoration: none; }
.project-empty { font-size: var(--fs-md); color: var(--dim); }

/* the kit's .dialog sets display, so a closed native dialog needs telling */
dialog.dialog:not([open]) { display: none; }
dialog.dialog { margin: auto; padding: 0; color: var(--fg); }
dialog.dialog::backdrop { background: rgba(17, 21, 24, .72); }

.ent-state { margin-bottom: var(--s5); max-width: none; }
.ent-state p { font-size: var(--fs-base-5); color: var(--muted); }
code { font-family: var(--mono); font-size: var(--fs-md); color: var(--fg); }

/* sign in */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: var(--s4); }
.login-card { width: min(400px, 100%); margin: 0; padding: var(--s6); }
.login-card .brand { font-family: var(--serif); font-size: var(--fs-brand); letter-spacing: var(--ls-brand); }
.login-card .brand b { color: var(--green); font-weight: var(--fw-semi); }
.login-card h1 { font-family: var(--serif); font-weight: var(--fw-medium); font-size: var(--fs-title); margin: var(--s3) 0 var(--s4); }
.login-card .field { max-width: none; }
.login-card .btn { width: 100%; margin-top: var(--s2); }
.login-card .note { margin: 0 0 var(--s4); }
.panel p.login-foot { font-size: var(--fs-sm); color: var(--dim); margin-top: var(--s4); }

@media (max-width: 900px) {
  .brand-sub { margin-bottom: 0; }
  .read-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .scan-actions .btn { flex: 1 1 auto; }
}
