/* =====================================================================
   Consola de plataforma (/plataforma)
   Hoja global con prefijo .pl- para no chocar con Bootstrap ni DevExpress.
   Se usa una hoja global porque el bundle de estilos aislados (.razor.css)
   no se está enlazando en App.razor.
   ===================================================================== */

.pl-shell {
    --pl-bg: #0b1120;
    --pl-panel: #0f172a;
    --pl-raise: #1e293b;
    --pl-line: #1e293b;
    --pl-line-strong: #334155;
    --pl-text: #f1f5f9;
    --pl-text-2: #cbd5e1;
    --pl-muted: #94a3b8;
    --pl-faint: #64748b;
    --pl-accent: #93c5fd;
    --pl-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--pl-bg);
    color: var(--pl-text);
    font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
}

.pl-shell a { color: var(--pl-accent); }
.pl-shell a:hover { color: #bfdbfe; }
.pl-shell :focus-visible { outline: 2px solid var(--pl-accent); outline-offset: 2px; }

/* ---------- Cabecera ---------- */
.pl-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    background: var(--pl-panel);
    border-bottom: 1px solid var(--pl-line);
}
.pl-brand { display: flex; align-items: center; gap: 12px; }
.pl-logo {
    width: 32px; height: 32px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    background: var(--pl-text); color: var(--pl-panel);
    font-weight: 700; font-size: 15px;
}
.pl-brand-name { display: flex; flex-direction: column; line-height: 1.25; }
.pl-brand-name strong { font-size: 15px; font-weight: 600; }
.pl-brand-name span { font-family: var(--pl-mono); font-size: 12px; color: var(--pl-muted); }
.pl-tag {
    margin-left: 8px; padding: 3px 8px; border-radius: 6px;
    border: 1px solid var(--pl-line-strong);
    font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--pl-text-2);
}
.pl-user { display: flex; align-items: center; gap: 12px; }
.pl-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--pl-raise); border: 1px solid var(--pl-line-strong);
    font-size: 13px; font-weight: 600;
}
.pl-user-name { display: flex; flex-direction: column; line-height: 1.3; }
.pl-user-name strong { font-size: 13px; font-weight: 500; }
.pl-user-name span { font-size: 11px; color: var(--pl-muted); }

/* ---------- Cuerpo: menú plano + contenido ---------- */
.pl-body { display: flex; flex-wrap: wrap; flex: 1; }

.pl-nav {
    flex: 1 1 220px;
    max-width: 100%;
    box-sizing: border-box;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--pl-panel);
    border-right: 1px solid var(--pl-line);
}
.pl-nav-title {
    padding: 0 12px 8px;
    font-size: 11px; font-weight: 600; letter-spacing: .08em;
    color: var(--pl-faint); text-transform: uppercase;
}
.pl-nav-title + .pl-nav-title, .pl-nav-link + .pl-nav-title { padding-top: 20px; }
.pl-nav .pl-nav-link {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    min-height: 44px; padding: 0 12px; border-radius: 8px;
    color: var(--pl-text-2); font-size: 14px; text-decoration: none;
}
.pl-nav .pl-nav-link:hover { background: var(--pl-raise); color: var(--pl-text); }
.pl-nav .pl-nav-link.active { background: var(--pl-text); color: var(--pl-panel); font-weight: 600; }
.pl-nav-count { font-size: 12px; color: inherit; opacity: .75; }
.pl-nav-badge {
    padding: 2px 7px; border-radius: 10px;
    background: #7f1d1d; color: #fecaca; font-size: 11px; font-weight: 600;
}

.pl-main {
    flex: 999 1 560px;
    min-width: 0;
    box-sizing: border-box;
    padding: 28px 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ---------- Encabezado de página ---------- */
.pl-crumb { font-size: 13px; color: var(--pl-muted); }
.pl-page-head {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px;
}
.pl-page-head > div:first-child { display: flex; flex-direction: column; gap: 6px; }
.pl-h1 { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -.01em; color: var(--pl-text); }
.pl-h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--pl-text); }
.pl-sub { font-size: 13px; color: var(--pl-muted); }
.pl-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Indicadores ---------- */
.pl-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.pl-kpi {
    padding: 18px 20px; border-radius: 12px;
    display: flex; flex-direction: column; gap: 8px;
    background: var(--pl-panel); border: 1px solid var(--pl-line);
}
.pl-kpi-label { font-size: 13px; color: var(--pl-muted); }
.pl-kpi-value { font-size: 32px; font-weight: 600; line-height: 1.1; }
.pl-kpi-note { font-size: 12px; color: var(--pl-muted); }
.pl-kpi--warn { border-color: #7c2d12; }
.pl-kpi--warn .pl-kpi-label { color: #fdba74; }
.pl-kpi--warn .pl-kpi-value { color: #fed7aa; }
.pl-kpi--bad { border-color: #7f1d1d; }
.pl-kpi--bad .pl-kpi-label { color: #fca5a5; }
.pl-kpi--bad .pl-kpi-value { color: #fecaca; }

/* ---------- Tarjetas y tablas ---------- */
.pl-split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.pl-split > .pl-wide { flex: 999 1 560px; min-width: 0; }
.pl-split > .pl-narrow { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.pl-split > .pl-half { flex: 1 1 420px; min-width: 0; }

.pl-card { border-radius: 12px; background: var(--pl-panel); border: 1px solid var(--pl-line); }
.pl-card-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 20px; border-bottom: 1px solid var(--pl-line);
}
.pl-card-head > div { display: flex; flex-direction: column; gap: 4px; }
.pl-card-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }

.pl-table-wrap { overflow-x: auto; }
.pl-table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--pl-text-2); }
.pl-table th {
    padding: 12px; text-align: left; font-weight: 500; color: var(--pl-muted); white-space: nowrap;
}
.pl-table td { padding: 14px 12px; border-top: 1px solid var(--pl-line); vertical-align: middle; }
.pl-table th:first-child, .pl-table td:first-child { padding-left: 20px; }
.pl-table th:last-child, .pl-table td:last-child { padding-right: 20px; }
.pl-table .pl-num { text-align: right; font-family: var(--pl-mono); }
.pl-table .pl-end { text-align: right; }
.pl-strong { color: var(--pl-text); font-weight: 600; text-decoration: none; }
.pl-stack { display: flex; flex-direction: column; gap: 3px; }
.pl-mono { font-family: var(--pl-mono); font-size: 12px; color: var(--pl-muted); }
.pl-muted { color: var(--pl-muted); }
.pl-nowrap { white-space: nowrap; }

.pl-list-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px; border-top: 1px solid var(--pl-line);
}
.pl-list-item:first-child { border-top: none; }

.pl-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; font-size: 13px; }
.pl-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pl-field > span:first-child { color: var(--pl-muted); }
.pl-field > span:last-child { overflow-wrap: anywhere; }

.pl-empty { padding: 28px 20px; text-align: center; color: var(--pl-muted); font-size: 13px; }

/* ---------- Estados ---------- */
.pl-pill {
    display: inline-block; padding: 3px 9px; border-radius: 6px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    border: 1px solid #475569; color: var(--pl-text-2); background: transparent;
}
.pl-pill--ok { background: #052e16; color: #bbf7d0; border-color: #166534; }
.pl-pill--info { background: #172554; color: #bfdbfe; border-color: #1e3a8a; }
.pl-pill--warn { background: #431407; color: #fed7aa; border-color: #7c2d12; }
.pl-pill--bad { background: #450a0a; color: #fecaca; border-color: #7f1d1d; }

.pl-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: #64748b; display: inline-block; }
.pl-dot--ok { background: #4ade80; }
.pl-dot--warn { background: #fb923c; }
.pl-dot--bad { background: #f87171; }

.pl-note {
    padding: 12px 14px; border-radius: 8px; background: var(--pl-raise);
    font-size: 12px; color: var(--pl-text-2); line-height: 1.5;
}
.pl-alert {
    padding: 12px 16px; border-radius: 10px; font-size: 13px; line-height: 1.5;
    background: #431407; border: 1px solid #7c2d12; color: #fed7aa;
}
.pl-alert--ok { background: #052e16; border-color: #166534; color: #bbf7d0; }
.pl-alert--bad { background: #450a0a; border-color: #7f1d1d; color: #fecaca; }

/* ---------- Controles ---------- */
.pl-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 16px; border-radius: 8px;
    border: 1px solid var(--pl-line-strong); background: transparent;
    color: var(--pl-text); font: inherit; font-size: 14px; font-weight: 500;
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.pl-btn:hover { background: var(--pl-raise); color: var(--pl-text); }
.pl-btn:disabled { opacity: .5; cursor: not-allowed; }
.pl-btn--primary { background: var(--pl-accent); border-color: var(--pl-accent); color: #0b1120; font-weight: 600; }
.pl-btn--primary:hover { background: #bfdbfe; color: #0b1120; }
.pl-btn--danger { border-color: #7f1d1d; color: #fca5a5; }
.pl-btn--sm { height: 36px; padding: 0 12px; font-size: 12px; border-radius: 6px; }

.pl-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pl-chip {
    height: 44px; padding: 0 14px; border-radius: 8px;
    border: 1px solid var(--pl-line-strong); background: transparent;
    color: var(--pl-text-2); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
}
.pl-chip[aria-pressed="true"] { background: var(--pl-text); border-color: var(--pl-text); color: var(--pl-panel); font-weight: 600; }
.pl-chip span { opacity: .7; margin-left: 4px; }

.pl-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pl-search {
    display: flex; align-items: center; gap: 8px;
    height: 44px; padding: 0 12px; border-radius: 8px;
    border: 1px solid var(--pl-line-strong); background: var(--pl-panel); color: var(--pl-muted);
}
.pl-search input {
    width: 240px; max-width: 60vw; border: none; outline: none; background: transparent;
    color: var(--pl-text); font: inherit; font-size: 13px;
}

.pl-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--pl-line); }
.pl-tab {
    height: 44px; padding: 0 16px; border: none; border-bottom: 2px solid transparent;
    background: transparent; color: var(--pl-muted); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.pl-tab[aria-selected="true"] { border-bottom-color: var(--pl-text); color: var(--pl-text); font-weight: 600; }

.pl-switch {
    position: relative; width: 52px; height: 30px; padding: 0; flex: none;
    border-radius: 15px; border: 1px solid #475569; background: var(--pl-raise); cursor: pointer;
}
.pl-switch::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px; border-radius: 50%; background: var(--pl-muted);
    transition: left .15s ease;
}
.pl-switch[aria-pressed="true"] { background: var(--pl-text); border-color: var(--pl-text); }
.pl-switch[aria-pressed="true"]::after { left: 25px; background: var(--pl-panel); }
.pl-switch:disabled { opacity: .5; cursor: not-allowed; }

.pl-pending {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px; border-radius: 12px;
    background: var(--pl-panel); border: 1px solid #7c2d12;
}
.pl-pending strong { color: #fed7aa; font-size: 13px; }

@media (max-width: 640px) {
    .pl-main { padding: 20px 16px 32px; }
    .pl-fields { grid-template-columns: minmax(0, 1fr); }
}

.pl-shell .visually-hidden {
    position: absolute !important; width: 1px !important; height: 1px !important;
    padding: 0 !important; margin: -1px !important; overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}

/* ---------- Formularios y asistente de alta ---------- */
.pl-form-card { max-width: 760px; }
.pl-form-card .pl-card-body { gap: 18px; }
.pl-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pl-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--pl-text-2); }
.pl-label--inline { flex-direction: row; align-items: center; gap: 8px; color: var(--pl-muted); }
.pl-input {
    height: 44px; padding: 0 12px; border-radius: 8px; box-sizing: border-box;
    border: 1px solid var(--pl-line-strong); background: var(--pl-bg);
    color: var(--pl-text); font: inherit; font-size: 14px;
}
.pl-input:focus { border-color: var(--pl-accent); outline: none; }
.pl-input--mono { font-family: var(--pl-mono); }
.pl-input::placeholder { color: var(--pl-faint); }
select.pl-input { padding: 0 10px; color-scheme: dark; }
.pl-form-actions {
    display: flex; justify-content: space-between; gap: 10px;
    padding-top: 12px; border-top: 1px solid var(--pl-line);
}

.pl-steps {
    margin: 0; padding: 0; list-style: none;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px;
    max-width: 760px;
}
.pl-step {
    display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 8px;
    border: 1px solid var(--pl-line); background: var(--pl-panel);
    color: var(--pl-muted); font-size: 13px; font-weight: 500;
}
.pl-step-num {
    width: 24px; height: 24px; border-radius: 50%; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--pl-raise); font-size: 12px; font-weight: 700;
}
.pl-step--actual { border-color: var(--pl-text); background: var(--pl-raise); color: var(--pl-text); }
.pl-step--actual .pl-step-num { background: var(--pl-text); color: var(--pl-panel); }
.pl-step--hecho { color: var(--pl-text); }
.pl-step--hecho .pl-step-num { background: #166534; color: #bbf7d0; }
