:root {
  --bg: #0f1520;
  --bg-panel: #161d2b;
  --bg-elevated: #1d2536;
  --border: #2a3448;
  --text: #e8ecf3;
  --text-dim: #9aa5b8;
  --accent: #4f8cff;
  --accent-dim: #2c5cc7;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --green: #35c48f;
  --amber: #e0a634;
  --red: #e0566f;
  --radius: 8px;
  --shadow: 0 8px 24px rgba(0,0,0,0.35);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

/* ---------------- HEADER / NAV ---------------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(135deg, #142033, #0f1520);
  border-bottom: 1px solid var(--border);
}
.app-header__brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  letter-spacing: .2px;
}
.app-header__brand:hover { text-decoration: none; color: var(--accent); }
.app-nav { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.app-nav__user { color: var(--text-dim); }

/* ---------------- LAYOUT ---------------- */
.app-main { max-width: 960px; margin: 0 auto; padding: 28px 20px 60px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header h1 { margin: 0 0 4px; font-size: 20px; }
.page-header__desc { margin: 0; color: var(--text-dim); font-size: 13px; }

/* ---------------- FLASH MESSAGES ---------------- */
.flashes { margin-bottom: 18px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 13px;
  background: var(--bg-elevated);
}
.flash-error { border-color: var(--red); color: var(--red); }
.flash-ok { border-color: var(--green); color: var(--green); }
.flash-warning { border-color: var(--amber); color: var(--amber); }

/* ---------------- BOTONES ---------------- */
.btn {
  border: none;
  border-radius: 7px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: transform .05s ease, opacity .15s ease, background .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dim); text-decoration: none; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-block { width: 100%; }

.link-danger {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}
.link-danger:hover { text-decoration: underline; }
.inline-form { display: inline; margin-left: 12px; }

/* ---------------- FORMULARIOS ---------------- */
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12.5px; color: var(--text-dim); font-weight: 600; }
.field-checkbox { flex-direction: row; align-items: center; gap: 8px; }
.field-checkbox label { font-weight: 400; color: var(--text); }
.hint { font-size: 11.5px; color: var(--text-dim); font-weight: 400; }

.input, select.input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 13.5px;
  width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); }
.field-error { color: var(--red); font-size: 12px; }

.form-card, .auth-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
}
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

/* ---------------- LOGIN ---------------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card { width: 340px; box-shadow: var(--shadow); }
.auth-card__title { margin: 0 0 4px; font-size: 18px; text-align: center; }
.auth-card__subtitle { margin: 0 0 20px; text-align: center; color: var(--text-dim); font-size: 12.5px; }

/* ---------------- HOME ---------------- */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.home-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
}
.home-card:hover { border-color: var(--accent); text-decoration: none; }
.home-card h2 { margin: 0 0 6px; font-size: 16px; }
.home-card p { margin: 0; color: var(--text-dim); font-size: 12.5px; }

/* ---------------- TABLAS ---------------- */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
}
table.data-table { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
table.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.row-actions { white-space: nowrap; }
.empty-row { text-align: center; color: var(--text-dim); padding: 24px 0; }

.badge { padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-ok { background: rgba(53,196,143,0.15); color: var(--green); }
.badge-off { background: rgba(224,86,111,0.15); color: var(--red); }
