  @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;600;700;800;900&display=swap');

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

  html, body {
    font-family: 'Noto Sans JP', -apple-system, sans-serif;
    background: #0c0c14;
    color: #fff;
    height: 100vh;
    overflow: hidden;
  }

  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

  input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.25); }

  /* ─── Login ─── */
  .login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 32px;
  }
  .login-logo {
    width: 56px; height: 56px;
    margin: 0 auto;
  }
  .login-logo img { width: 100%; height: 100%; object-fit: contain; }
  .login-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
  .login-sub { font-size: 13px; color: rgba(255,255,255,0.4); margin-top: 4px; }
  .login-users { display: flex; flex-direction: column; gap: 8px; width: 280px; }
  .login-btn {
    padding: 14px 20px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03); color: #fff; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; text-align: left;
    display: flex; align-items: center; gap: 12px;
  }
  .login-btn:hover { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); }
  .login-btn .role-tag {
    margin-left: auto; font-size: 10px; padding: 2px 8px; border-radius: 8px;
    font-weight: 700;
  }
  .role-ad { background: rgba(139,92,246,0.2); color: #a78bfa; }
  .role-worker { background: rgba(59,130,246,0.2); color: #93c5fd; }

  /* ─── Layout ─── */
  .app-layout { display: flex; height: 100vh; overflow: hidden; }

  /* Sidebar */
  .sidebar {
    width: 220px; height: 100%; background: #0a0a0f;
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex; flex-direction: column; padding: 24px 0;
    flex-shrink: 0; transition: width 0.2s ease;
  }
  .sidebar.collapsed { width: 56px; }
  .sidebar-logo { padding: 0 20px; margin-bottom: 32px; display: flex; align-items: center; gap: 10px; overflow: hidden; white-space: nowrap; }
  .sidebar.collapsed .sidebar-logo { padding: 0; justify-content: center; gap: 0; }
  .sidebar-logo-icon {
    width: 32px; height: 32px; flex-shrink: 0;
  }
  .sidebar-logo-icon img { width: 100%; height: 100%; object-fit: contain; }
  .sidebar-logo-text { font-size: 14px; font-weight: 800; letter-spacing: -0.02em; transition: opacity 0.15s; }
  .sidebar-logo-sub { font-size: 10px; color: rgba(255,255,255,0.35); font-weight: 500; transition: opacity 0.15s; }
  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .sidebar-logo-sub { opacity: 0; width: 0; overflow: hidden; }

  .nav-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 20px;
    cursor: pointer; border-left: 3px solid transparent; transition: all 0.15s;
    position: relative; overflow: hidden; white-space: nowrap;
  }
  .sidebar.collapsed .nav-item { padding: 10px 0; justify-content: center; border-left: 3px solid transparent; }
  .nav-item:hover { background: rgba(255,255,255,0.03); }
  .nav-item.active { background: rgba(245,158,11,0.1); border-left-color: #f59e0b; }
  .nav-item .icon { font-size: 14px; opacity: 0.4; flex-shrink: 0; }
  .nav-item.active .icon { opacity: 1; color: #f59e0b; }
  .nav-item .label { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.5); transition: opacity 0.15s; }
  .nav-item.active .label { font-weight: 700; color: #fff; }
  .sidebar.collapsed .nav-item .label { opacity: 0; width: 0; overflow: hidden; }
  .nav-badge {
    margin-left: auto; background: #ef4444; color: #fff; font-size: 10px;
    font-weight: 700; padding: 2px 7px; border-radius: 10px; flex-shrink: 0;
  }
  .sidebar.collapsed .nav-badge { position: absolute; top: 4px; right: 6px; padding: 1px 5px; font-size: 9px; margin-left: 0; }
  .nav-badge.purple { background: #8b5cf6; }
  .nav-badge.info { background: rgba(6,182,212,0.25); color: rgba(255,255,255,0.85); }

  .sidebar-footer {
    margin-top: auto; padding: 12px 20px; font-size: 10px; color: rgba(255,255,255,0.2);
    border-top: 1px solid rgba(255,255,255,0.04);
    overflow: hidden; white-space: nowrap; transition: opacity 0.15s;
  }
  .sidebar.collapsed .sidebar-footer { opacity: 0; height: 0; padding: 0; border: none; margin-top: auto; }
  .sidebar-toggle {
    padding: 10px 0; display: flex; justify-content: center;
    border-top: 1px solid rgba(255,255,255,0.04); cursor: pointer;
    color: rgba(255,255,255,0.2); font-size: 14px; transition: color 0.15s;
  }
  .sidebar-toggle:hover { color: rgba(255,255,255,0.5); }
  .sidebar.collapsed .sidebar-toggle { margin-top: auto; }
  .sidebar-user {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
    font-size: 12px; color: rgba(255,255,255,0.5);
  }
  .sidebar-user-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; }
  .logout-btn {
    font-size: 11px; color: rgba(255,255,255,0.3); cursor: pointer;
    background: none; border: none; padding: 0; text-decoration: underline;
  }
  .logout-btn:hover { color: #fff; }

  /* Main */
  .main-content { flex: 1; padding: 32px 40px; overflow-y: auto; min-height: 0; }

  /* Scroll-to-top floating button (bottom-left of main-content area) */
  .scroll-top-btn {
    position: fixed; bottom: 24px; left: 240px;
    width: 44px; height: 44px; border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(20,20,28,0.85); backdrop-filter: blur(10px);
    color: rgba(255,255,255,0.75); font-size: 20px; font-weight: 700;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s, background 0.15s, color 0.15s;
    z-index: 50; box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  }
  .scroll-top-btn.visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .scroll-top-btn:hover { background: rgba(40,40,52,0.92); color: #fff; border-color: rgba(255,255,255,0.25); }

  /* ── PSD Builder ──────────────────────────────────────── */
  .psd-layout { display: grid; grid-template-columns: 240px 56px 1fr 320px; gap: 12px; height: calc(100vh - 140px); }
  .psd-ref-col { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }
  .psd-ref-col .psd-ref-box { background: rgba(10,10,16,0.7); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 10px; }
  .psd-ref-col .psd-ref-box img { display: block; width: 100%; height: auto; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
  .psd-ref-col .psd-help-box { background: rgba(15,15,22,0.6); border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 10px; font-size: 10px; color: rgba(255,255,255,0.45); line-height: 1.7; }
  .psd-tools { background: rgba(15,15,22,0.6); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .psd-tool-btn { width: 40px; height: 40px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); color: rgba(255,255,255,0.75); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: all 0.15s; }
  .psd-tool-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
  .psd-tool-btn.active { background: rgba(59,130,246,0.22); border-color: rgba(59,130,246,0.55); color: #60a5fa; box-shadow: 0 0 0 2px rgba(59,130,246,0.15) inset; }
  .psd-tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }
  .psd-tool-divider { width: 24px; height: 1px; background: rgba(255,255,255,0.08); margin: 4px 0; }
  .psd-themes-page { background: rgba(15,15,22,0.6); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 18px; }
  .psd-theme-card { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.06); background: rgba(255,255,255,0.02); cursor: pointer; transition: all 0.15s; margin-bottom: 10px; }
  .psd-theme-card:hover { background: rgba(59,130,246,0.05); border-color: rgba(59,130,246,0.3); transform: translateY(-1px); }
  .psd-theme-card-thumb { width: 64px; height: 64px; border-radius: 8px; background-size: cover; background-position: center; background-color: rgba(255,255,255,0.05); flex-shrink: 0; }
  .psd-ref-panel { background: rgba(10,10,16,0.7); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 10px; display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
  .psd-ref-panel img { border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
  .psd-anchor { position: absolute; pointer-events: auto; cursor: grab; z-index: 30; }
  .psd-anchor.dragging { cursor: grabbing; }
  .psd-anchor.selected svg { filter: drop-shadow(0 0 4px rgba(255,0,0,0.7)); }
  .psd-canvas-area { background: rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; overflow: auto; position: relative; display: block; }
  .psd-canvas-zoom-bar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: rgba(15,15,22,0.88); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(255,255,255,0.06); border-radius: 9px 9px 0 0; }
  .psd-canvas-wrap { display: flex; justify-content: center; align-items: flex-start; padding: 28px; }
  .psd-layers { background: rgba(15,15,22,0.6); border: 1px solid rgba(255,255,255,0.06); border-radius: 10px; padding: 12px; overflow-y: auto; }
  .psd-canvas { position: relative; transform-origin: top center; background: #0a0a10; box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 8px 40px rgba(0,0,0,0.6); flex-shrink: 0; }
  .psd-canvas .psd-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
  .psd-layer { position: absolute; top: 0; left: 0; transform-origin: center; cursor: grab; user-select: none; }
  .psd-layer.selected { outline: 1px solid #3b82f6; outline-offset: 0; }
  .psd-layer.dragging { cursor: grabbing; }
  .psd-layer img { display: block; pointer-events: none; max-width: none; -webkit-user-drag: none; }
  .psd-handle { position: absolute; width: 10px; height: 10px; background: #3b82f6; border: 1px solid #fff; border-radius: 2px; z-index: 10; }
  .psd-handle.tl { cursor: nwse-resize; }
  .psd-handle.tr { cursor: nesw-resize; }
  .psd-handle.bl { cursor: nesw-resize; }
  .psd-handle.br { cursor: nwse-resize; }
  .psd-toolbar { position: sticky; top: 0; background: rgba(15,15,22,0.92); backdrop-filter: blur(8px); padding: 10px 14px; border-radius: 8px; display: flex; align-items: center; gap: 14px; font-size: 12px; color: rgba(255,255,255,0.7); z-index: 20; margin-bottom: 12px; border: 1px solid rgba(255,255,255,0.06); }
  .psd-zoom-btn { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); color: rgba(255,255,255,0.75); border-radius: 6px; padding: 4px 10px; font-size: 11px; cursor: pointer; }
  .psd-zoom-btn:hover { background: rgba(255,255,255,0.12); }
  .psd-zoom-btn.active { background: rgba(59,130,246,0.25); border-color: rgba(59,130,246,0.5); color: #60a5fa; }
  .psd-group-header { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: rgba(255,255,255,0.04); border-radius: 5px; margin-bottom: 3px; cursor: pointer; font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.85); }
  .psd-group-header:hover { background: rgba(255,255,255,0.08); }
  .psd-layer-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px 5px 22px; border-radius: 5px; cursor: pointer; font-size: 11px; color: rgba(255,255,255,0.7); }
  .psd-layer-item:hover { background: rgba(255,255,255,0.04); }
  .psd-layer-item.selected { background: rgba(59,130,246,0.2); color: #93c5fd; }
  .psd-eye { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border-radius: 3px; font-size: 12px; }
  .psd-eye:hover { background: rgba(255,255,255,0.08); }
  .psd-coord { font-size: 10px; color: rgba(255,255,255,0.35); margin-left: auto; font-variant-numeric: tabular-nums; }

  /* ─── Common ─── */
  .page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 4px; }
  .page-sub { font-size: 13px; color: rgba(255,255,255,0.4); margin-bottom: 32px; }

  .card {
    background: rgba(255,255,255,0.03); border-radius: 14px;
    padding: 24px; border: 1px solid rgba(255,255,255,0.06); margin-bottom: 20px;
  }
  .card-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; }

  .badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
    letter-spacing: 0.02em; color: #fff;
  }
  .badge::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: #fff; opacity: 0.6;
  }
  .badge-draft { background: #6b7280; }
  .badge-generating { background: #f59e0b; }
  .badge-review { background: #3b82f6; }
  .badge-ad_review { background: #8b5cf6; }
  .badge-approved { background: #10b981; }
  .badge-rejected { background: #ef4444; }
  .badge-pending { background: #f59e0b; }
  .badge-delivered { background: #06b6d4; }

  .btn {
    padding: 12px 24px; border-radius: 10px; border: none; font-size: 13px;
    font-weight: 700; cursor: pointer; transition: all 0.15s; font-family: inherit;
  }
  .btn-primary { background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; }
  .btn-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }
  .btn-green { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
  .btn-yellow { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }
  .btn-red { background: linear-gradient(135deg, #ef4444, #dc2626); color: #fff; }
  .btn-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); color: #fff; }
  .btn-ghost {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); color: #fff;
  }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
  .btn-full { width: 100%; }

  .input {
    width: 100%; background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
    padding: 12px 16px; color: #fff; font-size: 14px; outline: none;
    font-family: inherit;
  }
  .input:focus { border-color: rgba(245,158,11,0.4); }

  .textarea {
    width: 100%; background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
    padding: 14px; color: rgba(255,255,255,0.8); font-size: 12px;
    font-family: monospace; resize: vertical; outline: none; min-height: 200px;
  }

  .textarea-sm { min-height: 80px; background: rgba(255,255,255,0.04); font-family: inherit; font-size: 13px; }

  /* Stats grid */
  .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
  .stat-card { padding: 20px 18px; }
  .stat-label { font-size: 12px; color: rgba(255,255,255,0.4); font-weight: 600; }
  .stat-icon { font-size: 18px; }
  .stat-value { font-size: 32px; font-weight: 800; letter-spacing: -0.04em; margin-top: 12px; }

  /* Progress bar */
  .progress { margin-bottom: 12px; }
  .progress-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
  .progress-label { font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 600; }
  .progress-count { font-size: 11px; color: rgba(255,255,255,0.7); font-weight: 700; }
  .progress-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.06); overflow: hidden; }
  .progress-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }

  /* Steps indicator */
  .steps { display: flex; gap: 4px; margin-bottom: 32px; }
  .step-dot { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.08); transition: 0.3s; }
  .step-dot.active { background: #f59e0b; }

  /* Upload slots */
  .upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
  .upload-label { font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 600; margin-bottom: 8px; }
  .upload-box {
    aspect-ratio: 1; border-radius: 12px;
    border: 2px dashed rgba(255,255,255,0.12); background: rgba(255,255,255,0.02);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 12px; color: rgba(255,255,255,0.3);
    overflow: hidden; background-size: cover; background-position: center;
  }

  /* Generated images */
  .gen-grid { display: grid; gap: 12px; margin-bottom: 20px; }
  .gen-grid img { width: 100%; border-radius: 12px; display: block; }
  .gen-item { position: relative; }
  .gen-select-btn {
    position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  }

  /* Two column layout */
  .two-col { display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; }

  /* Theme list item */
  .theme-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    border: 1px solid transparent; margin-bottom: 4px; transition: all 0.15s;
  }
  .theme-item:hover { background: rgba(255,255,255,0.03); }
  .theme-item.selected { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); }
  .theme-item.mine { background: rgba(245,158,11,0.06); border-left: 3px solid rgba(245,158,11,0.6); }
  .theme-item.mine:hover { background: rgba(245,158,11,0.10); }
  .owner-badge { display:inline-block; font-size:10px; padding:1px 6px; border-radius:4px; font-weight:600; line-height:1.5; }
  .owner-badge.is-me { background:rgba(245,158,11,0.18); color:#f59e0b; }
  .owner-badge.is-other { background:rgba(255,255,255,0.06); color:rgba(255,255,255,0.45); }
  .theme-thumb {
    width: 36px; height: 36px; border-radius: 8px;
    background: rgba(255,255,255,0.06); flex-shrink: 0;
    background-size: cover; background-position: center;
  }
  .theme-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .theme-date { font-size: 10px; color: rgba(255,255,255,0.3); }

  /* Info banner */
  .info-banner {
    border-radius: 10px; padding: 10px 16px; font-size: 12px; margin-bottom: 24px;
    line-height: 1.6;
  }
  .info-purple { background: rgba(139,92,246,0.08); border: 1px solid rgba(139,92,246,0.2); color: #a78bfa; }
  .info-cyan { background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.2); color: #67e8f9; }

  /* Table */
  .table-header {
    display: grid; grid-template-columns: 48px 1fr 120px 160px 100px; gap: 12px;
    padding: 12px 16px; background: rgba(255,255,255,0.03);
    font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.4);
  }
  .table-row {
    display: grid; grid-template-columns: 48px 1fr 120px 160px 100px; gap: 12px;
    padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.04); align-items: center;
  }
  .table-thumb {
    width: 40px; height: 40px; border-radius: 8px; background: rgba(255,255,255,0.06);
    background-size: cover; background-position: center;
  }
  .table-filename { font-size: 11px; color: rgba(255,255,255,0.4); font-family: monospace; }

  .empty { text-align: center; padding: 40px; color: rgba(255,255,255,0.2); font-size: 13px; }

  /* Layout picker */
  .layout-option {
    aspect-ratio: 3/4; border-radius: 8px; border: 2px solid rgba(255,255,255,0.08);
    background-size: cover; background-position: center; cursor: pointer;
    transition: all 0.15s; position: relative;
  }
  .layout-option:hover { border-color: rgba(245,158,11,0.4); }
  .layout-option.selected { border-color: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,0.3); }
  .layout-option .layout-label {
    position: absolute; bottom: 4px; left: 0; right: 0; text-align: center;
    font-size: 10px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  }

  /* Comment */
  .comment-item {
    background: rgba(255,255,255,0.03); border-radius: 8px;
    padding: 8px 12px; margin-bottom: 4px; font-size: 12px; color: rgba(255,255,255,0.6);
  }
  .comment-by { color: #f59e0b; font-weight: 600; }

  /* Loading spinner */
  @keyframes spin { to { transform: rotate(360deg); } }
  .spinner {
    width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #f59e0b; border-radius: 50%; animation: spin 0.8s linear infinite;
    display: inline-block; vertical-align: middle; margin-right: 8px;
  }


  /* Responsive */
  @media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .two-col { grid-template-columns: 1fr; }
  }

  /* ─── Phase 2: Batch generation UI ─── */
  .batch-size-row { display: flex; gap: 8px; margin-bottom: 12px; }
  .batch-size-btn {
    padding: 8px 16px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04); color: #fff; font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
  }
  .batch-size-btn:hover { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); }
  .batch-size-btn.active {
    background: linear-gradient(135deg, #f59e0b, #d97706); color: #000; border-color: transparent;
  }
  .warn-banner {
    border-radius: 10px; padding: 10px 16px; font-size: 12px; line-height: 1.5;
    background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); color: #fca5a5;
    margin-bottom: 12px;
  }
  .ok-banner {
    border-radius: 10px; padding: 8px 14px; font-size: 11px;
    background: rgba(16,185,129,0.08); border: 1px solid rgba(16,185,129,0.2); color: #6ee7b7;
  }

  /* Candidate gallery */
  .cand-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
  }
  .cand-item {
    position: relative; aspect-ratio: 3/4; border-radius: 10px; overflow: hidden;
    cursor: pointer; border: 2px solid rgba(255,255,255,0.06); transition: all 0.15s;
    background: rgba(0,0,0,0.3);
  }
  .cand-item:hover { border-color: rgba(245,158,11,0.4); transform: translateY(-2px); }
  .cand-item.selected { border-color: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,0.25); }
  .cand-item.cand-rejected { border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.25); }
  .cand-item.cand-rejected:hover { border-color: #ef4444; }
  .cand-item.cand-ad-review { border-color: #8b5cf6; box-shadow: 0 0 0 2px rgba(139,92,246,0.25); }
  .cand-item.cand-ad-review:hover { border-color: #8b5cf6; }
  .cand-item.cand-approved { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,0.25); }
  .cand-item.cand-approved:hover { border-color: #10b981; }
  .cand-reject-badge {
    position: absolute; bottom: 6px; left: 6px; right: 6px;
    background: rgba(239,68,68,0.85); color: #fff; padding: 4px 8px; border-radius: 6px;
    font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .cand-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .cand-meta {
    position: absolute; top: 6px; left: 6px;
    background: rgba(0,0,0,0.6); padding: 2px 8px; border-radius: 6px;
    font-size: 10px; color: rgba(255,255,255,0.8);
  }
  .cand-selected-tag {
    position: absolute; top: 6px; right: 6px;
    background: #10b981; color: #fff; padding: 3px 8px; border-radius: 6px;
    font-size: 10px; font-weight: 700;
  }

  /* Uploaded thumbnail X button */
  .upload-x-btn {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(0,0,0,0.75); color: #fff; border: none;
    cursor: pointer; font-size: 14px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    z-index: 10; padding: 0;
  }
  .upload-x-btn:hover { background: #ef4444; }
  .upload-box.compact {
    aspect-ratio: auto !important; height: 36px;
    border-radius: 8px; font-size: 11px;
  }

  /* Local edit (Phase 3) */
  .canvas-wrap {
    background: rgba(0,0,0,0.35); border-radius: 12px; padding: 8px;
    display: flex; align-items: center; justify-content: center;
    min-height: 200px;
  }
  .edit-canvas {
    max-width: 100%; height: auto; display: block;
    cursor: crosshair; border-radius: 8px;
    user-select: none; -webkit-user-drag: none;
  }
  .history-strip {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
    max-height: 360px; overflow-y: auto;
  }
  .history-item {
    cursor: pointer; border: 2px solid rgba(255,255,255,0.08);
    border-radius: 8px; overflow: hidden; background: rgba(0,0,0,0.3);
    transition: border-color 0.15s, transform 0.15s;
  }
  .history-item:hover { border-color: rgba(139,92,246,0.5); transform: translateY(-1px); }
  .history-item.selected { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,0.25); }
  .history-item img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
  .history-prompt {
    padding: 4px 6px; font-size: 10px; color: rgba(255,255,255,0.6);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }

  /* Modal */
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 32px;
  }
  .modal-image {
    max-width: 90vw; max-height: 80vh; border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  }
  .modal-actions {
    position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 12px; z-index: 10;
  }
  .modal-close {
    position: absolute; top: 24px; right: 32px;
    background: rgba(255,255,255,0.1); border: none; color: #fff;
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 18px;
  }

  /* Delete confirm modal */
  .del-modal-box {
    background: #1a1a1a; border: 1px solid rgba(239,68,68,0.4); border-radius: 14px;
    padding: 24px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  }
  .del-modal-title { font-size: 16px; font-weight: 800; color: #f87171; margin-bottom: 8px; }
  .del-modal-body { font-size: 13px; color: rgba(255,255,255,0.7); margin-bottom: 16px; line-height: 1.6; }
  .del-modal-input {
    width: 100%; padding: 10px 12px; font-size: 16px; text-align: center; letter-spacing: 4px;
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.15); border-radius: 8px;
    color: #fff; margin-bottom: 14px; font-family: monospace;
  }
  .del-modal-actions { display: flex; gap: 10px; }
