/* ──────────────── Editor shell ──────────────── */
/* Background editor for index.php (guest mode) and workspace pages.
   See docs/DECISIONS.md ADR-005. Brand tokens come from brand.css. */

.editor {
  position: fixed; inset: 0;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--rail-w);
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas:
    "sidebar topbar topbar"
    "sidebar canvas rail";
  background: var(--bg);
}

/* Topbar */
.topbar {
  grid-area: topbar;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  background: white;
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 20px; }
.workspace-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: none;
  font-size: 13px; font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.workspace-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.topbar-search { flex: 0 1 380px; position: relative; }
.topbar-search input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg);
  font-family: inherit; font-size: 13px;
  color: var(--ink); outline: none;
  transition: all 0.15s var(--easing);
}
.topbar-search input:focus { border-color: var(--accent); background: white; box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-search i {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); background: transparent; border: none;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.icon-btn.has-badge { position: relative; }
.icon-btn.has-badge::after {
  content: ''; position: absolute; top: 6px; left: 8px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px;
}

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  background: white;
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 4px;
  overflow-y: auto;
}
.sb-btn {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: var(--muted); background: transparent; border: none;
  font-size: 9px; font-weight: 500; font-family: inherit;
  text-decoration: none;
  transition: all 0.15s;
  cursor: pointer; position: relative;
}
.sb-btn i { font-size: 17px; }
.sb-btn:hover { background: var(--bg); color: var(--ink); }
.sb-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.sb-btn.active::before {
  content: ''; position: absolute; right: -16px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 24px; background: var(--gradient); border-radius: 0 0 0 3px;
}
.sb-divider { width: 32px; height: 1px; background: var(--line); margin: 8px 0; }
.sb-spacer { flex: 1; }
.sb-pro {
  width: 56px; padding: 8px 6px;
  background: var(--gradient);
  border-radius: 14px;
  color: white; text-decoration: none;
  font-size: 9px; font-weight: 700; text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-glow);
}
.sb-pro i { display: block; font-size: 14px; margin-bottom: 4px; }

/* Canvas */
.canvas {
  grid-area: canvas;
  background: var(--bg-canvas);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.canvas-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px;
  background: rgba(255,255,255,0.5);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.canvas-toolbar-left { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.canvas-toolbar-left .crumb { color: var(--ink); font-weight: 500; }
.canvas-toolbar-right { display: flex; align-items: center; gap: 4px; }
.tb-btn {
  padding: 6px 10px; border-radius: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ink-2); cursor: pointer;
  background: transparent; border: none; font-family: inherit;
  transition: all 0.15s;
}
.tb-btn:hover { background: white; color: var(--ink); }
.tb-btn.primary { background: var(--gradient); color: white; padding: 8px 14px; font-weight: 600; }
.tb-btn.primary:hover { transform: translateY(-1px); }

.canvas-stage {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 50%, transparent 0%, rgba(255,176,32,0.04) 100%),
    repeating-conic-gradient(#ede7e0 0% 25%, #f5f0e8 0% 50%) 0 0 / 28px 28px;
  position: relative;
  padding: 40px;
}
.canvas-stage img {
  max-width: 90%; max-height: 90%;
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.18);
}
.canvas-floating-tip {
  position: absolute;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: white;
  padding: 8px 16px; border-radius: var(--r-pill);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-2);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.canvas-floating-tip i { color: var(--accent); }

/* Right rail */
.rail {
  grid-area: rail;
  background: white;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.rail-tabs { display: flex; border-bottom: 1px solid var(--line); }
.rail-tab {
  flex: 1; padding: 14px 0;
  background: none; border: none;
  text-align: center;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
}
.rail-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.rail-tab:hover:not(.active) { color: var(--ink-2); }
.rail-body { flex: 1; overflow-y: auto; padding: 18px; }
.rail-section { margin-bottom: 22px; }
.rail-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--muted);
  margin-bottom: 10px;
}
.preset-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.preset {
  padding: 10px 4px; text-align: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 10px; color: var(--ink-2);
  cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.preset i { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.preset:hover { border-color: var(--accent); color: var(--accent); }
.preset.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.preset.active i, .preset:hover i { color: var(--accent); }
.slider-row { margin-bottom: 12px; }
.slider-head { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; }
.slider-head .lab { color: var(--ink); font-weight: 500; }
.slider-head .val { color: var(--accent); font-weight: 600; font-variant-numeric: tabular-nums; }
.slider-track { height: 4px; background: var(--line); border-radius: 2px; position: relative; cursor: pointer; }
.slider-track .fill { position: absolute; top: 0; right: 0; height: 100%; background: var(--gradient); border-radius: 2px; }
.slider-track .thumb {
  position: absolute; top: 50%; transform: translate(50%, -50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: white; border: 2px solid var(--accent);
  box-shadow: 0 2px 6px var(--accent-glow);
}

@media (max-width: 1024px) {
  :root { --rail-w: 280px; }
}
@media (max-width: 768px) {
  .editor {
    grid-template-columns: 56px 1fr;
    grid-template-areas: "topbar topbar" "sidebar canvas";
  }
  :root { --sidebar-w: 56px; }
  .rail { display: none; }
  .topbar-search { display: none; }
}
