/* DCA Zones -- shared design system for dashboard / screener / chart / alerts. */

/* Colours, fonts and radii come from ../theme.css (light + dark). */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.mono { font-family: var(--mono); font-feature-settings: "zero" 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.up { color: var(--up); }
.down { color: var(--down); }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------- layout */

.wrap { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
main.wrap { padding: 32px 0 64px; }

kbd {
  font: 500 11px/1 var(--mono); padding: 4px 6px; border-radius: 5px;
  background: var(--panel-3); border: 1px solid var(--line-2); color: var(--ink-2);
}
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font-size: 12.5px; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); display: inline-block; flex: none; }
.dot.ring { background: transparent; border: 1.5px solid currentColor; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-head h1 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.025em; font-weight: 650; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.section { margin-top: 40px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 17px; letter-spacing: -.01em; font-weight: 620; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* ------------------------------------------------------------ surfaces */

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-raise) 100%);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.eyebrow { font: 600 11px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------------------------------------------------------------- zones */

.badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 64px; height: 22px; padding: 0 8px; border-radius: 6px;
  font: 700 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  color: var(--on-z1-badge); background: var(--z1-badge);
}
.badge.lg { height: 36px; min-width: 96px; padding: 0 14px; font-size: 17px; border-radius: 8px; letter-spacing: .04em; }
.badge.sm { height: 19px; min-width: 0; padding: 0 6px; font-size: 10px; border-radius: 5px; }
.badge.z-4X { background: var(--z4); color: var(--on-z4); }
.badge.z-3X { background: var(--z3); color: var(--on-z3); }
.badge.z-2X { background: var(--z2); color: var(--on-z2); }
.badge.z-1X { background: var(--z1-badge); color: var(--on-z1-badge); }
.badge.z-LT { background: var(--zlt); color: var(--on-zlt); }
.badge.z-ST { background: var(--zst); color: var(--on-zst); }
.badge.z-none { background: var(--panel-3); color: var(--muted); }

.zdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.zdot.ring { background: transparent !important; border: 2px solid; width: 9px; height: 9px; }
.c-4X { color: var(--z4); } .bg-4X { background: var(--z4); } .bd-4X { border-color: var(--z4) !important; }
.c-3X { color: var(--z3); } .bg-3X { background: var(--z3); } .bd-3X { border-color: var(--z3) !important; }
.c-2X { color: var(--z2); } .bg-2X { background: var(--z2); } .bd-2X { border-color: var(--z2) !important; }
.c-1X { color: var(--z1); } .bg-1X { background: var(--z1); } .bd-1X { border-color: var(--z1) !important; }
.c-LT { color: var(--zlt); } .bg-LT { background: var(--zlt); } .bd-LT { border-color: var(--zlt) !important; }
.c-ST { color: var(--zst); } .bg-ST { background: var(--zst); } .bd-ST { border-color: var(--zst) !important; }

.touch { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.touch b { font: 700 12px var(--mono); }

/* zone stat cards (dashboard + screener) */
.zone-card {
  position: relative; display: block; padding: 14px 16px 15px; text-align: left; cursor: pointer; text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s, background .15s, transform .15s;
}
.zone-card:hover { border-color: var(--line-2); background: var(--panel-2); }
.zone-card[aria-pressed="true"] { border-color: var(--ink-2); background: var(--panel-2); }
.zone-card .label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-card .value { margin-top: 8px; font: 600 24px/1 var(--mono); letter-spacing: -.02em; }
.zone-card .hint { margin-top: 6px; font-size: 12px; color: var(--muted); }
.zone-card .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; opacity: .9; }

/* ------------------------------------------------------------- controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink);
  font-weight: 550; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--panel-2); border-color: var(--line-3); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.danger:hover { color: var(--down); border-color: var(--down-line); }
.btn svg, .icon-svg { width: 16px; height: 16px; flex: none; }

.input, .select {
  height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-raise);
  color: var(--ink); outline: none; transition: border-color .15s, background .15s; min-width: 0;
}
.input:focus, .select:focus { border-color: var(--focus); }
.input::placeholder { color: var(--faint); }
.select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a93a0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 34px; width: 100%; }
.field label { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
.field .input, .field .select { width: 100%; height: 40px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-raise); border: 1px solid var(--line-2); border-radius: 10px; }
.seg button {
  height: 28px; min-width: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted);
  font-weight: 600; font-size: 12.5px; cursor: pointer; transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--panel-3); color: var(--ink); box-shadow: var(--shadow-seg); }

.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s; white-space: nowrap;
}
.chip:hover { border-color: var(--line-3); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--panel-3); color: var(--ink); border-color: var(--ink-2); }
.chip[aria-pressed="false"] .zdot { opacity: .35; }
.chip .x { opacity: .6; }

.switch { position: relative; width: 34px; height: 20px; flex: none; border-radius: 999px; background: var(--line-2); border: 0; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); transition: transform .18s; }
.switch[aria-checked="true"] { background: var(--up); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }

.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  position: relative; padding: 10px 0 12px; border: 0; background: none; color: var(--muted); font-size: 14.5px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--ink-2); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px; }
.tabs .count { margin-left: 6px; font: 500 11.5px var(--mono); color: var(--faint); }

/* ---------------------------------------------------------------- table */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  position: sticky; top: 0; z-index: 1; padding: 12px 12px; text-align: left; white-space: nowrap;
  font: 600 11px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  background: var(--panel); border-bottom: 1px solid var(--line);
}
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink-2); }
table.data th .arrow { margin-left: 4px; opacity: .45; }
table.data th[aria-sort] .arrow { opacity: 1; color: var(--ink); }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr.link { cursor: pointer; }
table.data tbody tr.link:hover { background: var(--panel-2); }
table.data .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data th.num { font-family: var(--sans); }
table.data .company { max-width: 240px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }

.tk { display: flex; align-items: center; gap: 10px; }
.tk-logo {
  width: 26px; height: 26px; flex: none; border-radius: 7px; display: grid; place-items: center; overflow: hidden;
  font: 700 10px/1 var(--mono); color: var(--ink); background: var(--panel-3); border: 1px solid var(--line-2);
}
.tk-logo { position: relative; }
.tk-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 2px; }
.tk-logo img { opacity: 0; transition: opacity .2s; }
.tk-logo img.ok { opacity: 1; }
.tk-logo img.seen { transition: none; }
.tk-logo img.light { background: #1f2430; }
.tk b { font: 700 13.5px var(--mono); letter-spacing: -.01em; }

/* One-line info banner (e.g. "not in the nightly scan -- live lookup"). */
.notice {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px;
  border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: var(--radius-sm);
  background: var(--info-soft); color: var(--ink-2); font-size: 13.5px;
}
.notice > svg { width: 18px; height: 18px; flex: none; color: var(--info); }
.notice > span { flex: 1; min-width: 200px; }

.empty {
  display: grid; place-items: center; gap: 8px; padding: 48px 24px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--bg-raise);
}
.empty h3 { margin: 4px 0 0; color: var(--ink); font-size: 16px; }
.empty > svg { width: 28px; height: 28px; color: var(--faint); }

.skeleton { position: relative; overflow: hidden; background: var(--panel-2); border-radius: 6px; }
.skeleton::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--shimmer), transparent); animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------- stacked dist bars */

.dist { display: flex; gap: 2px; height: 10px; border-radius: 4px; overflow: hidden; background: var(--panel-3); }
.dist span { display: block; height: 100%; min-width: 2px; }
.dist.tall { height: 26px; border-radius: 6px; }
.dist.tall span { position: relative; display: flex; align-items: center; justify-content: center; font: 600 11px var(--mono); color: var(--on-z1); overflow: hidden; }
.dist.tall span.bg-4X { color: var(--on-z4); } .dist.tall span.bg-3X { color: var(--on-z3); }
.dist.tall span.bg-2X { color: var(--on-z2); } .dist.tall span.bg-LT { color: var(--on-zlt); } .dist.tall span.bg-ST { color: var(--on-zst); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------- tooltip */

.tip {
  position: fixed; z-index: 80; pointer-events: none; min-width: 160px; padding: 10px 12px; border-radius: 10px;
  background: var(--tip-bg); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  font-size: 12.5px; color: var(--ink-2);
}
.tip .t { color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.tip .r { display: flex; justify-content: space-between; gap: 16px; }
.tip .r b { color: var(--ink); font: 600 12px var(--mono); }

/* --------------------------------------------------------------- modal */

.overlay {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: start center; padding: 12vh 16px 16px;
  background: var(--overlay); backdrop-filter: blur(4px); animation: fade .15s ease-out;
}
.modal {
  width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: var(--shadow-modal); animation: pop .18s cubic-bezier(.2, .9, .3, 1.2); overflow: hidden;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--bg-raise); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* command palette */
.palette { width: min(600px, 100%); }
.palette .input-icon { border-bottom: 1px solid var(--line); }
.palette .input-icon svg { left: 18px; width: 18px; height: 18px; }
.palette input { width: 100%; height: 56px; padding: 0 18px 0 48px; border: 0; background: transparent; font-size: 16px; outline: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 380px; overflow-y: auto; }
.palette li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.palette li[aria-selected="true"] { background: var(--panel-3); }
.palette li .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.palette .foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }

/* --------------------------------------------------------------- toast */

.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--panel-3);
  border: 1px solid var(--line-2); box-shadow: var(--shadow-pop); font-size: 13.5px; animation: pop .2s ease-out;
}
.toast.error { border-color: var(--down-line); }

/* -------------------------------------------------------------- footer */

.foot-note { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; line-height: 1.6; }

/* ---------------------------------------------------------- responsive */

@media (max-width: 1080px) {
  .cols-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .page-head { flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  main.wrap { padding-top: 22px; }
}
@media (max-width: 640px) {
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .status-pill { white-space: normal; max-width: 100%; }
}
@media (max-width: 520px) {
  .cols-6, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-3 { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 24px; }
  .status-pill.hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Live price under the settled close (app.js liveHero). */
.live-now { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 10px; font-size: 13px; }
.live-now[hidden] { display: none; }
.live-zone { display: inline-flex; align-items: center; gap: 6px; }
td.is-live .lp-ext { text-align: right; }

/* "What they do" / "Main business" under the ticker heading (company-about.js). */
.co-about { margin: 0; padding: 14px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 13.5px; line-height: 1.5; }
.co-about > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; }
.co-about dt { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.co-about dd { margin: 0; color: var(--ink-2); max-width: 90ch; }
.co-about dd b { color: var(--ink); font-weight: 600; }
.co-about .segs { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
@media (max-width: 520px) {
  .co-about > div { grid-template-columns: 1fr; gap: 2px; }
}
.co-about.in-head { margin-top: 18px; }
.co-about.in-hero { margin: 0 26px; padding-bottom: 16px; }
@media (max-width: 520px) {
  .co-about.in-hero { margin: 0 18px; }
}
