:root {
    color-scheme: light;
    --seel-blue: #1F5B7A;
    --seel-blue-dark: #17465f;
    --seel-blue-soft: #e8f1f5;
    --seel-yellow: #F2D500;
    --bg: #F3F4F6;
    --panel: #ffffff;
    --line: #d7dee6;
    --text: #17212b;
    --muted: #667085;
    --ok: #166534;
    --ok-bg: rgba(22, 101, 52, 0.1);
    --warn: #a15c00;
    --warn-bg: rgba(242, 213, 0, 0.18);
    --bad: #b42318;
    --bad-bg: rgba(180, 35, 24, 0.1);
    --off: #667085;
    --neutral: #475467;
    --shadow-sm: 0 8px 22px rgba(16, 24, 40, 0.07);
    --shadow-md: 0 18px 45px rgba(16, 24, 40, 0.12);
    --radius: 14px;
    --transition: 0.2s ease;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell {
    min-height: 100vh;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: 280px;
    overflow-y: auto;
    background: linear-gradient(180deg, var(--seel-blue) 0%, #15465f 100%);
    color: #fff;
    box-shadow: 10px 0 32px rgba(16, 24, 40, 0.14);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 92px;
    padding: 22px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.app-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    border-radius: 14px;
    background: #fff;
    color: var(--seel-blue);
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.app-brand strong {
    display: block;
    font-size: 1.08rem;
}

.app-brand span span {
    display: block;
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.82rem;
}

.app-nav {
    display: grid;
    gap: 20px;
    padding: 18px 14px 28px;
}

.app-nav-group {
    display: grid;
    gap: 6px;
}

.app-nav-title {
    padding: 0 10px 4px;
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 700;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.app-nav a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(2px);
}

.app-nav a.is-active {
    background: var(--seel-yellow);
    color: #1f2937;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

.app-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.app-nav-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-main {
    min-height: 100vh;
    margin-left: 280px;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 78px;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(215, 222, 230, 0.9);
    backdrop-filter: blur(12px);
}

.app-topbar-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.app-menu-toggle {
    display: none;
}

.app-topbar-kicker {
    display: block;
    margin-bottom: 3px;
    color: var(--seel-blue);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.app-topbar h1 {
    margin: 0;
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.15;
}

.app-user {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.app-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--seel-blue);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
}

.app-user strong,
.app-user small {
    display: block;
    line-height: 1.1;
}

.app-user strong {
    font-size: 0.88rem;
}

.app-user small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 0.72rem;
}

.page {
    width: min(100%, 1320px);
    margin: 0 auto;
    padding: 34px 28px 52px;
}

.hero,
.topbar {
    margin-bottom: 26px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.hero h1,
.topbar h1 {
    margin: 0;
    font-size: clamp(1.95rem, 3vw, 2.55rem);
    line-height: 1.08;
    letter-spacing: 0;
}

.hero p,
.topbar p,
.block-header p,
.section-header p {
    color: var(--muted);
}

.hero p,
.topbar p {
    margin: 8px 0 0;
}

.block {
    margin-top: 26px;
}

.block-header {
    margin-bottom: 14px;
}

.block-header h2,
.section-header h2 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 850;
}

.block-header p,
.section-header p {
    margin: 5px 0 0;
    font-size: 0.92rem;
}

.actions,
.table-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button,
button,
.table-actions a,
.recommended-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.button-primary,
button,
.recommended-actions a {
    background: var(--seel-blue);
    color: #fff;
    box-shadow: 0 8px 18px rgba(31, 91, 122, 0.18);
}

.button-primary:hover,
button:hover,
.recommended-actions a:hover {
    background: var(--seel-blue-dark);
    transform: translateY(-1px);
}

.button-secondary,
.table-actions a {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

.button-secondary:hover,
.table-actions a:hover {
    border-color: var(--seel-blue);
    color: var(--seel-blue);
    box-shadow: var(--shadow-sm);
}

.flash,
.empty-alert {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--ok-bg);
    color: var(--ok);
    border: 1px solid rgba(22, 101, 52, 0.16);
    font-weight: 750;
}

.card,
.panel,
.kpi-card,
.module-card,
.action-card,
.recommended-panel {
    background: var(--panel);
    border: 1px solid rgba(215, 222, 230, 0.9);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card {
    overflow: hidden;
}

form .card,
.card:has(.grid) {
    padding: 24px;
}

.grid,
.kpi-grid,
.alert-grid,
.actions-grid,
.modules-grid,
.recommended-grid {
    display: grid;
    gap: 16px;
}

.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.alert-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.actions-grid,
.modules-grid,
.recommended-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-card {
    min-height: 148px;
    padding: 20px;
    border-left: 7px solid var(--neutral);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.kpi-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

.kpi-card strong {
    display: block;
    margin-top: 12px;
    font-size: clamp(2.35rem, 4vw, 3rem);
    line-height: 1;
}

.kpi-card span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
}

.kpi-ok {
    border-left-color: var(--ok);
}

.kpi-ok strong {
    color: var(--ok);
}

.kpi-bad {
    border-left-color: var(--bad);
}

.kpi-bad strong {
    color: var(--bad);
}

.kpi-warn {
    border-left-color: var(--seel-yellow);
}

.kpi-warn strong {
    color: var(--warn);
}

.kpi-neutral strong {
    color: var(--neutral);
}

.recommended-panel {
    padding: 18px;
    border-color: rgba(31, 91, 122, 0.18);
}

.recommended-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 132px;
    padding: 18px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, #fff 0%, #f8fbfc 100%);
    border: 1px solid var(--line);
}

.recommended-card strong {
    display: block;
    color: var(--text);
    font-size: 1rem;
}

.recommended-card span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.9rem;
}

.recommended-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.alert-panel {
    padding: 18px;
    border-color: rgba(180, 35, 24, 0.24);
    background: #fffafa;
}

.alert-message {
    margin: 0 0 12px;
    color: var(--bad);
    font-weight: 850;
}

.alert-item {
    border: 1px solid rgba(180, 35, 24, 0.18);
    border-radius: 12px;
    padding: 15px;
    background: #fff;
}

.alert-item span {
    display: block;
    color: var(--muted);
    font-weight: 750;
    font-size: 0.9rem;
}

.alert-item strong {
    display: block;
    margin-top: 8px;
    color: var(--bad);
    font-size: 1.9rem;
}

.action-card,
.module-card {
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), color var(--transition);
}

.action-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 98px;
    padding: 18px;
    border-color: rgba(31, 91, 122, 0.22);
    font-weight: 850;
}

.action-card span {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 600;
}

.module-card {
    display: flex;
    align-items: center;
    min-height: 60px;
    padding: 14px 16px;
    font-weight: 850;
}

.action-card:hover,
.module-card:hover {
    transform: translateY(-2px);
    border-color: rgba(31, 91, 122, 0.42);
    color: var(--seel-blue);
    box-shadow: var(--shadow-md);
}

.table-section {
    overflow: hidden;
}

.section-header {
    padding: 20px 22px 14px;
    border-bottom: 1px solid var(--line);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 820px;
}

th,
td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    background: #f8fafc;
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:nth-child(even) {
    background: #fbfcfd;
}

tbody tr:hover {
    background: var(--seel-blue-soft);
}

tr:last-child td {
    border-bottom: 0;
}

.pagination {
    padding: 18px;
    border-top: 1px solid var(--line);
}

.empty {
    padding: 24px 18px;
    color: var(--muted);
}

.field-full {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.92rem;
    font-weight: 750;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--seel-blue);
    box-shadow: 0 0 0 3px rgba(31, 91, 122, 0.12);
}

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

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-weight: 700;
}

.checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.error-box {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid rgba(180, 35, 24, 0.2);
    background: var(--bad-bg);
    color: var(--bad);
}

.field-error {
    margin-top: 6px;
    color: var(--bad);
    font-size: 0.88rem;
}

.field {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    background: #fcfdfc;
}

.field strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge,
.status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.76rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.badge-on,
.status-regular {
    background: var(--ok-bg);
    color: var(--ok);
}

.badge-off,
.status-irregular {
    background: var(--bad-bg);
    color: var(--bad);
}

.status-pendente {
    background: var(--warn-bg);
    color: var(--warn);
}

.muted {
    color: var(--muted);
}

@media (max-width: 980px) {
    .app-sidebar {
        position: static;
        width: 100%;
        max-height: 96px;
        overflow: hidden;
        transition: max-height var(--transition);
    }

    .app-sidebar:hover,
    .app-sidebar:focus-within {
        max-height: 760px;
    }

    .app-brand {
        min-height: 78px;
    }

    .app-main {
        margin-left: 0;
    }

    .app-topbar {
        padding: 0 20px;
    }

    .app-menu-toggle {
        display: inline-flex;
        color: var(--seel-blue);
        font-size: 1.45rem;
        font-weight: 900;
    }

    .kpi-grid,
    .modules-grid,
    .recommended-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .actions-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .page {
        padding: 24px 14px 36px;
    }

    .app-user {
        display: none;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .grid,
    .kpi-grid,
    .alert-grid,
    .modules-grid,
    .recommended-grid {
        grid-template-columns: 1fr;
    }
}
