/* Genexts Design: calm & minimal, neutral greys, one teal accent, line icons */
.gd {
  --bg: #f6f7f8; --panel: #ffffff; --line: #e4e6e9; --text: #16181b; --muted: #6b7178;
  --soft: #eef0f2; --accent: #0d9488; --accent-soft: #e6f5f3; --danger: #dc2626; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text); background: var(--bg); height: 100%; display: flex; flex-direction: column; font-size: 14px;
}
.gd[data-theme="dark"] {
  --bg: #0f1113; --panel: #16191c; --line: #262a2f; --text: #e8eaed; --muted: #9aa0a6;
  --soft: #1d2125; --accent: #2dd4bf; --accent-soft: rgba(45,212,191,.12); --shadow: none;
}
.gd *, .gd *::before, .gd *::after { box-sizing: border-box; }
.gd button { font: inherit; color: inherit; cursor: pointer; }
.gd svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.gd-top { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.gd-brand { font-weight: 650; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.gd-brand .dot { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.gd-brand small { color: var(--muted); font-weight: 500; }
.gd-spacer { flex: 1; }

.gd-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); white-space: nowrap; }
.gd-btn:hover { background: var(--soft); }
.gd-btn:disabled { opacity: .45; cursor: default; }
.gd-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.gd[data-theme="dark"] .gd-btn.primary { color: #062420; }
.gd-btn.primary:hover { filter: brightness(1.05); }
.gd-btn.ghost { border-color: transparent; background: transparent; }
.gd-btn.ghost:hover { background: var(--soft); }
.gd-btn.icon { width: 32px; padding: 0; justify-content: center; }
.gd-btn.big { height: 40px; width: 100%; justify-content: center; font-weight: 600; }
.gd-btn.danger:hover { color: var(--danger); }

.gd-body { flex: 1; display: flex; min-height: 0; }
.gd-side { width: 340px; flex: none; border-right: 1px solid var(--line); background: var(--panel); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.gd-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.gd-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.gd-chip { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.gd-chip:hover { background: var(--soft); }
.gd-chip.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.gd-chip:disabled { opacity: .45; cursor: not-allowed; }
.gd-chip .tag { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.gd-chip.on .tag { background: transparent; color: inherit; }

.gd textarea, .gd input[type=text], .gd select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font: inherit; padding: 10px 12px; outline: none;
}
.gd textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.gd textarea:focus, .gd input:focus, .gd select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gd details summary { cursor: pointer; list-style: none; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.gd details summary::-webkit-details-marker { display: none; }
.gd details[open] summary { margin-bottom: 8px; }
.gd-ref { display: flex; align-items: center; gap: 8px; }
.gd-ref img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.gd-hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.gd-examples { display: flex; flex-direction: column; gap: 6px; }
.gd-examples button { text-align: left; border: 1px dashed var(--line); background: transparent; border-radius: 8px; padding: 8px 10px; color: var(--muted); font-size: 12.5px; }
.gd-examples button:hover { color: var(--text); border-color: var(--accent); }

.gd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gd-bar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); min-height: 52px; }
.gd-bar .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-bar .sub { color: var(--muted); font-size: 12.5px; }
.gd-scroll { flex: 1; overflow: auto; padding: 16px; }

.gd-empty { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); }
.gd-empty h2 { color: var(--text); font-size: 20px; margin: 12px 0 6px; font-weight: 650; letter-spacing: -.01em; }
.gd-empty .art { display: flex; gap: 8px; justify-content: center; }
.gd-empty .art span { width: 64px; height: 84px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); }
.gd-empty .art span:nth-child(2) { transform: translateY(-8px); border-color: var(--accent); }

.gd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.gd-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: border-color .15s; }
.gd-card.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.gd-card.best .gd-score { background: var(--accent); color: #fff; }
.gd-card-h { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.gd-card-h .name { font-weight: 600; font-size: 13px; }
.gd-card-h .maker { color: var(--muted); font-size: 12px; }
.gd-status { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.gd-status .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: gdpulse 1s infinite; }
.gd-status.err { color: var(--danger); }
@keyframes gdpulse { 50% { opacity: .25; } }
.gd-score { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); }
.gd-frame { position: relative; overflow: hidden; background: #fff; cursor: zoom-in; }
.gd-frame iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; pointer-events: none; background: #fff; }
.gd-frame .err { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); background: var(--panel); font-size: 13px; }
.gd-reason { padding: 8px 12px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.gd-card-f { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.gd-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.gd-check input { accent-color: var(--accent); }

/* focus / editor */
.gd-focus { flex: 1; display: flex; min-height: 0; }
.gd-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--soft); }
.gd-stage-in { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 20px; }
.gd-stage-frame { background: #fff; box-shadow: 0 2px 24px rgba(0,0,0,.08); border-radius: 6px; overflow: hidden; position: relative; transform-origin: top center; }
.gd-stage-frame iframe { border: 0; display: block; background: #fff; }
.gd-panel { width: 360px; flex: none; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.gd-tabs { display: flex; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line); }
.gd-tab { flex: 1; height: 30px; white-space: nowrap; padding: 0 6px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.gd-tab.on { background: var(--soft); color: var(--text); font-weight: 600; }
.gd-pane { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.gd-msg { padding: 9px 11px; border-radius: 10px; font-size: 13px; line-height: 1.45; }
.gd-msg.me { background: var(--accent-soft); align-self: flex-end; max-width: 90%; }
.gd-msg.bot { background: var(--soft); color: var(--muted); max-width: 95%; }
.gd-msg .sel-tag { display: inline-block; font-size: 11px; font-family: ui-monospace, monospace; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-bottom: 4px; }
.gd-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gd-mini .gd-frame { height: 120px; border-radius: 8px; border: 1px solid var(--line); }
.gd-mini .cap { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: flex; justify-content: space-between; }
.gd-compose { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.gd-compose textarea { min-height: 64px; }
.gd-compose-row { display: flex; gap: 6px; align-items: center; }
.gd-compose-row select { width: auto; flex: 1; padding: 6px 8px; font-size: 12.5px; }
.gd-selected { display: flex; align-items: center; gap: 6px; font-size: 12px; background: var(--accent-soft); color: var(--accent); padding: 5px 8px; border-radius: 8px; font-family: ui-monospace, monospace; }
.gd-selected span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.gd-ver { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.gd-ver:hover { background: var(--soft); }
.gd-ver.on { border-color: var(--accent); }
.gd-ver .n { font-weight: 600; font-size: 12.5px; }
.gd-ver .m { font-size: 12px; color: var(--muted); }
.gd-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.gd-seg button { height: 30px; width: 34px; border: 0; background: var(--panel); display: grid; place-items: center; color: var(--muted); }
.gd-seg button.on { background: var(--soft); color: var(--text); }
.gd-code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; background: var(--soft); border-radius: 10px; padding: 12px; margin: 0; max-height: 100%; overflow: auto; }

/* drawer + toast + modal */
.gd-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100%; background: var(--panel); border-left: 1px solid var(--line); box-shadow: -8px 0 32px rgba(0,0,0,.08); z-index: 50; display: flex; flex-direction: column; }
.gd-proj { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; }
.gd-proj:hover { background: var(--soft); }
.gd-proj .t { font-weight: 600; font-size: 13px; }
.gd-proj .d { font-size: 12px; color: var(--muted); }
.gd-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 10px 14px; border-radius: 10px; font-size: 13px; z-index: 60; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.gd-modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55; display: grid; place-items: center; }
.gd-modal { background: var(--panel); border-radius: 14px; width: 460px; max-width: calc(100% - 32px); padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 12px 48px rgba(0,0,0,.25); }
.gd-modal h3 { margin: 0; font-size: 16px; }
.gd-spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: gdspin .7s linear infinite; }
@keyframes gdspin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .gd-body { flex-direction: column; }
  .gd-side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); max-height: 48vh; }
  .gd-focus { flex-direction: column; }
  .gd-panel { width: auto; height: 46vh; border-left: 0; border-top: 1px solid var(--line); }
  .gd-grid { grid-template-columns: 1fr; }
}

/* inside the Genexts app (#design-view) */
.gd-host { padding: 0 !important; height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#design-root { flex: 1; min-height: 0; }
