      :root {
        color-scheme: dark;
        --bg: #0b0c0f;
        --panel: #15171c;
        --panel-soft: #12141a;
        --line: #222;
        --text: #e6e6e6;
        --muted: #9aa0a6;
        --brand: #18c29c;
        --brand-strong: #0f9f82;
        --danger: #ff6b6b;
        --warning: #ffd166;
        --button-text: #fff;
      }

      body[data-theme="light"] {
        color-scheme: light;
        --bg: #f7f8fb;
        --panel: #ffffff;
        --panel-soft: #f3f6f9;
        --line: #d9e0ea;
        --text: #172033;
        --muted: #667085;
        --brand: #0f9f82;
        --brand-strong: #087965;
        --button-text: #fff;
      }

      * {
        box-sizing: border-box;
      }

      body {
        margin: 0;
        min-height: 100vh;
        background: var(--bg);
        color: var(--text);
        font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      }

      button,
      input {
        font: inherit;
      }

      button {
        border: 1px solid var(--line);
        border-radius: 6px;
        background: var(--brand);
        color: var(--button-text);
        cursor: pointer;
        font-weight: 600;
        min-height: 40px;
        padding: 0 14px;
      }

      button.secondary {
        background: var(--panel-soft);
        color: var(--text);
        border: 1px solid var(--line);
      }

      button.danger {
        background: rgba(255, 107, 107, 0.12);
        color: #ffb4b4;
        border: 1px solid rgba(255, 107, 107, 0.38);
      }

      button:disabled {
        cursor: wait;
        opacity: 0.7;
      }

      input,
      select,
      textarea {
        width: 100%;
        border: 1px solid var(--line);
        border-radius: 7px;
        min-height: 40px;
        padding: 0 12px;
        color: var(--text);
        background: var(--bg);
        outline: none;
      }

      textarea {
        min-height: 78px;
        padding: 10px 12px;
        resize: vertical;
      }

      input:focus,
      select:focus,
      textarea:focus {
        border-color: var(--brand);
        box-shadow: 0 0 0 3px rgba(24, 194, 156, 0.14);
      }

      .shell {
        min-height: 100vh;
        display: grid;
        grid-template-rows: auto 1fr;
      }

      .topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 18px 28px;
        border-bottom: 1px solid var(--line);
        background: var(--panel);
      }

      .brand {
        display: flex;
        align-items: center;
        gap: 12px;
        min-width: 0;
      }

      .brand-logo {
        width: auto;
        height: 44px;
        display: block;
      }

      .brand h1 {
        margin: 0;
        font-size: 18px;
        line-height: 1.2;
      }

      .brand span,
      .muted {
        color: var(--muted);
      }

      .muted.ok {
        color: var(--ok);
      }

      .content {
        width: min(1220px, calc(100vw - 32px));
        margin: 0 auto;
        padding: 28px 0 42px;
      }

      .login {
        min-height: calc(100vh - 75px);
        display: grid;
        place-items: center;
      }

      .login-panel {
        width: min(440px, 100%);
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 24px;
      }

      .login-panel h2 {
        margin: 0 0 8px;
        font-size: 22px;
      }

      .login-panel form {
        display: grid;
        gap: 12px;
        margin-top: 20px;
      }

      .toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        margin-bottom: 18px;
      }

      .top-actions {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
      }

      .tabs {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        margin: 0 0 18px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--line);
      }

      .tab-button {
        background: var(--panel);
        color: var(--text);
      }

      .tab-button.active {
        background: var(--brand);
        border-color: var(--brand);
        color: var(--button-text);
      }

      [data-tab-panel][hidden] {
        display: none;
      }

      .tab-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
      }

      .grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
      }

      .card {
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
        padding: 16px;
      }

      body[data-theme="light"] .card,
      body[data-theme="light"] .login-panel,
      body[data-theme="light"] .modal {
        box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
      }

      .card h2,
      .card h3 {
        margin: 0 0 12px;
      }

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

      .card-header h3 {
        margin: 0;
      }

      .form-grid {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 10px;
        margin-bottom: 14px;
      }

      .compact-form {
        align-items: end;
      }

      .editor-form {
        display: none;
      }

      .editor-form.modal-form {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin: 0;
      }

      .form-grid .wide {
        grid-column: span 2;
      }

      .form-grid .full {
        grid-column: span 4;
      }

      label {
        display: grid;
        gap: 6px;
        color: var(--muted);
        font-size: 12px;
      }

      .transfer-audio-input {
        width: 100%;
        padding: 8px;
        border: 1px solid var(--border);
        border-radius: 6px;
        color: var(--text);
        background: var(--input);
      }

      .transfer-audio-input::file-selector-button {
        margin-right: 10px;
        padding: 7px 10px;
        border: 0;
        border-radius: 5px;
        color: var(--text);
        background: var(--panel);
        font-weight: 700;
        cursor: pointer;
      }

      .file-picker-name {
        min-height: 18px;
        color: var(--text);
        font-weight: 600;
        overflow-wrap: anywhere;
      }

      .actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
      }

      .row-actions {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        margin-left: 8px;
        vertical-align: middle;
      }

      .row-actions button {
        min-height: 34px;
        padding: 0 12px;
      }

      .status-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
        min-width: max-content;
      }

      .pagination {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 10px;
        margin-top: 14px;
      }

	      .help {
	        border-left: 3px solid var(--brand);
	        background: var(--panel-soft);
        padding: 12px 14px;
        margin-bottom: 14px;
        color: var(--muted);
	        line-height: 1.5;
	      }

	      .result-panel {
	        margin: 0 0 16px;
	        border: 1px solid var(--line);
	        border-radius: 8px;
	        overflow: hidden;
	        background: #090d12;
	      }

	      body[data-theme="light"] .result-panel {
	        background: #f8fafc;
	      }

	      .result-header {
	        display: flex;
	        align-items: center;
	        justify-content: space-between;
	        gap: 12px;
	        padding: 10px 12px;
	        border-bottom: 1px solid var(--line);
	        background: var(--panel-soft);
	      }

	      .result-header strong {
	        color: var(--text);
	      }

	      .route-note {
	        margin: -4px 0 14px;
	        color: var(--muted);
	        font-size: 12px;
	      }

	      .json-view {
	        min-height: 420px;
	        max-height: min(62vh, 760px);
	        overflow: auto;
	        margin: 0;
	        padding: 16px;
	        color: #d6deeb;
	        font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
	        white-space: pre-wrap;
	        tab-size: 2;
	      }

	      body[data-theme="light"] .json-view {
	        color: #182230;
	      }

	      .json-key {
	        color: #7dd3fc;
	      }

	      .json-string {
	        color: #a7f3d0;
	      }

	      .json-number,
	      .json-boolean {
	        color: #fde68a;
	      }

	      .json-null {
	        color: #fca5a5;
	      }

	      body[data-theme="light"] .json-key {
	        color: #0369a1;
	      }

	      body[data-theme="light"] .json-string {
	        color: #047857;
	      }

	      body[data-theme="light"] .json-number,
	      body[data-theme="light"] .json-boolean {
	        color: #92400e;
	      }

	      body[data-theme="light"] .json-null {
	        color: #b42318;
	      }

	      .lock-main {
	        display: block;
	        font-weight: 700;
	      }

	      .lock-sub {
	        display: block;
	        color: var(--muted);
	        font-size: 12px;
	        margin-top: 3px;
	        word-break: break-all;
	      }

      .field-actions {
        display: flex;
        justify-content: flex-end;
        margin-top: -8px;
        margin-bottom: 8px;
      }

      .field-actions button {
        min-height: 30px;
        padding: 0 10px;
        font-size: 12px;
      }

      .enhanced-select {
        display: none;
      }

      .picker-source-label {
        display: none;
      }

      .multi-picker {
        display: grid;
        gap: 8px;
      }

      .picker-label {
        color: var(--muted);
        font-size: 12px;
      }

      .single-picker {
        position: relative;
        z-index: 2;
      }

      .single-picker.open {
        z-index: 70;
      }

      .single-picker-trigger {
        width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        min-height: 40px;
        padding: 0 12px;
        border: 1px solid var(--line);
        border-radius: 7px;
        background: var(--bg);
        color: var(--text);
        font-weight: 500;
        text-align: left;
      }

      .single-picker-trigger:focus {
        border-color: var(--brand);
        box-shadow: 0 0 0 3px rgba(24, 194, 156, 0.14);
      }

      .single-picker-placeholder {
        color: var(--muted);
      }

      .single-picker-caret {
        color: var(--muted);
        font-size: 12px;
      }

      .single-picker-menu {
        position: absolute;
        top: calc(100% + 4px);
        left: 0;
        right: 0;
        z-index: 80;
        display: none;
        gap: 8px;
        padding: 8px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel);
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
      }

      .single-picker.open .single-picker-menu {
        display: grid;
      }

      .single-picker-menu input {
        min-height: 36px;
      }

      .single-picker-list {
        display: grid;
        max-height: 180px;
        overflow: auto;
        border: 1px solid var(--line);
        border-radius: 7px;
        background: var(--panel-soft);
      }

      .single-picker-option {
        border: 0;
        border-radius: 0;
        justify-content: flex-start;
        min-height: 36px;
        background: transparent;
        color: var(--text);
        text-align: left;
        font-weight: 500;
      }

      .single-picker-option:hover,
      .single-picker-option.selected {
        background: var(--panel-soft);
      }

      select.search-hidden {
        display: none;
      }

      .picker-add {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr) auto;
        gap: 8px;
      }

      .selected-list {
        display: grid;
        gap: 6px;
      }

      .selected-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: center;
        gap: 8px;
        min-height: 36px;
        padding: 6px 8px;
        border: 1px solid var(--line);
        border-radius: 7px;
        background: var(--panel-soft);
      }

      .selected-row-main {
        min-width: 0;
      }

      .distance-field {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        color: var(--muted);
        font-size: 12px;
        white-space: nowrap;
      }

      .distance-field input {
        width: 74px;
        min-height: 30px;
        padding: 0 8px;
      }

      .selected-row button {
        min-height: 30px;
        padding: 0 10px;
      }

      .empty-list {
        min-height: 36px;
        display: flex;
        align-items: center;
        color: var(--muted);
        border: 1px dashed var(--line);
        border-radius: 7px;
        padding: 0 10px;
      }

      .metric {
        display: grid;
        gap: 8px;
      }

      .metric .value {
        font-size: 28px;
        font-weight: 800;
      }

      .span-2 {
        grid-column: span 2;
      }

      .span-4 {
        grid-column: span 4;
      }

      table {
        width: 100%;
        border-collapse: collapse;
        font-size: 14px;
      }

      th,
      td {
        border-bottom: 1px solid var(--line);
        padding: 10px 8px;
        text-align: left;
        vertical-align: top;
      }

      th {
        color: var(--muted);
        font-weight: 600;
      }

      .pill {
        display: inline-flex;
        align-items: center;
        min-height: 24px;
        border-radius: 999px;
        padding: 0 9px;
        background: var(--panel-soft);
        color: var(--text);
        border: 1px solid var(--line);
        font-size: 12px;
        font-weight: 700;
      }

      .pill.ok {
        background: rgba(24, 194, 156, 0.14);
        color: #7ff0d5;
        border-color: rgba(24, 194, 156, 0.4);
      }

      body[data-theme="light"] .pill.ok {
        background: rgba(15, 159, 130, 0.12);
        color: #04735f;
        border-color: rgba(15, 159, 130, 0.38);
      }

      .pill.warn {
        background: rgba(255, 209, 102, 0.14);
        color: var(--warning);
        border-color: rgba(255, 209, 102, 0.35);
      }

      body[data-theme="light"] .pill.warn {
        background: rgba(180, 83, 9, 0.1);
        color: #92400e;
        border-color: rgba(180, 83, 9, 0.28);
      }

      body[data-theme="light"] button.danger {
        color: #b42318;
        background: #fff5f5;
        border-color: #f7b4b4;
      }

      .error {
        color: var(--danger);
        min-height: 20px;
      }

      .hidden {
        display: none !important;
      }

      .modal-backdrop {
        position: fixed;
        inset: 0;
        z-index: 50;
        display: grid;
        place-items: center;
        padding: clamp(14px, 3vh, 32px);
        background: rgba(0, 0, 0, 0.66);
      }

      .modal-backdrop[hidden] {
        display: none;
      }

	      .modal {
	        width: min(960px, 100%);
	        max-height: calc(100vh - clamp(28px, 6vh, 64px));
	        overflow: auto;
        background: var(--panel);
        border: 1px solid var(--line);
        border-radius: 8px;
	        box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36);
	      }

	      .side-modal-backdrop {
	        place-items: stretch end;
	        padding: 0;
	      }

	      .side-modal {
	        width: min(460px, 100vw);
	        height: 100vh;
	        max-height: 100vh;
	        border-radius: 0;
	        border-top: 0;
	        border-right: 0;
	        border-bottom: 0;
	      }

	      .icon-button {
	        width: 38px;
	        min-height: 38px;
	        padding: 0;
	        border-radius: 999px;
	        font-size: 18px;
	        line-height: 1;
	      }

	      .help-content {
	        display: grid;
	        gap: 18px;
	        color: var(--muted);
	        line-height: 1.55;
	      }

	      .help-content h4 {
	        margin: 0 0 8px;
	        color: var(--text);
	        font-size: 15px;
	      }

	      .help-content p,
	      .help-content ul,
	      .help-content ol {
	        margin: 0;
	      }

	      .help-content ul,
	      .help-content ol {
	        padding-left: 20px;
	      }

	      .help-content li + li {
	        margin-top: 6px;
	      }

	      .help-callout {
	        border: 1px solid rgba(24, 194, 156, 0.32);
	        border-radius: 8px;
	        background: rgba(24, 194, 156, 0.08);
	        padding: 12px;
	        color: var(--text);
	      }

      .modal.dropdown-open {
        overflow: visible;
      }

      .modal-header {
        position: sticky;
        top: 0;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 16px;
        border-bottom: 1px solid var(--line);
        background: var(--panel);
      }

      .modal-header h3 {
        margin: 0;
      }

      .modal-body {
        padding: 18px;
      }

      .qr-panel {
        display: grid;
        grid-template-columns: 240px minmax(0, 1fr);
        gap: 16px;
        align-items: start;
      }

      .qr-panel img {
        width: 240px;
        height: 240px;
        object-fit: contain;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 8px;
      }

      .qr-placeholder {
        width: 240px;
        height: 240px;
        display: grid;
        place-items: center;
        text-align: center;
        color: var(--muted);
        background: var(--panel-soft);
        border: 1px dashed var(--line);
        border-radius: 8px;
        padding: 16px;
      }

      @media (max-width: 900px) {
        .grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .tab-grid {
          grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .span-4 {
          grid-column: span 2;
        }
      }

      @media (max-width: 620px) {
        .topbar {
          align-items: flex-start;
          flex-direction: column;
          padding: 16px;
        }

        .content {
          width: min(100vw - 24px, 1220px);
          padding-top: 18px;
        }

        .grid,
        .tab-grid,
        .span-2,
        .span-4 {
          grid-template-columns: 1fr;
          grid-column: span 1;
        }

        .toolbar {
          align-items: stretch;
          flex-direction: column;
        }

        .form-grid,
        .form-grid .wide,
        .form-grid .full,
        .editor-form.modal-form,
        .picker-add,
        .qr-panel {
          grid-template-columns: 1fr;
          grid-column: span 1;
        }
      }
