/* ============================================================
   Webhook Studio — Dark Navy Theme
   Sections: tokens · base · layout · sidebar · topbar · tabs
   · fields · buttons · panels · embeds · components · preview
   · files · toasts · modals · context menu · responsive
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  --bg-0: #08111f;
  --bg-1: #0b1628;
  --bg-2: #13233d;
  --bg-3: #182c4a;
  --line: rgba(120, 160, 220, 0.14);
  --line-strong: rgba(120, 160, 220, 0.28);

  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.16);

  --txt: #e6edf7;
  --txt-dim: #9fb0c9;
  --txt-mut: #6b7d99;

  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --danger: #f43f5e;

  --radius: 14px;
  --radius-lg: 18px;
  --radius-sm: 10px;

  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 4px 18px rgba(0, 0, 0, 0.3);
  --glass: rgba(19, 35, 61, 0.55);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
  --t: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-anim="off"] * { transition: none !important; animation: none !important; }

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--txt);
  background:
    radial-gradient(1200px 700px at 15% -10%, #16294a 0%, transparent 55%),
    radial-gradient(1000px 600px at 100% 0%, #102038 0%, transparent 50%),
    var(--bg-0);
  background-color: var(--bg-0);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
::selection { background: var(--accent-soft); }
a { color: var(--accent-2); }
kbd {
  font-family: var(--mono); font-size: 11px;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px 6px;
}
code {
  font-family: var(--mono); font-size: 0.85em;
  background: rgba(0,0,0,0.25); padding: 1px 5px; border-radius: 5px;
}
.muted { color: var(--txt-mut); }
.small { font-size: 12px; }
.hint { font-size: 12px; color: var(--txt-dim); }
.grow { flex: 1 1 auto; min-width: 0; }
.push-right { margin-left: auto; }

/* custom scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--bg-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--bg-2); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; }
.main { display: flex; flex-direction: column; min-width: 0; }
.workspace { display: grid; grid-template-columns: 1fr 420px; flex: 1; min-height: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px; gap: 22px;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--accent-soft); border: 1px solid var(--line-strong);
  border-radius: 12px; box-shadow: var(--shadow-soft);
}
.brand-title { font-weight: 800; font-size: 15px; letter-spacing: 0.2px; }
.brand-sub { font-size: 11px; color: var(--txt-mut); display: block; }
.sidebar__nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; color: var(--txt-dim);
  font: inherit; font-weight: 600; cursor: pointer; text-align: left;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.nav-item:hover { background: var(--bg-2); color: var(--txt); }
.nav-item.is-active {
  background: var(--accent-soft); color: #fff; border-color: var(--line-strong);
}
.nav-ico { width: 20px; text-align: center; font-size: 15px; }
.nav-badge {
  margin-left: auto; background: var(--bg-3); color: var(--txt-dim);
  font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
}
.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: rgba(11, 22, 40, 0.7); backdrop-filter: blur(12px);
}
.topbar__spacer { flex: 1; }
.topbar__target {
  display: flex; align-items: center; gap: 9px;
  background: var(--bg-1); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; min-width: 220px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--txt-mut); flex: none; box-shadow: 0 0 0 3px rgba(0,0,0,0.2); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(34,197,94,0.18); }
.dot.err { background: var(--err); box-shadow: 0 0 0 3px rgba(239,68,68,0.18); }
.target-select { background: transparent; border: none; color: var(--txt); font: inherit; font-weight: 600; outline: none; flex: 1; cursor: pointer; }
.target-select option { background: var(--bg-1); }

/* ---------- Buttons ---------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer; color: var(--txt);
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: var(--radius-sm);
  transition: transform var(--t), background var(--t), border-color var(--t), box-shadow var(--t);
  white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.btn:hover { background: var(--bg-3); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(59,130,246,0.35); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { color: #fff; background: linear-gradient(180deg, #fb7185, var(--danger)); border-color: transparent; }
.btn.small { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn.is-loading { position: relative; color: transparent !important; }
.btn.is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  background: var(--bg-2); border: 1px solid var(--line); color: var(--txt-dim);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 15px;
  display: grid; place-items: center; transition: var(--t);
}
.icon-btn:hover { color: var(--txt); background: var(--bg-3); }
.file-label { cursor: pointer; }
.only-mobile { display: none; }

/* ---------- Views / tabs ---------- */
.editor { overflow-y: auto; padding: 18px; min-width: 0; }
.view { display: none; }
.view.is-active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.tabs { display: flex; gap: 4px; background: var(--bg-1); padding: 5px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tab {
  font: inherit; font-weight: 600; color: var(--txt-dim); background: transparent;
  border: none; padding: 8px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 7px; transition: var(--t);
}
.tab:hover { color: var(--txt); }
.tab.is-active { background: var(--accent-soft); color: #fff; }
.count-pill { background: var(--bg-3); border-radius: 999px; font-size: 11px; padding: 0 7px; min-width: 18px; text-align: center; }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fade 0.2s ease; }

/* ---------- Panels & fields ---------- */
.panel { padding: 18px; border-radius: var(--radius); margin-bottom: 16px; }
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(14px); box-shadow: var(--shadow-soft); }
.panel__title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--txt-dim); margin-bottom: 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field__label { font-size: 12px; font-weight: 600; color: var(--txt-dim); display: flex; justify-content: space-between; align-items: center; }
.counter, .field__label .counter { font-weight: 500; color: var(--txt-mut); font-size: 11px; }
input, textarea, select {
  font: inherit; color: var(--txt); background: var(--bg-0);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; outline: none; width: 100%;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 60px; }
.mini-select { width: auto; }
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.toolbar.wrap { flex-wrap: wrap; }
.empty { text-align: center; color: var(--txt-mut); padding: 40px 20px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* switches */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-weight: 500; }
.switch input { display: none; }
.switch__track { width: 40px; height: 22px; border-radius: 999px; background: var(--bg-3); position: relative; transition: var(--t); flex: none; border: 1px solid var(--line); }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--txt-dim); transition: var(--t); }
.switch input:checked + .switch__track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(18px); background: #fff; }
.switch.small { font-size: 12.5px; }
.switch.small .switch__track { width: 34px; height: 19px; }
.switch.small .switch__track::after { width: 13px; height: 13px; }
.switch.small input:checked + .switch__track::after { transform: translateX(15px); }

/* collapsible */
.collapsible { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; margin-top: 14px; }
.collapsible summary { padding: 11px 14px; cursor: pointer; font-weight: 600; color: var(--txt-dim); list-style: none; user-select: none; }
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::before { content: "▸ "; color: var(--accent-2); }
.collapsible[open] summary::before { content: "▾ "; }
.collapsible__body { padding: 0 14px 14px; }

/* ---------- Embed cards ---------- */
.embed-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-1); overflow: hidden; border-left: 4px solid var(--accent); }
.embed-card.dragging { opacity: 0.5; }
.embed-card__head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-2); cursor: grab; }
.embed-card__head .drag { color: var(--txt-mut); cursor: grab; }
.embed-card__title { font-weight: 700; flex: 1; }
.embed-card__actions { display: flex; gap: 6px; }
.mini-btn { background: transparent; border: 1px solid var(--line); color: var(--txt-dim); width: 28px; height: 28px; border-radius: 7px; cursor: pointer; display: grid; place-items: center; transition: var(--t); }
.mini-btn:hover { color: var(--txt); background: var(--bg-3); }
.mini-btn.danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.embed-card__body { padding: 14px; }
.embed-card.collapsed .embed-card__body { display: none; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 46px; height: 38px; padding: 2px; cursor: pointer; }
.fields-head { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 10px; }
.embed-field { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; background: var(--bg-0); }
.embed-field__top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.embed-field .drag { cursor: grab; color: var(--txt-mut); }

/* ---------- Inline warning banner ---------- */
.inline-warn {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd9a0; border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 14px; font-size: 13px;
}
.inline-warn::before { content: "⚠"; font-size: 15px; line-height: 1.2; }
.inline-warn.ok { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: #a7e8bd; }
.inline-warn.ok::before { content: "✔"; }

/* ---------- Component tree ---------- */
.comp {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-1); overflow: hidden;
}
.comp.dragging { opacity: 0.5; }
.comp__head { display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: var(--bg-2); }
.comp__head .drag { cursor: grab; color: var(--txt-mut); }
.comp__type { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent-2); }
.comp__name { color: var(--txt-dim); font-size: 12px; }
.comp__actions { margin-left: auto; display: flex; gap: 6px; }
.comp__body { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
#componentTree.is-disabled { opacity: 0.45; pointer-events: none; filter: grayscale(0.4); user-select: none; }
.comp--container { border-left: 4px solid var(--accent); }
.comp__children { display: flex; flex-direction: column; gap: 10px; padding-left: 8px; border-left: 2px dashed var(--line); margin-left: 4px; }
.comp__add-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Discord preview ---------- */
.preview-col { background: #1a1c22; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.preview-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.preview-title { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--txt-dim); }
.discord-preview { flex: 1; overflow-y: auto; padding: 16px; background: #313338; font-size: 15px; }
.preview-col.hidden { display: none; }

.dmsg { display: flex; gap: 16px; padding: 4px 0; }
.dmsg__avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; background: var(--accent); object-fit: cover; overflow: hidden; }
.dmsg__body { min-width: 0; flex: 1; }
.dmsg__head { display: flex; align-items: baseline; gap: 8px; }
.dmsg__name { font-weight: 600; color: #f2f3f5; }
.dmsg__bot { background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 4px; text-transform: uppercase; position: relative; top: -1px; }
.dmsg__time { font-size: 12px; color: #949ba4; }
.dmsg__content { color: #dbdee1; white-space: pre-wrap; word-wrap: break-word; margin-top: 2px; }
.dmsg__content strong { font-weight: 700; }
.dmsg__content em { font-style: italic; }
.dmsg__content code { background: #2b2d31; color: #dbdee1; }
.dmsg__content a { color: #00a8fc; text-decoration: none; }
.dmsg__content .mention { background: rgba(88,101,242,0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px; }

.d-embed { margin-top: 8px; max-width: 520px; background: #2b2d31; border-radius: 4px; border-left: 4px solid var(--accent); padding: 12px 16px 12px 12px; display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.d-embed__main { min-width: 0; }
.d-embed__author { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: #f2f3f5; }
.d-embed__author img { width: 20px; height: 20px; border-radius: 50%; }
.d-embed__title { font-weight: 600; color: #f2f3f5; margin-bottom: 4px; }
.d-embed__title a { color: #00a8fc; }
.d-embed__desc { color: #dbdee1; font-size: 14px; white-space: pre-wrap; word-wrap: break-word; }
.d-embed__fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(100%, 1fr)); gap: 8px; margin-top: 8px; }
.d-embed__fields.has-inline { grid-template-columns: repeat(3, 1fr); }
.d-embed__field { font-size: 14px; min-width: 0; }
.d-embed__field.inline { grid-column: span 1; }
.d-embed__field.block { grid-column: 1 / -1; }
.d-embed__field-name { font-weight: 600; color: #f2f3f5; margin-bottom: 2px; }
.d-embed__field-val { color: #dbdee1; white-space: pre-wrap; }
.d-embed__image { margin-top: 8px; border-radius: 4px; max-width: 100%; max-height: 300px; }
.d-embed__thumb { width: 80px; height: 80px; border-radius: 4px; object-fit: cover; }
.d-embed__footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: #949ba4; }
.d-embed__footer img { width: 20px; height: 20px; border-radius: 50%; }

.d-components { margin-top: 8px; max-width: 520px; display: flex; flex-direction: column; gap: 8px; }
.d-container { background: #2b2d31; border-radius: 6px; border-left: 4px solid var(--accent); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.d-section { display: flex; gap: 12px; align-items: flex-start; }
.d-section__text { flex: 1; color: #dbdee1; white-space: pre-wrap; }
.d-actionrow { display: flex; flex-wrap: wrap; gap: 8px; }
.d-btn { border: none; border-radius: 4px; padding: 8px 16px; font-weight: 500; font-size: 14px; color: #fff; cursor: default; font-family: inherit; }
.d-btn.primary { background: #5865f2; }
.d-btn.secondary { background: #4e5058; }
.d-btn.success { background: #248046; }
.d-btn.danger { background: #da373c; }
.d-btn.link { background: #4e5058; }
.d-btn.premium { background: #3a2e5c; }
.d-select { background: #1e1f22; border: 1px solid #1e1f22; border-radius: 4px; padding: 10px 12px; color: #949ba4; font-size: 14px; display: flex; justify-content: space-between; }
.d-separator { height: 1px; background: rgba(255,255,255,0.08); margin: 4px 0; }
.d-separator.spacer { background: transparent; height: 12px; }
.d-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.d-gallery img { width: 100%; border-radius: 4px; max-height: 180px; object-fit: cover; }
.d-media-img { max-width: 100%; border-radius: 6px; max-height: 300px; }
.d-attach { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.d-attach__file { background: #2b2d31; border: 1px solid rgba(255,255,255,0.06); border-radius: 8px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; max-width: 400px; }
.d-attach__file .fico { font-size: 22px; }
.d-attach img.thumb { max-width: 400px; border-radius: 8px; }

/* ---------- Files ---------- */
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 30px; text-align: center; cursor: pointer; transition: var(--t); margin-bottom: 14px; }
.dropzone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone__ico { font-size: 30px; color: var(--accent-2); }
.file-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-1); }
.file-item__thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--bg-3); display: grid; place-items: center; font-size: 20px; flex: none; }
.file-item__meta { flex: 1; min-width: 0; }
.file-item__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item__size { font-size: 12px; color: var(--txt-mut); }
.file-item__bar { height: 4px; background: var(--bg-3); border-radius: 4px; overflow: hidden; margin-top: 5px; }
.file-item__bar > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.2s; }

/* list cards (webhooks, templates, history) */
.list-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-1); transition: var(--t); }
.list-card:hover { border-color: var(--line-strong); background: var(--bg-2); }
.list-card__main { flex: 1; min-width: 0; }
.list-card__title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.list-card__sub { font-size: 12px; color: var(--txt-mut); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-card__actions { display: flex; gap: 6px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg-3); color: var(--txt-dim); font-weight: 600; }
.star { cursor: pointer; color: var(--txt-mut); font-size: 16px; }
.star.on { color: #fbbf24; }
.badge-ok { color: var(--ok); } .badge-err { color: var(--err); }

/* ---------- JSON editor ---------- */
.code { font-family: var(--mono); font-size: 13px; line-height: 1.55; min-height: 420px; background: var(--bg-0); tab-size: 2; }
.json-status { margin-top: 10px; font-family: var(--mono); font-size: 12.5px; padding: 8px 12px; border-radius: 8px; display: none; }
.json-status.ok { display: block; background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.3); }
.json-status.err { display: block; background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px;
  border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); animation: toastIn 0.3s cubic-bezier(0.2,0.9,0.3,1);
  border-left: 4px solid var(--accent);
}
.toast.leaving { animation: toastOut 0.25s forwards; }
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast__ico { font-size: 18px; line-height: 1.2; }
.toast__body { flex: 1; }
.toast__title { font-weight: 700; }
.toast__msg { font-size: 12.5px; color: var(--txt-dim); word-break: break-word; }
.toast__close { background: none; border: none; color: var(--txt-mut); cursor: pointer; font-size: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ---------- Modals ---------- */
.modal-root { position: fixed; inset: 0; z-index: 900; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-root.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,9,18,0.7); backdrop-filter: blur(4px); animation: fade 0.2s; }
.modal {
  position: relative; background: var(--bg-1); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); width: 100%; max-width: 440px;
  padding: 22px; animation: modalIn 0.25s cubic-bezier(0.2,0.9,0.3,1);
}
.modal.wide { max-width: 640px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal__title { font-size: 17px; font-weight: 800; margin-bottom: 6px; }
.modal__msg { color: var(--txt-dim); margin-bottom: 16px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Context menu ---------- */
.context-menu {
  position: fixed; z-index: 1100; background: var(--bg-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px; min-width: 170px;
  animation: fade 0.12s;
}
.context-menu button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; background: none; border: none; color: var(--txt); font: inherit; cursor: pointer; text-align: left; }
.context-menu button:hover { background: var(--accent-soft); }
.context-menu button.danger:hover { background: var(--danger); color: #fff; }
.context-menu hr { border: none; border-top: 1px solid var(--line); margin: 5px 2px; }

/* ---------- Compact mode ---------- */
[data-compact="on"] .panel { padding: 12px; }
[data-compact="on"] .field, [data-compact="on"] .field-grid { margin-bottom: 10px; }
[data-compact="on"] input, [data-compact="on"] textarea, [data-compact="on"] select { padding: 7px 10px; }
[data-compact="on"] .editor { padding: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-col { position: fixed; inset: 0; z-index: 800; }
  .preview-col:not(.floating) { display: none; }
}
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; z-index: 850; transform: translateX(-100%); transition: transform var(--t); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .only-mobile { display: grid; }
  .field-grid { grid-template-columns: 1fr; }
}
