/* ═══ RESET & BASE — SCADA DARK THEME ═════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }

/* ── Auth Gate (mandatory login) ── */
.auth-gate {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 1rem;
}
.auth-gate-content { text-align: center; }
#app-wrapper.auth-locked { filter: blur(6px); pointer-events: none; user-select: none; }

:root {
    --sidebar-w: 280px;
    --bg:      #0a0c10;
    --surface: #111520;
    --panel:   #161b28;
    --card-bg: #161b28;
    --border:  #1e2840;
    --border2: #2a3555;
    --orange:  #ff6b1a;
    --amber:   #ffaa00;
    --cyan:    #00c8ff;
    --green:   #00e676;
    --red:     #ff3d3d;
    --yellow:  #ffd600;
    --blue:    #3b82f6;
    --text:    #e8eaf0;
    --text-muted: #6b7590;
    --radius:  6px;
    --shadow:  0 2px 8px rgba(0,0,0,.3);
    --mono:    'JetBrains Mono', 'Consolas', monospace;
    --sans:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    /* UX pilot — „tactical HUD / hală” (doar tokeni vizuali, fără logică nouă) */
    --hud-cyan:     #00e5ff;
    --hud-glow:     rgba(0, 229, 255, 0.14);
    --hud-glow-soft: rgba(0, 200, 255, 0.06);
    --hud-vignette: rgba(2, 6, 12, 0.55);
    --hud-grid:     rgba(0, 200, 255, 0.045);
}

html { font-size: 15px; }
body {
    font-family: var(--sans);
    color: var(--text);
    min-height: 100vh;
    margin: 0;
    position: relative;
    background:
        radial-gradient(ellipse 130% 70% at 50% -25%, var(--hud-glow), transparent 58%),
        radial-gradient(ellipse 70% 50% at 100% 40%, rgba(255, 107, 26, 0.07), transparent 52%),
        radial-gradient(ellipse 60% 80% at 0% 60%, rgba(0, 100, 180, 0.06), transparent 45%),
        linear-gradient(168deg, #05070c 0%, var(--bg) 42%, #0c1018 100%);
    background-attachment: fixed;
}
/* Grilă discretă + „spațiu industrial” — fără interacțiune, zero JS */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    background-image:
        linear-gradient(var(--hud-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--hud-grid) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, black 20%, transparent 72%);
    -webkit-mask-image: radial-gradient(ellipse 85% 75% at 50% 45%, black 20%, transparent 72%);
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(ellipse 95% 90% at 50% 50%, transparent 40%, var(--hud-vignette) 100%);
}

/* ═══ SIDEBAR — FUTURIST REDESIGN ═══════════════════════════════ */
#sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: #0a0f1e;
    border-right: 1px solid rgba(0,212,255,0.12);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
    overflow: hidden;
}
#sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 1px; height: 100%;
    background: linear-gradient(to bottom, transparent 5%, var(--cyan) 25%, var(--blue) 50%, #8b5cf6 75%, transparent 95%);
    opacity: 0.3;
    animation: sidebarEdgePulse 5s ease-in-out infinite;
    pointer-events: none;
}
@keyframes sidebarEdgePulse {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.45; }
}

/* SIDEBAR HEADER */
.sidebar-header {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(0,212,255,0.12);
    position: relative;
    text-align: left;
}
.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 20px; right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan) 50%, transparent);
    opacity: 0.5;
}
.factory-logo {
    display: flex; align-items: center; gap: 12px;
}
.logo-hex {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-weight: 800; font-size: 14px;
    color: #060a14;
    animation: hexGlow 3s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes hexGlow {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(0,212,255,0.3)); }
    50% { filter: drop-shadow(0 0 16px rgba(0,212,255,0.7)); }
}
.factory-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 13px; font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--cyan);
    text-transform: uppercase;
}
.factory-sub {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: #3a4a6a;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

/* USER BADGE */
.user-badge {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    margin: 12px 12px 4px;
    background: rgba(0,212,255,0.04);
    border: 1px solid rgba(0,212,255,0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}
.user-badge:hover {
    background: rgba(0,212,255,0.08);
    border-color: rgba(0,212,255,0.2);
}
.user-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 11px; font-weight: 700;
    color: #fff; flex-shrink: 0;
}
.avatar-operator { background: linear-gradient(135deg, #00cc6a, #009950); }
.avatar-engineer { background: linear-gradient(135deg, var(--cyan), var(--blue)); }
.avatar-master { background: linear-gradient(135deg, var(--orange), #8b5cf6); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}
.role-c-operator { color: var(--green); }
.role-c-engineer { color: var(--cyan); }
.role-c-master { color: var(--orange); }
.status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
    animation: statusPulse 2s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,230,118,0.4); }
    50% { box-shadow: 0 0 0 5px rgba(0,230,118,0); }
}

/* NAV SECTION (scrollable) */
.nav-section {
    flex: 1;
    padding: 6px 0;
    overflow-y: auto;
    overflow-x: hidden;
}
.nav-section::-webkit-scrollbar { width: 3px; }
.nav-section::-webkit-scrollbar-track { background: transparent; }
.nav-section::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.3); border-radius: 3px; }

/* NAV ITEMS */
.nav-links { list-style: none; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 20px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-muted);
    font-size: .85rem; font-weight: 500;
    letter-spacing: 0.3px;
    overflow: hidden;
}
.nav-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    width: 0; height: 100%;
    background: linear-gradient(90deg, rgba(0,212,255,0.1), transparent);
    transition: width 0.3s;
}
.nav-item:hover::before { width: 100%; }
.nav-item:hover { color: var(--text); }
.nav-item.active {
    color: var(--cyan);
}
.nav-item.active::after {
    content: '';
    position: absolute;
    left: 0; top: 15%;
    width: 3px; height: 70%;
    background: var(--cyan);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--cyan), 0 0 20px rgba(0,212,255,0.3);
}
.nav-icon {
    width: 22px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.nav-label { flex: 1; }

/* NAV SEPARATOR */
.nav-sep {
    height: 1px;
    margin: 6px 20px;
    background: linear-gradient(90deg, transparent, rgba(0,212,255,0.12), transparent);
}

/* NAV GROUP (collapsible) */
.nav-group {
    margin: 4px 8px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid transparent;
    transition: background 0.35s cubic-bezier(0.4,0,0.2,1), border-color 0.35s;
}
.nav-group.open {
    background: rgba(0,212,255,0.025);
    border-color: rgba(0,212,255,0.08);
}
.nav-group.open.group-master {
    background: rgba(255,107,53,0.025);
    border-color: rgba(255,107,53,0.08);
}
.nav-group-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    border-radius: 10px;
}
.nav-group-header:hover {
    background: rgba(0,212,255,0.06);
}
.group-master .nav-group-header:hover {
    background: rgba(255,107,53,0.06);
}
.group-icon-wrap {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
    transition: all 0.3s;
}
.group-engineer .group-icon-wrap {
    background: linear-gradient(135deg, rgba(0,212,255,0.12), rgba(30,144,255,0.12));
    border: 1px solid rgba(0,212,255,0.2);
}
.group-master .group-icon-wrap {
    background: linear-gradient(135deg, rgba(255,107,53,0.12), rgba(139,92,246,0.12));
    border: 1px solid rgba(255,107,53,0.2);
}
.nav-group.open .group-icon-wrap {
    box-shadow: 0 0 12px rgba(0,212,255,0.2);
}
.nav-group.open.group-master .group-icon-wrap {
    box-shadow: 0 0 12px rgba(255,107,53,0.2);
}
.group-label {
    flex: 1;
    font-family: 'Orbitron', sans-serif;
    font-size: 10px; font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
}
.group-engineer .group-label { color: var(--cyan); }
.group-master .group-label { color: var(--orange); }
.group-count {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    color: #3a4a6a;
    background: rgba(255,255,255,0.04);
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 1px;
}
.group-chevron {
    font-size: 8px;
    color: #3a4a6a;
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), color 0.3s;
}
.nav-group.open .group-chevron {
    transform: rotate(90deg);
}
.nav-group.open.group-engineer .group-chevron { color: var(--cyan); }
.nav-group.open.group-master .group-chevron { color: var(--orange); }

/* NAV SUBMENU (expand/collapse) */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1);
}
.nav-group.open .nav-submenu {
    max-height: 400px;
}
.nav-submenu .nav-item {
    padding: 9px 12px 9px 24px;
    font-size: .8rem;
}
.nav-submenu .nav-icon {
    font-size: .85rem;
    width: 18px;
    opacity: 0.75;
}

/* NAV GROUP HIDDEN (role filtering) */
.nav-group.is-hidden {
    max-height: 0 !important;
    opacity: 0;
    margin: 0 8px;
    border: none;
    pointer-events: none;
    transition: max-height 0.4s, opacity 0.4s, margin 0.3s;
}
.nav-group:not(.is-hidden) {
    max-height: 500px;
    opacity: 1;
}

/* SIDEBAR NAV-BADGE (override) */
#sidebar .nav-badge {
    background: var(--red);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 9px; font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    animation: badgePulse 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255,51,102,0.4); }
    50% { box-shadow: 0 0 0 5px rgba(255,51,102,0); }
}

/* SIDEBAR FOOTER */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(0,212,255,0.12);
    position: relative;
}
.sidebar-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 20px; right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    opacity: 0.3;
}
.server-status {
    display: flex; align-items: center; gap: 8px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: #3a4a6a;
    letter-spacing: 1px;
}
.server-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: statusPulse 2s ease-in-out infinite;
}
.stats-mini { margin-top: 6px; }
.stats-mini span { display: block; margin-bottom: .1rem; font-size: .65rem; color: var(--text-muted); }

/* ═══ MAIN CONTENT ═════════════════════════════════════════════ */
#content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

#topbar {
    background: var(--surface);
    padding: .5rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}
#topbar h1 { font-size: .9rem; font-weight: 700; white-space: nowrap; margin-right: auto; }
#menu-toggle {
    display: none;
    background: none; border: none;
    font-size: 1.4rem; cursor: pointer; color: var(--text);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.user-role-indicator {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .7rem;
    margin-right: .6rem;
}
.user-role-indicator #current-role-label {
    color: var(--text-muted);
}

.live-badge {
    display: flex; align-items: center; gap: 6px;
    font-family: var(--mono); font-size: .7rem; font-weight: 700;
    color: var(--green); letter-spacing: 1px;
}
.live-dot {
    width: 8px; height: 8px; border-radius: 50%; background: var(--green);
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 6px var(--green);
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.4)} }

.ai-global-status {
    display: flex; gap: 6px; align-items: center;
    margin-left: 2px;
    padding-left: 10px;
    border-left: 1px solid var(--border);
}
.ai-indicator {
    display: flex; align-items: center; gap: 4px;
    font-family: var(--mono); font-size: .65rem; font-weight: 600;
    letter-spacing: .5px; cursor: default;
    transition: opacity .3s;
}
.ai-ind-dot {
    width: 8px; height: 8px; border-radius: 50%;
    transition: background .5s, box-shadow .5s;
}
.ai-ind-dot.online {
    background: var(--green);
    box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite;
}
.ai-ind-dot.offline {
    background: var(--red);
    box-shadow: 0 0 4px var(--red);
    opacity: .7;
}
.ai-ind-dot.unconfigured {
    background: var(--text-muted);
    box-shadow: none;
    opacity: .5;
}
.ai-ind-label {
    color: var(--text-muted);
}
.ai-indicator.active .ai-ind-label {
    color: var(--green);
}
.ai-indicator.down .ai-ind-label {
    color: var(--red);
}
@media (max-width: 600px) {
    .ai-global-status { gap: 6px; padding-left: 6px; }
    .ai-ind-label { display: none; }
    .ai-indicator { title: attr(title); }
}

.help-badge-top {
    font-family: var(--mono); font-size: .72rem; font-weight: 700;
    padding: .25rem .6rem; border-radius: 4px;
    background: rgba(255,107,26,.15); color: var(--orange);
    cursor: pointer; transition: all .2s;
}
.help-badge-top.active { animation: blinkBadge .8s infinite; }
.help-badge-top:hover { background: rgba(255,107,26,.3); }

.alarm-badge-top {
    font-family: var(--mono); font-size: .7rem; font-weight: 700;
    padding: .2rem .5rem; border-radius: 3px;
    background: rgba(255,61,61,.15); color: var(--red);
    animation: blinkBadge .8s infinite;
    cursor: default;
}
@keyframes blinkBadge { 0%,100%{opacity:1} 50%{opacity:.5} }

#clock { font-family: var(--mono); font-size: .75rem; color: var(--text-muted); }

.section { display: none; padding: 1.2rem 1.5rem; overflow-x: hidden; box-sizing: border-box; }
.section.active { display: block; }

/* ═══ STATS CARDS ══════════════════════════════════════════════ */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .8rem;
    margin-bottom: 1.2rem;
}
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--cyan);
}
.stat-card .label {
    font-size: .6rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 1.5px; font-weight: 600;
}
.stat-card .value {
    font-family: var(--mono); font-size: 1.6rem; font-weight: 700;
    margin-top: .2rem; color: var(--text);
}
.stat-card.green::before { background: var(--green); }
.stat-card.green .value { color: var(--green); }
.stat-card.orange::before { background: var(--orange); }
.stat-card.orange .value { color: var(--orange); }
.stat-card.red::before { background: var(--red); }
.stat-card.red .value { color: var(--red); }

.section-heading { margin-bottom: .3rem; color: var(--text); }
.section-desc { font-size: .85rem; color: var(--text-muted); margin-bottom: 1rem; }
.reports-summary { margin-bottom: 1rem; }
.reports-summary-cards { display: flex; flex-wrap: wrap; gap: .75rem; }
.reports-summary-cards .stat-card { min-width: 100px; }
.reports-upload-label { cursor: pointer; font-size: .8rem; color: var(--cyan); }
.reports-upload-label:hover { text-decoration: underline; }
.reports-rec-cell { white-space: nowrap; }

/* ═══ OVERVIEW GROUPS ══════════════════════════════════════════ */
.overview-group {
    margin-bottom: 1.2rem;
}
.group-title {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .8rem;
    padding-bottom: .4rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.group-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.group-count {
    font-size: .7rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* ═══ PRODUCTION LINES GRID ═══════════════════════════════════ */
/* ═══ LINE GROUP — per-line container ═══════════════════════ */
.line-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .8rem 1rem;
    margin-bottom: .8rem;
}
.line-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .5rem;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--border);
}
.line-group-right {
    display: flex;
    align-items: center;
    gap: .7rem;
}
.line-id-block { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.line-id {
    font-family: var(--mono);
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--orange);
}
.line-type-tag {
    font-size: .58rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
    padding: .15rem .45rem; border-radius: 3px;
    background: rgba(0,200,255,.1); color: var(--cyan);
    border: 1px solid rgba(0,200,255,.2);
}
.line-product-inline {
    font-size: .85rem; font-weight: 600; color: var(--text);
}
.line-metrics { font-size: .75rem; color: var(--muted); margin-left: .25rem; }
.eq-count-badge {
    font-size: .6rem; font-weight: 700;
    padding: .1rem .35rem; border-radius: 3px;
    background: rgba(255,107,26,.12); color: var(--orange);
    border: 1px solid rgba(255,107,26,.2);
}

/* ═══ EQUIP GRID — cards inside each line ═══════════════════ */
.equip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .6rem;
    margin-top: .5rem;
}
.equip-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .7rem .8rem;
    border-left: 3px solid var(--green);
    transition: border-color .2s, transform .15s, box-shadow .2s;
    position: relative;
    cursor: pointer;
}
.equip-card:hover { border-color: var(--cyan); border-left-color: var(--cyan); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,200,255,.08); }
.equip-card.equip-main { border-left-color: var(--orange); border-left-width: 4px; }
.equip-card.equip-main:hover { border-left-color: var(--orange); }
.equip-card.sensor-critical { border-color: var(--red) !important; border-left-color: var(--red) !important; box-shadow: 0 0 8px rgba(255,61,61,.2); }
.equip-card.sensor-warning  { border-color: var(--yellow) !important; border-left-color: var(--yellow) !important; box-shadow: 0 0 8px rgba(255,214,0,.15); }

.eq-header {
    display: flex; align-items: center; gap: .3rem; flex-wrap: wrap;
    margin-bottom: .25rem;
}
.eq-id {
    font-family: var(--mono); font-size: .9rem; font-weight: 800; color: var(--cyan);
}
.eq-type-tag {
    font-size: .52rem; font-weight: 700; text-transform: uppercase;
    padding: .1rem .3rem; border-radius: 2px;
    background: rgba(0,200,255,.08); color: var(--text-muted);
    border: 1px solid var(--border);
}
.eq-name { font-size: .72rem; font-weight: 600; color: var(--text); margin-bottom: .15rem; line-height: 1.2; }
.eq-sn { font-size: .62rem; font-family: var(--mono); color: var(--text-muted); margin-bottom: .2rem; }
.eq-consumption {
    display: flex; align-items: center; justify-content: space-between; gap: .4rem;
    font-size: .65rem; margin-top: .35rem; padding: .25rem .4rem;
    background: rgba(0, 200, 255, 0.06); border-radius: 4px; border-left: 3px solid var(--cyan);
}
.eq-consum-label { color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.eq-consum-val { font-family: var(--mono); font-weight: 700; color: var(--cyan); }
.eq-serves { font-size: .58rem; color: var(--amber); }

.eq-alarm-badge {
    font-size: .5rem; font-weight: 700; font-family: var(--mono);
    padding: .1rem .3rem; border-radius: 2px;
    animation: blinkBadge 1s infinite;
}
.eq-alarm-badge.critical { background: rgba(255,61,61,.2); color: var(--red); }
.eq-alarm-badge.warning { background: rgba(255,170,0,.2); color: var(--amber); }

.eq-machine-state {
    display: flex; align-items: center; gap: .3rem;
    font-size: .6rem; font-weight: 600; margin-bottom: .2rem;
    padding: .15rem .4rem; border-radius: 3px;
}
.eq-machine-state.producing { background: rgba(0,200,100,.1); color: #0c6; }
.eq-machine-state.stopped { background: rgba(255,61,61,.08); color: var(--red); }
.eq-machine-state.other { background: rgba(255,170,0,.08); color: var(--amber); }
.eq-state-dot {
    width: 6px; height: 6px; border-radius: 50%;
    display: inline-block; background: currentColor;
}
.eq-machine-state.producing .eq-state-dot { animation: blinkBadge 2s infinite; }

.eq-status-tag {
    display: inline-block; font-size: .55rem; font-weight: 700;
    padding: .1rem .35rem; border-radius: 3px; margin-bottom: .2rem;
}
.eq-status-tag.stopped { background: rgba(255,61,61,.15); color: var(--red); }
.eq-status-tag.warning { background: rgba(255,214,0,.15); color: var(--yellow); }
.equip-card.eq-stopped { border-left-color: var(--red); opacity: .7; }
.equip-card.eq-warning { border-left-color: var(--yellow); }

.eq-status-btns {
    display: flex; gap: .2rem; margin-top: .3rem;
}
.eqs-btn {
    flex: 1; padding: .15rem; border-radius: 3px; font-size: .55rem; font-weight: 700;
    border: 1px solid var(--border); background: var(--bg); color: var(--text-muted);
    cursor: pointer; transition: all .15s; text-align: center;
}
.eqs-btn:hover { border-color: var(--cyan); color: var(--cyan); }
.eqs-btn.active { background: var(--green); color: #000; border-color: var(--green); }
.eqs-btn.warn.active { background: var(--yellow); color: #000; border-color: var(--yellow); }
.eqs-btn.stop.active { background: var(--red); color: #fff; border-color: var(--red); }

.line-status { display: flex; align-items: center; gap: .4rem; }

/* ═══ LINE GAUGES & HOURS ════════════════════════════════════ */
.line-gauges {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin: .5rem 0;
    padding: .4rem 0;
}
.line-hours-display {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.hours-value {
    font-family: var(--mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--cyan);
    line-height: 1;
}
.hours-label {
    font-size: .55rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ═══ LINE ALERTS ════════════════════════════════════════════ */
.line-alerts {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    margin-bottom: .4rem;
}
.line-alert {
    font-size: .65rem;
    font-weight: 600;
    font-family: var(--mono);
    padding: .25rem .4rem;
    border-radius: 2px;
}
.line-alert-machine {
    color: var(--cyan);
    font-weight: 700;
    margin-right: .25rem;
}
.line-alert.warning {
    background: rgba(255,170,0,.1);
    color: var(--amber);
    border-left: 2px solid var(--amber);
}
.line-alert.critical {
    background: rgba(255,61,61,.1);
    color: var(--red);
    border-left: 2px solid var(--red);
    animation: blinkBadge .8s infinite;
}

/* ═══ BADGES ══════════════════════════════════════════════════ */
.mc-badges {
    display: flex; flex-wrap: wrap; gap: .25rem;
    margin-top: .4rem; margin-bottom: .2rem;
}
.badge {
    display: inline-block; padding: .1rem .4rem;
    border-radius: 2px; font-size: .62rem;
    font-weight: 700; font-family: var(--mono);
    letter-spacing: .3px;
}
.badge-green { background: rgba(0,230,118,.12); color: var(--green); }
.badge-yellow { background: rgba(255,214,0,.12); color: var(--yellow); }
.badge-red { background: rgba(255,61,61,.12); color: var(--red); }
.badge-blue { background: rgba(0,200,255,.1); color: var(--cyan); }
.badge-gray { background: rgba(255,255,255,.06); color: var(--text-muted); }

.mc-status {
    font-size: .6rem; font-weight: 700;
    padding: .15rem .5rem; border-radius: 2px;
    text-transform: uppercase; letter-spacing: .5px;
    font-family: var(--mono);
}
.mc-status.ok { background: rgba(0,230,118,.12); color: var(--green); }
.mc-status.warning { background: rgba(255,214,0,.12); color: var(--yellow); }
.mc-status.stopped { background: rgba(255,61,61,.12); color: var(--red); animation: blinkBadge .8s infinite; }

/* ═══ HOURS & STATUS CONTROLS ════════════════════════════════ */
.mc-hours-row {
    display: flex; align-items: center; gap: .4rem;
    margin-top: .6rem; padding-top: .6rem;
    border-top: 1px solid var(--border);
}
.mc-hours-row label { font-size: .68rem; color: var(--text-muted); white-space: nowrap; }
.mc-hours-row input {
    width: 80px; padding: .25rem .4rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
    font-family: var(--mono); font-size: .8rem; text-align: right;
    color: var(--text); outline: none;
}
.mc-hours-row input:focus { border-color: var(--cyan); }
.mc-status-btns {
    display: flex; gap: .25rem; margin-top: .4rem;
}
.mc-status-btns button {
    flex: 1; padding: .2rem; font-size: .58rem;
    border: 1px solid var(--border); border-radius: 3px;
    cursor: pointer; font-weight: 700; letter-spacing: .5px;
    background: transparent; color: var(--text-muted);
    font-family: var(--sans); transition: all .15s;
    text-transform: uppercase;
}
.mc-status-btns button:hover { opacity: .8; }
.mc-status-btns .s-ok { border-color: rgba(0,230,118,.3); color: var(--green); }
.mc-status-btns .s-ok.active { background: var(--green); color: #000; }
.mc-status-btns .s-warn { border-color: rgba(255,214,0,.3); color: var(--yellow); }
.mc-status-btns .s-warn.active { background: var(--yellow); color: #000; }
.mc-status-btns .s-stop { border-color: rgba(255,61,61,.3); color: var(--red); }
.mc-status-btns .s-stop.active { background: var(--red); color: #fff; }

/* ═══ COMPACT MACHINE CARDS (utilities) ═══════════════════════ */
.machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .8rem;
}
.machine-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    border-top: 3px solid var(--cyan);
    transition: border-color .2s;
}
.machine-card:hover { border-color: var(--cyan); }
.machine-card.compact { padding: .8rem; }
.machine-card .mc-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: .5rem;
}
.machine-card .mc-id { font-family: var(--mono); font-size: 1rem; font-weight: 700; color: var(--cyan); }
.machine-card .mc-name { font-size: .78rem; font-weight: 600; margin-bottom: .2rem; }
.machine-card .mc-detail { font-size: .7rem; color: var(--text-muted); margin-bottom: .1rem; }
.machine-card.compact .mc-id { font-size: .9rem; }
.machine-card.compact .mc-name { font-size: .72rem; }

/* ═══ FILTER BAR ═══════════════════════════════════════════════ */
.filter-bar {
    display: flex; flex-wrap: wrap; gap: .5rem;
    align-items: center; margin-bottom: 1rem;
    background: var(--panel); padding: .7rem .8rem;
    border-radius: var(--radius); border: 1px solid var(--border);
}
.filter-bar input[type="text"],
.filter-bar input[type="number"],
.filter-bar select {
    padding: .4rem .6rem;
    background: var(--bg); border: 1px solid var(--border); border-radius: 3px;
    font-size: .82rem; color: var(--text); min-width: 150px;
    font-family: var(--sans); outline: none;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--cyan); }
.filter-bar input[type="text"] { flex: 1; min-width: 180px; }
.filter-bar label { display: flex; align-items: center; gap: .4rem; font-size: .8rem; white-space: nowrap; color: var(--text-muted); }

/* ═══ CALENDAR VIEW ═════════════════════════════════════════════ */
.cal-filters { margin-bottom: .8rem; }
.cal-view-wrap { display: flex; flex-wrap: nowrap; gap: 1rem; align-items: flex-start; margin-bottom: 1rem; }
.cal-left { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.cal-month-nav {
    display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem;
}
.cal-month-title { font-size: 1.1rem; margin: 0; color: var(--text); min-width: 180px; text-align: center; }
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: var(--border);
    border: 1px solid var(--border);
    flex: 1 1 0;
    min-width: 0;
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 320px;
    flex: 1;
}
.cal-cell {
    background: var(--panel);
    min-height: 72px;
    padding: .35rem;
    font-size: .7rem;
    cursor: pointer;
    transition: background .15s;
}
.cal-cell-head {
    cursor: default;
    font-weight: 700;
    color: var(--text-muted);
    min-height: auto;
    padding: .4rem;
    text-align: center;
}
.cal-cell:hover:not(.cal-cell-head) { background: var(--bg); }
.cal-cell.other-month { opacity: .5; }
.cal-cell-date { font-weight: 700; margin-bottom: .25rem; color: var(--text-muted); }
.cal-cell-today .cal-cell-date { color: var(--cyan); }
.cal-cell-dots { display: flex; flex-wrap: wrap; gap: 2px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; }
.cal-dot.scheduled { background: var(--orange); }
.cal-dot.performed { background: var(--green); }
.cal-dot.critical { background: var(--red); }
.cal-day-panel {
    flex: 0 0 340px;
    max-width: 400px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: 1rem;
}
.cal-day-panel.hidden { display: none !important; }
.cal-day-panel:not(.hidden) { display: flex; flex-direction: column; }
.cal-day-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem .8rem; background: var(--bg); border-bottom: 1px solid var(--border);
}
.cal-day-panel-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.cal-day-panel-body { padding: .8rem; overflow-y: auto; max-height: calc(100vh - 200px); }
.cal-day-section { font-size: .85rem; color: var(--cyan); margin: .6rem 0 .5rem 0; font-weight: 600; }
.cal-day-list { list-style: none; padding: 0; margin: 0 0 1rem 0; }
.cal-day-list li {
    padding: .5rem .6rem; margin-bottom: .4rem;
    background: var(--bg); border-radius: 6px; border-left: 3px solid var(--border);
    font-size: .82rem; line-height: 1.4;
}
.cal-day-list li .cal-item-machine { font-weight: 700; color: var(--text); display: block; margin-bottom: .15rem; }
.cal-day-list li .cal-item-action { color: var(--text-muted); display: block; }
.cal-day-list li a.cal-link-detail { font-size: .75rem; margin-top: .3rem; display: inline-block; color: var(--cyan); }
.cal-list-toggle-wrap { margin-bottom: .8rem; }
#cal-table-wrapper.hidden { display: none !important; }

/* ═══ BUTTONS ══════════════════════════════════════════════════ */
.btn {
    padding: .4rem .9rem; border: none; border-radius: 3px;
    font-size: .8rem; font-weight: 600; cursor: pointer;
    background: var(--orange); color: #fff;
    font-family: var(--sans); transition: opacity .15s;
    letter-spacing: .3px;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--orange); }
.btn-cancel { background: var(--text-muted); color: #fff; }
.btn-sm { padding: .2rem .5rem; font-size: .7rem; }
.btn-active { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: rgba(255,255,255,.06); }
.btn-green { background: var(--green); color: #000; }
.btn-done {
    background: rgba(0,230,118,.1); color: var(--green);
    border: 1px solid rgba(0,230,118,.3);
    font-size: .68rem; padding: .25rem .6rem;
    border-radius: 3px; cursor: pointer; font-weight: 700;
}
.btn-done:hover { background: rgba(0,230,118,.2); }

/* ═══ TABLES ═══════════════════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%; border-collapse: collapse;
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    font-size: .78rem;
}
thead { background: var(--bg); }
th {
    padding: .5rem .7rem; text-align: left;
    font-weight: 700; font-size: .65rem;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-muted); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td {
    padding: .45rem .7rem; border-bottom: 1px solid var(--border);
    vertical-align: top;
}
tbody tr:hover { background: rgba(255,255,255,.02); }
tr.critical { background: rgba(255,61,61,.06); }
tr.critical:hover { background: rgba(255,61,61,.1); }
tr.wf-paused-row { background: rgba(255,193,7,.08); border-left: 3px solid var(--yellow); }
tr.wf-paused-row:hover { background: rgba(255,193,7,.14); }
.btn-resume { background: var(--yellow) !important; color: #111 !important; font-weight: 600; }
.btn-resume:hover { background: #e6a800 !important; }

/* ═══ PAGINATION ═══════════════════════════════════════════════ */
.pagination {
    display: flex; gap: .3rem; align-items: center;
    justify-content: center; margin-top: 1rem;
}
.pagination button {
    padding: .3rem .6rem; border: 1px solid var(--border);
    border-radius: 3px; background: var(--panel);
    cursor: pointer; font-size: .75rem; color: var(--text);
    font-family: var(--sans);
}
.pagination button.active { background: var(--orange); color: #fff; border-color: var(--orange); }
.pagination button:disabled { opacity: .3; cursor: default; }

.results-info { font-size: .78rem; color: var(--text-muted); margin-bottom: .5rem; }

/* ═══ JOURNAL LAYOUT ═══════════════════════════════════════════ */
.journal-layout {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.journal-form-wrap, .journal-log-wrap {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem;
}
.journal-form-wrap h3, .journal-log-wrap h3 {
    margin-bottom: .8rem; font-size: .9rem; color: var(--text);
}

form .form-row { display: flex; gap: .6rem; margin-bottom: .6rem; }
form .form-row label {
    display: flex; flex-direction: column; gap: .2rem;
    font-size: .75rem; font-weight: 600; color: var(--text-muted); flex: 1;
}
form input[type="text"],
form input[type="date"],
form input[type="number"],
form input[type="password"],
form textarea,
form select {
    padding: .4rem .5rem;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 3px; font-size: .82rem;
    font-family: var(--sans); color: var(--text);
    width: 100%; outline: none;
}
form input:focus, form textarea:focus, form select:focus { border-color: var(--cyan); }
form textarea { resize: vertical; }

/* ═══ MODAL ════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.3rem;
    width: 90%; max-width: 520px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
}
.modal h3 { margin-bottom: .8rem; color: var(--text); }
.modal p { margin-bottom: .8rem; font-size: .85rem; line-height: 1.5; }
.modal-auto-row {
    display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: .8rem;
    padding: .5rem 0; border-bottom: 1px solid var(--border);
    font-size: .85rem; color: var(--text-muted);
}
.modal-auto-row strong { color: var(--text); }
.modal-buttons { display: flex; gap: .5rem; margin-top: .8rem; }

/* ═══ RESPONSIVE ═══════════════════════════════════════════════ */
@media (max-width: 900px) {
    .journal-layout { grid-template-columns: 1fr; }
    .cal-view-wrap { flex-wrap: wrap; }
    .cal-left { flex: 1 1 100%; }
    .cal-day-panel { flex: 1 1 100%; max-width: 100%; }
}
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.open { transform: translateX(0); }
    #content { margin-left: 0; }
    #menu-toggle { display: block; }
    .machine-grid { grid-template-columns: 1fr; }
    .equip-grid { grid-template-columns: 1fr 1fr; }
    .line-group-header { flex-direction: column; align-items: flex-start; }
    .stats-cards { grid-template-columns: repeat(2, 1fr); }
    .section { padding: .8rem; }
    .filter-bar { flex-direction: column; }
    .filter-bar input[type="text"] { min-width: unset; width: 100%; }
    form .form-row { flex-direction: column; }
}

/* ═══ TOAST ════════════════════════════════════════════════════ */
.toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    background: var(--panel); color: var(--text);
    padding: .7rem 1rem; border-radius: var(--radius);
    font-size: .82rem; border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
    z-index: 300; animation: slideIn .3s ease-out;
}
.toast.success { border-color: var(--green); color: var(--green); }
.toast.error { border-color: var(--red); color: var(--red); }

/* ═══ SCROLLBAR ════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ═══ EMPTY STATE ══════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state .icon { font-size: 2rem; margin-bottom: .4rem; }

/* ═══ NAV SEPARATOR ════════════════════════════════════════════ */
.nav-separator {
    height: 1px; background: var(--border);
    margin: .3rem 1rem; list-style: none;
}

/* ═══ CHARTS ══════════════════════════════════════════════════ */
.charts-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: .8rem;
}
.chart-card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem;
}
.chart-card h4 {
    font-size: .7rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 1px; margin-bottom: .6rem;
    padding-bottom: .4rem; border-bottom: 1px solid var(--border);
}
.chart-card canvas { max-height: 260px; }

/* ═══ CHAT ═════════════════════════════════════════════════════ */
.chat-container {
    display: flex; flex-direction: column;
    height: calc(100vh - 70px); max-height: calc(100vh - 70px);
    background: var(--panel); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.chat-title { display: flex; align-items: center; gap: .6rem; }
.chat-avatar { font-size: 1.5rem; }
.chat-title strong { font-size: .88rem; display: block; color: var(--text); }
.chat-subtitle { font-size: .65rem; color: var(--text-muted); }

.chat-api-setup {
    padding: .8rem 1rem;
    background: rgba(255,107,26,.06);
    border-bottom: 1px solid rgba(255,107,26,.2);
}
.chat-api-setup.hidden { display: none; }
.chat-api-setup p { font-size: .78rem; margin-bottom: .4rem; }
.chat-api-setup .form-row { display: flex; gap: .4rem; align-items: flex-end; }
.chat-api-setup input { flex: 1; }
.chat-api-hint { font-size: .68rem; color: var(--text-muted); margin-top: .3rem; }
.chat-api-status-line { font-size: .8rem; color: var(--text-muted); margin: .4rem 0 .6rem; padding: .35rem .5rem; background: rgba(0,0,0,.06); border-radius: 4px; }
.chat-api-status-line.chat-api-status-missing { color: var(--warn); background: rgba(255,180,0,.1); }

.chat-messages {
    flex: 1; overflow-y: auto;
    padding: .8rem 1rem;
    display: flex; flex-direction: column; gap: .6rem;
}
.chat-msg {
    display: flex; gap: .5rem; max-width: 85%;
    animation: fadeInUp .3s ease-out;
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
    background: var(--surface); border: 1px solid var(--border);
}
.chat-msg.user .chat-msg-avatar { background: var(--orange); border-color: var(--orange); }

.chat-msg-content {
    padding: .6rem .9rem; border-radius: 8px;
    font-size: .82rem; line-height: 1.5;
}
.chat-msg.bot .chat-msg-content { background: var(--surface); border: 1px solid var(--border); }
.chat-msg.user .chat-msg-content { background: var(--orange); color: #fff; }

.chat-msg-content p { margin-bottom: .3rem; }
.chat-msg-content p:last-child { margin-bottom: 0; }
.chat-msg-content ul, .chat-msg-content ol { margin: .3rem 0 .3rem 1rem; }
.chat-msg-content li { margin-bottom: .15rem; }
.chat-msg-content code {
    background: rgba(255,255,255,.08); padding: .1rem .3rem;
    border-radius: 2px; font-family: var(--mono); font-size: .75rem;
}
.chat-msg-content pre {
    background: var(--bg); border: 1px solid var(--border);
    padding: .5rem .7rem; border-radius: 4px;
    overflow-x: auto; font-size: .72rem; margin: .3rem 0;
}
.chat-msg-content pre code { background: none; padding: 0; }
.chat-msg-content strong { font-weight: 700; }
.chat-msg-content table {
    width: 100%; font-size: .72rem; margin: .3rem 0;
    border: 1px solid var(--border);
}
.chat-msg-content th, .chat-msg-content td { padding: .25rem .4rem; text-align: left; }

.chat-msg.typing .chat-msg-content::after {
    content: '●●●'; animation: blink 1.2s infinite; letter-spacing: 2px;
}

.chat-suggestions {
    display: flex; flex-wrap: wrap; gap: .3rem;
    padding: .4rem 1rem; border-top: 1px solid var(--border);
}
.suggestion-chip {
    padding: .25rem .6rem; border: 1px solid var(--border);
    border-radius: 99px; background: transparent;
    font-size: .68rem; cursor: pointer; transition: all .15s;
    color: var(--text-muted); white-space: nowrap;
}
.suggestion-chip:hover { background: var(--orange); color: #fff; border-color: var(--orange); }

.chat-input-bar {
    display: flex; gap: .4rem; padding: .6rem 1rem;
    border-top: 1px solid var(--border); background: var(--surface);
}
.chat-input-bar input {
    flex: 1; padding: .5rem .7rem;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 4px; font-size: .85rem;
    font-family: var(--sans); color: var(--text); outline: none;
}
.chat-input-bar input:focus { border-color: var(--cyan); }
.chat-input-bar .btn { border-radius: 4px; padding: .5rem 1rem; }

.chat-query-table { margin: .4rem 0; overflow-x: auto; }
.chat-query-table table { font-size: .68rem; background: var(--bg); }

@keyframes fadeInUp {
    from { transform: translateY(.4rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes blink { 0%,100%{opacity:.3} 50%{opacity:1} }
@keyframes slideIn {
    from { transform: translateY(.8rem); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-30px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@media (max-width: 768px) {
    .charts-grid { grid-template-columns: 1fr; }
    .chat-msg { max-width: 95%; }
    .chat-suggestions { overflow-x: auto; flex-wrap: nowrap; }
}

/* ═══ ALARM PANEL ═════════════════════════════════════════════ */
.alarm-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 380px; max-width: 90vw;
    background: var(--surface);
    border-left: 1px solid var(--border);
    z-index: 250;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s ease;
    box-shadow: -4px 0 20px rgba(0,0,0,.4);
}
.alarm-panel.open { transform: translateX(0); }

.alarm-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255,61,61,.06);
}
.alarm-panel-header h3 {
    font-size: .75rem; font-weight: 800;
    letter-spacing: 1.5px; color: var(--red);
    font-family: var(--mono);
}
.alarm-panel-actions { display: flex; align-items: center; gap: .4rem; }

.alarm-close {
    background: none; border: 1px solid var(--border);
    color: var(--text-muted); font-size: 1rem;
    width: 28px; height: 28px; border-radius: 3px;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all .15s;
}
.alarm-close:hover { background: rgba(255,61,61,.15); color: var(--red); border-color: var(--red); }

.alarm-list {
    flex: 1; overflow-y: auto; padding: .4rem;
}

.alarm-item {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .6rem .8rem;
    margin-bottom: .4rem;
    border-left: 3px solid var(--amber);
    animation: fadeInUp .3s ease-out;
}
.alarm-item.critical { border-left-color: var(--red); background: rgba(255,61,61,.04); }

.alarm-item-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: .3rem;
}
.alarm-machine {
    font-family: var(--mono); font-size: .8rem;
    font-weight: 700; color: var(--orange);
}
.alarm-severity {
    font-family: var(--mono); font-size: .55rem;
    font-weight: 700; letter-spacing: 1px;
    padding: .1rem .35rem; border-radius: 2px;
}
.alarm-severity.critical { background: rgba(255,61,61,.15); color: var(--red); }
.alarm-severity.warning { background: rgba(255,170,0,.12); color: var(--amber); }
.alarm-item.open_case { border-left-color: var(--cyan); background: rgba(0,200,255,.04); }
.alarm-severity.open_case { background: rgba(0,200,255,.15); color: var(--cyan); }
.alarm-vezi { background: rgba(0,200,255,.12) !important; color: var(--cyan) !important; border-color: rgba(0,200,255,.3) !important; }

.alarm-action {
    font-size: .72rem; color: var(--text);
    margin-bottom: .3rem; line-height: 1.4;
}
.alarm-cause, .alarm-solution {
    font-size: .65rem; color: var(--text-muted);
    margin-bottom: .2rem; line-height: 1.35;
    padding-left: .4rem;
    border-left: 2px solid var(--border);
}
.alarm-cause strong, .alarm-solution strong {
    color: var(--text); font-size: .6rem;
}
.alarm-item.info { border-left-color: var(--cyan); background: rgba(0,200,255,.03); }
.alarm-severity.info { background: rgba(0,200,255,.12); color: var(--cyan); }
.alarm-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-size: .62rem; color: var(--text-muted);
}
.alarm-ack {
    font-size: .6rem; font-weight: 700;
    letter-spacing: .5px; padding: .15rem .4rem;
    border-radius: 2px; cursor: pointer;
    background: rgba(0,230,118,.1); color: var(--green);
    border: 1px solid rgba(0,230,118,.2);
    font-family: var(--mono); transition: all .15s;
}
.alarm-ack:hover { background: var(--green); color: #000; }

.alarm-empty {
    text-align: center; padding: 2rem 1rem;
    color: var(--text-muted); font-size: .8rem;
}
.alarm-empty .icon { font-size: 2rem; margin-bottom: .4rem; display: block; }

/* ═══ DETAIL OVERLAY ══════════════════════════════════════════ */
.detail-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.7);
    z-index: 200; display: flex;
    justify-content: center; align-items: flex-start;
    padding: 2rem 1rem;
    overflow-y: auto;
    backdrop-filter: blur(4px);
}
.detail-overlay.hidden { display: none; }

.detail-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%; max-width: 900px;
    max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
}

.detail-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}
.detail-title-block { display: flex; align-items: center; gap: .8rem; }
.detail-line-id {
    font-family: var(--mono); font-size: 1.4rem;
    font-weight: 900; color: var(--orange);
}
.detail-line-product {
    font-size: .9rem; font-weight: 600; color: var(--text);
}

.detail-machine-info {
    padding: .8rem 1.2rem;
    border-bottom: 1px solid var(--border);
    font-size: .78rem;
}
.detail-info-grid {
    display: flex; flex-wrap: wrap; gap: 1rem;
}
.detail-state-banner {
    display: flex; align-items: center; gap: .4rem;
    padding: .4rem .7rem; border-radius: 5px; margin-bottom: .6rem;
    font-size: .75rem; font-weight: 700;
}
.detail-state-banner.producing { background: rgba(0,200,100,.1); color: #0c6; }
.detail-state-banner.stopped { background: rgba(255,61,61,.08); color: var(--red); }
.detail-state-banner.other { background: rgba(255,170,0,.08); color: var(--amber); }

.detail-active-alarms {
    background: rgba(255,61,61,.04); border: 1px solid rgba(255,61,61,.15);
    border-radius: 6px; padding: .5rem .7rem; margin-bottom: .6rem;
}
.detail-alarms-title {
    font-size: .65rem; font-weight: 700; color: var(--red);
    margin-bottom: .3rem; text-transform: uppercase; letter-spacing: .5px;
}
.detail-alarm-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .2rem 0; font-size: .7rem;
    border-bottom: 1px solid rgba(255,61,61,.08);
}
.detail-alarm-row:last-child { border-bottom: none; }
.detail-alarm-code { font-family: var(--mono); font-weight: 700; min-width: 3rem; }
.detail-alarm-desc { flex: 1; color: var(--text); }

.detail-consum-banner {
    display: flex; align-items: center; gap: .4rem;
    padding: .4rem .7rem; border-radius: 5px; margin-top: .6rem;
    background: rgba(0,200,255,.06); border-left: 3px solid var(--cyan);
    font-size: .75rem;
}
.detail-consum-icon { font-size: 1rem; }
.detail-consum-label { color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; font-size: .6rem; }
.detail-consum-val { font-family: var(--mono); font-weight: 700; color: var(--cyan); margin-left: auto; }

.detail-stale-banner {
    display: flex; align-items: center; gap: .4rem;
    padding: .35rem .7rem; border-radius: 5px; margin-top: .4rem;
    background: rgba(255,170,0,.08); border-left: 3px solid #ffaa00;
    font-size: .7rem; color: #ffaa00;
    animation: stalePulse 2s ease-in-out infinite;
}
.detail-stale-banner .stale-icon { font-size: .9rem; }
.detail-stale-banner strong { color: #ffd060; }
@keyframes stalePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .6; }
}

.detail-info-item {
    display: flex; flex-direction: column; gap: .1rem;
}
.detail-info-item-conn {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .5rem;
}
.detail-info-item-conn .detail-info-label { margin-right: .15rem; }
.detail-info-item-conn .detail-info-value { margin-right: .25rem; }
.detail-conn-configure {
    font-size: .75rem;
    padding: .15rem .4rem;
    background: transparent;
    border: none;
    color: var(--cyan);
    cursor: pointer;
    text-decoration: underline;
}
.detail-conn-configure:hover { color: var(--orange); }
.detail-info-label {
    font-size: .55rem; font-weight: 700;
    letter-spacing: 1.5px; color: var(--text-muted);
    text-transform: uppercase;
}
.detail-info-value {
    font-family: var(--mono); font-weight: 600;
    color: var(--text);
}

.detail-tabs {
    display: flex; border-bottom: 1px solid var(--border);
    padding: 0 1.2rem; gap: 0;
}
.detail-tab {
    padding: .6rem 1rem;
    background: none; border: none;
    font-size: .72rem; font-weight: 700;
    letter-spacing: .5px; text-transform: uppercase;
    color: var(--text-muted); cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s; font-family: var(--sans);
}
.detail-tab:hover { color: var(--text); }
.detail-tab.active { color: var(--orange); border-bottom-color: var(--orange); }

.detail-content {
    flex: 1; overflow-y: auto;
    padding: 1rem 1.2rem;
}
.detail-content table { font-size: .72rem; }
.detail-content th { font-size: .6rem; }

.doc-upload-section {
    margin-top: 1.5rem; padding: 1.2rem;
    border: 1px dashed var(--border); border-radius: 8px;
    background: rgba(0,180,255,.03);
}
.doc-upload-title { font-size: .95rem; color: var(--cyan); margin: 0 0 .8rem 0; font-weight: 700; }
.doc-upload-form .form-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: .7rem; align-items: end; }
.doc-upload-form label { font-size: .8rem; color: var(--text-muted); display: block; margin-bottom: 3px; }

.consum-summary { margin-bottom: 1rem; }
.consum-current {
    display: flex; align-items: baseline; gap: .6rem; margin-bottom: .5rem;
    padding: .6rem .8rem; background: rgba(0, 200, 255, 0.08); border-radius: 6px; border-left: 3px solid var(--cyan);
}
.consum-current-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.consum-current-value { font-family: var(--mono); font-size: 1.2rem; font-weight: 700; color: var(--cyan); }
.consum-hint { font-size: .65rem; color: var(--text-muted); margin: 0 0 .8rem 0; }
.consum-chart-wrap { height: 220px; position: relative; }
.doc-upload-form input[type="file"] { font-size: .85rem; padding: .4rem; }
.doc-upload-form select { padding: .4rem .6rem; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: .85rem; }
.doc-upload-form input[type="text"] { padding: .4rem .6rem; min-width: 200px; width: 100%; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: .85rem; }

.doc-process-hint { font-size: .75rem; color: var(--text-muted); margin: 0 0 .6rem 0; }
.doc-processed-badge { color: var(--ok); font-size: .8rem; }
.doc-pending-hint { color: var(--text-muted); font-size: .8rem; }
.doc-process-btn { white-space: nowrap; }
.doc-reprocess-btn { white-space: nowrap; margin-left: .35rem; }
.doc-delete-btn { white-space: nowrap; margin-left: .35rem; background: rgba(255,60,60,.15); color: #ff4444; border-color: rgba(255,60,60,.3); }
.doc-delete-btn:hover { background: rgba(255,60,60,.3); }
.doc-status-inline { font-size: .8rem; color: var(--cyan); margin-right: .5rem; }
.doc-actions-cell {
    white-space: normal;
    min-width: 180px;
    display: flex; flex-wrap: wrap; gap: 4px;
}
.doc-actions-cell .btn { font-size: .65rem; padding: .2rem .4rem; margin: 0 !important; }
.doc-status-tag { display: inline-block; padding: .15rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 600; letter-spacing: .02em; }
.doc-status-unprocessed { background: rgba(255,255,255,.08); color: var(--text-muted); }
.doc-status-processing { background: rgba(0,180,255,.15); color: #00b4ff; animation: doc-pulse 1.5s ease-in-out infinite; }
.doc-status-processed { background: rgba(0,200,120,.15); color: var(--ok); }
.doc-status-reprocessed { background: rgba(0,220,180,.15); color: #00dcc8; }
.doc-status-error { background: rgba(255,60,60,.15); color: #ff4444; }
@keyframes doc-pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

.extract-type-title { font-size: .9rem; color: var(--cyan); margin: 1rem 0 .5rem 0; }
.extract-list { display:grid; grid-template-columns:repeat(auto-fill, minmax(380px, 1fr)); gap:.7rem; margin-bottom: 1rem; }
.extract-item { padding: .7rem .9rem; background: var(--card-bg); border:1px solid var(--border); border-radius: 8px; }
.extract-clickable { cursor: pointer; transition: border-color .2s, background .2s; }
.extract-clickable:hover { border-color: var(--cyan); background: rgba(0,200,255,.04); }
.extract-expanded { border-color: var(--cyan); background: rgba(0,200,255,.06); }
.extract-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; font-size:.88rem; }
.extract-expand-icon { font-size: .7rem; color: var(--cyan); margin-left: .5rem; flex-shrink: 0; transition: transform .2s; }
.extract-item strong:not(.extract-title-row) { display: block; margin-bottom: .25rem; font-size:.88rem; }
.extract-content { font-size: .82rem; color: var(--text-muted); margin: 0 0 .4rem; white-space: pre-wrap; line-height:1.5; }
.extract-full { animation: extractSlide .2s ease-out; }
.extract-full .extract-content { color: var(--text); font-size: .84rem; }
@keyframes extractSlide { from { opacity: 0; max-height: 0; } to { opacity: 1; max-height: 2000px; } }
.extract-info-row { display:flex; align-items:flex-start; gap:8px; padding:5px 0; border-top:1px solid var(--border); }
.extract-label { font-size:.65rem; font-weight:700; text-transform:uppercase; letter-spacing:.5px; min-width:70px; padding-top:2px; flex-shrink:0; }
.extract-label-tools { color:var(--cyan); }
.extract-label-safety { color:var(--red); }
.extract-label-ref { color:var(--orange); }
.extract-label-video { color:#14b8a6; }
.extract-value { font-size:.76rem; line-height:1.5; color:var(--text-muted); }
.extract-val-safety { color:var(--red) !important; }

.detail-parts-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: .8rem;
}
.detail-parts-search {
    flex: 1;
    min-width: 180px;
    padding: .4rem .6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: .8rem;
}
.detail-parts-category {
    padding: .4rem .6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
    font-size: .75rem;
}
.detail-parts-summary {
    font-size: .7rem;
    color: var(--text-muted);
}

.detail-revision-intro {
    font-size: .75rem;
    color: var(--text-muted);
    margin-bottom: .8rem;
    line-height: 1.4;
}
.detail-filter-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: .8rem;
    padding: .4rem .6rem;
    background: rgba(255,255,255,.03);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,.06);
}
.detail-filter-bar label {
    font-size: .75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: .4rem;
}
.detail-filter-bar select {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 4px;
    padding: .25rem .5rem;
    font-size: .75rem;
    cursor: pointer;
    min-width: 140px;
}
.detail-filter-bar select:focus {
    outline: none;
    border-color: var(--accent);
}
.detail-revision-table { margin-top: 0; }
.detail-revision-table .wear-bar-wrap,
#calendar-table .wear-bar-wrap {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 100px;
}
.detail-revision-table .wear-bar,
#calendar-table .wear-bar {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}
.detail-revision-table .wear-fill,
#calendar-table .wear-fill {
    height: 100%;
    border-radius: 4px;
    transition: width .3s;
}
.detail-revision-table .wear-fill.normal,
#calendar-table .wear-fill.normal { background: var(--green); }
.detail-revision-table .wear-fill.warning,
#calendar-table .wear-fill.warning { background: var(--yellow); }
.detail-revision-table .wear-fill.critical,
#calendar-table .wear-fill.critical { background: var(--red); }
.detail-revision-table .wear-pct,
#calendar-table .wear-pct {
    font-family: var(--mono);
    font-size: .7rem;
    font-weight: 700;
    min-width: 2.5rem;
}
.detail-revision-table .wear-pct.normal { color: var(--green); }
.detail-revision-table .wear-pct.warning { color: var(--yellow); }
.detail-revision-table .wear-pct.critical { color: var(--red); }
.stoc-badge { font-size: .7rem; font-weight: 600; padding: .15rem .4rem; border-radius: 3px; }
.stoc-ok { background: rgba(0,230,118,.2); color: var(--green); }
.stoc-no { background: rgba(255,61,61,.2); color: var(--red); }
.stoc-placeholder { font-size: .65rem; color: var(--text-muted); font-style: italic; }

.btn-revision-detail {
    padding: .35rem .6rem;
    font-size: .7rem;
    font-weight: 600;
    background: var(--orange);
    color: var(--bg);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}
.btn-revision-detail:hover {
    filter: brightness(1.1);
}

/* ═══ INTERFAȚĂ DETALII REVIZIE ════════════════════════════════ */
.revision-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: var(--bg, #0f1923);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    overflow-y: auto;
}
.revision-detail-overlay.hidden { display: none; }

.revision-detail-panel {
    background: var(--panel);
    border: none;
    border-radius: 0;
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: none;
}

.revision-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.revision-detail-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 .25rem 0;
    line-height: 1.3;
}
.revision-detail-subtitle {
    font-size: .8rem;
    color: var(--text-muted);
    margin: 0;
}

.revision-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}
.revision-detail-section {
    margin-bottom: 1.25rem;
}
.revision-detail-section h3 {
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--cyan);
    margin: 0 0 .5rem 0;
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--border);
}
.revision-detail-content {
    font-size: .85rem;
    line-height: 1.5;
    color: var(--text);
}
.revision-detail-action {
    font-weight: 600;
    margin: 0 0 .5rem 0;
}
.revision-detail-dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: .25rem .1rem;
    margin: 0;
    font-size: .8rem;
}
.revision-detail-dl dt {
    color: var(--text-muted);
    margin: 0;
}
.revision-detail-dl dd { margin: 0; }
.revision-detail-hint {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .5rem;
}
.revision-detail-muted {
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
}
.revision-detail-list {
    margin: 0;
    padding-left: 1.2rem;
}
.revision-detail-list li {
    margin-bottom: .35rem;
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
}
.revision-doc-link {
    font-size: .8rem;
    color: var(--cyan);
    text-decoration: none;
    white-space: nowrap;
}
.revision-doc-link:hover { text-decoration: underline; }
.revision-guide-intro {
    font-size: .8rem;
    font-weight: 600;
    margin: 0 0 .5rem 0;
    color: var(--cyan);
}
.revision-guide-steps {
    margin: 0 0 .5rem 0;
    padding-left: 1.2rem;
}
.revision-guide-steps li {
    margin-bottom: .4rem;
}
.revision-step-item {
    margin-bottom: .6rem;
}
.revision-step-content {
    margin-top: .25rem;
    padding-left: .5rem;
    font-size: .82rem;
    line-height: 1.45;
    color: var(--text);
    white-space: pre-wrap;
}
.revision-guide-hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0 .75rem 0;
}
.revision-guide-closing { margin-bottom: 0; }
.revision-guide-closing li { margin-bottom: .3rem; }

.revision-placeholder {
    background: rgba(0,200,255,.06);
    border: 1px dashed var(--border);
    border-radius: 4px;
    padding: .8rem;
}
.revision-placeholder-text {
    font-size: .8rem;
    color: var(--text-muted);
    margin: 0;
}

.revision-assist-modes .revision-assist-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: .75rem;
}
.revision-assist-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .75rem;
    text-align: center;
}
.revision-assist-card strong {
    display: block;
    font-size: .8rem;
    margin-bottom: .25rem;
}
.revision-assist-card p {
    font-size: .7rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.35;
}
.revision-assist-icon {
    font-size: 1.5rem;
    display: block;
    margin-bottom: .4rem;
}

.revision-detail-footer {
    display: flex;
    gap: .75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    border-radius: 0 0 8px 8px;
}
.revision-detail-footer .btn-primary { flex: 1; }

/* ═══ THRESHOLD REFERENCE GRID ════════════════════════════════ */
.threshold-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .6rem;
}
.th-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: .6rem .8rem;
}
.th-type {
    font-size: .65rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--orange);
    margin-bottom: .4rem;
    padding-bottom: .3rem;
    border-bottom: 1px solid var(--border);
}
.th-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .65rem;
    padding: .15rem 0;
}
.th-sensor { color: var(--text-muted); }
.th-warn { color: var(--yellow); font-family: var(--mono); font-weight: 600; }
.th-crit { color: var(--red); font-family: var(--mono); font-weight: 600; }

/* ═══ SENSOR GRID ON CARDS ════════════════════════════════════ */
.sensor-grid-inline {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin: .3rem 0;
}
.sensor-inline {
    background: var(--bg);
    border-radius: 3px;
    padding: .2rem .35rem;
    display: flex;
    align-items: baseline;
    gap: .15rem;
    min-width: 0;
    overflow: hidden;
}
.sensor-lbl {
    font-size: .48rem;
    font-weight: 700;
    letter-spacing: .5px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.sensor-val-live {
    font-family: var(--mono);
    font-size: .72rem;
    font-weight: 700;
    transition: color .3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.equip-card .sensor-grid-inline { margin: .15rem 0; }
.equip-card .sensor-inline { padding: .15rem .25rem; }
.equip-card .sensor-val-live { font-size: .65rem; }
.sensor-val-live.normal  { color: var(--green); }
.sensor-val-live.warning { color: var(--yellow); }
.sensor-val-live.critical { color: var(--red); animation: blinkBadge .8s infinite; }

/* ═══ MOLD COUNTERS (cycle + hours display on mold cards) ═══ */
.mold-counters {
    padding: .35rem 0;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
.mold-counter-row {
    display: flex;
    align-items: center;
    gap: .45rem;
    background: var(--bg);
    border-radius: 5px;
    padding: .35rem .55rem;
    border-left: 3px solid var(--border);
}
.mold-ctr-icon {
    font-size: 1rem;
    flex-shrink: 0;
}
.mold-ctr-label {
    font-size: .65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    min-width: 50px;
}
.mold-ctr-val {
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 700;
    margin-left: auto;
    transition: color .3s;
}
.mold-ctr-val.normal  { color: var(--green); }
.mold-ctr-val.warning { color: var(--yellow); border-left-color: var(--yellow); }
.mold-ctr-val.critical { color: var(--red); animation: blinkBadge .8s infinite; }
.mold-counter-row:has(.mold-ctr-val.warning) { border-left-color: var(--yellow); }
.mold-counter-row:has(.mold-ctr-val.critical) { border-left-color: var(--red); }
.mold-linked-info {
    font-size: .6rem;
    color: var(--text-muted);
    text-align: center;
    padding-top: .15rem;
    opacity: .7;
}
.mold-active-badge {
    font-size: .55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: .2rem .4rem;
    border-radius: 4px;
    align-self: flex-start;
}
.mold-active-badge.active {
    background: rgba(0, 230, 118, 0.2);
    color: var(--green);
    border: 1px solid var(--green);
}
.mold-active-badge.inactive {
    background: rgba(158, 158, 158, 0.2);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.equip-card.equip-inactive {
    opacity: 0.75;
    border-color: var(--border);
}
.equip-card.equip-inactive .mold-counters .mold-ctr-val { color: var(--text-muted); }

.active-molds-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem 1rem;
    margin: .35rem 0;
    padding: .35rem 0;
    border-top: 1px solid var(--border);
}
.active-mold-row {
    display: flex;
    align-items: center;
    gap: .4rem;
}
.active-mold-row label {
    font-size: .7rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.active-mold-select {
    font-size: .7rem;
    padding: .25rem .5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    min-width: 140px;
}
.sensor-u {
    font-size: .45rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* sensor borders now on equip-card */

/* ═══ DETAIL SENSORS PANEL ═══════════════════════════════════ */
.detail-sensors-panel {
    padding: .8rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: var(--panel);
}
.detail-sensors-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: .4rem;
}
.detail-sensors-panel.collapsed .detail-sensors-header { margin-bottom: 0; }
.detail-sensors-panel.collapsed .detail-gauge-row,
.detail-sensors-panel.collapsed .detail-thresholds { display: none !important; }
.detail-gauge-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .8rem 1.2rem;
    padding: .4rem 0;
    max-width: 100%;
    overflow: hidden;
}
.detail-gauge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    min-width: 70px;
    max-width: 90px;
}
.detail-gauge-val {
    font-family: var(--mono);
    font-size: .9rem;
    font-weight: 700;
    white-space: nowrap;
}
.detail-gauge-unit {
    font-size: .55rem;
    color: var(--text-muted);
    margin-left: 2px;
}
.detail-thresholds {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .3rem .8rem;
    margin-top: .4rem;
    font-size: .55rem;
    font-family: var(--mono);
    color: var(--text-muted);
    max-width: 100%;
    overflow: hidden;
}

/* ═══ SENZORI TAB — afișare clară, card-uri mari, clickabile ════════ */
.sensors-tab-container { padding: .5rem; }
.sensors-tab-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .4rem .6rem; margin-bottom: .5rem;
}
.sensors-tab-count {
    font-size: .75rem; color: var(--text-muted); font-weight: 600;
    letter-spacing: .5px; text-transform: uppercase;
}
.sensors-tab-list { display: flex; flex-direction: column; gap: .4rem; }
.stab-card {
    background: var(--panel); border-radius: 8px;
    border-left: 4px solid var(--green); transition: all .2s;
    overflow: hidden;
}
.stab-card.warning { border-left-color: var(--yellow); }
.stab-card.critical { border-left-color: var(--red); }
.stab-card-main {
    display: grid; grid-template-columns: 50px 1fr auto 80px 24px;
    align-items: center; gap: .5rem; padding: .6rem .8rem;
    cursor: pointer; user-select: none;
}
.stab-card-main:hover { background: rgba(255,255,255,.03); }
.stab-card-left { display: flex; align-items: center; justify-content: center; }
.stab-gauge-mini svg { width: 42px; height: 42px; }
.stab-card-center { min-width: 0; }
.stab-label {
    font-size: .85rem; font-weight: 700; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stab-sensor-key {
    font-size: .55rem; color: var(--text-muted); font-family: var(--mono);
    letter-spacing: .3px; margin-top: 1px;
}
.stab-card-right { text-align: right; }
.stab-value {
    font-family: var(--mono); font-size: 1.2rem; font-weight: 800;
    line-height: 1.1;
}
.stab-unit {
    font-size: .6rem; color: var(--text-muted); font-weight: 600;
}
.stab-sparkline { display: flex; align-items: center; }
.stab-sparkline svg { width: 80px; height: 28px; }
.stab-expand-icon {
    font-size: .6rem; color: var(--text-muted); transition: transform .2s;
    text-align: center;
}
.stab-card.expanded .stab-expand-icon { transform: rotate(180deg); }
.stab-card-details {
    display: none; padding: .5rem 1rem .8rem 1rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,.15);
}
.stab-card.expanded .stab-card-details { display: block; }
.stab-description {
    font-size: .75rem; color: var(--text-muted); line-height: 1.5;
    margin-bottom: .5rem;
}
.stab-desc-icon { font-size: .85rem; margin-right: .3rem; }
.stab-thresholds { display: flex; gap: .8rem; flex-wrap: wrap; margin-bottom: .5rem; }
.stab-thresh {
    font-size: .65rem; font-weight: 600; padding: .15rem .5rem;
    border-radius: 4px; font-family: var(--mono);
}
.stab-thresh.warn { background: rgba(255,170,0,.15); color: #ffaa00; }
.stab-thresh.crit { background: rgba(255,61,61,.15); color: #ff3d3d; }
.stab-history-label {
    font-size: .6rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .5px; margin-bottom: .3rem; font-weight: 600;
}
.stab-chart-svg { width: 100%; max-height: 80px; }
.stab-no-history { font-size: .7rem; color: var(--text-muted); font-style: italic; padding: .3rem 0; }

@media (max-width: 600px) {
    .stab-card-main { grid-template-columns: 40px 1fr auto 20px; gap: .3rem; padding: .5rem; }
    .stab-sparkline { display: none; }
    .stab-value { font-size: 1rem; }
    .stab-label { font-size: .78rem; }
    .stab-gauge-mini svg { width: 34px; height: 34px; }
}

/* ═══ CONECTARE TAB (formular în detaliu utilaj) ═══════════════════ */
.connection-panel-title { font-size: .9rem; margin: 0 0 .5rem 0; color: var(--text); }
.connection-form-panel.connection-panel-meter { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.connection-form-panel {
    padding: 1rem 0;
    max-width: 28rem;
}
.connection-desc {
    font-size: .8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.35;
}
.connection-desc-small {
    margin-bottom: .75rem;
    font-size: .75rem;
    opacity: .9;
}
.connection-how-list {
    margin: 0 0 1rem 1rem;
    padding: 0;
    font-size: .78rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.connection-how-list li { margin-bottom: .4rem; }
.connection-how-list code {
    font-size: .75em;
    background: var(--panel);
    padding: .1rem .3rem;
    border-radius: 3px;
}
.connection-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: .75rem 1rem;
    align-items: end;
    margin-bottom: 1rem;
}
.connection-field {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}
.connection-field label {
    font-size: .7rem;
    font-weight: 600;
    color: var(--text-muted);
}
.connection-field input,
.connection-field select {
    padding: .4rem .5rem;
    font-size: .85rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
}
.connection-field-port { max-width: 6rem; }
.connection-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .75rem;
    align-items: center;
}
.connection-form-actions .btn { margin-right: 0; }
.connection-readonly {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: .5rem;
}
.connection-consum-hint {
    font-size: .75rem;
    color: var(--text-muted);
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
    line-height: 1.4;
}
.connection-consum-hint code { font-size: .85em; background: var(--panel); padding: .1rem .3rem; border-radius: 3px; }

/* Registers table */
#conn-registers-panel { max-width: 100%; }
#conn-registers-panel .connection-form-actions { flex-wrap: wrap; }
#conn-registers-panel .connection-form-actions select { padding: .35rem .5rem; font-size: .8rem; border: 1px solid var(--border); border-radius: 4px; background: var(--bg); color: var(--text); }
.conn-reg-tbl { width: 100%; border-collapse: collapse; font-size: .8rem; }
.conn-reg-tbl th { text-align: left; padding: .4rem .5rem; font-size: .7rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
.conn-reg-tbl td { padding: .35rem .4rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.conn-reg-tbl input, .conn-reg-tbl select { padding: .25rem .35rem; font-size: .78rem; border: 1px solid var(--border); border-radius: 3px; background: var(--bg); color: var(--text); }
.conn-reg-tbl code { font-size: .78rem; background: var(--panel); padding: .1rem .3rem; border-radius: 3px; }
.btn-xs { padding: .15rem .4rem; font-size: .7rem; border-radius: 3px; }
.connection-form-panel { max-width: 100%; }
.connection-form-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.btn-blue { background: var(--clr-info, #2563eb); color: #fff; border: none; }
.btn-blue:hover { background: #1d4ed8; }

/* Senzori comuni */
.shared-sensors-desc { font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.4; }
.shared-sensors-list { margin-top: 1rem; }
.shared-sensors-empty, .no-assignments { font-size: .8rem; color: var(--text-muted); margin: .5rem 0; }
.shared-sensor-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
    background: var(--panel);
}
.shared-sensor-header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: .5rem; }
.shared-sensor-header strong { margin-right: .5rem; }
.shared-sensor-meta { font-size: .75rem; color: var(--text-muted); }
.shared-sensor-meta code { background: var(--bg); padding: .1rem .3rem; border-radius: 3px; }
.shared-sensor-actions { margin-left: auto; }
.shared-sensor-machines { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.shared-sensor-table { width: 100%; font-size: .8rem; }
.shared-sensor-table th, .shared-sensor-table td { padding: .25rem .4rem; text-align: left; }

/* Contoare (PAC3120/PAC3220 etc.) */
.counters-desc { font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.4; }
.counters-list { margin-top: 1rem; }
.counters-empty, .counter-machines .no-assignments { font-size: .8rem; color: var(--text-muted); margin: .5rem 0; }
.counter-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .75rem 1rem;
    margin-bottom: .75rem;
    background: var(--panel);
}
.counter-header { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-bottom: .5rem; }
.counter-header strong { margin-right: .5rem; }
.counter-meta { font-size: .75rem; color: var(--text-muted); }
.counter-actions { margin-left: auto; }
.counter-machines { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--border); }
.counter-tags { font-size: .85rem; }
.counter-tags code { background: var(--bg); padding: .1rem .35rem; border-radius: 3px; margin-right: .25rem; }

@media (max-width: 520px) {
    .connection-form-grid {
        grid-template-columns: 1fr;
    }
    .connection-field-port { max-width: none; }
}

/* ═══ SPARKLINE ═══════════════════════════════════════════════ */
.sparkline-container {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.sparkline-label {
    font-size: .5rem; font-weight: 600;
    letter-spacing: 1.5px; color: var(--text-muted);
    text-transform: uppercase; margin-top: 2px;
}

/* ═══ AR MODULE ═══════════════════════════════════════════════ */
.ar-container { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ar-header {
    padding: .8rem 1.2rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
.ar-header h3 { font-size: .9rem; font-weight: 700; margin-bottom: .2rem; }
.ar-subtitle { font-size: .72rem; color: var(--text-muted); }

.ar-body {
    display: grid; grid-template-columns: 1fr 1fr;
    min-height: 400px;
}
.ar-capture {
    padding: 1rem;
    display: flex; flex-direction: column;
    align-items: center; gap: .6rem;
    border-right: 1px solid var(--border);
}
#ar-video {
    width: 100%; max-width: 400px; border-radius: 4px;
    background: var(--bg); border: 1px solid var(--border);
    min-height: 240px; object-fit: cover;
}
.ar-controls { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.ar-preview { width: 100%; max-width: 400px; }
.ar-preview img { width: 100%; border-radius: 4px; border: 2px solid var(--cyan); }

.ar-results { padding: 1rem; overflow-y: auto; max-height: 500px; }
.ar-search-alt h4 { font-size: .75rem; font-weight: 700; margin-bottom: .4rem; color: var(--text-muted); }
.ar-result-panel { margin-top: .5rem; }

.ar-part-card {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 4px; padding: .6rem .8rem; margin-bottom: .4rem;
    border-left: 3px solid var(--cyan);
}
.ar-part-code { font-family: var(--mono); font-weight: 700; color: var(--cyan); font-size: .82rem; }
.ar-part-desc { font-size: .75rem; color: var(--text); margin-top: .15rem; }
.ar-part-meta { font-size: .62rem; color: var(--text-muted); margin-top: .2rem; display: flex; gap: .5rem; flex-wrap: wrap; }

/* ═══ DIAGNOSTIC MODULE ══════════════════════════════════════ */

/* Header row: tabs + AI selector */
.dx-header-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.dx-header-row .ai-mode-selector { margin: 0; flex-shrink: 0; }

/* Tabs - styled by inline styles on parent, these are just the buttons */
.dx-tab {
    flex: 1;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all .2s;
    text-align: center;
    white-space: nowrap;
}
.dx-tab:hover { color: var(--text); background: rgba(255,255,255,.05); }
.dx-tab.active {
    color: #fff;
    background: linear-gradient(135deg, var(--cyan), #0090cc);
    box-shadow: 0 2px 8px rgba(0,200,255,.25);
}

/* Panels */
.dx-panel { display: none; }
.dx-panel.active { display: block; }

/* Form elements */
.dx-form-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 640px;
}
.dx-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.dx-form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dx-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 140px;
}
.dx-field-wide { grid-column: 1 / -1; }
.dx-label { font-size: .84rem; font-weight: 600; color: var(--text-muted); }
.dx-input {
    width: 100%;
    padding: 10px 12px;
    font-size: .9rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--sans);
    transition: border-color .2s;
    box-sizing: border-box;
}
.dx-input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 2px rgba(0,200,255,.12); }
textarea.dx-input { resize: vertical; min-height: 90px; line-height: 1.5; }
select.dx-input { cursor: pointer; }
select.dx-input option { background: var(--surface); color: var(--text); }

/* Buttons */
.dx-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 28px;
    font-size: .95rem;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--cyan) 0%, #0090cc 100%);
    color: #fff;
    transition: all .2s;
    white-space: nowrap;
    box-shadow: 0 2px 12px rgba(0,200,255,.2);
}
.dx-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(0,200,255,.3); }
.dx-btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.dx-btn-inline { align-self: flex-end; flex-shrink: 0; }

/* Results area */
.dx-results { margin-top: 16px; }
.dx-empty {
    text-align: center;
    padding: 28px 16px;
    color: var(--text-muted);
    font-size: .88rem;
    background: var(--surface);
    border-radius: 10px;
    border: 1px dashed var(--border);
}

/* Table */
.dx-table-wrap {
    max-height: 450px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin-top: 12px;
}
.dx-table-wrap table { width: 100%; }

/* Cards */
.dx-card {
    padding: 14px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    word-wrap: break-word;
}
.dx-card-title { font-size: .88rem; font-weight: 700; margin-bottom: 5px; color: var(--text); }
.dx-card-subtitle { font-size: .76rem; color: var(--text-muted); margin-bottom: 6px; line-height: 1.4; }

/* Bottom row: 2-col grid for lessons + errors */
.dx-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .dx-header-row { flex-wrap: wrap; }
    .dx-tab { padding: 8px 10px; font-size: .78rem; }
    .dx-bottom-grid { grid-template-columns: 1fr; }
}

/* Diag step (used by JS results) */
.diag-step {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 16px; margin-bottom: 8px;
    border-left: 3px solid var(--cyan);
    display: flex; gap: 12px; align-items: flex-start;
}
.diag-step-num {
    font-family: var(--mono); font-size: 1rem; font-weight: 900;
    color: var(--orange); min-width: 28px; flex-shrink: 0;
}
.diag-step-text { font-size: .88rem; line-height: 1.6; flex: 1; }
.diag-step-text strong { color: var(--cyan); }

/* Knowledge base items */
#diag-kb-list { max-height: 340px; overflow-y: auto; }
.diag-kb-item {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 10px; margin-bottom: 5px;
    cursor: pointer; transition: border-color .2s;
}
.diag-kb-item:hover { border-color: var(--cyan); }
.diag-kb-code { font-family: var(--mono); font-size: .72rem; color: var(--orange); font-weight: 700; }
.diag-kb-desc { font-size: .75rem; color: var(--text); margin-top: 3px; line-height: 1.3; }

/* Lessons list */
.diag-lessons-list { margin-top: 8px; max-height: 300px; overflow-y: auto; }
.diag-lesson-item {
    font-size: .78rem; padding: 8px 10px; margin-bottom: 5px;
    border: 1px solid var(--border); border-radius: 6px; background: var(--bg);
}
.diag-lesson-item .meta { color: var(--text-muted); font-size: .7rem; }
.diag-lesson-item .ai-steps {
    margin-top: 4px; padding: 6px; background: rgba(0,200,255,.06);
    border-radius: 6px; white-space: pre-wrap; font-size: .72rem;
}

@media (max-width: 768px) {
    .ar-body { grid-template-columns: 1fr; }
    .ar-capture { border-right: none; border-bottom: 1px solid var(--border); }
}

@media (max-width: 768px) {
    .alarm-panel { width: 100%; }
    .detail-panel { max-height: 95vh; }
    .detail-overlay { padding: .5rem; }
    .equip-grid { grid-template-columns: 1fr; }
}

/* ═══ CONFIG MODALS ═════════════════════════════════════════════ */
.config-modal-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,.65);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(3px);
}
.config-modal-overlay.hidden { display: none; }
.config-modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 10px;
    width: 560px; max-width: 95vw; max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.config-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: .8rem 1.2rem;
    border-bottom: 1px solid var(--border);
}
.config-modal-header h3 { font-size: .95rem; color: var(--cyan); }
.config-modal-close {
    background: none; border: none; color: var(--text-muted); font-size: 1.4rem;
    cursor: pointer; line-height: 1;
}
.config-modal-close:hover { color: var(--red); }
.config-modal-body { padding: 1rem 1.2rem; }

/* Scan Label Section */
.cfg-label-scan-section {
    background: linear-gradient(135deg, rgba(0,200,255,.08), rgba(0,200,255,.02));
    border: 1px dashed rgba(0,200,255,.3);
    border-radius: 8px;
    padding: .6rem .8rem;
    margin-bottom: .7rem;
    text-align: center;
}
.btn-scan-label {
    background: linear-gradient(135deg, #0284c7, #0ea5e9);
    color: #fff;
    border: none;
    padding: .45rem 1rem;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    letter-spacing: .3px;
}
.btn-scan-label:hover {
    background: linear-gradient(135deg, #0369a1, #0284c7);
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(2,132,199,.4);
}
.btn-scan-label:disabled {
    opacity: .6;
    cursor: not-allowed;
    transform: none;
}
.scan-label-status {
    font-size: .65rem;
    margin-top: .3rem;
    min-height: 1.2em;
}
.scan-label-status .scanning {
    color: #fbbf24;
    animation: pulse 1.2s infinite;
}
.scan-label-status .success { color: #4ade80; }
.scan-label-status .error { color: #f87171; }
.scan-label-preview {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: .4rem;
    justify-content: center;
}
.scan-label-preview img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform .2s;
}
.scan-label-preview img:hover {
    transform: scale(1.5);
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
.machine-photos-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: .6rem;
}
.machine-photos-gallery .mp-thumb {
    position: relative;
    width: 70px;
    height: 52px;
}
.machine-photos-gallery .mp-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
}
.machine-photos-gallery .mp-thumb img:hover {
    transform: scale(1.3);
    z-index: 5;
    box-shadow: 0 2px 12px rgba(0,0,0,.4);
}
.machine-photos-gallery .mp-delete {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: .5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    opacity: 0;
    transition: opacity .2s;
}
.machine-photos-gallery .mp-thumb:hover .mp-delete { opacity: 1; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.collector-status { margin: .5rem 0; }
.collector-status-label { font-weight: 600; margin-right: .5rem; }
.collector-toggle-wrap { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.collector-toggle-wrap input[type="checkbox"] { width: 1.1rem; height: 1.1rem; cursor: pointer; }
.collector-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.collector-dot.online { background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; }
.collector-dot.offline { background: var(--red); }
.collector-stat { text-align: center; background: rgba(255,255,255,.03); border-radius: 6px; padding: .4rem .3rem; }
.collector-stat .stat-num { display: block; font-size: 1.2rem; font-weight: 700; font-family: var(--mono); }
.collector-stat .stat-label { font-size: .6rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.config-modal-footer {
    display: flex; align-items: center; gap: .5rem;
    padding: .8rem 1.2rem;
    border-top: 1px solid var(--border);
}
.cfg-field { margin-bottom: .6rem; flex: 1; }
.cfg-field label {
    display: block; font-size: .68rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: .5px; margin-bottom: .2rem;
}
.cfg-field input, .cfg-field select {
    width: 100%; padding: .45rem .6rem;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 4px; color: var(--text);
    font-family: var(--sans); font-size: .82rem;
}
.cfg-field input:focus, .cfg-field select:focus {
    outline: none; border-color: var(--cyan);
    box-shadow: 0 0 0 2px rgba(0,200,255,.15);
}
.cfg-field-row { display: flex; gap: .6rem; }
.cfg-field.invalid label { color: var(--red); }
.cfg-field input.invalid,
.cfg-field.invalid input { border-color: var(--red); box-shadow: 0 0 0 1px rgba(255,61,61,.3); }
.cfg-field.invalid { padding: .4rem; border-radius: 4px; border: 1px solid var(--red); background: rgba(255,61,61,.06); }

.lines-checkbox-grid {
    display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem;
}
.line-chk-item {
    display: flex; align-items: center; gap: .25rem;
    padding: .25rem .5rem; border-radius: 4px;
    background: var(--bg); border: 1px solid var(--border);
    cursor: pointer; transition: all .15s;
    font-size: .72rem; color: var(--text-muted);
}
.line-chk-item:hover { border-color: var(--cyan); }
.line-chk-item input[type="checkbox"] { accent-color: var(--cyan); }
.line-chk-item.checked { border-color: var(--cyan); background: rgba(0,200,255,.08); color: var(--text); }

.sensor-config-row {
    display: flex; gap: .4rem; align-items: center;
    padding: .4rem; margin-bottom: .3rem;
    background: var(--bg); border-radius: 4px; border: 1px solid var(--border);
    flex-wrap: wrap;
}
.sensor-config-row input, .sensor-config-row select {
    padding: .25rem .35rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: 3px; color: var(--text); font-size: .72rem; font-family: var(--sans);
}
.sensor-config-row input:focus { border-color: var(--cyan); outline: none; }
.sensor-config-row .sc-key { width: 80px; }
.sensor-config-row .sc-label { width: 100px; }
.sensor-config-row .sc-unit { width: 55px; }
.sensor-config-row .sc-num { width: 60px; text-align: right; font-family: var(--mono); }
.sensor-config-row .sc-del {
    width: 24px; height: 24px; border-radius: 3px; border: 1px solid var(--border);
    background: none; color: var(--red); cursor: pointer; font-size: .8rem;
    display: flex; align-items: center; justify-content: center;
}
.sensor-config-row .sc-del:hover { background: rgba(255,61,61,.15); }
.sensor-config-row.sensor-row-shared { opacity: .85; }
.sensor-config-row .sc-source { width: 120px; max-width: 120px; }
.sensor-config-row .sc-conn-wrap .sc-conn-ip { width: 100px; }
.sensor-config-row .sc-conn-wrap .sc-conn-port { width: 55px; }

.btn-red { background: var(--red) !important; color: #fff !important; }
.btn-red:hover { opacity: .85; }

/* Config buttons on overview */
.overview-config-bar {
    display: flex; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap;
}
.btn-config {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .35rem .7rem; border-radius: 4px;
    font-size: .72rem; font-weight: 600;
    background: rgba(0,200,255,.1); color: var(--cyan);
    border: 1px solid rgba(0,200,255,.2);
    cursor: pointer; transition: all .2s;
}
.btn-config:hover { background: rgba(0,200,255,.2); border-color: var(--cyan); }
.btn-config.orange { background: rgba(255,107,26,.1); color: var(--orange); border-color: rgba(255,107,26,.2); }
.btn-config.orange:hover { background: rgba(255,107,26,.2); border-color: var(--orange); }

.equip-card .eq-actions {
    position: absolute; top: .3rem; right: .3rem;
    display: none; gap: .2rem;
}
.equip-card:hover .eq-actions { display: flex; }
.eq-action-btn {
    width: 22px; height: 22px; border-radius: 3px;
    border: 1px solid var(--border); background: var(--bg);
    color: var(--text-muted); font-size: .65rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.eq-action-btn:hover { color: var(--cyan); border-color: var(--cyan); }
.eq-action-btn.delete:hover { color: var(--red); border-color: var(--red); }

/* Meter Dashboard (CONSUM tab) */
.meter-dashboard { display: flex; flex-direction: column; gap: .8rem; }
.meter-section-highlight {
    background: linear-gradient(135deg, rgba(0,200,255,.12), rgba(0,200,255,.04));
    border: 1px solid rgba(0,200,255,.25);
    border-radius: 8px; padding: .8rem 1rem; text-align: center;
}
.meter-big-value { font-size: 2rem; font-weight: 700; color: var(--cyan); margin: .3rem 0; }
.meter-sub-row { font-size: .8rem; color: var(--text-muted); }
.meter-sub-row strong { color: var(--text); }
.meter-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .6rem;
}
.meter-section {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 6px; padding: .6rem .8rem;
}
.meter-section-title {
    font-size: .75rem; font-weight: 700; color: var(--cyan);
    text-transform: uppercase; letter-spacing: .04em;
    margin-bottom: .4rem; padding-bottom: .3rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.meter-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: .25rem 0; border-bottom: 1px solid rgba(255,255,255,.03);
}
.meter-row:last-child { border-bottom: none; }
.meter-label { font-size: .78rem; color: var(--text-muted); }
.meter-label sub { font-size: .65rem; }
.meter-value { font-size: .85rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.meter-chart-section {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: 6px; padding: .6rem .8rem;
}

/* ═══ WORKFLOW REVIZIE ═══ */
@keyframes slideUp { from { transform:translateY(100%); opacity:0 } to { transform:translateY(0); opacity:1 } }
.wf-panel { max-width: 100%; }
.wf-panel > .wf-header {
    display:flex; justify-content:space-between; align-items:flex-start;
    padding:18px 24px; border-radius:8px 8px 0 0;
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2940 100%);
    border-left: 4px solid #f59e0b;
}
.wf-header-left { flex:1; }
.wf-panel > .wf-header .wf-title {
    font-size: 1.15rem; font-weight: 600; color: #fbbf24;
    margin: 0; line-height: 1.45;
}
.wf-panel > .wf-header .wf-subtitle {
    font-size: .82rem; color: rgba(255,255,255,.7); margin: 8px 0 0;
    font-weight: 500;
}

.wf-stepper { display:flex; padding:12px 24px; background:var(--card-bg); border-bottom:1px solid var(--border); gap:0; }
.wf-step-ind { flex:1; display:flex; align-items:center; gap:8px; padding:8px 0; position:relative; }
.wf-step-ind::after { content:''; position:absolute; right:0; top:50%; width:24px; height:2px; background:var(--border); }
.wf-step-ind:last-child::after { display:none; }
.wf-step-num { width:28px; height:28px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:.72rem; font-weight:700; border:2px solid var(--border); color:var(--text-muted); flex-shrink:0; transition:all .2s; }
.wf-step-ind.active .wf-step-num { background:var(--cyan); border-color:var(--cyan); color:#fff; }
.wf-step-ind.done .wf-step-num { background:var(--green); border-color:var(--green); color:#fff; }
.wf-step-lbl { font-size:.72rem; color:var(--text-muted); }
.wf-step-ind.active .wf-step-lbl { color:var(--text); font-weight:600; }
.wf-step-ind.done .wf-step-lbl { color:var(--green); }

.wf-body { padding:20px 24px; flex:1; overflow-y:auto; }
.wf-step-content {}
.wf-section-title { font-size:.92rem; font-weight:700; margin-bottom:4px; }
.wf-hint { font-size:.78rem; color:var(--text-muted); margin-bottom:16px; }
.wf-actions-row { display:flex; gap:8px; margin-bottom:14px; flex-wrap:wrap; }
.wf-btn-erp-all { border:1px solid var(--cyan) !important; color:var(--cyan) !important; background:transparent !important; }
.wf-btn-erp-all:hover { background:rgba(0,200,255,.1) !important; }

.wf-parts-table { width:100%; border-collapse:collapse; margin-bottom:16px; }
.wf-parts-table th { text-align:left; font-size:.65rem; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--text-muted); padding:8px 10px; border-bottom:2px solid var(--border); }
.wf-parts-table td { padding:8px 10px; border-bottom:1px solid var(--border); font-size:.78rem; vertical-align:middle; }
.wf-parts-table tr:hover { background:rgba(255,255,255,.03); }
.wf-part-code { color:var(--cyan); font-size:.75rem; }
.wf-match-score { font-family:'Courier New',monospace; font-size:.68rem; color:var(--text-muted); }
.wf-stock-cell { display:flex; align-items:center; gap:6px; }
.wf-stock-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.wf-stock-unknown { background:var(--text-muted); }
.wf-stock-ok { background:var(--green); box-shadow:0 0 6px rgba(34,197,94,.4); }
.wf-stock-low { background:var(--orange); box-shadow:0 0 6px rgba(245,158,11,.4); }
.wf-stock-none { background:var(--red); box-shadow:0 0 6px rgba(239,68,68,.4); }
.wf-stock-text { font-size:.72rem; color:var(--text-muted); }
.wf-erp-btn { font-size:.62rem; padding:3px 8px; border-radius:4px; border:1px solid var(--border); background:var(--card-bg); color:var(--text-muted); cursor:pointer; }
.wf-erp-btn:hover { border-color:var(--cyan); color:var(--cyan); }
.wf-manual-chk { appearance:none; width:18px; height:18px; border:2px solid var(--border); border-radius:4px; cursor:pointer; position:relative; background:transparent; }
.wf-manual-chk:checked { background:var(--green); border-color:var(--green); }
.wf-manual-chk:checked::after { content:'✓'; position:absolute; top:-2px; left:2px; color:#fff; font-size:.75rem; font-weight:700; }
.wf-no-match { padding:16px; background:var(--card-bg); border:1px solid var(--border); border-radius:8px; text-align:center; color:var(--text-muted); font-size:.82rem; }

.wf-summary-row { display:flex; gap:16px; padding:14px; background:var(--card-bg); border:1px solid var(--border); border-radius:10px; margin:16px 0; flex-wrap:wrap; }
.wf-summary-item { text-align:center; flex:1; min-width:80px; }
.wf-summary-num { font-size:1.4rem; font-weight:700; display:block; }
.wf-summary-label { font-size:.6rem; text-transform:uppercase; letter-spacing:1px; color:var(--text-muted); }

.wf-nav-row { display:flex; justify-content:space-between; margin-top:20px; gap:12px; flex-wrap:wrap; }
.wf-nav-left, .wf-nav-right { display:flex; gap:8px; }
.btn-green { background:var(--green) !important; color:#fff !important; }
.btn-green:hover { filter:brightness(1.1); }

/* Step 2: Guidance */
.wf-guidance-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin:16px 0; }
@media(max-width:700px) { .wf-guidance-grid { grid-template-columns:1fr; } }
.wf-guidance-card { background:var(--card-bg); border:2px solid var(--border); border-radius:12px; padding:20px; text-align:center; cursor:pointer; transition:all .2s; }
.wf-guidance-card:hover { border-color:var(--cyan); transform:translateY(-2px); }
.wf-guidance-card.selected { border-color:var(--cyan); background:rgba(0,200,255,.06); box-shadow:0 0 16px rgba(0,200,255,.1); }
.wf-guidance-icon { font-size:2.2rem; margin-bottom:10px; }
.wf-guidance-title { font-size:.88rem; font-weight:700; margin-bottom:6px; }
.wf-guidance-desc { font-size:.72rem; color:var(--text-muted); line-height:1.5; }
.wf-operator-row { display:flex; gap:16px; margin:16px 0; flex-wrap:wrap; }
.wf-operator-field { flex:1; min-width:200px; }
.wf-field-label { display:block; font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--text-muted); margin-bottom:4px; }
.wf-input { width:100%; background:var(--card-bg); border:1px solid var(--border); color:var(--text); padding:8px 12px; border-radius:8px; font-size:.82rem; outline:none; }
.wf-input:focus { border-color:var(--cyan); }

/* Step 3: Execution */
.wf-exec-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:16px; flex-wrap:wrap; gap:12px; }
.wf-exec-badges { display:flex; gap:8px; flex-wrap:wrap; }
.wf-exec-badge { display:flex; align-items:center; gap:6px; background:var(--card-bg); border:1px solid var(--border); padding:6px 12px; border-radius:8px; }
.wf-exec-badge-icon { font-size:1.1rem; }
.wf-exec-badge-val { font-size:.8rem; font-weight:600; color:var(--cyan); }
.wf-step-list { list-style:none; counter-reset:wfsteps; padding:0; margin:0; }
.wf-exec-step { counter-increment:wfsteps; padding:12px 40px 12px 48px; background:var(--card-bg); border:1px solid var(--border); border-radius:10px; margin-bottom:8px; position:relative; font-size:.82rem; line-height:1.5; transition:all .2s; }
.wf-exec-step::before { content:counter(wfsteps); position:absolute; left:12px; top:12px; background:var(--cyan); color:#fff; width:24px; height:24px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:.7rem; font-weight:700; }
.wf-exec-step.wf-step-done { opacity:.5; border-color:var(--green); }
.wf-exec-step.wf-step-done::before { background:var(--green); }
.wf-exec-step.wf-step-current { border-color:var(--cyan); box-shadow:0 0 12px rgba(0,200,255,.12); }
.wf-exec-step-content { }
.wf-exec-step-detail { font-size:.76rem; color:var(--text-muted); margin-top:4px; }
.wf-exec-step-extras { display:flex; gap:8px; flex-wrap:wrap; margin-top:8px; }
.wf-step-tag { font-size:.64rem; padding:3px 8px; border-radius:4px; display:inline-block; }
.wf-tag-safety { background:rgba(239,68,68,.12); color:var(--red); border:1px solid rgba(239,68,68,.25); }
.wf-tag-tools { background:rgba(0,200,255,.1); color:var(--cyan); border:1px solid rgba(0,200,255,.2); }
.wf-tag-ref { background:rgba(245,158,11,.1); color:var(--orange); border:1px solid rgba(245,158,11,.2); }
.wf-tag-ar { background:rgba(168,85,247,.1); color:#a855f7; border:1px solid rgba(168,85,247,.2); }
.wf-step-chk { position:absolute; right:12px; top:12px; appearance:none; width:22px; height:22px; border:2px solid var(--border); border-radius:6px; cursor:pointer; background:transparent; }
.wf-step-chk:checked { background:var(--green); border-color:var(--green); }
.wf-step-chk:checked::after { content:'✓'; position:absolute; top:-1px; left:3px; color:#fff; font-size:.85rem; font-weight:700; }
.wf-progress-row { display:flex; align-items:center; gap:12px; margin:12px 0 8px; }
.wf-progress-bar { flex:1; height:8px; background:var(--border); border-radius:4px; overflow:hidden; }
.wf-progress-fill { height:100%; background:var(--green, #22c55e); border-radius:4px; transition:width .3s; }
.wf-progress-text { font-size:.75rem; font-weight:600; color:var(--text-muted); min-width:50px; text-align:right; }
.wf-exec-proc .proc-steps-list { max-height:55vh; overflow-y:auto; padding-right:4px; }
.wf-exec-proc .proc-step { margin-bottom:6px; }
.wf-exec-info-cols { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-top:16px; }
@media(max-width:700px) { .wf-exec-info-cols { grid-template-columns:1fr; } }
.wf-exec-info-block { background:var(--card-bg); border:1px solid var(--border); border-radius:10px; padding:12px 14px; }
.wf-exec-info-block h4 { font-size:.72rem; font-weight:700; margin-bottom:8px; }
.wf-exec-info-block ul { list-style:none; padding:0; margin:0; }
.wf-exec-info-block ul li { font-size:.76rem; color:var(--text-muted); padding:2px 0; }
.wf-exec-info-block ul li::before { content:'•'; margin-right:6px; color:var(--cyan); }
.wf-safety-block { background:rgba(239,68,68,.05); border-color:rgba(239,68,68,.2); }
.wf-safety-block ul li { color:var(--red) !important; }
.wf-safety-block ul li::before { color:var(--red) !important; }

/* ═══ PROCEDURE OVERLAY ═══ */
.proc-overlay { position:fixed; inset:0; z-index:10000; background:rgba(0,0,0,.7); backdrop-filter:blur(4px); display:flex; align-items:center; justify-content:center; animation:fadeIn .2s; }
.proc-container { background:var(--card-bg); border-radius:16px; width:94vw; max-width:720px; max-height:92vh; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 20px 60px rgba(0,0,0,.5); }
.proc-header { padding:20px 24px 16px; border-bottom:1px solid var(--border); flex-shrink:0; }
.proc-header-top { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.proc-title { font-size:1.15rem; font-weight:700; margin:0; color:var(--text-main); line-height:1.3; }
.proc-close { background:none; border:none; color:var(--text-muted); font-size:1.6rem; cursor:pointer; padding:0 4px; line-height:1; }
.proc-close:hover { color:var(--red); }
.proc-type-badge { display:inline-block; font-size:.65rem; font-weight:600; text-transform:uppercase; padding:2px 10px; border-radius:20px; margin-top:8px; background:rgba(6,182,212,.1); color:var(--cyan); border:1px solid rgba(6,182,212,.2); }
.proc-meta-row { display:flex; gap:8px; margin-top:8px; font-size:.78rem; align-items:baseline; }
.proc-meta-label { font-weight:700; color:var(--cyan); white-space:nowrap; min-width:80px; font-size:.68rem; text-transform:uppercase; }
.proc-meta-val { color:var(--text-muted); line-height:1.4; }
.proc-meta-safety { background:rgba(239,68,68,.06); border-radius:8px; padding:6px 10px; margin-top:10px; }
.proc-meta-safety .proc-meta-label { color:var(--red); }
.proc-meta-safety .proc-meta-val { color:var(--red); }
.proc-meta-source { background:rgba(6,182,212,.06); border-radius:8px; padding:6px 10px; margin-top:8px; }
.proc-pdf-source-link { color:var(--cyan); text-decoration:underline; cursor:pointer; font-weight:500; }
.proc-pdf-source-link:hover { color:var(--text-main); }
.proc-step-page-hint { font-size:.65rem; color:var(--text-muted); margin-left:6px; opacity:.7; white-space:nowrap; }

.proc-steps-list { flex:1; overflow-y:auto; padding:12px 20px; }
.proc-step { position:relative; padding:12px 14px; margin-bottom:8px; border-radius:10px; border:1px solid var(--border); background:var(--bg); transition:all .2s; }
.proc-step:hover { border-color:var(--cyan); }
.proc-step-done { background:rgba(16,185,129,.06); border-color:rgba(16,185,129,.3); }
.proc-step-done .proc-step-text { text-decoration:line-through; opacity:.6; }
.proc-step-checkpoint { border-left:3px solid var(--red); }
.proc-step-label { display:flex; gap:10px; align-items:flex-start; cursor:pointer; }
.proc-step-cb { flex-shrink:0; appearance:none; width:22px; height:22px; border:2px solid var(--border); border-radius:6px; cursor:pointer; background:transparent; margin-top:1px; position:relative; }
.proc-step-cb:checked { background:var(--green); border-color:var(--green); }
.proc-step-cb:checked::after { content:'✓'; position:absolute; top:-1px; left:3px; color:#fff; font-size:.85rem; font-weight:700; }
.proc-step-num { flex-shrink:0; font-weight:700; color:var(--cyan); font-size:.85rem; min-width:22px; padding-top:2px; }
.proc-step-text { font-size:.82rem; line-height:1.5; color:var(--text-main); }
.proc-ck-icon { color:var(--red); margin-right:4px; }
.proc-step-notes { margin:6px 0 0 54px; font-size:.75rem; color:var(--text-muted); background:rgba(234,179,8,.06); padding:4px 8px; border-radius:6px; }
.proc-step-img { display:block; max-width:280px; margin:8px 0 0 54px; border-radius:8px; border:1px solid var(--border); }
.proc-step-link { display:inline-block; margin:6px 0 0 54px; font-size:.78rem; color:var(--cyan); text-decoration:none; }
.proc-step-link:hover { text-decoration:underline; }

.proc-footer { padding:14px 20px; border-top:1px solid var(--border); flex-shrink:0; display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
.proc-progress { flex:1; min-width:140px; }
.proc-progress-bar { height:6px; background:var(--border); border-radius:3px; overflow:hidden; }
.proc-progress-fill { height:100%; background:linear-gradient(90deg, var(--cyan), var(--green)); border-radius:3px; transition:width .3s; }
.proc-progress-text { font-size:.72rem; color:var(--text-muted); margin-top:4px; display:block; }
.proc-timer { font-family:'JetBrains Mono', monospace; font-size:1rem; font-weight:700; color:var(--cyan); min-width:60px; text-align:center; }
.proc-actions { display:flex; gap:8px; }
.proc-btn { padding:6px 14px; border-radius:8px; border:1px solid var(--border); background:var(--card-bg); color:var(--text-main); font-size:.78rem; cursor:pointer; font-weight:600; transition:all .15s; }
.proc-btn:hover { border-color:var(--cyan); }
.proc-btn-finish { background:var(--green); color:#fff; border-color:var(--green); }
.proc-btn-finish:disabled { opacity:.4; cursor:not-allowed; }
.proc-btn-finish:not(:disabled):hover { filter:brightness(1.1); }

.proc-open-btn { display:inline-block; margin-left:auto; padding:2px 10px; font-size:.68rem; font-weight:600; border-radius:6px; border:1px solid rgba(6,182,212,.3); background:rgba(6,182,212,.08); color:var(--cyan); cursor:pointer; white-space:nowrap; transition:all .15s; }
.proc-open-btn:hover { background:rgba(6,182,212,.2); border-color:var(--cyan); }

@media(max-width:600px) {
    .proc-container { width:100vw; max-width:100vw; max-height:100vh; border-radius:0; }
    .proc-footer { flex-direction:column; align-items:stretch; }
    .proc-timer { text-align:left; }
}

/* PDF context in procedure steps */
.proc-step-actions { display:flex; gap:6px; margin:6px 0 0 54px; flex-wrap:wrap; }
.proc-ctx-btn, .proc-openpdf-btn { padding:3px 10px; font-size:.68rem; font-weight:600; border-radius:6px; cursor:pointer; transition:all .15s; }
.proc-ctx-btn { border:1px solid rgba(6,182,212,.3); background:rgba(6,182,212,.06); color:var(--cyan); }
.proc-ctx-btn:hover { background:rgba(6,182,212,.15); border-color:var(--cyan); }
.proc-openpdf-btn { border:1px solid rgba(234,179,8,.3); background:rgba(234,179,8,.06); color:#eab308; }
.proc-openpdf-btn:hover { background:rgba(234,179,8,.15); border-color:#eab308; }
.proc-ctx-btn:disabled, .proc-img-btn:disabled, .proc-openpdf-btn:disabled { opacity:.3; cursor:not-allowed; pointer-events:none; }
.proc-img-btn { font-size:.75rem; padding:2px 8px; border:1px solid #7c3aed; color:#7c3aed; background:transparent; border-radius:4px; cursor:pointer; }
.proc-img-btn:hover { background:rgba(124,58,237,.12); }
.proc-step-images { padding:8px 0 8px 32px; display:flex; flex-wrap:wrap; gap:10px; }
.proc-img-wrap { position:relative; max-width:320px; }
.proc-step-diagram { max-width:100%; max-height:300px; border:1px solid #e5e7eb; border-radius:6px; cursor:pointer; transition:transform .2s; }
.proc-step-diagram:hover { transform:scale(1.5); z-index:100; box-shadow:0 8px 32px rgba(0,0,0,.3); }
.proc-img-caption { display:block; font-size:.65rem; color:#9ca3af; text-align:center; margin-top:2px; }
.proc-no-images { font-size:.8rem; color:#9ca3af; font-style:italic; padding:4px 0 4px 32px; }
.wf-rpt-pct { font-size:.75rem; color:var(--text-muted); }
.wf-ai-ref { margin:12px 0; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
.wf-ai-ref summary { padding:10px 16px; cursor:pointer; font-weight:600; font-size:.85rem; color:var(--accent); background:rgba(59,130,246,.06); }
.wf-ai-ref-content { padding:12px 16px; font-size:.82rem; line-height:1.6; max-height:50vh; overflow-y:auto; color:var(--text-secondary); }
.wf-media-list { display:flex; flex-wrap:wrap; gap:12px; margin-top:8px; }
.wf-media-item { max-width:300px; }
.wf-validate-section textarea { font-family:inherit; resize:vertical; }
.wf-exec-progress { height:8px; background:var(--border,#333); border-radius:4px; overflow:hidden; }
.wf-exec-progress-bar { height:100%; background:var(--green,#22c55e); border-radius:4px; transition:width .3s; }
.wf-exec-progress-text { font-size:.75rem; color:var(--text-muted); margin-top:4px; }

/* Workflow reports */
.wf-rpt-progress { display:flex; align-items:center; gap:6px; }
.wf-rpt-progress .wf-rpt-bar { height:6px; background:var(--green,#22c55e); border-radius:3px; min-width:2px; }
.wf-rpt-progress span { font-size:.75rem; color:var(--text-muted); }

.wf-detail-overlay { position:fixed; inset:0; z-index:10000; background:rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; padding:20px; }
.wf-detail-modal { background:var(--bg-card,#1e293b); border:1px solid var(--border); border-radius:12px; padding:24px; max-width:700px; width:100%; max-height:85vh; overflow-y:auto; color:var(--text-primary); }
.wf-detail-modal h3 { margin:0 0 12px; font-size:1.2rem; }
.wf-detail-modal h4 { margin:16px 0 8px; font-size:.95rem; color:var(--accent); }
.wf-detail-meta { display:flex; flex-wrap:wrap; gap:10px 20px; font-size:.85rem; color:var(--text-muted); margin-bottom:12px; }
.wf-detail-steps { display:flex; flex-direction:column; gap:4px; }
.wf-detail-step { display:flex; align-items:flex-start; gap:8px; padding:6px 10px; border-radius:6px; font-size:.85rem; }
.wf-detail-step-done { background:rgba(34,197,94,.08); }
.wf-detail-step-pending { background:rgba(239,68,68,.06); }
.wf-detail-step-num { font-weight:700; min-width:20px; color:var(--text-muted); }
.wf-detail-step-icon { min-width:20px; }
.wf-detail-step-text { flex:1; }
.wf-detail-notes { margin-top:12px; padding:10px; background:rgba(255,255,255,.04); border-radius:6px; font-size:.85rem; }
.proc-pdf-context { margin:8px 0 0 54px; }
.proc-pdf-context.hidden { display:none !important; }
.proc-step-done .proc-step-actions { opacity:.3; pointer-events:none; }
.proc-step-done .proc-pdf-context { display:none !important; }
.pdf-ctx-header { font-size:.72rem; font-weight:700; color:var(--cyan); margin-bottom:8px; padding-bottom:4px; border-bottom:1px solid var(--border); }
.pdf-ctx-page { background:rgba(255,255,255,.03); border:1px solid var(--border); border-radius:8px; padding:10px 12px; margin-bottom:8px; }
.pdf-ctx-page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:6px; }
.pdf-ctx-page-num { font-size:.68rem; font-weight:700; color:#eab308; }
.pdf-ctx-open-btn { padding:2px 8px; font-size:.65rem; font-weight:600; border-radius:5px; border:1px solid rgba(234,179,8,.3); background:rgba(234,179,8,.08); color:#eab308; cursor:pointer; transition:all .15s; }
.pdf-ctx-open-btn:hover { background:rgba(234,179,8,.2); }
.pdf-ctx-text { font-size:.75rem; line-height:1.6; color:var(--text-muted); font-family:'JetBrains Mono', monospace; white-space:pre-wrap; word-break:break-word; max-height:250px; overflow-y:auto; }

/* AI suggestions in procedure steps */
.ai-ctx-row { display:flex; gap:8px; margin:6px 0; font-size:.76rem; align-items:baseline; padding:4px 8px; border-radius:6px; background:rgba(6,182,212,.04); }
.ai-ctx-label { font-weight:700; color:var(--cyan); white-space:nowrap; min-width:75px; font-size:.66rem; text-transform:uppercase; }
.ai-ctx-val { color:var(--text-muted); line-height:1.5; }
.ai-ctx-safety { background:rgba(239,68,68,.06); }
.ai-ctx-safety .ai-ctx-label { color:var(--red); }
.ai-ctx-safety .ai-ctx-val { color:var(--red); }
.ai-ctx-detail { margin-top:8px; padding:8px 10px; border-radius:8px; background:rgba(255,255,255,.02); border:1px solid var(--border); }
.ai-ctx-detail-title { font-size:.68rem; font-weight:700; color:var(--cyan); margin-bottom:6px; }
.ai-ctx-line { font-size:.76rem; color:var(--text-muted); padding:3px 6px; line-height:1.5; border-radius:4px; }
.ai-ctx-current { background:rgba(6,182,212,.1); color:var(--text-main); font-weight:600; border-left:3px solid var(--cyan); }

/* ══════ INTERVENȚII URGENTE ══════ */
.urg-phase { max-width:100%; margin:0 auto; }
#urg-phase-1 { max-width:780px; }
#urg-phase-manual { max-width:780px; }

/* 2-column layout for AI guided steps */
.urg-result-layout {
    display:grid; grid-template-columns:1fr 340px; gap:20px;
    align-items:start;
}
.urg-result-main { min-width:0; }
.urg-steps-scroll { max-height:52vh; overflow-y:auto; padding-right:4px; }
.urg-result-side { display:flex; flex-direction:column; gap:14px; position:sticky; top:20px; }
.urg-side-card {
    background:var(--surface); border:1px solid var(--border);
    border-radius:12px; padding:16px;
}
.urg-side-card h4 { font-size:.95rem; font-weight:700; margin:0 0 8px; color:var(--text); }
.urg-side-card p { font-size:.88rem; color:var(--text-muted); margin:0 0 10px; line-height:1.5; }
.urg-side-help { border-color:rgba(239,68,68,.25); background:rgba(239,68,68,.04); }
.urg-side-help h4 { color:var(--red); }
.urg-side-info { border-color:rgba(0,200,255,.15); background:rgba(0,200,255,.03); }

@media (max-width:960px) {
    .urg-result-layout { grid-template-columns:1fr; }
    .urg-result-side { position:static; }
}
.urg-hero { text-align:center; padding:24px 16px 8px; }
.urg-hero-icon { font-size:3.5rem; margin-bottom:8px; }
.urg-hero-title { font-size:1.6rem; font-weight:800; color:var(--text-main); margin:0 0 6px; }
.urg-hero-sub { font-size:1.05rem; color:var(--text-muted); margin:0; line-height:1.5; }
.urg-form-card { background:var(--card-bg); border:1px solid var(--border); border-radius:14px; padding:24px; margin-top:16px; }
.urg-field { margin-bottom:16px; }
.urg-label { display:block; font-size:1.1rem; font-weight:700; color:var(--text-main); margin-bottom:8px; }
.urg-step-badge { display:inline-flex; align-items:center; justify-content:center; width:28px; height:28px; border-radius:50%; background:var(--accent); color:#fff; font-size:.85rem; font-weight:800; margin-right:8px; }
.urg-select, .urg-input, .urg-textarea {
    width:100%; padding:14px 16px; font-size:1.1rem; border-radius:10px;
    border:2px solid var(--border); background:#1a1f2e; color:#e2e8f0;
    transition:border-color .2s, box-shadow .2s;
}
.urg-select option { background:#1a1f2e; color:#e2e8f0; }
.urg-select:focus, .urg-input:focus, .urg-textarea:focus {
    border-color:var(--accent); box-shadow:0 0 0 3px rgba(59,130,246,.15); outline:none;
}
.urg-textarea { resize:vertical; min-height:80px; }
.urg-actions { margin-top:20px; }
.urg-btn-main {
    display:flex; flex-direction:column; align-items:center; width:100%;
    padding:18px 24px; border:none; border-radius:12px; cursor:pointer;
    background:linear-gradient(135deg, #f97316 0%, #ef4444 100%); color:#fff;
    transition:transform .15s, box-shadow .15s;
}
.urg-btn-main:hover { transform:translateY(-2px); box-shadow:0 8px 24px rgba(249,115,22,.35); }
.urg-btn-main:active { transform:translateY(0); }
.urg-btn-main:disabled { opacity:.6; cursor:wait; transform:none; box-shadow:none; }
.urg-btn-icon { font-size:1.6rem; margin-bottom:4px; }
.urg-btn-text { font-size:1.2rem; font-weight:800; letter-spacing:.5px; }
.urg-btn-hint { font-size:.82rem; opacity:.85; margin-top:2px; }
.urg-alt-actions { display:flex; gap:10px; margin-top:12px; justify-content:center; }
.urg-btn-alt {
    padding:10px 18px; border-radius:8px; font-size:.95rem; font-weight:600; cursor:pointer;
    background:transparent; border:2px solid var(--border); color:var(--text-muted);
    transition:all .2s;
}
.urg-btn-alt:hover { border-color:var(--accent); color:var(--accent); }

/* Guide result steps */
.urg-result-card { background:var(--card-bg); border:1px solid var(--border); border-radius:14px; padding:24px; }
.urg-result-header { display:flex; align-items:center; gap:12px; margin-bottom:16px; padding-bottom:12px; border-bottom:1px solid var(--border); }
.urg-result-title { font-size:1.2rem; font-weight:700; color:var(--accent); flex:1; }
.urg-step-item {
    display:flex; align-items:flex-start; gap:12px; padding:14px 16px; margin:6px 0;
    background:rgba(255,255,255,.02); border:2px solid var(--border); border-radius:10px;
    cursor:pointer; transition:all .25s;
}
.urg-step-item:hover { border-color:var(--accent); background:rgba(59,130,246,.04); }
.urg-step-item.done { border-color:#22c55e; background:rgba(34,197,94,.08); }
.urg-step-item.done .urg-step-text { text-decoration:line-through; opacity:.55; }
.urg-step-cb { width:26px; height:26px; min-width:26px; margin-top:1px; cursor:pointer; accent-color:#22c55e; }
.urg-step-num { font-weight:800; color:var(--accent); min-width:30px; font-size:1.05rem; margin-top:2px; }
.urg-step-text { font-size:1.05rem; line-height:1.5; color:var(--text-main); }
.urg-progress-bar { height:8px; border-radius:4px; background:var(--border); margin:12px 0; overflow:hidden; }
.urg-progress-fill { height:100%; border-radius:4px; background:linear-gradient(90deg,#22c55e,#16a34a); transition:width .3s; }
.urg-help-section {
    margin-top:16px; padding:16px; border-radius:10px;
    background:rgba(239,68,68,.06); border:2px dashed rgba(239,68,68,.3);
    text-align:center;
}
.urg-btn-help {
    display:inline-flex; align-items:center; gap:8px;
    padding:14px 28px; border:none; border-radius:10px; cursor:pointer;
    background:linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); color:#fff;
    font-size:1.1rem; font-weight:700; transition:transform .15s, box-shadow .15s;
}
.urg-btn-help:hover { transform:translateY(-2px); box-shadow:0 6px 20px rgba(220,38,38,.35); }
.urg-similar-box {
    margin-top:12px; padding:12px; border-radius:8px;
    background:rgba(59,130,246,.05); border:1px solid rgba(59,130,246,.15);
}
.urg-similar-title { font-size:.9rem; font-weight:700; color:var(--accent); margin-bottom:8px; }
.urg-similar-item {
    font-size:.88rem; padding:10px 14px; color:var(--text-muted);
    border-bottom:1px solid var(--border); display:flex; align-items:center;
    gap:8px; flex-wrap:wrap;
}
.urg-similar-clickable {
    cursor:pointer; border-radius:8px; transition:all .2s;
    border:1px solid transparent; margin-bottom:4px;
}
.urg-similar-clickable:hover {
    background:rgba(0,200,255,.06); border-color:var(--cyan);
    color:var(--text);
}
.urg-similar-open {
    margin-left:auto; font-size:.8rem; color:var(--cyan);
    opacity:.5; transition:opacity .2s; flex-shrink:0;
}
.urg-similar-clickable:hover .urg-similar-open { opacity:1; }
.urg-step-actions { display:flex; gap:4px; margin-left:auto; flex-shrink:0; }
.urg-fb-btn { border:none; background:rgba(255,255,255,.05); border-radius:6px; padding:4px 8px; font-size:1.1rem; cursor:pointer; opacity:.5; transition:all .2s; }
.urg-fb-btn:hover { opacity:1; transform:scale(1.15); }
.urg-fb-btn.active { opacity:1; }
.urg-fb-btn.urg-fb-good.active { background:rgba(34,197,94,.2); }
.urg-fb-btn.urg-fb-bad.active { background:rgba(239,68,68,.2); }
.urg-fb-btn.urg-fb-del { opacity:.3; }
.urg-fb-btn.urg-fb-del:hover { opacity:.8; background:rgba(239,68,68,.15); }
.urg-step-item.urg-deleted { pointer-events:none; }
.urg-step-item.urg-deleted .urg-step-text { text-decoration:line-through; opacity:.3; }

/* ══════ INTERVENTION TAB ══════ */
.urg-intv-header {
    display:flex; justify-content:space-between; align-items:flex-start; gap:20px;
    background:var(--card-bg); border:1px solid var(--border); border-radius:14px;
    padding:20px 24px; margin-bottom:16px; flex-wrap:wrap;
}
.urg-intv-info { flex:1; min-width:200px; }
.urg-intv-badge {
    display:inline-block; background:linear-gradient(135deg,#ef4444,#dc2626); color:#fff;
    font-size:.7rem; font-weight:800; letter-spacing:1.5px; padding:3px 10px;
    border-radius:6px; margin-bottom:8px; animation:urgPulse 2s infinite;
}
@keyframes urgPulse { 0%,100%{opacity:1} 50%{opacity:.7} }
.urg-intv-machine { font-size:1.3rem; font-weight:700; color:var(--text); margin:0 0 4px; }
.urg-intv-problem { font-size:.95rem; color:var(--text-muted); margin:0; line-height:1.4; }
.urg-intv-timer-box { text-align:center; min-width:180px; }
.urg-intv-timer {
    font-size:2.2rem; font-weight:800; font-family:'Courier New',monospace;
    color:#22c55e; letter-spacing:2px;
}
.urg-intv-timer.paused { color:var(--orange); }
.urg-intv-timer-label { font-size:.75rem; color:var(--text-muted); margin-top:2px; }
.urg-intv-timer-actions { margin-top:8px; display:flex; gap:6px; justify-content:center; }

.urg-intv-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media(max-width:900px) { .urg-intv-grid { grid-template-columns:1fr; } }
.urg-intv-col-left, .urg-intv-col-right { display:flex; flex-direction:column; gap:14px; }
.urg-intv-card {
    background:var(--card-bg); border:1px solid var(--border); border-radius:12px; padding:16px 18px;
}
.urg-intv-card-title { font-size:1rem; font-weight:700; color:var(--accent); margin:0 0 12px; }
.urg-intv-report { border-color:rgba(249,115,22,.3); }

.urg-intv-report-meta {
    background:rgba(255,255,255,.03); border:1px solid var(--border); border-radius:8px;
    padding:12px 14px; margin-bottom:16px;
}
.urg-intv-meta-row { display:flex; gap:8px; padding:3px 0; font-size:.9rem; }
.urg-intv-meta-label { color:var(--text-muted); min-width:140px; font-weight:600; }
.urg-intv-meta-value { color:var(--text); flex:1; }

.urg-intv-similar-list { max-height:250px; overflow-y:auto; }
.urg-intv-similar-item {
    padding:10px 12px; border:1px solid var(--border); border-radius:8px; margin-bottom:8px;
    cursor:pointer; transition:all .2s;
}
.urg-intv-similar-item:hover { border-color:var(--accent); background:rgba(59,130,246,.04); }
.urg-intv-similar-date { font-size:.75rem; color:var(--text-muted); }
.urg-intv-similar-action { font-size:.88rem; color:var(--text); margin-top:2px; }
.urg-intv-similar-operator { font-size:.78rem; color:var(--accent); margin-top:2px; }

.urg-intv-loading { color:var(--text-muted); font-size:.9rem; font-style:italic; padding:8px 0; }

#intv-ai-suggestions .urg-ai-step {
    padding:8px 10px; border-left:3px solid var(--accent); margin-bottom:8px;
    background:rgba(59,130,246,.04); border-radius:0 6px 6px 0;
    font-size:.92rem; line-height:1.5; color:var(--text);
}
.urg-ai-docs-section { margin-top:14px; padding-top:12px; border-top:1px solid var(--border); }
.urg-ai-docs-section strong { font-size:.9rem; display:block; margin-bottom:8px; }

.urg-sim-header { display:flex; justify-content:space-between; align-items:center; }
.urg-sim-expand-icon { font-size:.7rem; color:var(--text-muted); transition:transform .2s; }
.urg-similar-relevant { border-left:3px solid var(--accent) !important; }
.urg-sim-detail {
    margin-top:10px; padding-top:10px; border-top:1px solid var(--border);
    font-size:.88rem; line-height:1.5;
}
.urg-sim-section { margin-bottom:8px; }
.urg-sim-section strong { color:var(--accent); font-size:.82rem; }
.urg-sim-section p { margin:3px 0 0; color:var(--text); }
.urg-sim-section ol { margin:4px 0 0 16px; padding:0; }
.urg-sim-section li { margin-bottom:3px; }

.urg-doc-link {
    display:flex; align-items:center; gap:8px; padding:10px 12px;
    border:1px solid var(--border); border-radius:8px; margin-bottom:6px;
    text-decoration:none; color:var(--text); transition:all .2s;
}
.urg-doc-link:hover { border-color:var(--accent); background:rgba(59,130,246,.06); }
.urg-doc-chapter { font-weight:700; color:var(--accent); min-width:40px; font-size:.85rem; }
.urg-doc-title { flex:1; font-size:.88rem; line-height:1.3; }
.urg-doc-open {
    font-size:.75rem; color:var(--accent); white-space:nowrap;
    padding:3px 8px; border:1px solid var(--accent); border-radius:4px;
    opacity:.7; transition:opacity .2s;
}
.urg-doc-link:hover .urg-doc-open { opacity:1; }

.urg-media-buttons { display:flex; gap:8px; flex-wrap:wrap; }
.urg-btn-camera {
    flex:1; min-width:100px; padding:12px 10px; border:2px dashed var(--border);
    border-radius:10px; background:rgba(255,255,255,.03); color:var(--text);
    font-size:.95rem; font-weight:600; cursor:pointer; transition:all .2s;
    display:flex; align-items:center; justify-content:center; gap:6px;
}
.urg-btn-camera:hover { border-color:var(--accent); background:rgba(59,130,246,.06); color:var(--accent); }
.urg-btn-file { border-style:solid; opacity:.7; font-size:.85rem; }
.urg-btn-file:hover { opacity:1; }

.urg-media-preview { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.urg-media-thumb {
    position:relative; width:80px; height:80px; border-radius:8px; overflow:hidden;
    border:1px solid var(--border);
}
.urg-media-thumb img, .urg-media-thumb video {
    width:100%; height:100%; object-fit:cover;
}
.urg-media-thumb-remove {
    position:absolute; top:2px; right:2px; background:rgba(0,0,0,.7); color:#fff;
    border:none; border-radius:50%; width:20px; height:20px; font-size:.7rem;
    cursor:pointer; display:flex; align-items:center; justify-content:center;
}
.urg-media-thumb-label {
    position:absolute; bottom:0; left:0; right:0; background:rgba(0,0,0,.6);
    color:#fff; font-size:.6rem; text-align:center; padding:1px 0;
}

/* ══════ HELP REQUESTS DASHBOARD ══════ */
.help-req-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 14px 16px; margin-bottom: 12px;
    border-left: 3px solid var(--orange);
}
.help-req-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.help-req-msg {
    font-size: .92rem; line-height: 1.5; margin-bottom: 6px;
    white-space: pre-wrap; color: var(--text);
}
.help-req-response {
    margin-top: 8px; padding: 10px; border-radius: 6px;
    background: rgba(0,200,255,.06); border: 1px solid rgba(0,200,255,.15);
    font-size: .9rem; line-height: 1.4;
}
.help-req-actions { margin-top: 6px; }

/* ══════ CHAT AI - LOCAL/CLOUD INDICATORS ══════ */
.chat-source-tag {
    display: inline-block; font-size: .7rem; font-weight: 600;
    padding: 2px 8px; border-radius: 10px; margin-bottom: 6px;
    letter-spacing: .02em;
}
.chat-source-tag.local {
    background: rgba(34,197,94,.15); color: #22c55e; border: 1px solid rgba(34,197,94,.3);
}
.chat-source-tag.cloud {
    background: rgba(59,130,246,.15); color: #3b82f6; border: 1px solid rgba(59,130,246,.3);
}
.chat-sources {
    margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border);
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.chat-sources-label {
    font-size: .75rem; color: var(--text-muted); font-weight: 600;
}
.chat-source-btn {
    font-size: .72rem; padding: 3px 10px; border-radius: 14px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); cursor: pointer; transition: all .15s;
    white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.chat-source-btn:hover {
    background: rgba(0,200,255,.1); border-color: var(--cyan);
    color: var(--cyan);
}
.chat-escalate-btn {
    display: block; margin-top: 10px; padding: 8px 18px;
    background: transparent; border: 1px dashed rgba(59,130,246,.4);
    border-radius: 8px; color: #3b82f6; font-size: .82rem;
    cursor: pointer; transition: all .2s; width: 100%; text-align: center;
}
.chat-escalate-btn:hover {
    background: rgba(59,130,246,.1); border-style: solid;
}
.chat-escalate-btn:disabled {
    opacity: .5; cursor: not-allowed;
}

/* ══════ PROACTIVE ALERTS ══════ */
.proactive-alert-btn {
    position: relative; background: transparent; border: 1px solid var(--border);
    border-radius: 8px; padding: 4px 10px; cursor: pointer; display: flex; align-items: center; gap: 4px;
    font-size: .85rem; color: var(--text); transition: all .2s;
}
.proactive-alert-btn:hover { border-color: var(--orange); background: rgba(245,158,11,.1); }
.pa-count {
    background: var(--red); color: #fff; border-radius: 50%; font-size: .7rem; font-weight: 700;
    width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
}
.pa-panel {
    position: fixed; top: 56px; right: 16px; width: 380px; max-height: 70vh;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4); z-index: 1100; overflow: hidden;
}
.pa-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.pa-list { max-height: 60vh; overflow-y: auto; padding: 8px; }
.pa-item {
    padding: 10px 12px; border-radius: 8px; margin-bottom: 6px;
    border-left: 3px solid var(--border); font-size: .85rem; line-height: 1.4;
    cursor: pointer; transition: background .2s;
}
.pa-item:hover { background: rgba(255,255,255,.04); }
.pa-item.sev-high { border-left-color: var(--red); background: rgba(239,68,68,.06); }
.pa-item.sev-medium { border-left-color: var(--orange); background: rgba(245,158,11,.06); }
.pa-item.sev-low { border-left-color: var(--blue); }
.pa-machine { font-weight: 600; color: var(--cyan); font-size: .8rem; }
.pa-msg { color: var(--text); margin-top: 2px; }
.pa-type { font-size: .7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ══════ AI WORKFLOW (pas cu pas) ══════ */
.ai-workflow {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
    padding: 12px 14px; margin-top: 10px;
}
.wf-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.wf-title { font-size: .85rem; font-weight: 600; color: var(--text); }
.wf-progress {
    font-size: .8rem; font-weight: 600; color: var(--cyan);
    background: rgba(0,200,255,.1); padding: 2px 10px; border-radius: 12px;
}
.wf-step {
    display: flex; align-items: flex-start; gap: 8px; padding: 8px 6px;
    border-radius: 6px; cursor: pointer; transition: all .2s;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.wf-step:hover { background: rgba(0,200,255,.05); }
.wf-step.wf-done { opacity: .55; }
.wf-step.wf-done .wf-text { text-decoration: line-through; }
.wf-check { flex-shrink: 0; width: 18px; height: 18px; accent-color: var(--green); cursor: pointer; margin-top: 2px; }
.wf-num {
    flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
    background: var(--cyan); color: #000; display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700;
}
.wf-step.wf-done .wf-num { background: var(--green); }
.wf-text { font-size: .85rem; line-height: 1.4; color: var(--text); }
.wf-complete {
    text-align: center; padding: 8px; margin-top: 8px; border-radius: 8px;
    background: rgba(34,197,94,.1); color: var(--green); font-weight: 600; font-size: .9rem;
    animation: fadeIn .3s;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-5px); } to { opacity:1; transform:translateY(0); } }

/* ══════ CHAT FEEDBACK ══════ */
.chat-feedback {
    display: flex; gap: 6px; align-items: center; margin-top: 8px;
    padding-top: 8px; border-top: 1px solid rgba(255,255,255,.06);
}
.fb-btn {
    padding: 4px 10px; border-radius: 6px; font-size: .78rem;
    background: transparent; border: 1px solid var(--border);
    color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.fb-btn:hover { border-color: var(--accent); color: var(--text); }
.fb-good:hover { border-color: var(--green); color: var(--green); }
.fb-bad:hover { border-color: var(--red); color: var(--red); }
.fb-correct:hover { border-color: var(--accent); color: var(--accent); }

.fb-correction-form {
    background: rgba(59,130,246,.05); border: 1px solid rgba(59,130,246,.15);
    border-radius: 8px; padding: 12px; margin-top: 4px;
}
.fb-correction-text {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border);
    border-radius: 6px; background: var(--bg); color: var(--text);
    font-size: .85rem; resize: vertical; font-family: inherit;
}
.fb-src-label {
    display: flex; align-items: center; gap: 6px; padding: 3px 0;
    font-size: .8rem; color: var(--text-muted); cursor: pointer;
}
.fb-src-label input[type="checkbox"] { accent-color: var(--red); }
.fb-src-type {
    font-size: .7rem; padding: 1px 6px; border-radius: 4px;
    background: rgba(255,255,255,.06); color: var(--text-muted);
    white-space: nowrap;
}
.fb-flag-warning {
    display: flex; align-items: flex-start; gap: 8px;
    background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3);
    border-radius: 8px; padding: 8px 12px; margin: 8px 0;
    font-size: .8rem; color: #ef4444; line-height: 1.4;
}
.fb-flag-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ══════ CHAT HISTORY PANEL ══════ */
.chat-history-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 16px; margin-bottom: 12px;
    max-height: 70vh; overflow-y: auto;
}
.chat-history-panel.hidden { display: none; }
.chat-history-panel .dx-input {
    padding: 6px 10px; border: 1px solid var(--border);
    border-radius: 6px; background: var(--bg); color: var(--text); font-size: .85rem;
}
.ch-card {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; margin-bottom: 6px; overflow: hidden;
    transition: border-color .15s;
}
.ch-card:hover { border-color: var(--accent); }
.ch-card.ch-done { opacity: .7; }
.ch-card.ch-done:hover { opacity: 1; }
.ch-card-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; cursor: pointer;
}
.ch-card-meta { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.ch-badge {
    font-size: .7rem; padding: 2px 7px; border-radius: 4px;
    white-space: nowrap;
}
.ch-local { background: rgba(34,197,94,.15); color: #22c55e; }
.ch-cloud { background: rgba(59,130,246,.15); color: #3b82f6; }
.ch-reviewed { background: rgba(34,197,94,.15); color: #22c55e; }
.ch-unreviewed { background: rgba(234,179,8,.15); color: #eab308; }
.ch-date { font-size: .7rem; color: var(--text-muted); }
.ch-card-question {
    flex: 1; font-size: .85rem; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ch-card-body {
    display: none; padding: 0 14px 14px; border-top: 1px solid var(--border);
}
.ch-card.expanded .ch-card-body { display: block; padding-top: 12px; }
.ch-card.expanded .scheme-expand-icon { transform: rotate(90deg); }
.ch-q-full { font-size: .85rem; margin-bottom: 8px; line-height: 1.5; color: var(--text); }
.ch-a-full {
    font-size: .85rem; line-height: 1.6; color: var(--text-muted);
    max-height: 300px; overflow-y: auto; margin-bottom: 10px;
    background: rgba(0,0,0,.15); padding: 10px; border-radius: 6px;
}
.ch-correction-existing {
    background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2);
    border-radius: 6px; padding: 8px 12px; font-size: .83rem; margin-bottom: 8px;
    color: var(--accent);
}
.ch-review-actions { margin-top: 8px; }
.ch-correct-input {
    width: 100%; padding: 8px; border: 1px solid var(--border);
    border-radius: 6px; background: var(--bg); color: var(--text);
    font-size: .85rem; resize: vertical; font-family: inherit;
}
.ch-reviewed-info {
    font-size: .8rem; color: var(--green); margin-top: 6px;
}

.typing-dots { display: flex; gap: 4px; padding: 8px 0; }
.typing-dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--text-muted); animation: typingBounce .6s infinite alternate;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
    from { opacity: .3; transform: translateY(0); }
    to { opacity: 1; transform: translateY(-4px); }
}

/* ══════ AI MODE SELECTOR ══════ */
.ai-mode-selector {
    display: flex; align-items: center; gap: 4px;
    background: rgba(0,0,0,.3); border-radius: 20px; padding: 3px;
    margin-right: 8px;
}
.ai-mode-btn {
    font-size: .7rem; padding: 4px 12px; border-radius: 16px;
    border: none; background: transparent; color: var(--text-muted);
    cursor: pointer; transition: all .2s; white-space: nowrap; font-weight: 500;
}
.ai-mode-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
.ai-mode-btn.active {
    background: rgba(0,200,255,.15); color: var(--cyan);
    border: 1px solid rgba(0,200,255,.3); font-weight: 600;
}
.ai-mode-btn[data-mode="local"].active {
    background: rgba(34,197,94,.15); color: #22c55e;
    border: 1px solid rgba(34,197,94,.3);
}
.ai-mode-btn[data-mode="cloud"].active {
    background: rgba(59,130,246,.15); color: #3b82f6;
    border: 1px solid rgba(59,130,246,.3);
}
.ai-status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #666; margin-left: 4px; margin-right: 4px;
    transition: background .3s;
}
.ai-status-dot.online { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,.5); }
.ai-status-dot.offline { background: #ef4444; }

/* ══════ PARTS EMPTY STATE ══════ */
.parts-empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.parts-empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: .5; }
.parts-empty-state h3 { color: var(--text); font-size: 1.2rem; margin-bottom: 8px; }
.parts-empty-state p { font-size: .95rem; line-height: 1.5; }

/* ══════ PARTS TAB PANELS ══════ */
#parts-tabs-bar { margin-bottom: 12px; }
#sec-parts .dx-panel { display: none; }
#sec-parts .dx-panel.active { display: block; }

/* ══════ DRAG & DROP ZONE ══════ */
.ar-drop-zone {
    border: 2px dashed var(--border); border-radius: 12px;
    padding: 30px 20px; text-align: center;
    transition: border-color .2s, background .2s;
    cursor: pointer;
}
.ar-drop-zone.dragover {
    border-color: var(--accent); background: rgba(59,130,246,.08);
}
.ar-drop-content p { margin: 4px 0; color: var(--text); }

/* ══════ PARTS PHOTOS GALLERY ══════ */
.photo-thumb {
    width: 130px; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--border); background: var(--surface);
    cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.photo-thumb:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.photo-thumb img {
    width: 100%; height: 90px; object-fit: cover; display: block;
}
.photo-thumb-label {
    padding: 4px 6px 2px; font-size: .75rem; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.photo-thumb-meta {
    padding: 0 6px 4px; font-size: .65rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ══════ PARTS IDENTIFY LAYOUT ══════ */
.parts-identify-layout {
    display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.parts-identify-camera,
.parts-identify-search {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 20px;
}
.parts-identify-camera h4,
.parts-identify-search h4 {
    margin: 0 0 8px; font-size: 1rem; color: var(--text);
}
.parts-identify-hint {
    font-size: .85rem; color: var(--text-muted); margin: 0 0 14px; line-height: 1.4;
}
.parts-identify-search .dx-input {
    padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg); color: var(--text);
    font-size: .9rem;
}
#ar-result-panel {
    min-height: 120px;
}
#ar-result-panel .part-card {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 14px; margin-bottom: 8px;
}
#ar-result-panel .part-card h5 { margin: 0 0 4px; font-size: .95rem; color: var(--text); }
#ar-result-panel .part-card p  { margin: 2px 0; font-size: .85rem; color: var(--text-muted); }

/* ══════ SCHEMES TOOLBAR ══════ */
.schemes-toolbar {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
    align-items: center;
}
.schemes-toolbar .dx-input {
    padding: 8px 12px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg); color: var(--text); font-size: .9rem;
}

/* ══════ SCHEMES TYPE FILTER ══════ */
#schemes-type-filter {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.scheme-type-btn {
    padding: 5px 14px; border-radius: 20px; font-size: .8rem;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text-muted); cursor: pointer; transition: all .15s;
}
.scheme-type-btn:hover { border-color: var(--accent); color: var(--text); }
.scheme-type-btn.active {
    background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ══════ SCHEMES CARDS (expandable) ══════ */
.scheme-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; margin-bottom: 8px; overflow: hidden;
    transition: border-color .2s;
}
.scheme-card:hover { border-color: var(--accent); }

.scheme-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; cursor: pointer; gap: 12px;
    user-select: none;
}
.scheme-card-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.scheme-card-title h4 {
    margin: 0; font-size: .95rem; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.scheme-type-badge {
    font-size: .75rem; padding: 3px 8px; border-radius: 6px;
    background: rgba(59,130,246,.12); color: var(--accent);
    white-space: nowrap; flex-shrink: 0;
}
.scheme-expand-icon {
    font-size: 1.1rem; color: var(--text-muted); transition: transform .2s;
    flex-shrink: 0;
}
.scheme-card.expanded .scheme-expand-icon { transform: rotate(90deg); }

.scheme-card-body {
    display: none; padding: 0 16px 16px; border-top: 1px solid var(--border);
}
.scheme-card.expanded .scheme-card-body { display: block; padding-top: 12px; }

.scheme-warning {
    background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.25);
    border-radius: 8px; padding: 8px 12px; margin-bottom: 10px;
    font-size: .85rem; color: #ef4444; line-height: 1.5;
}

.scheme-content {
    font-size: .9rem; line-height: 1.7; color: var(--text);
    white-space: pre-wrap;
}

.scheme-steps ol {
    margin: 4px 0 0 20px; padding: 0;
    font-size: .9rem; line-height: 1.7; color: var(--text);
}
.scheme-steps li { padding: 3px 0; }
.scheme-steps li.checkpoint {
    background: rgba(59,130,246,.08); margin: 2px -8px; padding: 4px 8px;
    border-radius: 6px; font-weight: 500;
}
.step-dur { font-size: .75rem; color: var(--text-muted); }
.step-note { font-size: .8rem; color: var(--accent); display: block; }

.scheme-meta {
    display: flex; flex-direction: column; gap: 6px; margin-top: 12px;
    padding-top: 10px; border-top: 1px solid var(--border);
}
.scheme-meta-item {
    font-size: .83rem; color: var(--text-muted); line-height: 1.5;
}
.scheme-meta-item strong { color: var(--text); font-weight: 600; }

/* ══════ SCHEME ACTION BUTTONS ══════ */
.scheme-actions {
    display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px;
    padding-top: 10px; border-top: 1px solid var(--border);
}
.btn-sm {
    padding: 6px 14px; font-size: .82rem; border-radius: 6px;
}
.scheme-doc-btn {
    background: var(--accent) !important; color: #fff !important;
    text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
}
.scheme-doc-btn:hover { opacity: .85; }
.scheme-proc-btn {
    background: var(--surface) !important; color: var(--text) !important;
    border: 1px solid var(--border) !important;
}
.scheme-proc-btn:hover { border-color: var(--accent) !important; }

@media (max-width: 700px) {
    .parts-identify-layout { grid-template-columns: 1fr; }
    .scheme-card-title h4 { font-size: .85rem; }
}

/* ══════ DASHBOARD PRODUCȚIE ══════ */
.dashboard-toolbar {
    display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap;
}
.dash-filter {
    padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font-size: .9rem;
    min-width: 150px;
}
.dash-cards-grid {
    display: flex; flex-direction: column; gap: 16px;
}

/* Line card (full-width per production line) */
.dash-line-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 20px; transition: border-color .2s;
}
.dash-line-card:hover { border-color: var(--accent); }
.dash-line-card.dash-line-alert { border-left: 4px solid #ffb400; }
.dash-line-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
    padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.dash-line-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-line-id {
    font-size: 1.2rem; font-weight: 800; color: var(--accent);
    background: rgba(0,200,255,.1); padding: 3px 12px; border-radius: 8px;
}
.dash-line-type {
    font-size: .72rem; font-weight: 700; text-transform: uppercase;
    padding: 2px 8px; border-radius: 4px; letter-spacing: .5px;
    background: rgba(255,255,255,.08); color: var(--text-muted);
}
.dash-line-product { font-size: .95rem; font-weight: 600; color: var(--text); }
.dash-line-eqcount {
    font-size: .75rem; color: var(--text-muted);
    background: rgba(255,255,255,.05); padding: 2px 8px; border-radius: 10px;
}
.dash-line-metrics { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dash-metric {
    font-size: .85rem; font-weight: 600; color: var(--text);
    padding: 4px 10px; background: rgba(255,255,255,.04); border-radius: 6px;
}
.dash-status {
    padding: 4px 12px; border-radius: 20px; font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
}
.dash-status-ok { background: rgba(0,200,100,.15); color: #00c864; }
.dash-status-error { background: rgba(255,60,60,.15); color: #ff3c3c; }
.dash-status-stopped { background: rgba(150,150,150,.15); color: #999; }
.dash-status-maintenance { background: rgba(255,180,0,.15); color: #ffb400; }

/* Alerts inside line card */
.dash-alerts {
    background: rgba(255,180,0,.08); border: 1px solid rgba(255,180,0,.25);
    border-radius: 8px; padding: 10px 14px; margin-bottom: 12px;
}
.dash-alert-row {
    font-size: .82rem; color: #ffb400; padding: 3px 0;
}
.dash-alert-row strong { color: var(--text); }

/* Equipment status warnings */
.dash-eq-statuses { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.dash-eq-error, .dash-eq-stopped, .dash-eq-warn {
    font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 6px;
}
.dash-eq-error { background: rgba(255,60,60,.15); color: #ff3c3c; }
.dash-eq-stopped { background: rgba(150,150,150,.15); color: #999; }
.dash-eq-warn { background: rgba(255,180,0,.12); color: #ffb400; }

.dash-line-info { margin-bottom: 12px; }
.dash-info-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.dash-info-item { font-size: .82rem; color: var(--text-muted); }
.dash-info-item strong { color: var(--text); display: block; font-size: .88rem; }

/* Equipment chip list */
.dash-eq-list {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px;
    padding: 10px 0; border-top: 1px solid var(--border);
}
.dash-eq-chip {
    font-size: .78rem; padding: 4px 10px; border-radius: 8px;
    background: rgba(255,255,255,.06); color: var(--text-muted);
    border: 1px solid var(--border); white-space: nowrap;
    cursor: pointer; transition: all .15s;
}
.dash-eq-chip:hover {
    background: rgba(0,200,255,.12); border-color: var(--accent); color: var(--text);
}
.dash-eq-chip.dash-eq-err { border-color: #ff3c3c; color: #ff3c3c; background: rgba(255,60,60,.08); }
.dash-eq-chip.dash-eq-stp { border-color: #666; color: #888; background: rgba(100,100,100,.1); }

.dash-actions {
    display: flex; gap: 8px; flex-wrap: wrap;
}
.dash-btn {
    flex: 1; padding: 12px 8px; border-radius: 8px; border: none; cursor: pointer;
    font-size: .85rem; font-weight: 600; text-align: center; transition: opacity .2s;
    min-width: 120px;
}
.dash-btn:hover { opacity: .85; }
.dash-btn-urgent { background: #ff3c3c; color: #fff; }
.dash-btn-ai { background: var(--accent); color: #fff; }
.dash-btn-detail { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

@media (max-width: 600px) {
    .dash-line-header { flex-direction: column; align-items: flex-start; }
    .dash-line-metrics { width: 100%; justify-content: flex-start; }
    .dash-info-grid { grid-template-columns: 1fr; }
    .dash-btn { min-width: 90px; padding: 10px 6px; font-size: .8rem; }
}

/* ========== PRODUCT QUALITY MODULE ========== */
.dash-btn-product { background: var(--accent); color: #fff; }
.dash-btn-product:hover { filter: brightness(1.2); }

.dash-alert-quality { border-left: 3px solid var(--accent); background: rgba(0,150,255,.08); }

.pq-doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px; }
.pq-doc-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.pq-doc-link:hover { text-decoration: underline; }
.pq-doc-meta { color: var(--text-dim); font-size: .85rem; flex: 1; }

.pq-img-section { margin-bottom: 20px; }
.pq-img-ok-label { color: var(--success); margin: 0 0 8px; }
.pq-img-nok-label { color: var(--danger); margin: 0 0 8px; }
.pq-img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.pq-img-card { border-radius: 8px; overflow: hidden; border: 3px solid transparent; transition: transform .2s; }
.pq-img-card:hover { transform: scale(1.02); }
.pq-img-ok { border-color: var(--success); }
.pq-img-nok { border-color: var(--danger); }
.pq-img-card img { width: 100%; height: 150px; object-fit: cover; cursor: pointer; display: block; }
.pq-img-caption { padding: 6px 8px; font-size: .82rem; color: var(--text-dim); display: flex; align-items: center; justify-content: space-between; gap: 6px; }

.pq-video-card { margin-bottom: 16px; }
.pq-video-caption { padding: 8px 0; font-size: .9rem; display: flex; align-items: center; gap: 10px; }

.pq-check-template { border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.pq-check-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 1.05rem; }
.pq-check-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.pq-check-table th { text-align: left; padding: 6px 8px; border-bottom: 2px solid var(--border); color: var(--text-dim); font-weight: 600; }
.pq-check-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); }
.pq-val-min, .pq-val-max { color: var(--text-dim); font-size: .85rem; }
.pq-val-nom { font-weight: 600; }
.pq-input-measure { width: 80px; padding: 4px 6px; border: 2px solid var(--border); border-radius: 4px; background: var(--bg-card); color: var(--text); font-size: .9rem; transition: border-color .2s; }
.pq-input-measure:focus { outline: none; border-color: var(--accent); }
.pq-cell-status { font-size: 1.1rem; font-weight: bold; text-align: center; width: 40px; }

.pq-field-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.pq-field-row input, .pq-field-row select { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-card); color: var(--text); font-size: .85rem; }

.pq-result-ok td:nth-child(4) { color: var(--success); }
.pq-result-nok { background: rgba(255, 80, 80, .08); }
.pq-result-nok td:nth-child(4) { color: var(--danger); }

.btn-danger-sm { background: none; border: 1px solid var(--danger); color: var(--danger); border-radius: 4px; padding: 2px 8px; cursor: pointer; font-size: .8rem; }
.btn-danger-sm:hover { background: var(--danger); color: #fff; }

@media (max-width: 768px) {
    .pq-img-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .pq-check-table { font-size: .8rem; }
    .pq-input-measure { width: 60px; }
    .pq-field-row { flex-direction: column; }
}

/* ═══ FACTORY LAYOUT ═══════════════════════════════════════════ */
.layout-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; padding: .5rem 0; }
.layout-toolbar-left, .layout-toolbar-right { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.layout-canvas-wrap { background: #0f0f23; border: 1px solid var(--border); border-radius: 8px; min-height: 450px; position: relative; overflow: hidden; }
.layout-el { transition: all .2s ease; }
.layout-eq { backdrop-filter: blur(2px); }
.layout-eq:hover { box-shadow: 0 0 16px rgba(59,130,246,.4), inset 0 0 20px rgba(255,255,255,.03) !important; }
.layout-selected { outline: 2px solid var(--accent) !important; outline-offset: 2px; }
.layout-zone { pointer-events: auto; }
.layout-canvas-wrap:not(.edit-mode) .layout-zone { pointer-events: none; }
.layout-annot:hover { text-shadow: 0 0 8px currentColor; }
.layout-form { animation: fadeIn .2s; }
.layout-photo-thumb img { transition: transform .2s; }
.layout-photo-thumb img:hover { transform: scale(1.05); }
@media (max-width: 768px) {
    .layout-toolbar { flex-direction: column; align-items: stretch; }
    .layout-canvas-wrap { min-height: 300px; }
}

@keyframes layout-attn-pulse {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: .88; filter: brightness(1.15); }
}
.layout-attention-marker {
    animation: layout-attn-pulse 1.35s ease-in-out infinite;
}
.alarm-plan-focus {
    font-size: .68rem;
    padding: 2px 8px;
    margin-left: 6px;
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, .5);
    background: rgba(99, 102, 241, .15);
    color: #c7d2fe;
    cursor: pointer;
}
.alarm-plan-focus:hover {
    background: rgba(99, 102, 241, .35);
}

/* ═══ ALARM HISTORY TABLE ═══ */
.ah-table {
    width: 100%; border-collapse: collapse; font-size: .7rem;
}
.ah-table th {
    background: var(--panel); color: var(--text-muted); text-align: left;
    padding: .4rem .5rem; border-bottom: 2px solid var(--border);
    font-size: .6rem; text-transform: uppercase; letter-spacing: .5px;
    position: sticky; top: 0; z-index: 1;
}
.ah-table td {
    padding: .35rem .5rem; border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.ah-table tr.ah-active { background: rgba(255,61,61,.03); }
.ah-table tr.ah-resolved { opacity: .7; }
.ah-time { font-family: var(--mono); font-size: .6rem; white-space: nowrap; }
.ah-machine { font-weight: 700; color: var(--cyan); white-space: nowrap; }
.ah-code { font-family: var(--mono); font-weight: 700; }
.ah-detail { max-width: 200px; font-size: .62rem; line-height: 1.3; }
.ah-active-badge {
    font-size: .55rem; font-weight: 700; padding: .1rem .3rem; border-radius: 2px;
    background: rgba(255,61,61,.15); color: var(--red);
}
.ah-resolved-badge {
    font-size: .55rem; padding: .1rem .3rem; border-radius: 2px;
    background: rgba(0,200,100,.1); color: #0c6;
}
.ah-acked-badge {
    font-size: .55rem; padding: .1rem .3rem; border-radius: 2px;
    background: rgba(0,200,255,.1); color: var(--cyan);
}
.btn-sm { font-size: .65rem; padding: .2rem .4rem; }

@keyframes blinkBadge {
    0%, 100% { opacity: 1; }
    50% { opacity: .4; }
}

/* ═══ HMI MIRROR ═══ */
.hmi-mirror-container {
    display: flex; flex-direction: column; height: 100%; min-height: 400px;
}
.hmi-mirror-toolbar {
    display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem;
    background: var(--panel); border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.hmi-mirror-label {
    font-size: .7rem; color: var(--text-muted); flex: 1;
    font-family: var(--mono); overflow: hidden; text-overflow: ellipsis;
}
.hmi-fullscreen-btn { cursor: pointer; }
.hmi-mirror-iframe {
    flex: 1; width: 100%; min-height: 500px; border: none;
    background: #111; border-radius: 0 0 6px 6px;
}

/* ─── Document Template Navigator ──────────────────────────────── */
.doc-template-nav {
    margin-bottom: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card-bg);
    padding: 16px;
}
.doc-completeness { margin-bottom: 16px; }
.doc-completeness-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.doc-completeness-label { font-weight: 600; font-size: .95rem; color: var(--text); }
.doc-completeness-pct { font-size: .85rem; color: var(--text-muted); font-family: var(--mono); }
.doc-completeness-bar {
    height: 8px; background: rgba(255,255,255,.08); border-radius: 4px; overflow: hidden;
}
.doc-completeness-fill {
    height: 100%; border-radius: 4px; transition: width .3s;
    background: linear-gradient(90deg, #10b981, #34d399);
}
.doc-completeness-fill[style*="width:0%"] { background: #ef4444; }

/* Tree view */
.doc-tree { font-size: .9rem; }
.doc-tree-item { border-left: 2px solid transparent; }
.doc-tree-item.depth-0 { border-left-color: rgba(255,255,255,.06); }
.doc-tree-item.depth-1 { margin-left: 20px; border-left-color: rgba(255,255,255,.04); }
.doc-tree-item.depth-2 { margin-left: 40px; }
.doc-tree-row {
    display: flex; align-items: center; gap: 8px; padding: 5px 8px;
    cursor: default; border-radius: 4px; transition: background .15s;
}
.doc-tree-item.has-children > .doc-tree-row { cursor: pointer; }
.doc-tree-item.has-children > .doc-tree-row:hover { background: rgba(255,255,255,.05); }
.doc-tree-expand {
    font-size: .6rem; color: var(--text-muted); transition: transform .2s; width: 12px; text-align: center;
    display: inline-block; flex-shrink: 0;
}
.doc-tree-expand.open { transform: rotate(90deg); }
.doc-tree-expand-placeholder { width: 12px; flex-shrink: 0; display: inline-block; }
.doc-tree-status {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    display: inline-block;
}
.doc-tree-status.filled { background: #10b981; }
.doc-tree-status.empty { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15); }
.doc-tree-num {
    font-family: var(--mono); font-size: .8rem; color: var(--accent);
    min-width: 32px; flex-shrink: 0;
}
.doc-tree-title { flex: 1; color: var(--text); }
.doc-tree-item.is-filled .doc-tree-title { color: var(--text); }
.doc-tree-page {
    font-family: var(--mono); font-size: .75rem; color: var(--accent);
    background: rgba(0,180,255,.1); padding: 1px 6px; border-radius: 3px;
    cursor: pointer; flex-shrink: 0;
}
.doc-tree-page:hover { background: rgba(0,180,255,.25); }

/* Categories view (SACMI) */
.doc-categories { display: flex; flex-direction: column; gap: 12px; }
.doc-category {
    border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.doc-category-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; background: rgba(255,255,255,.03);
    font-weight: 600; font-size: .9rem; cursor: pointer;
}
.doc-category-count {
    font-family: var(--mono); font-size: .8rem; color: var(--text-muted);
}
.doc-category-items { padding: 4px 8px; }
.doc-category-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px;
    border-radius: 4px; font-size: .85rem;
}
.doc-category-item:hover { background: rgba(255,255,255,.03); }
.doc-cat-status {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.doc-cat-status.filled { background: #10b981; }
.doc-cat-status.empty { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.15); }
.doc-cat-title { flex: 1; color: var(--text); }
.doc-cat-code {
    font-family: var(--mono); font-size: .75rem; color: var(--text-muted);
    background: rgba(255,255,255,.05); padding: 1px 6px; border-radius: 3px;
}
.doc-cat-lang {
    font-size: .7rem; color: var(--text-muted); text-transform: uppercase;
}
.doc-cat-remove {
    cursor: pointer; color: #ef4444; font-size: 1rem; font-weight: bold;
    padding: 0 3px; border-radius: 3px; margin-left: 2px; line-height: 1;
}
.doc-cat-remove:hover { background: rgba(239,68,68,.15); }
.doc-cat-open:hover { text-decoration: underline; color: var(--accent); }
.doc-cat-pages {
    font-family: var(--mono); font-size: .7rem; color: var(--text-muted);
}
.doc-cat-ch-toggle {
    font-size: .7rem; color: var(--accent); cursor: pointer;
    padding: 1px 6px; border-radius: 3px;
    background: rgba(0,180,255,.08); border: 1px solid rgba(0,180,255,.2);
    white-space: nowrap; user-select: none;
}
.doc-cat-ch-toggle:hover { background: rgba(0,180,255,.18); }
.doc-cat-ch-toggle.expanded { background: rgba(0,180,255,.2); }
.doc-ch-list {
    margin: 0 0 8px 22px; padding: 4px 0; border-left: 2px solid rgba(0,180,255,.15);
    max-height: 350px; overflow-y: auto;
}
.doc-ch-main, .doc-ch-sub {
    display: flex; align-items: center; gap: 6px; padding: 3px 8px;
    font-size: .82rem; line-height: 1.3;
}
.doc-ch-main:hover, .doc-ch-sub:hover { background: rgba(255,255,255,.03); }
.doc-ch-sub { padding-left: 22px; font-size: .78rem; }
.doc-ch-num-link {
    font-family: var(--mono); font-size: .75rem; color: var(--accent);
    cursor: pointer; min-width: 30px; flex-shrink: 0;
}
.doc-ch-num-link:hover { text-decoration: underline; }
.doc-ch-title-text { flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-ch-title-link {
    flex: 1; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer;
}
.doc-ch-title-link:hover { color: var(--accent); text-decoration: underline; }
.doc-ch-pages {
    font-family: var(--mono); font-size: .72rem; color: var(--text-muted);
    white-space: nowrap; flex-shrink: 0;
}
.doc-ch-del {
    cursor: pointer; color: #ef4444; font-size: .9rem; font-weight: bold;
    padding: 0 3px; border-radius: 3px; line-height: 1; flex-shrink: 0;
}
.doc-ch-del:hover { background: rgba(239,68,68,.15); }
.doc-ch-add-row {
    display: flex; align-items: center; gap: 4px; padding: 4px 8px; margin-top: 4px;
    border-top: 1px solid rgba(255,255,255,.06);
}
.doc-ch-add-row input {
    font-size: .78rem; padding: 2px 6px; background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.12); border-radius: 3px; color: var(--text);
}
.doc-ch-add-row input:focus { border-color: var(--accent); outline: none; }
.doc-ch-add-row .doc-ch-add-title { flex: 1; }
.doc-ch-add-btn {
    font-size: .85rem; font-weight: bold; padding: 0 6px;
    background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.3); color: #10b981;
}
.doc-ch-add-btn:hover { background: rgba(16,185,129,.25); }
.doc-cat-upload-btn {
    font-size: .85rem; font-weight: bold; padding: 0 6px; margin-left: 6px;
    background: rgba(16,185,129,.15); border: 1px solid rgba(16,185,129,.3);
    color: #10b981; border-radius: 4px; cursor: pointer; line-height: 1.4;
}
.doc-cat-upload-btn:hover { background: rgba(16,185,129,.25); }
.doc-tree-alloc {
    font-size: .72rem; padding: 1px 4px; border-radius: 3px; margin-left: 6px;
    background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.2);
    color: var(--text-muted); max-width: 140px; cursor: pointer;
}
.doc-tree-alloc:focus { border-color: #10b981; outline: none; }
/* Chapter management */
.doc-ch-delete {
    cursor: pointer; color: #ef4444; font-size: 1.1rem; font-weight: bold;
    padding: 0 4px; border-radius: 3px; margin-left: 4px; line-height: 1;
}
.doc-ch-delete:hover { background: rgba(239,68,68,.15); }
.doc-detected-chapters {
    margin-top: 12px; padding: 10px; border-radius: 6px;
    background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06);
}
.doc-detected-header {
    font-size: .85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px;
}
.doc-detected-list { display: flex; flex-direction: column; gap: 3px; }
.doc-detected-item {
    display: flex; align-items: center; gap: 6px; padding: 4px 8px;
    font-size: .82rem; border-radius: 4px;
}
.doc-detected-item:hover { background: rgba(255,255,255,.03); }
.doc-ch-num {
    font-family: var(--mono); font-size: .75rem; color: var(--text-muted);
    min-width: 35px;
}
.doc-ch-title { flex: 1; color: var(--text); }
.doc-ch-pages {
    font-family: var(--mono); font-size: .72rem; color: var(--text-muted);
}
.doc-ch-mapped {
    font-size: .7rem; padding: 1px 5px; border-radius: 3px;
    background: rgba(16,185,129,.12); color: #10b981;
}
.doc-ch-unmapped {
    font-size: .7rem; padding: 1px 5px; border-radius: 3px;
    background: rgba(245,158,11,.12); color: #f59e0b;
}
.doc-add-chapter {
    margin-top: 12px; padding: 10px; border-radius: 6px;
    background: rgba(16,185,129,.03); border: 1px solid rgba(16,185,129,.12);
}
.doc-add-chapter-title {
    font-size: .82rem; font-weight: 600; color: #10b981; margin-bottom: 8px;
}
.doc-add-chapter-form {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.doc-add-chapter-form select,
.doc-add-chapter-form input {
    font-size: .8rem; padding: 4px 8px; border-radius: 4px;
    background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.1);
    color: var(--text);
}
.doc-add-chapter-form select { max-width: 200px; }
.doc-add-chapter-form input[type="text"] { flex: 1; min-width: 100px; }

/* ─── LINE LAYOUT DETAIL ───────────────────────────────────────── */
.dash-btn-layout {
    background: rgba(99,102,241,.15); border-color: rgba(99,102,241,.3); color: #818cf8;
}
.dash-btn-layout:hover { background: rgba(99,102,241,.25); }

.ll-upload-bar {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    background: rgba(255,255,255,.02); border-bottom: 1px solid rgba(255,255,255,.06);
}
.ll-upload-bar input[type="file"] { font-size: .8rem; color: var(--text-muted); }
.ll-upload-bar input[type="text"] {
    font-size: .8rem; padding: 4px 8px; border-radius: 4px;
    background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.1); color: var(--text);
}
.ll-edit-toggle { margin-left: auto !important; }

.ll-no-layout { text-align: center; }

.ll-layout-container {
    position: relative; overflow: auto; padding: 12px;
    max-height: 65vh;
}
.ll-layout-wrap {
    position: relative; display: inline-block; width: 100%;
}
.ll-layout-img {
    width: 100%; height: auto; display: block; border-radius: 6px;
    background: rgba(0,0,0,.3); user-select: none;
}

.ll-element {
    position: absolute; transform: translate(-50%, -50%);
    display: flex; align-items: center; gap: 3px;
    padding: 2px 6px; border-radius: 4px; font-size: .72rem;
    background: rgba(0,0,0,.7); border: 1.5px solid rgba(16,185,129,.6);
    color: #e2e8f0; white-space: nowrap; cursor: default;
    z-index: 10; transition: box-shadow .2s;
}
.ll-element:hover { box-shadow: 0 0 10px rgba(16,185,129,.4); z-index: 20; }
.ll-element.draggable { cursor: grab; border-style: dashed; }
.ll-element.draggable:active { cursor: grabbing; }
.ll-element.elem-ok { border-color: rgba(16,185,129,.6); }
.ll-element.elem-warn {
    border-color: #f59e0b; background: rgba(245,158,11,.15);
    animation: ll-pulse-warn 1.5s infinite;
}
.ll-element.elem-alarm {
    border-color: #ef4444; background: rgba(239,68,68,.2);
    animation: ll-pulse-alarm 1s infinite;
}
@keyframes ll-pulse-warn { 0%,100%{box-shadow:0 0 4px rgba(245,158,11,.3)} 50%{box-shadow:0 0 12px rgba(245,158,11,.6)} }
@keyframes ll-pulse-alarm { 0%,100%{box-shadow:0 0 4px rgba(239,68,68,.3)} 50%{box-shadow:0 0 14px rgba(239,68,68,.7)} }

.ll-elem-icon { font-size: .85rem; }
.ll-elem-label { font-size: .68rem; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }

/* Elements table */
.ll-elements-list { padding: 12px; }
.ll-elem-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.ll-elem-table th {
    text-align: left; padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.1);
    color: var(--text-muted); font-weight: 600; font-size: .75rem; text-transform: uppercase;
}
.ll-elem-table td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,.04); }
.ll-elem-row.ll-elem-alert { background: rgba(239,68,68,.06); }

/* Media gallery */
.ll-media-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px; padding: 12px;
}
.ll-media-item {
    position: relative; border-radius: 8px; overflow: hidden;
    background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.06);
}
.ll-media-img {
    width: 100%; height: 160px; object-fit: cover; cursor: pointer;
    transition: transform .2s;
}
.ll-media-img:hover { transform: scale(1.03); }
.ll-media-vid { width: 100%; max-height: 200px; }
.ll-media-desc {
    padding: 6px 8px; font-size: .78rem; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ll-media-del {
    position: absolute; top: 4px; right: 6px; cursor: pointer;
    color: #ef4444; font-size: 1.2rem; font-weight: bold;
    background: rgba(0,0,0,.6); border-radius: 50%; width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center; line-height: 1;
}
.ll-media-del:hover { background: rgba(239,68,68,.3); }

/* Add element dialog */
.ll-add-dialog {
    position: fixed; inset: 0; z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.6);
}
.ll-add-dialog-inner {
    background: var(--bg-panel, #1e293b); border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px; padding: 20px; max-width: 400px; width: 90%;
}
.ll-add-dialog-inner h4 { margin: 0 0 12px; color: var(--text); }
.ll-add-dialog-inner label {
    display: block; margin-bottom: 8px; font-size: .82rem; color: var(--text-muted);
}
.ll-add-dialog-inner select,
.ll-add-dialog-inner input {
    width: 100%; margin-top: 2px; padding: 6px 8px; border-radius: 4px;
    background: rgba(0,0,0,.3); border: 1px solid rgba(255,255,255,.15);
    color: var(--text); font-size: .82rem;
}
.ll-add-btns { display: flex; gap: 8px; margin-top: 14px; justify-content: flex-end; }

/* ── Energy Monitor Dashboard (CONSUM tab) ── */
.em-dashboard { display: flex; flex-direction: column; gap: 16px; }

.em-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.em-kpi-card {
    display: flex; align-items: center; gap: 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 10px; padding: 14px 16px;
    transition: border-color .2s;
}
.em-kpi-card:hover { border-color: rgba(255,255,255,.18); }
.em-kpi-primary {
    background: linear-gradient(135deg, rgba(37,99,235,.18), rgba(37,99,235,.06));
    border-color: rgba(37,99,235,.35);
}
.em-kpi-good { border-color: rgba(0,230,118,.35); }
.em-kpi-warn { border-color: rgba(255,183,0,.4); }
.em-kpi-bad  { border-color: rgba(255,82,82,.4); }
.em-kpi-icon { font-size: 1.6rem; flex-shrink: 0; }
.em-kpi-body { min-width: 0; }
.em-kpi-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.em-kpi-value { font-size: 1.25rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.em-kpi-primary .em-kpi-value { color: var(--accent); }

.em-stats-row {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding: 10px 14px;
    background: rgba(255,255,255,.03);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,.06);
}
.em-stat { flex: 1; min-width: 100px; text-align: center; }
.em-stat-label { display: block; font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 2px; }
.em-stat-value { display: block; font-size: 1rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.em-stat-max { color: #ff9800; }
.em-stat-min { color: #29b6f6; }

.em-chart-panel {
    background: rgba(255,255,255,.02);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 10px; padding: 12px;
}
.em-chart-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.em-period-group, .em-param-group { display: flex; flex-wrap: wrap; gap: 4px; }

.em-period-btn, .em-param-btn {
    padding: 5px 12px; border-radius: 6px;
    font-size: .78rem; font-weight: 500; cursor: pointer;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: var(--text-muted);
    transition: all .15s;
}
.em-period-btn:hover, .em-param-btn:hover { background: rgba(255,255,255,.1); color: var(--text); }
.em-period-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.em-param-btn.active  { background: rgba(37,99,235,.2); color: var(--accent); border-color: var(--accent); }

.em-chart-wrap { position: relative; min-height: 280px; }
.em-chart-wrap canvas { width: 100% !important; max-height: 350px; }

.em-chart-loading {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: rgba(0,0,0,.4); border-radius: 8px;
    font-size: .85rem; color: var(--text-muted);
}
.em-spinner {
    width: 20px; height: 20px; border: 2px solid rgba(255,255,255,.15);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin .7s linear infinite;
}
.detail-loading {
    display: flex; align-items: center; justify-content: center; gap: .6rem;
    padding: 2rem; color: var(--text-muted); font-size: .85rem;
}
.detail-loading .spinner {
    width: 24px; height: 24px; border: 3px solid rgba(255,255,255,.1);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.em-live-panel { margin-top: 4px; }
.em-live-summary {
    cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--text-muted);
    padding: 6px 0;
}
.em-live-summary:hover { color: var(--text); }

.ai-mode-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
}
.ai-mode-dialog {
    background: var(--card-bg, #1e293b); border: 1px solid var(--border, #334155);
    border-radius: 12px; padding: 20px 24px; min-width: 300px; max-width: 380px;
    text-align: center; color: var(--text, #e2e8f0);
}
.ai-mode-dialog h3 { margin: 0 0 4px; font-size: 1.1rem; }
.ai-mode-opt {
    display: block; width: 100%; padding: 10px 14px; margin: 6px 0;
    background: rgba(255,255,255,.05); border: 1px solid var(--border, #334155);
    border-radius: 8px; color: var(--text, #e2e8f0); cursor: pointer;
    text-align: left; transition: all .15s;
}
.ai-mode-opt:hover {
    background: rgba(56,189,248,.12); border-color: rgba(56,189,248,.4);
}
.ai-mode-opt b { color: var(--accent, #38bdf8); }
.ai-mode-cancel {
    background: none; border: none; color: var(--text-muted, #94a3b8);
    cursor: pointer; font-size: .85rem; padding: 6px 12px;
}
.ai-mode-cancel:hover { color: var(--text, #e2e8f0); }

/* ═══ PROCEDURES & VALIDATION ════════════════════════════════════ */
.proc-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 10px;
}
.proc-card {
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: 10px;
    padding: 12px 14px;
    transition: border-color .15s;
}
.proc-card:hover { border-color: var(--accent, #38bdf8); }
.proc-card-missing { border-left: 3px solid var(--red, #ef4444); }
.proc-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.proc-card-meta {
    font-size: 0.85em;
    color: var(--text-muted, #94a3b8);
    margin-bottom: 6px;
}
.proc-card-actions { display: flex; gap: 6px; }
.proc-editor-meta label {
    display: block;
    font-size: 0.82em;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.proc-step-extra {
    padding: 4px 0 4px 36px;
    font-size: 0.88em;
    color: var(--text-muted);
}
.proc-step-safety {
    color: var(--red, #ef4444);
    font-weight: 600;
    margin-bottom: 2px;
}
.proc-step-tools { color: var(--accent, #38bdf8); margin-bottom: 2px; }
.proc-step-parts { margin-bottom: 2px; }
.proc-step-pdf-link {
    display: inline-block;
    color: var(--accent, #38bdf8);
    text-decoration: none;
    margin-bottom: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(56,189,248,.08);
}
.proc-step-pdf-link:hover { background: rgba(56,189,248,.18); }
.proc-step-ref-photo {
    max-width: 120px;
    border-radius: 6px;
    margin: 4px 0;
    cursor: pointer;
}
.proc-step-eng-notes {
    color: var(--green, #22c55e);
    font-style: italic;
    margin-bottom: 2px;
}
.proc-step-time {
    font-size: 0.82em;
    color: var(--text-muted);
}
.proc-note-btn {
    font-size: 0.78em;
    padding: 2px 6px;
    border-radius: 4px;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
}
.proc-note-btn:hover { background: rgba(255,255,255,.05); }

.val-card {
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border, #334155);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
}
.val-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.val-card-date {
    font-size: 0.82em;
    color: var(--text-muted);
}
.val-card-meta {
    font-size: 0.85em;
    color: var(--text-muted);
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--red, #ef4444);
    color: #fff;
    font-size: 0.72em;
    font-weight: 700;
    margin-left: 4px;
}

.wf-lessons-ref {
    margin: 8px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
}
.wf-lessons-ref summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--accent);
}
.wf-lessons-list li {
    margin-bottom: 6px;
    font-size: 0.9em;
}

/* ═══ VALIDATION SPLIT VIEW — PDF + WORKFLOW STEPS ═══ */
.val-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 9999;
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}
.val-split-container {
    display: flex;
    width: 100%;
    max-width: 1600px;
    height: 100%;
    background: var(--card-bg, #1e2a3a);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
    position: relative;
}
.val-split-left {
    flex: 0 0 45%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border, #2a3a4a);
    min-width: 0;
}
.val-split-right {
    flex: 1 1 55%;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--bg, #0f1923);
}
.val-split-container.val-no-pdf .val-split-left {
    flex: 1;
    border-right: none;
}
.val-split-container.val-no-pdf .val-split-right {
    flex: 0 0 320px;
}
.val-split-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border, #2a3a4a);
}
.val-split-header h3 {
    margin: 0;
    font-size: 1.05em;
    line-height: 1.3;
    flex: 1;
    padding-right: 8px;
}
.val-detail-meta {
    padding: 8px 20px;
    font-size: 0.85em;
    color: var(--text-muted, #8899aa);
    border-bottom: 1px solid var(--border, #2a3a4a);
}
.val-split-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}
.val-split-body h4 {
    margin: 12px 0 8px;
    font-size: 0.95em;
    color: var(--accent, #00b4ff);
}
.val-split-body h4:first-child {
    margin-top: 0;
}
.val-steps-list {
    padding-left: 0;
    counter-reset: step-counter;
    list-style: none;
}
.val-steps-list li {
    counter-increment: step-counter;
    padding: 8px 12px 8px 36px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: rgba(255,255,255,.03);
    position: relative;
    font-size: 0.92em;
    line-height: 1.45;
    transition: background .15s;
}
.val-steps-list li:hover {
    background: rgba(255,255,255,.06);
}
.val-steps-list li::before {
    content: counter(step-counter) ".";
    position: absolute;
    left: 10px;
    top: 8px;
    font-weight: 700;
    color: var(--text-muted, #8899aa);
    font-size: 0.85em;
}
.val-step-dur {
    color: var(--text-muted, #8899aa);
    font-size: 0.85em;
}
.val-step-page-btn {
    display: inline-block;
    background: rgba(0,180,255,.12);
    border: 1px solid rgba(0,180,255,.3);
    color: var(--accent, #00b4ff);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.78em;
    cursor: pointer;
    margin-left: 4px;
    vertical-align: middle;
    transition: background .15s;
}
.val-step-page-btn:hover {
    background: rgba(0,180,255,.25);
}
.val-notes-list {
    padding-left: 16px;
}
.val-notes-list li {
    margin-bottom: 6px;
    font-size: 0.9em;
    line-height: 1.4;
}
.val-split-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 20px;
    border-top: 1px solid var(--border, #2a3a4a);
}

/* PDF panel */
.val-pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #2a3a4a);
    flex-wrap: wrap;
    background: rgba(0,0,0,.15);
}
.val-pdf-label {
    font-size: 0.85em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}
.val-pdf-selector {
    background: var(--card-bg, #1e2a3a);
    color: var(--text-main, #e0e8f0);
    border: 1px solid var(--border, #2a3a4a);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.82em;
    max-width: 200px;
}
.val-pdf-extract-info {
    font-size: 0.82em;
    color: var(--accent, #00b4ff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.val-pdf-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.val-pdf-page-display {
    font-size: 0.85em;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}
.val-pdf-frame {
    flex: 1;
    border: none;
    width: 100%;
    min-height: 0;
    background: #1a1a2e;
}
.val-pdf-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted, #8899aa);
}
.val-pdf-empty .icon {
    font-size: 3em;
    margin-bottom: 16px;
    opacity: .4;
}

/* Mobile: stack panels vertically, toggle between them */
@media (max-width: 768px) {
    .val-detail-overlay {
        padding: 0;
    }
    .val-split-container {
        flex-direction: column;
        border-radius: 0;
    }
    .val-split-left {
        flex: 1;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .val-split-right {
        flex: 0;
        height: 0;
        overflow: hidden;
        transition: flex .3s, height .3s;
    }
    .val-split-container.val-show-pdf .val-split-left {
        flex: 0;
        height: 0;
        overflow: hidden;
    }
    .val-split-container.val-show-pdf .val-split-right {
        flex: 1;
        height: auto;
    }
    .val-toggle-panel {
        position: absolute !important;
        top: 8px !important;
        right: 50px !important;
        z-index: 2 !important;
    }
}

/* ═══ SACMI SPACE INTEGRATION ═════════════════════════════════ */
.sacmi-toolbar {
    display: flex; gap: 10px; align-items: center;
    padding: 12px 0; flex-wrap: wrap;
}
.sacmi-toolbar .dx-input { max-width: 300px; }
.sacmi-status {
    font-size: .85rem; color: var(--text-muted); margin-left: auto;
}
.sacmi-status-ok {
    color: var(--green); font-weight: 600;
}
.sacmi-status-warn {
    color: var(--yellow, #f5a623); font-weight: 600;
}
.sacmi-empty-state {
    padding: 50px 20px; text-align: center;
    color: var(--text-muted);
}
.sacmi-empty-state h3 { color: var(--text); margin-bottom: 8px; }
.sacmi-logo-empty {
    width: 120px; margin-bottom: 16px;
    filter: brightness(0) invert(.7);
}
.sacmi-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px; padding: 4px 0;
}
.sacmi-card {
    display: flex; align-items: center; gap: 14px;
    padding: 20px; border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    text-decoration: none; color: var(--text);
    transition: border-color .2s, box-shadow .2s, transform .15s;
    cursor: pointer;
}
.sacmi-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    transform: translateY(-2px);
}
.sacmi-card-primary {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(56,132,244,.08), rgba(56,132,244,.02));
}
.sacmi-card-primary:hover {
    background: linear-gradient(135deg, rgba(56,132,244,.15), rgba(56,132,244,.05));
}
.sacmi-card-icon {
    font-size: 2rem; flex-shrink: 0;
    width: 48px; text-align: center;
}
.sacmi-card-body { flex: 1; }
.sacmi-card-body h4 {
    margin: 0 0 4px; font-size: 1rem;
    color: var(--text);
}
.sacmi-card-body p {
    margin: 0; font-size: .83rem;
    color: var(--text-muted); line-height: 1.4;
}
.sacmi-card-arrow {
    font-size: 1.3rem; color: var(--text-muted);
    transition: transform .2s;
    flex-shrink: 0;
}
.sacmi-card:hover .sacmi-card-arrow {
    transform: translateX(4px);
    color: var(--primary);
}
.sacmi-missing-notice {
    margin-top: 16px; padding: 12px 16px;
    background: rgba(245,166,35,.1);
    border: 1px solid rgba(245,166,35,.3);
    border-radius: 8px; font-size: .85rem;
    color: var(--text);
}
.sacmi-missing-notice a { color: var(--primary); }
.sacmi-info-bar {
    display: flex; gap: 20px; flex-wrap: wrap;
    margin-top: 16px; padding: 10px 16px;
    background: var(--bg); border-radius: 8px;
    font-size: .83rem; color: var(--text-muted);
}
.sacmi-info-bar code {
    background: var(--surface); padding: 1px 6px;
    border-radius: 4px; font-size: .8rem;
}
.sacmi-config-details {
    margin-top: 16px;
}
.sacmi-config-details summary {
    cursor: pointer; font-size: .9rem;
    color: var(--text-muted); padding: 8px 0;
}
.sacmi-config-fields {
    display: flex; gap: 12px; flex-wrap: wrap;
    align-items: flex-end; padding: 12px 0;
}
.sacmi-config-fields label {
    display: flex; flex-direction: column; gap: 4px;
    font-size: .8rem; color: var(--text-muted);
}
.sacmi-config-fields .dx-input {
    width: 200px;
}
@media (max-width: 640px) {
    .sacmi-cards-grid { grid-template-columns: 1fr; }
    .sacmi-config-fields { flex-direction: column; }
    .sacmi-config-fields .dx-input { width: 100%; }
}

/* ═══ AR VIEW ═══════════════════════════════════════════════════ */
#sec-ar { padding: 0 !important; }
.ar-container { position: relative; width: 100%; height: calc(100vh - 56px); overflow: hidden; background: #000; }
.ar-camera-area { position: relative; width: 100%; height: 100%; }
#ar-video { width: 100%; height: 100%; object-fit: cover; }

.ar-hud-top {
    position: absolute; top: 0; left: 0; right: 0;
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,.6) 0%, transparent 100%);
}
.ar-status-indicator {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 20px;
    background: rgba(0,0,0,.55); backdrop-filter: blur(8px);
    color: #fff; font-size: .85rem; font-weight: 500;
}
.ar-status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: #666; display: inline-block;
}
.ar-status-scanning .ar-status-dot { background: #3b82f6; animation: ar-pulse 1.5s infinite; }
.ar-status-identifying .ar-status-dot { background: #f59e0b; animation: ar-pulse .6s infinite; }
.ar-status-identified .ar-status-dot { background: #22c55e; }
.ar-status-no-match .ar-status-dot { background: #ef4444; }
.ar-status-error .ar-status-dot { background: #ef4444; }

@keyframes ar-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .4; transform: scale(1.3); }
}

.ar-btn-close {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(0,0,0,.55); backdrop-filter: blur(8px);
    color: #fff; border: none; font-size: 1.1rem; cursor: pointer;
}

.ar-overlay-panel {
    position: absolute; bottom: 16px; right: 16px;
    width: 340px; max-height: calc(100% - 80px);
    background: rgba(15, 23, 42, .82);
    backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 16px; padding: 18px;
    color: #fff; z-index: 10;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.ar-machine-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.ar-machine-status {
    width: 14px; height: 14px; border-radius: 50%;
    flex-shrink: 0; background: #666;
}
.ar-machine-status.status-running { background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,.5); }
.ar-machine-status.status-stopped { background: #ef4444; }
.ar-machine-status.status-maint { background: #f59e0b; }
.ar-machine-info { flex: 1; min-width: 0; }
.ar-machine-info h3 { margin: 0; font-size: 1.05rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-subtitle { font-size: .78rem; color: rgba(255,255,255,.55); }

.ar-confidence {
    padding: 3px 10px; border-radius: 12px; font-size: .82rem; font-weight: 600;
    background: rgba(255,255,255,.1);
}
.ar-confidence.high { background: rgba(34,197,94,.25); color: #86efac; }
.ar-confidence.mid { background: rgba(245,158,11,.25); color: #fcd34d; }
.ar-confidence.low { background: rgba(239,68,68,.25); color: #fca5a5; }

.ar-data-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 8px; margin-bottom: 14px;
}
.ar-data-item {
    background: rgba(255,255,255,.06); border-radius: 10px; padding: 10px;
}
.ar-data-label { display: block; font-size: .7rem; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.ar-data-value { font-size: 1.05rem; font-weight: 600; }
.ar-data-value.ar-val-alert { color: #f87171; animation: ar-pulse 1s infinite; }

.ar-maintenance-section { margin-bottom: 14px; }
.ar-maint-item {
    font-size: .8rem; color: rgba(255,255,255,.7);
    padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.ar-maint-interval {
    display: inline-block; background: rgba(59,130,246,.2); color: #93c5fd;
    padding: 1px 8px; border-radius: 8px; font-size: .72rem; margin-right: 6px;
}

.ar-actions {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 6px; margin-bottom: 10px;
}
.ar-action-btn {
    padding: 8px 10px; border-radius: 10px;
    border: 1px solid rgba(255,255,255,.15);
    background: rgba(255,255,255,.08);
    color: #fff; font-size: .78rem; cursor: pointer;
    transition: background .2s;
}
.ar-action-btn:hover { background: rgba(255,255,255,.18); }
.ar-btn-confirm { border-color: rgba(34,197,94,.4); }
.ar-btn-confirm:hover { background: rgba(34,197,94,.25); }
.ar-btn-detail { border-color: rgba(59,130,246,.4); }
.ar-btn-detail:hover { background: rgba(59,130,246,.25); }
.ar-btn-maint { border-color: rgba(245,158,11,.4); }
.ar-btn-maint:hover { background: rgba(245,158,11,.25); }

.ar-source-info { text-align: center; }
.ar-source {
    font-size: .7rem; padding: 2px 10px; border-radius: 10px;
    background: rgba(255,255,255,.08); color: rgba(255,255,255,.4);
}
.ar-source.src-local { color: #93c5fd; background: rgba(59,130,246,.15); }
.ar-source.src-yolo { color: #86efac; background: rgba(34,197,94,.15); }
.ar-source.src-cloud { color: #c4b5fd; background: rgba(139,92,246,.15); }

.ar-identify-part-btn {
    position: absolute; bottom: 16px; left: 16px; z-index: 10;
}

@media (max-width: 640px) {
    .ar-overlay-panel { width: calc(100% - 32px); right: 16px; left: 16px; bottom: 10px; max-height: 55vh; }
    .ar-identify-part-btn { bottom: auto; top: 60px; left: 16px; }
}
