/* Identidad Silvestre — paneles de gestión */
:root {
  --bg: #f8f5f0;
  --surface: #fffdf9;
  --text: #1f1a17;
  --muted: #6f655e;
  --line: rgba(31, 26, 23, 0.12);
  --accent: #b39b7c;
  --accent-dark: #8e775c;
  --gold-rich: #c9a227;
  --danger: #8b3a2f;
  --ok: #3d6b4f;
  --sidebar: 260px;
  --radius: 14px;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --shadow: 0 10px 28px rgba(25, 20, 16, 0.07);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(201, 162, 39, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(179, 155, 124, 0.16), transparent 50%),
    var(--bg);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: var(--accent-dark);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold-rich);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  padding: 0.5rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.auth-brand img {
  width: min(200px, 70%);
  height: auto;
  object-fit: contain;
}

.auth-brand h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.75rem;
  margin: 0;
}

.auth-brand p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.form-stack {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

input[type="email"],
input[type="password"],
input[type="text"],
select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 560;
  cursor: pointer;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
}

.btn:hover {
  filter: brightness(0.97);
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.btn--block {
  width: 100%;
}

.alert {
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.alert--ok {
  background: rgba(61, 107, 79, 0.1);
  color: var(--ok);
  border: 1px solid rgba(61, 107, 79, 0.25);
}

.alert--error {
  background: rgba(139, 58, 47, 0.08);
  color: var(--danger);
  border: 1px solid rgba(139, 58, 47, 0.25);
}

.alert--dev {
  background: rgba(201, 162, 39, 0.12);
  color: #5a4a12;
  border: 1px solid rgba(201, 162, 39, 0.35);
  word-break: break-all;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-links {
  margin-top: 1.25rem;
  display: grid;
  gap: 0.5rem;
  text-align: center;
  font-size: 0.9rem;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: var(--sidebar) 1fr;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.sidebar__brand img {
  width: 96px;
  height: auto;
}

.sidebar__meta {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 0.5rem;
}

.sidebar nav {
  display: grid;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: block;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.nav-link:hover {
  background: rgba(179, 155, 124, 0.12);
}

.nav-link.is-active {
  background: rgba(179, 155, 124, 0.2);
  font-weight: 600;
}

.sidebar__footer {
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}

.main {
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 2.5rem;
  min-width: 0;
}

.topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  margin: 0 0 0.35rem;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

.wedding-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.9);
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.panel + .panel {
  margin-top: 1rem;
}

.panel h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.85rem;
}

.stat {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.stat__label {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat__value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-top: 0.2rem;
}

.empty-state {
  padding: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  color: var(--muted);
  font-weight: 560;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mobile-nav {
  display: none;
}

.mobile-nav__toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  font: inherit;
  cursor: pointer;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(var(--sidebar), 88vw);
    z-index: 40;
    height: 100%;
    box-shadow: var(--shadow);
  }

  .sidebar.is-open {
    display: flex;
  }

  .topbar {
    display: flex;
  }

  .mobile-nav {
    display: block;
  }

  .backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(31, 26, 23, 0.35);
    z-index: 30;
  }

  .backdrop.is-open {
    display: block;
  }
}

textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  color: var(--text);
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.section-tabs a {
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.88rem;
  color: var(--text);
}

.section-tabs a:hover {
  border-color: var(--accent);
}

.subhead {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  margin: 1rem 0 0.5rem;
}

.event-list {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 1rem;
}

.event-list--readonly li {
  margin-bottom: 0.5rem;
}

.event-edit {
  margin-bottom: 0.5rem;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination__disabled {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.panel + .panel,
section.panel + section.panel {
  margin-top: 1rem;
}

.ai-panel {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  max-width: min(360px, calc(100vw - 2rem));
}

.ai-panel__toggle {
  border: 1px solid var(--line);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.ai-panel__drawer {
  margin-top: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.65rem;
}

.ai-panel__intro,
.ai-panel__label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.ai-panel__input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  resize: vertical;
}

.ai-panel__out {
  font-size: 0.92rem;
  white-space: pre-wrap;
  min-height: 1.2em;
}

.ai-panel__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.ai-panel__btn-link {
  font-size: 0.85rem;
  color: var(--ink);
  text-decoration: underline;
}
