/* LumaRank — dense analyst interface. Desktop-first, responsive down to mobile. */

:root {
  --bg:            #080c14;
  --bg-raised:     #0d1420;
  --bg-panel:      #111a28;
  --bg-inset:      #0a111c;
  --line:          #1e2a3d;
  --line-soft:     #16202f;
  --text:          #e6edf7;
  --text-dim:      #93a4bd;
  --text-faint:    #64748b;
  --accent:        #64d2ff;
  --accent-deep:   #0ea5e9;
  --good:          #34d399;
  --warn:          #fbbf24;
  --bad:           #f87171;
  --danger:        #ef4444;
  --violet:        #a78bfa;
  --radius:        10px;
  --radius-sm:     6px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 620; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 25px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 .7rem; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); font-size: .92em; }
.nowrap { white-space: nowrap; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; background: var(--accent); color: #001; padding: .5rem .8rem; border-radius: 6px; z-index: 200; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-raised);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 4px; }
.brand-mark {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-deep));
  color: #04121c; font-weight: 800; font-size: 13px; border-radius: 8px; letter-spacing: -.03em;
}
.brand-text { font-weight: 660; font-size: 15px; display: flex; flex-direction: column; line-height: 1.15; }
.brand-text em { font-style: normal; font-size: 10.5px; color: var(--text-faint); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a {
  color: var(--text-dim); padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; text-decoration: none;
}
.sidebar nav a:hover { background: var(--bg-panel); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--bg-panel); color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }

.signout { margin-top: auto; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.who { font-size: 12px; color: var(--text-faint); margin-bottom: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* min-width:0 is load-bearing: grid items default to min-width:auto, which lets a
   wide table stretch the column instead of scrolling inside its own wrapper. */
.main { padding: 26px 30px 70px; max-width: 1500px; min-width: 0; overflow-x: hidden; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-dim); font-size: 13.5px; margin-top: 5px; max-width: 68ch; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- panels */
.panel {
  min-width: 0;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 18px; overflow: hidden;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap;
}
.panel-head h2 { font-size: 14px; letter-spacing: .01em; }
.panel-head .hint { font-size: 12px; color: var(--text-faint); }
.panel-body { padding: 16px; }
.panel-body.tight { padding: 0; }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2.05fr) minmax(0, 1fr); align-items: start; }

/* ---------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; }
.stat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 600; }
.stat .v { font-size: 22px; font-weight: 660; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .v small { font-size: 12px; color: var(--text-dim); font-weight: 500; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  border: 1px solid transparent; white-space: nowrap;
}
.v-SCALE, .v-CREATE.THIS.GIG { background: rgba(52,211,153,.14); color: var(--good); border-color: rgba(52,211,153,.32); }
.v-IMPROVE { background: rgba(100,210,255,.13); color: var(--accent); border-color: rgba(100,210,255,.3); }
.v-TEST { background: rgba(167,139,250,.14); color: var(--violet); border-color: rgba(167,139,250,.32); }
.v-REPOSITION { background: rgba(251,191,36,.13); color: var(--warn); border-color: rgba(251,191,36,.3); }
.v-WAIT { background: rgba(148,163,184,.12); color: var(--text-dim); border-color: rgba(148,163,184,.26); }
.v-KILL { background: rgba(248,113,113,.14); color: var(--bad); border-color: rgba(248,113,113,.34); }

.claim-fact { background: rgba(52,211,153,.13); color: var(--good); border-color: rgba(52,211,153,.3); }
.claim-obs  { background: rgba(100,210,255,.12); color: var(--accent); border-color: rgba(100,210,255,.28); }
.claim-est  { background: rgba(251,191,36,.12); color: var(--warn); border-color: rgba(251,191,36,.28); }
.claim-ai   { background: rgba(167,139,250,.14); color: var(--violet); border-color: rgba(167,139,250,.32); }

.conf { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; }
.conf-HIGH { color: var(--good); }
.conf-MODERATE { color: var(--accent); }
.conf-LOW { color: var(--warn); }
.conf-VERY.LOW, .conf-VERYLOW { color: var(--bad); }

/* ---------------------------------------------------------------- action list */
.actions { list-style: none; margin: 0; padding: 0; }
.action {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 14px;
  padding: 13px 16px; border-bottom: 1px solid var(--line-soft); align-items: start;
}
.action:last-child { border-bottom: 0; }
.action:hover { background: rgba(255,255,255,.016); }
.action .rank {
  font-family: var(--mono); font-size: 17px; font-weight: 700; color: var(--accent);
  font-variant-numeric: tabular-nums; text-align: right; padding-top: 1px;
}
.action .rank small { display: block; font-size: 9.5px; color: var(--text-faint); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.action h3 { font-size: 14px; margin-bottom: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.action .why-text { color: var(--text-dim); font-size: 12.8px; line-height: 1.5; }
.action .meta { display: flex; gap: 12px; margin-top: 6px; font-size: 11.5px; color: var(--text-faint); flex-wrap: wrap; }
.action-btns { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--bg-inset); color: var(--text); border: 1px solid var(--line);
  padding: 7px 13px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 550;
  cursor: pointer; font-family: inherit; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #04121c; border-color: var(--accent); font-weight: 650; }
.btn-primary:hover { background: #8adfff; color: #04121c; border-color: #8adfff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 11.5px; }
.btn-danger:hover { border-color: var(--danger); color: var(--bad); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-faint); font-weight: 650; white-space: nowrap;
  background: var(--bg-inset); position: sticky; top: 0; z-index: 1;
}
tbody tr:hover { background: rgba(255,255,255,.016); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12.4px; }
tr.is-dim td { opacity: .55; }

/* ---------------------------------------------------------------- forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11.5px; font-weight: 620; color: var(--text-dim); margin-bottom: 4px; letter-spacing: .02em; }
.field .help { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url],
input[type=date], select, textarea {
  width: 100%; background: var(--bg-inset); border: 1px solid var(--line); color: var(--text);
  padding: 7px 10px; border-radius: var(--radius-sm); font: 13.5px var(--sans);
}
textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
fieldset { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px; margin: 0 0 12px; }
legend { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 650; padding: 0 5px; }
details.form-block { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; background: var(--bg-inset); }
details.form-block > summary { padding: 9px 13px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-dim); }
details.form-block > summary:hover { color: var(--text); }
details.form-block > div { padding: 0 13px 13px; }

/* ---------------------------------------------------------------- alerts */
.alert { display: flex; gap: 10px; padding: 10px 13px; border-radius: var(--radius-sm); margin-bottom: 9px; border: 1px solid; font-size: 13px; align-items: flex-start; }
.alert-danger { background: rgba(239,68,68,.08); border-color: rgba(239,68,68,.3); }
.alert-warn { background: rgba(251,191,36,.07); border-color: rgba(251,191,36,.26); }
.alert-info { background: rgba(100,210,255,.06); border-color: rgba(100,210,255,.24); }
.alert strong { display: block; font-size: 13px; margin-bottom: 2px; }
.alert .detail { color: var(--text-dim); font-size: 12.3px; }

.empty { padding: 30px 18px; text-align: center; color: var(--text-faint); font-size: 13.5px; }
.empty strong { display: block; color: var(--text-dim); font-size: 14.5px; margin-bottom: 5px; }

/* ---------------------------------------------------------------- score bar */
.contrib { margin: 0; padding: 0; list-style: none; }
.contrib li { display: grid; grid-template-columns: minmax(120px, 1.3fr) 1fr 62px; gap: 10px; align-items: center; padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid var(--line-soft); }
.contrib li:last-child { border-bottom: 0; }
.contrib .cl { color: var(--text-dim); }
.contrib .cbar { background: var(--bg-inset); height: 7px; border-radius: 4px; overflow: hidden; position: relative; }
.contrib .cbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); border-radius: 4px; }
.contrib .cbar i.neg { background: linear-gradient(90deg, var(--danger), var(--bad)); margin-left: auto; }
.contrib .cv { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 600; }
.contrib .cv.pos { color: var(--good); }
.contrib .cv.neg { color: var(--bad); }
.contrib li.unavailable { opacity: .5; }

.score-big { font-size: 40px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.score-big small { font-size: 15px; color: var(--text-faint); font-weight: 500; }

/* ---------------------------------------------------------------- drawer */
.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer[hidden] { display: none; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(2,6,14,.72); backdrop-filter: blur(2px); }
.drawer-panel {
  position: absolute; right: 0; top: 0; bottom: 0; width: min(680px, 100%);
  background: var(--bg-raised); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(0,0,0,.5);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 15px; }
.drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer-body section { margin-bottom: 22px; }
.drawer-body section > h3 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-faint); margin-bottom: 9px; padding-bottom: 5px; border-bottom: 1px solid var(--line-soft);
}
.ev { border-left: 2px solid var(--line); padding: 2px 0 2px 11px; margin-bottom: 11px; }
.ev .ev-label { font-size: 12.5px; font-weight: 620; display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.ev .ev-detail { font-size: 12.5px; color: var(--text-dim); line-height: 1.5; }
.ev .ev-src { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.callout { background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; font-size: 12.8px; color: var(--text-dim); line-height: 1.55; }
.callout.alt { border-left: 3px solid var(--warn); }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--bg-panel); border: 1px solid var(--accent); color: var(--text);
  padding: 10px 18px; border-radius: 8px; font-size: 13.5px; z-index: 300;
  box-shadow: 0 12px 34px rgba(0,0,0,.5); max-width: min(560px, 90vw);
}
.toast[hidden] { display: none; }
.toast.err { border-color: var(--danger); }

/* ---------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 372px; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 13px; padding: 30px; }
.login-card .brand { justify-content: center; margin-bottom: 22px; }

/* ---------------------------------------------------------------- misc */
.pill { display: inline-block; background: var(--bg-inset); border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; font-size: 11px; color: var(--text-dim); margin: 0 3px 3px 0; }
.split { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
hr.sep { border: 0; border-top: 1px solid var(--line-soft); margin: 14px 0; }
.bar-mini { height: 5px; background: var(--bg-inset); border-radius: 3px; overflow: hidden; min-width: 54px; }
.bar-mini i { display: block; height: 100%; background: var(--accent); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .grid-main, .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; gap: 4px; }
  .sidebar nav a { font-size: 12.5px; padding: 5px 9px; }
  .sidebar nav a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .signout { margin: 0; border: 0; padding: 0; display: flex; gap: 10px; align-items: center; }
  .main { padding: 18px 14px 60px; }
  .action { grid-template-columns: 38px 1fr; }
  .action-btns { grid-column: 1 / -1; flex-direction: row; }
  .drawer-panel { width: 100%; }
  h1 { font-size: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
