
    /* ── Fonturi locale (fără dependențe externe) ── */
    @font-face {
      font-family: 'AppMono';
      src: local('Courier New'), local('Courier'), local('monospace');
      font-weight: normal;
    }

    :root {
      --bg:        #353542;
      --surface:   #414157;
      --border:    #1e1e1e;
      --accent:    #00e5a0;
      --accent2:   #00b8ff;
      --danger:    #ff4545;
      --warn:      #ffaa00;
      --text:      #e8e8e8;
      --muted:     #969696;
      --mono:      'Share Tech Mono', 'Courier New', 'Courier', monospace;
      --sans:      'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      --radius:    6px;
      --trans:     0.18s ease;
    }

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

    html, body {
      height: 100%;
      background: var(--bg);
      color: var(--text);
      font-family: var(--sans);
      font-weight: 400;
      overflow: hidden;
      -webkit-tap-highlight-color: transparent;
    }

    /* ── Layout ── */
    #app {
      display: flex;
      flex-direction: column;
      height: 100dvh;
      max-width: 480px;
      margin: 0 auto;
    }

    /* ── Header ── */
    header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px 10px;
      border-bottom: 1px solid var(--border);
      background: var(--surface);
      flex-shrink: 0;
    }
    .logo {
      font-family: var(--mono);
      font-size: 20px;
      letter-spacing: 0.08em;
      color: var(--accent);
    }
    .logo span { color: var(--muted); }

    #network-badge {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 15px;
      font-weight: 600;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--muted);
      transition: color var(--trans);
    }
    #network-badge .dot {
      width: 7px; height: 7px;
      border-radius: 50%;
      background: var(--muted);
      transition: background var(--trans);
    }
    #network-badge.online  { color: var(--accent); }
    #network-badge.online .dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
    #network-badge.offline { color: var(--warn); }
    #network-badge.offline .dot { background: var(--warn); }

    /* ── Tab bar ── */
    nav {
      display: flex;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      flex-shrink: 0;
    }
    nav button {
      flex: 1;
      padding: 15px 0;
      background: none;
      border: none;
      border-bottom: 3px solid transparent;
      color: var(--muted);
      font-family: var(--sans);
      font-size: 15px;
      font-weight: 600;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      cursor: pointer;
      transition: color var(--trans), border-color var(--trans);
    }
    nav button.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
    }

    /* ── Views ── */
    .view { display: none; flex-direction: column; flex: 1; overflow: hidden; }
    .view.active { display: flex; }

    /* ── Scanner view ── */
    #view-scan {
      position: relative;
      align-items: center;
      justify-content: center;
      background: var(--bg);
    }

    #video-container {
      position: relative;
      width: 100%;
      flex: 1;
      overflow: hidden;
    }
    #preview {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    /* Viewfinder overlay */
    .vf-overlay {
      position: absolute;
      inset: 0;
      pointer-events: none;
    }
    .vf-overlay::before {
      content: '';
      position: absolute;
      inset: 0;
      background:
        linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.55) 100%),
        linear-gradient(to right,  rgba(0,0,0,0.35) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.35) 100%);
    }
    .vf-box {
      position: absolute;
      top: 50%; left: 50%;
      transform: translate(-50%, -52%);
      width: 72%; max-width: 280px;
      height: 120px;
    }
    .vf-corner {
      position: absolute;
      width: 20px; height: 20px;
      border-color: var(--accent);
      border-style: solid;
    }
    .vf-corner.tl { top: 0; left: 0;  border-width: 2px 0 0 2px; }
    .vf-corner.tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
    .vf-corner.bl { bottom: 0; left: 0;  border-width: 0 0 2px 2px; }
    .vf-corner.br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }

    .scan-line {
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 2px;
      background: linear-gradient(90deg, transparent, var(--accent), transparent);
      animation: scanline 2s ease-in-out infinite;
      opacity: 0.8;
    }
    @keyframes scanline {
      0%   { top: 0%;   opacity: 0.8; }
      50%  { top: 95%;  opacity: 0.9; }
      100% { top: 0%;   opacity: 0.8; }
    }

    .vf-label {
      position: absolute;
      bottom: -22px;
      left: 50%;
      transform: translateX(-50%);
      font-family: var(--mono);
      font-size: 10px;
      color: rgba(255,255,255,0.4);
      white-space: nowrap;
      letter-spacing: 0.1em;
    }

    /* Scan result flash */
    #scan-flash {
      position: absolute;
      inset: 0;
      background: var(--accent);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.05s;
    }
    #scan-flash.flash { animation: flashAnim 0.35s ease-out forwards; }
    @keyframes flashAnim {
      0%   { opacity: 0.35; }
      100% { opacity: 0; }
    }

    /* Result bar */
    #scan-result-bar {
      padding: 15px 16px;
      background: var(--surface);
      border-top: 1px solid var(--border);
      min-height: 70px;
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
    }
    #scan-result-bar .result-code {
      font-family: var(--mono);
      font-size: 19px;
      color: var(--accent);
      flex: 1;
      word-break: break-all;
    }
    #scan-result-bar .result-meta {
      font-size: 13px;
      color: var(--muted);
      text-align: right;
      line-height: 1.6;
    }
    #scan-result-bar.empty .result-code { color: var(--muted); font-size: 16px; }

    /* Scanner controls */
    #scan-controls {
      display: flex;
      gap: 10px;
      padding: 14px 16px;
      background: var(--surface);
      border-top: 1px solid var(--border);
      flex-shrink: 0;
    }
    .btn {
      flex: 1;
      padding: 16px 10px;
      border: none;
      border-radius: var(--radius);
      font-family: var(--sans);
      font-size: 16px;
      font-weight: 600;
      letter-spacing: 0.04em;
      cursor: pointer;
      transition: opacity var(--trans), transform 0.1s;
    }
    .btn:active { transform: scale(0.97); }
    .btn-primary { background: var(--accent); color: #000; }
    .btn-secondary { background: var(--border); color: var(--text); }
    .btn-danger { background: var(--danger); color: #fff; }
    .btn:disabled { opacity: 0.35; cursor: not-allowed; }

    /* ── List view ── */
    #view-list { background: var(--bg); }

    .list-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      background: var(--surface);
      flex-shrink: 0;
    }
    .list-header h2 {
      font-size: 16px;
      font-weight: 600;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      color: var(--muted);
    }
    #pending-count {
      font-family: var(--mono);
      font-size: 14px;
      background: var(--warn);
      color: #000;
      padding: 3px 10px;
      border-radius: 20px;
      font-weight: 700;
    }
    #pending-count.zero { background: var(--border); color: var(--muted); }

    #scan-list {
      flex: 1;
      overflow-y: auto;
      padding: 8px 0;
      -webkit-overflow-scrolling: touch;
    }
    #scan-list::-webkit-scrollbar { width: 3px; }
    #scan-list::-webkit-scrollbar-track { background: var(--bg); }
    #scan-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

    .scan-item {
      display: flex;
      align-items: center;
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      gap: 14px;
      animation: slideIn 0.2s ease-out;
    }
    @keyframes slideIn {
      from { opacity: 0; transform: translateX(-8px); }
      to   { opacity: 1; transform: translateX(0); }
    }
    .scan-item-icon {
      width: 42px; height: 42px;
      border-radius: 8px;
      display: flex; align-items: center; justify-content: center;
      font-size: 20px;
      flex-shrink: 0;
    }
    .scan-item-icon.pending  { background: rgba(255,170,0,0.12); }
    .scan-item-icon.synced   { background: rgba(0,229,160,0.1); }
    .scan-item-icon.error    { background: rgba(255,69,69,0.12); }

    .scan-item-body { flex: 1; min-width: 0; }
    .scan-item-code {
      font-family: var(--mono);
      font-size: 16px;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .scan-item-meta {
      font-size: 12px;
      color: var(--muted);
      margin-top: 3px;
    }
    .scan-item-status {
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      flex-shrink: 0;
    }
    .scan-item-status.pending { color: var(--warn); }
    .scan-item-status.synced  { color: var(--accent); }
    .scan-item-status.error   { color: var(--danger); }

    .empty-state {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      color: var(--muted);
      font-size: 16px;
    }
    .empty-state .icon { font-size: 48px; opacity: 0.3; }

    /* Sync bar */
    #sync-bar {
      padding: 12px 16px;
      background: var(--surface);
      border-top: 1px solid var(--border);
      display: flex;
      gap: 10px;
      flex-shrink: 0;
    }

    /* ── Settings view ── */
    #view-settings {
      background: var(--bg);
      overflow-y: auto;
      padding: 16px;
      gap: 12px;
    }
    .settings-group {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      overflow: visible;
      margin-bottom: 14px;
    }
    .settings-group-title {
      padding: 10px 16px;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: var(--muted);
      border-bottom: 1px solid var(--border);
      background: rgba(255,255,255,0.02);
    }
    .settings-row {
      display: flex;
      align-items: center;
      padding: 10px 11px;
      gap: 5px;
      border-bottom: 1px solid var(--border);
    }
    .settings-group > .settings-row:first-of-type {
      border-radius: var(--radius) var(--radius) 0 0;
    }
    .settings-group > .settings-row:last-child {
      border-bottom: none;
      border-radius: 0 0 var(--radius) var(--radius);
    }
    .settings-row:last-child { border-bottom: none; }
    .settings-row label {
      flex: 1;
      font-size: 15px;
      color: var(--text);
    }
    .settings-row small {
      display: block;
      font-size: 12px;
      color: var(--muted);
      margin-top: 3px;
    }
    .settings-row input[type="text"],
    .settings-row input[type="password"],
    .settings-row input[type="url"] {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 4px;
      color: var(--text);
      font-family: var(--mono);
      font-size: 14px;
      padding: 6px 8px;
      width: 100%;
      outline: none;
      transition: border-color var(--trans);
    }
    .settings-row input:focus { border-color: var(--accent2); }
    .settings-full { flex-direction: column; align-items: stretch; }
    .settings-full label { margin-bottom: 8px; font-size: 15px; }

    /* Toggle switch custom */
    .toggle-wrap {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
    }
    .toggle-wrap .toggle-label {
      font-size: 15px;
      color: var(--text);
      flex: 1;
      line-height: 1.4;
    }
    .toggle-wrap .toggle-label small {
      display: block;
      font-size: 12px;
      color: var(--muted);
      margin-top: 3px;
    }
    .toggle {
      position: relative;
      width: 52px;
      min-width: 52px;
      height: 28px;
      flex-shrink: 0;
      margin-left: 12px;
    }
    .toggle input {
      opacity: 0;
      width: 0; height: 0;
      position: absolute;
    }
    .toggle-slider {
      position: absolute;
      top: 0; left: 0;
      width: 52px;
      height: 28px;
      background: var(--border);
      border-radius: 28px;
      cursor: pointer;
      transition: background 0.2s;
    }
    .toggle-slider::after {
      content: '';
      position: absolute;
      left: 3px; top: 3px;
      width: 22px; height: 22px;
      border-radius: 50%;
      background: var(--muted);
      transition: transform 0.2s, background 0.2s;
    }
    .toggle input:checked + .toggle-slider {
      background: rgba(0, 229, 160, 0.2);
      border: 1px solid var(--accent);
    }
    .toggle input:checked + .toggle-slider::after {
      transform: translateX(24px);
      background: var(--accent);
    }

    /* Toast */
    #toast {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%) translateY(20px);
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--text);
      font-size: 13px;
      padding: 10px 18px;
      border-radius: 24px;
      opacity: 0;
      transition: opacity 0.2s, transform 0.2s;
      pointer-events: none;
      white-space: nowrap;
      z-index: 999;
    }
    #toast.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
    }
    #toast.success { border-color: var(--accent); color: var(--accent); }
    #toast.error   { border-color: var(--danger); color: var(--danger); }
    #toast.warn    { border-color: var(--warn);   color: var(--warn); }
