:root { --bg:#fff; --fg:#1b1f24; --muted:#6a737d; --line:#d8dee4; --head:#f1f3f5; --accent:#0b5cad; --warn:#b35c00; --rowh:24px; }
* { box-sizing:border-box; }
html,body { height:100%; margin:0; }
body { font:13px/1.35 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; color:var(--fg); background:var(--bg); }
button,input,select { font:inherit; }
button { padding:4px 10px; border:1px solid var(--line); background:#fff; border-radius:4px; cursor:pointer; }
button:hover { background:var(--head); }
button.primary { background:var(--accent); color:#fff; border-color:var(--accent); }
button:disabled { opacity:.5; cursor:default; }
input[type=text],input[type=password],input[type=date],select { padding:4px 6px; border:1px solid var(--line); border-radius:4px; }
.muted { color:var(--muted); }
.err { color:#b00020; }
.ok { color:#1a7f37; }

/* login */
.login { max-width:340px; margin:14vh auto; padding:24px; border:1px solid var(--line); border-radius:8px; }
.login h1 { font-size:18px; margin:0 0 14px; }
.login input { width:100%; margin-bottom:10px; padding:8px; }
.login button { width:100%; padding:8px; }

/* public page */
#app { display:flex; flex-direction:column; height:100%; }
#toolbar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; padding:8px 10px; border-bottom:1px solid var(--line); background:#fafbfc; }
#toolbar .sp { flex:1; }
#toolbar label { display:inline-flex; gap:4px; align-items:center; }
#status { padding:2px 10px; font-size:12px; color:var(--muted); border-bottom:1px solid var(--line); min-height:20px; }
#wrap { flex:1; overflow:auto; position:relative; }
table#t { border-collapse:separate; border-spacing:0; table-layout:fixed; font-variant-numeric:tabular-nums; }
#t th,#t td { height:var(--rowh); padding:0 6px; white-space:nowrap; overflow:hidden; text-overflow:clip; border-right:1px solid #eceff1; border-bottom:1px solid #eceff1; }
#t td.n { text-align:right; }
#t thead th { position:sticky; background:var(--head); z-index:3; font-weight:600; text-align:right; border-bottom:1px solid var(--line); }
#t thead tr.h1 th { top:0; }
#t thead tr.h2 th { top:var(--rowh); font-weight:400; color:var(--muted); }
#t th.date,#t td.date { position:sticky; left:0; text-align:left; background:var(--head); z-index:2; border-right:1px solid var(--line); }
#t thead th.date { z-index:4; }
#t td.date { font-weight:500; }
#t th.frozen { font-style:italic; color:#7a828a; }
#t th.fx { background:#e8f0f9; }
#t tr.spacer td { padding:0; border:0; }
#t tr.alt td { background:#fcfcfd; }
#t tr.alt td.date { background:var(--head); }
::selection { background:#b6d7ff; }

/* admin */
.page { max-width:1250px; margin:0 auto; padding:14px; }
.page h1 { font-size:18px; margin:0 0 4px; }
.card { border:1px solid var(--line); border-radius:8px; padding:12px; margin:12px 0; }
.card h2 { font-size:14px; margin:0 0 8px; }
.row { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
table.adm { border-collapse:collapse; width:100%; }
table.adm th,table.adm td { padding:4px 6px; border-bottom:1px solid #eceff1; text-align:left; white-space:nowrap; }
table.adm th { background:var(--head); position:sticky; top:0; }
table.adm tr.dragging { opacity:.4; }
table.adm tr.over td { border-top:2px solid var(--accent); }
table.adm tr.paused td { color:var(--muted); }
table.adm tr.hiddenc td.sym { text-decoration:line-through; }
.handle { cursor:grab; color:var(--muted); user-select:none; padding:0 6px; }
.badge { display:inline-block; font-size:11px; padding:0 6px; border-radius:9px; background:var(--head); border:1px solid var(--line); }
.badge.warn { background:#fff4e5; color:var(--warn); border-color:#f5d6a8; }
.badge.fx { background:#e8f0f9; }
.small { font-size:12px; }
.status-err { color:#b00020; max-width:260px; overflow:hidden; text-overflow:ellipsis; display:inline-block; vertical-align:bottom; }
#toast { position:fixed; right:14px; bottom:14px; background:#1b1f24; color:#fff; padding:8px 12px; border-radius:6px; opacity:0; transition:opacity .2s; pointer-events:none; z-index:50; }
#toast.show { opacity:.95; }
.mt6 { margin-top:6px; }
.grow { flex:1; }
.scroll { max-height:62vh; overflow:auto; }

/* carried-forward values (market closed / no FX rate) */
#t td.carried { font-style:italic; color:#8a929a; }
#legend { display:flex; gap:6px; align-items:center; padding:3px 10px; border-top:1px solid var(--line); background:#fafbfc; font-size:12px; color:var(--muted); }
#legend .sp { flex:1; }
#legend .sw { font-style:italic; color:#8a929a; border:1px solid #eceff1; padding:0 6px; background:#fff; }
.ver { color:var(--muted); font-size:12px; }
