:root { --g9: #1f4720; --g7: #2f6b2f; --g5: #4fa43a; --g2: #e6f2d8; --bg: #f4f7ef; --ink: #1e2a1e; --muted: #6b7a63; --or: #ff8a1f; --red: #d9443b; --sky: #2b8fd6; }
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); }
button, .btn, select, input { font: inherit; }
button, .btn { border: 0; border-radius: 10px; padding: 8px 14px; background: #fff; color: var(--ink); cursor: pointer; box-shadow: 0 1px 0 #c9d6bd, 0 0 0 1px #d6e2cb inset; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--g2); }
button.primary { background: var(--g7); color: #fff; box-shadow: none; font-weight: 700; }
button.primary:hover { background: var(--g9); }
button.danger { background: var(--red); color: #fff; box-shadow: none; }
button.danger.outline { background: #fff; color: var(--red); box-shadow: 0 0 0 2px var(--red) inset; }
button.ghost { background: transparent; box-shadow: none; }
select, input:not([type=checkbox]):not([type=range]):not([type=color]) { padding: 7px 10px; border: 1px solid #cbd8bf; border-radius: 10px; background: #fff; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.grow { flex: 1; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.err { color: var(--red); min-height: 1.4em; }

.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--g7), var(--g5)); }
.login-card { background: #fff; padding: 32px; border-radius: 20px; width: 340px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { margin: 0 0 6px; color: var(--g9); }
.login-card button { background: var(--g7); color: #fff; font-weight: 700; padding: 10px; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 10px 18px; background: var(--g9); color: #fff; flex-wrap: wrap; }
.brand { font-weight: 800; font-size: 19px; } .brand span { opacity: .6; font-weight: 600; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs button { background: transparent; color: #dfeccf; box-shadow: none; }
.tabs button.active, .tabs button:hover { background: rgba(255,255,255,.15); color: #fff; }
.top-right { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.top-right a { color: #cfe5b8; text-decoration: none; }
.top-right button { color: #fff; }

.tab { display: none; padding: 18px; }
.tab.active { display: block; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar.bulk { background: #fff; padding: 8px 12px; border-radius: 12px; box-shadow: 0 0 0 1px #dde7d2; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.item { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 0 0 1px #dde7d2, 0 2px 6px rgba(0,0,0,.04); position: relative; transition: box-shadow .15s; }
.item.sel { box-shadow: 0 0 0 3px var(--or); }
.item.is-hidden .thumb img { opacity: .3; filter: grayscale(1); }
.thumb { height: 160px; display: flex; align-items: center; justify-content: center; padding: 10px; cursor: pointer;
  background: repeating-conic-gradient(#eef3e8 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.thumb img { max-width: 100%; max-height: 100%; }
.item .meta { padding: 8px 10px; font-size: 13px; }
.item .meta b { font-size: 14px; }
.item .acts { display: flex; border-top: 1px solid #eef3e8; }
.item .acts button { flex: 1; border-radius: 0; box-shadow: none; background: #fff; padding: 7px 0; font-size: 16px; }
.item .acts button:hover { background: var(--g2); }
.item .acts button.del:hover { background: #fde4e2; }
.item .cb { position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; accent-color: var(--or); }
.badges { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #fff; }
.badge.led { background: var(--g5); } .badge.hid { background: #888; }
.pager { display: flex; gap: 6px; justify-content: center; margin: 18px 0; flex-wrap: wrap; }
.pager button.cur { background: var(--g7); color: #fff; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 14px; }
.card { background: #fff; border-radius: 16px; padding: 16px 18px; box-shadow: 0 0 0 1px #dde7d2; }
.card.wide { grid-column: 1 / -1; }
.card h3 { margin: 0 0 12px; font-size: 16px; color: var(--g9); }
.card label { display: block; margin-bottom: 12px; }
.card label.chk { display: flex; margin-bottom: 8px; }
.card label.row { display: flex; align-items: center; gap: 10px; }
.card input[type=range] { width: 100%; accent-color: var(--g7); display: block; }
.card select { width: 100%; margin-top: 4px; }
.savebar { position: sticky; bottom: 0; margin-top: 16px; padding: 12px 0; background: var(--bg); display: flex; gap: 12px; align-items: center; }

.plot-wrap { background: #fff; border-radius: 14px; padding: 10px; box-shadow: 0 0 0 1px #dde7d2; }
.plot { position: relative; width: 100%; aspect-ratio: 5760 / 1080; background: url("../assets/background.png") center / 100% 100%; cursor: crosshair; border-radius: 6px; overflow: hidden; }
.band { position: absolute; left: 0; right: 0; pointer-events: none; }
.band.ground { background: rgba(80,200,60,.28); border-top: 2px dashed #2a7a1a; border-bottom: 2px dashed #2a7a1a; }
.band.sky { background: rgba(43,143,214,.22); border-top: 2px dashed #1a5f99; border-bottom: 2px dashed #1a5f99; }
.pt { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: #ff3d7f; color: #fff; font-weight: 800; font-size: 13px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px #fff, 0 3px 8px rgba(0,0,0,.4); cursor: grab; user-select: none; touch-action: none; }
.pt::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid #ff3d7f; animation: ping 1.6s infinite; }
@keyframes ping { from { transform: scale(.6); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.tag { padding: 1px 8px; border-radius: 6px; color: #fff; font-weight: 700; }
.tag.ground { background: #3a9a2a; } .tag.sky { background: var(--sky); }
.spawn-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; max-height: 220px; overflow: auto; }
.spawn-list div { display: flex; justify-content: space-between; align-items: center; background: var(--bg); padding: 4px 10px; border-radius: 8px; font-size: 13px; }
.spawn-list button { padding: 2px 8px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: #fff; border-radius: 14px; padding: 14px 16px; box-shadow: 0 0 0 1px #dde7d2; }
.kpi .n { font-size: 30px; font-weight: 800; color: var(--g9); line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 13px; }
.hbars .r { display: grid; grid-template-columns: 120px 1fr 48px; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.hbars .bar { height: 16px; background: var(--g5); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbars .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.vbars { display: flex; align-items: flex-end; gap: 4px; height: 200px; padding-top: 20px; }
.vbars .c { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: 11px; color: var(--muted); }
.vbars .b { width: 100%; background: var(--g5); border-radius: 4px 4px 0 0; min-height: 1px; position: relative; }
.vbars .b span { position: absolute; top: -17px; left: 0; right: 0; text-align: center; color: var(--ink); font-weight: 600; }

.preview-wrap { width: 100%; aspect-ratio: 5760 / 1080; background: #000; border-radius: 10px; overflow: hidden; }
.preview-wrap iframe { width: 100%; height: 100%; border: 0; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 150%); background: var(--ink); color: #fff; padding: 10px 22px; border-radius: 999px; transition: transform .3s; z-index: 99; }
.toast.show { transform: translate(-50%, 0); }

@media print { .top, .toolbar, .savebar { display: none !important; } .tab { display: none !important; } #tab-report { display: block !important; } }
