*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0f0e0c;
    --card: #211f1b;
    --border: #2e2b26;
    --accent: #c9a84c;
    --accent-dim: #8a6f30;
    --text: #f0ebe0;
    --text-muted: #7a7368;
    --text-soft: #b0a898;
    --input-bg: #1a1815;
    --input-border: #3a3630;
    --error: #e05a5a;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    min-height: 100vh;
}

/* ── NAVBAR ── */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 14, 12, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 2.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.04em;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    list-style: none;
}

.nav-links a {
    display: block;
    padding: 0.45rem 1rem;
    color: var(--text-soft);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}

.nav-links a:hover {
    color: var(--accent);
    background: rgba(201, 168, 76, 0.08);
}

/* ── LAYOUT ── */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3rem 2.5rem 5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: start;
}

.page-header {
    grid-column: 1 / -1;
}

.page-label {
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.page-header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--text);
    line-height: 1.1;
}

.page-header h1 span { color: var(--accent); }

/* ── TABLE SECTION ── */
.table-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 1rem;
}

.table-wrap {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    max-height: 380px;
    overflow-y: auto;
}

/* scrollbar personalizado */
.table-wrap::-webkit-scrollbar {
    width: 6px;
}

.table-wrap::-webkit-scrollbar-track {
    background: var(--card);
}

.table-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dim);
}

/* thead fijo al hacer scroll */
thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: rgba(201, 168, 76, 0.06);
    border-bottom: 1px solid var(--border);
}

th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-soft);
    border-top: 1px solid var(--border);
}

tr:first-child td { border-top: none; }

tr:hover td { background: rgba(255,255,255,0.02); }

.empty-row {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── FORM SECTION ── */
.form-section h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 1rem;
}

.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

input[type="text"],
input[type="date"] {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    padding: 0.65rem 0.9rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--accent-dim);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

input::placeholder { color: var(--text-muted); }

/* ── ERRORS ── */
.errors {
    background: rgba(224, 90, 90, 0.08);
    border: 1px solid rgba(224, 90, 90, 0.25);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.errors li {
    font-size: 0.85rem;
    color: var(--error);
}

/* ── BUTTON ── */
.btn-submit {
    background: var(--accent);
    color: #0f0e0c;
    border: none;
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    letter-spacing: 0.03em;
    transition: opacity 0.2s, transform 0.15s;
    margin-top: 0.25rem;
}

.btn-submit:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-submit:active { transform: translateY(0); }

@media (max-width: 768px) {
    nav { padding: 0 1.25rem; }
    .page { grid-template-columns: 1fr; padding: 2rem 1.25rem 4rem; }
    .page-header { grid-column: 1; }
}

/* ── SEARCH BAR ── */
.search-wrap {
    margin-bottom: 0.75rem;
}

.search-wrap input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    padding: 0.55rem 0.85rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-wrap input:focus {
    outline: none;
    border-color: var(--accent-dim);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

.search-wrap input::placeholder { color: var(--text-muted); }

/* ── TABLE ACTION BUTTONS ── */
.td-actions {
    display: flex;
    gap: 0.4rem;
}

.btn-edit, .btn-delete {
    padding: 0.3rem 0.65rem;
    border: none;
    border-radius: 5px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    white-space: nowrap;
}

.btn-edit {
    background: rgba(201, 168, 76, 0.12);
    color: var(--accent);
    border: 1px solid rgba(201, 168, 76, 0.25);
}

.btn-delete {
    background: rgba(224, 90, 90, 0.1);
    color: #e05a5a;
    border: 1px solid rgba(224, 90, 90, 0.2);
}

.btn-edit:hover, .btn-delete:hover {
    opacity: 0.75;
    transform: translateY(-1px);
}