:root {
  --bg: #0b0f14;
  --bg-elev: #121821;
  --bg-soft: #182030;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef2f7;
  --muted: #93a0b4;
  --accent: #d4a017;
  --accent-soft: rgba(212, 160, 23, 0.16);
  --ok: #3dcf8e;
  --danger: #ff6b6b;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(212, 160, 23, 0.12), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(60, 110, 180, 0.14), transparent 50%),
    var(--bg);
  color: var(--text);
}

body {
  min-height: 100dvh;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.nav-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.nav-tab {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
}

.nav-tab.active {
  background: var(--accent);
  color: #111;
  border-color: transparent;
}

.petition-form label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.petition-form input,
.petition-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font: inherit;
  font-size: 16px;
}

.petition-form textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.45;
}

.petition-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: #000;
}

.sig-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sig-list {
  display: grid;
  gap: 8px;
}

.sig-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--bg-soft);
  font-size: 0.9rem;
}

.sig-card strong {
  display: block;
  margin-bottom: 4px;
}

.sig-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

#login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 400px);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  background: #000;
}

.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 0.95rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 6px;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  outline: none;
}

input:focus {
  border-color: rgba(212, 160, 23, 0.55);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--accent);
  color: #111;
  font-weight: 650;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-block {
  width: 100%;
}

.error {
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.2em;
  margin: 0 0 10px;
}

#app-view {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-top: 8px;
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.period {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 14px;
  white-space: nowrap;
  cursor: pointer;
}

.chip.active {
  color: #111;
  background: var(--accent);
  border-color: transparent;
  font-weight: 650;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.card.span-2 {
  grid-column: span 2;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.metric-value {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.metric-hint {
  margin-top: 6px;
  color: var(--ok);
  font-size: 0.8rem;
}

.section-title {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.bar {
  width: 100%;
  max-width: 36px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #f0c14b, var(--accent));
  min-height: 4px;
}

.bar-label {
  font-size: 0.7rem;
  color: var(--muted);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.list li:last-child {
  border-bottom: 0;
}

.list .path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.list .count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.status-line {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  z-index: 20;
  box-shadow: var(--shadow);
}

@media (min-width: 720px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .card.span-2 {
    grid-column: span 2;
  }

  .card.span-4 {
    grid-column: span 4;
  }
}

@media (max-width: 719px) {
  .card.span-4 {
    grid-column: span 2;
  }
}
