
    :root {
      --cardboard: #D97706;
      --metal: #6366F1;
      --paper: #059669;
      --plastic: #DC2626;
      --cap: #f9c016;
      --bg-dark: #0A0E1A;
      --bg-card: #111827;
      --bg-card2: #1A2235;
      --border: rgba(255, 255, 255, 0.07);
      --text-muted: #6B7280;
    }

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

    html,
    body {
      height: 100%;
    }

    body {
      background-color: var(--bg-dark);
      color: #F9FAFB;
      font-family: 'Space Grotesk', sans-serif;
      min-height: 100vh;
      overflow-x: hidden;
      background-image:
        linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
      background-size: 32px 32px;
    }

    .mono {
      font-family: 'JetBrains Mono', monospace;
    }

    .scanline::after {
      content: '';
      position: absolute;
      inset: 0;
      background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 255, 150, 0.013) 2px, rgba(0, 255, 150, 0.013) 4px);
      pointer-events: none;
      z-index: 2;
    }

    .cam-frame {
      position: relative;
    }

    .cam-frame::before,
    .cam-frame::after,
    .corner-tr,
    .corner-bl {
      content: '';
      position: absolute;
      width: 24px;
      height: 24px;
      z-index: 10;
    }

    .cam-frame::before {
      top: 0;
      left: 0;
      border-top: 2px solid #10B981;
      border-left: 2px solid #10B981;
    }

    .cam-frame::after {
      bottom: 0;
      right: 0;
      border-bottom: 2px solid #10B981;
      border-right: 2px solid #10B981;
    }

    .corner-tr {
      top: 0;
      right: 0;
      border-top: 2px solid #10B981;
      border-right: 2px solid #10B981;
    }

    .corner-bl {
      bottom: 0;
      left: 0;
      border-bottom: 2px solid #10B981;
      border-left: 2px solid #10B981;
    }

    @keyframes scan {
      0% {
        top: 0%;
        opacity: 1;
      }

      90% {
        opacity: 0.5;
      }

      100% {
        top: 100%;
        opacity: 0;
      }
    }

    .scan-beam {
      position: absolute;
      left: 0;
      right: 0;
      height: 2px;
      background: linear-gradient(90deg, transparent 0%, #10B981 30%, #34D399 50%, #10B981 70%, transparent 100%);
      box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
      animation: scan 2.8s linear infinite;
      z-index: 5;
      pointer-events: none;
    }

    @keyframes boxpulse {

      0%,
      100% {
        opacity: 1
      }

      50% {
        opacity: 0.5
      }
    }

    .bbox {
      position: absolute;
      border: 2px solid;
      animation: boxpulse 1.5s ease-in-out infinite;
      z-index: 8;
    }

    .bbox-label {
      position: absolute;
      top: -22px;
      left: -1px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 10px;
      font-weight: 600;
      padding: 2px 7px;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    .card-glow {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 16px;
      transition: border-color 0.3s;
    }

    .card-glow:hover {
      border-color: rgba(16, 185, 129, 0.28);
    }

    .conf-fill {
      height: 100%;
      border-radius: 9999px;
      transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes blink {

      0%,
      100% {
        opacity: 1
      }

      50% {
        opacity: 0.15
      }
    }

    .status-dot {
      animation: blink 1.2s ease-in-out infinite;
    }

    @keyframes slideIn {
      from {
        transform: translateY(-8px);
        opacity: 0
      }

      to {
        transform: translateY(0);
        opacity: 1
      }
    }

    .log-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 11px;
      border-radius: 10px;
      background: var(--bg-card2);
      border: 1px solid var(--border);
      animation: slideIn 0.25s ease-out;
      flex-shrink: 0;
    }

    .waste-badge {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 10px;
      border-radius: 9999px;
      font-size: 11px;
      font-weight: 600;
      font-family: 'JetBrains Mono', monospace;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .ring-segment {
      transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    }

    ::-webkit-scrollbar {
      width: 3px;
      height: 3px;
    }

    ::-webkit-scrollbar-track {
      background: transparent;
    }

    ::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.12);
      border-radius: 9999px;
    }

    select,
    button {
      font-family: 'Space Grotesk', sans-serif;
    }

    /* ─── NAV ─── */
    #top-nav {
      position: sticky;
      top: 0;
      z-index: 50;
      background: rgba(10, 14, 26, 0.96);
      backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--border);
    }

    /* ─── TAB PANE (mobile) ─── */
    .tab-pane {
      display: block;
    }

    /* ─── BOTTOM TAB BAR ─── */
    .tab-bar {
      display: none;
    }

    /* ─── DESKTOP ≥1024px ─── */
    @media (min-width:1024px) {
      #page {
        display: flex;
        flex-direction: row;
        height: calc(100vh - 53px);
        overflow: hidden;
      }

      #main-col {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 16px;
        gap: 12px;
        overflow: hidden;
        min-width: 0;
      }

      #cam-wrap {
        flex: 1;
        min-height: 0;
      }

      #stats-row {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 10px;
        flex-shrink: 0;
      }

      #side-col {
        width: 320px;
        flex-shrink: 0;
        border-left: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 16px;
        overflow-y: auto;
      }

      #log-container {
        max-height: 220px;
        overflow-y: auto;
      }

      .tab-bar {
        display: none !important;
      }

      .tab-pane {
        display: block !important;
      }
    }

    /* ─── TABLET 768–1023px ─── */
    @media (min-width:768px) and (max-width:1023px) {
      #page {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
      }

      #main-col {
        padding: 14px;
        display: flex;
        flex-direction: column;
        gap: 12px;
      }

      #cam-wrap {
        height: 360px;
      }

      #stats-row {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 8px;
      }

      #side-col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        padding: 0 14px 14px;
      }

      #log-section {
        grid-column: 1/-1;
      }

      #log-container {
        max-height: 180px;
        overflow-y: auto;
      }

      .tab-bar {
        display: none !important;
      }

      .tab-pane {
        display: block !important;
      }
    }

    /* ─── MOBILE <768px ─── */
    @media (max-width:767px) {
      #page {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        padding-bottom: 72px;
      }

      #main-col {
        padding: 10px;
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      #cam-wrap {
        height: 230px;
      }

      #stats-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
      }

      #side-col {
        padding: 0 10px 10px;
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      /* tab switching */
      .tab-pane {
        display: none;
      }

      .tab-pane.active {
        display: block;
      }

      .tab-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 60;
        background: rgba(10, 14, 26, 0.97);
        border-top: 1px solid var(--border);
        backdrop-filter: blur(12px);
      }

      .tab-btn {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 8px 4px;
        cursor: pointer;
        font-size: 10px;
        color: var(--text-muted);
        border: none;
        background: transparent;
        transition: color 0.2s;
      }

      .tab-btn.active {
        color: #10B981;
      }

      .tab-btn svg {
        width: 20px;
        height: 20px;
      }

      #log-container {
        max-height: 360px;
        overflow-y: auto;
      }
    }

    .stream-video {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }


    .label {
      font-family: system-ui, sans-serif;
      font-size: 11px;
      color: var(--color-text-tertiary);
      margin-bottom: 6px;
      font-weight: 500;
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }

    .card {
      background: var(--color-background-primary);
      border: 0.5px solid var(--color-border-tertiary);
      border-radius: 12px;
      padding: 14px;
    }

    .muted {
      color: var(--color-text-secondary);
      font-size: 11px;
    }

    .badge {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      padding: 2px 9px;
      border-radius: 9999px;
      font-size: 11px;
      font-weight: 600;
    }

    .sep {
      height: 0.5px;
      background: var(--color-border-tertiary);
      margin: 10px 0;
    }

    .grid2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
    }

    .cell {
      background: var(--color-background-secondary);
      border-radius: 8px;
      padding: 10px 12px;
    }

    .cell .val {
      font-size: 15px;
      font-weight: 600;
      margin-top: 2px;
    }

    .highlight {
      outline: 2px dashed #10B981;
      outline-offset: 3px;
      border-radius: 12px;
    }

    .highlight2 {
      outline: 2px dashed #10B981;
      outline-offset: 2px;
      border-radius: 8px;
    }

    .tag {
      font-size: 9px;
      background: rgba(16, 185, 129, 0.15);
      color: #10B981;
      padding: 1px 5px;
      border-radius: 4px;
      vertical-align: middle;
      margin-left: 4px;
      font-family: system-ui;
      font-weight: 700;
      letter-spacing: 0.05em;
    }