:root{
  --bg:#070a12;
  --panel:#0b1220;
  --panel2:#0f172a;
  --text:#e5e7eb;
  --muted:#94a3b8;
  --line:rgba(148,163,184,.22);
  --primary:#6366f1;
  --primary2:#8b5cf6;
  --ok:#22c55e;
  --err:#ef4444;
  --warn:#f59e0b;
  --radius:16px;
  --shadow: 0 10px 30px rgba(0,0,0,.40);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 20% -10%, rgba(99,102,241,.25), transparent 60%),
              radial-gradient(1000px 600px at 100% 0%, rgba(139,92,246,.18), transparent 55%),
              var(--bg);
  color:var(--text);
}

.app-shell{max-width:1200px;margin:0 auto;padding:18px}
.topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 16px;border:1px solid var(--line);
  background: linear-gradient(180deg, rgba(15,23,42,.92), rgba(11,18,32,.92));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.brand{display:flex;gap:12px;align-items:center}
.brand__mark{
  width:36px;height:36px;border-radius:12px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 10px 25px rgba(99,102,241,.22);
}
.brand__title{font-weight:750;letter-spacing:.2px}
.brand__sub{color:var(--muted);font-size:12px;margin-top:2px}
.topbar__actions{display:flex;gap:10px;align-items:center}

.card{
  margin-top:14px;
  border:1px solid var(--line);
  background: linear-gradient(180deg, rgba(15,23,42,.80), rgba(11,18,32,.85));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:18px;
}

.h1{font-size:22px;margin:0 0 12px;font-weight:800}
.h2{font-size:14px;margin:14px 0 10px;font-weight:750;color:#cbd5e1}
.muted{color:var(--muted);font-size:13px}
.hint{
  margin-top:14px;
  padding:10px 12px;
  border:1px dashed rgba(148,163,184,.35);
  border-radius: 12px;
  color:var(--muted);
  font-size:12.5px;
  background: rgba(2,6,23,.35);
}

.grid2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
@media (max-width: 980px){ .grid2{grid-template-columns:1fr} }

.panel{
  border:1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding:14px;
  background: rgba(2,6,23,.30);
}

.list{margin:0;padding-left:18px;color:#cbd5e1}
.list li{margin:6px 0}

.form{display:flex;flex-direction:column;gap:10px}
.field{display:flex;flex-direction:column;gap:6px}
.field span{font-size:13px;color:#cbd5e1}
.field input{
  height:42px;border-radius:12px;border:1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.55); color: var(--text);
  padding:0 12px;font-size:14px; outline:none;
}
.field input:focus{border-color: rgba(99,102,241,.7); box-shadow: 0 0 0 4px rgba(99,102,241,.12);}

.row{display:flex;gap:10px;align-items:center;margin-top:4px;flex-wrap:wrap}
.btn{
  height:42px;padding:0 14px;border-radius:12px;border:1px solid rgba(148,163,184,.25);
  background: rgba(2,6,23,.40); color: var(--text);
  cursor:pointer; font-weight:650;
}
.btn:hover{border-color: rgba(148,163,184,.45)}
.btn.primary{
  border-color: rgba(99,102,241,.55);
  background: linear-gradient(135deg, rgba(99,102,241,.9), rgba(139,92,246,.82));
}
.btn.primary:hover{filter: brightness(1.05)}

.status{margin-top:8px;font-size:13px;color:var(--muted)}
.status.busy{color:#cbd5e1}
.status.ok{color:var(--ok)}
.status.err{color:var(--err)}

.footer{
  margin-top:12px;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 8px;
}

/* Viewer */
.viewer-head{
  display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;
  margin-bottom:12px;
}
.viewer-nav{display:flex;gap:10px;align-items:center}
.pill{
  padding:10px 12px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.35);
  font-weight:750;
  color:#cbd5e1;
}

.viewer{
  display:grid;
  grid-template-columns: 1.6fr .9fr;
  gap: 14px;
}
@media (max-width: 980px){ .viewer{grid-template-columns:1fr} }

.viewer__canvasWrap{
  border:1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding: 12px;
  background: rgba(2,6,23,.30);
}
#sheetCanvas{
  width:100%;
  height:auto;
  display:block;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.18);
}
.viewer__meta{
  margin-top:10px;
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.35);
}
.meta-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
}
.meta-grid .k{display:block;color:var(--muted);font-size:12px}
.meta-grid .v{display:block;font-weight:800;color:#e2e8f0;margin-top:2px}

.viewer__list{
  border:1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding: 10px;
  background: rgba(2,6,23,.30);
  max-height: 640px;
  overflow:auto;
}
.thumb{
  width:100%;
  text-align:left;
  padding:10px 10px;
  border-radius: 12px;
  border:1px solid rgba(148,163,184,.14);
  background: rgba(15,23,42,.35);
  color: var(--text);
  cursor:pointer;
  margin-bottom:10px;
}
.thumb:hover{border-color: rgba(148,163,184,.35)}
.thumb.is-active{
  border-color: rgba(99,102,241,.55);
  box-shadow: 0 0 0 4px rgba(99,102,241,.10);
}
.thumb__title{font-weight:850}
.thumb__sub{font-size:12px;color:var(--muted);margin-top:2px}
.thumb__chips{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.chip{
  font-size:11px;
  color:#cbd5e1;
  padding:4px 8px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.18);
  background: rgba(2,6,23,.35);
}

.grid3{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
@media (max-width: 980px){ .grid3{grid-template-columns:1fr} }

.field--toggle .toggle{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;border-radius:12px;
  border:1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.35);
}
.field--toggle input[type="checkbox"]{width:18px;height:18px}

.charts-row{
  display:grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin: 14px 0;
}
@media (max-width: 980px){ .charts-row{grid-template-columns:1fr} }

.chart-card{
  border:1px solid rgba(148,163,184,.18);
  border-radius: 14px;
  padding: 12px;
  background: rgba(2,6,23,.30);
}
.chart-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
  flex-wrap:wrap;
}
.chart-title{font-weight:850;color:#e2e8f0}
.chart-tabs{display:flex;gap:8px;flex-wrap:wrap}

.chipBtn{
  height:32px;
  padding:0 10px;
  border-radius:999px;
  border:1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.35);
  color:#cbd5e1;
  cursor:pointer;
  font-weight:750;
  font-size:12px;
}
.chipBtn:hover{border-color: rgba(148,163,184,.45)}
.chipBtn.is-active{
  border-color: rgba(99,102,241,.55);
  box-shadow: 0 0 0 4px rgba(99,102,241,.10);
}

