* { box-sizing: border-box; }
:root{
    --red:#f30b0b; --red-d:#b91c1c; --red-l:#fdecec;
    --ink:#2b2f36; --muted:#8a909a; --line:#e2e5ea;
    --bg:#eef0f3; --panel:#ffffff;
}
/*body{
    margin:0; height:100vh; overflow:hidden;
    font-family:'Segoe UI',system-ui,-apple-system,Roboto,Arial,sans-serif;
    background:var(--bg); color:var(--ink);
    display:flex; flex-direction:column;
}*/

main.py-4 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* ---------- Header ---------- */
header{
    background:var(--panel); border-bottom:3px solid var(--red);
    padding:9px 16px; display:flex; align-items:center; gap:14px; flex-wrap:wrap;
    box-shadow:0 1px 5px rgba(0,0,0,.07); z-index:5;
}
.brand{ display:flex; align-items:center; gap:10px; font-weight:700; font-size:17px; }
.brand .logo{
    width:32px; height:32px; border-radius:7px; background:var(--red);
    display:flex; align-items:center; justify-content:center; color:#fff; font-size:18px;
    box-shadow:0 2px 6px rgba(220,38,38,.4);
}
.brand small{ color:var(--muted); font-weight:500; font-size:12px; display:block; margin-top:-2px;}
.header-actions{ margin-left:auto; display:flex; gap:7px; align-items:center; flex-wrap:wrap; }
.divider{ width:1px; height:26px; background:var(--line); margin:0 3px; }

/* ---------- Buttons ---------- */
.btn{
    font:inherit; font-size:13px; padding:8px 12px; border-radius:8px; cursor:pointer;
    display:inline-flex; align-items:center; gap:7px; border:1px solid transparent;
    transition:background .15s, border-color .15s, transform .05s, box-shadow .15s; user-select:none;
}
.btn:active{ transform:translateY(1px); }
.btn-red{ background:var(--red); color:#fff; box-shadow:0 2px 5px rgba(220,38,38,.3); }
.btn-red:hover{ background:var(--red-d); }
.btn-ghost{ background:var(--panel); border:1px solid #d7dbe0; color:#3a3f47; }
.btn-ghost:hover{ border-color:var(--red); color:var(--red); background:#fbfbfc; }
.btn .ic{ font-size:15px; line-height:1; }

/* toggle */
.toggle{
    display:inline-flex; align-items:center; gap:8px; padding:7px 12px; border-radius:20px;
    border:1px solid #d7dbe0; background:var(--panel); cursor:pointer; font-size:13px; font-weight:600;
}
.toggle .dot{ width:15px; height:15px; border-radius:50%; background:#f5b400; box-shadow:0 0 7px #ffd24a; transition:.2s; }
.toggle.night{ background:#1f2937; color:#e5e7eb; border-color:#111827; }
.toggle.night .dot{ background:#c7d2fe; box-shadow:0 0 8px #a5b4fc; }

/* ---------- Layout ---------- */
div.main-terrain{ flex:1; display:flex; min-height:0; }
.sidebar{
    width:236px; flex-shrink:0; background:var(--panel); border-right:1px solid var(--line);
    padding:14px; overflow-y:scroll; height: 800px;
}
.section-title{
    font-size:11px; text-transform:uppercase; letter-spacing:.07em; color:var(--muted);
    margin:0 0 9px; font-weight:700;
}
.group{ margin-bottom:18px; }

.tools{ display:grid; grid-template-columns:1fr 1fr; gap:7px; }
.tool-btn{
    font:inherit; font-size:12.5px; cursor:pointer; padding:9px 6px; border-radius:9px;
    border:1px solid var(--line); background:#fafbfc; color:#3a3f47;
    display:flex; flex-direction:column; align-items:center; gap:4px; transition:.15s;
}
.tool-btn:hover{ border-color:#f0a8a8; background:#fff; }
.tool-btn.active{ border-color:var(--red); background:var(--red-l); color:var(--red-d); box-shadow:0 0 0 1px var(--red) inset; }
.tool-btn .ic{ font-size:18px; }

.palette{ display:flex; flex-direction:column; gap:7px; }
.pal-item{
    display:flex; align-items:center; gap:10px; padding:6px 8px; border:1px solid var(--line);
    border-radius:9px; background:#fff; cursor:pointer; transition:.15s; text-align:left; font:inherit;
}
.pal-item:hover{ border-color:#f0a8a8; background:#fafafa; }
.pal-item.active{ border-color:var(--red); background:var(--red-l); box-shadow:0 0 0 1px var(--red) inset; }
.pal-item canvas{ border:1px solid #eef0f3; border-radius:6px; background:#fff; flex-shrink:0; }
.pal-item .lbl{ font-size:13px; color:#3a3f47; line-height:1.2; }
.pal-item .sz{ font-size:11px; color:var(--muted); }

.hint-box{
    font-size:12px; color:#5b6068; background:#f7f8fa; border:1px dashed var(--line);
    border-radius:8px; padding:9px 10px; line-height:1.45;
}
.info-box{
    font-size:12px; color:#7c3a3a; background:var(--red-l); border:1px solid #f5c2c2;
    border-radius:8px; padding:8px 10px; line-height:1.45;
}

.statusbar{
    margin-top:auto; padding-top:12px; border-top:1px solid var(--line);
    font-size:12px; color:var(--muted); display:flex; flex-direction:column; gap:3px;
}
.statusbar b{ color:#3a3f47; font-weight:600; }

/* ---------- Canvas area ---------- */
.canvas-area{
    flex:1; display:flex; align-items:center; justify-content:center; padding:22px; overflow:auto;
    background:
        linear-gradient(0deg,#e7e9ed,#e7e9ed),
        repeating-linear-gradient(45deg,#eef0f3 0 10px,#e7e9ed 10px 20px);
}
.canvas-wrap{
    background:#fff; border-radius:8px; padding:0; line-height:0;
    box-shadow:0 8px 26px rgba(0,0,0,.18); border:1px solid #d7dbe0;
}
canvas#map{ display:block; max-width:100%; height:auto; cursor:crosshair; touch-action:none; }

::-webkit-scrollbar{ width:9px; height:9px; }
::-webkit-scrollbar-thumb{ background:#cfd4db; border-radius:6px; }
::-webkit-scrollbar-thumb:hover{ background:#b9bfc7; }
