@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --navy-950: #08121e;
    --navy-900: #0d1b2a;
    --navy-800: #13273c;
    --ink-900: #152033;
    --ink-700: #445067;
    --ink-500: #75809a;
    --line: rgba(17, 24, 39, 0.08);
    --paper: rgba(255, 255, 255, 0.82);
    --paper-strong: rgba(255, 255, 255, 0.94);
    --gold: #f3b43f;
    --gold-soft: #fff0c9;
    --green: #0f9f78;
    --green-soft: #d8f7ec;
    --red: #d25b5b;
    --red-soft: #ffe1dc;
    --blue: #2a6df2;
    --blue-soft: #dce8ff;
    --amber: #d48a12;
    --amber-soft: #ffefc4;
    --shadow-lg: 0 24px 70px rgba(7, 18, 34, 0.12);
    --shadow-md: 0 14px 32px rgba(7, 18, 34, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
}

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

html {
    min-height: 100%;
    background:
        radial-gradient(circle at top left, rgba(243, 180, 63, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(42, 109, 242, 0.16), transparent 22%),
        linear-gradient(180deg, #f6f0e3 0%, #f4f7fb 42%, #eef3f9 100%);
}

body {
    min-height: 100vh;
    color: var(--ink-900);
    font-family: 'Manrope', system-ui, sans-serif;
    line-height: 1.45;
    background: transparent;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: auto;
    border-radius: 999px;
    pointer-events: none;
    z-index: 0;
    filter: blur(6px);
}

body::before {
    width: 320px;
    height: 320px;
    top: 92px;
    right: -120px;
    background: rgba(243, 180, 63, 0.1);
}

body::after {
    width: 280px;
    height: 280px;
    bottom: 50px;
    left: -120px;
    background: rgba(42, 109, 242, 0.08);
}

a {
    color: inherit;
}

.sidebar {
    width: 280px;
    position: fixed;
    top: 20px;
    left: 20px;
    bottom: 20px;
    z-index: 10;
    padding: 22px 18px;
    color: #f6f7fb;
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(19, 39, 60, 0.96) 0%, rgba(8, 18, 30, 0.96) 100%);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.25s ease, padding 0.25s ease;
}

.sidebar.collapsed {
    width: 60px;
    padding: 22px 8px;
}

.sidebar.collapsed .sidebar-brand small,
.sidebar.collapsed .sidebar-brand .eyebrow,
.sidebar.collapsed .sidebar nav a span:not(.icon),
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar.collapsed .sidebar-brand .brand-title {
    font-size: 0;
}

.sidebar.collapsed .sidebar-brand {
    text-align: center;
    padding-bottom: 0.8rem;
}

.sidebar nav {
    flex: 1;
    padding: 1.2rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 0.88rem 0.95rem;
    border-radius: 16px;
    color: rgba(255, 255, 255, 0.76);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.sidebar nav a.active {
    background: rgba(243, 180, 63, 0.18);
    color: var(--gold);
}

.sidebar nav a .icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.sidebar nav a.active .icon {
    background: rgba(243, 180, 63, 0.25);
    color: var(--gold);
}

.sidebar.collapsed .sidebar nav a {
    justify-content: center;
    padding: 0.7rem;
}

.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -14px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--navy-900);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 11;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.main {
    position: relative;
    z-index: 1;
    margin-left: 332px;
    padding: 30px 30px 36px 10px;
    min-height: 100vh;
    transition: margin-left 0.25s ease;
}

.sidebar.collapsed ~ .main {
    margin-left: 100px;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    margin-top: 0.85rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-user .label {
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-user strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.95rem;
    color: #fff;
}

.sidebar-user small {
    display: block;
    margin-top: 0.3rem;
    margin-bottom: 0.85rem;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.78rem;
}

.sidebar-status {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-status .label {
    color: rgba(255, 255, 255, 0.56);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-status strong {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.95rem;
}

.sidebar-status small {
    display: block;
    margin-top: 0.3rem;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.78rem;
}

.main {
    position: relative;
    z-index: 1;
    margin-left: 332px;
    padding: 30px 30px 36px 10px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 1.7rem;
    padding: 1.65rem 1.75rem;
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.54));
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow-md);
}

.page-header h1 {
    font-size: clamp(2rem, 3vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.05em;
}

.page-header p {
    margin-top: 0.45rem;
    color: var(--ink-700);
    font-size: 0.98rem;
    max-width: 760px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card,
.card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, var(--paper-strong) 0%, var(--paper) 100%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(18px);
}

.stat-card {
    min-height: 152px;
    padding: 1.25rem 1.3rem;
}

.stat-card::before,
.card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, rgba(42, 109, 242, 0.8), rgba(243, 180, 63, 0.72));
}

.stat-card .label {
    color: var(--ink-500);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.stat-card .value {
    margin-top: 1.05rem;
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.06em;
}

.stat-card .value.blue { color: var(--blue); }
.stat-card .value.green { color: var(--green); }
.stat-card .value.amber { color: var(--amber); }
.stat-card .value.red { color: var(--red); }

.card {
    padding: 1.45rem;
    margin-bottom: 1.45rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.grid-2 {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.3rem;
}

.chart-container {
    position: relative;
    height: 300px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.62rem;
    font-size: 0.92rem;
}

thead th {
    padding: 0 1rem 0.65rem;
    text-align: left;
    color: var(--ink-500);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 1px solid rgba(17, 24, 39, 0.06);
}

tbody tr td {
    padding: 0.95rem 1rem;
    background: rgba(255, 255, 255, 0.84);
    border-top: 1px solid rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(17, 24, 39, 0.04);
}

tbody tr td:first-child {
    border-left: 1px solid rgba(17, 24, 39, 0.04);
    border-top-left-radius: 14px;
    border-bottom-left-radius: 14px;
}

tbody tr td:last-child {
    border-right: 1px solid rgba(17, 24, 39, 0.04);
    border-top-right-radius: 14px;
    border-bottom-right-radius: 14px;
}

tbody tr:hover td {
    background: #ffffff;
    transform: translateY(-1px);
}

select,
input,
textarea {
    min-height: 42px;
    padding: 0.65rem 0.85rem;
    border-radius: 12px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink-900);
    font: inherit;
}

select:focus,
input:focus,
textarea:focus {
    outline: none;
    border-color: rgba(42, 109, 242, 0.28);
    box-shadow: 0 0 0 4px rgba(42, 109, 242, 0.08);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.36rem 0.72rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.badge-green { background: var(--green-soft); color: #116f55; }
.badge-amber { background: var(--amber-soft); color: #8c5c06; }
.badge-red { background: var(--red-soft); color: #9e3737; }
.badge-blue { background: var(--blue-soft); color: #1e53bc; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 46px;
    padding: 0 1.05rem;
    border-radius: 14px;
    border: 0;
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn-full {
    width: 100%;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #1d4ed8, #163b72);
    box-shadow: 0 14px 26px rgba(29, 78, 216, 0.22);
}

.btn-primary:hover {
    box-shadow: 0 18px 30px rgba(29, 78, 216, 0.28);
}

.btn-success {
    color: #fff;
    background: linear-gradient(135deg, #0f9f78, #0b6d53);
}

.btn-outline {
    color: var(--ink-900);
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(17, 24, 39, 0.08);
}

.loading,
.empty {
    padding: 2.6rem 1rem;
    text-align: center;
    color: var(--ink-500);
    font-size: 0.92rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
}

.field-group {
    grid-column: span 12;
}

.field-group.half {
    grid-column: span 6;
}

.field-group.third {
    grid-column: span 4;
}

.field-group label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--ink-700);
    font-size: 0.82rem;
    font-weight: 700;
}

.field-group small {
    display: block;
    margin-top: 0.35rem;
    color: var(--ink-500);
    font-size: 0.76rem;
}

.stack-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.notice {
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(17, 24, 39, 0.06);
    font-size: 0.88rem;
}

.notice.success {
    background: var(--green-soft);
    color: #116f55;
}

.notice.error {
    background: var(--red-soft);
    color: #9e3737;
}

.notice.info {
    background: var(--blue-soft);
    color: #1e53bc;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(17, 24, 39, 0.06);
}

.metric-row:last-child {
    border-bottom: 0;
}

.metric-row span {
    color: var(--ink-500);
}

.metric-row strong {
    font-weight: 800;
}

.hero-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.9fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hero-copy {
    padding: 1.55rem;
    border-radius: var(--radius-xl);
    background:
        linear-gradient(140deg, rgba(13, 27, 42, 0.96) 0%, rgba(24, 55, 96, 0.92) 62%, rgba(38, 84, 146, 0.84) 100%);
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.hero-copy .eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 0.38rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.hero-copy h2 {
    margin-top: 0.95rem;
    font-size: clamp(1.6rem, 3vw, 2.35rem);
    line-height: 1.1;
    letter-spacing: -0.05em;
}

.hero-copy p {
    margin-top: 0.85rem;
    color: rgba(255, 255, 255, 0.78);
    max-width: 620px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.15rem;
}

.hero-side {
    padding: 1.45rem;
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255, 247, 226, 0.96), rgba(255, 255, 255, 0.82));
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.88);
}

.hero-side .mini-label {
    color: var(--ink-500);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.hero-side strong {
    display: block;
    margin-top: 0.4rem;
    font-size: 2.1rem;
    letter-spacing: -0.06em;
}

.hero-side p {
    margin-top: 0.7rem;
    color: var(--ink-700);
    font-size: 0.92rem;
}

.list-stack {
    display: grid;
    gap: 0.85rem;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(17, 24, 39, 0.05);
}

.list-row strong {
    display: block;
    font-size: 0.94rem;
}

.list-row span {
    color: var(--ink-500);
    font-size: 0.84rem;
}

.alert-card {
    display: grid;
    gap: 0.55rem;
    padding: 1rem 1.05rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid rgba(17, 24, 39, 0.06);
}

.alert-card.critica {
    box-shadow: inset 0 0 0 1px rgba(210, 91, 91, 0.35);
}

.alert-card.alta {
    box-shadow: inset 0 0 0 1px rgba(212, 138, 18, 0.3);
}

.alert-card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    color: var(--ink-500);
    font-size: 0.8rem;
}

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.pill-stat {
    min-width: 120px;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(17, 24, 39, 0.05);
}

.pill-stat strong {
    display: block;
    font-size: 1.25rem;
    letter-spacing: -0.04em;
}

.pill-stat span {
    color: var(--ink-500);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
    gap: 1.2rem;
    align-items: stretch;
}

.login-panel {
    padding: 2rem;
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(13, 27, 42, 0.96), rgba(24, 55, 96, 0.88));
    color: #fff;
    box-shadow: var(--shadow-lg);
}

.login-panel h1 {
    font-size: clamp(2.1rem, 4vw, 3.4rem);
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.login-panel p {
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.76);
    max-width: 560px;
}

.login-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1.4rem;
}

.login-form {
    padding: 1.75rem;
    border-radius: 28px;
    background: linear-gradient(180deg, var(--paper-strong) 0%, var(--paper) 100%);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
    .login-card {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    .hero-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .sidebar {
        position: static;
        width: auto;
        margin: 16px;
        max-height: none;
    }

    .main {
        margin-left: 0;
        padding: 0 16px 28px;
    }
}

@media (max-width: 768px) {
    .page-header,
    .card,
    .stat-card,
    .hero-copy,
    .hero-side {
        border-radius: 22px;
    }

    .grid-2,
    .hero-panel {
        grid-template-columns: 1fr;
    }

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

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

    .field-group.half,
    .field-group.third {
        grid-column: span 12;
    }

    table,
    thead,
    tbody,
    tr,
    td,
    th {
        display: block;
    }

    thead {
        display: none;
    }

    tbody tr {
        margin-bottom: 0.85rem;
    }

    tbody tr td {
        border-left: 1px solid rgba(17, 24, 39, 0.04);
        border-right: 1px solid rgba(17, 24, 39, 0.04);
        border-radius: 0;
        padding: 0.78rem 0.95rem;
    }

    tbody tr td:first-child {
        border-top-left-radius: 14px;
        border-top-right-radius: 14px;
        border-bottom-left-radius: 0;
    }

    tbody tr td:last-child {
        border-bottom-left-radius: 14px;
        border-bottom-right-radius: 14px;
        border-top-right-radius: 0;
    }
}

@media (max-width: 560px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .sidebar nav a {
        padding: 0.8rem 0.85rem;
    }

    .page-header h1 {
        font-size: 1.85rem;
    }
}
