:root {
    --main: #222d31;
    --secondary: #2e3b40;
    --bg: #f4f6f7;
    --surface: #ffffff;
    --text: #101517;
    --muted: #5d6a71;
    --line: #d8e0e3;
    --accent: #2d8f73;
}

* { box-sizing: border-box; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    width: 272px;
    height: 100vh;
    max-height: 100vh;
    background: var(--main);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    padding: 20px 16px;
    overflow: hidden;
}
.sidebar nav {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.35) transparent;
}
.sidebar nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.35);
    border-radius: 999px;
}
.brand {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    color: #fff;
    text-decoration: none;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 22px;
    width: 100%;
}
.brand-media {
    width: 100%;
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid rgba(216, 224, 227, .9);
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 8px 22px rgba(0,0,0,.12);
}
.logo-slot, .login-logo {
    border: 1px dashed rgba(255,255,255,.45);
    border-radius: 8px;
    min-width: 58px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.8);
    font-size: 12px;
}
.brand-logo {
    width: 100%;
    max-width: 218px;
    height: 68px;
    max-height: 68px;
    object-fit: contain;
    object-position: center;
    background: transparent;
    padding: 0;
    display: block;
}
.brand-title {
    display: block;
    color: #fff;
    font-size: 15px;
    letter-spacing: 0;
    line-height: 1.2;
    text-align: center;
    word-break: normal;
}
.mobile-logo {
    width: 42px;
    max-height: 34px;
    object-fit: contain;
}
.login-logo-img {
    display: block;
    width: min(260px, 86%);
    height: 96px;
    max-height: 96px;
    object-fit: contain;
    object-position: left center;
    margin-bottom: 18px;
}
.footer-logo {
    max-width: 92px;
    max-height: 28px;
    object-fit: contain;
    display: block;
    margin-bottom: 8px;
}
.sidebar nav a, .mobile-nav a, .logout-link, .workflow-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    color: rgba(255,255,255,.86);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
}
.sidebar nav a:hover, .logout-link:hover { background: var(--secondary); color: #fff; }
.workflow-link {
    background: #ffffff;
    color: var(--main);
    font-weight: 700;
    margin-top: 0;
}
.workflow-link:hover {
    background: #e8f5ef;
    color: var(--main);
}
.sidebar-actions {
    flex: 0 0 auto;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,.14);
}
.logout-link { margin-top: 6px; }
.mobile-nav a { color: var(--text); }
.mobile-nav .workflow-link {
    color: var(--main);
    border: 1px solid var(--line);
}
.app-main {
    margin-left: 272px;
    min-height: 100vh;
    width: calc(100% - 272px);
    display: flex;
    flex-direction: column;
}
.topbar {
    min-height: 72px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 5;
}
.content-wrap { padding: 24px; flex: 1; }
.app-footer {
    padding: 16px 24px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    background: var(--surface);
    font-size: 14px;
}
.card, .table-wrap, .filter-bar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(16,21,23,.04);
}
.metric {
    padding: 18px;
    min-height: 118px;
}
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; font-size: clamp(22px, 2vw, 30px); margin-top: 8px; }
.filter-bar { padding: 16px; margin-bottom: 18px; }
.table-wrap { overflow: hidden; }
.table { margin-bottom: 0; }
.btn-primary {
    --bs-btn-bg: var(--main);
    --bs-btn-border-color: var(--main);
    --bs-btn-hover-bg: var(--secondary);
    --bs-btn-hover-border-color: var(--secondary);
}
.badge-azul { background: #dbeafe; color: #1d4ed8; }
.badge-verde { background: #dcfce7; color: #166534; }
.badge-amarillo { background: #fef3c7; color: #92400e; }
.badge-rojo { background: #fee2e2; color: #991b1b; }
.status-dot {
    width: 12px;
    height: 12px;
    display: inline-block;
    border-radius: 999px;
    margin-right: 6px;
}
.dot-azul { background: #2563eb; }
.dot-verde { background: #16a34a; }
.dot-amarillo { background: #f59e0b; }
.dot-rojo { background: #dc2626; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-section-title {
    font-weight: 700;
    margin: 8px 0 14px;
    color: var(--secondary);
}
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
    background: linear-gradient(135deg, var(--main), var(--secondary));
}
.login-card {
    width: min(100%, 430px);
    background: #fff;
    padding: 32px;
    border-radius: 8px;
    box-shadow: 0 24px 80px rgba(0,0,0,.2);
}
.login-card .login-logo {
    color: var(--muted);
    border-color: var(--line);
    width: 170px;
    margin-bottom: 18px;
}
.login-card h1 { font-size: 26px; font-weight: 800; }
.login-card footer { color: var(--muted); font-size: 12px; margin-top: 22px; }

@media (max-width: 991.98px) {
    .app-main { margin-left: 0; width: 100%; }
    .topbar { padding: 12px 16px; }
    .content-wrap { padding: 16px; }
    .table-to-cards thead { display: none; }
    .table-to-cards, .table-to-cards tbody, .table-to-cards tr, .table-to-cards td { display: block; width: 100%; }
    .table-to-cards tr { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 10px; }
    .table-to-cards td { border: 0; padding: 6px 4px; }
    .table-to-cards td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; }
}
