:root {
  --ink: #17212b;
  --muted: #617080;
  --line: #d8e0e8;
  --paper: #f7f9fb;
  --white: #ffffff;
  --red: #c9192e;
  --green: #0b7a62;
  --blue: #1f5f8f;
  --gold: #d49b2a;
  --shadow: 0 18px 50px rgba(23, 33, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(247, 249, 251, 0.92), rgba(247, 249, 251, 0.92)),
    url("/assets/images/papel-japones.jpeg") center/520px auto;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
}

.login-card,
.panel,
.alert,
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(460px, calc(100% - 32px));
  padding: 28px;
}

.admin-app {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background:
    linear-gradient(rgba(23, 33, 43, 0.96), rgba(23, 33, 43, 0.96)),
    url("/assets/images/tatami.jpeg") center/360px auto;
  color: var(--white);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 28px;
  color: var(--white);
  text-decoration: none;
}

.admin-brand span {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--white);
}

.admin-brand img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav a {
  padding: 12px 13px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
  text-decoration: none;
}

.admin-nav a.active,
.admin-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.admin-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 90px;
}

.topbar,
.panel-heading,
.table-row,
.header-actions,
.row-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.panel-heading,
.table-row {
  justify-content: space-between;
  gap: 18px;
}

.header-actions,
.row-actions {
  gap: 10px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
}

h2 {
  margin-bottom: 18px;
  font-size: 1.45rem;
}

.panel h2::after,
.topbar h1::after {
  content: "";
  display: block;
  width: 150px;
  height: 13px;
  margin-top: 8px;
  background: url("/assets/images/brush1.jpeg") center/cover;
  opacity: 0.15;
  mix-blend-mode: multiply;
}

h3 {
  margin: 12px 0;
  font-size: 1rem;
}

form {
  margin: 0;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

label span {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.84rem;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

button,
.button-link,
.header-actions a,
.row-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  background: var(--red);
  color: var(--white);
  font-weight: 900;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

button.ghost,
.button-link.muted {
  background: var(--ink);
}

.header-actions a,
.row-actions a:first-child {
  background: var(--green);
}

.row-actions a:last-of-type {
  background: var(--blue);
}

button.danger {
  background: #8f1723;
}

.alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  font-weight: 800;
  box-shadow: none;
}

.alert.success {
  border-color: rgba(11, 122, 98, 0.35);
  color: var(--green);
}

.alert.error {
  border-color: rgba(201, 25, 46, 0.35);
  color: var(--red);
}

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

.stat-card {
  padding: 18px;
  box-shadow: none;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.86rem;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2.1rem;
}

.editor-form {
  display: grid;
  gap: 18px;
}

.panel {
  margin-bottom: 18px;
  padding: 22px;
  box-shadow: none;
}

.edit-card {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide,
.row-grid label:has(textarea) {
  grid-column: 1 / -1;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.check-row span {
  color: var(--ink);
}

.table-list {
  display: grid;
  gap: 10px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.filter-tabs a {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  font-weight: 900;
  text-decoration: none;
}

.filter-tabs a.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.table-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.table-row strong,
.table-row span {
  display: block;
}

.table-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.action-grid a {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fbfcfe;
}

.editor-toolbar button {
  min-height: 34px;
  padding: 7px 10px;
  background: var(--ink);
}

.rich-editor {
  min-height: 360px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: var(--white);
  outline: none;
  line-height: 1.65;
}

.rich-editor h2,
.rich-editor h3,
.rich-editor p,
.rich-editor ul,
.rich-editor ol,
.rich-editor blockquote {
  margin: 0 0 16px;
}

.rich-editor blockquote {
  padding-left: 14px;
  border-left: 4px solid var(--red);
  color: var(--muted);
}

.editor-source {
  display: none;
}

.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  padding: 16px 0 0;
  background: linear-gradient(180deg, rgba(247, 249, 251, 0), var(--paper) 38%);
}

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

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

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

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

@media (max-width: 720px) {
  .topbar,
  .panel-heading,
  .table-row,
  .header-actions,
  .row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .row-grid,
  .stats-grid,
  .action-grid,
  .admin-nav {
    grid-template-columns: 1fr;
  }

  button,
  .button-link,
  .header-actions a,
  .row-actions a {
    width: 100%;
  }
}
