*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 1000;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--ink);
    color: var(--surface);
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

img {
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
p,
ul {
    margin: 0;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.6rem);
}

h2 {
    font-size: 1.4rem;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.container.narrow {
    width: min(480px, calc(100% - 32px));
}

.muted,
.page-intro,
.lead {
    color: var(--ink-soft);
}

.eyebrow {
    margin-bottom: 10px;
    color: var(--warm);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0;
    background: transparent;
    font-weight: 700;
}

.brand-logo {
    display: block;
    height: clamp(44px, 6.5vw, 64px);
    width: auto;
    max-width: min(280px, 72vw);
    object-fit: contain;
    background: transparent;
}

.brand-mark {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 8px 0 0 var(--warm);
}

.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
}

.button:hover,
button.button:hover {
    background: var(--bg-muted);
    border-color: color-mix(in srgb, var(--ink) 22%, var(--line-strong));
}

.button:focus-visible,
button.button:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
    outline-offset: 2px;
}

.button:disabled,
button.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-primary {
    color: #fff;
    background: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 72%, #000);
}

.button-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.button-ghost,
.button-secondary {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
}

.button-ghost:hover,
.button-secondary:hover {
    background: var(--bg-muted);
}

.button-lg {
    min-height: 52px;
    padding: 0 22px;
}

.button-block {
    width: 100%;
}

.text-link {
    font-weight: 600;
    color: var(--ink-soft);
}

.text-link:hover,
.form-foot a {
    color: var(--accent);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
}

/* Sistema de superficies y acciones compartido por todo el panel. */
.admin-page { display: grid; gap: 18px; padding-bottom: 32px; }
.admin-page > .page-intro { max-width: 680px; font-size: .96rem; line-height: 1.55; }
.panel { box-shadow: 0 1px 0 rgba(27,25,22,.03); }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .data-table tr,
html[data-theme="dark"] .empty-box,
html[data-theme="dark"] .empty-inline { background: var(--surface); border-color: var(--line); }
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .button-secondary,
html[data-theme="dark"] .button-ghost { background: var(--surface-raised); color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .data-table td,
html[data-theme="dark"] .data-table th { border-color: var(--line); }
html[data-theme="dark"] .empty-box { color: var(--ink-soft); }
.button, button.button { transition: transform .16s ease, background .16s ease, border-color .16s ease; }
@media (hover:hover) { .button:hover, button.button:hover { transform: translateY(-1px); } }
@media (max-width: 767px) { .admin-page { gap: 14px; padding-bottom: 24px; } .panel { border-radius: 16px; } .page-intro { font-size: .92rem; } }

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.empty-box,
.empty-inline {
    padding: 22px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    background: rgba(255, 253, 248, 0.4);
}

.empty-inline {
    padding: 14px;
    margin: 0;
}

.form {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 600;
}

.field span {
    color: var(--ink);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-weight: 500;
}

.field textarea {
    min-height: 96px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid var(--accent-soft);
    border-color: var(--accent);
}

.form-foot {
    margin-top: 18px;
    color: var(--ink-soft);
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th,
.data-table td {
    padding: 12px;
    text-align: left;
}

.data-table th {
    color: var(--ink-soft);
    font-weight: 600;
    border-bottom: 1px solid var(--line);
}

.data-table td {
    border-bottom: 1px solid var(--line);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    margin-bottom: 18px;
}

.field-inline,
.field-grow {
    min-width: 180px;
}

.field-grow {
    flex: 1;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 720px) {
    .field-row,
    .toolbar {
        grid-template-columns: 1fr;
    }

    .field-inline,
    .field-grow,
    .toolbar .button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
