:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --ink: #16213a;
  --muted: #64748b;
  --border: #e2e8f0;
  --brand-green: #10b981;
  --brand-blue: #0284c7;
  --brand-dark: #151e32;
  --brand-darker: #0b1120;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
}

* { box-sizing: border-box; }

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

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

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Topbar / brand ---------- */
.topbar {
  background: var(--brand-darker);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #1c2740;
}

.brand { display: flex; align-items: center; gap: 14px; }

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-blue) 100%);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(16,185,129,.35);
  flex-shrink: 0;
}
.brand-icon svg { width: 22px; height: 22px; stroke: #fff; stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }

.brand-title { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; }
.brand-title span {
  background: linear-gradient(90deg, #34d399, #38bdf8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.brand-slogan { font-size: 11px; color: #94a3b8; letter-spacing: .3px; margin-top: 3px; }

.topbar-right { display: flex; align-items: center; gap: 16px; font-size: 13px; color: #cbd5e1; }
.topbar-right .badge-perfil {
  background: rgba(16,185,129,.15); color: #34d399; border: 1px solid rgba(16,185,129,.4);
  padding: 3px 10px; border-radius: 999px; font-weight: 600; font-size: 11px;
}
.topbar-right a { color: #cbd5e1; }
.topbar-right a:hover { color: #fff; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 220px; background: var(--brand-dark); color: #e2e8f0; flex-shrink: 0;
  padding: 18px 0; min-height: calc(100vh - 69px);
}
.sidebar a {
  display: block; padding: 10px 22px; color: #cbd5e1; font-size: 14px; font-weight: 500;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: rgba(255,255,255,.05); text-decoration: none; color: #fff; }
.sidebar a.active { border-left-color: var(--brand-green); background: rgba(16,185,129,.08); color: #fff; }
.sidebar .section-title { padding: 16px 22px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #64748b; }

/* ---------- Content ---------- */
.content { flex: 1; padding: 26px 30px; }
.page-title { font-size: 22px; font-weight: 700; margin: 0 0 18px; color: var(--ink); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.card h3 { margin-top: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.kpi { }
.kpi .valor { font-size: 26px; font-weight: 800; color: var(--ink); }
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafbff; }

.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: linear-gradient(90deg, var(--brand-green), var(--brand-blue)); color: #fff; }
.btn-primary:hover { opacity: .92; text-decoration: none; color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand-blue); text-decoration: none; }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

.form-group { margin-bottom: 14px; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 3px rgba(2,132,199,.12); }

.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-danger { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill-ok { background: #ecfdf5; color: #047857; }
.pill-warn { background: #fffbeb; color: #92400e; }
.pill-off { background: #f1f5f9; color: #64748b; }

.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--brand-darker);
}
.login-card {
  background: var(--brand-dark); border: 1px solid #23304d; border-radius: 20px; padding: 36px 40px;
  width: 380px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.6); color: #e2e8f0;
}

.empresa-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 20px;
  cursor: pointer; transition: box-shadow .15s, border-color .15s;
}
.empresa-card:hover { border-color: var(--brand-blue); box-shadow: 0 4px 14px rgba(2,132,199,.12); }
