:root {
    --color-bg: #f4f3f1;
    --color-surface: #ffffff;
    --color-border: #e2ded9;
    --color-text: #2b2b2b;
    --color-text-muted: #6b6b6b;
    --color-primary: #d9622b;
    --color-primary-dark: #b84f20;
    --color-danger: #c0392b;
    --color-success: #2f7d46;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
}

header {
    background: var(--color-primary);
    color: #fff;
    padding: 1.5rem 2rem;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
}

header p {
    margin: 0.25rem 0 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

section h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

/* ---------- Formularios ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

input, select, textarea {
    font: inherit;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

textarea {
    resize: vertical;
    min-height: 60px;
}

.form-actions {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ---------- Botones ---------- */

.btn {
    font: inherit;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

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

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

.btn-secondary {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-small {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    margin-right: 0.35rem;
}

.btn-edit {
    background: #e8e2da;
    color: var(--color-text);
}

.btn-danger {
    background: var(--color-danger);
    color: #fff;
}

/* ---------- Feedback ---------- */

.feedback {
    font-size: 0.9rem;
}

.feedback-success {
    color: var(--color-success);
}

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

/* ---------- Tabla ---------- */

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th, td {
    text-align: left;
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

td[colspan] {
    white-space: normal;
}

th {
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#empty-state {
    padding: 1rem 0;
    color: var(--color-text-muted);
    text-align: center;
}

/* ---------- Modal ---------- */

dialog {
    border: none;
    border-radius: var(--radius);
    padding: 1.5rem;
    width: min(520px, 90vw);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.4);
}

dialog h2 {
    margin-top: 0;
}

footer {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    padding-bottom: 2rem;
}
