/* =========================================================
   THEME TOKENS (CSS Variables)
   - Default: Dark
   - Light: [data-theme="light"]
========================================================= */

:root {
  --bg: #0b1020;
  --card: rgba(18, 26, 51, .82);
  --text: #e7eaf3;
  --muted: #aeb6d6;
  --border: rgba(255, 255, 255, .12);
  --shadow: 0 18px 45px rgba(0, 0, 0, .32);
  --radius: 14px;

  --grad1: rgba(115, 102, 255, .28);
  --grad2: rgba(0, 204, 255, .18);

  /* Brand */
  --primary1: #7366ff;
  --primary2: #4f46e5;

  /* Status / accents */
  --pending: rgba(255, 184, 0, .22);
  --active: rgba(0, 210, 140, .20);
  --completed: rgba(90, 160, 255, .18);

  --dangerBg: rgba(255, 0, 90, .14);
  --dangerBd: rgba(255, 0, 90, .28);
  --dangerBgHover: rgba(255, 0, 90, .20);

  /* UI surfaces */
  --btnBg: rgba(255, 255, 255, .07);
  --btnBgHover: rgba(255, 255, 255, .12);
}

[data-theme="light"] {
  /* Light theme with more “personality” */
  --bg: #eef2ff;
  --card: rgba(255, 255, 255, .86);
  --text: #0b1220;
  --muted: #334155;
  --border: rgba(15, 23, 42, .10);
  --shadow: 0 20px 55px rgba(15, 23, 42, .12);

  --grad1: rgba(167, 139, 250, .30);
  --grad2: rgba(56, 189, 248, .18);

  --primary1: #4f46e5;
  --primary2: #4338ca;

  --pending: rgba(245, 158, 11, .20);
  --active: rgba(16, 185, 129, .18);
  --completed: rgba(59, 130, 246, .16);

  --dangerBg: rgba(255, 0, 90, .12);
  --dangerBd: rgba(255, 0, 90, .22);
  --dangerBgHover: rgba(255, 0, 90, .18);

  --btnBg: rgba(255, 255, 255, .72);
  --btnBgHover: rgba(255, 255, 255, .95);
}

/* =========================================================
   BASE
========================================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1100px 700px at 15% -15%, var(--grad1), transparent 60%),
    radial-gradient(1000px 800px at 95% 5%, var(--grad2), transparent 62%),
    var(--bg);
  color: var(--text);
  transition: background .25s ease, color .25s ease;
}

a {
  color: inherit;
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 18px 0 50px;
}

/* =========================================================
   NAV
========================================================= */

.nav{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content: space-between;
  padding: 0;
  min-height: 74px; /* evita saltos al alternar tema */
}

.nav .links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Dark nav (glass card) */
:root:not([data-theme="light"]) .nav {
  background: rgba(0, 0, 0, .10);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  backdrop-filter: blur(10px);
}

/* Light nav (glass card) */
[data-theme="light"] .nav{
  background: rgba(255,255,255,.30);
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 18px;
  padding: 10px 14px;
  box-shadow: 0 10px 28px rgba(15,23,42,.10);
  backdrop-filter: blur(10px);
}

/* =========================================================
   CARDS / GRID
========================================================= */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.card-pad {
  padding: 16px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 16px;
}

@media (min-width: 860px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

hr.sep {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 14px 0 16px;
}

/* =========================================================
   BUTTONS
========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--btnBg);
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  transition: transform .06s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
  color: var(--text);
  font: inherit;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}

.btn,
.btn:hover {
  text-decoration: none;
}

.btn:hover {
  background: var(--btnBgHover);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0px);
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(90deg, var(--primary1), var(--primary2));
  border-color: rgba(255, 255, 255, .10);
}

[data-theme="light"] .btn-primary {
  border-color: rgba(15, 23, 42, .10);
}

.btn-secondary {
  background: transparent;
  border-color: var(--border);
}

/* Danger: Archivar should ALWAYS stand out */
.btn-danger {
  background: var(--dangerBg);
  border-color: var(--dangerBd);
}

.btn-danger:hover {
  background: var(--dangerBgHover);
}

/* =========================================================
   STATUS BUTTONS (pending / active / completed)
========================================================= */

.btn-status-pending {
  border-color: rgba(255, 184, 0, .35);
  background: rgba(255, 184, 0, .10);
}

.btn-status-pending:hover {
  background: rgba(255, 184, 0, .16);
}

.btn-status-active {
  border-color: rgba(0, 210, 140, .35);
  background: rgba(0, 210, 140, .10);
}

.btn-status-active:hover {
  background: rgba(0, 210, 140, .16);
}

.btn-status-completed {
  border-color: rgba(90, 160, 255, .35);
  background: rgba(90, 160, 255, .10);
}

.btn-status-completed:hover {
  background: rgba(90, 160, 255, .16);
}

/* Slight pill look for nav buttons (optional but nice) */
.nav .btn {
  padding: 9px 12px;
  border-radius: 999px;
  border-color: var(--border);
  font-size: 12px;
  color: var(--text);
}

/* =========================================================
   BADGES (Status pills)
========================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, .06);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .6);
}

.badge--pending {
  background: var(--pending);
}

.badge--pending .badge-dot {
  background: rgba(255, 184, 0, .9);
}

.badge--active {
  background: var(--active);
}

.badge--active .badge-dot {
  background: rgba(0, 210, 140, .9);
}

.badge--completed {
  background: var(--completed);
}

.badge--completed .badge-dot {
  background: rgba(90, 160, 255, .95);
}

.badge--archived {
  background: rgba(255, 255, 255, .07);
}

.badge--archived .badge-dot {
  background: rgba(255, 255, 255, .65);
}

[data-theme="light"] .badge {
  background: rgba(255, 255, 255, .80);
  border-color: rgba(15, 23, 42, .10);
}

/* =========================================================
   FORMS
========================================================= */

label {
  display: block;
  font-size: 14px;
  margin: 10px 0 6px;
  color: var(--muted);
}

input[type="text"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  outline: none;
  transition: border-color .12s ease, background .12s ease;
}

[data-theme="light"] input[type="text"],
[data-theme="light"] textarea,
[data-theme="light"] select {
  background: rgba(255, 255, 255, .85);
  color: var(--text);
  border-color: rgba(15, 23, 42, .10);
}

input[type="text"]:focus,
textarea:focus {
  border-color: rgba(115, 102, 255, .55);
  background: rgba(255, 255, 255, .07);
}

[data-theme="light"] input[type="text"]:focus,
[data-theme="light"] textarea:focus {
  border-color: rgba(79, 70, 229, .55);
  background: rgba(255, 255, 255, .95);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

/* =========================================================
   BRAND / HEADER
========================================================= */

.brand-link{
  display:flex;
  align-items:center;
  text-decoration:none;
  line-height: 1;
}

.logo{
  height: 120px;
  width: auto;
  display:block;
  margin-top: -10px;
  margin-bottom: -10px;
}

@media (max-width: 520px){
  .logo{
    height: 100px;
    margin-top: -6px;
    margin-bottom: -6px;
  }
}


/* =========================================================
   TOGGLE ICON BUTTON
========================================================= */

.icon-toggle{
  width: 42px;
  height: 42px;
  border-radius: 999px;

  /* antes: border: 1px solid transparent; */
  border: 1px solid var(--border);

  background: rgba(255,255,255,.10);
  color: var(--text);
  cursor: pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  transition: transform .12s ease, background .12s ease, border-color .12s ease;
}

/* Fallback: si el toggle NO está usando .icon-toggle y se ve cuadrado */
#themeToggle,
#theme-toggle,
.toggle-theme,
.theme-toggle,
.nav .theme-toggle,
.nav #themeToggle,
.nav #theme-toggle{
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.10);
  color: var(--text);
}

/* Si el toggle también tiene .btn, esto lo “des-cuadra” */
#themeToggle.btn,
#theme-toggle.btn,
.toggle-theme.btn,
.theme-toggle.btn{
  padding: 0;
  border-radius: 999px;
}


.icon-btn{
  width: 42px;
  height: 42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  border: 1px solid var(--border);

  /* Glass fijo, no dependiente de --btnBg */
  background: rgba(255,255,255,.10);

  cursor:pointer;
  transition: transform .06s ease, background .12s ease, border-color .12s ease;
}

.icon-btn:hover{
  background: rgba(255,255,255,.16);
  transform: translateY(-1px);
}

.icon-btn:active{
  transform: translateY(0px);
}

/* Light mode: glass claro, NO blanco sólido */
[data-theme="light"] .icon-btn{
  background: rgba(255,255,255,.55);
  border-color: rgba(15,23,42,.10);
}

[data-theme="light"] .icon-btn:hover{
  background: rgba(255,255,255,.75);
}


/* =========================================================
   SMALL UTILITIES
========================================================= */

h1,
h2,
h3 {
  margin: 0 0 10px;
}

p {
  margin: 0 0 10px;
}

small {
  color: var(--muted);
}

.flex {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gap8 {
  gap: 8px;
}

.mt10 {
  margin-top: 10px;
}

.mt16 {
  margin-top: 16px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  margin-left: 8px;
  border: 1px solid transparent;
}

.status-pill-active {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.45);
}

.status-pill-inactive {
  background: rgba(255, 0, 90, 0.12);
  border-color: rgba(255, 0, 90, 0.35);
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.audit-table th,
.audit-table td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  font-size: 13px;
  color: var(--muted);
}

.audit-table td {
  font-size: 14px;
}

/* Form readability in dark/light */
input,
select,
textarea {
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(115, 102, 255, 0.35);
  outline-offset: 1px;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px rgba(20, 30, 60, 0.88) inset;
  transition: background-color 9999s ease-in-out 0s;
}

/* Better audit table readability */
.audit-table {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.audit-table thead tr {
  background: rgba(255, 255, 255, 0.05);
}

.audit-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.audit-table td:nth-child(1) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.audit-table td:nth-child(2) {
  font-weight: 600;
}

.audit-table th {
  white-space: nowrap;
}

.audit-table td,
.audit-table th {
  line-height: 1.35;
}

/* =========================================================
   ERROR / INFO PAGES
