    :root {
      --bg: #0a1020;
      --bg-2: #101931;
      --panel: rgba(16, 25, 49, 0.88);
      --panel-2: rgba(255,255,255,0.04);
      --line: rgba(255,255,255,0.1);
      --text: #eef4ff;
      --muted: #9dafca;
      --primary: #60a5fa;
      --secondary: #8b5cf6;
      --ok: #22c55e;
      --danger: #ef4444;
      --shadow: 0 22px 60px rgba(0,0,0,0.4);
      --radius: 22px;
    }
    * { box-sizing: border-box; }
    html, body { margin: 0; padding: 0; }
    body {
      min-height: 100vh;
      color: var(--text);
      font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background:
        radial-gradient(circle at top left, rgba(96,165,250,0.18), transparent 25%),
        radial-gradient(circle at bottom right, rgba(139,92,246,0.17), transparent 30%),
        linear-gradient(135deg, var(--bg), var(--bg-2));
    }
    .container {
      width: min(1180px, calc(100% - 28px));
      margin: 0 auto;
      padding: 24px 0 40px;
    }
    .hidden { display: none !important; }
    .card {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      backdrop-filter: blur(16px);
    }
    .auth-shell {
      min-height: calc(100vh - 64px);
      display: grid;
      place-items: center;
    }
    .auth-card {
      width: min(520px, 100%);
      padding: 30px;
    }
    .brand {
      display: flex;
      gap: 14px;
      align-items: center;
      margin-bottom: 20px;
    }
    .logo {
      width: 52px;
      height: 52px;
      border-radius: 18px;
      display: grid;
      place-items: center;
      font-size: 28px;
      border: 1px solid var(--line);
      background: linear-gradient(135deg, rgba(96,165,250,0.24), rgba(139,92,246,0.24));
    }
    h1, h2, h3 { margin-top: 0; }
    p { line-height: 1.6; }
    .muted { color: var(--muted); }
    .build-meta {
      margin-top: 14px;
      color: var(--muted);
      font-size: 12px;
      font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
      word-break: break-word;
    }
    .tabs {
      display: flex;
      gap: 10px;
      margin: 18px 0 20px;
    }
    .tab {
      flex: 1;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.05);
      color: var(--text);
      border-radius: 14px;
      padding: 12px;
      cursor: pointer;
      font-weight: 700;
    }
    .tab.active {
      background: linear-gradient(135deg, var(--primary), var(--secondary));
    }
    .tab:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      pointer-events: none;
    }
    label {
      display: block;
      margin-bottom: 8px;
      color: var(--muted);
      font-size: 14px;
    }
    input, select, textarea {
      width: 100%;
      border-radius: 14px;
      border: 1px solid rgba(255,255,255,0.12);
      background: rgba(5, 10, 20, 0.6);
      color: var(--text);
      padding: 12px 14px;
      font: inherit;
      outline: none;
    }
    input:focus, select:focus, textarea:focus {
      border-color: rgba(96,165,250,0.7);
      box-shadow: 0 0 0 3px rgba(96,165,250,0.14);
    }
    .stack > * + * { margin-top: 14px; }
    .row { display: flex; gap: 12px; }
    .row > * { flex: 1; }
    button {
      border: 0;
      border-radius: 14px;
      padding: 12px 16px;
      font: inherit;
      font-weight: 700;
      color: white;
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      cursor: pointer;
    }
    button.secondary {
      background: rgba(255,255,255,0.06);
      border: 1px solid var(--line);
      color: var(--text);
    }
    button.danger {
      background: rgba(239,68,68,0.18);
      border: 1px solid rgba(239,68,68,0.25);
      color: #ffd7d7;
    }
    .topbar {
      display: flex;
      justify-content: space-between;
      gap: 16px;
      align-items: center;
      margin-bottom: 22px;
      flex-wrap: wrap;
    }
    .layout {
      display: grid;
      grid-template-columns: 360px 1fr;
      gap: 22px;
    }
    #formDetails > summary {
      cursor: pointer;
      user-select: none;
      list-style: none;
    }
    #formDetails > summary::-webkit-details-marker {
      display: none;
    }
    #formDetails > summary h2 {
      display: inline;
    }
    .panel { padding: 22px; }
    .stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 12px;
      margin: 18px 0 22px;
    }
    .stat {
      border: 1px solid var(--line);
      background: var(--panel-2);
      border-radius: 16px;
      padding: 14px;
    }
    .stat strong {
      display: block;
      font-size: 24px;
      margin-bottom: 4px;
    }
    .toolbar {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      align-items: center;
      flex-wrap: wrap;
      margin-bottom: 18px;
    }
    .search {
      width: min(360px, 100%);
    }
    .message {
      min-height: 22px;
      margin-top: 10px;
      font-size: 14px;
    }
    .error { color: #fca5a5; }
    .success { color: #86efac; }
    .pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.05);
      color: var(--muted);
      font-size: 13px;
    }
    .list {
      display: grid;
      gap: 12px;
    }
    .item {
      display: grid;
      grid-template-columns: auto 1fr;
      gap: 14px;
      padding: 16px;
      border-radius: 18px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.04);
      align-items: start;
    }
    .item.done {
      background: rgba(34,197,94,0.08);
      opacity: 0.8;
    }
    .item-image {
      width: 160px;
      height: 160px;
      border-radius: 12px;
      object-fit: contain;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.05);
      flex-shrink: 0;
      display: block;
    }
    .item-image-placeholder {
      width: 160px;
      height: 160px;
      border-radius: 12px;
      border: 1px dashed rgba(255,255,255,0.15);
      background: rgba(255,255,255,0.03);
      display: flex;
      align-items: center;
      justify-content: center;
      color: rgba(255,255,255,0.2);
      font-size: 22px;
      flex-shrink: 0;
    }
    /* ── Image-only list grid ────────────────────────────────── */
    .image-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
      gap: 8px;
    }
    .image-tile {
      aspect-ratio: 1;
      border-radius: 12px;
      overflow: hidden;
      cursor: pointer;
      position: relative;
      border: 2px solid transparent;
      transition: border-color 0.15s;
      background: var(--panel-2);
    }
    .image-tile:hover,
    .image-tile:focus-visible {
      border-color: var(--primary);
    }
    .image-tile img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .image-tile.done img {
      filter: grayscale(1);
      opacity: 0.35;
    }
    .image-tile.done::after {
      content: '✓';
      position: absolute;
      top: 6px;
      right: 6px;
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--ok);
      color: #fff;
      border-radius: 50%;
      font-size: 14px;
      font-weight: bold;
    }
    .image-tile-placeholder {
      aspect-ratio: 1;
      border-radius: 12px;
      background: var(--panel-2);
      border: 1px dashed var(--line);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 32px;
      font-weight: 700;
      color: var(--muted);
      cursor: pointer;
      text-transform: uppercase;
      position: relative;
    }
    .image-tile-placeholder.done {
      opacity: 0.35;
    }
    .image-tile-placeholder.done::after {
      content: '✓';
      position: absolute;
      top: 6px;
      right: 6px;
      width: 24px;
      height: 24px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--ok);
      color: #fff;
      border-radius: 50%;
      font-size: 14px;
      font-weight: bold;
    }
    /* Image modal */
    #imgModal {
      background: var(--panel);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      backdrop-filter: blur(20px);
      width: min(560px, 100%);
      max-height: 90vh;
      overflow-y: auto;
      padding: 24px;
      color: var(--text);
    }
    #imgModal::backdrop {
      background: rgba(0,0,0,0.75);
    }
    #imgModal h3 { margin: 0 0 6px; }
    .img-modal-subtitle { color: var(--muted); font-size: 14px; margin: 0 0 20px; }
    .img-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
      margin-bottom: 20px;
    }
    .img-option {
      position: relative;
      cursor: pointer;
      border-radius: 14px;
      border: 2px solid transparent;
      overflow: hidden;
      background: rgba(255,255,255,0.04);
      aspect-ratio: 1;
      transition: border-color 0.15s;
    }
    .img-option:hover { border-color: rgba(96,165,250,0.5); }
    .img-option.selected { border-color: var(--primary); }
    .img-option img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .img-option .img-select-badge {
      position: absolute;
      top: 8px;
      right: 8px;
      background: var(--primary);
      color: white;
      border-radius: 999px;
      width: 26px;
      height: 26px;
      display: none;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }
    .img-option.selected .img-select-badge { display: flex; }
    .img-modal-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
    }
    .img-modal-tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 18px;
    }
    .img-modal-tab {
      flex: 1;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.05);
      color: var(--text);
      border-radius: 12px;
      padding: 10px 8px;
      cursor: pointer;
      font-weight: 700;
      font-size: 14px;
      text-align: center;
    }
    .img-modal-tab.active {
      background: linear-gradient(135deg, var(--primary), var(--secondary));
      border-color: transparent;
    }
    .img-upload-area {
      border: 2px dashed rgba(255,255,255,0.2);
      border-radius: 14px;
      padding: 32px 16px;
      text-align: center;
      cursor: pointer;
      transition: border-color 0.15s, background 0.15s;
      margin-bottom: 16px;
    }
    .img-upload-area:hover,
    .img-upload-area.drag-over {
      border-color: var(--primary);
      background: rgba(96,165,250,0.08);
    }
    .img-upload-area-icon {
      font-size: 36px;
      margin-bottom: 10px;
    }
    .img-upload-area-text {
      color: var(--muted);
      font-size: 14px;
    }
    .img-upload-preview {
      border-radius: 14px;
      overflow: hidden;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.04);
      aspect-ratio: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 16px;
    }
    .img-upload-preview img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      display: block;
    }
    .img-upload-preview {
      position: relative;
      border-radius: 14px;
      overflow: hidden;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.04);
      aspect-ratio: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 12px;
    }
    .img-crop-overlay {
      position: absolute;
      inset: 0;
      pointer-events: none;
    }
    .img-crop-mask {
      position: absolute;
      background: rgba(0,0,0,0.55);
    }
    .img-crop-box {
      position: absolute;
      border: 2px dashed rgba(255,255,255,0.7);
      box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
      pointer-events: auto;
      cursor: move;
      touch-action: none;
    }
    .img-crop-handle {
      position: absolute;
      width: 18px;
      height: 18px;
      background: var(--primary);
      border: 2px solid white;
      border-radius: 50%;
      pointer-events: auto;
    }
    .img-crop-handle:nth-child(1) { top: -9px; left: -9px; cursor: nw-resize; }
    .img-crop-handle:nth-child(2) { top: -9px; right: -9px; cursor: ne-resize; }
    .img-crop-handle:nth-child(3) { bottom: -9px; left: -9px; cursor: sw-resize; }
    .img-crop-handle:nth-child(4) { bottom: -9px; right: -9px; cursor: se-resize; }
    .img-rotate-btns {
      display: flex;
      gap: 8px;
      justify-content: center;
      margin-bottom: 12px;
    }
    .img-rotate-btn {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      border: 1px solid var(--line);
      background: rgba(255,255,255,0.06);
      color: var(--text);
      font-size: 20px;
      cursor: pointer;
      display: grid;
      place-items: center;
    }
    .img-bg-toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 12px;
      justify-content: center;
      font-size: 14px;
      color: var(--muted);
    }
    .img-bg-toggle input[type="checkbox"] {
      width: 18px;
      height: 18px;
      accent-color: var(--primary);
    }
    .img-bg-toggle label {
      cursor: pointer;
      user-select: none;
    }
    .img-progress {
      width: 100%;
      height: 4px;
      background: rgba(255,255,255,0.1);
      border-radius: 2px;
      overflow: hidden;
      margin-top: 8px;
    }
    .img-progress-bar {
      height: 100%;
      background: var(--primary);
      border-radius: 2px;
      transition: width 0.15s ease;
    }
    /* Lock dialog during background removal processing */
    #imgModal.processing {
      pointer-events: none;
      opacity: 0.7;
    }
    #imgModal.processing::after {
      content: '';
      position: absolute;
      inset: 0;
      background: rgba(0,0,0,0.05);
      border-radius: var(--radius);
    }
    .img-modal-message {
      margin-bottom: 14px;
      font-size: 14px;
      min-height: 22px;
    }
    .img-modal-message.error { color: #fca5a5; }
    .img-modal-message.success { color: #86efac; }
    .img-loading {
      text-align: center;
      padding: 32px 16px;
      color: var(--muted);
    }
    .img-loading .spinner {
      display: inline-block;
      width: 32px;
      height: 32px;
      border: 3px solid rgba(96,165,250,0.25);
      border-top-color: var(--primary);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      margin-bottom: 12px;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    .img-error {
      text-align: center;
      padding: 24px 16px;
      color: #fca5a5;
    }
    .checkbox {
      width: 22px;
      height: 22px;
      margin-top: 2px;
      accent-color: var(--ok);
    }
    .item-title {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 6px;
      align-items: center;
    }
    .tag {
      font-size: 12px;
      padding: 4px 8px;
      border-radius: 999px;
      border: 1px solid rgba(96,165,250,0.2);
      background: rgba(96,165,250,0.12);
      color: #bfdbfe;
    }
    .cat-header {
      padding: 8px 16px;
      margin: 14px 0 4px 0;
      font-weight: 700;
      font-size: 13px;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 0.06em;
      border-bottom: 1px solid rgba(96,165,250,0.15);
    }
    .cat-header:first-child {
      margin-top: 0;
    }
    .item.priority-normal  { border-left: 4px solid rgba(203, 213, 225, 0.4); }
    .item.priority-wichtig  { border-left: 4px solid #fde68a; }
    .item.priority-dringend { border-left: 4px solid #fecaca; }
    .meta, .note, .empty {
      color: var(--muted);
      line-height: 1.55;
    }
    .actions {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 10px;
    }
    .actions button:first-child {
      flex: 1 0 auto;
      max-width: 44px;
    }
    .actions button:not(:first-child) {
      flex: 1;
    }
    .empty {
      padding: 28px;
      text-align: center;
      border-radius: 18px;
      border: 1px dashed rgba(255,255,255,0.14);
      background: rgba(255,255,255,0.03);
    }
    .notice {
      margin-top: 18px;
      padding: 12px 14px;
      border-radius: 14px;
      border: 1px solid rgba(96,165,250,0.2);
      background: rgba(96,165,250,0.08);
      color: #bfdbfe;
      font-size: 14px;
      line-height: 1.55;
    }
    #menuToggle { display: none; }
    @media (max-width: 940px) {
      .layout { grid-template-columns: 1fr; }
      .stats { grid-template-columns: repeat(3, 1fr); }
      .stat:last-child { grid-column: 1 / -1; }
      .item-image,
      .item-image-placeholder {
        width: 96px;
        height: 96px;
      }
      .row { flex-direction: column; }
      .img-grid { grid-template-columns: repeat(2, 1fr); }
      #menuToggle { display: inline-flex; }
      .toolbar-actions { display: none; flex-wrap: wrap; gap: 6px; }
      .toolbar-actions.open { display: flex; }
    }
    @media (max-width: 600px) {
      .item-image,
      .item-image-placeholder {
        width: 72px;
        height: 72px;
      }
      .item .item-image {
        object-fit: cover;
      }
      .item .actions button {
        padding: 6px 10px;
        font-size: 13px;
      }
      .item .actions button:first-child {
        display: none;
      }
    }
    @media (max-width: 400px) {
      .image-list { grid-template-columns: repeat(3, 1fr); gap: 6px; }
      .item-image,
      .item-image-placeholder {
        width: 56px;
        height: 56px;
      }
    }
    @media (max-width: 480px) {
      .img-grid { grid-template-columns: 1fr 1fr; }
    }
    /* ── Light Theme ───────────────────────────────────────── */
    [data-theme="light"] {
      --bg: #f0f4ff;
      --bg-2: #e4e9f4;
      --panel: rgba(255,255,255,0.94);
      --panel-2: rgba(0,0,0,0.04);
      --line: rgba(0,0,0,0.12);
      --text: #1a1a2e;
      --muted: #55627a;
      --primary: #2563eb;
      --secondary: #6d28d9;
      --ok: #15803d;
      --danger: #b91c1c;
      --shadow: 0 12px 40px rgba(0,0,0,0.08);
    }
    [data-theme="light"] body {
      background:
        radial-gradient(circle at top left, rgba(37,99,235,0.1), transparent 25%),
        radial-gradient(circle at bottom right, rgba(109,40,217,0.08), transparent 30%),
        linear-gradient(135deg, var(--bg), var(--bg-2));
    }
    [data-theme="light"] button.danger {
      color: var(--danger);
    }
    .theme-toggle {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 38px;
      height: 38px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: var(--panel-2);
      color: var(--text);
      font-size: 18px;
      cursor: pointer;
      transition: background 0.15s, transform 0.2s;
    }
    .theme-toggle:hover { background: var(--line); transform: scale(1.1); }
    .store-group-header {
      padding: 8px 16px;
      margin: 14px 0 4px 0;
      font-weight: 700;
      font-size: 13px;
      color: var(--accent);
      text-transform: uppercase;
      letter-spacing: 0.06em;
      border-bottom: 1px solid rgba(96,165,250,0.15);
    }
    .store-group-header:first-child {
      margin-top: 0;
    }
