:root {
  --green: #15952e;
  --green-dark: #06381b;
  --green-deep: #031f10;
  --yellow: #ffed00;
  --paper: #f3f7ef;
  --surface: #ffffff;
  --ink: #142319;
  --muted: #68736a;
  --line: #dce5da;
  --danger: #b42318;
  --shadow: 0 20px 60px rgba(5, 43, 21, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.admin-alert {
  margin-bottom: 22px;
  padding: 14px 17px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 700;
}

.admin-alert.is-success {
  color: #075d24;
  border-color: #bfe4c8;
  background: #eaf9ed;
}

.admin-alert.is-error {
  color: #7b2525;
  border-color: #f0c4c4;
  background: #fff0f0;
}

/* Acceso */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background:
    radial-gradient(circle at 82% 5%, rgba(255, 237, 0, 0.18), transparent 30rem),
    var(--paper);
}

.login-card {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  overflow: hidden;
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 32px 100px rgba(5, 43, 21, 0.16);
}

.login-visual {
  min-height: 570px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 46px;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(3, 31, 16, 0.06), rgba(3, 31, 16, 0.97)),
    url("../../usicayos-panorama.webp") center / cover;
}

.login-visual img {
  width: 86px;
  height: 86px;
  margin-bottom: auto;
  border: 3px solid var(--yellow);
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.22);
}

.login-visual > span,
.login-form > small {
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.login-visual h1 {
  max-width: 420px;
  margin: 12px 0 13px;
  font-size: clamp(34px, 5vw, 51px);
  line-height: 0.98;
}

.login-visual p {
  max-width: 440px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  line-height: 1.65;
}

.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 54px;
}

.login-form > small {
  color: var(--green);
}

.login-form h2 {
  margin: 10px 0 8px;
  font-size: 34px;
}

.login-form > p {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.6;
}

.login-form form,
.editor-form,
.upload-form {
  display: grid;
  gap: 16px;
}

.login-form label,
.editor-form > label {
  display: grid;
  gap: 7px;
  color: #435047;
  font-size: 12px;
  font-weight: 800;
}

.login-form input,
.editor-form input,
.editor-form textarea,
.editor-form select,
.media-copy input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.editor-form textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.55;
}

.login-form input:focus,
.editor-form input:focus,
.editor-form textarea:focus,
.editor-form select:focus,
.media-copy input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(21, 149, 46, 0.1);
}

.login-form form button,
.admin-primary {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 0;
  border-radius: 12px;
  color: #073419;
  background: var(--yellow);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(128, 118, 0, 0.12);
}

.login-form > a {
  align-self: flex-start;
  margin-top: 25px;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

/* Estructura */
.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 30% 0, rgba(255, 237, 0, 0.1), transparent 20rem),
    var(--green-deep);
  overflow-y: auto;
}

.admin-sidebar-brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 3px 5px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-brand img {
  width: 48px;
  height: 48px;
  border: 2px solid var(--yellow);
  border-radius: 13px;
  object-fit: cover;
}

.admin-sidebar-brand strong,
.admin-sidebar-brand span {
  display: block;
}

.admin-sidebar-brand strong {
  font-size: 13px;
}

.admin-sidebar-brand span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 10px;
}

.admin-sidebar-brand button {
  display: none;
  border: 0;
  color: #fff;
  background: transparent;
  font-size: 30px;
}

.admin-sidebar nav {
  display: grid;
  gap: 5px;
  padding: 20px 0;
}

.admin-sidebar nav > p {
  margin: 0 10px 7px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.admin-sidebar nav > a {
  min-height: 53px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  transition: 0.18s ease;
}

.admin-sidebar nav > a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.admin-sidebar nav > a.is-active {
  color: #fff;
  border-color: rgba(255, 237, 0, 0.24);
  background: rgba(255, 237, 0, 0.1);
}

.admin-sidebar nav > a > span {
  font-size: 17px;
  text-align: center;
}

.admin-sidebar nav strong,
.admin-sidebar nav small {
  display: block;
}

.admin-sidebar nav strong {
  font-size: 12px;
}

.admin-sidebar nav small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 9px;
}

.admin-sidebar nav b {
  min-width: 23px;
  padding: 4px 6px;
  border-radius: 99px;
  color: #073419;
  background: var(--yellow);
  font-size: 10px;
  text-align: center;
}

.admin-sidebar-footer {
  margin-top: auto;
  padding: 16px 5px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-footer > div {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.admin-sidebar-footer > div > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #073419;
  background: var(--yellow);
  font-size: 11px;
  font-weight: 900;
}

.admin-sidebar-footer strong,
.admin-sidebar-footer small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-sidebar-footer strong {
  font-size: 11px;
}

.admin-sidebar-footer small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 9px;
}

.admin-sidebar-footer form {
  margin-top: 13px;
}

.admin-sidebar-footer button {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 800;
}

.admin-main {
  min-width: 0;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px clamp(20px, 4vw, 50px);
  border-bottom: 1px solid rgba(5, 43, 21, 0.08);
  background: rgba(243, 247, 239, 0.92);
  backdrop-filter: blur(16px);
}

.admin-topbar > div {
  min-width: 0;
}

.admin-topbar small,
.admin-topbar strong {
  display: block;
}

.admin-topbar small {
  color: var(--green);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-topbar strong {
  margin-top: 4px;
  font-size: 15px;
}

.admin-topbar > a {
  margin-left: auto;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
}

.sidebar-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--green-dark);
  background: #fff;
}

.admin-content {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: 32px clamp(20px, 4vw, 50px) 60px;
}

.admin-hero {
  min-height: 220px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
  padding: clamp(28px, 5vw, 48px);
  overflow: hidden;
  border-radius: 23px;
  color: #fff;
  background:
    linear-gradient(110deg, rgba(3, 31, 16, 0.99) 15%, rgba(6, 56, 27, 0.84)),
    url("../../usicayos-panorama.webp") center / cover;
  box-shadow: var(--shadow);
}

.admin-hero.compact {
  min-height: 180px;
  align-items: center;
}

.admin-hero small,
.panel-heading small {
  color: var(--yellow);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.admin-hero h1 {
  max-width: 760px;
  margin: 10px 0 10px;
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.02;
}

.admin-hero p {
  max-width: 690px;
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  line-height: 1.65;
}

.admin-hero > span {
  flex: 0 0 auto;
  padding: 11px 15px;
  border: 1px solid rgba(255, 237, 0, 0.28);
  border-radius: 12px;
  color: var(--yellow);
  background: rgba(255, 237, 0, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stats-grid article {
  display: grid;
  gap: 8px;
  padding: 24px;
  border: 1px solid rgba(5, 43, 21, 0.07);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 35px rgba(5, 43, 21, 0.05);
}

.stats-grid strong {
  color: var(--green-dark);
  font-size: 34px;
  line-height: 1;
}

.stats-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(5, 43, 21, 0.08);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 45px rgba(5, 43, 21, 0.055);
}

.panel-heading {
  min-height: 77px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 18px 21px;
  border-bottom: 1px solid #edf1eb;
}

.panel-heading small {
  color: var(--green);
}

.panel-heading h2 {
  margin: 5px 0 0;
  font-size: 19px;
}

.panel-heading > a {
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
}

.admin-split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  align-items: start;
  gap: 22px;
}

.editor-panel {
  position: sticky;
  top: 98px;
}

.record-list,
.activity-list {
  display: grid;
}

.record-list article {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid #edf1eb;
}

.record-list article:last-child,
.activity-list article:last-child {
  border-bottom: 0;
}

.record-list article.is-editing {
  background: #f7fbf5;
}

.record-state {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: #b8c0b8;
  box-shadow: 0 0 0 4px #eef1ed;
}

.record-state.is-live {
  background: var(--green);
  box-shadow: 0 0 0 4px #e2f3e5;
}

.record-copy {
  min-width: 0;
}

.record-copy small,
.record-copy strong,
.record-copy span {
  display: block;
}

.record-copy small {
  color: var(--green);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.record-copy strong {
  margin: 5px 0;
  font-size: 14px;
}

.record-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
}

.record-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.record-actions a,
.record-actions button,
.message-actions button,
.media-actions button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: #fff;
  font-size: 10px;
  font-weight: 850;
  text-decoration: none;
}

.record-actions form,
.message-actions form,
.media-actions form {
  display: contents;
}

.record-actions button,
.message-actions .danger,
.media-actions .danger {
  color: var(--danger);
}

.editor-form {
  padding: 22px;
}

.field-hint {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.5;
}

.switch-field {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 11px !important;
  cursor: pointer;
}

.switch-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-field > span {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: #c5cec3;
  transition: 0.2s ease;
}

.switch-field > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.18);
  transition: 0.2s ease;
}

.switch-field input:checked + span {
  background: var(--green);
}

.switch-field input:checked + span::after {
  transform: translateX(18px);
}

.switch-field strong,
.switch-field small {
  display: block;
}

.switch-field small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 500;
}

.empty-state {
  padding: 52px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  color: var(--green-dark);
}

.empty-state p {
  margin: 8px 0 0;
  font-size: 12px;
}

.activity-list article {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid #edf1eb;
}

.activity-list article > span,
.message-meta > span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #075d24;
  background: #eaf9ed;
  font-size: 10px;
  font-weight: 900;
}

.activity-list strong,
.activity-list small {
  display: block;
}

.activity-list strong {
  font-size: 12px;
}

.activity-list small,
.activity-list time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.message-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: #edf1eb;
}

.message-grid > article {
  min-width: 0;
  padding: 22px;
  background: #fff;
}

.message-grid > article.is-new {
  box-shadow: inset 4px 0 var(--yellow);
}

.message-meta {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.message-meta strong,
.message-meta small {
  display: block;
}

.message-meta strong {
  font-size: 12px;
}

.message-meta small,
.message-meta time {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.message-grid article > p {
  min-height: 60px;
  margin: 18px 0;
  color: #445248;
  font-size: 12px;
  line-height: 1.65;
}

.message-actions,
.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.media-layout {
  grid-template-columns: minmax(280px, 0.55fr) minmax(0, 1.45fr);
}

.upload-form {
  padding: 22px;
}

.upload-drop {
  min-height: 230px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 30px;
  border: 2px dashed #cdd9ca;
  border-radius: 15px;
  color: var(--green-dark);
  background: #f7faf5;
  text-align: center;
  cursor: pointer;
}

.upload-drop:hover,
.upload-drop.has-file {
  border-color: var(--green);
  background: #f0f8ef;
}

.upload-drop > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #073419;
  background: var(--yellow);
  font-size: 24px;
}

.upload-drop small {
  color: var(--muted);
}

.upload-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: #edf1eb;
}

.media-grid > article {
  min-width: 0;
  padding: 15px;
  background: #fff;
}

.media-preview {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  color: #fff;
  background: var(--green-dark);
  font-weight: 900;
}

.media-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-copy {
  min-width: 0;
  margin: 12px 0;
}

.media-copy strong,
.media-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-copy strong {
  font-size: 11px;
}

.media-copy small {
  margin: 4px 0 9px;
  color: var(--muted);
  font-size: 9px;
}

.media-copy input {
  min-height: 34px;
  padding: 7px 9px;
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 1180px) {
  .admin-split {
    grid-template-columns: 1fr;
  }

  .editor-panel {
    position: static;
  }

  .media-layout {
    grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr);
  }

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

@media (max-width: 920px) {
  .admin-layout {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    left: 0;
    width: min(310px, 88vw);
    transform: translateX(-105%);
    box-shadow: 20px 0 70px rgba(0, 0, 0, 0.25);
    transition: transform 0.22s ease;
  }

  .admin-sidebar.is-open {
    transform: translateX(0);
  }

  .admin-sidebar-brand button,
  .sidebar-toggle {
    display: block;
  }

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

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

  .login-visual {
    min-height: 340px;
    padding: 30px;
  }

  .login-visual img {
    width: 68px;
    height: 68px;
  }

  .login-form {
    padding: 34px 28px;
  }

  .admin-content {
    padding-top: 20px;
  }

  .admin-topbar {
    min-height: 68px;
  }

  .admin-topbar > a {
    max-width: 135px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-hero,
  .admin-hero.compact {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 28px;
  }

  .admin-hero h1 {
    font-size: 31px;
  }

  .stats-grid,
  .message-grid,
  .media-layout,
  .media-grid {
    grid-template-columns: 1fr;
  }

  .record-list article {
    grid-template-columns: 8px minmax(0, 1fr);
  }

  .record-actions {
    grid-column: 2;
  }

  .activity-list article,
  .message-meta {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .activity-list time,
  .message-meta time {
    grid-column: 2;
  }
}

@media (max-width: 460px) {
  .admin-topbar {
    padding-inline: 14px;
  }

  .admin-topbar > a {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    color: transparent;
  }

  .admin-topbar > a::after {
    content: "↗";
    color: var(--green-dark);
    font-size: 17px;
  }

  .admin-content {
    padding-inline: 14px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stats-grid article,
  .editor-form,
  .upload-form {
    padding: 18px;
  }
}
