    /* ============================================================
       RESET & BASE
    ============================================================ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg-primary:    #0f172a;
      --bg-card:       #1e293b;
      --bg-card-hover: #263548;
      --border:        #334155;
      --green:         #22c55e;
      --green-dim:     #15803d;
      --red:           #ef4444;
      --red-dim:       #991b1b;
      --yellow:        #f59e0b;
      --yellow-dim:    #92400e;
      --blue:          #3b82f6;
      --purple:        #a855f7;
      --purple-dim:    #6b21a8;
      --cyan:          #06b6d4;
      --text-primary:  #f1f5f9;
      --text-secondary:#94a3b8;
      --text-muted:    #64748b;
      --radius:        12px;
      --radius-sm:     8px;
      --shadow:        0 4px 24px rgba(0,0,0,0.4);
      --transition:    0.25s ease;
    }

    html { font-size: 16px; }

    body {
      font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
      background: var(--bg-primary);
      color: var(--text-primary);
      min-height: 100vh;
      line-height: 1.5;
    }

    /* ============================================================
       SCROLLBAR
    ============================================================ */
    ::-webkit-scrollbar { width: 6px; }
    ::-webkit-scrollbar-track { background: var(--bg-primary); }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

    /* ============================================================
       LAYOUT WRAPPER
    ============================================================ */
    .page-wrapper {
      max-width: 1400px;
      margin: 0 auto;
      padding: 24px 20px;
    }

    /* ============================================================
       BACK BUTTON
    ============================================================ */
    .back-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      background: var(--bg-card);
      border: 1px solid var(--border);
      color: var(--text-secondary);
      padding: 8px 16px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      font-size: 0.875rem;
      font-weight: 500;
      text-decoration: none;
      transition: all var(--transition);
      margin-bottom: 24px;
    }
    .back-btn:hover {
      background: var(--bg-card-hover);
      color: var(--text-primary);
      border-color: var(--blue);
      transform: translateX(-3px);
    }
    .back-btn svg { width: 16px; height: 16px; }

    /* ============================================================
       CORPORATE BRAND HEADER
    ============================================================ */
    .brand-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 24px;
      padding: 15px 28px;
      background: linear-gradient(180deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0) 100%);
      border-bottom: 1px solid var(--border);
      border-radius: var(--radius) var(--radius) 0 0;
    }
    .brand-left {
      display: flex;
      align-items: center;
      gap: 15px;
    }
    .company-logo {
      height: 50px;
      width: auto;
      filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.3));
    }
    .company-name {
      font-size: 2.2rem;
      font-weight: 800;
      color: var(--text-primary);
      margin: 0;
      letter-spacing: -1px;
    }
    .app-subtitle {
      font-size: 0.85rem;
      color: var(--blue);
      margin: 0;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 1px;
    }
    .brand-right {
      display: flex;
      align-items: center;
    }
    .system-status {
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 8px;
      background: rgba(15, 23, 42, 0.5);
      padding: 6px 12px;
      border-radius: 20px;
      border: 1px solid var(--border);
    }
    .status-dot.online {
      width: 8px;
      height: 8px;
      background: var(--green);
      border-radius: 50%;
      box-shadow: 0 0 8px var(--green);
    }

    /* ============================================================
       HEADER
    ============================================================ */
    .header {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 24px 28px;
      margin-bottom: 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 16px;
      box-shadow: var(--shadow);
      position: relative;
      overflow: hidden;
    }
    .header::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 3px;
      background: linear-gradient(90deg, var(--blue), var(--cyan), var(--purple));
    }

    .header-left { display: flex; align-items: center; gap: 16px; }

    .machine-icon-wrapper {
      width: 52px; height: 52px;
      background: linear-gradient(135deg, var(--blue), var(--cyan));
      border-radius: var(--radius-sm);
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
      transition: all 0.5s ease;
    }

    .machine-icon {
      font-size: 1.5rem;
      display: block;
    }

    /* Rotation Animation */
    .machine-icon-wrapper.is-running .machine-icon {
      animation: rotate-gear 3s linear infinite;
    }

    @keyframes rotate-gear {
      from { transform: rotate(0deg); }
      to   { transform: rotate(360deg); }
    }

    .machine-name {
      font-size: 1.6rem;
      font-weight: 700;
      color: var(--text-primary);
      letter-spacing: -0.5px;
    }
    .machine-subtitle {
      font-size: 0.8rem;
      color: var(--text-muted);
      margin-top: 2px;
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    .header-right {
      display: flex;
      align-items: center;
      gap: 20px;
      flex-wrap: wrap;
    }

    /* Status Badge */
    .status-badge {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      border-radius: 999px;
      font-size: 0.875rem;
      font-weight: 600;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }
    .status-badge.running {
      background: rgba(34,197,94,0.15);
      color: var(--green);
      border: 1px solid rgba(34,197,94,0.4);
    }
    .status-badge.stopped {
      background: rgba(239,68,68,0.15);
      color: var(--red);
      border: 1px solid rgba(239,68,68,0.4);
    }
    .status-badge.offline {
      background: rgba(100,116,139,0.15);
      color: var(--text-muted);
      border: 1px solid rgba(100,116,139,0.4);
    }
    .status-badge.idle {
      background: rgba(245,158,11,0.15);
      color: var(--yellow);
      border: 1px solid rgba(245,158,11,0.4);
    }
    .status-badge.fault {
      background: rgba(168,85,247,0.15);
      color: var(--purple);
      border: 1px solid rgba(168,85,247,0.4);
    }

    /* Blinking live dot */
    .live-dot {
      width: 10px; height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .running .live-dot {
      background: var(--green);
      box-shadow: 0 0 0 0 rgba(34,197,94,0.7);
      animation: pulse-green 1.5s infinite;
    }
    .stopped .live-dot {
      background: var(--red);
      animation: none;
    }
    .offline .live-dot {
      background: var(--text-muted);
      animation: none;
    }
    .idle .live-dot {
      background: var(--yellow);
      animation: none;
    }
    .fault .live-dot {
      background: var(--purple);
      animation: pulse-purple 1.5s infinite;
    }

    @keyframes pulse-green {
      0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.7); }
      70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
      100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
    }
    
    @keyframes pulse-purple {
      0%   { box-shadow: 0 0 0 0 rgba(168,85,247,0.7); }
      70%  { box-shadow: 0 0 0 8px rgba(168,85,247,0); }
      100% { box-shadow: 0 0 0 0 rgba(168,85,247,0); }
    }

    .last-update {
      font-size: 0.8rem;
      color: var(--text-muted);
      text-align: right;
    }
    .last-update span {
      display: block;
      color: var(--text-secondary);
      font-size: 0.875rem;
      font-weight: 500;
      margin-top: 2px;
    }

    /* ============================================================
       KPI CARDS GRID
    ============================================================ */
    .kpi-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }

    .kpi-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 20px;
      cursor: default;
      transition: all var(--transition);
      position: relative;
      overflow: hidden;
      box-shadow: var(--shadow);
    }
    .kpi-card::after {
      content: '';
      position: absolute;
      bottom: 0; left: 0; right: 0;
      height: 3px;
      border-radius: 0 0 var(--radius) var(--radius);
      opacity: 0;
      transition: opacity var(--transition);
    }
    .kpi-card:hover { background: var(--bg-card-hover); transform: translateY(-3px); }
    .kpi-card:hover::after { opacity: 1; }

    .kpi-card.accent-blue::after   { background: var(--blue); }
    .kpi-card.accent-green::after  { background: var(--green); }
    .kpi-card.accent-yellow::after { background: var(--yellow); }
    .kpi-card.accent-red::after    { background: var(--red); }
    .kpi-card.accent-cyan::after   { background: var(--cyan); }
    .kpi-card.accent-purple::after { background: var(--purple); }

    .kpi-label {
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
      font-weight: 600;
      margin-bottom: 10px;
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .kpi-label .icon { font-size: 1rem; }
    .info-icon {
      font-size: 0.8rem;
      color: var(--text-muted);
      cursor: help;
      margin-left: 4px;
      opacity: 0.6;
    }
    .info-icon:hover { opacity: 1; color: var(--blue); }

    .kpi-value {
      font-size: 2rem;
      font-weight: 800;
      line-height: 1;
      margin-bottom: 4px;
      font-variant-numeric: tabular-nums;
    }
    .kpi-unit {
      font-size: 0.8rem;
      color: var(--text-muted);
      font-weight: 400;
    }
    .kpi-sub {
      font-size: 0.78rem;
      color: var(--text-secondary);
      margin-top: 6px;
    }

    .accent-blue   .kpi-value { color: var(--blue); }
    .accent-green  .kpi-value { color: var(--green); }
    .accent-yellow .kpi-value { color: var(--yellow); }
    .accent-red    .kpi-value { color: var(--red); }
    .accent-cyan   .kpi-value { color: var(--cyan); }
    .accent-purple .kpi-value { color: var(--purple); }

    /* Health bar inside KPI */
    .health-bar-wrap {
      margin-top: 10px;
      height: 4px;
      background: var(--border);
      border-radius: 2px;
      overflow: hidden;
    }
    .health-bar-fill {
      height: 100%;
      border-radius: 2px;
      transition: width 1s ease;
    }

    /* ============================================================
       CHARTS SECTION
    ============================================================ */
    .charts-grid {
      display: grid;
      grid-template-columns: 1fr 2fr;
      gap: 16px;
      margin-bottom: 24px;
    }

    @media (max-width: 900px) {
      .charts-grid { grid-template-columns: 1fr; }
    }

    .chart-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 24px;
      box-shadow: var(--shadow);
      transition: all var(--transition);
    }
    .chart-card:hover { border-color: #475569; }

    .chart-title {
      font-size: 0.85rem;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
      font-weight: 600;
      margin-bottom: 20px;
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .chart-title .dot {
      width: 8px; height: 8px;
      border-radius: 50%;
    }

    .doughnut-wrap {
      position: relative;
      max-width: 240px;
      margin: 0 auto;
    }
    .doughnut-center {
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -50%);
      text-align: center;
      pointer-events: none;
    }
    .doughnut-center .big { font-size: 1.8rem; font-weight: 800; color: var(--green); }
    .doughnut-center .small { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

    .chart-legend {
      display: flex;
      justify-content: center;
      gap: 24px;
      margin-top: 18px;
    }
    .legend-item {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 0.8rem;
      color: var(--text-secondary);
    }
    .legend-dot {
      width: 10px; height: 10px;
      border-radius: 2px;
      flex-shrink: 0;
    }

    .line-chart-wrap { height: 240px; }

    /* ============================================================
       PERFORMANCE ANALYTICS
    ============================================================ */
    .analytics-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-bottom: 24px;
    }
    @media (max-width: 700px) {
      .analytics-grid { grid-template-columns: 1fr; }
    }

    .analytics-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 24px;
      box-shadow: var(--shadow);
    }
    .analytics-title {
      font-size: 0.85rem;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-muted);
      font-weight: 600;
      margin-bottom: 20px;
    }

    /* Efficiency progress bar */
    .progress-row {
      margin-bottom: 18px;
    }
    .progress-label {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }
    .progress-label .name { font-size: 0.875rem; color: var(--text-secondary); }
    .progress-label .val  { font-size: 0.875rem; font-weight: 700; }

    .progress-track {
      height: 10px;
      background: var(--border);
      border-radius: 5px;
      overflow: hidden;
    }
    .progress-fill {
      height: 100%;
      border-radius: 5px;
      transition: width 1.2s cubic-bezier(0.4,0,0.2,1);
      position: relative;
    }
    .progress-fill::after {
      content: '';
      position: absolute;
      top: 0; right: 0;
      width: 6px; height: 100%;
      background: rgba(255,255,255,0.4);
      border-radius: 3px;
    }

    /* Ratio bar */
    .ratio-bar-wrap {
      margin: 16px 0;
    }
    .ratio-bar {
      display: flex;
      height: 24px;
      border-radius: var(--radius-sm);
      overflow: hidden;
      gap: 2px;
    }
    .ratio-run, .ratio-stop {
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.7rem;
      font-weight: 700;
      transition: width 1.2s cubic-bezier(0.4,0,0.2,1);
      color: #fff;
      min-width: 30px;
    }
    .ratio-run  { background: var(--green); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
    .ratio-stop { background: var(--red);   border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

    .ratio-labels {
      display: flex;
      justify-content: space-between;
      margin-top: 8px;
      font-size: 0.78rem;
      color: var(--text-secondary);
    }
    .ratio-labels .run-lbl { color: var(--green); }
    .ratio-labels .stp-lbl { color: var(--red); }

    /* Insight box */
    .insight-box {
      margin-top: 18px;
      padding: 14px 16px;
      border-radius: var(--radius-sm);
      font-size: 0.875rem;
      font-weight: 500;
      display: flex;
      align-items: flex-start;
      gap: 10px;
      line-height: 1.5;
    }
    .insight-box.good {
      background: rgba(34,197,94,0.1);
      border: 1px solid rgba(34,197,94,0.3);
      color: var(--green);
    }
    .insight-box.warn {
      background: rgba(245,158,11,0.1);
      border: 1px solid rgba(245,158,11,0.3);
      color: var(--yellow);
    }
    .insight-box.bad {
      background: rgba(239,68,68,0.1);
      border: 1px solid rgba(239,68,68,0.3);
      color: var(--red);
    }
    .insight-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

    /* Stats list */
    .stats-list { list-style: none; }
    .stats-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 12px 0;
      border-bottom: 1px solid var(--border);
      font-size: 0.875rem;
    }
    .stats-item:last-child { border-bottom: none; }
    .stats-item .s-key { color: var(--text-secondary); }
    .stats-item .s-val { font-weight: 600; color: var(--text-primary); }
    .stats-item .s-val.running { color: var(--green); }
    .stats-item .s-val.stopped { color: var(--red); }
    .stats-item .s-val.idle    { color: var(--yellow); }
    .stats-item .s-val.fault   { color: var(--purple); }

    /* ============================================================
       FOOTER TIMESTAMP
    ============================================================ */
    .footer-bar {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 14px 24px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 10px;
      font-size: 0.8rem;
      color: var(--text-muted);
    }
    .footer-bar .brand { color: var(--text-secondary); font-weight: 500; }
    .footer-date { color: var(--text-secondary); }

    /* ============================================================
       RESPONSIVE
    ============================================================ */
    @media (max-width: 600px) {
      .machine-name { font-size: 1.2rem; }
      .kpi-value    { font-size: 1.5rem; }
      .header       { padding: 16px; }
      .page-wrapper { padding: 16px 12px; }
      .kpi-grid     { grid-template-columns: repeat(2, 1fr); }
    }
  
