:root, [data-theme="dark"] {
  --bg: #111214; --panel: #18191c; --panel2: #1e1f23; --line: #2a2b30; --line2: #34353b;
  --text: #e4e4e7; --muted: #8b8d94; --dim: #5d5f66;
  --green: #22c55e; --green-bg: rgba(34,197,94,.12); --red: #ef4444; --red-bg: rgba(239,68,68,.12);
  --amber: #f0b429; --amber-bg: rgba(240,180,41,.12); --blue: #4f8cff; --blue-bg: rgba(79,140,255,.14);
  --shadow: none;
}
[data-theme="light"] {
  --bg: #f3f4f7; --panel: #ffffff; --panel2: #f7f8fa; --line: #e3e5ea; --line2: #d5d8de;
  --text: #1c2230; --muted: #6b7280; --dim: #9aa0aa;
  --green: #0f9d58; --green-bg: rgba(15,157,88,.10); --red: #d93025; --red-bg: rgba(217,48,37,.08);
  --amber: #c98a00; --amber-bg: rgba(201,138,0,.10); --blue: #1f5fd6; --blue-bg: rgba(31,95,214,.08);
  --shadow: 0 1px 2px rgba(0,0,0,.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); font: 13px/1.4 Inter, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.num, td.n { font-variant-numeric: tabular-nums; }
.up { color: var(--green); } .dn { color: var(--red); } .mut { color: var(--muted); } .warn { color: var(--amber); }

/* ---------- nav */
.nav { height: 48px; display: flex; align-items: center; gap: 18px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 15px; white-space: nowrap; }
.logo { width: 26px; height: 26px; border-radius: 6px; background: linear-gradient(135deg,#ff6a3d,#e0452b); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
#menu { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
#menu a { padding: 14px 12px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
#menu a.on { color: var(--text); border-bottom-color: var(--blue); }
#menu a:hover { color: var(--text); }
.nav-right { display: flex; align-items: center; gap: 8px; }
.asof { font-size: 12px; color: var(--muted); white-space: nowrap; }
.asof b { color: var(--text); font-weight: 600; }
.icon-btn { width: 32px; height: 32px; border: 1px solid var(--line); background: var(--panel2); border-radius: 6px; }

/* ---------- ticker (index strip) */
.ticker { display: flex; overflow-x: auto; background: var(--panel); border-bottom: 1px solid var(--line); scrollbar-width: none; position: sticky; top: 48px; z-index: 19; }
.ticker::-webkit-scrollbar { display: none; }
.tk { padding: 7px 14px; border-right: 1px solid var(--line); white-space: nowrap; font-size: 12px; cursor: pointer; }
.tk:hover { background: var(--panel2); }
.tk b { font-weight: 600; letter-spacing: .2px; margin-right: 6px; }
.tk .v { margin-right: 6px; }
.tk.sel { box-shadow: inset 0 -2px 0 var(--blue); background: var(--blue-bg); }

main { padding: 12px 16px 28px; }
h1 { font-size: 18px; font-weight: 600; }
h2 { font-size: 14px; font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
.row { display: flex; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* ---------- panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 44px; }
.card-h h2 { flex: 1; }
.card-b { padding: 12px 14px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; }
.tab { padding: 6px 11px; border-radius: 6px; color: var(--muted); white-space: nowrap; border: 1px solid transparent; background: none; }
.tab.on { color: var(--text); background: var(--blue-bg); border-color: var(--blue); }
.tabs.line .tab { border-radius: 0; border: none; border-bottom: 2px solid transparent; padding: 8px 10px; background: none; }
.tabs.line .tab.on { border-bottom-color: var(--blue); color: var(--blue); background: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line2); border-radius: 6px; background: var(--panel2); white-space: nowrap; }
select.pill { appearance: none; padding-right: 22px; background-image: linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%); background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%; background-size: 4px 4px; background-repeat: no-repeat; color: var(--text); }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 6px; overflow: hidden; }
.seg button { padding: 5px 10px; background: var(--panel2); border: none; border-right: 1px solid var(--line2); color: var(--muted); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--blue); color: #fff; }
.badge { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line2); color: var(--muted); }
.badge.draft { color: var(--amber); border-color: var(--amber); }
.badge.g { color: var(--green); border-color: var(--green); } .badge.r { color: var(--red); border-color: var(--red); } .badge.a { color: var(--amber); border-color: var(--amber); }
.chg { font-size: 12px; white-space: nowrap; }

/* ---------- tables */
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 500; color: var(--muted); font-size: 11.5px; padding: 7px 10px; border-bottom: 1px solid var(--line); background: var(--panel2); position: sticky; top: 0; white-space: nowrap; }
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th.n, table.t td.n { text-align: right; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: var(--panel2); }
table.t td.k { color: var(--text); }
.zone { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.zone.g { background: var(--green); } .zone.r { background: var(--red); } .zone.a { background: var(--amber); } .zone.n { background: var(--dim); }
.bar { height: 6px; background: var(--line); border-radius: 3px; position: relative; overflow: hidden; min-width: 60px; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }

/* ---------- dashboard */
.dash { display: grid; grid-template-columns: 400px 1fr 360px; gap: 12px; align-items: start; }
.mover { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.mover:hover { background: var(--panel2); }
.mover .nm { font-weight: 500; }
.mover .nm small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.mover .rt { text-align: right; }
.mover .rt .v { font-size: 14px; }
.idx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.idx { padding: 12px 14px; cursor: pointer; }
.idx:hover { border-color: var(--blue); }
.idx .top { display: flex; justify-content: space-between; align-items: baseline; }
.idx .nm { font-weight: 600; font-size: 12px; letter-spacing: .3px; }
.idx .v { font-size: 20px; margin: 4px 0 2px; }
.idx svg { display: block; margin-top: 6px; }
.idx .tgt { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11px; color: var(--muted); }

/* ---------- workspace */
.ws-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.ws-head h1 { margin-right: 6px; }
.ws-upper { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 12px; }
.ws-lower { display: grid; grid-template-columns: 300px minmax(0, 1fr) 380px; gap: 12px; margin-top: 12px; align-items: stretch; }
.chart-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chart-legend { padding: 8px 14px 0; font-size: 12.5px; display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; }
.chart-legend .big { font-size: 20px; font-weight: 600; }
.chart-box { height: 430px; position: relative; }
.zone-key { display: flex; gap: 14px; padding: 6px 14px 10px; font-size: 11.5px; color: var(--muted); }
.zone-key span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; border-radius: 2px; }
.zone-key .zg::before { background: var(--green-bg); border: 1px solid var(--green); }
.zone-key .zr::before { background: var(--red-bg); border: 1px solid var(--red); }
.zone-key .zn::before { background: var(--line); }
.rep-wrap { max-height: 520px; overflow: auto; }
#report table.t td, #report table.t th { padding: 6px 7px; font-size: 12px; }
#report table.t td.k { white-space: normal; min-width: 120px; max-width: 170px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; padding: 12px; }
.kpi { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 86px; }
.kpi .l { color: var(--muted); font-size: 11.5px; }
.kpi .v { font-size: 21px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi.g { border-color: var(--green); background: var(--green-bg); } .kpi.r { border-color: var(--red); background: var(--red-bg); } .kpi.a { border-color: var(--amber); background: var(--amber-bg); }
.ring-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; gap: 8px; text-align: center; }
.gl-list .mover { padding: 9px 14px; }
.gl-list .mover .nm { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- workspaces list */
.wl-sec { margin: 16px 0 8px; display: flex; align-items: baseline; gap: 10px; }
.wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.wl { padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.wl:hover { border-color: var(--blue); }
.wl .ttl { display: flex; justify-content: space-between; font-weight: 600; }
.wl.new { border-style: dashed; align-items: center; justify-content: center; color: var(--blue); min-height: 120px; }

/* ---------- all charts */
.grid-charts { display: grid; gap: 10px; }
.mini { display: flex; flex-direction: column; overflow: hidden; }
.mini .card-h { padding: 6px 10px; min-height: 36px; }
.mini .card-h h2 { font-size: 12.5px; letter-spacing: .3px; }
.mini .mbox { flex: 1; min-height: 0; position: relative; }
.mini.span2 { grid-column: span 2; grid-row: span 2; }
.edit .mini { outline: 1px dashed var(--blue); cursor: grab; }
.edit .mini.drag-over { outline: 2px solid var(--amber); }
.mini .x { display: none; color: var(--red); padding: 0 4px; }
.edit .mini .x { display: inline; }
.drawer { width: 300px; }
.drawer label { display: flex; gap: 8px; align-items: center; padding: 7px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }

/* ---------- forms */
input.in { background: var(--panel2); border: 1px solid var(--line2); color: var(--text); border-radius: 6px; padding: 6px 8px; width: 130px; text-align: right; font: inherit; }
.btn { padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line2); background: var(--panel2); }
.btn.pri { background: var(--blue); border-color: var(--blue); color: #fff; }
.note { background: var(--amber-bg); border: 1px solid var(--amber); color: var(--text); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 12.5px; }

.tip { position: fixed; pointer-events: none; z-index: 50; background: var(--panel); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 9px; font-size: 12px; display: none; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* big screen */
body.big { font-size: 15px; }
body.big .kpi .v { font-size: 26px; }
body.big .chart-box { height: 520px; }

@media (max-width: 1300px) {
  .dash { grid-template-columns: 1fr 1fr; }
  .ws-upper { grid-template-columns: 1fr; }
  .ws-lower { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 800px) {
  .dash, .ws-lower { grid-template-columns: 1fr; }
  #menu a { padding: 14px 8px; }
}
.mini .card-h h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.mini .card-h .num, .mini .card-h .chg { white-space: nowrap; }

/* ================= sidebar layout (analyse.deodap.info) ================= */
body { display: flex; min-height: 100vh; }
.side { width: 236px; flex: 0 0 236px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30; transition: width .15s, flex-basis .15s; }
.side .brand { padding: 0 16px; height: 52px; border-bottom: 1px solid var(--line); }
#menu { flex: 1; overflow-y: auto; padding: 8px 0; display: block; }
#menu .sec { padding: 14px 18px 6px; font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
#menu a { display: flex; align-items: center; gap: 10px; padding: 8px 18px; color: var(--muted); border-left: 3px solid transparent; white-space: nowrap; border-bottom: none; }
#menu a .ic { width: 18px; text-align: center; flex: 0 0 18px; }
#menu a .cnt { margin-left: auto; font-size: 11px; }
#menu a:hover { color: var(--text); background: var(--panel2); }
#menu a.on { color: var(--text); background: var(--blue-bg); border-left-color: var(--blue); }
#menu details summary { list-style: none; cursor: pointer; }
#menu details summary::-webkit-details-marker { display: none; }
#menu details a { padding-left: 46px; font-size: 12.5px; }
#menu details[open] > summary .car { transform: rotate(90deg); }
#menu .car { margin-left: auto; transition: transform .15s; font-size: 10px; }
.side-foot { border-top: 1px solid var(--line); padding: 10px 14px; font-size: 12px; }
.side-foot .who { display: flex; align-items: center; gap: 8px; }
.side-foot .av { width: 30px; height: 30px; border-radius: 50%; background: var(--blue-bg); color: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 30px; }
.side-foot .links { display: flex; gap: 10px; margin-top: 8px; }
.side-foot .links a { color: var(--muted); } .side-foot .links a:hover { color: var(--text); }
body.mini-side .side { width: 64px; flex-basis: 64px; }
body.mini-side .side .lbl, body.mini-side #menu .sec, body.mini-side #menu a .t, body.mini-side #menu .cnt, body.mini-side #menu .car, body.mini-side .side-foot .nm, body.mini-side .side-foot .links, body.mini-side #menu details a { display: none; }
body.mini-side #menu a { justify-content: center; padding: 10px 0; }
.maincol { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .ticker { flex: 1; min-width: 0; border: none; position: static; background: none; }
.nav { display: none; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: center; justify-content: center; }
.modal { width: 560px; max-width: 94vw; max-height: 90vh; overflow: auto; }
.modal .card-b label.f { display: block; color: var(--muted); font-size: 12px; margin: 12px 0 5px; }
.modal input.in, .modal select.in { width: 100%; text-align: left; }
.chk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.chk-grid label { display: flex; gap: 6px; align-items: center; padding: 3px 0; cursor: pointer; }
.pwbox { font: 600 18px/1.4 ui-monospace, Menlo, monospace; background: var(--panel2); border: 1px dashed var(--amber); padding: 10px 14px; border-radius: 6px; margin: 8px 0; user-select: all; }
@media (max-width: 900px) { .side { position: fixed; left: 0; transform: translateX(-100%); } body.open-side .side { transform: none; } }

#report table.t td, #report table.t th { padding: 5px 6px; font-size: 11.5px; }
#report table.t td.k { min-width: 104px; }
@media (max-width: 1350px) { .ws-upper { grid-template-columns: 1fr; } }
