:root {
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;

    color: #f7f7f7;
    background: #0c0d0f;
    color-scheme: dark;

    --orange: #ff6a00;
    --orange-soft: rgba(255, 106, 0, 0.13);
    --panel: #17191d;
    --panel-soft: #202329;
    --line: #30343b;
    --muted: #9b9fa8;
    --danger: #ff4d4d;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(
            circle at top right,
            rgba(255, 106, 0, 0.12),
            transparent 30rem
        ),
        #0c0d0f;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

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

.login-card {
    width: min(100%, 440px);
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(23, 25, 29, 0.96);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

.brand-mark {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    border-radius: 20px;
    color: #fff;
    background:
        linear-gradient(145deg, #ff8a00, #e54e00);
    font-size: 25px;
    font-weight: 900;
    letter-spacing: -1px;
    box-shadow:
        0 12px 30px rgba(255, 106, 0, 0.25),
        inset 0 1px rgba(255, 255, 255, 0.25);
}

.brand-mark.small {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 16px;
}

.eyebrow {
    margin: 24px 0 6px;
    color: var(--orange);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 12px;
    font-size: clamp(30px, 5vw, 44px);
    line-height: 1;
    letter-spacing: -0.04em;
}

.login-copy {
    margin-bottom: 28px;
    color: var(--muted);
    line-height: 1.6;
}

label {
    display: grid;
    gap: 8px;
    color: #d7d9dc;
    font-size: 13px;
    font-weight: 700;
}

.login-card form {
    display: grid;
    gap: 18px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 11px;
    padding: 12px 13px;
    color: #fff;
    background: #111317;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px var(--orange-soft);
}

textarea {
    resize: vertical;
}

.primary-button,
.secondary-button {
    border-radius: 11px;
    padding: 12px 16px;
    font-weight: 800;
}

.primary-button {
    border: 1px solid var(--orange);
    color: #fff;
    background: var(--orange);
}

.primary-button:hover {
    filter: brightness(1.08);
}

.secondary-button {
    border: 1px solid var(--line);
    color: #fff;
    background: #1a1d22;
}

.secondary-button:hover {
    border-color: #525861;
}

.form-message {
    min-height: 22px;
    margin-top: 14px;
    color: #7ddf9b;
    font-size: 14px;
}

.error-message {
    color: #ff7777;
}

.app-view {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 255px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--line);
    background: rgba(18, 20, 23, 0.97);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
}

.sidebar-brand small {
    margin-top: 3px;
    color: var(--muted);
}

.main-nav {
    display: grid;
    gap: 7px;
    margin-top: 38px;
}

.nav-button {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 11px;
    padding: 12px 14px;
    color: var(--muted);
    background: transparent;
    text-align: left;
    font-weight: 750;
}

.nav-button:hover,
.nav-button.active {
    border-color: rgba(255, 106, 0, 0.25);
    color: #fff;
    background: var(--orange-soft);
}

.user-panel {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #14161a;
}

.user-panel small {
    margin-bottom: 10px;
    color: var(--muted);
    text-transform: capitalize;
}

.main-content {
    min-width: 0;
    padding: 28px clamp(20px, 4vw, 54px) 60px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 26px;
}

.topbar .eyebrow {
    margin-top: 0;
}

.topbar h2 {
    margin-bottom: 0;
    font-size: clamp(27px, 4vw, 40px);
    letter-spacing: -0.035em;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.metric-card,
.panel,
.welcome-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background:
        linear-gradient(
            145deg,
            rgba(255, 255, 255, 0.02),
            transparent
        ),
        var(--panel);
}

.metric-card {
    padding: 24px;
}

.metric-card span {
    display: block;
    margin-bottom: 16px;
    color: var(--muted);
    font-size: 14px;
}

.metric-card strong {
    display: block;
    font-size: 42px;
    letter-spacing: -0.05em;
}

.metric-card.urgent {
    border-color: rgba(255, 77, 77, 0.3);
}

.metric-card.urgent strong {
    color: #ff7474;
}

.welcome-card {
    margin-top: 20px;
    padding: 30px;
}

.welcome-card .eyebrow {
    margin-top: 0;
}

.welcome-card h3 {
    font-size: 25px;
}

.welcome-card p:last-child {
    max-width: 800px;
    margin-bottom: 0;
    color: var(--muted);
    line-height: 1.7;
}

.two-column-layout {
    display: grid;
    grid-template-columns:
        minmax(300px, 0.82fr)
        minmax(500px, 1.3fr);
    gap: 20px;
    align-items: start;
}

.panel {
    min-width: 0;
    padding: 24px;
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.panel-heading .eyebrow {
    margin-top: 0;
}

.panel-heading h3 {
    margin-bottom: 0;
    font-size: 22px;
}

.data-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.data-form .wide {
    grid-column: 1 / -1;
}

.compact-search {
    max-width: 210px;
}

.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

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

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 13px;
    vertical-align: top;
}

th {
    color: var(--muted);
    background: #121419;
    font-size: 11px;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

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

tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 5px 8px;
    background: #292d33;
    font-size: 11px;
    font-weight: 800;
    text-transform: capitalize;
}

.badge.urgente {
    color: #ff9090;
    background: rgba(255, 77, 77, 0.13);
}

.badge.alta {
    color: #ffbe7f;
    background: rgba(255, 132, 0, 0.13);
}

.empty-cell {
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 1100px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .app-view {
        display: block;
    }

    .sidebar {
        position: static;
        width: auto;
        height: auto;
        padding: 14px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .main-nav {
        grid-template-columns: repeat(3, 1fr);
        margin: 15px 0;
    }

    .nav-button {
        text-align: center;
    }

    .user-panel {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .user-panel small {
        margin: 0 auto 0 0;
    }

    .main-content {
        padding: 22px 14px 40px;
    }

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

    .data-form {
        grid-template-columns: 1fr;
    }

    .data-form .wide {
        grid-column: auto;
    }

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

    .compact-search {
        max-width: none;
    }
}

@media (max-width: 520px) {
    .login-card {
        padding: 28px 22px;
    }

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

    .main-nav {
        grid-template-columns: 1fr;
    }

    .user-panel {
        align-items: stretch;
        flex-direction: column;
    }
}


/* ==================================================
   EMV INFORMÁTICA · IDENTIDAD CORPORATIVA
   Revisión visual 0.3.1
   ================================================== */

:root {
    color: #0a1930;
    background: #f3f7fc;
    color-scheme: light;

    --navy: #06182f;
    --navy-2: #082a50;
    --navy-3: #0d345e;

    --blue: #0e6ef5;
    --blue-2: #27a8ff;
    --cyan: #42d8ff;

    --ink: #0a1930;
    --text: #263a54;
    --muted: #5b6b80;

    --line: #dbe5f1;
    --soft: #f3f7fc;
    --white: #ffffff;

    --panel: #ffffff;
    --panel-soft: #eef4fb;

    --danger: #d9363e;
    --success: #168354;
    --warning: #b56b00;
}

body {
    color: var(--ink);
    background: var(--soft);
}

.login-view {
    background:
        radial-gradient(
            circle at 85% 12%,
            rgba(39, 168, 255, 0.23),
            transparent 30rem
        ),
        linear-gradient(
            145deg,
            var(--navy) 0%,
            var(--navy-2) 70%,
            var(--navy-3) 100%
        );
}

.login-card {
    border: 1px solid rgba(219, 229, 241, 0.8);
    color: var(--ink);
    background: var(--white);
    box-shadow: 0 28px 80px rgba(2, 20, 43, 0.34);
}

.brand-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--white);
}

.brand-logo-wrap img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

.login-logo {
    width: 100%;
    max-width: 310px;
    min-height: 112px;
    margin: 0 0 25px;
    padding: 11px 16px;
    border-radius: 17px;
    box-shadow: 0 13px 32px rgba(6, 24, 47, 0.1);
}

.sidebar-logo {
    width: 158px;
    min-width: 158px;
    padding: 7px 9px;
    border-radius: 11px;
}

.brand-mark {
    display: none;
}

.login-card .eyebrow {
    margin-top: 0;
}

.login-card h1 {
    color: var(--navy);
}

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

label {
    color: var(--text);
}

input,
select,
textarea {
    border-color: var(--line);
    color: var(--ink);
    background: var(--white);
}

input::placeholder,
textarea::placeholder {
    color: #8391a3;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(14, 110, 245, 0.13);
}

.primary-button {
    border-color: var(--blue);
    color: var(--white);
    background: var(--blue);
    box-shadow: 0 10px 24px rgba(14, 110, 245, 0.2);
}

.primary-button:hover {
    background: #0b61d9;
    border-color: #0b61d9;
    filter: none;
    transform: translateY(-1px);
}

.secondary-button {
    border-color: #a9c7ec;
    color: var(--blue);
    background: var(--white);
}

.secondary-button:hover {
    border-color: var(--blue);
    color: #0758c8;
    background: #f8fbff;
}

.eyebrow {
    color: var(--blue);
}

.form-message {
    color: var(--success);
}

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

.app-view {
    background: var(--soft);
}

.sidebar {
    border-right: 0;
    color: var(--white);
    background:
        linear-gradient(
            180deg,
            var(--navy) 0%,
            #041326 100%
        );
    box-shadow: 8px 0 30px rgba(6, 24, 47, 0.08);
}

.sidebar-brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 0 6px;
}

.product-label {
    padding-left: 3px;
}

.sidebar-brand strong {
    color: var(--white);
    font-size: 15px;
}

.sidebar-brand small {
    color: #b8c7d8;
}

.nav-button {
    color: #c7d3e1;
}

.nav-button:hover,
.nav-button.active {
    border-color: rgba(39, 168, 255, 0.38);
    color: var(--white);
    background: rgba(14, 110, 245, 0.25);
}

.user-panel {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--white);
    background: var(--navy-2);
}

.user-panel small {
    color: #b8c7d8;
}

.user-panel .secondary-button {
    border-color: rgba(255, 255, 255, 0.3);
    color: var(--white);
    background: rgba(255, 255, 255, 0.08);
}

.user-panel .secondary-button:hover {
    border-color: rgba(255, 255, 255, 0.55);
    color: var(--white);
    background: rgba(255, 255, 255, 0.14);
}

.main-content {
    background: var(--soft);
}

.topbar h2 {
    color: var(--navy);
}

.metric-card,
.panel,
.welcome-card {
    border-color: var(--line);
    color: var(--ink);
    background: var(--white);
    box-shadow: 0 12px 34px rgba(5, 28, 58, 0.07);
}

.metric-card span {
    color: var(--muted);
}

.metric-card strong {
    color: var(--navy);
}

.metric-card.urgent {
    border-color: rgba(217, 54, 62, 0.25);
    background: #fffafa;
}

.metric-card.urgent strong {
    color: var(--danger);
}

.welcome-card p:last-child {
    color: var(--muted);
}

.panel-heading h3,
.welcome-card h3 {
    color: var(--navy);
}

.table-wrapper {
    border-color: var(--line);
    background: var(--white);
}

table {
    color: var(--ink);
    background: var(--white);
}

th,
td {
    border-bottom-color: var(--line);
}

th {
    color: var(--navy-3);
    background: #eef4fb;
}

tbody tr:hover {
    background: #f7faff;
}

tbody small {
    color: var(--muted);
}

.badge {
    color: var(--navy-3);
    background: #e8f1fb;
}

.badge.urgente {
    color: #a9242b;
    background: #ffebed;
}

.badge.alta {
    color: #985b00;
    background: #fff1dc;
}

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

.compact-search {
    background: var(--white);
}

@media (max-width: 780px) {
    .sidebar {
        border-bottom: 0;
        box-shadow: 0 8px 24px rgba(6, 24, 47, 0.12);
    }

    .sidebar-brand {
        align-items: center;
        flex-direction: row;
    }

    .sidebar-logo {
        width: 138px;
        min-width: 138px;
    }

    .product-label {
        padding-left: 0;
    }
}

@media (max-width: 520px) {
    .login-logo {
        max-width: 270px;
        min-height: 96px;
    }

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


/* ==================================================
   EMV GESTIÓN · MÓDULO DE PRESUPUESTOS 0.4.0
   ================================================== */

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

.metric-card small {
    display: block;
    margin-top: 8px;
    color: var(--blue);
    font-size: 14px;
    font-weight: 800;
}

.budget-layout {
    display: grid;
    gap: 22px;
}

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

.budget-lines-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 8px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.budget-lines-heading .eyebrow {
    margin: 0 0 5px;
}

.budget-lines-heading h4 {
    margin: 0;
    color: var(--navy);
    font-size: 18px;
}

.budget-lines {
    display: grid;
    gap: 12px;
}

.budget-line {
    position: relative;
    display: grid;
    grid-template-columns:
        minmax(240px, 2.4fr)
        minmax(90px, 0.7fr)
        minmax(75px, 0.6fr)
        minmax(120px, 1fr)
        minmax(85px, 0.7fr)
        minmax(85px, 0.7fr)
        minmax(115px, 0.9fr)
        34px;
    gap: 10px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #f8fbff;
}

.budget-line label {
    min-width: 0;
    font-size: 11px;
}

.budget-line input {
    min-width: 0;
    padding: 10px 9px;
}

.line-total {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding-bottom: 10px;
}

.line-total span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.line-total strong {
    color: var(--navy);
    font-size: 14px;
    white-space: nowrap;
}

.remove-line {
    width: 34px;
    height: 38px;
    margin-bottom: 1px;
    border: 1px solid #efb9bd;
    border-radius: 9px;
    color: var(--danger);
    background: #fff;
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.remove-line:hover {
    border-color: var(--danger);
    background: #fff4f5;
}

.budget-totals {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}

.budget-totals > div {
    display: grid;
    min-width: 175px;
    gap: 6px;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--white);
}

.budget-totals span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.budget-totals strong {
    color: var(--navy);
    font-size: 18px;
}

.budget-totals .grand-total {
    border-color: var(--navy);
    color: var(--white);
    background: var(--navy);
}

.budget-totals .grand-total span,
.budget-totals .grand-total strong {
    color: var(--white);
}

.budget-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.budget-filters select {
    min-width: 165px;
}

.budget-table {
    min-width: 1050px;
}

.money-cell {
    white-space: nowrap;
    text-align: right;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 165px;
}

.table-action {
    padding: 6px 8px;
    border: 1px solid #a9c7ec;
    border-radius: 7px;
    color: var(--blue);
    background: var(--white);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.table-action:hover {
    border-color: var(--blue);
    background: #f3f8ff;
}

.table-action.success {
    border-color: #9fd5bc;
    color: var(--success);
}

.table-action.danger {
    border-color: #efb9bd;
    color: var(--danger);
}

.badge.budget-state {
    text-transform: none;
}

.badge.budget-state.borrador {
    color: #5b6b80;
    background: #edf1f5;
}

.badge.budget-state.enviado {
    color: #0758c8;
    background: #e7f1ff;
}

.badge.budget-state.aceptado {
    color: #0f7047;
    background: #e4f6ed;
}

.badge.budget-state.rechazado {
    color: #a9242b;
    background: #ffebed;
}

.badge.budget-state.vencido {
    color: #985b00;
    background: #fff1dc;
}

@media (max-width: 1350px) {
    .budget-line {
        grid-template-columns:
            minmax(230px, 2fr)
            repeat(3, minmax(90px, 0.8fr))
            repeat(2, minmax(80px, 0.7fr))
            34px;
    }

    .line-total {
        grid-column: 1 / -2;
    }
}

@media (max-width: 1100px) {
    .metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .budget-line .line-concept {
        grid-column: 1 / -1;
    }

    .line-total {
        grid-column: auto;
    }

    .remove-line {
        position: absolute;
        top: 10px;
        right: 10px;
    }
}

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

    .budget-form {
        grid-template-columns: 1fr;
    }

    .budget-lines-heading,
    .budget-filters,
    .budget-totals {
        align-items: stretch;
        flex-direction: column;
    }

    .budget-filters {
        width: 100%;
    }

    .budget-filters .compact-search,
    .budget-filters select {
        width: 100%;
        max-width: none;
    }

    .budget-totals > div {
        min-width: 0;
    }
}

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

    .budget-line .line-concept {
        grid-column: auto;
    }
}
