/* ==================================================================
   TPP By Servicon — tema "red de servicios conectados"
   Oscuro, glass, acentos cian/violeta.
   ================================================================== */

:root {
    --tpp-bg: #060B16;
    --tpp-bg-2: #0B1A33;
    --tpp-surface: rgba(255, 255, 255, 0.04);
    --tpp-surface-2: rgba(255, 255, 255, 0.07);
    --tpp-border: rgba(148, 183, 255, 0.14);
    --tpp-border-strong: rgba(148, 183, 255, 0.28);
    --tpp-text: #E6EEFB;
    --tpp-muted: #8AA0C2;
    --tpp-cyan: #22D3EE;
    --tpp-violet: #7C6CFF;
    --tpp-green: #34D399;
    --tpp-red: #FB7185;
    --tpp-amber: #FBBF24;
    --tpp-sidebar-w: 232px;
}

html, body {
    height: 100%;
    background: var(--tpp-bg);
    color: var(--tpp-text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

body {
    background:
        radial-gradient(1000px 500px at 85% -10%, rgba(124, 108, 255, 0.10), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(34, 211, 238, 0.08), transparent 60%),
        var(--tpp-bg);
    background-attachment: fixed;
}

#app { min-height: 100vh; }

::selection { background: rgba(34, 211, 238, .35); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(138, 160, 194, .35) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(138, 160, 194, .35); border-radius: 8px; }

h1, h2, h3, h4, h5 { color: var(--tpp-text); }
a { color: var(--tpp-cyan); text-decoration: none; }
a:hover { color: #67E8F9; }

/* ============================ LAYOUT ============================ */

.tpp-shell { display: flex; min-height: 100vh; }

.tpp-sidebar {
    width: var(--tpp-sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    background: linear-gradient(180deg, rgba(11, 26, 51, 0.85), rgba(6, 11, 22, 0.9));
    border-right: 1px solid var(--tpp-border);
    backdrop-filter: blur(14px);
    z-index: 50;
}

.tpp-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 18px;
    border-bottom: 1px solid var(--tpp-border);
    margin-bottom: 16px;
}

.tpp-logo-mark {
    width: 38px; height: 38px; flex-shrink: 0;
    filter: drop-shadow(0 0 10px rgba(34, 211, 238, .5));
}

.tpp-logo-text { line-height: 1.05; }

.tpp-logo-text .t1 {
    font-size: 20px; font-weight: 800; letter-spacing: 4px;
    background: linear-gradient(90deg, var(--tpp-cyan), var(--tpp-violet));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.tpp-logo-text .t2 { font-size: 10.5px; color: var(--tpp-muted); letter-spacing: 1.6px; }

.tpp-nav { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }

.tpp-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--tpp-muted);
    border: 1px solid transparent;
    font-size: 14.5px;
    transition: all .18s ease;
}

.tpp-nav-link i { font-size: 17px; width: 20px; text-align: center; }

.tpp-nav-link:hover { color: var(--tpp-text); background: var(--tpp-surface-2); }

.tpp-nav-link.active {
    color: var(--tpp-text);
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.13), rgba(124, 108, 255, 0.08));
    border-color: var(--tpp-border-strong);
    box-shadow: inset 3px 0 0 var(--tpp-cyan), 0 0 18px rgba(34, 211, 238, 0.12);
}

.tpp-nav-link.active i { color: var(--tpp-cyan); }

.tpp-sidebar-footer {
    border-top: 1px solid var(--tpp-border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tpp-user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 10px;
    background: var(--tpp-surface);
    border: 1px solid var(--tpp-border);
    font-size: 13px;
}

.tpp-user-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--tpp-cyan), var(--tpp-violet));
    color: #06131F; font-weight: 700; font-size: 13px;
}

.tpp-user-chip .u-name { color: var(--tpp-text); line-height: 1.1; }
.tpp-user-chip .u-role { color: var(--tpp-muted); font-size: 11px; }

.tpp-main {
    flex-grow: 1;
    min-width: 0;
    padding: 26px 30px 40px;
}

.tpp-page-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.tpp-page-title h1 { font-size: 24px; font-weight: 700; margin: 0; letter-spacing: .4px; }
.tpp-page-title .sub { color: var(--tpp-muted); font-size: 13px; margin-top: 3px; }

.tpp-live-pill {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 12px; color: var(--tpp-muted);
    border: 1px solid var(--tpp-border); border-radius: 999px;
    padding: 5px 12px; background: var(--tpp-surface);
}

.tpp-live-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--tpp-green);
    box-shadow: 0 0 8px var(--tpp-green);
    animation: tppLive 1.8s ease-in-out infinite;
}

@keyframes tppLive { 50% { opacity: .35; } }

/* ============================ CARDS / KPI ============================ */

.tpp-card {
    background: var(--tpp-surface);
    border: 1px solid var(--tpp-border);
    border-radius: 14px;
    backdrop-filter: blur(10px);
    padding: 18px;
}

.tpp-kpi {
    position: relative;
    overflow: hidden;
    animation: tppRise .5s ease both;
    animation-delay: calc(var(--d, 0) * 70ms);
}

@keyframes tppRise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.tpp-kpi::before {
    content: "";
    position: absolute; inset: 0 auto auto 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, var(--tpp-cyan), transparent 70%);
    opacity: .7;
}

.tpp-kpi.k-violet::before { background: linear-gradient(90deg, var(--tpp-violet), transparent 70%); }
.tpp-kpi.k-green::before  { background: linear-gradient(90deg, var(--tpp-green), transparent 70%); }
.tpp-kpi.k-red::before    { background: linear-gradient(90deg, var(--tpp-red), transparent 70%); }

.tpp-kpi-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.tpp-kpi-label { color: var(--tpp-muted); font-size: 12.5px; letter-spacing: .8px; text-transform: uppercase; }

.tpp-kpi-icon {
    width: 34px; height: 34px; border-radius: 9px;
    display: grid; place-items: center;
    color: var(--tpp-cyan);
    background: rgba(34, 211, 238, 0.10);
    border: 1px solid rgba(34, 211, 238, 0.25);
}

.k-violet .tpp-kpi-icon { color: var(--tpp-violet); background: rgba(124,108,255,.1); border-color: rgba(124,108,255,.3); }
.k-green .tpp-kpi-icon  { color: var(--tpp-green); background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.3); }
.k-red .tpp-kpi-icon    { color: var(--tpp-red); background: rgba(251,113,133,.1); border-color: rgba(251,113,133,.3); }

.tpp-kpi-value { font-size: 27px; font-weight: 800; letter-spacing: .5px; }
.tpp-kpi-foot { margin-top: 6px; font-size: 12px; color: var(--tpp-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.tpp-delta {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 999px; font-weight: 600; font-size: 11.5px;
}

.tpp-delta.up   { color: var(--tpp-green); background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); }
.tpp-delta.down { color: var(--tpp-red); background: rgba(251, 113, 133, 0.12); border: 1px solid rgba(251, 113, 133, 0.3); }
.tpp-delta.flat { color: var(--tpp-muted); background: var(--tpp-surface-2); border: 1px solid var(--tpp-border); }

/* ============================ TABLAS ============================ */

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

.tpp-table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13.5px; }

.tpp-table thead th {
    background: rgba(11, 26, 51, 0.85);
    color: var(--tpp-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .8px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--tpp-border-strong);
    white-space: nowrap;
    position: sticky; top: 0;
}

.tpp-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--tpp-border);
    color: var(--tpp-text);
    white-space: nowrap;
    vertical-align: middle;
}

.tpp-table tbody tr { transition: background .15s ease; }
.tpp-table tbody tr:hover { background: rgba(34, 211, 238, 0.05); }
.tpp-table tbody tr:last-child td { border-bottom: none; }

.tpp-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11.5px; font-weight: 600;
    padding: 3px 10px; border-radius: 999px;
    letter-spacing: .4px;
}

.tpp-badge.ok      { color: var(--tpp-green); background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.35); }
.tpp-badge.err     { color: var(--tpp-red); background: rgba(251, 113, 133, 0.12); border: 1px solid rgba(251, 113, 133, 0.35); }
.tpp-badge.warn    { color: var(--tpp-amber); background: rgba(251, 191, 36, 0.10); border: 1px solid rgba(251, 191, 36, 0.35); }
.tpp-badge.neutral { color: var(--tpp-muted); background: var(--tpp-surface-2); border: 1px solid var(--tpp-border); }
.tpp-badge.info    { color: var(--tpp-cyan); background: rgba(34, 211, 238, 0.1); border: 1px solid rgba(34, 211, 238, 0.35); }

.tpp-mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; }

/* ============================ CONTROLES ============================ */

.tpp-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--tpp-border-strong);
    background: var(--tpp-surface-2);
    color: var(--tpp-text);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .18s ease;
}

.tpp-btn:hover { border-color: var(--tpp-cyan); color: var(--tpp-cyan); box-shadow: 0 0 14px rgba(34, 211, 238, 0.18); }
.tpp-btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.tpp-btn-primary {
    background: linear-gradient(90deg, rgba(34, 211, 238, 0.2), rgba(124, 108, 255, 0.2));
    border-color: rgba(34, 211, 238, 0.5);
    color: #A5F3FC;
}

.tpp-btn-primary:hover { color: #fff; border-color: var(--tpp-cyan); box-shadow: 0 0 20px rgba(34, 211, 238, 0.35); }

.tpp-btn-ghost { background: transparent; border-color: transparent; color: var(--tpp-muted); }
.tpp-btn-ghost:hover { color: var(--tpp-red); box-shadow: none; border-color: transparent; }

.form-label { color: var(--tpp-muted); font-size: 12.5px; letter-spacing: .4px; margin-bottom: 5px; }

.form-control, .form-select {
    background: rgba(6, 11, 22, 0.7);
    border: 1px solid var(--tpp-border-strong);
    color: var(--tpp-text);
    border-radius: 9px;
    font-size: 14px;
}

.form-control:focus, .form-select:focus {
    background: rgba(6, 11, 22, 0.9);
    border-color: var(--tpp-cyan);
    color: var(--tpp-text);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.form-control::placeholder { color: rgba(138, 160, 194, 0.55); }

.form-select option { background: var(--tpp-bg-2); color: var(--tpp-text); }

.form-check-input {
    background-color: rgba(6, 11, 22, 0.8);
    border-color: var(--tpp-border-strong);
}

.form-check-input:checked { background-color: var(--tpp-cyan); border-color: var(--tpp-cyan); }
.form-check-label { color: var(--tpp-text); font-size: 13.5px; }

input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); }

.validation-message { color: var(--tpp-red); font-size: 12px; margin-top: 4px; }

/* ============================ FILTROS ============================ */

.tpp-filters {
    background: var(--tpp-surface);
    border: 1px solid var(--tpp-border);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 18px;
}

.tpp-filters-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; flex-wrap: wrap;
}

.tpp-filters-title { display: flex; align-items: center; gap: 9px; color: var(--tpp-text); font-weight: 600; font-size: 14px; }
.tpp-filters-title i { color: var(--tpp-cyan); }

/* ============================ PAGINACIÓN ============================ */

.tpp-pagination { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }

.tpp-page-btn {
    min-width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    border: 1px solid var(--tpp-border);
    background: var(--tpp-surface);
    color: var(--tpp-muted);
    font-size: 13px; cursor: pointer;
    transition: all .15s ease;
}

.tpp-page-btn:hover:not(:disabled) { color: var(--tpp-cyan); border-color: var(--tpp-cyan); }
.tpp-page-btn.active { color: #06131F; background: linear-gradient(135deg, var(--tpp-cyan), var(--tpp-violet)); border-color: transparent; font-weight: 700; }
.tpp-page-btn:disabled { opacity: .35; cursor: not-allowed; }

.tpp-page-info { color: var(--tpp-muted); font-size: 12.5px; margin: 0 8px; }

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

.tpp-modal-backdrop {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(4, 7, 15, 0.75);
    backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    animation: tppFade .18s ease;
}

@keyframes tppFade { from { opacity: 0; } }

.tpp-modal {
    width: min(1000px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    background: linear-gradient(180deg, #0C1C38, #081226);
    border: 1px solid var(--tpp-border-strong);
    border-radius: 16px;
    box-shadow: 0 0 60px rgba(34, 211, 238, 0.12);
    padding: 22px 24px;
    animation: tppRise .25s ease;
}

.tpp-modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.tpp-modal-head h5 { margin: 0; font-size: 17px; }

.tpp-code {
    background: rgba(4, 7, 15, 0.8);
    border: 1px solid var(--tpp-border);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 12px;
    color: #A5F3FC;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
}

.tpp-timeline { display: flex; flex-direction: column; gap: 0; margin: 8px 0 16px; }

.tpp-tl-item { display: flex; gap: 12px; }

.tpp-tl-rail { display: flex; flex-direction: column; align-items: center; }

.tpp-tl-dot {
    width: 11px; height: 11px; border-radius: 50%;
    background: var(--tpp-cyan); box-shadow: 0 0 8px rgba(34, 211, 238, 0.7);
    margin-top: 4px; flex-shrink: 0;
}

.tpp-tl-item.violet .tpp-tl-dot { background: var(--tpp-violet); box-shadow: 0 0 8px rgba(124, 108, 255, 0.7); }
.tpp-tl-item.green .tpp-tl-dot { background: var(--tpp-green); box-shadow: 0 0 8px rgba(52, 211, 153, 0.7); }

.tpp-tl-line { width: 1.5px; flex-grow: 1; background: var(--tpp-border-strong); min-height: 18px; }

.tpp-tl-content { padding-bottom: 14px; }
.tpp-tl-content .t { font-size: 13.5px; font-weight: 600; }
.tpp-tl-content .d { font-size: 12px; color: var(--tpp-muted); }

/* ============================ VARIOS ============================ */

.tpp-fullpage-msg {
    min-height: 70vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 12px; text-align: center;
    color: var(--tpp-muted);
}

.tpp-denied-icon { font-size: 44px; color: var(--tpp-red); }

.tpp-spinner {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 3px solid rgba(34, 211, 238, 0.15);
    border-top-color: var(--tpp-cyan);
    animation: tppSpin .8s linear infinite;
}

.tpp-spinner.sm { width: 18px; height: 18px; border-width: 2px; }

@keyframes tppSpin { to { transform: rotate(360deg); } }

.tpp-empty {
    padding: 46px 20px;
    text-align: center;
    color: var(--tpp-muted);
}

.tpp-empty i { font-size: 34px; display: block; margin-bottom: 10px; color: var(--tpp-border-strong); }

.tpp-alert-error {
    background: rgba(251, 113, 133, 0.1);
    border: 1px solid rgba(251, 113, 133, 0.4);
    color: #FDA4AF;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13.5px;
    display: flex; align-items: center; gap: 9px;
}

#blazor-error-ui {
    background: #7F1D1D; color: #fff;
    bottom: 0; box-shadow: 0 -1px 8px rgba(0,0,0,.4);
    display: none; left: 0; padding: .7rem 1.25rem; position: fixed; width: 100%; z-index: 3000;
}

#blazor-error-ui .reload { color: #A5F3FC; margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; color: #fff; }

/* ============================ LOGIN ============================ */

.tpp-login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
    padding: 24px;
}

.tpp-login-bg-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(56, 189, 248, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.05) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(700px 500px at 50% 45%, #000 20%, transparent 75%);
}

.tpp-login-orb {
    position: absolute; border-radius: 50%;
    filter: blur(80px); opacity: .3;
    animation: tpplFloatLogin 10s ease-in-out infinite alternate;
}

.tpp-login-orb.a { width: 380px; height: 380px; background: #0EA5E9; top: 4%; left: 8%; }
.tpp-login-orb.b { width: 300px; height: 300px; background: #7C6CFF; bottom: 4%; right: 8%; animation-delay: -5s; }

@keyframes tpplFloatLogin {
    from { transform: translate(-16px, -12px); }
    to   { transform: translate(16px, 14px); }
}

.tpp-login-card {
    position: relative; z-index: 2;
    width: min(400px, 100%);
    background: linear-gradient(180deg, rgba(12, 28, 56, 0.9), rgba(8, 18, 38, 0.92));
    border: 1px solid var(--tpp-border-strong);
    border-radius: 18px;
    padding: 34px 32px 24px;
    box-shadow: 0 0 70px rgba(34, 211, 238, 0.10);
    backdrop-filter: blur(14px);
    animation: tppRise .5s ease both;
}

.tpp-login-brand { text-align: center; margin-bottom: 24px; }
.tpp-login-brand .brand-mark { width: 62px; height: 62px; filter: drop-shadow(0 0 14px rgba(34, 211, 238, .55)); }

.tpp-login-brand .brand-title {
    font-size: 30px; font-weight: 800; letter-spacing: 7px; margin-top: 10px;
    background: linear-gradient(90deg, var(--tpp-cyan), var(--tpp-violet));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

.tpp-login-brand .brand-title span {
    font-size: 13px; letter-spacing: 2px; font-weight: 500;
    -webkit-text-fill-color: var(--tpp-muted); color: var(--tpp-muted);
}

.tpp-login-brand .brand-sub { color: var(--tpp-muted); font-size: 12px; letter-spacing: 1.6px; text-transform: uppercase; margin-top: 4px; }

.tpp-login-foot {
    margin-top: 20px; padding-top: 14px;
    border-top: 1px solid var(--tpp-border);
    text-align: center; color: var(--tpp-muted); font-size: 12px;
}

.tpp-login-foot strong { color: var(--tpp-cyan); }

/* responsive */
@media (max-width: 900px) {
    .tpp-shell { flex-direction: column; }
    .tpp-sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; gap: 10px; padding: 10px 14px; }
    .tpp-logo { border: none; margin: 0; padding: 0; }
    .tpp-nav { flex-direction: row; }
    .tpp-nav-link span { display: none; }
    .tpp-sidebar-footer { border: none; padding: 0; margin-left: auto; flex-direction: row; }
    .tpp-user-chip { display: none; }
    .tpp-main { padding: 18px 14px 30px; }
}
