:root { --bg:#f4f6f5; --card:#fff; --ink:#17221d; --muted:#64736b; --line:#dde4e0; --accent:#0f6b47; --soft:#e3f1ea; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin:0; font:14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background:var(--bg); color:var(--ink); }
button, input, select { font:inherit; color:inherit; }
button { background:var(--card); border:1px solid var(--line); border-radius:7px; padding:6px 12px; cursor:pointer; }
button:hover:not(:disabled) { border-color:var(--accent); }
button:disabled { opacity:.5; cursor:default; }
button.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
input:not([type=checkbox]), select { border:1px solid var(--line); border-radius:7px; padding:6px 9px; background:#fff; width:100%; }
h2, h3 { margin:0 0 6px; }
h3 { font-size:15px; }
.muted { color:var(--muted); font-size:13px; }


header { display:flex; align-items:center; gap:20px; background:var(--accent); color:#fff; padding:9px 18px; position:sticky; top:0; z-index:5; flex-wrap:wrap; }
header nav { display:flex; gap:4px; flex:1; flex-wrap:wrap; }
header button { background:transparent; border-color:transparent; color:#fff; }
header button.active { background:#fff; color:var(--accent); font-weight:600; }
.layout { display:grid; grid-template-columns:270px minmax(0,1fr); align-items:start; }
aside { padding:14px; display:flex; flex-direction:column; gap:7px; position:sticky; top:52px; max-height:calc(100vh - 52px); overflow:auto; }
aside > * { flex-shrink:0; }
aside details, fieldset { background:var(--card); border:1px solid var(--line); border-radius:8px; padding:7px 10px; margin:0; }
summary { cursor:pointer; }
summary b:not(:empty) { background:var(--accent); color:#fff; border-radius:9px; padding:0 7px; margin-left:6px; font-size:12px; }
.optsearch { margin:7px 0; }
.opts { max-height:230px; overflow:auto; }
.opts label { display:flex; gap:7px; align-items:flex-start; padding:3px 0; font-size:13px; }
.opts span { flex:1; overflow-wrap:anywhere; }
.opts i { font-style:normal; color:var(--muted); }
legend { font-size:13px; color:var(--muted); }
.range { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.range input { min-width:0; padding:5px !important; font-size:12px; }
main { padding:14px 18px 40px; }
.summary { display:flex; gap:12px; align-items:center; flex-wrap:wrap; margin-bottom:10px; }
#count { font-weight:700; font-size:16px; }
#chips { display:flex; gap:6px; flex-wrap:wrap; }
.chip { background:var(--soft); border-color:transparent; font-size:12px; padding:3px 9px; }

.stats { display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; }
.stat, .card { background:var(--card); border:1px solid var(--line); border-radius:10px; padding:13px 15px; }
.stat b { display:block; font-size:24px; color:var(--accent); }
.stat span { color:var(--muted); }
.cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(360px,1fr)); gap:12px; align-items:start; }
.cards .card { min-width:0; }
main > section > .card { margin-bottom:12px; }
.toolbar { display:flex; gap:12px; align-items:end; flex-wrap:wrap; margin:8px 0 10px; }
.toolbar label { display:flex; flex-direction:column; font-size:12px; color:var(--muted); gap:2px; }
.toolbar input[type=search] { width:260px; }
.toolbar input[type=number] { width:130px; }
.toolbar label.check { flex-direction:row; align-items:center; gap:6px; padding-bottom:6px; }
.menu { position:relative; }
.menu summary { border:1px solid var(--line); border-radius:7px; padding:6px 12px; background:var(--card); }
.menu > div { position:absolute; z-index:4; background:var(--card); border:1px solid var(--line); border-radius:8px; padding:10px; width:200px; max-height:330px; overflow:auto; box-shadow:0 8px 20px #0002; }
.sizes { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:6px 14px; margin-bottom:12px; }
.sizes label { display:flex; justify-content:space-between; align-items:center; gap:8px; font-size:13px; }
.sizes input { width:70px !important; }

.scroll { overflow:auto; background:var(--card); border:1px solid var(--line); border-radius:8px; margin-bottom:10px; }
table { border-collapse:collapse; width:100%; font-size:13px; }
th, td { padding:6px 9px; border-bottom:1px solid var(--line); text-align:left; vertical-align:top; }
th { background:var(--soft); white-space:nowrap; }
th button { border:0; background:none; padding:0; font-weight:600; }
.matrix td:not(:first-child), .matrix th:not(:first-child) { text-align:right; }
tr.total td { font-weight:700; background:var(--soft); }
.pager { display:flex; gap:12px; align-items:center; justify-content:center; }
em { color:#a05a00; }

@media (max-width: 800px) {
  .layout { grid-template-columns:1fr; }
  aside { position:static; max-height:45vh; }
  .cards { grid-template-columns:1fr; }
}

#printArea { display:none; }
@media print {
  @page { size: A4 landscape; margin:10mm; }
  body { background:#fff; }
  body:not(.shared) > *:not(#printArea) { display:none !important; }
  #printArea { display:block; }
  .scroll { overflow:visible; border:0; }
  table { font-size:10px; }
  th, td { border:1px solid #999; padding:3px 5px; }
  th { background:#eee; }
  thead { display:table-header-group; }
  tr { break-inside:avoid; }
  .sheet { break-after:page; }
  .sheet:last-child { break-after:auto; }
  .sheet td { height:24px; }
  .sign { width:110px; }
  .foot { margin-top:24px; }
}

.authbox { max-width:340px; margin:12vh auto; background:var(--card); padding:28px; border-radius:12px; border:1px solid var(--line); display:flex; flex-direction:column; gap:12px; }
.authbox h1 { margin:0; font-size:24px; }
.error { color:#a62b1f; margin:0; }
#who { font-size:13px; opacity:.85; }
button.small { padding:1px 9px; font-size:12px; }
button.danger { color:#a62b1f; margin-left:auto; }
dialog { border:1px solid var(--line); border-radius:12px; padding:22px; width:min(760px, 94vw); max-height:90vh; }
dialog::backdrop { background:#0006; }
dialog label { display:block; font-size:12px; color:var(--muted); margin-bottom:8px; }
.formgrid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); column-gap:12px; margin-bottom:6px; }
.deleted { font-size:13px; }
body.shared main { max-width:1000px; margin:0 auto; }
@media print {
  body.shared > main { display:block !important; padding:0; }
  body.shared button { display:none; }
}

/* dashboard */
.layout.dash { grid-template-columns:minmax(0,1fr); }
.layout.dash aside { display:none; }
.layout.dash main { max-width:1500px; width:100%; margin:0 auto; }
.dashboard { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:14px; align-items:stretch; }
.dashhead, .dashactions, .filterbar, .wide { grid-column:1/-1; }
.half { grid-column:span 6; } .two { grid-column:span 8; } .one { grid-column:span 4; display:flex; flex-direction:column; gap:14px; } .third { grid-column:span 4; }
.dashhead { text-align:center; padding-top:6px; }
.dashhead h1 { margin:0; font-size:26px; letter-spacing:.04em; text-transform:uppercase; color:var(--accent); }
.dashhead p { margin:4px 0 0; color:var(--muted); }
.dashactions { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.panel, .dashboard .stat { background:var(--card); border:1px solid var(--line); border-radius:14px; padding:16px 18px; min-width:0; box-shadow:0 2px 10px #0f6b4708; }
.panelhead { display:flex; justify-content:space-between; gap:10px; margin-bottom:12px; }
.panelhead h3 { margin:0; font-size:12px; text-transform:uppercase; letter-spacing:.07em; }
.panelhead span { font-size:12px; color:var(--muted); }
.dashboard .stat { grid-column:span 3; text-align:center; }
.dashboard .stat span { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.07em; font-weight:600; }
.dashboard .stat b { font-size:28px; } .dashboard .stat small { font-size:15px; }
.filterbar { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:10px 14px; align-items:end; }
.filterbar label { font-size:11px; text-transform:uppercase; letter-spacing:.06em; font-weight:600; min-width:0; }
.quick { display:flex; gap:6px; flex-wrap:wrap; grid-column:span 2; }
.dashboard button:disabled { opacity:1; }
.bars { max-height:330px; overflow:auto; }
.bars button { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(60px,2fr) 56px; gap:10px; align-items:center; width:100%; border:0; padding:4px 0; text-align:left; background:none; }
.bars span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bars em { height:10px; background:#eef3f0; border-radius:5px; overflow:hidden; }
.bars i { display:block; height:100%; background:var(--accent); border-radius:5px; min-width:2px; }
.bars b { text-align:right; font-weight:600; }
.columns { display:flex; gap:6px; overflow-x:auto; height:250px; align-items:stretch; }
.columns button { flex:1 0 34px; display:flex; flex-direction:column; align-items:center; gap:4px; border:0; background:none; padding:0; font-size:11px; min-width:0; }
.columns em { flex:1; width:70%; max-width:44px; display:flex; align-items:flex-end; }
.columns i { display:block; width:100%; background:var(--accent); border-radius:5px 5px 0 0; min-height:2px; }
.columns span { height:30px; width:100%; overflow:hidden; line-height:1.2; overflow-wrap:anywhere; }
.donut { display:block; width:210px; margin:0 auto 12px; }
.donut text { text-anchor:middle; font-size:5px; font-weight:700; fill:var(--ink); }
.donut text.sub { font-size:2.4px; fill:var(--muted); }
.tiles { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.tiles button { display:flex; gap:9px; align-items:center; text-align:left; }
.tiles i, .legend i { width:9px; height:9px; border-radius:50%; flex:none; display:inline-block; }
.tiles b { display:block; font-weight:400; color:var(--muted); font-size:12px; }
.pills { display:flex; gap:5px; flex-wrap:wrap; margin-bottom:10px; }
.pills button { border-radius:20px; font-size:12px; padding:4px 12px; }
.pills button.on { background:var(--accent); border-color:var(--accent); color:#fff; }
.heat { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:6px; max-height:440px; overflow:auto; }
.heat button { text-align:left; display:flex; flex-direction:column; justify-content:space-between; min-height:66px; font-size:12px; }
.heat b { font-size:18px; }
.cloud { display:flex; flex-wrap:wrap; gap:4px 14px; justify-content:center; align-items:center; }
.cloud button { border:0; background:none; padding:0; color:var(--accent); font-weight:700; }
.chart { width:100%; height:auto; }
.chart text { font-size:11px; text-anchor:middle; fill:var(--ink); }
.chart text.axis { fill:var(--muted); font-size:10px; }
.stack > div { margin-bottom:12px; } .stack span { font-weight:600; font-size:13px; } .stack small { color:var(--muted); }
.stack div div { display:flex; height:22px; border-radius:6px; overflow:hidden; margin:3px 0; }
.legend { font-size:12px; color:var(--muted); } .legend i { margin:0 4px 0 8px; }
.top5 { list-style:none; margin:0; padding:0; }
.top5 button { display:flex; gap:10px; align-items:center; width:100%; border:0; background:none; text-align:left; padding:6px 0; }
.top5 em { font-style:normal; background:var(--soft); color:var(--accent); border-radius:7px; width:26px; height:26px; display:grid; place-items:center; font-weight:700; }
.top5 span { flex:1; font-weight:600; } .top5 small { display:block; font-weight:400; color:var(--muted); }
.top5 i, .share { display:block; height:5px; background:#eef3f0; border-radius:3px; overflow:hidden; }
.top5 u, .share i { display:block; height:100%; background:var(--accent); }
.share { display:inline-block; width:110px; vertical-align:middle; }
.rings { display:grid; grid-template-columns:1fr 1fr; gap:10px; text-align:center; font-size:12px; margin-bottom:10px; }
.ring > div { width:104px; height:104px; border-radius:50%; margin:0 auto; display:grid; place-items:center; }
.ring b { background:var(--card); border-radius:50%; width:78px; height:78px; display:grid; place-items:center; font-size:19px; }
.recent { list-style:none; margin:0; padding:0; }
.recent li { display:flex; justify-content:space-between; gap:8px; padding:6px 0; border-bottom:1px solid var(--line); }
.recent small { display:block; color:var(--muted); } .recent time { font-size:12px; color:var(--muted); white-space:nowrap; }
@media (max-width:1100px) { .half, .two, .one, .third { grid-column:1/-1; } .dashboard .stat { grid-column:span 6; } }
@media (max-width:800px) { .layout.dash aside { display:none; } .tiles { grid-template-columns:1fr; } .quick { grid-column:1/-1; } }
@media print {
  * { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  .dashprint { display:grid; grid-template-columns:repeat(12,minmax(0,1fr)); gap:8px; }
  .dashprint > p, .dashprint .dashhead { grid-column:1/-1; }
  .dashprint .dashactions, .dashprint .filterbar, .dashprint .pills, .dashprint .toolbar, .dashprint .pager, .dashprint .recent { display:none; }
  .dashprint .panel { break-inside:avoid; }
  .dashprint .bars, .dashprint .heat { max-height:none; }
}
