
        /* -------------- COLOR TOKENS -------------- */
        :root {
            --bg: #0e0f12;
            --bg-elev: #15171c;
            --text: #e9eaee;
            --muted: #b3b7c0;
            --border: #2a2d34;
            --accent: #10b981;
            --accent-hover: #0ea372;
            --danger: #ef4444;
            --warn: #f59e0b;
            --ok: #22c55e;
            --focus: #60a5fa;
            --hover-bg: rgba(255,255,255,0.08);
            --icon-filter: brightness(0) invert(1);
        }

            :root[data-theme="light"] {
                --bg: #f7f8fa;
                --bg-elev: #ffffff;
                --text: #0f1115;
                --muted: #585f6b;
                --border: #e5e7eb;
                --accent: #0ea372;
                --accent-hover: #0a8b61;
                --hover-bg: rgba(0,0,0,0.05);
                --icon-filter: none;
            }

        /* -------------- ICONS -------------- */
        .themed-icon {
            filter: var(--icon-filter);
        }

        /* -------------- BASE & TYPOGRAPHY -------------- */
        html, body {
            height: 100%;
        }

        html {
            color-scheme: light dark;
        }

        body {
            margin: 0;
            background: var(--bg);
            color: var(--text);
            font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, Helvetica, Arial, sans-serif;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        h1 {
            font-size: 30px;
            line-height: 38px;
            font-weight: 600;
            margin: 0 0 12px;
        }

        h2 {
            font-size: 24px;
            line-height: 32px;
            font-weight: 600;
            margin: 24px 0 12px;
        }

        h3 {
            font-size: 20px;
            line-height: 28px;
            font-weight: 600;
            margin: 16px 0 8px;
        }

        p, ul, ol {
            margin: 8px 0 12px;
        }

        small {
            font-size: 14px;
            line-height: 20px;
            color: var(--muted);
        }

        /* -------------- LAYOUT PRIMITIVES -------------- */
        /* -------------- LAYOUT PRIMITIVES -------------- */
        .container {
            display: grid;
            grid-template-columns: 280px 350px 1fr;
            grid-template-rows: 1fr;
            grid-template-areas: "sidebar operations documents";
            height: 100dvh;
            transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

            .container.sidebar-minimized {
                grid-template-columns: 60px 350px 1fr;
            }

            .container.operations-hidden {
                grid-template-columns: 280px 0px 1fr;
            }

            .container.sidebar-minimized.operations-hidden {
                grid-template-columns: 60px 0px 1fr;
            }

        .sidebar {
            grid-area: sidebar;
            background: var(--bg-elev);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            gap: 0;
            padding: 16px;
            overflow-y: auto;
            overflow-x: hidden;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .container.sidebar-minimized .sidebar {
            padding: 16px 8px;
            align-items: center;
        }

        /* Hide text content when sidebar is minimized */
        .container.sidebar-minimized .sidebar-title,
        .container.sidebar-minimized .list-item-name,
        .container.sidebar-minimized .list-item-new span,
        .container.sidebar-minimized #pinnedList,
        .container.sidebar-minimized #otherList {
            display: none;
        }

        /* Adjust elements for minimized state */
        .container.sidebar-minimized .sidebar-header {
            justify-content: center;
        }

        .container.sidebar-minimized .list-item {
            padding: 12px 12px;
            justify-content: center;
            min-height: 44px;
        }

        .container.sidebar-minimized .list-item-new {
            padding: 6px 12px;
        }

        .operations-panel {
            grid-area: operations;
            background: var(--bg-elev);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            gap: 0;
            padding: 16px;
            overflow-y: auto;
            overflow-x: hidden;
            transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }

        .container.operations-hidden .operations-panel {
            opacity: 0;
            pointer-events: none;
            padding: 16px 0;
        }

        .documents-panel {
            grid-area: documents;
            padding: 24px;
            overflow-y: auto;
            position: relative;
        }

        .theme-toggle-btn {
            position: absolute;
            top: 24px;
            right: 24px;
            z-index: 100;
        }

        #documentsPanel {
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .main {
            grid-area: main;
            padding: 24px;
            overflow-y: auto;
            position: relative;
        }

        .main-inner {
            max-width: 1200px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        /* Floating toggle button - shown when sidebar is hidden */
        .container.sidebar-minimized .main-inner {
            padding-top: 48px;
        }

        .floating-sidebar-toggle {
            position: absolute;
            top: 24px;
            left: 24px;
            width: 32px;
            height: 32px;
            padding: 0;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            color: var(--text);
            cursor: pointer;
            border-radius: 6px;
            z-index: 10;
            transition: all 0.2s ease;
        }

            .floating-sidebar-toggle:hover {
                background: rgba(255,255,255,0.08);
                color: var(--accent);
            }

        /* Show toggle when sidebar is hidden */
        .container.sidebar-minimized .floating-sidebar-toggle {
            display: flex !important;
        }

        /* Hide toggle when sidebar is visible */
        .container:not(.sidebar-minimized) .floating-sidebar-toggle {
            display: none !important;
        }

        /* -------------- UTILITIES -------------- */
        .w100 {
            width: 100%
        }

        .row {
            display: flex;
            align-items: center;
            gap: 12px
        }

        .col {
            display: flex;
            flex-direction: column;
            gap: 12px
        }

        .muted {
            color: var(--muted)
        }

        .hidden {
            display: none
        }

        /* -------------- CARDS -------------- */
        .card {
            background: var(--bg-elev);
            border: 1px solid var(--border);
            border-radius: 12px;
        }

        .card-header {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .card-body {
            padding: 16px;
        }

        /* -------------- BUTTONS -------------- */
        .btn {
            border-radius: 10px;
            padding: 0 14px;
            height: 36px;
            border: 1px solid var(--border);
            background: var(--bg-elev);
            color: var(--text);
            display: inline-flex;
            align-items: center;
            gap: 8px;
            cursor: pointer;
            user-select: none;
            font-size: 14px;
            font-weight: 500;
        }

            .btn:hover {
                filter: brightness(1.1);
            }

            .btn:active {
                transform: scale(0.985);
            }

            .btn:focus {
                outline: 2px solid var(--focus);
                outline-offset: 2px;
            }

            .btn[disabled] {
                opacity: .5;
                cursor: not-allowed;
            }

        .btn-primary {
            background: var(--accent);
            border-color: transparent;
            color: #fff;
        }

            .btn-primary:hover {
                background: var(--accent-hover);
            }

        .btn-secondary {
            background: var(--bg-elev);
            border-color: var(--border);
        }

            .btn-secondary.active {
                background: var(--accent);
                border-color: var(--accent);
                color: white;
            }

            .btn-secondary.active:focus {
                outline: 2px solid var(--accent);
            }

        .btn-ghost {
            background: transparent;
            border-color: transparent;
        }

        .btn-danger {
            background: var(--danger);
            border-color: transparent;
            color: #fff;
        }

        .btn-sm {
            height: 28px;
            padding: 0 10px;
            border-radius: 8px;
            font-size: 13px;
        }

        .btn-xs {
            height: 24px;
            padding: 0 8px;
            border-radius: 8px;
            font-size: 12px;
        }

        /* -------------- FORMS & INPUTS -------------- */
        .label {
            font-weight: 600;
            font-size: 14px;
            margin-bottom: 6px;
            display: block;
        }

        .field {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 12px;
        }

        .input, select, textarea {
            background: var(--bg-elev);
            color: var(--text);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 10px 12px;
            outline: none;
            width: 100%;
            box-sizing: border-box;
            font-size: 14px;
        }

            .input:focus, select:focus, textarea:focus {
                outline: 2px solid var(--focus);
                outline-offset: 2px;
            }

            .input.invalid, select.invalid {
                border-color: var(--danger);
                outline: none;
            }

                .input.invalid:focus, select.invalid:focus {
                    outline: 2px solid var(--danger);
                    outline-offset: 2px;
                }

        .field-hint {
            color: var(--muted);
            font-size: 13px;
            margin-top: -2px;
        }

        .field-error {
            color: var(--danger);
            font-size: 13px;
            margin-top: 2px;
            display: none;
        }

            .field-error.show {
                display: block;
            }

        .required::after {
            content: " *";
            color: var(--danger);
            font-weight: 600;
        }

        .form-actions {
            display: flex;
            gap: 12px;
            justify-content: flex-end;
            margin-top: 20px;
            padding-top: 16px;
            border-top: 1px solid var(--border);
        }

        .checkbox-field {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 12px;
        }

            .checkbox-field input[type="checkbox"] {
                width: 18px;
                height: 18px;
                cursor: pointer;
            }

            .checkbox-field label {
                font-size: 14px;
                font-weight: 500;
                margin: 0;
                cursor: pointer;
            }

        .field-group {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

        .indent {
            margin-left: 26px;
        }

        /* -------------- SIDEBAR LISTS -------------- */
        .sidebar-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 16px;
            padding: 0;
            min-height: 32px;
        }

        .sidebar-title {
            font-weight: 600;
            font-size: 20px;
            flex: 1;
        }

        .sidebar-footer {
            margin-top: auto;
            padding-top: 16px;
            border-top: 1px solid var(--border);
        }

        .icon-btn {
            width: 32px;
            height: 32px;
            padding: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            color: var(--text);
            cursor: pointer;
            border-radius: 8px;
            transition: background-color 0.2s ease;
        }

            .icon-btn:hover {
                background: var(--hover-bg);
            }

        .section-title {
            font-size: 12px;
            letter-spacing: .04em;
            text-transform: uppercase;
            color: var(--muted);
            margin: 16px 0 8px;
            font-weight: 600;
        }

        .list {
            display: flex;
            flex-direction: column;
            gap: 0px;
        }

        .list:first-of-type {
            margin-bottom: 12px;
        }

        .list-item {
            display: flex;
            gap: 10px;
            padding: 6px 12px;
            border-radius: 8px;
            color: var(--text);
            text-decoration: none;
            cursor: pointer;
            position: relative;
            border: 1px solid transparent;
            background: transparent;
            margin: 0;
        }

            .list-item:hover {
                background: rgba(128,128,128,0.3);
            }

            .list-item.active {
                background: rgba(16,185,129,0.15);
            }

            .list-item.active:hover {
                background: rgba(16,185,129,0.2);
            }

        .list-item-icon {
            flex-shrink: 0;
            width: 36px;
            height: 36px;
            border-radius: 10px;
            display: grid;
            place-items: center;
            color: var(--muted);
            background: color-mix(in srgb, var(--muted) 12%, transparent);
        }

        .list-item-content {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        /* Header row: name + badge + menu */
        .list-item-header {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .list-item-name {
            font-weight: 600;
            font-size: 15px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1;
            min-width: 0;
            padding-right: 36px;
        }

        /* Reserve additional space for status icon when present */
        .list-item.has-status-icon .list-item-name {
            padding-right: 52px;
        }

        .list-item-gear {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            width: 28px;
            height: 28px;
            padding: 0;
            background: transparent;
            border: none;
            color: var(--text);
            cursor: pointer;
            border-radius: 6px;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.15s ease;
        }

        .list-item:hover .list-item-gear {
            opacity: 1;
            pointer-events: auto;
            display: flex;
        }

        .list-item-gear:hover {
            background: var(--hover-bg);
            color: var(--accent);
        }

        .pin-indicator {
            color: var(--accent);
            font-size: 12px;
            margin-left: 4px;
        }

        /* Details row: status + address */
        .list-item-details {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            color: var(--muted);
        }

        .detail-separator {
            opacity: 0.5;
        }

        .detail-text {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .detail-muted {
            font-size: 12px;
            color: var(--muted);
        }

        /* Footer row: last doc + actions */
        .list-item-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 4px;
        }

        .list-item-actions {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        /* Legacy support */
        .list-item-line1 {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 700;
            font-size: 15px;
        }

        .list-item-line2 {
            font-size: 13px;
            line-height: 1.4;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .new-docs-count {
            color: var(--accent);
            font-weight: 600;
            font-size: 13px;
        }

        .stopped-text {
            color: var(--danger);
            font-weight: 600;
            font-size: 13px;
            text-transform: uppercase;
        }

        .pin-icon {
            display: inline-block;
            vertical-align: top;
            margin-left: 0;
            opacity: 0.9;
        }

        .stopped-badge {
            color: var(--danger);
            font-weight: 600;
            font-size: 12px;
            text-transform: uppercase;
            margin-left: 8px;
        }

        .stopped-icon {
            position: absolute;
            right: 44px;
            top: 50%;
            transform: translateY(-50%);
            flex-shrink: 0;
            z-index: 1;
        }

        .list-item-dot {
            opacity: 0.6;
            font-size: 14px;
            margin: 0 6px;
        }

        .status-pill {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 1px 6px;
            border-radius: 4px;
            font-size: 13px;
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            background: rgba(255, 255, 255, 0.06);
            flex-shrink: 0;
            width: fit-content;
        }

        .status-started,
        .status-listening {
            color: var(--accent);
            background: rgba(16, 185, 129, 0.12);
        }

        .status-starting {
            color: var(--warn);
            background: rgba(245, 158, 11, 0.12);
        }

        .status-stopped {
            color: var(--danger);
            background: transparent;
        }

        .status-error {
            color: var(--danger);
            background: rgba(239, 68, 68, 0.12);
        }

        .status-unknown {
            color: var(--muted);
            background: rgba(255, 255, 255, 0.04);
        }

        .list-item-badge {
            background: var(--accent);
            color: white;
            border-radius: 6px;
            padding: 0 5px;
            font-size: 10px;
            font-weight: 600;
            line-height: 16px;
            min-width: 16px;
            text-align: center;
            flex-shrink: 0;
        }

        .list-item-menu {
            opacity: 0;
            font-weight: 900;
            font-size: 16px;
            line-height: 1;
            padding: 2px 6px;
            border-radius: 4px;
            flex-shrink: 0;
            transition: opacity 0.15s ease, background-color 0.15s ease;
        }

            .list-item-menu:hover {
                background: var(--hover-bg);
            }

            .list-item-menu:focus {
                outline: none;
            }

        .list-item:hover .list-item-menu {
            opacity: 1;
        }

        /* Outline danger button for Stop action */
        .btn-outline-danger {
            background: transparent;
            border: 1px solid var(--danger);
            color: var(--danger);
        }

            .btn-outline-danger:hover {
                background: rgba(239, 68, 68, 0.1);
            }

        .list-item-simple {
            padding: 10px 12px;
            padding-right: 44px;
        }

        .list-item-new {
            border: 1px solid transparent;
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 500;
            padding: 6px 12px;
            background: transparent;
            border-radius: 8px;
            cursor: pointer;
            min-height: 44px;
        }

        .list-item-new span {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

            .list-item-new:hover {
                background: rgba(255,255,255,0.08);
            }

        .new-printer-icon {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background: var(--accent);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .new-printer-icon svg {
            stroke: white;
        }

        /* -------------- MENU -------------- */
        .menu {
            position: absolute;
            background: var(--bg-elev);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 4px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.25);
            z-index: 100;
            min-width: 220px;
        }

        .menu-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 12px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 15px;
            color: var(--text);
            user-select: none;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

            .menu-item:hover {
                background: var(--hover-bg);
            }

        .menu-item svg {
            flex-shrink: 0;
            color: var(--muted);
        }

        .menu-item-icon {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
            opacity: 0.85;
        }

        .menu-item-text {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .menu-item-submenu-toggle {
            justify-content: space-between;
        }

        .menu-item-chevron {
            width: 12px;
            height: 12px;
            opacity: 0.7;
            transition: opacity 0.2s ease;
        }

        .menu-help {
            position: relative;
        }

        .menu-submenu {
            display: none;
            flex-direction: column;
            gap: 2px;
            padding: 6px;
            position: absolute;
            left: calc(100% + 8px);
            top: 0;
            min-width: 260px;
            background: var(--bg-elev);
            border: 1px solid var(--border);
            border-radius: 10px;
            box-shadow: 0 8px 22px rgba(0,0,0,0.2);
            z-index: 120;
        }

        .menu-submenu.open {
            display: flex;
        }

        .menu-item-danger {
            color: var(--danger);
        }

            .menu-item-danger svg {
                color: var(--danger);
            }

            .menu-item-danger:hover {
                background: rgba(239, 68, 68, 0.1);
            }

        .menu-item-accent {
            color: var(--accent);
        }

            .menu-item-accent svg {
                color: var(--accent);
            }

            .menu-item-accent:hover {
                background: rgba(16, 185, 129, 0.1);
            }

        .menu-divider {
            height: 1px;
            background: var(--border);
            margin: 6px 6px;
        }

        /* -------------- TOKEN DISPLAY -------------- */
        .token-display {
            background: var(--bg);
            border: 2px dashed var(--accent);
            border-radius: 12px;
            padding: 20px;
            text-align: center;
            margin: 20px 0;
        }

        .token-value {
            font-size: 24px;
            font-weight: 700;
            font-family: 'Courier New', monospace;
            color: var(--accent);
            letter-spacing: 2px;
            margin: 12px 0;
            user-select: all;
        }

        .token-actions {
            display: flex;
            gap: 8px;
            justify-content: center;
            margin-top: 16px;
        }

        /* -------------- PRINTER HEADER -------------- */
        .printer-header {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .properties-panel .printer-header {
            padding: 0;
        }

        .documents-panel .printer-header {
            position: sticky;
            top: 0;
            background: var(--bg-elev);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 24px;
            z-index: 5;
        }

        .printer-header-main {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .printer-header-info {
            flex: 1;
            min-width: 0;
        }

        .printer-header-title-row {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }

        .printer-header-title {
            margin: 0;
            font-size: 24px;
            font-weight: 600;
        }

        .printer-header-details {
            display: flex;
            flex-direction: column;
            gap: 6px;
            font-size: 14px;
            color: var(--text);
        }

        .printer-detail-line {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .copy-icon-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: transparent;
            border: none;
            color: var(--muted);
            cursor: pointer;
            padding: 4px;
            border-radius: 4px;
            transition: all 0.2s ease;
            vertical-align: middle;
        }

            .copy-icon-btn:hover {
                background: rgba(255,255,255,0.08);
                color: var(--accent);
            }

        .printer-header-actions {
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        /* -------------- DOCUMENTS -------------- */
        .document-item {
            margin: 0 auto 24px;
            text-align: left;
            display: inline-grid;
            grid-template-columns: 28px auto;
            grid-template-rows: auto auto auto;
            align-items: start;
        }

        .document-content {
            position: relative;
            display: inline-block;
            text-align: left;
        }

        .document-header {
            grid-column: 2;
            grid-row: 1;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin-bottom: 0;
            padding: 8px 0;
            background: var(--bg);
            border-bottom: 1px solid var(--border);
        }

        .document-preview-wrap {
            display: inline-block;
            grid-column: 2;
            grid-row: 2;
        }

        .document-footer {
            grid-column: 2;
            grid-row: 3;
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 8px 0 4px;
        }

        .document-footer-text {
            padding-left: 0;
        }

        .document-gutter {
            width: 28px;
            display: flex;
            justify-content: center;
            color: var(--muted);
            z-index: 2;
            grid-column: 1;
            align-self: start;
        }

        .document-gutter-header {
            grid-row: 1;
            padding-top: 8px;
        }

        .document-gutter-preview {
            grid-row: 2;
            padding-top: 8px;
        }

        .document-copy-btn {
            flex-shrink: 0;
        }

        .document-meta-text {
            color: var(--muted);
            font-size: 13px;
            padding-left: 12px;
        }

        .document-actions {
            margin-left: auto;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .document-debug-switch {
            margin: 0;
            gap: 6px;
        }

        .document-debug-switch .flag-label {
            font-size: 13px;
            color: var(--muted);
        }

        .document-debug-switch input[type="checkbox"]:disabled {
            cursor: not-allowed;
            opacity: 0.6;
        }

        .document-debug-switch input[type="checkbox"]:disabled ~ .flag-label {
            color: var(--muted);
        }

        /* -------------- TOAST -------------- */
        .toast-host {
            position: fixed;
            top: 16px;
            right: 16px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            z-index: 300;
        }

        .toast {
            padding: 12px 16px;
            border-radius: 10px;
            border: 1px solid var(--border);
            background: var(--bg-elev);
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
            animation: slideIn 0.3s ease;
        }

            .toast.ok {
                border-color: var(--ok);
                background: color-mix(in srgb, var(--ok) 10%, var(--bg-elev));
            }

            .toast.warn {
                border-color: var(--warn);
                background: color-mix(in srgb, var(--warn) 10%, var(--bg-elev));
            }

            .toast.danger {
                border-color: var(--danger);
                background: color-mix(in srgb, var(--danger) 10%, var(--bg-elev));
            }

        @keyframes slideIn {
            from {
                transform: translateX(100%);
                opacity: 0;
            }

            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        /* -------------- THEME TOGGLE -------------- */
        #themeToggle {
            position: fixed;
            bottom: 16px;
            right: 16px;
            z-index: 70;
        }

        /* -------------- TRANSITIONS -------------- */
        * {
            transition: background-color .2s ease, color .2s ease, border-color .2s ease, filter .15s ease, transform .08s ease;
        }

        @media (prefers-reduced-motion: reduce) {
            * {
                transition: none !important;
                animation: none !important;
            }
        }
    

        /* -------------- OPERATIONS PANEL -------------- */
        .operations-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
            padding: 0;
            min-height: 32px;
        }

        .operations-title-row {
            display: flex;
            align-items: baseline;
            gap: 12px;
        }

        .operations-title {
            font-size: 14px;
            font-weight: 600;
            color: var(--text);
        }

        .operations-printer-name {
            font-size: 18px;
            font-weight: 600;
            color: var(--text);
            line-height: 32px;
        }

        .operations-separator {
            color: var(--muted);
            user-select: none;
            font-size: 14px;
        }

        .operations-protocol {
            font-size: 13px;
            color: var(--muted);
            font-weight: 500;
        }

        .operations-info {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding-bottom: 16px;
            border-bottom: 1px solid var(--border);
            margin-bottom: 16px;
            font-size: 15px;
        }

        .info-row {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }

        .info-label {
            color: var(--muted);
            font-size: 13px;
            font-weight: 600;
            letter-spacing: 0.5px;
        }

        .info-separator {
            color: var(--muted);
            user-select: none;
        }

        .operations-actions {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .operations-button-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
        }

        .operations-button-row .btn {
            justify-content: center;
        }

        .operations-actions .btn {
            width: 100%;
            justify-content: center;
        }

        /* Section Divider */
        .section-divider {
            height: 1px;
            background: var(--border);
            margin: 12px 0;
        }

        /* Danger Zone */
        .danger-zone {
            margin-top: 16px;
            border: 1px solid transparent;
            border-radius: 8px;
            padding: 0px;
            background: transparent;
        }

        .danger-zone-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 12px;
            background: var(--bg-elev);
            border: 1px solid var(--border);
            border-radius: 6px;
            cursor: pointer;
            user-select: none;
            transition: all 0.2s ease;
            margin-bottom: 0;
        }

        .danger-zone-header:hover {
            background: var(--bg);
            border-color: var(--border);
        }

        .danger-zone-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 13px;
            font-weight: 600;
            color: var(--muted);
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .danger-zone-icon {
            width: 16px;
            height: 16px;
            opacity: 0.7;
        }

        .danger-zone-chevron {
            width: 16px;
            height: 16px;
            transition: transform 0.2s ease;
        }

        .danger-zone-chevron.expanded {
            transform: rotate(180deg);
        }

        .danger-zone-content {
            display: grid;
            grid-template-columns: 1fr;
            gap: 8px;
            padding: 12px;
            overflow: hidden;
            transition: max-height 0.3s ease, opacity 0.2s ease;
        }

        .danger-zone-content.collapsed {
            max-height: 0;
            opacity: 0;
        }

        .danger-zone-content.expanded {
            max-height: 140px;
            opacity: 1;
        }

        .danger-zone-content .btn {
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid rgba(239, 68, 68, 0.2);
            color: #ef4444;
        }

        .danger-zone-content .btn:hover {
            background: rgba(239, 68, 68, 0.15);
            border-color: rgba(239, 68, 68, 0.3);
        }

        .danger-zone-chevron {
            filter: var(--icon-filter);
        }

        .danger-zone.expanded {
            background: rgba(239, 68, 68, 0.08);
            border-color: rgba(239, 68, 68, 0.35);
        }

        .danger-zone.expanded .danger-zone-header {
            background: rgba(239, 68, 68, 0.1);
            border-color: rgba(239, 68, 68, 0.35);
        }

        .danger-zone.expanded .danger-zone-title {
            color: #ef4444;
        }

        .danger-zone.expanded .danger-zone-icon {
            opacity: 1;
        }

        /* Hide floating sidebar toggle since sidebar is always visible (just minimized) */
        .floating-sidebar-toggle {
            display: none !important;
        }

        /* Operational Flags Section */

        .flags-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-bottom: 8px;
            margin-top: 16px;
        }

        .flag-switch {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            user-select: none;
            margin-bottom: 0;
        }

        .debug-switch {
            margin-top: 16px;
        }

        .operations-actions > .flag-switch {
            margin-bottom: 8px;
        }

        .flag-switch input[type="checkbox"] {
            width: 36px;
            height: 20px;
            margin: 0;
            appearance: none;
            background: var(--border);
            border: 1px solid var(--border);
            border-radius: 10px;
            cursor: pointer;
            position: relative;
            transition: background 0.2s, border-color 0.2s;
            flex-shrink: 0;
        }

        .flag-switch input[type="checkbox"]::before {
            content: '';
            position: absolute;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--muted);
            left: 2px;
            top: 2px;
            transition: left 0.2s, background 0.2s;
        }

        .flag-switch input[type="checkbox"]:checked {
            background: var(--accent);
            border-color: var(--accent);
        }

        .flag-switch input[type="checkbox"]:checked::before {
            background: white;
            left: calc(100% - 16px);
        }

        /* Danger color for error flags when checked (matches danger zone styling) */
        .flag-switch.flag-error input[type="checkbox"]:checked {
            background: rgba(239, 68, 68, 0.25);
            border-color: rgba(239, 68, 68, 0.4);
        }

        /* Red text for error flag labels when checked (matches STOPPED status) */
        .flag-switch.flag-error input[type="checkbox"]:checked ~ .flag-label {
            color: var(--danger);
        }

        .flag-label {
            flex: 1;
            font-size: 14px;
            color: var(--text);
        }

        /* Drawer Management Section */
        .drawer-control {
            display: grid;
            grid-template-columns: 1fr 1fr;
            align-items: center;
            margin-bottom: 4px;
        }

        .drawer-info {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 6px 0;
        }

        .drawer-label {
            font-size: 14px;
            font-weight: 600;
            color: var(--text);
            width: auto;
        }

        .drawer-state {
            font-size: 14px;
            color: var(--text);
            width: auto;
        }

        .drawer-control .btn {
            width: 100%;
        }

        /* Buffer Status Section */
        .buffer-status-ascii {
            margin-bottom: 8px;
            margin-top: 12px;
        }

        .buffer-header-ascii {
            font-size: 13px;
            color: var(--text);
            margin-bottom: 4px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .buffer-header-value {
            color: var(--muted);
            padding-right: 4px;
        }

        .buffer-bar-ascii {
            font-family: 'Courier New', monospace;
            font-size: 14px;
            color: var(--text);
            letter-spacing: 0;
            line-height: 1.2;
        }

        .buffer-progress-bar {
            width: 100%;
            height: 6px;
            border: 1px solid var(--border);
            background: transparent;
            overflow: hidden;
            box-sizing: border-box;
        }

        .buffer-progress-fill {
            height: 100%;
            transition: background-color 0.2s ease;
            will-change: width;
        }

