
        :root {
            --ink: #0f172a;
            --ink-soft: #475569;
            --line: #e2e8f0;
            --paper: #f6f7fb;
            --card: #ffffff;
            --signal: #4338ca;
            --signal-soft: #eef0fd;
            --signal-hover: #362e9e;
            --amber: #b45309;
            --amber-bg: #fef3e2;
            --ok: #15803d;
            --ok-bg: #ecfdf3;
            --radius: 14px;
            --mono: 'JetBrains Mono', monospace;
        }



        @font-face {
            font-family: 'Material Icons';
            font-style: normal;
            font-weight: 400;
            src: url(https://example.com/MaterialIcons-Regular.eot);
            src: local('Material Icons'),
                local('MaterialIcons-Regular'),
                url(https://example.com/MaterialIcons-Regular.woff2) format('woff2'),
                url(https://example.com/MaterialIcons-Regular.woff) format('woff'),
                url(https://example.com/MaterialIcons-Regular.ttf) format('truetype');
        }

        .material-icons {
            font-family: 'Material Icons';
            font-weight: normal;
            font-style: normal;
            font-size: 24px;
            /* Preferred icon size */
            display: inline-block;
            line-height: 1;
            text-transform: none;
            letter-spacing: normal;
            word-wrap: normal;
            white-space: nowrap;
            direction: ltr;

            /* Support for all WebKit browsers. */
            -webkit-font-smoothing: antialiased;
            /* Support for Safari and Chrome. */
            text-rendering: optimizeLegibility;

            /* Support for Firefox. */
            -moz-osx-font-smoothing: grayscale;

            /* Support for IE. */
            font-feature-settings: 'liga';
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: 'Inter', sans-serif;
            background:
                radial-gradient(circle at 8% 8%, rgba(67, 56, 202, 0.06), transparent 45%),
                var(--paper);
            color: var(--ink);
            min-height: 100vh;
            padding: 40px 20px;
        }

        .shell {
            max-width: 760px;
            margin: 0 auto;
        }

        /* ---- Top identity bar ---- */
        .brandbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 28px;
        }

        .brandmark {
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 800;
            letter-spacing: -0.02em;
            font-size: 1.05rem;
        }

        .brandmark .dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: var(--signal);
            box-shadow: 0 0 0 4px var(--signal-soft);
        }

        .brandmark .sub {
            color: var(--ink-soft);
            font-weight: 500;
            font-size: 0.8rem;
        }

        nav.tabs {
            display: inline-flex;
            background: var(--card);
            border: 1px solid var(--line);
            border-radius: 999px;
            padding: 4px;
            gap: 2px;
        }

        nav.tabs button {
            border: none;
            background: transparent;
            padding: 8px 16px;
            border-radius: 999px;
            font-family: inherit;
            font-size: 0.82rem;
            font-weight: 600;
            color: var(--ink-soft);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.15s ease;
            width: auto;
            box-shadow: none;
        }

        nav.tabs button.active {
            background: var(--ink);
            color: #fff;
        }

        nav.tabs button:hover:not(.active) {
            color: var(--ink);
            background: var(--paper);
        }

        nav.tabs .material-symbols-outlined {
            font-size: 18px;
        }

        /* ---- Cards ---- */
        .card {
            background: var(--card);
            border: 1px solid var(--line);
            border-radius: var(--radius);
            padding: 2rem;
        }

        .page {
            display: none;
        }

        .page.active {
            display: block;
        }

        h1 {
            font-size: 1.35rem;
            font-weight: 800;
            letter-spacing: -0.01em;
            margin-bottom: 0.35rem;
        }

        .lede {
            font-size: 0.875rem;
            color: var(--ink-soft);
            margin-bottom: 1.75rem;
            line-height: 1.5;
        }

        label {
            display: block;
            font-size: 0.78rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--ink-soft);
            margin-bottom: 0.5rem;
        }

        input[type="text"] {
            width: 100%;
            padding: 0.8rem 1rem;
            font-size: 0.98rem;
            font-family: var(--mono);
            border: 1.5px solid var(--line);
            border-radius: 10px;
            outline: none;
            transition: all 0.15s ease;
            background: var(--paper);
        }

        input[type="text"]:focus {
            border-color: var(--signal);
            background: #fff;
            box-shadow: 0 0 0 4px var(--signal-soft);
        }

        .input-group {
            margin-bottom: 1.25rem;
        }

        button.primary,
        button.ghost {
            padding: 0.75rem 1.1rem;
            font-size: 0.9rem;
            font-weight: 700;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            transition: all 0.15s ease;
            font-family: inherit;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        button.primary {
            width: 100%;
            color: #fff;
            background: var(--ink);
        }

        button.primary:hover {
            background: #000;
        }

        button.primary:active {
            transform: scale(0.98);
        }

        button.primary:disabled {
            background: #cbd5e1;
            cursor: not-allowed;
        }

        button.ghost {
            background: var(--signal-soft);
            color: var(--signal);
        }

        button.ghost:hover {
            background: #e0e2fb;
        }

        .row {
            display: flex;
            gap: 10px;
        }

        .row>* {
            flex: 1;
        }

        /* ---- QR result zone ---- */
        .qr-container {
            margin-top: 1.75rem;
            padding-top: 1.75rem;
            border-top: 1px dashed var(--line);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1.1rem;
        }

        .qr-placeholder {
            color: #94a3b8;
            font-size: 0.85rem;
            border: 2px dashed var(--line);
            border-radius: 12px;
            width: 200px;
            height: 200px;
            display: flex;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 1rem;
            background: var(--paper);
        }

        #qrcode {
            display: flex;
            justify-content: center;
        }

        #qrcode img,
        #qrcode canvas {
            border-radius: 10px;
            border: 1px solid var(--line);
            box-shadow: 0 8px 20px -8px rgba(15, 23, 42, 0.15);
        }

        .qr-id-chip {
            font-family: var(--mono);
            font-size: 0.85rem;
            font-weight: 600;
            background: var(--signal-soft);
            color: var(--signal);
            padding: 5px 12px;
            border-radius: 999px;
        }

        .action-row {
            width: 100%;
            display: flex;
            gap: 10px;
        }

        /* ---- Storage choice ---- */
        .storage-choice {
            margin-top: 1.25rem;
            width: 100%;
            background: var(--paper);
            border: 1px solid var(--line);
            border-radius: 12px;
            padding: 1rem;
        }

        .storage-choice legend {
            font-size: 0.78rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--ink-soft);
            margin-bottom: 0.6rem;
        }

        .storage-opt {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 8px 6px;
            border-radius: 8px;
            cursor: pointer;
        }

        .storage-opt:hover {
            background: rgba(15, 23, 42, 0.03);
        }

        .storage-opt input {
            margin-top: 3px;
            accent-color: var(--signal);
        }

        .storage-opt .lbl {
            font-size: 0.86rem;
            font-weight: 600;
        }

        .storage-opt .desc {
            font-size: 0.76rem;
            color: var(--ink-soft);
            margin-top: 1px;
        }

        #saveStatus {
            font-size: 0.8rem;
            font-weight: 600;
            margin-top: 0.85rem;
            padding: 8px 12px;
            border-radius: 8px;
            display: none;
        }

        #saveStatus.ok {
            display: block;
            color: var(--ok);
            background: var(--ok-bg);
        }

        #saveStatus.err {
            display: block;
            color: var(--amber);
            background: var(--amber-bg);
        }

        /* ---- Saved page ---- */
        .saved-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.25rem;
            gap: 10px;
            flex-wrap: wrap;
        }

        .count-pill {
            font-family: var(--mono);
            font-size: 0.78rem;
            background: var(--paper);
            border: 1px solid var(--line);
            padding: 4px 10px;
            border-radius: 999px;
            color: var(--ink-soft);
        }

        .print-menu-wrap {
            position: relative;
        }

        .print-menu {
            position: absolute;
            top: calc(100% + 6px);
            right: 0;
            background: #fff;
            border: 1px solid var(--line);
            border-radius: 10px;
            box-shadow: 0 12px 28px -10px rgba(15, 23, 42, 0.25);
            width: 220px;
            padding: 6px;
            display: none;
            z-index: 20;
        }

        .print-menu.open {
            display: block;
        }

        .print-menu button {
            width: 100%;
            text-align: left;
            background: none;
            border: none;
            padding: 10px 10px;
            border-radius: 7px;
            font-family: inherit;
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--ink);
            cursor: pointer;
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .print-menu button:hover {
            background: var(--paper);
        }

        .print-menu button small {
            font-weight: 500;
            color: var(--ink-soft);
            font-size: 0.72rem;
        }

        .empty-state {
            text-align: center;
            padding: 3rem 1rem;
            color: var(--ink-soft);
        }

        .empty-state .material-symbols-outlined {
            font-size: 40px;
            opacity: 0.35;
            margin-bottom: 8px;
        }

        .empty-state p {
            font-size: 0.85rem;
        }

        .qr-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
            gap: 14px;
        }

        .qr-tile {
            border: 1.5px solid var(--line);
            border-radius: 12px;
            padding: 12px;
            text-align: center;
            position: relative;
            background: var(--paper);
            transition: border-color 0.15s ease;
        }

        .qr-tile.selected {
            border-color: var(--signal);
            background: var(--signal-soft);
        }

        .qr-tile img {
            width: 100%;
            border-radius: 8px;
            border: 1px solid var(--line);
            background: #fff;
        }

        .qr-tile .tile-id {
            font-family: var(--mono);
            font-size: 0.75rem;
            font-weight: 700;
            margin-top: 8px;
            word-break: break-all;
        }

        .qr-tile .tile-meta {
            font-size: 0.65rem;
            color: var(--ink-soft);
            margin-top: 2px;
        }

        .qr-tile .tile-check {
            position: absolute;
            top: 8px;
            left: 8px;
            width: 18px;
            height: 18px;
            accent-color: var(--signal);
        }

        .qr-tile .tile-del {
            position: absolute;
            top: 6px;
            right: 6px;
            font-size: 16px;
            color: #94a3b8;
            cursor: pointer;
            background: #fff;
            border-radius: 50%;
            padding: 2px;
        }

        .qr-tile .tile-del:hover {
            color: #dc2626;
        }

        .tile-source {
            display: inline-block;
            font-size: 0.6rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.03em;
            padding: 2px 6px;
            border-radius: 5px;
            margin-top: 6px;
        }

        .tile-source.local {
            background: #e0f2fe;
            color: #0369a1;
        }

        .tile-source.session {
            background: #fef9c3;
            color: #854d0e;
        }

        .tile-source.backend {
            background: #ecfdf3;
            color: #15803d;
        }


.ports-section {
  margin-top: 32px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 16px;
}

.ports-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.port-item {
  background: #14161f;
  border: 1px solid #23262f;
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.port-item:hover {
  border-color: #3a3f4d;
}

.port-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.port-number {
  font-weight: 600;
  color: #fff;
  font-size: 15px;
}

.port-status {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 12px;
}

.port-status.used {
  background: rgba(255, 99, 99, 0.15);
  color: #ff6363;
}

.port-status.free {
  background: rgba(46, 213, 115, 0.15);
  color: #2ed573;
}

.port-customers {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #23262f;
}

.port-customers.expanded {
  display: block;
}

.customer-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 13px;
  color: #b0b3bc;
}

.customer-row + .customer-row {
  border-top: 1px solid #1c1e27;
}

.no-customer {
  font-size: 13px;
  color: #6b6f7b;
  font-style: italic;
}

.port-loading {
  font-size: 13px;
  color: #6b6f7b;
  padding: 8px 0;
}
        

  .boxes-section { padding: 24px 0; color: #e5e7eb; font-family: system-ui, sans-serif; }
  .boxes-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
  .boxes-header h2 { margin: 0; font-size: 20px; font-weight: 600; color: #f9fafb; }
  .boxes-count { font-size: 13px; color: #6b7280; }
 
  .boxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
  }
 
  .box-card {
    background: #13131a;
    border: 1px solid #23232e;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s ease;
  }
  .box-card:hover { border-color: #10b981; }
  .box-card.open { border-color: #10b981; }
 
  .box-card-top { display: flex; justify-content: space-between; align-items: flex-start; }
  .box-name { font-size: 15px; font-weight: 600; color: #f9fafb; margin: 0 0 2px; }
  .box-code { font-size: 12px; color: #6b7280; font-family: monospace; }
  .box-chevron { color: #6b7280; transition: transform 0.15s ease; font-size: 13px; }
  .box-card.open .box-chevron { transform: rotate(90deg); color: #10b981; }
 
  .box-ports-list { margin-top: 12px; display: none; flex-direction: column; gap: 6px; }
  .box-card.open .box-ports-list { display: flex; }
 
  .port-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0d0d12;
    border: 1px solid #1f1f29;
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.12s ease;
  }
  .port-row:hover { background: #16161f; }
  .port-label { color: #d1d5db; }
  .port-status { font-size: 11px; padding: 2px 7px; border-radius: 5px; }
  .port-status.used { background: rgba(16,185,129,0.15); color: #10b981; }
  .port-status.free { background: rgba(107,114,128,0.15); color: #9ca3af; }
 
  .box-ports-loading, .box-ports-empty { font-size: 12px; color: #6b7280; padding: 6px 2px; }
 
  .boxes-empty { color: #6b7280; font-size: 13px; }
 
  /* Modal */
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
  }
  .modal {
    background: #13131a; border: 1px solid #23232e; border-radius: 10px;
    width: 380px; max-width: 90vw; max-height: 80vh; overflow: hidden;
    display: flex; flex-direction: column;
  }
  .modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid #1f1f29;
  }
  .modal-header h3 { margin: 0; font-size: 14px; color: #f9fafb; }
  .modal-close { background: none; border: none; color: #9ca3af; font-size: 20px; cursor: pointer; line-height: 1; }
  .modal-close:hover { color: #f9fafb; }
  .modal-body { padding: 14px 16px; overflow-y: auto; font-size: 13px; }
 
  .customer-row { padding: 8px 0; border-bottom: 1px solid #1f1f29; }
  .customer-row:last-child { border-bottom: none; }
  .customer-name { color: #f9fafb; font-weight: 500; }
  .customer-email { color: #6b7280; font-size: 12px; }


        /* ---- Print styling ---- */
        @media print {
            body {
                padding: 0;
                background: #fff;
            }

            .brandbar,
            nav.tabs,
            .saved-toolbar,
            .tile-check,
            .tile-del,
            .page:not(.print-target),
            .no-print {
                display: none !important;
            }

            .card {
                border: none;
                padding: 0;
            }

            .qr-tile {
                break-inside: avoid;
                border-color: #ccc;
            }

            .qr-tile.print-hide {
                display: none !important;
            }
        }

        @media (max-width: 480px) {
            .card {
                padding: 1.4rem;
            }
            .brandbar {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
            }

        }
    