:root {
  --bg: #0e0f13;
  --panel: #16181f;
  --border: #262a35;
  --text: #e8e9ed;
  --muted: #8b909c;
  --accent-a: #7c5cff;
  --accent-b: #22d3ee;
  --danger: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-accent { border-color: rgba(124, 92, 255, 0.5); }
.card-label { font-size: 12px; color: var(--muted); }
.card-value { font-size: 24px; font-weight: 600; }
.card-sub { font-size: 11px; color: var(--muted); }
.card-wide { grid-column: 1 / -1; }

.igic-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; }
.progress-bar { background: #23262f; border-radius: 999px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-a), var(--accent-b)); width: 0%; transition: width .3s; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-header h2 { font-size: 14px; margin: 0; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 4px; border-bottom: 1px solid var(--border); }
td { padding: 8px 4px; border-bottom: 1px solid #1c1f28; }
tr:last-child td { border-bottom: none; }

.ayudas-list { display: flex; flex-direction: column; gap: 10px; }
.ayuda-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ayuda-item .nombre { font-weight: 600; font-size: 14px; }
.ayuda-item .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; margin-left: 6px; }
.badge-abierta { background: rgba(34, 211, 238, .15); color: var(--accent-b); }
.badge-proxima { background: rgba(124, 92, 255, .15); color: var(--accent-a); }

.btn {
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  color: #0b0c10;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 0;
  width: min(420px, 90vw);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
.form-dialog { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.form-dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form-dialog input {
  background: #0e0f13;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  color: var(--text);
  font-size: 14px;
}
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.login-box {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 12px;
  width: min(320px, 90vw);
}
.login-error { color: var(--danger); font-size: 12px; margin: 0; }
