/* WinBox dashboard and landing page. No external assets: everything here
   ships inside the binary so the UI works offline and behind a firewall. */
:root {
  --bg: #0d1117; --panel: #161b22; --panel-2: #1c2330; --line: #2a3340;
  --text: #e6edf3; --muted: #8b98a5; --accent: #ffb020; --accent-2: #3fb950;
  --ok: #3fb950; --warn: #d29922; --bad: #f85149; --neutral: #6e7681;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f6f8fa; --panel: #ffffff; --panel-2: #f0f3f6; --line: #d8dee4;
    --text: #1f2328; --muted: #636c76; --neutral: #8c959f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: inherit; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.25; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: .86em; }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; padding: .3rem .5rem 1rem; text-decoration: none; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #ff7a00); display: grid; place-items: center; color: #201500; font-size: 14px; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { padding: .48rem .6rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .93rem; }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.on { background: var(--panel-2); color: var(--text); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.nav .sep { margin: .7rem .6rem .25rem; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--neutral); }
.main { padding: 1.25rem 1.5rem 3rem; max-width: 1400px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--muted); }

/* panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card > h2, .card > h3 { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) { .shell { grid-template-columns: 1fr; } .side { position: static; height: auto; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .main { padding: 1rem; } }

/* kpis */
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; }
.kpi .label { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi .value { font-size: 1.5rem; font-weight: 700; margin-top: .2rem; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.kpi.accent .value { color: var(--accent); }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--panel-2); }
.table-wrap { overflow-x: auto; }
td a { color: var(--accent); text-decoration: none; }
td a:hover { text-decoration: underline; }

/* badges & buttons */
.badge { display: inline-block; padding: .12rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap; }
.badge.ok { background: rgba(63,185,80,.14); color: var(--ok); border-color: rgba(63,185,80,.35); }
.badge.warn { background: rgba(210,153,34,.14); color: var(--warn); border-color: rgba(210,153,34,.35); }
.badge.bad { background: rgba(248,81,73,.14); color: var(--bad); border-color: rgba(248,81,73,.35); }
.badge.neutral { background: rgba(110,118,129,.16); color: var(--neutral); border-color: rgba(110,118,129,.3); }
.btn { display: inline-flex; align-items: center; gap: .35rem; padding: .42rem .8rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); font: inherit; font-size: .87rem; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #201500; font-weight: 600; }
.btn.danger { color: var(--bad); border-color: rgba(248,81,73,.4); }
.btn.sm { padding: .25rem .55rem; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* forms */
label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .22rem; }
/* Most inputs carry no type attribute, so match by exclusion rather than by type. */
input:not([type=checkbox]):not([type=radio]):not([type=submit]), select, textarea {
  width: 100%; padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; font-size: .9rem; }
input[type=date], input[type=datetime-local] { color-scheme: dark; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) input[type=date],
  :root:not([data-theme="dark"]) input[type=datetime-local] { color-scheme: light; } }
textarea { min-height: 92px; font-family: var(--mono); font-size: .84rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255,176,32,.5); outline-offset: 0; border-color: var(--accent); }
.field { margin-bottom: .7rem; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--text); margin: .3rem 0 .7rem; }
.check input { width: auto; }
.filters { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: .8rem; }
.filters .field { margin: 0; min-width: 130px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin: 0 0 1rem; }
legend { padding: 0 .4rem; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* flash */
.flash { padding: .6rem .85rem; border-radius: 8px; margin-bottom: 1rem; font-size: .9rem; border: 1px solid; }
.flash.ok { background: rgba(63,185,80,.1); border-color: rgba(63,185,80,.4); color: var(--ok); }
.flash.error { background: rgba(248,81,73,.1); border-color: rgba(248,81,73,.4); color: var(--bad); }

/* charts */
.chart { width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .bar.a { fill: var(--accent); } .chart .bar.b { fill: #58a6ff; }
.chart .bar.c { fill: var(--accent-2); }
.chart .line.a { stroke: var(--accent); stroke-width: 2; fill: none; }
.chart .area.a { fill: rgba(255,176,32,.14); stroke: none; }
.chart .line.b { stroke: #58a6ff; stroke-width: 2; fill: none; }
.chart .area.b { fill: rgba(88,166,255,.14); stroke: none; }
.donut-wrap { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.donut { width: 190px; height: 190px; flex: none; }
.slice.s0 { stroke: var(--accent); } .slice.s1 { stroke: #58a6ff; } .slice.s2 { stroke: var(--accent-2); }
.slice.s3 { stroke: #d2a8ff; } .slice.s4 { stroke: #ff7b72; } .slice.s5 { stroke: #79c0ff; }
.slice.s6 { stroke: #f0883e; } .slice.s7 { stroke: #8b949e; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; font-size: .86rem; min-width: 220px; }
.legend li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: .5rem; align-items: center; }
.legend b { font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.dot.s0 { background: var(--accent); } .dot.s1 { background: #58a6ff; } .dot.s2 { background: var(--accent-2); }
.dot.s3 { background: #d2a8ff; } .dot.s4 { background: #ff7b72; } .dot.s5 { background: #79c0ff; }
.dot.s6 { background: #f0883e; } .dot.s7 { background: #8b949e; }
.legend-inline { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); }

/* tabs */
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
.tabs a { padding: .45rem .7rem; text-decoration: none; color: var(--muted); font-size: .88rem; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* detail lists */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; font-size: .9rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .6rem; overflow-x: auto;
  font-family: var(--mono); font-size: .8rem; margin: 0; max-height: 320px; }
details summary { cursor: pointer; color: var(--muted); font-size: .86rem; }

/* boxes (landing + round detail) */
.boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: .6rem; }
.box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); padding: .8rem .5rem;
  text-align: center; cursor: pointer; transition: transform .12s, border-color .12s; }
.box:hover { transform: translateY(-2px); border-color: var(--accent); }
.box .n { font-size: .78rem; color: var(--muted); }
.box .v { font-size: 1.05rem; font-weight: 700; margin-top: .2rem; }
.box.picked { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,176,32,.25); }
.box.win { border-color: var(--ok); }
.box.opened .v { color: var(--accent); }
.box.zero .v { color: var(--muted); }

/* landing page */
.landing { max-width: 960px; margin: 0 auto; padding: 1rem 1rem 3rem; }
.lp-head { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0 1.5rem; }
.lp-head .brand { padding: 0; }
.hero { text-align: center; padding: 1.5rem 0 2rem; }
.hero h1 { font-size: 2.6rem; letter-spacing: -.02em; }
.hero .tag { font-size: 1.15rem; color: var(--accent); font-weight: 600; }
.hero-facts { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; margin-top: 1.2rem; }
.hero-facts div { display: flex; flex-direction: column; }
.hero-facts b { font-size: 1.2rem; }
.hero-facts span { font-size: .8rem; color: var(--muted); }
.play-card .boxes { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.result-card { text-align: center; }
.result-card h1 { font-size: 2rem; }
.result-card h1.win { color: var(--accent); }
.result-card .boxes { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); text-align: center; }
.lp-foot { display: flex; justify-content: space-between; padding: 2rem 0 0; font-size: .85rem; color: var(--muted); }

/* RANGE prize inputs stay on one line inside the narrow table cell */
.range-inputs { display: flex; gap: .3rem; flex-wrap: nowrap; }
.range-inputs input { min-width: 78px; }
