:root{
  --bg-start: #071022;
  --bg-end: #071426;
  --card-bg-a: rgba(255,255,255,0.02);
  --card-bg-b: rgba(255,255,255,0.01);
  --accent: #7c3aed;
  --accent-2: #06b6d4;
  --muted: rgba(230,238,248,0.75);
  --glass: rgba(255,255,255,0.03);
  --glass-2: rgba(255,255,255,0.02);
  --text: #e6eef8;
  --border-subtle: rgba(255,255,255,0.03);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 60%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.header-row a { color: var(--muted); text-decoration: none; }

h1 { margin: 8px 0 0 0; font-size: 20px; }
.subtitle { color: var(--muted); font-size: 13px; margin-top: 6px; }
.meta { color: var(--muted); font-size: 14px; margin-bottom: 12px; }

.card {
  background: linear-gradient(180deg, var(--card-bg-a), var(--card-bg-b));
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  border: 1px solid var(--border-subtle);
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 18px;
  align-items: start;
}

.pie-wrap {
  width: 360px;
  height: 360px;
  min-width: 240px;
  min-height: 240px;
  padding: 12px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pie-wrap canvas { width: 100% !important; height: 100% !important; }

.side {
  width: 320px;
  max-width: 42%;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.totals-card {
  padding: 12px;
  border-radius: 10px;
  background: var(--glass);
  border: 1px solid var(--border-subtle);
  text-align: left;
}
.total-global { font-size: 28px; font-weight: 700; }

.list-parties {
  margin: 10px 0 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.party-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  background: var(--glass-2);
  border: 1px solid rgba(255,255,255,0.02);
}
.swatch { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 14px; }
.party-name { flex: 1; font-weight: 600; color: #fff; }
.party-stats { color: var(--muted); font-size: 14px; min-width: 90px; text-align: right; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
table th, table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  text-align: left;
  font-size: 14px;
}
table thead th {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}

.actions { display:flex; gap:8px; justify-content:flex-end; margin-top:12px; }
.btn {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--muted);
}

label { font-size: 14px; color: var(--muted); display: block; margin-bottom: 6px; }
input[type="text"],
input[type="number"],
input[type="password"] {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  color: #fff;
  width: 100%;
}

.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.footer-note { font-size: 12px; color: rgba(230,238,248,0.6); margin-top: 12px; text-align: center; }

@media (max-width: 920px) {
  .card { flex-direction: column; padding: 14px; }
  .side { width: 100%; max-width: 100%; }
  .pie-wrap { width: 320px; height: 320px; }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .pie-wrap { width: 260px; height: 260px; }
  body { padding: 12px; }
  h1 { font-size: 18px; }
}

.legend-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.legend-item {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
