:root {
      --primary: #059669;
      --primary-hover: #047857;
      --surface: #ffffff;
      --bg: #f8fafc;
      --text: #0f172a;
      --text-muted: #64748b;
      --border: #e2e8f0;
      --radius-lg: 16px;
      --radius-md: 10px;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; }
    body {
      font-family: sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.5;
    }
    header {
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      position: sticky;
      top: 0;
      z-index: 100;
      padding: 0.75rem 1.5rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .brand {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      text-decoration: none;
      color: inherit;
    }
    .brand-icon {
      width: 36px;
      height: 36px;
      background: #ea580c;
      color: white;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      font-size: 1.1rem;
    }
    .brand-title { font-weight: 800; font-size: 1.15rem; color: #0f172a; }
    .brand-badge {
      font-size: 0.75rem;
      background: #ecfdf5;
      color: #059669;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 6px;
      border: 1px solid #a7f3d0;
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      gap: 4px;
    }
    .nav-links { display: flex; align-items: center; gap: 0.85rem; }
    .nav-btn {
      text-decoration: none;
      color: var(--text-muted);
      font-size: 0.88rem;
      font-weight: 600;
      padding: 0.45rem 0.85rem;
      border-radius: 6px;
    }
    .nav-btn.primary { background: #ea580c; color: white; font-weight: 700; }

    .hero-sec {
      max-width: 960px;
      margin: 2.5rem auto 1.5rem auto;
      padding: 0 1.25rem;
      text-align: center;
    }
    .hero-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: 0.82rem;
      font-weight: 700;
      color: #047857;
      background: #d1fae5;
      padding: 4px 12px;
      border-radius: 20px;
      margin-bottom: 0.75rem;
      border: 1px solid #a7f3d0;
    }
    .hero-title {
      font-size: 2.2rem;
      font-weight: 800;
      color: #0f172a;
      line-height: 1.25;
      margin-bottom: 0.5rem;
    }
    .hero-sub {
      font-size: 1rem;
      color: var(--text-muted);
      max-width: 650px;
      margin: 0 auto;
    }

    .app-box {
      max-width: 1080px;
      margin: 2rem auto;
      background: var(--surface);
      border-radius: var(--radius-lg);
      border: 1px solid var(--border);
      box-shadow: 0 10px 25px -5px rgba(0,0,0,0.06);
      padding: 2rem;
    }
    .dropzone {
      border: 2px dashed #cbd5e1;
      border-radius: var(--radius-md);
      padding: 3.5rem 1.5rem;
      text-align: center;
      cursor: pointer;
      background: #f8fafc;
      position: relative;
    }
    .dropzone:hover { border-color: var(--primary); background: #f0fdf4; }
    .dropzone input {
      position: absolute;
      inset: 0;
      opacity: 0;
      cursor: pointer;
      width: 100%;
      height: 100%;
    }

    .workspace-wrap {
      display: grid;
      grid-template-columns: 360px 1fr;
      gap: 1.5rem;
    }
    @media (max-width: 880px) {
      .workspace-wrap { grid-template-columns: 1fr; }
    }

    /* Top Demo & Upload Toolbar */
    .preview-toolbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 0.75rem;
      background: #f8fafc;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 0.75rem 1rem;
      margin-bottom: 1.25rem;
    }
    .demo-selector-group {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }
    .demo-toolbar-label {
      font-size: 0.82rem;
      font-weight: 700;
      color: #475569;
      display: flex;
      align-items: center;
      gap: 4px;
    }
    .demo-tab-btn {
      padding: 0.38rem 0.85rem;
      font-size: 0.82rem;
      font-weight: 700;
      border: 1px solid #cbd5e1;
      border-radius: 20px;
      background: #ffffff;
      color: #334155;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 5px;
      transition: all 0.2s ease;
    }
    .demo-tab-btn:hover {
      border-color: #059669;
      color: #059669;
      background: #f0fdf4;
    }
    .demo-tab-btn.active {
      background: #059669;
      border-color: #059669;
      color: #ffffff;
      box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
    }
    .btn-upload-trigger {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 0.45rem 1rem;
      background: #ffffff;
      border: 1.5px dashed #059669;
      border-radius: 8px;
      color: #059669;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .btn-upload-trigger:hover {
      background: #ecfdf5;
      border-style: solid;
      box-shadow: 0 2px 8px rgba(5, 150, 105, 0.15);
    }

    .config-card {
      background: #f8fafc;
      border: 1px solid var(--border);
      border-radius: var(--radius-md);
      padding: 1.25rem;
      display: flex;
      flex-direction: column;
      gap: 1.1rem;
    }
    .form-group label {
      display: block;
      font-size: 0.82rem;
      font-weight: 700;
      color: #334155;
      margin-bottom: 0.35rem;
    }
    .form-input {
      width: 100%;
      padding: 0.55rem 0.75rem;
      border: 1px solid #cbd5e1;
      border-radius: 6px;
      font-size: 0.88rem;
    }
    .form-input:focus {
      outline: none;
      border-color: #059669;
      box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
    }

    /* Quick preset watermark text chips */
    .quick-tags-wrap {
      display: flex;
      flex-wrap: wrap;
      gap: 0.38rem;
      margin-top: 0.45rem;
    }
    .quick-tag {
      font-size: 0.72rem;
      background: #ffffff;
      border: 1px solid #cbd5e1;
      padding: 2px 7px;
      border-radius: 4px;
      color: #475569;
      cursor: pointer;
      transition: all 0.15s ease;
      user-select: none;
    }
    .quick-tag:hover {
      border-color: #059669;
      color: #059669;
      background: #f0fdf4;
    }

    /* Watermark Color Swatches */
    .color-swatches {
      display: flex;
      gap: 0.6rem;
      align-items: center;
      margin-top: 0.25rem;
    }
    .color-dot {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      cursor: pointer;
      border: 2px solid #e2e8f0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    }
    .color-dot:hover {
      transform: scale(1.12);
    }
    .color-dot.active {
      border-color: #059669;
      box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.4);
    }
    .color-dot-white { background: #ffffff; }
    .color-dot-black { background: #0f172a; }
    .color-dot-red { background: #dc2626; }
    .color-dot-blue { background: #2563eb; }

    .slider-row {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .slider-row input[type="range"] {
      flex: 1;
      accent-color: #059669;
    }

    /* Preview Board Container */
    .preview-board-wrap {
      display: flex;
      flex-direction: column;
      gap: 0.6rem;
    }
    .preview-board-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 0.82rem;
      color: #64748b;
      padding: 0 0.25rem;
    }
    .preview-board {
      background: #f1f5f9;
      border: 2px dashed #cbd5e1;
      border-radius: var(--radius-md);
      padding: 1.25rem;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 480px;
      max-height: 600px;
      overflow: hidden;
      position: relative;
      transition: border-color 0.2s ease, background-color 0.2s ease;
    }
    .preview-board.drag-over {
      border-color: #059669;
      background: #ecfdf5;
    }
    #previewCanvas {
      max-width: 100%;
      max-height: 520px;
      border-radius: 6px;
      box-shadow: 0 6px 20px rgba(0,0,0,0.12);
      object-fit: contain;
    }
    .preview-demo-tag {
      position: absolute;
      top: 12px;
      right: 12px;
      background: rgba(15, 23, 42, 0.75);
      backdrop-filter: blur(6px);
      color: #f8fafc;
      font-size: 0.74rem;
      font-weight: 600;
      padding: 4px 10px;
      border-radius: 20px;
      pointer-events: none;
      display: flex;
      align-items: center;
      gap: 5px;
    }

    .btn-download {
      background: linear-gradient(135deg, #059669, #047857);
      color: white;
      font-weight: 700;
      padding: 0.8rem 1.5rem;
      border-radius: 8px;
      border: none;
      cursor: pointer;
      width: 100%;
      font-size: 0.95rem;
      box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
      transition: all 0.2s ease;
    }
    .btn-download:hover {
      box-shadow: 0 6px 16px rgba(5, 150, 105, 0.4);
      transform: translateY(-1px);
    }
  
    /* Header Actions & Country Selector */
    .header-actions {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }
    .select-pill {
      padding: 0.42rem 0.75rem;
      border: 1px solid var(--border, #cbd5e1);
      border-radius: 9999px;
      background: var(--surface, #ffffff);
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--text, #0f172a);
      outline: none;
      cursor: pointer;
      box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    }
    .country-selector {
      min-width: 82px;
    }

    /* Safety Studio Dual Tab Bar (Segmented Pill) */
    .safety-tab-bar {
      display: flex;
      gap: 6px;
      background: #f1f5f9;
      padding: 4px;
      border-radius: 12px;
      border: 1px solid #e2e8f0;
      margin-bottom: 0.85rem;
      width: 100%;
    }
    .safety-tab-btn {
      flex: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 7px 12px;
      border: none;
      border-radius: 9px;
      background: transparent;
      color: #64748b;
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
      user-select: none;
    }
    .safety-tab-btn:hover {
      color: #0f172a;
      background: rgba(255, 255, 255, 0.6);
    }
    .safety-tab-btn.active {
      background: #ffffff;
      color: #0f172a;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
    }
    .safety-tab-btn .tab-btn-icon {
      font-size: 0.95rem;
      line-height: 1;
    }

    /* Redact Panel inside Watermark Sidebar */
    .redact-tab-panel {
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }
    .redact-mode-group {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 6px;
      margin-bottom: 0.5rem;
    }
    .redact-mode-btn {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      padding: 8px 4px;
      background: #f8fafc;
      border: 1.5px solid #e2e8f0;
      border-radius: 8px;
      font-size: 0.78rem;
      font-weight: 700;
      color: #475569;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .redact-mode-btn:hover {
      border-color: #cbd5e1;
      background: #f1f5f9;
      color: #0f172a;
    }
    .redact-mode-btn.active {
      border-color: #0f172a;
      background: #ffffff;
      color: #0f172a;
      box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }
    .redact-undo-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      width: 100%;
      padding: 7px;
      border: 1px solid #e2e8f0;
      border-radius: 8px;
      background: #f8fafc;
      color: #475569;
      font-size: 0.82rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.15s ease;
      margin-top: 0.25rem;
    }
    .redact-undo-btn:hover:not(:disabled) {
      background: #eff6ff;
      border-color: #bfdbfe;
      color: #2563eb;
    }
    .redact-undo-btn:disabled {
      opacity: 0.45;
      cursor: not-allowed;
    }