:root {
  --bg: #0F0B1E;
  --surface: #1D1836;
  --surface-2: #241D47;
  --border: rgba(255,255,255,0.09);
  --border-strong: rgba(255,255,255,0.16);
  --text: #F5F3FF;
  --text-secondary: #B4A9DA;
  --text-muted: #7C74A3;
  --violet: #8B5CF6;
  --pink: #EC4899;
  --amber: #F59E0B;
  --accent: #A78BFA;
  --accent-bg: rgba(167,139,250,0.14);
  --success: #2DD4BF;
  --success-bg: rgba(45,212,191,0.15);
  --danger: #FB7185;
  --danger-bg: rgba(251,113,133,0.15);
  --grad: linear-gradient(135deg, #7C3AED 0%, #EC4899 55%, #F59E0B 100%);
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 15% 0%, #241a45 0%, var(--bg) 45%), var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

.topbar {
  background: rgba(29,24,54,0.7);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.brand { font-weight: 800; color: var(--text); display: flex; align-items: center; gap: 9px; letter-spacing: -0.2px; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 26px; height: 26px; border-radius: 8px; background: var(--grad); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-logo svg { width: 14px; height: 14px; }
.topbar-inner nav { display: flex; gap: 1.25rem; flex: 1; }
.topbar-inner nav a { color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.topbar-inner nav a:hover { color: var(--text); text-decoration: none; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-secondary); }

h1 { font-size: 21px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.3px; }
h2 { font-size: 16px; font-weight: 700; }
.section-title { font-size: 13px; font-weight: 700; margin: 0 0 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .3px; }
.muted { color: var(--text-secondary); }
.small { font-size: 12px; }
.hint { font-size: 12px; color: var(--text-muted); margin: -6px 0 4px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }

label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; margin-top: 10px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); }
textarea { resize: vertical; }
.checkbox-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.checkbox-inline input { width: auto; }

button, .btn-primary, .btn-secondary {
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  padding: 9px 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
}
button:hover, .btn-secondary:hover { border-color: var(--border-strong); }
.btn-primary {
  background: var(--grad);
  color: #fff;
  border: none;
  box-shadow: 0 6px 18px -6px rgba(139,92,246,0.55);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-secondary { background: rgba(255,255,255,0.05); }
.btn-block { width: 100%; margin-top: 14px; }
.btn-link { background: none; border: none; color: var(--accent); padding: 0; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }
.icon-btn { background: none; border: none; color: var(--text-muted); font-size: 12px; cursor: pointer; }

.hidden { display: none; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
}

/* Auth / login */
.auth-wrap { display: flex; justify-content: center; padding: 2rem 0; }
.login-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  max-width: 820px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 420px;
}
.login-hero {
  background: var(--grad);
  padding: 2.25rem 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-hero::before { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: rgba(255,255,255,0.14); top: -100px; right: -80px; }
.login-hero::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,0.10); bottom: -70px; left: -50px; }
.login-mark { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 16px; color: #fff; position: relative; z-index: 1; }
.login-mark .brand-logo { background: rgba(255,255,255,0.22); }
.login-pitch { position: relative; z-index: 1; }
.login-pitch h1 { color: #fff; font-size: 24px; max-width: 320px; margin-bottom: 10px; }
.login-pitch p { color: rgba(255,255,255,0.85); font-size: 13.5px; max-width: 300px; margin: 0; }
.login-foot { color: rgba(255,255,255,0.7); font-size: 12px; position: relative; z-index: 1; margin: 0; }
.login-form-side { background: var(--surface); padding: 2.25rem 2.25rem; display: flex; flex-direction: column; justify-content: center; }
.login-form-side form { text-align: left; }

.tabs { display: flex; background: rgba(255,255,255,0.04); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px; overflow: hidden; margin: 0 0 1.25rem; }
.tab { flex: 1; text-align: center; padding: 8px 0; font-size: 13px; color: var(--text-secondary); font-weight: 700; border-radius: 8px; }
.tab.active { background: var(--grad); color: #fff; }
.tab:hover { text-decoration: none; }

.alert { padding: 9px 12px; border-radius: var(--radius); font-size: 13px; margin-bottom: 10px; font-weight: 600; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.25rem; gap: 1rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.1rem 1.25rem; color: var(--text); display: block; position: relative; overflow: hidden; }
.project-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--grad); }
.project-card:hover { border-color: var(--border-strong); text-decoration: none; }
.project-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.project-name { font-weight: 700; font-size: 15px; margin: 0; }

.badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; letter-spacing: .2px; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: rgba(124,116,163,0.18); color: var(--text-secondary); }

/* Circular progress ring (proyectos.html) */
.ring-row { display: flex; align-items: center; gap: 14px; margin: 14px 0 8px; }
.ring { width: 52px; height: 52px; border-radius: 50%; position: relative; flex-shrink: 0; --ring-color: var(--pink); }
.ring.ring-over { --ring-color: var(--danger); }
.ring-inner { position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.ring-figures .amt { font-size: 16px; font-weight: 800; margin: 0; }
.ring-figures .of { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }

.progress-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin: 12px 0 4px; }
.progress-bar { height: 7px; background: rgba(255,255,255,0.06); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grad); border-radius: 999px; }
.progress-fill.over { background: var(--danger); }

.metrics-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin: 1.25rem 0; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1rem 1.1rem; }
.metric-card.metric-success { background: var(--grad); border: none; }
.metric-card.metric-danger { background: rgba(251,113,133,0.1); border: 1px solid rgba(251,113,133,0.35); }
.metric-label { font-size: 12px; color: var(--text-secondary); margin: 0 0 4px; font-weight: 600; }
.metric-value { font-size: 21px; font-weight: 800; margin: 0; }
.metric-card.metric-success .metric-value, .metric-card.metric-success .metric-label { color: #fff; }
.metric-card.metric-danger .metric-value, .metric-card.metric-danger .metric-label { color: var(--danger); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
tr:last-child td { border-bottom: none; }
td.right, th.right { text-align: right; }
.row-cancelado { opacity: 0.5; text-decoration: line-through; }
.gasto-edit-row td { white-space: normal; background: rgba(255,255,255,0.03); padding: 1rem 1.25rem; }
.gasto-edit-row form { max-width: 480px; }

.filters-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1.25rem; align-items: center; }
.filters-bar select, .filters-bar input { width: auto; }

.bar-row { margin-bottom: 12px; }
.bar-row-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar-row-simple { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px solid var(--border); }

.empty-state { text-align: center; padding: 2rem; color: var(--text-secondary); background: var(--surface); border: 1px dashed var(--border); border-radius: 16px; margin-bottom: 1.5rem; }

.simple-list { list-style: none; padding: 0; margin: 0 0 10px; }
.simple-list li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr; }
  .topbar-inner nav { gap: 0.75rem; }
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { padding: 1.75rem; }
}
