/* Surveillance Industrielle — PWA Theme */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #16213e;
    --bg-card: #1a1a2e;
    --bg-input: #0d1b2a;
    --text-primary: #e8e8f0;
    --text-secondary: #8892a4;
    --text-muted: #555e70;
    --accent: #e94560;
    --accent-hover: #c73e54;
    --border: #2a2a4a;
    --success: #00c853;
    --warning: #ffab00;
    --critical: #ff1744;
    --info: #448aff;
    --cleared: #78909c;
}

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

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

/* ── Layout ── */

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

main {
    flex: 1;
    padding: 16px;
    padding-bottom: 80px; /* space for bottom nav */
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

/* ── Bottom Navigation ── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: color 0.15s;
}

.bottom-nav a.active {
    color: var(--accent);
}

.bottom-nav a svg {
    width: 22px;
    height: 22px;
}

.nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    background: var(--critical);
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 4px;
}

/* ── Header ── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-header h1 {
    font-size: 20px;
    font-weight: 700;
}

/* ── Cards ── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

/* ── Alarm Items ── */

.alarm-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-left: 4px solid var(--border);
    transition: border-color 0.15s;
}

.alarm-item[data-severity="critical"] { border-left-color: var(--critical); }
.alarm-item[data-severity="warning"] { border-left-color: var(--warning); }
.alarm-item[data-severity="info"] { border-left-color: var(--info); }

.alarm-item[data-state="cleared"] { opacity: 0.6; }
.alarm-item[data-state="acknowledged"] { opacity: 0.5; }

.alarm-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.alarm-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.alarm-message {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* ── Badges ── */

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-critical { background: rgba(255,23,68,0.2); color: var(--critical); }
.badge-warning { background: rgba(255,171,0,0.2); color: var(--warning); }
.badge-info { background: rgba(68,138,255,0.2); color: var(--info); }
.badge-active { background: rgba(255,23,68,0.15); color: var(--critical); }
.badge-cleared { background: rgba(120,144,156,0.2); color: var(--cleared); }
.badge-acknowledged { background: rgba(0,200,83,0.2); color: var(--success); }

/* ── Buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover:not(:disabled) { border-color: var(--text-secondary); }

.btn-ack {
    background: rgba(0,200,83,0.15);
    color: var(--success);
    border: 1px solid rgba(0,200,83,0.3);
}
.btn-ack:hover:not(:disabled) { background: rgba(0,200,83,0.25); }

/* ── Forms ── */

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus {
    border-color: var(--accent);
}

/* ── Login ── */

.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 360px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 22px;
    color: var(--accent);
    margin-top: 12px;
}

.login-logo p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.login-error {
    background: rgba(255,23,68,0.1);
    border: 1px solid rgba(255,23,68,0.3);
    color: var(--critical);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.login-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    justify-content: center;
}

/* ── Stats Row ── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1;
}

.stat-value.critical { color: var(--critical); }
.stat-value.warning { color: var(--warning); }
.stat-value.success { color: var(--success); }

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Filter Tabs ── */

.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.filter-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ── Dashboard Chart Area ── */

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.chart-header h3 {
    font-size: 14px;
    font-weight: 600;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.data-cell {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.data-cell-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    word-break: break-word;
}

.data-cell-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ── Time range selector ── */

.range-selector {
    display: flex;
    gap: 6px;
}

.range-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
}

.range-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ── Empty / Loading States ── */

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

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Timestamp ── */

.timestamp {
    font-size: 12px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ── Refresh indicator ── */

.refresh-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
    z-index: 200;
}

.refresh-bar.active {
    transform: scaleX(1);
    transition: transform 10s linear;
}

/* ── Toast ── */

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 300;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* ── Dashboard sections ── */

.dash-section {
    margin-bottom: 16px;
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 16px 4px 8px;
}

/* ── Machine cards (presse / rotor) ── */

.machines-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.machine-card,
.machine-card:link,
.machine-card:visited,
.machine-card:hover,
.machine-card:active {
    color: var(--text-primary);
    text-decoration: none;
}
.machine-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--cleared);
    border-radius: 12px;
    padding: 14px 16px;
    display: block;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}
.machine-card:hover { border-color: var(--accent); }
.machine-card:active { transform: scale(0.98); }

.machine-card[data-state="running"] { border-left-color: var(--success); }
.machine-card[data-state="faulted"] { border-left-color: var(--critical); }
.machine-card[data-state="stopped"] { border-left-color: var(--cleared); }

.machine-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.machine-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--cleared);
    flex-shrink: 0;
}
.machine-card[data-state="running"] .machine-dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}
.machine-card[data-state="faulted"] .machine-dot {
    background: var(--critical);
    box-shadow: 0 0 8px var(--critical);
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    50% { opacity: 0.4; }
}

.machine-label {
    font-size: 15px;
    font-weight: 600;
    flex: 1;
}

.machine-state {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--cleared);
}
.machine-card[data-state="running"] .machine-state { color: var(--success); }
.machine-card[data-state="faulted"] .machine-state { color: var(--critical); }

.machine-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    font-variant-numeric: tabular-nums;
}

.machine-metrics > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 4px;
    background: var(--bg-secondary);
    border-radius: 6px;
}

.m-v { font-size: 16px; font-weight: 700; }
.m-u { font-size: 10px; color: var(--text-muted); text-transform: uppercase; }

/* ── Temperature cards ── */

.temps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.temp-card,
.temp-card:link,
.temp-card:visited,
.temp-card:hover,
.temp-card:active {
    color: var(--text-primary);
    text-decoration: none;
}
.temp-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent-c, var(--accent));
    border-radius: 12px;
    padding: 12px 14px;
    text-align: left;
    position: relative;
    display: block;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
}
.temp-card:hover { border-color: var(--accent); }
.temp-card:active { transform: scale(0.98); }

.temp-card.ok   { box-shadow: inset 0 0 0 1px rgba(0,200,83,0.15); }
.temp-card.warn { box-shadow: inset 0 0 0 1px rgba(255,171,0,0.25); }
.temp-card.bad  { box-shadow: inset 0 0 0 1px rgba(255,23,68,0.35); }

.temp-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.temp-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    margin: 4px 0 6px;
}

.temp-unit {
    font-size: 14px;
    color: var(--text-secondary);
    margin-left: 2px;
}

.temp-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    min-height: 14px;
}

/* ── Temperature chart canvas ── */

.chart-canvas-wrap {
    position: relative;
    height: 220px;
}

/* ── Detail view (drill-down) ── */

.back-link {
    display: inline-block;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 22px;
    line-height: 1;
    margin-right: 8px;
    padding: 2px 6px;
    border-radius: 6px;
    vertical-align: -2px;
}
.back-link:hover { background: var(--bg-secondary); color: var(--text); }

.detail-values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.detail-val {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent-c, var(--accent));
    border-radius: 12px;
    padding: 10px 14px;
}

.dv-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dv-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    margin-top: 4px;
}

.dv-unit {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 3px;
}

.detail-canvas-wrap {
    height: 320px;
}

/* ── Details collapse ── */

.dash-details {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    margin-top: 16px;
}

.dash-details > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dash-details > summary::-webkit-details-marker { display: none; }

.dash-details > summary::after {
    content: "▸";
    color: var(--text-muted);
    transition: transform 0.2s;
}

.dash-details[open] > summary::after {
    transform: rotate(90deg);
}

.dash-details > .data-grid {
    padding: 0 16px 16px;
}

/* ── Machine View ── */

.machine-view-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    overflow: hidden;
}

.machine-view-wrap svg {
    width: 100%;
    height: auto;
    display: block;
}

/* SVG structural elements — cuiseur (bleu sombre) */
.sv-tank-body { stroke: #3a4a6a; stroke-width: 1; }
.sv-tank-edge-top    { stroke: rgba(120,140,180,0.28); stroke-width: 1; }
.sv-tank-edge-bottom { stroke: rgba(0,0,0,0.45); stroke-width: 1; }
.sv-flange    { fill: #2a3d5e; stroke: #4a5f80; stroke-width: 1; }
.sv-bin-rim   { fill: #3a4a6a; stroke: #5a6a85; stroke-width: 0.8; }
.sv-bin       { fill: #1a2540; stroke: #3a4a6a; stroke-width: 1.5; }
.sv-bin-neck  { fill: #1a2540; stroke: #3a4a6a; stroke-width: 1; }
.sv-port      { fill: #2a3d5e; stroke: #4a5f80; stroke-width: 1; }
.sv-port-pipe { stroke: #3a4a6a; stroke-width: 2; }
.sv-zone-lid  { fill: rgba(140,160,200,0.25); }

/* SVG structural elements — presse (vert sombre désaturé) */
.sv-press-body   { stroke: #2d5a40; stroke-width: 1; }
.sv-press-edge-top    { stroke: rgba(90,190,130,0.3); stroke-width: 1; }
.sv-press-edge-bottom { stroke: rgba(0,0,0,0.5); stroke-width: 1; }
.sv-press-flange { fill: #1a3a2a; stroke: #2d5a40; stroke-width: 1; }
.sv-press-motor  { fill: #1a3a2a; stroke: #2d5a40; stroke-width: 1.5; }
.sv-bolt         { fill: #5a6a78; stroke: #3a4a55; stroke-width: 0.3; }

/* Shared SVG elements */
.sv-plate     { fill: #4a5a78; stroke: none; }
.sv-hole      { fill: #0a1020; stroke: none; }
.sv-shaft     { stroke: #5a6a85; stroke-width: 3; }
.sv-shaft-center { stroke: #2a3a55; stroke-width: 1; stroke-dasharray: 4 3; }
.sv-feed-tube { fill: #1a2540; stroke: #3a4a6a; stroke-width: 1; }
.sv-drop-flow { stroke: #4a5a78; stroke-width: 2; stroke-dasharray: 5 3; opacity: 0.55; }
.sv-zone      { fill: rgba(85,94,112,0.25); stroke: #555e70; stroke-width: 1.5; transition: fill 0.8s, stroke 0.8s; }
.sv-chute     { stroke: #3a4a6a; stroke-width: 2; stroke-linecap: round; }
.sv-leg       { stroke: #3a4a6a; stroke-width: 3; }
.sv-foot      { fill: #3a4a6a; }
.sv-motor-body  { fill: #1a2540; stroke: #3a4a6a; stroke-width: 1.5; }
.sv-motor-shaft { fill: #0a1020; stroke: #3a4a6a; stroke-width: 1; }
.sv-motor-fan   { fill: none; stroke: #5a6a85; stroke-width: 1; stroke-dasharray: 2 2; }
.sv-room-box  { fill: #16213e; stroke: #2a2a4a; stroke-width: 1; }
.sv-fan-ring  { fill: none; stroke: #5a6a85; stroke-width: 1.5; }
.sv-fan-blade { stroke: #8892a4; stroke-width: 2; stroke-linecap: round; }
.sv-flow-line { stroke: #3a4a60; stroke-width: 1; stroke-dasharray: 8 4; opacity: 0.35; }

/* SVG state elements */
.sv-halo {
    fill: none;
    stroke: transparent;
    stroke-width: 3;
    transition: stroke 0.5s, opacity 0.5s;
}
.sv-dot  { transition: fill 0.3s; }
.sv-pulse { animation: pulse 1.2s ease-in-out infinite; }

/* SVG text styles */
.sv-label        { fill: #8892a4; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; }
.sv-label-sm     { fill: #6a7a94; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; }
.sv-label-xs     { fill: #5a6a84; font-size: 8px; font-weight: 600; text-transform: uppercase; }
.sv-zone-label   { fill: #8892a4; font-size: 9px; font-weight: 700; letter-spacing: 0.5px; }
.sv-motor-m      { fill: #8892a4; font-size: 16px; font-weight: 700; }
.sv-temp-val     { fill: #e8e8f0; font-size: 11px; font-weight: 700; font-family: system-ui, monospace; }
.sv-val          { fill: #b0b8c8; font-size: 10px; font-weight: 600; font-family: system-ui, monospace; }
.sv-val-sm       { fill: #8892a4; font-size: 9px; font-weight: 600; font-family: system-ui, monospace; }
.sv-state-text   { font-size: 11px; font-weight: 700; letter-spacing: 0.6px; }

/* Particles */
.sv-particle { fill: #e9a560; opacity: 0.15; transition: opacity 0.5s; }

/* Screw animations */
.screw-anim-left line,
.screw-anim-right line { stroke: #3a5070; stroke-width: 2; }

.screw-anim-left {
    animation: screw-left 1s linear infinite;
    animation-play-state: paused;
}

.screw-anim-right {
    animation: screw-right 1s linear infinite;
    animation-play-state: paused;
}

@keyframes screw-left {
    from { transform: translateX(0); }
    to   { transform: translateX(-30px); }
}

@keyframes screw-right {
    from { transform: translateX(0); }
    to   { transform: translateX(30px); }
}

/* Fan rotation */
.fan-spin {
    animation: fan-rotate 2s linear infinite;
    animation-play-state: paused;
    transform-origin: 0 0;
}

@keyframes fan-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Demo button active state */
.btn-demo-active {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: white !important;
}

/* Machine hint (portrait only) */
.machine-hint {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 12px 0 0;
    opacity: 0.7;
}

/* ── Machine view: landscape fullscreen mode ── */
@media (orientation: landscape) and (max-height: 600px) {
    body.view-machine { overflow: hidden; }

    body.view-machine main {
        padding: 0;
        max-width: none;
        height: 100vh;
        height: 100dvh;
    }

    body.view-machine .bottom-nav { display: none; }

    /* Compact floating header */
    body.view-machine .page-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10;
        margin: 0;
        padding: 6px 14px;
        background: rgba(15, 15, 26, 0.75);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--border);
    }
    body.view-machine .page-header h1 { font-size: 14px; }
    body.view-machine .page-header .btn-sm { padding: 4px 10px; font-size: 11px; }
    body.view-machine .page-header .timestamp { font-size: 10px; }

    /* SVG fills viewport */
    body.view-machine .machine-view-wrap {
        padding: 0;
        margin: 0;
        border: none;
        border-radius: 0;
        background: var(--bg-primary);
        height: 100vh;
        height: 100dvh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    body.view-machine .machine-view-wrap svg {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
    }

    /* Hide hint in landscape (user rotated = knows) */
    body.view-machine .machine-hint { display: none; }
}

/* ── Utility ── */

.hidden { display: none !important; }
.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* ── Multi-clients : header & sélecteur ── */

.client-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.client-header .client-name {
    color: var(--text-primary);
    font-weight: 600;
}

.client-selector-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.client-selector {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 13px;
    cursor: pointer;
}

.fleet-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.fleet-link:hover { color: var(--accent-hover); }

/* ── Vue flotte ── */

.fleet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.fleet-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fleet-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fleet-card-head h3 {
    font-size: 16px;
    margin: 0;
}

.fleet-status {
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.fleet-card-meta {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.fleet-alarm-badge {
    background: var(--critical);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.fleet-card-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 6px;
    background: var(--bg-input);
    border-radius: 6px;
    padding: 8px;
}

.fleet-card-kpis .kpi {
    display: flex;
    flex-direction: column;
}

.fleet-card-kpis .kpi-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.fleet-card-kpis .kpi-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.fleet-open-btn {
    align-self: stretch;
}

.empty {
    text-align: center;
    padding: 32px;
    color: var(--text-secondary);
}

/* --- Audit Trail ---
 * Created by: Opus 4.6 | 2026-04-10
 * Modified by: Opus 4.7 | 2026-04-29 — multi-clients : header + sélecteur de machine + vue flotte (cartes par machine)
 */
