/* ════════════════════════════════════════════════════════════════════
   ABM System · shell.css
   Estilos comunes del armazón (cabecera + sidebar + paneles) compartidos
   por la lanzadera (index.html) y las 4 apps. Extraído del index monolítico
   sin cambios de aspecto. Lo nuevo va al final: lanzadera y breadcrumb.
   ════════════════════════════════════════════════════════════════════ */

:root {
    --bg-0:       #0b1220;
    --bg-1:       #111827;
    --bg-2:       #1e293b;
    --bg-3:       #273449;
    --bg-card:    #1e293b;
    --bg-hover:   #273449;
    --bg-active:  rgba(245,158,11,0.10);

    --border-0:   #334155;
    --border-1:   #475569;
    --border-accent: rgba(245,158,11,0.5);

    --text-0:     #f1f5f9;
    --text-1:     #cbd5e1;
    --text-2:     #94a3b8;
    --text-3:     #64748b;

    --accent:     #f59e0b;
    --accent-h:   #fbbf24;
    --accent-glow: rgba(245,158,11,0.14);
    --orange:     #f97316;
    --cyan:       #06b6d4;
    --purple:     #8b5cf6;
    --green:      #10b981;
    --red:        #ef4444;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.25);
    --shadow:    0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg: 0 12px 36px rgba(0,0,0,0.5);

    --sidebar-width: 264px;
    --topbar-height: 56px;
    --radius:    8px;
    --radius-lg: 12px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}
html[data-theme="light"] {
    --bg-0:       #f1f5f9;
    --bg-1:       #ffffff;
    --bg-2:       #ffffff;
    --bg-3:       #f1f5f9;
    --bg-card:    #ffffff;
    --bg-hover:   #f1f5f9;
    --bg-active:  rgba(245,158,11,0.10);

    --border-0:   #e2e8f0;
    --border-1:   #cbd5e1;
    --border-accent: rgba(217,119,6,0.5);

    --text-0:     #0f172a;
    --text-1:     #334155;
    --text-2:     #64748b;
    --text-3:     #94a3b8;

    --accent:     #d97706;
    --accent-h:   #b45309;
    --accent-glow: rgba(217,119,6,0.12);
    --orange:     #ea580c;
    --cyan:       #0891b2;
    --purple:     #7c3aed;
    --green:      #059669;
    --red:        #dc2626;

    --shadow-sm: 0 1px 2px rgba(15,23,42,0.06);
    --shadow:    0 4px 14px rgba(15,23,42,0.08);
    --shadow-lg: 0 12px 28px rgba(15,23,42,0.14);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-sans);
    background: var(--bg-0);
    color: var(--text-0);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    font-size: 13px;
    transition: background-color 220ms ease, color 220ms ease;
}

/* ══════════════════ TOPBAR ══════════════════ */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-height);
    background: var(--bg-1);
    border-bottom: 1px solid var(--border-0);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 100;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: background-color 220ms ease, border-color 220ms ease;
}
.topbar-brand {
    display: flex; align-items: center; gap: 10px;
    width: var(--sidebar-width);
    padding-right: 12px;
    height: 100%;
    border-right: 1px solid var(--border-0);
}
.brand-home { display:flex; align-items:center; gap:8px; text-decoration:none; }
.brand-mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--orange));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono);
    font-size: 16px; font-weight: 800;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(245,158,11,0.4);
    letter-spacing: -0.04em;
}
.brand-cons {
    width: 30px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px;
    filter: grayscale(0.1);
}
.topbar-brand .brand-name {
    font-size: 13px;
    color: var(--text-0);
    letter-spacing: 0.2px;
    font-weight: 700;
}
.topbar-brand .brand-sub {
    font-size: 10px;
    color: var(--text-2);
    letter-spacing: 0.3px;
    font-weight: 500;
}

.topbar-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--text-2);
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.topbar-breadcrumb .bc-sep { color: var(--text-3); }
.topbar-breadcrumb .bc-active { color: var(--accent); font-weight: 600; }
.topbar-breadcrumb .bc-link {
    color: var(--text-2);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
    border-radius: 5px;
    padding: 2px 4px;
}
.topbar-breadcrumb .bc-link:hover { color: var(--accent); background: var(--accent-glow); }
.topbar-breadcrumb .bc-mid { color: var(--text-2); }

.topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user .user-name { font-size: 12px; color: var(--text-0); font-weight: 600; }
.topbar-user .user-role {
    font-size: 10px;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid var(--border-accent);
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.4px;
}
.icon-btn {
    background: var(--bg-3);
    border: 1px solid var(--border-0);
    color: var(--text-1);
    width: 34px; height: 34px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--border-accent); }
.btn-logout {
    background: transparent;
    border: 1px solid var(--border-0);
    color: var(--text-2);
    padding: 6px 12px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border-radius: var(--radius);
}
.btn-logout:hover { background: rgba(239,68,68,0.10); border-color: var(--red); color: var(--red); }

/* ══════════════════ SIDEBAR ══════════════════ */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-1);
    border-right: 1px solid var(--border-0);
    overflow-y: auto;
    z-index: 90;
    display: flex;
    flex-direction: column;
    transition: width 0.22s ease, background-color 220ms ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-0); border-radius: 2px; }

.sidebar-section { padding: 6px 12px; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--border-0); }

.sidebar-section-header {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 8px 8px;
    font-size: 10.5px;
    color: var(--text-3);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    font-weight: 700;
    transition: color 0.15s;
}
.sidebar-section-header:hover { color: var(--text-2); }
.sidebar-section-header .chevron {
    margin-left: auto;
    transition: transform 0.2s;
    font-size: 10px;
}
.sidebar-section-header.collapsed .chevron { transform: rotate(-90deg); }

.sidebar-section-items {
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.sidebar-section-items.collapsed { max-height: 0 !important; }

.sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px;
    margin: 2px 0;
    font-size: 12.5px;
    color: var(--text-1);
    cursor: pointer;
    transition: all 0.15s;
    border-radius: var(--radius);
    font-weight: 500;
    position: relative;
}
.sidebar-item:hover { background: var(--bg-3); color: var(--text-0); }
.sidebar-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}
.sidebar-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 8px; bottom: 8px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.sidebar-item .item-icon { font-size: 14px; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-item .item-badge {
    margin-left: auto;
    font-size: 9.5px;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.badge-new { background: var(--accent-glow); color: var(--accent); }
.badge-soon { background: rgba(249,115,22,0.15); color: var(--orange); }
.badge-dev { background: rgba(139,92,246,0.15); color: var(--purple); }

.sidebar-footer {
    margin-top: auto;
    padding: 14px 18px;
    border-top: 1px solid var(--border-0);
    font-size: 10.5px;
    color: var(--text-3);
    text-align: center;
    font-weight: 500;
}
.sidebar-footer img { height: 16px; opacity: 0.45; margin: 0 auto 6px; display: block; }

/* ── Sidebar collapse ── */
.sidebar-toggle {
    position: absolute; top: 8px; right: -12px;
    width: 24px; height: 24px;
    background: var(--bg-1);
    border: 1px solid var(--border-0);
    border-radius: 50%;
    color: var(--text-2); font-size: 10px;
    cursor: pointer; z-index: 95;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
    box-shadow: var(--shadow-sm);
}
.sidebar-toggle:hover { color: var(--accent); border-color: var(--accent); }

body.sb-collapsed { --sidebar-width: 60px; }
body.sb-collapsed .sidebar { width: 60px; }
body.sb-collapsed .sidebar-section-header > span:first-child,
body.sb-collapsed .sidebar-section-header .chevron,
body.sb-collapsed .sidebar-item > *:not(.item-icon),
body.sb-collapsed .sidebar-footer { display: none; }
body.sb-collapsed .sidebar-item { justify-content: center; padding: 9px 6px; }
body.sb-collapsed .brand-sub,
body.sb-collapsed .brand-name { display: none; }
body.sb-collapsed .topbar-brand { width: 60px; padding-right: 0; border-right: 1px solid var(--border-0); justify-content: center; }
body.sb-collapsed .sidebar-toggle .tgl-arrow { transform: rotate(180deg); }
body.sb-collapsed .sidebar-section-header { padding: 14px 0 6px; justify-content: center; }
body.sb-collapsed .sidebar-section { padding: 6px 8px; }

/* Vertical collapsed title */
.sidebar-collapsed-title {
    display: none;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    color: var(--accent);
    font-size: 10px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    font-weight: 800;
    padding: 18px 0;
    margin: auto 0;
    text-align: center;
    white-space: nowrap;
    user-select: none;
    opacity: 0.7;
}
body.sb-collapsed .sidebar-collapsed-title { display: block; }

/* ══════════════════ FULLSCREEN MODE (v4) ══════════════════ */
body.gc4-maximized .topbar { display:none !important; }
body.gc4-maximized .sidebar { display:none !important; }
body.gc4-maximized .main-content { top:0 !important; left:0 !important; }
body.gc4-maximized .panel-header { display:none !important; }

/* ══════════════════ MAIN CONTENT ══════════════════ */
.main-content {
    position: fixed;
    top: var(--topbar-height);
    left: var(--sidebar-width);
    right: 0;
    bottom: 0;
    overflow-y: auto;
    background: var(--bg-0);
    transition: left 0.22s ease, background-color 220ms ease;
}
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-0); border-radius: 3px; }

/* ── Panel ── */
.panel { display: none; height: 100%; }
.panel.active { display: flex; flex-direction: column; }

.panel-header {
    padding: 22px 30px 16px;
    border-bottom: 1px solid var(--border-0);
    flex-shrink: 0;
}
.panel-header h2 {
    font-size: 18px;
    color: var(--text-0);
    font-weight: 700;
    letter-spacing: -0.01em;
}
.panel-header p {
    font-size: 12.5px;
    color: var(--text-2);
    margin-top: 4px;
    font-weight: 500;
}

.panel-body { flex: 1; padding: 24px 30px; overflow-y: auto; }

/* ── Panel tool (iframe container) ── */
.tool-container { flex: 1; position: relative; }
.tool-container iframe {
    width: 100%; height: 100%;
    border: none;
    background: var(--bg-0);
}

/* ── Panel placeholder ── */
.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-3);
    text-align: center;
    gap: 18px;
}
.placeholder-icon { font-size: 56px; opacity: 0.35; }
.placeholder-title { font-size: 18px; color: var(--text-1); font-weight: 600; }
.placeholder-desc { font-size: 13px; max-width: 450px; line-height: 1.6; color: var(--text-2); }
.placeholder-status {
    font-size: 10.5px;
    letter-spacing: 1.5px;
    padding: 5px 14px;
    border: 1px solid;
    border-radius: 999px;
    font-weight: 700;
}
.status-ready   { color: var(--accent); border-color: var(--border-accent); background: var(--accent-glow); }
.status-dev     { color: var(--orange); border-color: rgba(249,115,22,0.35); background: rgba(249,115,22,0.1); }
.status-planned { color: var(--purple); border-color: rgba(139,92,246,0.35); background: rgba(139,92,246,0.1); }

.hidden { display: none !important; }

/* ══════════════════ RESPONSIVE (app shells) ══════════════════ */
@media (max-width: 768px) {
    body:not(.launcher) { --sidebar-width: 0px; }
    body:not(.launcher) .sidebar { transform: translateX(-264px); transition: transform 0.3s; width: 264px; }
    body:not(.launcher) .sidebar.open { transform: translateX(0); }
    .topbar-brand { width: auto; border-right: none; }
}

/* ════════════════════════════════════════════════════════════════════
   NUEVO · LANZADERA (index.html)
   ════════════════════════════════════════════════════════════════════ */
body.launcher .topbar-brand { width: auto; border-right: none; padding-right: 16px; }

.launcher-wrap {
    position: fixed;
    top: var(--topbar-height);
    left: 0; right: 0; bottom: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.9fr);
    gap: 0;
    overflow: hidden;
}
.launcher-main {
    overflow-y: auto;
    padding: 30px 32px 40px;
}
.launcher-aside {
    overflow-y: auto;
    padding: 24px 22px 40px;
    background: var(--bg-1);
    border-left: 1px solid var(--border-0);
}
.launcher-main::-webkit-scrollbar,
.launcher-aside::-webkit-scrollbar { width: 6px; }
.launcher-main::-webkit-scrollbar-thumb,
.launcher-aside::-webkit-scrollbar-thumb { background: var(--border-0); border-radius: 3px; }

.launcher-hero { margin-bottom: 26px; }
.launcher-hero h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; color: var(--text-0); }
.launcher-hero p { font-size: 13px; color: var(--text-2); margin-top: 6px; font-weight: 500; }

.section-title {
    font-size: 11px; color: var(--text-3); text-transform: uppercase;
    letter-spacing: 2px; font-weight: 700; margin: 4px 0 16px;
    display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ''; flex: 1; height: 1px; background: var(--border-0); }

/* ── App cards (las 4) ── */
.app-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
.app-card {
    --c: var(--accent);
    background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
    border: 2px solid var(--border-0);
    border-radius: 18px;
    padding: 26px 24px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.22s;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 178px;
}
.app-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 6px; height: 100%; background: var(--c);
}
.app-card::after {
    content: '→'; position: absolute; right: 22px; top: 22px;
    font-size: 22px; color: var(--text-3); transition: all 0.22s;
}
.app-card:hover { transform: translateY(-5px); border-color: var(--c); box-shadow: 0 12px 34px rgba(0,0,0,0.32); }
.app-card:hover::after { color: var(--c); transform: translateX(5px); }
.app-card .ac-ico {
    width: 56px; height: 56px; border-radius: 15px;
    background: var(--c); color: #0b1220;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; font-weight: 700; margin-bottom: 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.app-card .ac-tag {
    font-size: 10px; font-weight: 800; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--c); margin-bottom: 6px;
}
.app-card .ac-title { font-size: 18px; font-weight: 800; color: var(--text-0); letter-spacing: -0.01em; margin-bottom: 7px; }
.app-card .ac-desc { font-size: 12.5px; color: var(--text-2); line-height: 1.5; font-weight: 500; }
.app-card.c-bim        { --c: var(--cyan); }
.app-card.c-gestion    { --c: var(--accent); }
.app-card.c-inspeccion { --c: var(--purple); }
.app-card.c-entregables{ --c: var(--green); }
.app-card.is-soon { opacity: 0.92; }
.app-card.is-soon .ac-tag::after { content: ' · próximamente'; color: var(--text-3); }

/* ── Tablero lateral (indicadores / recordatorios) ── */
.board-head { font-size: 13px; font-weight: 700; color: var(--text-0); margin-bottom: 4px; }
.board-sub  { font-size: 11px; color: var(--text-3); margin-bottom: 18px; font-weight: 500; }

.board-tile {
    display: flex; align-items: center; gap: 13px;
    padding: 13px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-0);
    border-radius: 12px;
    margin-bottom: 11px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.16s;
}
.board-tile:hover { border-color: var(--bt-c, var(--accent)); transform: translateX(3px); }
.board-tile .bt-ico {
    width: 38px; height: 38px; flex-shrink: 0; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    background: color-mix(in srgb, var(--bt-c, var(--accent)) 16%, transparent);
    color: var(--bt-c, var(--accent));
}
.board-tile .bt-body { flex: 1; min-width: 0; }
.board-tile .bt-label { font-size: 12.5px; color: var(--text-0); font-weight: 600; }
.board-tile .bt-hint  { font-size: 10.5px; color: var(--text-3); font-weight: 500; }
.board-tile .bt-count {
    font-size: 15px; font-weight: 800; color: var(--text-2);
    font-family: var(--font-mono); min-width: 26px; text-align: right;
}
.board-tile .bt-count.has { color: var(--bt-c, var(--accent)); }
.bt-tareas      { --bt-c: var(--accent); }
.bt-incidencias { --bt-c: var(--orange); }
.bt-nc          { --bt-c: var(--red); }
.bt-valid       { --bt-c: var(--cyan); }
.bt-msg         { --bt-c: var(--purple); }

.board-note {
    margin-top: 16px; font-size: 10.5px; color: var(--text-3);
    line-height: 1.5; font-weight: 500; opacity: 0.85;
}

@media (max-width: 960px) {
    .launcher-wrap { grid-template-columns: 1fr; overflow-y: auto; }
    .launcher-aside { border-left: none; border-top: 1px solid var(--border-0); }
}
