/* ============================================================
   ULTIMATE IMAGE TOOLKIT — Orely-Inspired Redesign
   Layout: Left sidebar (layer tree) + Center canvas + Right inspector
   Aesthetic: Light mode · Premium · Clean · clean precision
   Fonts: Plus Jakarta Sans (UI) + Instrument Serif (display accents)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Instrument+Serif:ital@0;1&display=swap');

/* ── Design Tokens ── */
:root {
  /* Core surfaces */
  --bg:             #f0eff5;
  --bg-2:           #e8e7ef;
  --surface:        #ffffff;
  --surface-2:      #f7f7fb;
  --surface-3:      #f0eff7;

  /* Borders */
  --border:         rgba(0,0,0,0.07);
  --border-2:       rgba(0,0,0,0.12);
  --border-3:       rgba(0,0,0,0.18);

  /* Brand / accent */
  --accent:         #6366f1;       /* indigo — primary */
  --accent-2:       #8b5cf6;       /* violet */
  --accent-hover:   #4f51de;
  --accent-soft:    rgba(99,102,241,0.09);
  --accent-border:  rgba(99,102,241,0.22);
  --accent-text:    #4338ca;

  /* Semantic palette */
  --teal:     #0d9488;
  --teal-s:   rgba(13,148,136,0.1);
  --amber:    #d97706;
  --amber-s:  rgba(217,119,6,0.1);
  --rose:     #e11d48;
  --rose-s:   rgba(225,29,72,0.1);
  --green:    #059669;
  --green-s:  rgba(5,150,105,0.1);
  --violet:   #7c3aed;
  --violet-s: rgba(124,58,237,0.1);
  --sky:      #0284c7;
  --sky-s:    rgba(2,132,199,0.1);
  --orange:   #ea580c;
  --orange-s: rgba(234,88,12,0.1);

  /* Text */
  --t1: #111118;
  --t2: #5c5b6e;
  --t3: #9998b0;
  --t4: #c4c3d4;

  /* Layout dimensions — matching Orely exactly */
  --hdr-h:        52px;    /* slim top toolbar */
  --sidebar-w:    220px;   /* left panel width */
  --inspector-w:  260px;   /* right inspector panel */

  /* Radii */
  --r1: 4px;
  --r2: 6px;
  --r3: 10px;
  --r4: 14px;
  --r5: 20px;

  /* Shadows */
  --s1: 0 1px 2px rgba(0,0,0,0.06);
  --s2: 0 2px 8px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.05);
  --s3: 0 8px 28px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  --s4: 0 20px 60px rgba(0,0,0,0.12), 0 6px 20px rgba(0,0,0,0.07);

  /* Fonts */
  --f-ui:      'Plus Jakarta Sans', system-ui, sans-serif;
  --f-display: 'Instrument Serif', Georgia, serif;

  /* Motion */
  --ease: cubic-bezier(0.16,1,0.3,1);
  --tf:   all 0.13s cubic-bezier(0.16,1,0.3,1);
  --tm:   all 0.24s cubic-bezier(0.16,1,0.3,1);

  /* Legacy compat aliases */
  --text-1: var(--t1);
  --text-2: var(--t2);
  --text-3: var(--t3);
  --font-display: var(--f-display);
  --font-body: var(--f-ui);
  --ok: var(--green);
  --warn: var(--amber);
  --bad: var(--rose);
  --emerald: var(--green);
  --emerald-soft: var(--green-s);
  --rose-soft: var(--rose-s);
  --accent-soft: rgba(99,102,241,0.09);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--f-ui);
  background: var(--bg);
  color: var(--t1);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════════════════════════════
   APP SHELL — Orely 3-column layout
   [sidebar] [main canvas] [inspector]
   with sticky header spanning full width
═══════════════════════════════════════════ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--hdr-h) 1fr;
  min-height: 100vh;
  position: relative;
}

/* ═══════════════════════════════════════════
   TOP TOOLBAR (Orely-style slim header)
   Full-width, spans all 3 columns
═══════════════════════════════════════════ */
.app-header {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: center;
  height: var(--hdr-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 300;
  box-shadow: var(--s1);
}

/* Left zone: logo + project breadcrumb */
.header-left {
  display: flex;
  align-items: center;
  gap: 0;
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 0 14px;
  border-right: 1px solid var(--border);
  height: 100%;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo-mark {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: var(--r2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-ui);
  font-weight: 800;
  font-size: 11px;
  color: #fff;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.header-logo-text { display: flex; flex-direction: column; }
.header-logo-name { font-size: 12.5px; font-weight: 700; color: var(--t1); line-height: 1.1; letter-spacing: -0.02em; }
.header-logo-sub  { font-size: 9.5px; font-weight: 500; color: var(--t3); letter-spacing: 0.05em; text-transform: uppercase; }

/* Center zone: toolbar icons + tool name */
.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 16px;
  height: 100%;
}

/* Toolbar action buttons (like Orely's icon row) */
.toolbar-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r2);
  border: none;
  background: transparent;
  color: var(--t2);
  cursor: pointer;
  transition: var(--tf);
  flex-shrink: 0;
}

.toolbar-btn:hover { background: var(--bg); color: var(--t1); }
.toolbar-btn.active { background: var(--accent-soft); color: var(--accent); }

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: var(--border-2);
  margin: 0 6px;
  flex-shrink: 0;
}

.header-tool-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  padding: 0 10px;
  letter-spacing: -0.01em;
}

/* Right zone: avatar + actions + zoom */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  width: var(--inspector-w);
  flex-shrink: 0;
  padding: 0 14px;
  border-left: 1px solid var(--border);
  height: 100%;
  justify-content: flex-end;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r5);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-text);
}

.header-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--t2);
  font-weight: 600;
}

.header-stat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 0 2px rgba(5,150,105,0.2); }
  50%      { box-shadow: 0 0 0 4px rgba(5,150,105,0.08); }
}

/* Share button (like Orely's purple Share btn) */
.btn-share {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r2);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--tf);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.btn-share:hover { background: var(--accent-hover); }

/* Hamburger (mobile only) */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: var(--r2);
  cursor: pointer;
}

.hamburger span { display: block; width: 14px; height: 1.5px; background: var(--t2); border-radius: 2px; }
.hamburger:hover { background: var(--bg); }

/* ═══════════════════════════════════════════
   LEFT SIDEBAR — Layer tree panel (Orely left panel)
   Search + collapsible sections + nav items
═══════════════════════════════════════════ */
.app-sidebar {
  grid-row: 2;
  grid-column: 1;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: calc(100vh - var(--hdr-h));
  position: sticky;
  top: var(--hdr-h);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border-2) transparent;
}

.app-sidebar::-webkit-scrollbar { width: 3px; }
.app-sidebar::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 2px; }

/* Search bar at top of sidebar (Orely style) */
.sidebar-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--f-ui);
  font-size: 12px;
  color: var(--t1);
  placeholder-color: var(--t3);
}

.sidebar-search input::placeholder { color: var(--t3); }

.sidebar-search-icon { width: 13px; height: 13px; stroke: var(--t3); flex-shrink: 0; }

.sidebar-search-hint {
  font-size: 10px;
  color: var(--t4);
  font-weight: 600;
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r1);
  padding: 1px 5px;
}

/* Section label (like "Pages / Design") */
.sidebar-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--t3);
  user-select: none;
  flex-shrink: 0;
}

.sidebar-section-add {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r1);
  cursor: pointer;
  color: var(--t3);
  transition: var(--tf);
}

.sidebar-section-add:hover { background: var(--bg); color: var(--t1); }

/* Nav list */
.sidebar-nav { list-style: none; padding: 0 6px; }
.sidebar-nav-item { display: block; }

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5.5px 8px;
  border-radius: var(--r2);
  font-size: 12px;
  font-weight: 500;
  color: var(--t2);
  text-decoration: none;
  transition: var(--tf);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.sidebar-nav-link:hover { background: var(--bg); color: var(--t1); }

.sidebar-nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.sidebar-nav-link.active .sidebar-icon { stroke: var(--accent); }

.sidebar-icon {
  width: 13px; height: 13px;
  stroke: currentColor;
  flex-shrink: 0;
  opacity: 0.75;
}

.sidebar-nav-link:hover .sidebar-icon,
.sidebar-nav-link.active .sidebar-icon { opacity: 1; }

/* Indent levels (like Orely's tree hierarchy) */
.sidebar-nav-link.lvl-1 { padding-left: 20px; }
.sidebar-nav-link.lvl-2 { padding-left: 32px; }

/* Sidebar folder chevron */
.sidebar-chevron {
  width: 10px; height: 10px;
  stroke: var(--t3);
  flex-shrink: 0;
  margin-right: -3px;
  transition: transform 0.15s ease;
}

.sidebar-nav-link.open .sidebar-chevron { transform: rotate(90deg); }

/* Sidebar new tag */
.sidebar-new-tag {
  margin-left: auto;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-text);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  padding: 1px 5px;
  border-radius: 10px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Sidebar ad zone */
.sidebar-ad-zone {
  margin: auto 10px 12px;
  background: var(--bg);
  border: 1px dashed var(--border-2);
  border-radius: var(--r3);
  min-height: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--t4);
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  gap: 3px;
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 250;
  opacity: 0;
  transition: opacity 0.22s ease;
  pointer-events: none;
}



.sidebar-backdrop.active { opacity: 1; pointer-events: all; }

/* ═══════════════════════════════════════════
   CENTER CANVAS / MAIN CONTENT
   This is the active tool workspace (Orely center)
═══════════════════════════════════════════ */
.app-main {
  grid-column: 2;
  grid-row: 2;
  min-height: calc(100vh - var(--hdr-h));
  background: var(--bg);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Tool breadcrumb bar (below header, above canvas) */
.tool-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  height: 36px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tool-topbar-label {
  font-size: 11px;
  color: var(--t3);
  font-weight: 500;
}

.tool-topbar-name {
  font-size: 11px;
  color: var(--t1);
  font-weight: 600;
}

.tool-topbar-sep { font-size: 11px; color: var(--t4); }

/* Page / canvas area */
.page {
  padding: 24px 24px 32px;
  flex: 1;
}

/* ── Page Hero (tool title block) ── */
.page-hero {
  margin-bottom: 20px;
}

.page-title {
  font-family: var(--f-ui);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--t1);
  margin-bottom: 3px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 12px;
  color: var(--t2);
  line-height: 1.55;
}

/* Legacy breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--t3);
  margin-bottom: 16px;
}

.breadcrumb a { color: var(--t3); text-decoration: none; transition: var(--tf); }
.breadcrumb a:hover { color: var(--t2); }
.breadcrumb span { color: var(--t2); font-weight: 600; }

/* ── Tool Grid ── */
.tool-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  align-items: start;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  padding: 18px;
  box-shadow: var(--s1);
  transition: var(--tm);
}

.card:hover { box-shadow: var(--s2); }

.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ── Upload Zone ── */
.upload-zone {
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r3);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--tm);
  background: var(--bg);
  position: relative;
}

.upload-zone input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-icon { width: 30px; height: 30px; stroke: var(--t3); margin: 0 auto 10px; display: block; }
.upload-zone:hover .upload-icon, .upload-zone.drag-over .upload-icon { stroke: var(--accent); }

.upload-title { font-weight: 700; font-size: 13px; color: var(--t1); margin-bottom: 3px; }
.upload-hint { font-size: 11px; color: var(--t3); }
.upload-hint span { color: var(--accent); font-weight: 700; cursor: pointer; }

/* ── Preview Area ── */
.preview-area {
  min-height: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.preview-area img, .preview-area canvas {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: var(--r2);
}

.preview-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--t3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.preview-empty-icon { width: 34px; height: 34px; stroke: var(--t4); }
.preview-empty span { font-size: 12px; }

/* ── Form Controls ── */
.control-group { margin-bottom: 12px; }

.control-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--t3);
  margin-bottom: 5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

select, input[type="text"], input[type="number"], textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r2);
  padding: 7px 10px;
  font-family: var(--f-ui);
  font-size: 12px;
  color: var(--t1);
  transition: var(--tf);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' viewBox='0 0 10 6'%3E%3Cpath stroke='%239998b0' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
  cursor: pointer;
}

select:focus, input[type="text"]:focus, input[type="number"]:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
  background: var(--surface);
}

/* Range slider */
.range-row { display: flex; align-items: center; gap: 9px; }

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--bg-2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(99,102,241,0.35);
  transition: var(--tf);
}

input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.control-value { font-size: 11px; font-weight: 700; color: var(--accent-text); min-width: 32px; text-align: right; }

/* Checkbox */
.check-row { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12px; color: var(--t2); font-weight: 500; }
.check-row input[type="checkbox"] { width: 13px; height: 13px; accent-color: var(--accent); cursor: pointer; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: var(--r2);
  font-family: var(--f-ui);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: var(--tf);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn:disabled { opacity: 0.38; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 4px rgba(99,102,241,0.28); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 3px 10px rgba(99,102,241,0.32); transform: translateY(-1px); }

.btn-secondary { background: var(--surface); color: var(--t1); border: 1px solid var(--border-2); box-shadow: var(--s1); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); border-color: var(--border-3); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #047857; transform: translateY(-1px); }

.btn-ghost { background: transparent; color: var(--t2); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); color: var(--t1); }

.btn-lg { padding: 9px 20px; font-size: 13px; border-radius: var(--r3); }
.btn-sm { padding: 4px 10px; font-size: 11px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Status Messages ── */
.status-msg {
  padding: 8px 11px;
  border-radius: var(--r2);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-msg.ok  { background: var(--green-s); color: var(--green); border: 1px solid rgba(5,150,105,0.18); }
.status-msg.err { background: var(--rose-s); color: var(--rose); border: 1px solid rgba(225,29,72,0.18); }
.status-msg.info { background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-border); }

/* ═══════════════════════════════════════════
   AD ZONES
═══════════════════════════════════════════ */
.ad-zone {
  background: var(--bg);
  border: 1px dashed var(--border-2);
  border-radius: var(--r3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t4);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ad-zone-tool-top { height: 64px; margin-bottom: 20px; }
.ad-zone-tool-bottom { height: 64px; margin-top: 20px; }

/* ═══════════════════════════════════════════
   INDEX / DASHBOARD — Hero + tool cards
═══════════════════════════════════════════ */
.hero-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-kicker::before {
  content: '';
  display: block;
  width: 12px;
  height: 1.5px;
  background: var(--accent);
  border-radius: 1px;
}

.hero-headline {
  font-family: var(--f-ui);
  font-size: clamp(28px, 3.2vw, 46px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--t1);
  line-height: 1.07;
  margin-bottom: 14px;
}

.hero-body {
  font-size: 13.5px;
  color: var(--t2);
  line-height: 1.65;
  max-width: 480px;
}

.hero-cta-row { display: flex; align-items: center; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* Stat bar */
.stat-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  overflow: hidden;
  margin: 24px 0;
}

.stat-cell {
  background: var(--surface);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: var(--tf);
}

.stat-cell:hover { background: var(--surface-2); }

.stat-value {
  font-family: var(--f-ui);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent);
  line-height: 1;
}

.stat-label { font-size: 11px; color: var(--t3); font-weight: 600; }

/* Trust bar */
.trust-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 11px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.trust-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--t2); font-weight: 600; }
.trust-icon { width: 12px; height: 12px; color: var(--green); flex-shrink: 0; }

/* Section headers */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  margin-top: 32px;
}

.section-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--t1);
}

.section-count {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--t3);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

/* Feature strip */
.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 32px;
}

.feature-strip-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--tm);
}

.feature-strip-item:hover { border-color: var(--accent-border); box-shadow: var(--s2); }

.feature-strip-icon {
  width: 34px; height: 34px;
  border-radius: var(--r2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.feature-strip-title { font-size: 13px; font-weight: 700; color: var(--t1); letter-spacing: -0.01em; }
.feature-strip-desc { font-size: 11.5px; color: var(--t2); line-height: 1.55; }

/* Dashboard tool grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 9px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r4);
  padding: 16px;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: var(--tm);
  position: relative;
  overflow: hidden;
}

.tool-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--s2);
  transform: translateY(-2px);
}

.tool-card-icon {
  width: 34px; height: 34px;
  border-radius: var(--r2);
  display: flex; align-items: center; justify-content: center;
}

.tool-card-name { font-size: 12.5px; font-weight: 700; color: var(--t1); letter-spacing: -0.02em; }
.tool-card-desc { font-size: 11px; color: var(--t2); line-height: 1.5; }

.tool-card-arrow {
  font-size: 13px;
  color: var(--t4);
  margin-top: auto;
  transition: var(--tf);
}

.tool-card:hover .tool-card-arrow { color: var(--accent); transform: translateX(3px); }

/* Designer featured */
.designer-featured {
  background: linear-gradient(135deg, var(--accent-soft) 0%, rgba(124,58,237,0.05) 50%, rgba(13,148,136,0.04) 100%);
  border: 1px solid var(--accent-border);
  border-radius: var(--r5);
  padding: 26px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  text-decoration: none;
  transition: var(--tm);
}

.designer-featured:hover { border-color: var(--accent); box-shadow: var(--s3); transform: translateY(-2px); }

.designer-featured-title { font-size: 22px; font-weight: 800; letter-spacing: -0.04em; color: var(--t1); margin-bottom: 6px; }
.designer-featured-desc { font-size: 12.5px; color: var(--t2); line-height: 1.6; max-width: 460px; }
.designer-featured-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

.designer-tag {
  padding: 3px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 10.5px;
  color: var(--t2);
  font-weight: 700;
}

.designer-featured-cta { display: flex; align-items: center; white-space: nowrap; }

/* Feature tag */
.feature-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.feature-tag-new { background: var(--accent-soft); color: var(--accent-text); border: 1px solid var(--accent-border); }

/* Meta table */
.meta-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.meta-table tr { border-bottom: 1px solid var(--border); }
.meta-table tr:last-child { border-bottom: none; }
.meta-table td { padding: 7px 0; vertical-align: middle; }
.meta-table td:first-child { color: var(--t2); font-weight: 600; width: 48%; }
.meta-table td:last-child { color: var(--t1); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* Footer */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--t3);
  background: var(--surface);
  flex-wrap: wrap;
  gap: 8px;
}

.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--t3); text-decoration: none; font-weight: 600; transition: var(--tf); }
.footer-links a:hover { color: var(--t1); }

/* Spacing helpers */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* Text helpers */
.text-sm { font-size: 11px; }
.text-muted { color: var(--t3); }

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */
@media (max-width: 1100px) {
}

@media (max-width: 960px) {
  .app-shell { grid-template-columns: var(--sidebar-w) 1fr; }
  
  .header-left { border-right: none; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }

  .header-left { width: auto; }

  .app-sidebar {
    position: fixed;
    top: var(--hdr-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--hdr-h));
    z-index: 260;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--s4);
  }

  .app-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { display: block; }
  .app-main { grid-column: 1; }
  .hamburger { display: flex; }
  .feature-strip { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr; }
  .page { padding: 18px 16px; }
  .stat-bar { grid-template-columns: 1fr 1fr; }
  .designer-featured { grid-template-columns: 1fr; }
  .designer-featured-cta { display: none; }
  .trust-bar { padding: 10px 16px; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .hero-cta-row { flex-direction: column; align-items: flex-start; }
}

/* ═══════════════════════════════════════════
   UTILITY & COMPONENT ADDITIONS
   Missing classes used across tool pages
═══════════════════════════════════════════ */

/* ── Flex utilities ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }

/* ── Spacing additions ── */
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mt-4  { margin-top: 4px; }
.w-full { width: 100%; }

/* ── Toggle Switch ── */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-track {
  width: 34px;
  height: 18px;
  border-radius: 9px;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  position: relative;
  transition: var(--tf);
  flex-shrink: 0;
}

.toggle-track.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 0.15s var(--ease);
}

.toggle-track.on .toggle-thumb {
  transform: translateX(16px);
}

/* ── Chip / Badge ── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--r5);
  font-size: 10.5px;
  font-weight: 700;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  color: var(--t2);
  letter-spacing: 0.02em;
}

.chip-accent {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent-text);
}

/* ── Button additions ── */
.btn-danger {
  background: var(--rose);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: #be123c; transform: translateY(-1px); }

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--r2);
  flex-shrink: 0;
}

/* ── Base64 Textarea ── */
.b64-textarea {
  width: 100%;
  min-height: 120px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  line-height: 1.5;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r2);
  padding: 9px 11px;
  color: var(--t1);
  outline: none;
  transition: var(--tf);
}
.b64-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
  background: var(--surface);
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r2);
  padding: 3px;
  margin-bottom: 14px;
}

.tab-btn {
  flex: 1;
  padding: 5px 10px;
  border-radius: var(--r1);
  border: none;
  background: transparent;
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--t2);
  cursor: pointer;
  transition: var(--tf);
}

.tab-btn.active {
  background: var(--surface);
  color: var(--accent-text);
  box-shadow: var(--s1);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Progress Bar ── */
.progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: var(--bg-2);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s ease;
}

/* ── Merge image grid ── */
.merge-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

/* ── Palette row ── */
.palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── Crop UI ── */
.crop-container {
  position: relative;
  display: inline-block;
  cursor: crosshair;
  user-select: none;
}

.crop-selection {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.42);
  pointer-events: none;
}

/* ── Tool button (icon-only toolbar) ── */
.tool-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r2);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--t2);
  cursor: pointer;
  transition: var(--tf);
  flex-shrink: 0;
}

.tool-btn:hover { background: var(--bg); color: var(--t1); border-color: var(--border-3); }
.tool-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }

/* ── Right section (inspector-style panels) ── */
.right-section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.right-section:last-child { border-bottom: none; }
.right-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--t3);
  margin-bottom: 8px;
}

/* ── Designer layout ── */
.designer-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--hdr-h));
  overflow: hidden;
}

.designer-top-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.designer-workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.designer-left-panel {
  width: 44px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  gap: 4px;
  flex-shrink: 0;
}

.designer-canvas-area {
  flex: 1;
  overflow: auto;
  background: repeating-conic-gradient(var(--bg-2) 0% 25%, var(--bg) 0% 50%) 0 0 / 14px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.designer-canvas-wrap { position: relative; display: inline-block; }

.designer-right-panel {
  width: 180px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 10px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.designer-sep {
  width: 1px;
  height: 22px;
  background: var(--border-2);
  margin: 0 4px;
  flex-shrink: 0;
}

/* ── Sidebar container passthrough (allows .app-sidebar to participate in grid) ── */
#sidebarContainer {
  display: contents;
}
