:root {
  --bg0: #e8eef2;
  --bg1: #f4f7f9;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --ink: #0b1c24;
  --text: #15262e;
  --muted: #5c727c;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #d8f3ef;
  --border: rgba(15, 38, 46, 0.12);
  --danger: #c2314a;
  --ok: #0d8a5f;
  --sel: #14b8a6;
  --canvas: #121a1f;
  --header: #0b1c24;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Figtree", sans-serif;
  --display: "Syne", sans-serif;
  --shadow: 0 10px 28px rgba(11, 28, 36, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg0);
}

body {
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(20, 184, 166, 0.18), transparent 60%),
    radial-gradient(700px 420px at 92% 8%, rgba(15, 118, 110, 0.12), transparent 55%),
    radial-gradient(600px 400px at 50% 110%, rgba(11, 28, 36, 0.06), transparent 50%),
    linear-gradient(165deg, var(--bg1), var(--bg0));
}
.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(11, 28, 36, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 28, 36, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}

/* Header éditeur : styles délégués à nav.css (.site-header) */
.header { /* alias site-header */ }
.docs { color: #99f6e4; text-decoration: none; font-size: 0.85rem; font-weight: 600; }
.docs:hover { color: #fff; }

/* ─── Toolbar ─── */
.toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
  animation: fade-down 0.5s var(--ease) 0.05s both;
}

.toolbar-toggle {
  display: none;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.65rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
}
.toolbar-toggle .chev {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.25s var(--ease);
}
.toolbar.collapsed .toolbar-toggle .chev { transform: rotate(-135deg); }

.toolbar-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.tool-group.opts { flex: 1; min-width: 0; }

.tool-btn, .ops button, .add-row button, .nav button {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.42rem 0.72rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.tool-btn:hover, .ops button:hover, .add-row button:hover, .nav button:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}
.tool-btn:active, .ops button:active, .add-row button:active {
  transform: translateY(1px);
}
.tool-btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.18);
  color: #e2eef1;
}
.tool-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.28);
}
.tool-btn.primary-outline {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--accent-dark);
  font-weight: 600;
}

.sep {
  width: 1px;
  height: 1.55rem;
  background: var(--border);
  margin: 0 0.15rem;
}

.inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}
.inline input[type="number"] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.32rem 0.45rem;
  font: inherit;
  background: var(--surface-solid);
  width: 4.8rem;
  max-width: 6rem;
}
.inline.check { color: var(--text); }

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.52rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.btn.accent {
  background: var(--accent);
  color: #fff;
  margin-left: auto;
}
.btn.accent:hover { background: var(--accent-dark); }
.btn.accent:active { transform: translateY(1px); }
.btn.ok {
  background: var(--ok);
  color: #fff;
  margin-top: 0.5rem;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.accent-sm {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  font-size: 0.86rem;
}
.btn.accent-sm:hover { background: var(--accent-dark); }

/* ─── Mobile tabs ─── */
.mobile-tabs {
  display: none;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  gap: 0.35rem;
  flex-shrink: 0;
}
.mobile-tab {
  flex: 1;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  padding: 0.5rem 0.35rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.mobile-tab.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-color: color-mix(in srgb, var(--accent) 25%, transparent);
}

/* ─── Workspace ─── */
.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 250px) 1fr minmax(260px, 310px);
  gap: 0.75rem;
  padding: 0.75rem;
  animation: fade-up 0.5s var(--ease) 0.08s both;
}

.panel, .center {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  min-height: 0;
}

.panel {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
}

.panel-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.muted {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0.2rem 0 0.65rem;
}

.add-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}
.add-row button {
  flex: 1;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.45rem 0.35rem;
}

.elem-list {
  list-style: none;
  margin: 0.45rem 0;
  padding: 0;
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.55);
}
.elem-list li {
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
  transition: background 0.15s;
}
.elem-list li:last-child { border-bottom: none; }
.elem-list li:hover { background: var(--accent-soft); }
.elem-list li.active {
  background: var(--accent);
  color: #fff;
}
.elem-list li.hidden-el { opacity: 0.5; }

.ops { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.ops .danger {
  background: #fce9ed;
  color: var(--danger);
  border-color: #f5c2cc;
}

.center {
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
}

.canvas-wrap {
  flex: 1;
  min-height: 240px;
  background:
    radial-gradient(circle at 30% 20%, rgba(45, 212, 191, 0.06), transparent 45%),
    #0a1216;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.artboard {
  position: relative;
  background:
    radial-gradient(circle at 28% 18%, rgba(45, 212, 191, 0.1), transparent 42%),
    var(--canvas);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 520px);
  aspect-ratio: 3 / 2;
  min-width: 160px;
  min-height: 120px;
  transition: width 0.28s var(--ease), height 0.28s var(--ease);
}

.stage { position: relative; line-height: 0; display: none; width: 100%; height: 100%; }
.stage.show { display: block; }
#preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}
.overlay { position: absolute; inset: 0; }

.box {
  position: absolute;
  border: 2px dashed transparent;
  cursor: move;
  box-sizing: border-box;
}
.box.selected { border-color: var(--sel); }
.handle {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 11px;
  height: 11px;
  background: var(--sel);
  border: 1px solid #fff;
  border-radius: 2px;
  cursor: nwse-resize;
}

.align-tpl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.align-tpl button {
  flex: 1 1 30%;
  min-width: 4.2rem;
  border: 1px solid var(--border);
  background: #f4f8f9;
  border-radius: 8px;
  padding: 0.35rem 0.4rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.align-tpl button:hover {
  background: var(--accent-soft, #d8f3ef);
  border-color: var(--accent);
}

.empty {
  color: #9db0b8;
  text-align: center;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  position: absolute;
  inset: 0;
}
.empty-icon {
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.4rem;
  border-radius: 12px;
  border: 2px dashed rgba(157, 176, 184, 0.45);
  background:
    linear-gradient(135deg, transparent 46%, rgba(157, 176, 184, 0.35) 46%, rgba(157, 176, 184, 0.35) 54%, transparent 54%),
    linear-gradient(45deg, transparent 46%, rgba(157, 176, 184, 0.35) 46%, rgba(157, 176, 184, 0.35) 54%, transparent 54%);
  background-size: 12px 12px;
  background-position: center;
}
.empty strong {
  color: #d7e4e8;
  font-family: var(--display);
  font-size: 1.05rem;
}
.empty span#empty-sub,
.empty #empty-sub { font-size: 0.85rem; }
.empty.hidden { display: none; }
.empty .btn,
.empty button {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  cursor: pointer;
}

.tpl-props {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.8rem 0.9rem;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.45);
  flex-shrink: 0;
}
.tpl-props h3,
.props-subtitle {
  margin: 0 0 0.45rem;
  font-family: var(--display);
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}
.props-subtitle { margin-top: 0.15rem; }
.tpl-summary { margin: 0 0 0.65rem !important; font-size: 0.78rem !important; }
.tpl-apply {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.86rem;
}
.tpl-props .prop-row { margin-bottom: 0.4rem; }

.nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.65rem;
  flex-wrap: wrap;
}
#record-label {
  font-size: 0.88rem;
  font-weight: 600;
  flex: 1;
  text-align: center;
}

.preview-strip-wrap {
  margin-top: 0.55rem;
  border: 2px solid #c2314a;
  border-radius: 12px;
  background: color-mix(in srgb, #c2314a 6%, #fff);
  padding: 0.45rem 0.5rem 0.55rem;
}
.preview-strip-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #9b1c2e;
}
.preview-strip-head .muted { font-weight: 500; font-size: 0.72rem; color: var(--muted); }
.preview-strip {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scroll-behavior: smooth;
}
.preview-strip::-webkit-scrollbar { height: 6px; }
.preview-strip::-webkit-scrollbar-thumb {
  background: #c2314a88;
  border-radius: 4px;
}
.strip-thumb {
  flex: 0 0 auto;
  width: 72px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fff;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(11, 28, 36, 0.08);
  transition: border-color 0.15s, transform 0.15s;
}
.strip-thumb:hover { border-color: #c2314a88; transform: translateY(-1px); }
.strip-thumb.active {
  border-color: #c2314a;
  box-shadow: 0 0 0 2px color-mix(in srgb, #c2314a 35%, transparent);
}
.strip-thumb img {
  display: block;
  width: 100%;
  height: 56px;
  object-fit: contain;
  background: #f0f3f5;
}
.strip-thumb span {
  display: block;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.2rem 0.25rem;
  color: var(--muted);
}
.strip-thumb.active span { color: #9b1c2e; }

.props { flex: 1; overflow: auto; }
.prop-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.4rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.prop-row label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.prop-row input, .prop-row select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.38rem 0.45rem;
  font: inherit;
  background: var(--surface-solid);
}
.prop-row input[type="checkbox"] { width: auto; }
.prop-row input[type="color"] { padding: 0; height: 2rem; }

.photo-status { margin-top: 0.5rem; font-size: 0.8rem; }
.photo-status.ok { color: var(--ok); }
.photo-status.bad { color: var(--danger); }

.gen-panel {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--border);
}
.status-line {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.88rem;
}
.progress {
  height: 7px;
  background: rgba(11, 28, 36, 0.08);
  border-radius: 6px;
  overflow: hidden;
  margin: 0.4rem 0;
}
#gen-bar, #dl-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #2dd4bf);
  transition: width 0.2s var(--ease);
}

.error {
  background: #fff1f3;
  color: var(--danger);
  border: 1px solid #f5c2cc;
  border-radius: var(--radius-sm);
  padding: 0.6rem;
  white-space: pre-wrap;
  margin-top: 0.5rem;
  font-family: var(--font);
  font-size: 0.82rem;
}
.hidden { display: none !important; }

.status-bar {
  background: transparent;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  color: var(--muted);
  flex: 1;
  min-width: 0;
}

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border-top: 1px solid var(--border);
  padding: 0.45rem 0.95rem;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.site-copy {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  line-height: 1.35;
}

/* ─── Modals ─── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 22, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s var(--ease);
}
.modal-card {
  background: var(--surface-solid);
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 1.35rem 1.4rem;
  width: min(420px, 100%);
  box-shadow: var(--shadow);
  animation: scale-in 0.28s var(--ease);
  max-height: min(92dvh, 720px);
  overflow: auto;
}
.modal-wide { width: min(520px, 100%); }
.modal-card h3 {
  margin: 0 0 0.3rem;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.modal-card .field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0.7rem 0;
}
.modal-card .field span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.modal-card select,
.modal-card input[type="email"],
.modal-card input[type="password"],
.modal-card input[type="text"],
.modal-card input[type="search"] {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  background: #f8fbfc;
}
.modal-card select:focus,
.modal-card input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.library-card { width: min(640px, 100%); }
.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.library-head h3 { margin: 0; }
.library-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.75rem 0 0.85rem;
}
.library-pane {
  max-height: min(52vh, 420px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.library-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
}
.library-item .lib-title {
  font-weight: 650;
  color: #eef7f5;
  margin: 0;
}
.library-item .lib-meta {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  color: #8aa4ad;
}
.library-item .lib-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: stretch;
}
.library-empty {
  padding: 1.25rem 0.5rem;
  text-align: center;
  color: #8aa4ad;
  font-size: 0.92rem;
}
.library-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.65rem;
}

.solid-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.4rem, 1fr));
  gap: 0.45rem;
  margin: 0.75rem 0 0.9rem;
}
.solid-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}
.solid-swatch.active {
  border-color: #99f6e4;
  box-shadow: 0 0 0 2px rgba(45, 212, 191, 0.35);
}
.solid-preview-wrap {
  display: flex;
  justify-content: center;
  margin: 0.85rem 0 0.35rem;
}
.solid-preview {
  width: min(220px, 70%);
  aspect-ratio: 85.6 / 54;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,0.25));
}
.solid-custom-size { margin-top: 0.5rem; }
#solid-color {
  width: 100%;
  height: 2.4rem;
  padding: 0.15rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
}

.project-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: min(240px, 36vw);
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.28);
}
.project-chip-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5eead4;
  font-weight: 700;
}
.project-chip-name {
  border: 0;
  background: transparent;
  color: #eef7f5;
  font: inherit;
  font-weight: 650;
  font-size: 0.86rem;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
  text-align: left;
}
.project-chip-name:hover { color: #99f6e4; text-decoration: underline; }

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}
.auth-brand h3 { margin: 0; }

.gf-search-row { display: flex; gap: 0.4rem; margin: 0.6rem 0; }
.gf-search-row input { flex: 1; }
.gf-results {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.gf-results li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.gf-results li:last-child { border-bottom: none; }
.gf-results li:hover { background: var(--accent-soft); }
.gf-results .family { font-weight: 700; }
.gf-results .meta { color: var(--muted); font-size: 0.75rem; }
.gf-results button {
  border: 1px solid var(--border);
  background: var(--surface-solid);
  border-radius: 7px;
  padding: 0.3rem 0.55rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
}
.gf-results button:hover { background: var(--accent-soft); }

.check-inline {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
}
.check-inline span {
  text-transform: none !important;
  color: var(--text) !important;
  font-weight: 500 !important;
}

.auth-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0.75rem 0 0.5rem;
}
.auth-tab {
  flex: 1;
  border: 1px solid var(--border);
  background: #f4f8f9;
  border-radius: 9px;
  padding: 0.48rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
}
.auth-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0.85rem 0 0.35rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  transition: background 0.18s;
}
.btn-google:hover { background: #f4f8f9; }
.btn-google.disabled { opacity: 0.5; pointer-events: none; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.85rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── Animations ─── */
@keyframes fade-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(200px, 220px) 1fr minmax(240px, 280px);
  }
  .quota-hint { display: none; }
}

@media (max-width: 900px) {
  body { overflow: auto; }

  .toolbar-toggle { display: flex; }
  .toolbar.collapsed .toolbar-body { display: none; }
  .toolbar-body {
    padding-top: 0;
    flex-direction: column;
    align-items: stretch;
  }
  .tool-group, .tool-group.opts { width: 100%; }
  .sep { display: none; }
  .btn.accent {
    margin-left: 0;
    width: 100%;
    padding: 0.7rem;
  }
  .inline {
    flex: 1 1 calc(50% - 0.4rem);
    min-width: 8rem;
  }
  .inline select { max-width: none; flex: 1; }

  .mobile-tabs { display: flex; }

  .workspace {
    grid-template-columns: 1fr;
    padding: 0.55rem;
    gap: 0.55rem;
  }
  .workspace .panel.left,
  .workspace .panel.right,
  .workspace .center {
    display: none;
    min-height: min(70dvh, 640px);
  }
  .workspace[data-view="left"] .panel.left { display: flex; }
  .workspace[data-view="center"] .center { display: flex; }
  .workspace[data-view="right"] .panel.right { display: flex; }

  .canvas-wrap { min-height: 52dvh; }
  .prop-row { grid-template-columns: 90px 1fr; }
}

@media (max-width: 520px) {
  .header-actions .tool-btn:not(.ghost) { font-size: 0.8rem; padding: 0.38rem 0.55rem; }
  .add-row { flex-wrap: wrap; }
  .add-row button { flex: 1 1 calc(50% - 0.35rem); }
  .modal-card { padding: 1.1rem; border-radius: 14px; }
  .nav { justify-content: space-between; }
  #record-label { flex: 1 1 100%; order: -1; margin-bottom: 0.15rem; }
}

@media (min-width: 901px) {
  .toolbar.collapsed .toolbar-body { display: flex !important; }
}
