
:root {
    --bg: #0b1220;
    --bg2: #101827;
    --glass: rgba(255,255,255,0.06);
    --border: rgba(46,161,255,0.35);
    --brand: #2ea1ff;
    --gold: #d4af37;
    --text: #e6e6e6;
    --muted: #8892b0;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, sans-serif;
    color: var(--text);
    background: var(--bg);
}

/* LANDING */
.ng-landing {
    display: grid;
    place-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at top, #1f2937, #020617);
}
.ng-glass {
    background: var(--glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 40px rgba(0,0,0,.6);
}
.landing-container {
    padding: 2.5rem 2rem;
    border-radius: 1.6rem;
    text-align: center;
    max-width: 420px;
}
.landing-title {
    font-size: 2.4rem;
    font-weight: 900;
    background: linear-gradient(90deg, var(--gold), #ffecb3);
    /* -webkit-background-clip: text; */
    background-clip: text;
    color: transparent;
    margin-bottom: .5rem;
}
.landing-subtitle {
    color: var(--muted);
    font-size: .95rem;
}
.accent-gold { color: var(--gold); }

.ng-btn-primary,
.ng-btn-secondary,
.ng-btn-success,
.ng-btn-danger {
    border-radius: .8rem;
    padding: .6rem 1.2rem;
    border: none;
    cursor: pointer;
    font-size: .9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    text-decoration: none;
}
.ng-btn-primary {
    background: var(--brand);
    color: #fff;
}
.ng-btn-primary:hover { background: #5ab9ff; }
.ng-btn-secondary {
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text);
}
.ng-btn-success {
    background: #16a36d;
    color: #fff;
}
.ng-btn-warning {
    background: #ffb100;
    color: #fff;
}
.ng-btn-danger {
    background: #ff4b4b;
    color: #fff;
}

/* LOGIN */
.ng-login {
    display: grid;
    place-content: center;
    min-height: 100vh;
}
.login-card {
    width: min(380px, 92vw);
    padding: 2rem 1.5rem;
    border-radius: 1.5rem;
}
.login-title {
    text-align: center;
    color: var(--brand);
    font-size: 1.7rem;
    font-weight: 700;
}
.ng-label {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-top: 1rem;
    display: block;
    color: var(--muted);
}
.ng-input, .ng-select {
    width: 100%;
    padding: .6rem .7rem;
    margin-top: .25rem;
    background: var(--bg2);
    border-radius: .6rem;
    border: 1px solid var(--border);
    color: var(--text);
    font-size: .9rem;
}

.ng-select option {
    color: var(--text-color);
    background-color: var(--card-bg);
}

select.ng-select {
    height: auto !important;
    min-height: 40px !important;
}

.ng-input:focus, .ng-select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(46,161,255,.4);
}
.ng-btn-full { width: 100%; margin-top: 1.2rem; }
.ng-error { color: #ff7b7b; text-align: center; font-size: .9rem; margin-top: .5rem; }




/* LAYOUT APP */
.ng-app {
    display: flex;
    min-height: 100vh;
}
.sidebar {
    width: 260px;
    background: #020617;
    border-right: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.brand {
    text-align: center;
    color: var(--gold);
    font-size: 1.6rem;
    font-weight: 800;
}
.sidebar-user {
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
}
.badge-role {
    display: inline-block;
    margin-left: .4rem;
    padding: .1rem .4rem;
    border-radius: 999px;
    border: 1px solid var(--gold);
    font-size: .7rem;
    color: var(--gold);
}
.badge-user {
    border-color: var(--brand);
    color: var(--brand);
}

.nav-item {
    width: 100%;
    padding: .7rem .9rem;
    margin-top: .4rem;
    border-radius: .7rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    font-size: .9rem;
}
.nav-item:hover { background: var(--glass); }
.nav-item.active {
    background: var(--brand);
    color: #fff;
}

/* CONTENT */
.content {
    flex: 1;
    padding: 1.3rem 1.5rem;
    overflow-y: auto;
}
.header {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}
.header-title {
    color: var(--brand);
    font-weight: 700;
    font-size: 1.4rem;
}

/* CARDS, TABLE */
.ng-card {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 1rem 1.1rem;
    margin-bottom: 1.2rem;
}
.section-title {
    font-size: 1rem;
    font-weight: 600;
}
.gastos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}
.ng-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .8rem;
}
.ng-table th {
    background: var(--bg2);
    color: var(--brand);
    padding: .4rem .5rem;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 1;
}
.ng-table td {
    padding: .35rem .5rem;
    border-bottom: 1px solid rgba(148,163,184,.4);
}
.muted {
    color: var(--muted);
}

/* FORM GRID */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 1rem 1.2rem;
    margin-top: .8rem;
}
.form-field {
    display: flex;
    flex-direction: column;
}
.form-actions {
    grid-column: 1/-1;
    display: flex;
    justify-content: flex-end;
    margin-top: .5rem;
}

/* KPIs */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
.kpi-card { text-align: center; }
.kpi-title { color: var(--brand); font-size: .9rem; }
.kpi-value { color: var(--gold); font-size: 1.5rem; font-weight: 800; }

/* DASHBOARD POR TARJETA */
.tarjetas-grid {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;  /* 1 panel por fila */
    /* grid-template-columns: repeat(2, minmax(0, 1fr)); */
    /* gap: 1rem; */
}
.tarjeta-panel { 
  margin-bottom: 0; 
  width: 100%;
  max-width: none !important;
  justify-self: stretch;

}


.tarjeta-title {
    color: var(--gold);
    font-weight: 800;
    margin: 0 0 .75rem;
}
.ng-card-inner {
    margin-top: 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(46,161,255,0.25);
    border-radius: 1rem;
    padding: .9rem;
}

.kpi-grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: .25rem;
}
.kpi-mini {
    text-align: center;
    padding: .65rem .6rem;
    border-radius: 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(46,161,255,0.22);
}
.kpi-mini-title {
    color: var(--brand);
    font-size: .78rem;
    margin-bottom: .25rem;
}
.kpi-mini-value {
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 800;
}

.filtros-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

/* CHARTS */
.chart-wrapper {
    width: 100%;
    height: 320px;
}

.charts-row{
  width: 100%;
  display: grid;
  grid-template-columns: 1.6fr 1fr;  /* bar grande, pie un poco menor */
  gap: 16px;
  align-items: stretch;
}

.chart-card{
  width: 100%;
  min-width: 0; /* clave para que el canvas no rompa el grid */
}

/* Alto consistente, responsive */
.chart-wrapper{
  width: 100%;
  height: clamp(260px, 32vh, 380px);
}

/* Canvas que llene su wrapper */
.chart-wrapper canvas{
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Responsive: en pantallas chicas, se apilan */
@media (max-width: 1100px){
  .charts-row{
    grid-template-columns: 1fr;
  }
  .chart-wrapper{
    height: clamp(240px, 36vh, 360px);
  }
}




/* RESPONSIVE */
@media (max-width: 900px) {
    .ng-app {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: .6rem .9rem;
        position: sticky;
        top: 0;
        z-index: 20;
    }
    .sidebar nav {
        display: flex;
        gap: .4rem;
    }
    .content {
        padding: 1rem;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    .tarjetas-grid {
         width: 100%;
        display: grid;
        grid-template-columns: 1fr;  /* 1 panel por fila */
    }
    .kpi-grid-5 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 600px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
    }
    .kpi-grid-5 {
        grid-template-columns: 1fr;
    }
}

.btn-xs {
    padding: .25rem .5rem;
    font-size: .75rem;
    border-radius: .4rem;
}

.filtros-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Crea 3 columnas con igual tamaño */
    gap: 15px; /* Espacio entre las columnas */
    align-items: center; /* Alinea verticalmente los elementos */
}

.ng-input-error {
    border: 1px solid #ff4d4f !important;
    background: rgba(255, 77, 79, 0.08);
}

.ng-error-msg {
    color: #ff4d4f;
    font-size: 0.8rem;
    margin-top: 4px;
}

/*======================================
    MODAL
========================================*/

.ng-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.ng-modal.hidden {
    display: none;
}

.ng-modal-box {
    background: var(--card-bg, #302f2f);
    padding: 20px 24px;
    border-radius: 10px;
    width: 360px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0,0,0,.25);
}

.ng-modal-box h3 {
    margin-bottom: 8px;
}

.ng-modal-box p {
    margin-bottom: 16px;
    font-size: 0.95rem;
}

