:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --border: #e2e5ea;
    --text: #1f2430;
    --muted: #6b7280;
    --brand: #1f6f5c;
    --brand-dark: #14503f;
    --accent: #c98a2c;
    --danger: #b3412c;
    --radius: 10px;
}

* { box-sizing: border-box; }

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

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--brand-dark);
    color: #eef3f1;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    margin-bottom: 12px;
}
.brand-mark {
    background: var(--accent);
    color: #2a1c04;
    font-weight: 700;
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}
.brand-name { font-size: 14px; line-height: 1.2; font-weight: 600; }
.brand-name small { font-weight: 400; opacity: 0.75; }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.sidebar nav a {
    color: #d7e4df;
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.08); }
.sidebar nav a.active { background: var(--brand); color: white; font-weight: 600; }

.sidebar-footer { margin-top: auto; padding: 12px 20px 0 20px; font-size: 11px; color: rgba(255,255,255,0.5); }

.content { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    padding: 18px 28px;
}
.topbar h1 { margin: 0; font-size: 20px; }

.content-body { padding: 24px 28px; }

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.card .value.accent { color: var(--brand); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.02em; }
tr:hover td { background: #fafbfc; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 17px; }

.btn {
    display: inline-block;
    background: var(--brand);
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}
.btn:hover { background: var(--brand-dark); }
.btn.secondary { background: transparent; color: var(--brand); border: 1px solid var(--brand); }
.btn.small { padding: 5px 10px; font-size: 12px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.gray { background: #eceff1; color: #52606d; }
.badge.green { background: #e2f3ea; color: #1f6f43; }
.badge.amber { background: #fdf1e0; color: #a86a12; }
.badge.blue { background: #e4eefc; color: #2158a6; }
.badge.red { background: #fbe6e2; color: var(--danger); }

form.stacked { display: flex; flex-direction: column; gap: 12px; max-width: 560px; }
form.stacked label { font-size: 13px; font-weight: 600; color: var(--text); display: block; margin-bottom: 4px; }
form.stacked input, form.stacked select, form.stacked textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}
form.row { display: flex; gap: 12px; }
form.row > div { flex: 1; }

.muted { color: var(--muted); font-size: 13px; }
.section-title { font-size: 15px; font-weight: 700; margin: 24px 0 10px 0; }
a.link { color: var(--brand); text-decoration: none; font-weight: 600; }
a.link:hover { text-decoration: underline; }

.empty { color: var(--muted); font-style: italic; padding: 20px 0; }

/* ---------- Móvil ---------- */
@media (max-width: 768px) {
    .layout { flex-direction: column; min-height: auto; }

    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 10px 12px;
        gap: 12px;
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    .brand {
        padding: 0 12px 0 0;
        margin-bottom: 0;
        border-bottom: none;
        border-right: 1px solid rgba(255,255,255,0.15);
        flex-shrink: 0;
    }
    .brand-name { display: none; }

    .sidebar nav {
        flex-direction: row;
        padding: 0;
        gap: 4px;
        overflow-x: auto;
        flex: 1;
    }
    .sidebar nav a {
        white-space: nowrap;
        padding: 8px 12px;
        font-size: 13px;
    }

    .sidebar-footer {
        margin-top: 0;
        padding: 0 0 0 8px;
        border-left: 1px solid rgba(255,255,255,0.15);
        white-space: nowrap;
        flex-shrink: 0;
    }
    .sidebar-footer br { display: none; }
    .sidebar-footer a { display: inline; margin-left: 6px; }

    .topbar { padding: 14px 16px; }
    .topbar h1 { font-size: 18px; }
    .content-body { padding: 16px; }

    .panel { padding: 16px; }
    .grid-cards { grid-template-columns: 1fr 1fr; }

    table { display: block; overflow-x: auto; white-space: nowrap; }

    form.row { flex-direction: column; gap: 10px; }
}
