:root{
  --bg:#fffaf2;
  --card:#ffffff;
  --card2:#fff3df;
  --text:#243047;
  --muted:#6f7d99;
  --accent:#2f7dff;
  --good:#1ea772;
  --warn:#d08a00;
  --bad:#d84f65;
  --glow: 0 0 18px rgba(47,125,255,.22);
  --radius:18px;
}

*{box-sizing:border-box}
html, body{max-width:100%; overflow-x:hidden}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 700px at 20% 10%, rgba(47,125,255,.12), transparent 55%),
              radial-gradient(900px 500px at 80% 0%, rgba(30,167,114,.10), transparent 60%),
              radial-gradient(900px 700px at 70% 90%, rgba(255,182,60,.12), transparent 55%),
              var(--bg);
  color:var(--text);
}

a{color:inherit}
.container{max-width:1100px; margin:0 auto; padding:22px}
header{
  display:flex; align-items:center; justify-content:space-between;
  gap:14px; margin-bottom:18px;
}
.header-centered{
  justify-content:center;
  position:relative;
}
.header-spacer{
  width:96px;
  min-width:96px;
}
.header-action{
  position:absolute;
  right:0;
  top:50%;
  transform:translateY(-50%);
}
.brand{
  display:flex; align-items:center; gap:12px;
}
.brand-centered{
  justify-content:center;
  margin:0 auto;
}
.brand-text-centered{
  text-align:center;
}
.logo{
  width:80px; height:80px;
  display:grid; place-items:center;
}
.logo-img{
  width:80px;
  height:80px;
  object-fit:contain;
}
.brand h1{margin:0; font-size:18px; letter-spacing:.2px}
.brand p{margin:2px 0 0; color:var(--muted); font-size:13px}

.grid{
  display:grid;
  grid-template-columns: 1.25fr .75fr;
  gap:16px;
}
@media (max-width: 900px){
  .grid{grid-template-columns:1fr}
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.88));
  border:1px solid rgba(36,48,71,.12);
  border-radius: var(--radius);
  padding:16px;
  box-shadow: 0 10px 30px rgba(36,48,71,.10);
}
.card h2{
  margin:0 0 10px;
  font-size:16px;
}
.admin-section summary{
  cursor:pointer;
  list-style:none;
  display:flex;
  align-items:center;
  gap:8px;
}
.admin-section summary::-webkit-details-marker{display:none}
.admin-section summary::before{
  content:"▸";
  color:var(--muted);
  font-size:14px;
}
.admin-section[open] summary::before{content:"▾"}
.admin-section summary h2{margin:0}
.admin-section > :not(summary){margin-top:10px}
.badge{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(47,125,255,.10);
  border:1px solid rgba(47,125,255,.30);
  box-shadow: var(--glow);
  font-size:12px;
}
.legend-badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 14px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.22);
  font-size:14px;
  font-weight:900;
  letter-spacing:.2px;
  box-shadow: 0 0 20px rgba(86,214,255,.25);
}
.legend-badge--locked{
  background: linear-gradient(135deg, rgba(86,214,255,.18), rgba(255,255,255,.04));
  color: var(--text);
}
.legend-badge--legend{
  background: linear-gradient(135deg, rgba(255,214,107,.26), rgba(255,255,255,.06));
  border-color: rgba(255,214,107,.45);
  color: #7a5000;
  box-shadow: 0 0 20px rgba(255,214,107,.25);
}
.legend-badge--plus{
  background: linear-gradient(135deg, rgba(85,240,165,.22), rgba(86,214,255,.16));
  border-color: rgba(85,240,165,.45);
  color: #0f5e46;
  box-shadow: 0 0 22px rgba(85,240,165,.30);
}
.legend-stars{
  font-size:15px;
  letter-spacing:1px;
}

.row{display:flex; gap:10px; flex-wrap:wrap}
.history-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.history-tab{
  border:1px solid rgba(36,48,71,.16);
  background: rgba(255,255,255,.80);
  color: var(--muted);
  padding:6px 10px;
  border-radius:999px;
  cursor:pointer;
  font-weight:700;
}
.history-tab.active{
  color: var(--text);
  border-color: rgba(47,125,255,.50);
  background: rgba(47,125,255,.16);
  box-shadow: var(--glow);
}
.field{flex:1; min-width:180px}
label{display:block; font-size:12px; color:var(--muted); margin:8px 0 6px}
input, select, textarea{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(36,48,71,.18);
  background: #ffffff;
  color: var(--text);
  outline:none;
}
input:focus, textarea:focus, select:focus{
  border-color: rgba(47,125,255,.55);
  box-shadow: var(--glow);
}
textarea{min-height:84px; resize:vertical}

.btn{
  cursor:pointer;
  border:1px solid rgba(36,48,71,.18);
  background: rgba(47,125,255,.12);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-weight:700;
}
.btn:hover{border-color: rgba(47,125,255,.55); box-shadow: var(--glow)}
.btn.primary{background: rgba(30,167,114,.14); border-color: rgba(30,167,114,.35)}
.btn.danger{background: rgba(216,79,101,.12); border-color: rgba(216,79,101,.35)}
.btn.small{padding:8px 10px; font-size:12px}

.hr{height:1px; background: rgba(36,48,71,.12); margin:12px 0}

.kpi{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
}
@media (max-width: 600px){
  .kpi{grid-template-columns:1fr}
}
.kpi .box{
  padding:12px; border-radius:16px;
  background: rgba(255,255,255,.82);
  border:1px solid rgba(36,48,71,.12);
}
.kpi .val{font-size:20px; font-weight:900}
.kpi .lab{font-size:12px; color:var(--muted)}

.progress{
  margin-top:10px;
  padding:12px;
  border-radius:16px;
  background: rgba(255,255,255,.80);
  border:1px solid rgba(36,48,71,.12);
}
.bar{
  height:14px;
  border-radius:999px;
  background: rgba(36,48,71,.10);
  overflow:hidden;
}
.fill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, rgba(47,125,255,.90), rgba(30,167,114,.90));
  box-shadow: var(--glow);
}
.muted{color:var(--muted); font-size:13px}
.big{font-size:28px; font-weight:1000; letter-spacing:.2px}
.highlight{color:var(--accent); font-weight:900}

.map{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:10px;
  margin-top:12px;
}
.tile{
  padding:12px;
  border-radius:16px;
  border:1px solid rgba(36,48,71,.12);
  background: rgba(255,255,255,.78);
  position:relative;
  overflow:hidden;
}
.tile.locked{opacity:.65}
.tile.unlocked{
  border-color: rgba(85,240,165,.45);
  box-shadow: 0 0 18px rgba(85,240,165,.22);
}
.tile .t{font-weight:900}
.tile .s{font-size:12px; color:var(--muted); margin-top:3px}
.pill{
  position:absolute; top:10px; right:10px;
  font-size:11px; padding:5px 8px; border-radius:999px;
  border:1px solid rgba(36,48,71,.16);
  background: rgba(255,255,255,.92);
}
.pill.good{border-color: rgba(85,240,165,.45); color: var(--good)}
.pill.warn{border-color: rgba(255,214,107,.45); color: var(--warn)}

.list{display:flex; flex-direction:column; gap:10px}
.item{
  padding:12px; border-radius:16px;
  border:1px solid rgba(36,48,71,.12);
  background: rgba(255,255,255,.82);
}
.item strong{display:block}
.item .meta{font-size:12px; color:var(--muted); margin-top:4px}
.item .row{margin-top:10px; justify-content:space-between; align-items:center}

.notice{
  padding:10px 12px; border-radius:16px;
  border:1px dashed rgba(36,48,71,.20);
  background: rgba(255,255,255,.75);
  color: var(--muted);
  font-size:13px;
}

.footer{
  margin-top:14px;
  font-size:12px;
  color: var(--muted);
}
.code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding:2px 6px;
  border-radius:8px;
  border:1px solid rgba(36,48,71,.16);
  background: rgba(255,255,255,.92);
}

@media (max-width: 1024px){
  .container{padding:16px}
  .header-spacer{display:none}
  .header-centered{
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:10px;
    padding-top:4px;
  }
  .header-centered .brand-centered{margin:0}
  .header-centered .brand{
    width:100%;
    justify-content:center;
    text-align:center;
    flex-wrap:wrap;
  }
  .header-centered .header-action{
    position:static;
    transform:none;
    width:100%;
    display:flex;
    justify-content:center;
    gap:8px;
    flex-wrap:wrap;
  }
  .field{min-width:100%}
  .row{gap:8px}
  .map{grid-template-columns: repeat(2, 1fr)}
}

@media (max-width: 640px){
  .container{padding:12px}
  .card{padding:12px}
  .logo,
  .logo-img{width:64px; height:64px}
  .brand h1{font-size:16px}
  .brand p{font-size:12px}
  .btn{width:100%}
  .btn.small{width:auto}
  .map{grid-template-columns:1fr}
  input, select, textarea, .btn{font-size:16px}
}