:root {
  --bg: #f2f6f5;
  --surface: #ffffff;
  --line: #dce4e1;
  --ink: #17211f;
  --muted: #65736f;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  margin: 0;
}

a {
  color: inherit;
}

input,
select,
textarea,
button {
  font: inherit;
}

label {
  color: var(--muted);
  display: grid;
  gap: .4rem;
  font-size: .9rem;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: .7rem;
  width: 100%;
}

textarea {
  resize: vertical;
}

.landing,
.auth-page {
  display: grid;
  min-height: 100vh;
  padding: 1rem;
  place-items: center;
}

.landing section,
.auth-card,
.panel-card,
.metrics article,
.sidebar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(27, 48, 43, .07);
}

.landing section,
.auth-card {
  max-width: 520px;
  padding: 1.5rem;
  width: 100%;
}

.landing h1,
.auth-card h1,
.topbar h1 {
  margin: 0 0 .5rem;
}

.muted,
.eyebrow {
  color: var(--muted);
}

.eyebrow {
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.button,
.ghost,
.icon {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  justify-content: center;
  min-height: 40px;
  padding: .6rem .85rem;
  text-decoration: none;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.ghost {
  width: 100%;
}

.icon {
  font-size: .82rem;
  min-height: 34px;
  padding: .35rem .5rem;
}

.danger {
  color: var(--danger);
}

.actions-row,
.row-actions,
.filters,
.upload-row,
.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.app-shell {
  display: grid;
  gap: 1rem;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
  margin: 0 auto;
  max-width: 1600px;
  padding: 1.5rem;
}

.sidebar {
  align-self: start;
  background: #18211f;
  border-color: #283330;
  color: #edf4f1;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-height: calc(100svh - 3rem);
  padding: 1.15rem .95rem;
  position: sticky;
  top: 1.5rem;
}

.sidebar-brand {
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  display: grid;
  gap: .2rem;
  margin-bottom: 1rem;
  padding: .35rem .55rem 1.15rem;
}

.sidebar-brand strong {
  color: #fff;
  font-size: .95rem;
}

.sidebar-brand small {
  color: #91a09c;
  font-size: .7rem;
}

.sidebar nav {
  display: grid;
  gap: .35rem;
}

.sidebar a {
  border-radius: 6px;
  color: #b9c6c2;
  font-size: .84rem;
  font-weight: 650;
  padding: .65rem;
  text-decoration: none;
}

.sidebar a:hover {
  background: rgba(255, 255, 255, .06);
  color: #fff;
}

.sidebar a.is-active {
  background: var(--primary);
  color: #fff;
  box-shadow: inset 3px 0 #9ad9cf;
}

.sidebar .ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, .16);
  color: #b9c6c2;
  margin-top: auto;
}

.content {
  min-width: 0;
}

.topbar {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.topbar .muted {
  margin: 0;
  max-width: 670px;
  font-size: .86rem;
}

.metrics {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 1rem;
}

.metrics article,
.panel-card {
  padding: 1.2rem;
}

.panel-card {
  margin-bottom: 1rem;
}

.metrics span {
  color: var(--muted);
  display: block;
  font-size: .85rem;
}

.metrics strong {
  display: block;
  font-size: 1.8rem;
  margin-top: .25rem;
}

.metrics article {
  border-radius: 8px;
  min-height: 105px;
}

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

table {
  border-collapse: collapse;
  min-width: 1040px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: .75rem;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f8faf9;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
}

tbody tr:hover {
  background: #fbfdfc;
}

.grid-form,
.guest-form {
  display: grid;
  gap: .85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide {
  grid-column: 1 / -1;
}

.bulk-form {
  border-top: 1px solid var(--line);
  display: grid;
  gap: .85rem;
  margin-top: 1rem;
  padding-top: 1rem;
}

.photo-list {
  display: grid;
  gap: .7rem;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  margin-top: 1rem;
}

.photo-list img {
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  object-fit: cover;
  width: 100%;
}

.alert {
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: 8px;
  color: var(--danger);
  padding: .75rem;
}

.guest-identity {
  align-items: center;
  display: flex;
  gap: .65rem;
  min-width: 180px;
}

.guest-avatar {
  background: #e2f1ee;
  border-radius: 6px;
  color: var(--primary);
  display: grid;
  flex: 0 0 34px;
  font-family: Georgia, serif;
  font-weight: 700;
  height: 34px;
  place-items: center;
  width: 34px;
}

.guest-identity strong,
.guest-identity small {
  display: block;
}

.guest-identity strong {
  font-size: .84rem;
}

.guest-identity small {
  color: var(--muted);
  font-size: .68rem;
  margin-top: .15rem;
}

.status-badge {
  border: 1px solid;
  border-radius: 5px;
  display: inline-flex;
  font-size: .66rem;
  font-weight: 750;
  min-height: 25px;
  padding: .3rem .5rem;
  white-space: nowrap;
}

.status-badge--pendiente { background: #f3f6f5; border-color: #d7dfdc; color: #65736f; }
.status-badge--enviada { background: #edf5fc; border-color: #b9d3eb; color: #245f91; }
.status-badge--vista { background: #f2effb; border-color: #c4b8e8; color: #624fa2; }
.status-badge--confirmada { background: #edf8f0; border-color: #b8dfc2; color: #16713a; }
.status-badge--no_asistira { background: #fff1f2; border-color: #efc5ca; color: #ad3042; }

.link-control {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto auto;
  min-width: 310px;
  overflow: hidden;
  border: 1px solid #cdd8d4;
  border-radius: 6px;
}

.link-control input {
  border: 0;
  border-radius: 0;
  color: #52615c;
  font-size: .7rem;
  min-height: 34px;
  min-width: 0;
  outline: 0;
  padding: 0 .6rem;
  width: 100%;
}

.link-control .icon {
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
}

.whatsapp {
  background: #edf8f0;
  border-color: #9bd0ac;
  color: #16713a;
}

.is-disabled {
  cursor: not-allowed;
  opacity: .5;
}

.empty-row td {
  color: var(--muted);
  padding: 2.5rem;
  text-align: center;
}

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: .7rem;
  }

  .app-shell {
    padding: .8rem;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

  .sidebar nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .sidebar .ghost {
    margin-top: .65rem;
  }
}

@media (max-width: 640px) {
  .sidebar-brand {
    display: none;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel-card .table-wrap {
    overflow: visible;
  }

  table,
  tbody {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody tr {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    margin-bottom: .75rem;
    padding: .9rem;
  }

  tbody td {
    align-items: center;
    border: 0;
    display: grid;
    font-size: .8rem;
    grid-template-columns: 78px minmax(0, 1fr);
    padding: 0;
  }

  tbody td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: .62rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  tbody td:first-child,
  tbody td:last-child {
    display: block;
  }

  tbody td:first-child::before,
  tbody td:last-child::before {
    display: none;
  }

  .link-control {
    min-width: 0;
    width: 100%;
  }

  .row-actions {
    border-top: 1px solid var(--line);
    padding-top: .75rem;
  }

  .guest-form {
    grid-template-columns: 1fr;
  }

  .pagination {
    justify-content: space-between;
  }
}

@media (max-width: 390px) {
  .metrics {
    grid-template-columns: 1fr;
  }

  .sidebar a {
    font-size: .75rem;
    padding-inline: .4rem;
    text-align: center;
  }
}
