/* 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: 200px;
  --radius: 10px;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --shadow: 0 4px 14px rgba(25, 20, 16, 0.05);
}

*,
*::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.35rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  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: 0.85rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

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

.sidebar__meta {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0 0.4rem;
  line-height: 1.3;
}

.sidebar nav {
  display: grid;
  gap: 0.15rem;
  flex: 1;
  align-content: start;
  align-items: stretch;
}

.nav-link {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.86rem;
  line-height: 1.25;
}

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

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

.chart-box {
  position: relative;
  width: 100%;
  max-width: none;
  height: 168px;
  margin: 0.35rem 0 0;
  flex: 1 1 auto;
}

.chart-box--wide {
  max-width: none;
  height: 168px;
}

.chart-box canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.dash-charts {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.75rem;
  align-items: stretch;
}

@media (max-width: 720px) {
  .dash-charts {
    grid-template-columns: 1fr;
  }
}

.dash-charts > .panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 240px;
  margin-top: 0 !important;
}

.dash-charts > .panel .chart-box,
.dash-charts > .panel .empty-state {
  margin-top: auto;
  min-height: 168px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-charts > .panel .empty-state {
  width: 100%;
}

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

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

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

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

.page-header h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  margin: 0 0 0.25rem;
}

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

.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: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

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

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

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

.kpi-panel h2 { margin-bottom: 1rem; }
.kpi-row { display:grid; grid-template-columns:minmax(10rem, 1fr) auto minmax(8rem, 2fr); gap:.75rem; align-items:center; margin:.7rem 0; }
.kpi-bar { display:block; height:.55rem; overflow:hidden; border-radius:999px; background:var(--surface-muted, #eee8df); }
.kpi-bar i { display:block; height:100%; border-radius:inherit; background:var(--accent, #a88f6d); }
@media (max-width:600px) { .kpi-row { grid-template-columns:1fr auto; } .kpi-bar { grid-column:1/-1; } }

.stat {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: inherit;
}

.stat__label {
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.25;
}

.stat__value {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-top: 0.1rem;
  line-height: 1.15;
}

.empty-state {
  padding: 0.85rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 0.88rem;
}

.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;
}

/* Asistente: misma presencia visual que la landing, cerrado por defecto. */
.app-assistant-root{position:fixed;right:1.25rem;bottom:1.25rem;z-index:80}.app-assistant-root .asistente-stack{display:flex;flex-direction:column;align-items:flex-end;gap:.75rem}.app-assistant-root .asistente-fab{width:58px;height:58px;border:1px solid var(--gold-rich);border-radius:50%;background:var(--surface);color:var(--gold-rich);display:grid;place-items:center;cursor:pointer;box-shadow:0 10px 28px rgba(25,20,16,.18)}.app-assistant-root .asistente-fab svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.app-assistant-root .asistente-panel{width:min(380px,calc(100vw - 2rem));max-height:min(70vh,620px);display:flex;flex-direction:column;background:var(--surface);border:1px solid rgba(201,162,39,.48);border-radius:22px;box-shadow:0 18px 48px rgba(25,20,16,.2);overflow:hidden}.app-assistant-root .asistente-panel[hidden]{display:none!important}.app-assistant-root .asistente-panel__head{display:flex;align-items:flex-start;justify-content:space-between;padding:1rem 1.1rem .85rem;border-bottom:1px solid var(--line)}.app-assistant-root .asistente-panel__eyebrow{margin:0 0 .15rem;font-size:.65rem;letter-spacing:.12em;color:var(--accent-dark)}.app-assistant-root .asistente-panel__title{margin:0;font:600 1.35rem/1.1 var(--font-display);color:var(--text)}.app-assistant-root .asistente-panel__close{border:0;background:transparent;color:var(--muted);font-size:1.7rem;line-height:1;cursor:pointer;padding:.1rem .25rem}.app-assistant-root .asistente-panel__messages{padding:1rem;overflow:auto;display:flex;flex-direction:column;gap:.65rem}.app-assistant-root .asistente-msg{max-width:90%;padding:.65rem .8rem;border-radius:14px;font-size:.9rem;white-space:pre-wrap}.app-assistant-root .asistente-msg--bot,.app-assistant-root .asistente-msg--typing{align-self:flex-start;background:#f1ece4;color:var(--text)}.app-assistant-root .asistente-msg--user{align-self:flex-end;background:var(--accent-dark);color:#fff}.app-assistant-root .asistente-msg__buttons{display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.55rem}.app-assistant-root .asistente-msg__buttons a{color:var(--accent-dark);font-size:.8rem;text-decoration:underline}.app-assistant-root .asistente-panel__form{display:flex;gap:.5rem;padding:.75rem;border-top:1px solid var(--line)}.app-assistant-root .asistente-panel__input{min-width:0;flex:1;border:1px solid var(--line);border-radius:12px;padding:.65rem .7rem;font:inherit;resize:none;background:#fff}.app-assistant-root .asistente-panel__send{border:0;border-radius:999px;padding:0 .95rem;background:var(--accent-dark);color:#fff;font:inherit;font-weight:600;cursor:pointer}.app-assistant-root .asistente-panel__send:disabled{opacity:.55;cursor:wait}@media(max-width:520px){.app-assistant-root{right:.75rem;bottom:.75rem}.app-assistant-root .asistente-panel{width:calc(100vw - 1.5rem);max-height:68vh}}
