/* ============================================================================
   restyling-cosentino.css  —  v3 (2026-04-13)
   Overlay premium Cosentino — Layout Image-2: right panel unificado.
   Se carga DESPUÉS de styles.css.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── Custom Properties ──────────────────────────────────────────────────── */
:root {
    --cos-bg:            #F4F3F0;
    --cos-bg-hover:      #EEEDEA;
    --cos-surface:       #FFFFFF;
    --cos-sidebar:       #111110;
    --cos-sidebar-hover: #1C1C1B;
    --cos-gold:          #C8A97E;
    --cos-gold-dim:      #B89A6F;
    --cos-gold-glow:     rgba(200,169,126,0.25);
    --cos-gold-bg:       rgba(200,169,126,0.08);
    --cos-text:          #1A1A1A;
    --cos-text-sec:      #7A7A78;
    --cos-text-muted:    #A3A39E;
    --cos-border:        rgba(0,0,0,0.07);
    --cos-border-light:  rgba(0,0,0,0.04);
    --cos-success:       #2D8B6F;
    --cos-danger:        #C44040;
    --cos-warning:       #D4A030;
    --cos-info:          #5A7FAA;
    --primary-color:   #1A1A1A;  --primary-hover: #333;
    --secondary-color: #7A7A78;
    --success-color: var(--cos-success); --danger-color: var(--cos-danger);
    --warning-color: var(--cos-warning); --info-color: var(--cos-info);
    --bg-primary: var(--cos-surface); --bg-secondary: var(--cos-bg); --bg-tertiary: #EEEDEA;
    --card-bg: var(--cos-surface); --border-color: var(--cos-border);
    --text-primary: var(--cos-text); --text-secondary: var(--cos-text-sec);
    --shadow: 0 1px 3px rgba(0,0,0,0.06); --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
}

/* ═══════ GLOBAL TYPOGRAPHY ═══════════════════════════════════════════════ */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--cos-bg); color: var(--cos-text);
    font-size: 13px; line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { font-family: inherit; }

/* ═══════ SIDEBAR ════════════════════════════════════════════════════════ */
.hd-sidebar {
    background: var(--cos-sidebar) !important;
    border-right: none !important;
    position: relative;
    display: flex; flex-direction: column;
    padding-top: 3px !important;
    width: 260px !important;
}
.hd-sidebar::before {
    content: '';  position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #C8A97E 0%, #D4B896 35%, #C0805A 70%, #C8A97E 100%);
    z-index: 1;
}

/* Brand (antes en header, ahora en sidebar) */
.cos-sidebar-brand {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1.1rem 1rem 0.7rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 0.25rem; flex-shrink: 0;
}
.cos-brand-logo { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; flex-shrink: 0; transition: transform .15s; }
.cos-brand-logo:hover { transform: scale(1.07); }
.cos-brand-text { display: flex; flex-direction: column; min-width: 0; }
.cos-brand-title {
    font-size: 15px; font-weight: 700; color: #ECECEA;
    line-height: 1.2; letter-spacing: -0.01em;
}
.cos-brand-sub {
    font-size: 9px; font-weight: 600; color: var(--cos-gold);
    text-transform: uppercase; letter-spacing: 0.12em; opacity: 0.85;
}

/* Nav wrap */
.cos-nav-wrap { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0.4rem 0.65rem; }

/* Group labels */
.cos-nav-group-label {
    text-transform: uppercase; letter-spacing: 0.1em;
    font-size: 9.5px; font-weight: 700;
    color: rgba(255,255,255,0.3);
    padding: 0.85rem 0.5rem 0.25rem; user-select: none;
}
.cos-nav-wrap .cos-nav-group-label:first-child { padding-top: 0.25rem; }

/* Nav buttons */
.hd-nav-btn {
    font-size: 13px; font-weight: 400; color: #B0B0AD;
    border-radius: 7px; padding: 0.48rem 0.6rem;
    transition: all 0.18s ease;
    border-left: 3px solid transparent;
    display: flex; align-items: center; gap: 0.5rem; margin: 1px 0;
}
.hd-nav-btn:hover { background: var(--cos-sidebar-hover); color: #E8E8E5; border-left-color: rgba(200,169,126,0.3); }
.hd-nav-btn.active {
    background: rgba(200,169,126,0.08) !important; color: var(--cos-gold) !important;
    font-weight: 600; border-left-color: var(--cos-gold); box-shadow: none !important;
}
.hd-nav-btn.active .hd-nav-icon { opacity: 1; }
.hd-nav-icon { font-size: 14px; opacity: 0.6; width: 22px; text-align: center; flex-shrink: 0; }

/* Nav badges */
.hd-nav-btn .hd-list-badge {
    background: var(--cos-gold) !important; color: var(--cos-sidebar) !important;
    font-size: 9.5px !important; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
}


/* ═══════ SIDEBAR FOOTER (Image-2: horizontal label:value) ═══════════════ */
.cos-sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 0.65rem 0.8rem 0.55rem;
}
.cos-footer-row {
    display: flex; align-items: center; gap: 0.45rem;
    margin-bottom: 0.3rem;
}
.cos-footer-label {
    font-size: 11px; color: rgba(255,255,255,0.45);
    flex: 1; min-width: 0;
}
.cos-footer-value {
    font-size: 11px; font-weight: 600; color: #ddd;
    text-align: right; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
    max-width: 120px;
}
#hd-current-model {
    color: #ddd !important; font-weight: 600 !important;
    font-size: 11px !important; text-align: right;
}
.cos-model-dot { background: var(--cos-gold) !important; animation: none !important; }
.cos-footer-meta {
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 0.35rem; padding-top: 0.35rem;
}
.cos-footer-version { font-size: 9px; color: rgba(255,255,255,0.22); }
.cos-footer-datetime { font-size: 9px; color: rgba(255,255,255,0.22); display: none; }
.cos-footer-user { display: flex; align-items: center; gap: 0.35rem; margin-top: 0.3rem; }
.cos-user-role {
    font-size: 9px; font-weight: 700; padding: 0.08rem 0.35rem;
    border-radius: 4px; text-transform: uppercase; letter-spacing: 0.04em;
    background: rgba(200,169,126,0.12); color: var(--cos-gold);
    border: 1px solid rgba(200,169,126,0.2);
}
.cos-user-name {
    font-size: 11px; color: #ccc; flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cos-logout-btn {
    background: rgba(239,68,68,0.08) !important;
    border: 1px solid rgba(239,68,68,0.2) !important;
    color: #ef4444 !important; border-radius: 5px !important;
    padding: 0.15rem 0.4rem !important; font-size: 12px !important;
    cursor: pointer; flex-shrink: 0;
}

/* Status dots */
.status-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--cos-text-muted); flex-shrink: 0; display: inline-block;
    transition: background 0.3s;
}
.status-dot.online { background: var(--cos-success); box-shadow: 0 0 6px rgba(45,139,111,0.5); animation: none; }
@keyframes cos-amber-pulse {
    0%,100% { opacity:1; box-shadow: 0 0 4px rgba(200,169,126,0.4); }
    50%     { opacity:0.6; box-shadow: 0 0 8px rgba(200,169,126,0.2); }
}
.status-dot:not(.online):not(.cos-model-dot) { animation: cos-amber-pulse 2s ease-in-out infinite; background: var(--cos-warning); }


/* ═══════ SIDEBAR TOGGLE ═════════════════════════════════════════════════ */
#sidebar-nav-toggle {
    background: var(--cos-sidebar) !important; color: var(--cos-gold) !important;
    border-radius: 0 8px 8px 0 !important; left: 260px !important;
}
#sidebar-nav-toggle:hover { background: var(--cos-sidebar-hover) !important; }
.sidebar-collapse-tab { color: var(--cos-gold) !important; }


/* ═══════ APP HEADER ════════════════════════════════════════════════════ */
/* Header oculto: branding movido al sidebar */
.app-header {
    display: none !important;
}


/* ═══════ SESSION BAR ════════════════════════════════════════════════════ */
.cos-session-bar {
    display: flex; align-items: center; gap: 1rem;
    padding: 0.5rem 0; margin-bottom: 0.15rem;
    border-bottom: 1px solid var(--cos-border-light);
}
.cos-session-title {
    font-size: 15px !important; font-weight: 700 !important;
    color: var(--cos-text) !important; margin: 0 !important;
    letter-spacing: -0.01em;
}
.cos-session-info {
    font-size: 12px; color: var(--cos-text-muted);
    flex: 1;
}
.cos-session-expand {
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 500;
    color: var(--cos-text-sec); background: var(--cos-surface);
    border: 1px solid var(--cos-border); border-radius: 8px;
    padding: 0.3rem 0.75rem; cursor: pointer;
    transition: all 0.2s ease; white-space: nowrap;
}
.cos-session-expand:hover { border-color: var(--cos-gold); color: var(--cos-gold); }

/* Page subtitle */
.cos-page-subtitle {
    margin-bottom: 0.35rem; padding-left: 0;
}
.cos-page-subtitle h2 { font-size: 16px !important; }


/* ═══════ LAYOUT OVERRIDE — widgets INSIDE right panel ═══════════════════ */

/* Kill the fixed positioning from styles.css */
#hd-widgets-bar {
    position: static !important;
    width: 100% !important;
    top: auto !important; right: auto !important; bottom: auto !important;
    z-index: auto !important;
    display: flex !important; flex-direction: column !important;
    gap: 0 !important;
    overflow: visible !important;
    transform: none !important;
}

/* Remove the padding reservation */
#hd-page-asistente {
    padding-right: 0 !important;
}

/* Hide the old panel toggle — right panel is now part of the split */
.cos-panel-toggle,
#widgets-panel-toggle {
    display: none !important;
}


/* ═══════ RIGHT PANEL — unified (.cos-right-panel) ═══════════════════════ */
.cos-right-panel {
    flex: 0 0 300px !important;
    max-width: 340px !important;
    min-width: 260px !important;
    display: flex !important; flex-direction: column !important;
    border: none !important;
    border-left: 1px solid var(--cos-border) !important;
    border-radius: 0 !important;
    background: var(--cos-bg) !important;
    overflow-y: auto !important;
    gap: 0;
}

/* ── Right panel section ── */
.cos-rp-section {
    border-bottom: 1px solid var(--cos-border-light);
}
.cos-rp-section.collapsed .cos-rp-body { display: none; }
.cos-rp-section.collapsed .cos-rp-chevron { transform: rotate(-90deg); }

.cos-rp-header {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.65rem 0.85rem;
    cursor: pointer; user-select: none;
    transition: background 0.15s;
}
.cos-rp-header:hover { background: var(--cos-bg-hover); }

.cos-rp-icon { font-size: 13px; opacity: 0.5; }
.cos-rp-title {
    font-size: 11.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--cos-text-sec); flex: 1;
}
.cos-rp-chevron {
    font-size: 10px; color: var(--cos-text-muted);
    transition: transform 0.2s; margin-left: auto;
}
.cos-rp-badge {
    background: var(--cos-danger); color: #fff;
    font-size: 10px; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
}
.cos-rp-body {
    padding: 0.5rem 0.85rem 0.75rem;
}

/* Select inside right panel */
.cos-rp-select {
    width: 100%; padding: 0.4rem 0.6rem;
    border: 1px solid var(--cos-border) !important;
    border-radius: 8px !important;
    background: var(--cos-surface) !important;
    color: var(--cos-text) !important;
    font-size: 12.5px !important;
    font-weight: 600;
    cursor: pointer; margin-bottom: 0.5rem;
}

/* Rows in right panel */
.cos-rp-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.5rem;
}

/* Button in right panel sections */
.cos-rp-btn {
    display: block; width: 100%;
    padding: 0.4rem 0.75rem;
    background: var(--cos-surface) !important;
    border: 1px solid var(--cos-border) !important;
    border-radius: 8px !important;
    color: var(--cos-text-sec) !important;
    font-size: 12px !important; font-weight: 500;
    cursor: pointer; text-align: center;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
    font-family: 'Inter', sans-serif !important;
}
.cos-rp-btn:hover {
    border-color: var(--cos-gold) !important;
    color: var(--cos-gold) !important;
}

/* Widgets container inside right panel */
.cos-rp-widgets {
    display: flex; flex-direction: column;
}
.cos-rp-widgets > .cos-rp-section { width: 100% !important; }

/* Proposal container */
#hd-proposal-container {
    overflow-y: auto; padding: 0.5rem 0.85rem;
}

/* Machine metrics */
#cos-machine-metrics { margin-bottom: 0.4rem; }


/* ═══════ ALERTS inside right panel — override old inline styles ═════════ */
#alerts-header {
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0.65rem 0.85rem !important;
}
#alerts-body {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 0.85rem 0.75rem !important;
}
#hd-alerts-wrapper { width: 100% !important; }


/* ═══════ LAYOUT FIX ════════════════════════════════════════════════════ */
.hd-layout { display: flex !important; height: 100%; }

/* ═══════ MAIN CONTENT ══════════════════════════════════════════════════ */
.hd-main-content { background: var(--cos-bg); padding: 0.7rem 1.5rem !important; }
.hd-page h2 { font-size: 17px !important; font-weight: 700 !important; color: var(--cos-text) !important; }
.hd-page p { font-size: 13px; color: var(--cos-text-sec); }

/* Keep all non-chat pages scrollable when expanded content is taller than viewport. */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.hd-layout {
    min-height: 0;
}

.hd-main-content {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#hd-page-knowledge.active,
#hd-page-knowledge-management.active {
    min-height: 0;
    overflow-y: visible;
}

/* "En línea" badge */
[style*="background:rgba(16,185,129"],
[style*="background: rgba(16,185,129"] {
    background: rgba(200,169,126,0.1) !important; color: var(--cos-gold-dim) !important;
    border-radius: 20px !important; font-size: 11px !important; font-weight: 600 !important;
}
[style*="border:1px solid rgba(16,185,129"],
[style*="border: 1px solid rgba(16,185,129"] {
    border-color: rgba(200,169,126,0.25) !important;
}

/* Context bar badges — unify colors */
.hd-list-badge {
    font-family: 'Inter', sans-serif !important;
}
#hd-chat-messages .hd-list-badge[style*="color:#fbbf24"],
#hd-chat-messages .hd-list-badge[style*="color: #fbbf24"] {
    background: var(--cos-gold-bg) !important;
    color: var(--cos-gold) !important;
    border-color: rgba(200,169,126,0.35) !important;
}
#hd-chat-messages .hd-list-badge[style*="color:#a5b4fc"],
#hd-chat-messages .hd-list-badge[style*="color: #a5b4fc"] {
    background: rgba(200,169,126,0.06) !important;
    color: var(--cos-gold-dim) !important;
    border-color: rgba(200,169,126,0.25) !important;
}
#hd-chat-messages .hd-list-badge[style*="color:#34d399"],
#hd-chat-messages .hd-list-badge[style*="color: #34d399"] {
    background: rgba(45,139,111,0.06) !important;
    color: var(--cos-success) !important;
    border-color: rgba(45,139,111,0.2) !important;
}
#hd-chat-messages .hd-list-badge[style*="color:#c084fc"],
#hd-chat-messages .hd-list-badge[style*="color: #c084fc"] {
    background: rgba(200,169,126,0.06) !important;
    color: var(--cos-gold) !important;
    border-color: rgba(200,169,126,0.25) !important;
}
#hd-chat-messages .hd-list-badge[style*="color:#f59e0b"],
#hd-chat-messages .hd-list-badge[style*="color: #f59e0b"] {
    background: var(--cos-gold-bg) !important;
    color: var(--cos-gold) !important;
    border-color: rgba(200,169,126,0.35) !important;
}
#hd-chat-messages .hd-list-badge[style*="color:#10b981"],
#hd-chat-messages .hd-list-badge[style*="color: #10b981"] {
    background: rgba(45,139,111,0.06) !important;
    color: var(--cos-success) !important;
    border-color: rgba(45,139,111,0.2) !important;
}

/* Suggestion chips */
#mode-chat button[onclick*="quickPrompt"] {
    font-size: 12px !important; font-weight: 500 !important;
    border-radius: 20px !important; border: 1px solid var(--cos-border) !important;
    background: var(--cos-surface) !important; color: var(--cos-text) !important;
    padding: 0.4rem 0.85rem !important; box-shadow: none !important;
}
#mode-chat button[onclick*="quickPrompt"]:hover {
    border-color: var(--cos-gold) !important; color: var(--cos-gold) !important;
    background: var(--cos-gold-bg) !important;
}


/* ═══════ CHAT MESSAGES ═════════════════════════════════════════════════ */
#hd-chat-messages {
    background: var(--cos-bg) !important; border-color: var(--cos-border) !important;
    border-radius: 12px !important;
}
/* Bot bubble — override inline #f1f5f9 / #e2e8f0 / #4f46e5 */
#hd-chat-messages > div > div[style*="justify-content:flex-start"] > div:last-child,
#hd-chat-messages > div > div[style*="justify-content: flex-start"] > div:last-child {
    background: var(--cos-surface) !important;
    border: 1px solid var(--cos-border) !important; color: var(--cos-text) !important;
    border-radius: 12px 12px 12px 2px !important; font-size: 13px !important;
    line-height: 1.55 !important; box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
}
/* "Asistente IT" label inside bot bubble */
#hd-chat-messages div[style*="color:#4f46e5"],
#hd-chat-messages div[style*="color:#4338ca"],
#hd-chat-messages div[style*="color: #4f46e5"] {
    color: var(--cos-gold) !important;
}
/* User bubble — override inline indigo gradient */
#hd-chat-messages > div > div[style*="justify-content:flex-end"] > div:last-child,
#hd-chat-messages > div > div[style*="justify-content: flex-end"] > div:last-child {
    background: #1A1A1A !important; color: #fff !important; border: none !important;
    border-radius: 12px 12px 2px 12px !important; font-size: 13px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
}
/* System bubbles — amber warning / blue actions */
#hd-chat-messages div[style*="background:#fef3c7"],
#hd-chat-messages div[style*="background: #fef3c7"] {
    background: var(--cos-gold-bg) !important;
    border-color: var(--cos-gold) !important;
    color: var(--cos-text) !important;
}
#hd-chat-messages div[style*="background:linear-gradient(135deg,#eff6ff"],
#hd-chat-messages div[style*="background: linear-gradient(135deg,#eff6ff"],
#hd-chat-messages div[style*="background:linear-gradient(135deg,#4f46e5"],
#hd-chat-messages div[style*="background: linear-gradient(135deg,#4f46e5"] {
    background: var(--cos-gold-bg) !important;
    border-color: rgba(200,169,126,0.3) !important;
    color: var(--cos-text) !important;
}
#hd-chat-messages div[style*="background:rgba(245,158,11"] {
    background: var(--cos-gold-bg) !important;
    border: 1px solid rgba(200,169,126,0.2) !important; border-radius: 10px !important;
}
/* Green confirm button → gold */
#hd-chat-messages button[style*="background:#22c55e"],
#hd-chat-messages button[style*="background: #22c55e"] {
    background: var(--cos-gold) !important;
    color: var(--cos-sidebar) !important;
    border: none !important;
    border-radius: 8px !important;
}
/* Red decline button → muted dark */
#hd-chat-messages button[style*="background:#ef4444"],
#hd-chat-messages button[style*="background: #ef4444"] {
    background: rgba(26,26,26,0.08) !important;
    color: var(--cos-text) !important;
    border: 1px solid var(--cos-border) !important;
    border-radius: 8px !important;
}
#hd-chat-messages button[style*="background:#ef4444"]:hover,
#hd-chat-messages button[style*="background: #ef4444"]:hover {
    border-color: var(--cos-danger) !important;
    color: var(--cos-danger) !important;
}
/* Blue action bubble borders → gold */
#hd-chat-messages div[style*="border:1px solid #60a5fa"],
#hd-chat-messages div[style*="border: 1px solid #60a5fa"] {
    background: var(--cos-gold-bg) !important;
    border-color: rgba(200,169,126,0.3) !important;
    color: var(--cos-text) !important;
}
/* Ticket flow bubble — indigo → warm neutral */
#hd-chat-messages div[style*="background:#eef2ff"],
#hd-chat-messages div[style*="background: #eef2ff"] {
    background: var(--cos-surface) !important;
    border-color: var(--cos-border) !important;
    color: var(--cos-text) !important;
}
/* ACT inline badges — indigo → gold */
#hd-chat-messages span[style*="background:rgba(99,102,241"],
#hd-chat-messages span[style*="background: rgba(99,102,241"] {
    background: var(--cos-gold-bg) !important;
    border-color: rgba(200,169,126,0.4) !important;
    color: var(--cos-gold-dim) !important;
}
/* Ticket badges */
#hd-chat-messages a[style*="background:rgba(79,70,229"],
#hd-chat-messages a[style*="background: rgba(79,70,229"] {
    background: var(--cos-gold-bg) !important;
    border-color: rgba(200,169,126,0.35) !important;
    color: var(--cos-gold-dim) !important;
}
/* Execute action buttons — indigo → gold */
#hd-chat-messages button[style*="color:#4338ca"],
#hd-chat-messages button[style*="color: #4338ca"] {
    background: var(--cos-gold-bg) !important;
    border-color: rgba(200,169,126,0.4) !important;
    color: var(--cos-gold-dim) !important;
}
/* Simulate buttons — purple → muted */
#hd-chat-messages button[style*="color:#7c3aed"],
#hd-chat-messages button[style*="color: #7c3aed"] {
    background: rgba(200,169,126,0.06) !important;
    border-color: rgba(200,169,126,0.3) !important;
    color: var(--cos-text-muted) !important;
}
/* Action bar heading inside chat */
#hd-chat-messages div[style*="color:#4338ca"][style*="font-weight:700"] {
    color: var(--cos-gold-dim) !important;
}
/* Context bar border */
#hd-chat-messages div[style*="border-top:1px solid #c7d2fe"],
#hd-chat-messages div[style*="border-top: 1px solid #c7d2fe"],
#hd-chat-messages div[style*="border-top:1px solid #e2e8f0"],
#hd-chat-messages div[style*="border-top: 1px solid #e2e8f0"] {
    border-top-color: var(--cos-border) !important;
}
/* Remedy purple buttons → gold/dark */
#hd-chat-messages button[style*="background:#4f46e5"],
#hd-chat-messages button[style*="background: #4f46e5"] {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
    border: none !important;
    border-radius: 8px !important;
}
/* Remedy escalate red → outline */
#hd-chat-messages button[style*="color:#dc2626"],
#hd-chat-messages button[style*="color: #dc2626"] {
    color: var(--cos-danger) !important;
    border-color: rgba(196,64,64,0.25) !important;
    background: rgba(196,64,64,0.05) !important;
}
/* Remedy panel background */
#hd-chat-messages div[style*="background:rgba(79,70,229"],
#hd-chat-messages div[style*="background: rgba(79,70,229"] {
    background: var(--cos-gold-bg) !important;
    border-color: rgba(200,169,126,0.25) !important;
}
/* Ticket form labels/fields */
#hd-chat-messages label[style*="color:#4f46e5"],
#hd-chat-messages label[style*="color: #4f46e5"] {
    color: var(--cos-gold-dim) !important;
}
#hd-chat-messages input[style*="border:1px solid #c7d2fe"],
#hd-chat-messages input[style*="border: 1px solid #c7d2fe"],
#hd-chat-messages textarea[style*="border:1px solid #c7d2fe"],
#hd-chat-messages textarea[style*="border: 1px solid #c7d2fe"],
#hd-chat-messages select[style*="border:1px solid #c7d2fe"],
#hd-chat-messages select[style*="border: 1px solid #c7d2fe"] {
    border-color: var(--cos-border) !important;
    background: var(--cos-surface) !important;
    color: var(--cos-text) !important;
}
/* Resolved/escalated result bubbles */
#hd-chat-messages div[style*="background:rgba(5,150,105"],
#hd-chat-messages div[style*="background: rgba(5,150,105"] {
    background: rgba(45,139,111,0.06) !important;
    border-color: rgba(45,139,111,0.2) !important;
    color: var(--cos-success) !important;
}
#hd-chat-messages div[style*="background:rgba(239,68,68"],
#hd-chat-messages div[style*="background: rgba(239,68,68"],
#hd-chat-messages div[style*="background:rgba(239,68,68,.06"],
#hd-chat-messages div[style*="background: rgba(239,68,68,.06"] {
    background: rgba(196,64,64,0.05) !important;
    border-color: rgba(196,64,64,0.2) !important;
    color: var(--cos-danger) !important;
}
/* Auto-exec green analysis bubble */
#hd-chat-messages div[style*="background:#f0fdf4"],
#hd-chat-messages div[style*="background: #f0fdf4"] {
    background: var(--cos-gold-bg) !important;
    border-color: rgba(200,169,126,0.3) !important;
    color: var(--cos-text) !important;
}
/* Separator */
#hd-chat-messages div[style*="CONVERSACIÓN ANTERIOR"],
#hd-chat-messages div[style*="text-transform: uppercase"] {
    font-size: 9.5px !important; font-weight: 600 !important;
    letter-spacing: 0.08em !important; color: var(--cos-text-muted) !important;
}
/* Avatar */
#hd-chat-messages div[style*="border-radius:50%"][style*="background"] {
    border: 2px solid rgba(200,169,126,0.3) !important;
}


/* ═══════ CHAT INPUT ════════════════════════════════════════════════════ */
#hd-chat-input {
    font-size: 13.5px !important; background: var(--cos-surface) !important;
    border: 1px solid var(--cos-border) !important; border-radius: 24px !important;
    color: var(--cos-text) !important; padding: 0.55rem 1rem !important;
}
#hd-chat-input:focus { border-color: var(--cos-gold) !important; box-shadow: 0 0 0 3px var(--cos-gold-glow) !important; outline: none !important; }
#hd-chat-input::placeholder { color: var(--cos-text-muted) !important; font-weight: 300; }

#btn-chat-send {
    background: var(--cos-text) !important; color: var(--cos-surface) !important;
    border: none !important; border-radius: 24px !important;
    font-weight: 600 !important; font-size: 13px !important;
    padding: 0.55rem 1.2rem !important;
}
#btn-chat-send:hover { background: #333 !important; }

#btn-chat-attach { border-radius: 24px !important; }

#chat-action-bar button { font-size: 11.5px !important; border-radius: 8px !important; }

/* Capture training button — purple → gold */
#btn-capture-training {
    background: var(--cos-gold) !important;
    color: var(--cos-sidebar) !important;
    border: none !important;
    font-weight: 600 !important;
}
#btn-capture-training:hover {
    background: var(--cos-gold-dim) !important;
}

/* Simulation button group — purple → dark/gold */
#exec-sim-view {
    border-color: var(--cos-text) !important;
}
#btn-exec-simulate {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
}
#btn-switch-to-real {
    background: var(--cos-gold-dim) !important;
    color: var(--cos-sidebar) !important;
    border-left-color: rgba(255,255,255,0.15) !important;
}
/* Real execution button group */
#exec-real-view {
    border-color: var(--cos-danger) !important;
}
#btn-exec-real {
    background: var(--cos-danger) !important;
    color: #fff !important;
}
#btn-switch-to-simulate {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
}
/* View report button — teal → dark */
#btn-view-report {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
}
#btn-view-report:hover {
    background: #333 !important;
}

/* ACT badges in chat */
#hd-chat-messages span[style*="ACT"] { border-radius: 6px !important; }
#hd-chat-messages button[style*="#10b981"] {
    border-radius: 8px !important;
    background: var(--cos-gold) !important;
    color: var(--cos-sidebar) !important;
    border: none !important;
}
#hd-chat-messages button[style*="#ef4444"] {
    border-radius: 8px !important;
}

/* Proposal section gold accent */
#hd-proposal-container div[style*="border-left:3px solid #f59e0b"],
#hd-proposal-container div[style*="border-left: 3px solid #f59e0b"] {
    border-left-color: var(--cos-gold) !important;
    background: var(--cos-gold-bg) !important;
}
/* Proposal badges */
#hd-proposal-container button[style*="background:#f59e0b"],
#hd-proposal-container button[style*="background: #f59e0b"],
#hd-proposal-container span[style*="color:#f59e0b"],
#hd-proposal-container span[style*="color: #f59e0b"] {
    background: var(--cos-gold) !important;
    color: var(--cos-sidebar) !important;
}
#hd-proposal-container code[style*="color:#f59e0b"],
#hd-proposal-container code[style*="color: #f59e0b"] {
    color: var(--cos-gold) !important;
}


/* ═══════ METRIC BARS (gold gradient) ═══════════════════════════════════ */
#hd-analysis-result div[style*="height:6px"] > div,
#hd-analysis-result div[style*="height: 6px"] > div,
#hd-analysis-result div[style*="height:5px"] > div,
#hd-analysis-result div[style*="height: 5px"] > div {
    background: linear-gradient(90deg, var(--cos-gold-dim), var(--cos-gold)) !important;
    border-radius: 4px !important;
}


/* ═══════ ALERTS ════════════════════════════════════════════════════════ */
.hd-alert {
    background: rgba(196,64,64,0.06) !important;
    border: 1px solid rgba(196,64,64,0.15) !important;
    border-radius: 8px !important; font-size: 12px !important;
}
.hd-no-alerts { color: var(--cos-text-muted) !important; }


/* ═══════ BUTTONS ═══════════════════════════════════════════════════════ */
.btn { font-weight: 500; border-radius: 8px; font-size: 13px; transition: all 0.2s; }
.btn-primary { background: var(--cos-text) !important; color: var(--cos-surface) !important; border: none !important; }
.btn-primary:hover { background: #333 !important; }
.btn-secondary { background: var(--cos-surface) !important; border: 1px solid var(--cos-border) !important; color: var(--cos-text-sec) !important; }
.btn-secondary:hover { border-color: var(--cos-gold) !important; color: var(--cos-gold) !important; }
.btn-sm { font-size: 11.5px; border-radius: 6px; }

/* Override blue/orange/teal hardcoded btn backgrounds across all pages */
.hd-page-header-actions button[style*="background:#f59e0b"],
.hd-page-header-actions button[style*="background: #f59e0b"] {
    background: var(--cos-gold) !important;
    color: var(--cos-sidebar) !important;
}
.hd-page-header-actions button[style*="background:#0078d4"],
.hd-page-header-actions button[style*="background: #0078d4"],
.hd-page-header-actions button[style*="background:#036"],
.hd-page-header-actions button[style*="background: #036"],
.hd-page-header-actions button[style*="background:#1e40af"],
.hd-page-header-actions button[style*="background: #1e40af"] {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
}
button[style*="background:#3b82f6"],
button[style*="background: #3b82f6"] {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
}


/* ═══════ CARDS ═════════════════════════════════════════════════════════ */
.hd-metric-card, .hd-kb-card, .hd-pol-card {
    background: var(--cos-surface); border: 1px solid var(--cos-border);
    border-radius: 10px; box-shadow: none;
}
.hd-metric-card:hover, .hd-kb-card:hover, .hd-pol-card:hover {
    border-color: var(--cos-gold); box-shadow: 0 2px 12px rgba(200,169,126,0.1);
}
.hd-metric-label { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; color: var(--cos-text-muted); }
.hd-metric-value { font-weight: 700; color: var(--cos-text); }
.hd-section-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cos-text-sec); }


/* ═══════ PAGE HEADERS — Estilo unificado Cosentino ═════════════════════ */
.hd-page-header {
    border-bottom: 1px solid var(--cos-border);
    padding-bottom: 1rem;
    margin-bottom: 1.2rem;
}
.hd-page-header h2 {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--cos-text) !important;
    letter-spacing: -0.01em;
}
.hd-page-header p {
    font-size: 12.5px !important;
    color: var(--cos-text-muted) !important;
    margin-top: 0.25rem !important;
}
/* Páginas sin .hd-page-header: unificar h2 sueltos */
.hd-page > h2 {
    font-size: 16px !important;
    font-weight: 700 !important;
    color: var(--cos-text) !important;
    letter-spacing: -0.01em;
    margin-top: 0 !important;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--cos-border);
    margin-bottom: 1rem !important;
}
.hd-page > p {
    font-size: 12.5px;
    color: var(--cos-text-muted);
}
.hd-page > hr {
    border: none;
    border-top: 1px solid var(--cos-border);
    margin: 0 0 1rem 0;
}

/* Header actions buttons — estilo unificado */
.hd-page-header-actions .btn,
.hd-page-header-actions button,
#acciones-header-actions button {
    font-family: 'Inter', sans-serif !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.85rem !important;
    transition: all 0.2s ease !important;
    border: 1px solid var(--cos-border) !important;
    cursor: pointer;
}

/* Acciones del Sistema: botones de cabecera */
#acciones-header-actions button[style*="background: #f59e0b"],
#acciones-header-actions button[style*="background:#f59e0b"] {
    background: var(--cos-gold) !important;
    color: var(--cos-sidebar) !important;
    border-color: var(--cos-gold-dim) !important;
}
#acciones-header-actions button[style*="background: #10b981"],
#acciones-header-actions button[style*="background:#10b981"] {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
    border-color: var(--cos-text) !important;
}


/* ═══════ FILTER PILLS (acciones, etc.) ═════════════════════════════════ */
.hd-filter-pills {
    gap: 0.35rem !important;
}
.hd-filter-pills button,
.hd-filter-pill {
    font-family: 'Inter', sans-serif !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    border-radius: 999px !important;
    padding: 0.28rem 0.7rem !important;
    background: var(--cos-surface) !important;
    color: var(--cos-text-sec) !important;
    border: 1px solid var(--cos-border) !important;
    transition: all 0.18s ease !important;
}
.hd-filter-pills button:hover,
.hd-filter-pill:hover {
    border-color: var(--cos-gold) !important;
    color: var(--cos-gold) !important;
}
.hd-filter-pills button.active,
.hd-filter-pill.active {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
    border-color: var(--cos-text) !important;
}


/* ═══════ ACTION LIST ITEMS ═════════════════════════════════════════════ */
.hd-list-item {
    border: 1px solid var(--cos-border) !important;
    border-radius: 10px !important;
    background: var(--cos-surface) !important;
    transition: border-color 0.18s !important;
    margin-bottom: 0.5rem !important;
}
.hd-list-item:hover {
    border-color: var(--cos-gold) !important;
}
/* Action badges (Sistema, Medición, etc.) */
.hd-list-item .badge,
.hd-action-badge {
    font-size: 10px !important;
    font-weight: 600 !important;
    border-radius: 999px !important;
    padding: 0.15rem 0.55rem !important;
    letter-spacing: 0.02em;
}
/* Execute button in actions */
.hd-list-item button[style*="background:#10b981"],
.hd-list-item button[style*="background: #10b981"],
.hd-list-item .btn-execute {
    background: var(--cos-text) !important;
    color: var(--cos-surface) !important;
    border: none !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
}
.hd-list-item .btn-execute:hover {
    background: #333 !important;
}
/* Delete button in actions */
.hd-list-item button[style*="background:#ef4444"],
.hd-list-item button[style*="background: #ef4444"],
.hd-list-item .btn-delete {
    background: transparent !important;
    color: var(--cos-danger) !important;
    border: 1px solid rgba(196,64,64,0.25) !important;
    font-size: 11px !important;
    border-radius: 6px !important;
}


/* ═══════ ALERT BOXES ═══════════════════════════════════════════════════ */
.alert {
    font-size: 12.5px !important;
    border-radius: 10px !important;
    border: 1px solid var(--cos-border) !important;
}
.alert-info {
    background: rgba(90,127,170,0.06) !important;
    border-color: rgba(90,127,170,0.15) !important;
    color: var(--cos-text) !important;
}
.alert-warning,
div[style*="background:#FEF3C7"],
div[style*="background: #FEF3C7"],
div[style*="background: rgb(254, 243, 199)"] {
    background: rgba(212,160,48,0.06) !important;
    border: 1px solid rgba(212,160,48,0.18) !important;
    color: var(--cos-text) !important;
    border-radius: 10px !important;
    font-size: 12.5px !important;
}


/* ═══════ ACCORDION / COLLAPSIBLE SECTIONS ══════════════════════════════ */
.accordion-header,
.hd-accordion-header {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--cos-text) !important;
    border-radius: 10px !important;
}
.hd-accordion .hd-accordion-header:hover,
.accordion-header:hover {
    background: var(--cos-bg-hover) !important;
}


/* ═══════ MODALS ════════════════════════════════════════════════════════ */
.modal-content { border-radius: 14px; border: 1px solid var(--cos-border); box-shadow: 0 20px 60px rgba(0,0,0,0.12); }
.modal-header { font-size: 15px; font-weight: 700; }
/* Catalog iframe modal — Cosentino styling */
.catalog-iframe-modal-content { border-radius: 0; border: none; }
.catalog-iframe-modal-header { background: linear-gradient(135deg, var(--cos-charcoal), #1a1a2e) !important; border-bottom: 2px solid var(--cos-gold) !important; }
.catalog-iframe-modal-header h3 { color: var(--cos-gold) !important; font-size: 0.95rem !important; }
.catalog-iframe-modal-header .modal-close { color: var(--cos-gold) !important; }
.catalog-iframe-modal-header .modal-close:hover { background: rgba(199,169,120,0.15) !important; }


/* ═══════ TOASTS ════════════════════════════════════════════════════════ */
.toast { border-radius: 10px !important; font-size: 12.5px !important; border: 1px solid var(--cos-border) !important; }
.toast.success { border-left: 3px solid var(--cos-success) !important; }
.toast.error   { border-left: 3px solid var(--cos-danger) !important; }
.toast.warning { border-left: 3px solid var(--cos-warning) !important; }


/* ═══════ INPUTS ════════════════════════════════════════════════════════ */
input[type="text"], input[type="search"], input[type="number"], select, textarea {
    font-size: 13px; border: 1px solid var(--cos-border); border-radius: 8px;
    background: var(--cos-surface); color: var(--cos-text);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--cos-gold); box-shadow: 0 0 0 3px var(--cos-gold-glow); outline: none;
}


/* ═══════ PROGRESS ══════════════════════════════════════════════════════ */
#progress-bar { background: linear-gradient(90deg, var(--cos-gold-dim), var(--cos-gold)) !important; border-radius: 4px !important; }


/* ═══════ SCROLLBAR ═════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
.hd-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }


/* ═══════ LOGIN MODAL ═══════════════════════════════════════════════════ */
#login-overlay > div { font-family: 'Inter', sans-serif !important; }
#login-btn { background: var(--cos-text) !important; border-radius: 10px !important; }
#login-btn:hover { background: #333 !important; }


/* ═══════ HAMBURGER MÓVIL (fuera del header) ════════════════════════════ */
.hamburger-btn-mobile {
    display: none;
    position: fixed;
    top: 0.7rem;
    left: 0.75rem;
    z-index: 101;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.hamburger-btn-mobile span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: var(--cos-text);
    border-radius: 2px;
    transition: all 0.3s ease;
}
@media (max-width: 640px) {
    .hamburger-btn-mobile { display: flex; }

    /* Cosentino-themed mobile split tabs */
    .mobile-split-tabs {
        background: var(--cos-surface) !important;
        border-color: var(--cos-border) !important;
    }
    .mobile-split-tab {
        color: var(--cos-text-sec) !important;
        font-family: 'Inter', sans-serif !important;
    }
    .mobile-split-tab.active {
        background: var(--cos-sidebar) !important;
        color: var(--cos-gold) !important;
    }

    /* Compact header */
    .app-header {
        background: var(--cos-sidebar) !important;
    }

    /* Sidebar nav buttons: touch-friendly */
    .hd-sidebar .hd-nav-btn {
        min-height: 48px !important;
        border-radius: 10px !important;
    }

    /* Widget chips: Cosentino dark theme */
    #hd-widgets-bar .cos-rp-section {
        background: var(--cos-surface) !important;
        border-color: var(--cos-border) !important;
    }
    #hd-widgets-bar .cos-rp-section.expanded .cos-rp-body {
        background: var(--cos-surface) !important;
        border-color: var(--cos-border) !important;
    }

    /* Drag handle on modals */
    .modal-header::before {
        background: var(--cos-text-muted) !important;
    }
}


/* ═══════ TABS ══════════════════════════════════════════════════════════ */
.hd-tab-btn { font-size: 12px; font-weight: 500; }
.hd-tab-btn.active { border-bottom-color: var(--cos-gold); color: var(--cos-gold); }


/* ═══════ USER BAR ═════════════════════════════════════════════════════ */
#hd-user-bar { background: var(--cos-sidebar) !important; }
/* Blue "USUARIO" badge → gold */
#hd-user-bar span[style*="background:rgba(59,130,246"],
#hd-user-bar span[style*="background: rgba(59,130,246"] {
    background: rgba(200,169,126,0.12) !important;
    color: var(--cos-gold) !important;
    border-color: rgba(200,169,126,0.3) !important;
}
/* Red logout button → muted gold outline */
#hd-user-bar button[onclick*="hdLogout"] {
    background: rgba(200,169,126,0.08) !important;
    border: 1px solid rgba(200,169,126,0.25) !important;
    color: var(--cos-gold) !important;
}


/* ═══════ USER MODE — solo chat visible ════════════════════════════════ */
body.user-mode #hd-sidebar,
body.user-mode #sidebar-nav-toggle,
body.user-mode #hd-widgets-bar,
body.user-mode #widgets-panel-toggle,
body.user-mode #hd-analysis-result,
body.user-mode #split-resizer,
body.user-mode #btn-capture-training,
body.user-mode .cos-session-expand,
body.user-mode .cos-page-subtitle,
body.user-mode .cos-panel-toggle {
    display: none !important;
}
body.user-mode .hd-layout {
    padding-left: 0 !important;
    margin-left: 0 !important;
}
body.user-mode .hd-main-content {
    margin-left: 0 !important;
    max-width: 100% !important;
}
body.user-mode #hd-page-asistente {
    padding-right: 0 !important;
}
body.user-mode #asistente-split {
    max-width: 900px;
    margin: 0 auto;
}
body.user-mode #mode-chat {
    flex: 1 1 100% !important;
}
body.user-mode .cos-session-bar {
    justify-content: center;
}
body.user-mode .cos-session-title {
    text-align: center;
}
body.user-mode #hd-user-bar {
    max-width: 900px;
    margin: 0 auto 0.4rem;
    border-radius: 8px;
}


/* ═══════ RESPONSIVE ═══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .cos-session-bar { flex-wrap: wrap; gap: 0.5rem; }
    /* Hide right panel/widgets on small screens — but not in tablet-staff-mode */
    body:not(.tablet-staff-mode) .cos-right-panel { display: none !important; }
    body:not(.tablet-staff-mode) #hd-widgets-bar { display: none !important; }
}

@media (max-width: 1100px) and (min-width: 769px) {
    .cos-right-panel { flex: 0 0 260px !important; max-width: 280px !important; }
}

@media (max-width: 1024px) and (min-width: 641px) {
    .hd-sidebar { width: 64px !important; }
    #sidebar-nav-toggle { left: 64px !important; }
    .cos-brand-title, .cos-brand-sub { font-size: 0; }
    .cos-brand-logo { margin: 0 auto; }
    .cos-nav-group-label { font-size: 0; height: 0.5rem; }
    .cos-footer-label, .cos-footer-version, .cos-user-name { display: none; }
}

/* Sidebar colapsado: forzar width 0 sobre !important del restyling */
.hd-layout.sidebar-collapsed .hd-sidebar {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
}
.hd-layout.sidebar-collapsed #sidebar-nav-toggle {
    left: 0 !important;
}

/* ═══════════════════════════════════════════════════════════════════
   Asset Management (Gestión Activos)
   ═══════════════════════════════════════════════════════════════════ */

.am-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem;
}
.am-global-actions { display: flex; gap: 0.5rem; }
.am-btn-seed { background: #10b981; color: #fff; border: none; border-radius: 6px; padding: 0.35rem 0.75rem; font-size: 0.82rem; cursor: pointer; }
.am-btn-reset { background: #ef4444; color: #fff; border: none; border-radius: 6px; padding: 0.35rem 0.75rem; font-size: 0.82rem; cursor: pointer; }
.am-btn-seed:hover { background: #059669; }
.am-btn-reset:hover { background: #dc2626; }

.am-tabs { flex-wrap: wrap; }

/* KPI Grid */
.am-kpi-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1.5rem;
}
.am-kpi-card {
    background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px;
    padding: 1rem; text-align: center; transition: transform 0.15s;
}
.am-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.am-kpi-icon { font-size: 1.5rem; margin-bottom: 0.25rem; }
.am-kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--text-primary); }
.am-kpi-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 0.15rem; }

/* Panels */
.am-panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.am-panel { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px; padding: 1rem; }
.am-panel h3 { margin: 0 0 0.75rem; font-size: 0.95rem; }

/* Activity entries */
.am-activity-list, .am-timeline { display: flex; flex-direction: column; gap: 0.4rem; }
.am-activity-entry, .am-timeline-entry {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color); font-size: 0.84rem; flex-wrap: wrap;
}
.am-act-actor, .am-tl-actor { font-weight: 600; min-width: 50px; }
.am-act-detail, .am-tl-detail { flex: 1; color: var(--text-secondary); min-width: 0; }
.am-act-date, .am-tl-date { font-size: 0.75rem; color: var(--text-secondary); white-space: nowrap; }
.am-tl-entity { font-size: 0.78rem; color: var(--text-secondary); min-width: 80px; }

/* Tables */
.am-table {
    width: 100%; border-collapse: collapse; font-size: 0.85rem;
    background: var(--card-bg); border-radius: 8px; overflow: hidden;
}
.am-table th {
    background: var(--bg-secondary, rgba(0,0,0,0.03)); padding: 0.6rem 0.75rem;
    text-align: left; font-weight: 600; font-size: 0.78rem; color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
}
.am-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border-color); }
.am-table tbody tr:hover { background: rgba(59,130,246,0.04); }
.am-table-clickable tbody tr { cursor: pointer; }

/* Action buttons */
.am-btn-action {
    background: none; border: none; cursor: pointer; font-size: 1rem; padding: 2px 4px;
    border-radius: 4px; transition: background 0.15s;
}
.am-btn-action:hover { background: rgba(0,0,0,0.06); }

/* Filters (disabled placeholder) */
.am-filter {
    padding: 0.35rem 0.6rem; border: 1px solid var(--border-color); border-radius: 6px;
    background: var(--card-bg); color: var(--text-secondary); font-size: 0.82rem;
    opacity: 0.5; cursor: not-allowed;
}

/* Stock summary */
.am-stock-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.am-stock-card {
    background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 0.75rem;
}

/* Employee detail panel */
.am-employee-detail {
    position: fixed; right: 0; top: 0; width: 400px; height: 100vh;
    background: var(--bg-primary, #fff); border-left: 2px solid var(--border-color);
    overflow-y: auto; z-index: 1000; box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    padding: 1rem;
}
.am-emp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.am-emp-header h3 { margin: 0; }
.am-btn-close {
    background: none; border: 1px solid var(--border-color); border-radius: 6px;
    font-size: 1.1rem; cursor: pointer; padding: 0.2rem 0.5rem; color: var(--text-primary);
}
.am-btn-close:hover { background: rgba(239,68,68,0.1); }
.am-emp-section { margin-bottom: 1rem; }
.am-emp-section h4 { margin: 0 0 0.5rem; font-size: 0.88rem; color: var(--text-secondary); }
.am-detail-table { width: 100%; font-size: 0.82rem; }
.am-detail-table td, .am-detail-table th { padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--border-color); }
.am-detail-table td:first-child { font-weight: 600; color: var(--text-secondary); width: 100px; }
.am-json-pre {
    background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 6px;
    padding: 0.75rem; font-size: 0.78rem; overflow-x: auto; max-height: 200px; overflow-y: auto;
}

/* Report buttons */
.am-report-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.am-btn-report {
    background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px;
    padding: 0.5rem 1rem; font-size: 0.85rem; cursor: pointer; transition: all 0.15s;
}
.am-btn-report:hover { background: var(--accent-color, #3b82f6); color: #fff; border-color: transparent; }

/* Responsive */
@media (max-width: 900px) {
    .am-kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .am-panel-row { grid-template-columns: 1fr; }
    .am-employee-detail { width: 100%; }
}
@media (max-width: 600px) {
    .am-kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════
   COSENTINO — MOBILE STAFF MODE
   ═══════════════════════════════════════════════════════════════════════ */

body.mobile-staff-mode .mobile-bottom-tabs {
    background: var(--cos-sidebar) !important;
    border-top-color: var(--cos-border) !important;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.3) !important;
}
body.mobile-staff-mode .mob-tab {
    color: var(--cos-text-muted) !important;
}
body.mobile-staff-mode .mob-tab.active {
    color: var(--cos-gold) !important;
}
body.mobile-staff-mode .mob-tab.active::after {
    background: var(--cos-gold) !important;
}

/* Submenu panels */
body.mobile-staff-mode .mob-submenu {
    background: var(--cos-surface) !important;
    border-top-color: var(--cos-border) !important;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.4) !important;
}
body.mobile-staff-mode .mob-submenu-grid button {
    background: var(--cos-sidebar) !important;
    border-color: var(--cos-border) !important;
    color: var(--cos-text) !important;
}
body.mobile-staff-mode .mob-submenu-grid button:active {
    background: var(--cos-gold-bg) !important;
    border-color: var(--cos-gold) !important;
}

/* Header compact: dark background */
body.mobile-staff-mode .app-header {
    background: var(--cos-sidebar) !important;
}

/* Chat input area */
body.mobile-staff-mode #mode-chat > div:last-of-type {
    background: var(--cos-surface) !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   COSENTINO — TABLET STAFF MODE
   ═══════════════════════════════════════════════════════════════════════ */

body.tablet-staff-mode .hd-sidebar {
    background: var(--cos-sidebar) !important;
    border-right: 1px solid var(--cos-border) !important;
}
body.tablet-staff-mode .hd-sidebar:hover {
    box-shadow: 4px 0 24px rgba(0,0,0,0.35) !important;
}
body.tablet-staff-mode .hd-sidebar .hd-nav-btn:hover {
    background: var(--cos-gold-bg) !important;
}
body.tablet-staff-mode .hd-sidebar .hd-nav-btn.active .hd-nav-icon {
    color: var(--cos-gold) !important;
}
body.tablet-staff-mode .app-header {
    background: var(--cos-sidebar) !important;
    border-bottom: 1px solid var(--cos-border) !important;
}
