/* Discohook Puni — original stylesheet. App chrome uses a dark blue-gray
   "primary" palette with a sky-blue accent (referencing discohook.app);
   the preview column keeps authentic Discord colors. */
:root {
  --bg: #161b25; --panel: #1e2635; --panel2: #273144; --input: #12161f;
  --text: #dbe4f0; --muted: #93a4bb; --accent: #58b9ff; --accent-dark: #0a1622;
  --border: #33415c; --blurple: #5865f2;
  --ok: #57f287; --bad: #ed4245; --warn: #fee75c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "gg sans", "Segoe UI", system-ui, sans-serif; font-size: 14px; }
button, input, select, textarea { font: inherit; color: var(--text); }
input[type="text"], input[type="password"], input[type="number"], input[type="datetime-local"], select, textarea {
  background: var(--input); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; width: 100%;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(88,185,255,.25); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Icons (inline SVG sprite, currentColor) */
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3.5px; }
.ic-sm { width: 14px; height: 14px; vertical-align: -2.5px; }
.ic-lg { width: 24px; height: 24px; }
.ic-logo { width: 26px; height: 26px; vertical-align: middle; }
.hbtn, .btn, .seg-btn, .chip, .tab-btn, .tab-main { display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.tab-btn, .btn.tiny { gap: 4px; }
.btn.icon-only, .hbtn.icon-only { padding: 5px 7px; }
.card > summary, .embed-card > summary { display: flex; align-items: center; gap: 8px; }
.card-head h3 { display: inline-flex; align-items: center; gap: 8px; }
.att-file { display: inline-flex; color: var(--muted); }
.drag-handle { display: inline-flex; color: var(--muted); cursor: grab; }
.dc-select-arrow, .btn-ext { display: inline-flex; align-items: center; }
label { display: block; margin: 8px 0; color: var(--muted); font-size: 13px; }
label > input, label > textarea, label > select { margin-top: 4px; color: var(--text); }
input[type="color"] { width: 38px; height: 32px; padding: 2px; background: var(--input); border: 1px solid var(--border); border-radius: 6px; }
.hidden { display: none !important; }
.hint { color: var(--muted); font-size: 12.5px; margin: 6px 0; }
.hint.warn, .warn { color: var(--warn); }
.hint.pad, .pad { padding: 8px; }
.count { color: var(--muted); font-size: 12px; font-weight: normal; }
.count.over, .over { color: var(--bad) !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }

/* Header */
.app-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 16px; background: #1b2331; border-bottom: 1px solid var(--border); flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-logo { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; background: rgba(88,185,255,.14); color: var(--accent); border: 1px solid rgba(88,185,255,.35); }
.brand-name { font-size: 20px; font-weight: 800; color: #fff; }
.brand-note { color: var(--muted); font-size: 12px; }
.header-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.hbtn { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.hbtn:hover { background: #303c52; border-color: var(--accent); }
.hbtn.danger { color: #ff8a8d; }
.notice { background: #2e4a34; color: #c8f5d6; padding: 9px 16px; font-size: 13.5px; }
.notice.error { background: #4a2e2e; color: #f5c8c8; }

/* Layout */
.layout { display: grid; grid-template-columns: 55fr 45fr; gap: 16px; padding: 16px; align-items: start; max-width: 1800px; margin: 0 auto; }
.editor { border-right: 1px solid var(--border); padding-right: 16px; }
@media (max-width: 980px) { .editor { border-right: none; padding-right: 0; } }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }
body.viewer .editor { display: none; }
body.viewer .layout { grid-template-columns: 1fr; max-width: 860px; }

/* Cards & editor */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.card > summary, .embed-card > summary { padding: 10px 14px; cursor: pointer; font-weight: 700; color: #eaf2fb; list-style: none; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.embed-card > summary { text-transform: none; letter-spacing: 0; font-size: 14px; }
.card-body { padding: 6px 14px 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px 0; }
.card-head h3 { margin: 0; color: #eaf2fb; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.btn { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
.btn:hover { background: #303c52; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.tiny { padding: 2px 7px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-dark); font-weight: 700; }
.btn.primary:hover { background: #7cc7ff; }
.btn.danger { color: #ff8a8d; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.check { display: inline-flex; align-items: center; gap: 6px; margin: 4px 10px 4px 0; color: var(--text); }
.check input { width: auto; }
.checks { display: flex; flex-wrap: wrap; }
.am-box { border: 1px solid var(--border); border-radius: 8px; margin: 10px 0; }
.am-box legend { color: var(--muted); font-size: 12.5px; padding: 0 6px; }

/* Message tabs */
.msg-tabs-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; flex-wrap: wrap; }
.msg-tabs { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.msg-tab { display: flex; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.msg-tab.active { border-color: var(--accent); }
.tab-main { background: none; border: none; padding: 7px 8px; cursor: pointer; font-weight: 600; }
.tab-btn { background: none; border: none; border-left: 1px solid var(--border); padding: 7px 6px; cursor: pointer; color: var(--muted); }
.tab-check { margin: 0 0 0 6px; }
.tab-check input { width: auto; }
.status-chip { font-size: 11px; padding: 1px 7px; border-radius: 20px; font-weight: 700; }
.status-chip.draft { background: #4e5058; color: #e3e5e8; }
.status-chip.ready { background: #b8860b; color: #fff8e1; }
.status-chip.sent { background: #248046; color: #d9fbe7; }
.msg-meta { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.msg-meta label { flex: 1; margin: 0; }

/* Webhook */
.wh-row { display: flex; gap: 6px; margin-top: 4px; }
.wh-row input { flex: 1; }

/* Chips */
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.chip { background: var(--panel2); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; cursor: pointer; font-size: 12.5px; }
.chip:hover { border-color: var(--accent); }
.chip.var { border-style: dashed; }

/* Attachments */
.drop-zone { border: 2px dashed var(--border); border-radius: 8px; padding: 16px; text-align: center; color: var(--muted); }
.drop-zone.drag { border-color: var(--accent); color: var(--text); }
.file-label { display: inline-block; cursor: pointer; }
.att-list { margin-top: 8px; }
.att-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel2); border-radius: 8px; margin-bottom: 6px; }
.att-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; }
.att-name { flex: 1; word-break: break-all; }

/* Embeds */
.embed-card { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; margin: 10px; }
.embed-actions { float: right; display: inline-flex; gap: 4px; }
.color-row { display: inline-flex; gap: 6px; align-items: center; margin-top: 4px; }
.color-row input[type="text"] { width: 100px; }
.palette, .brand-dots { display: inline-flex; gap: 4px; margin-left: 6px; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); cursor: pointer; padding: 0; }
.dot.big { width: 26px; height: 26px; }
.fields-box { border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin: 8px 0; }
.fields-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.field-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.field-row input[type="text"] { flex: 1; min-width: 110px; }
.field-row .poll-emoji { flex: 0 0 74px; min-width: 74px; }

/* V2 builder */
.presets-row, .v2-add-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.v2-add-row select { width: auto; }
.tree-title { color: var(--muted); font-size: 13px; margin: 12px 0 6px; }
.v2-tree { background: var(--input); border: 1px solid var(--border); border-radius: 8px; padding: 6px 0; max-height: 190px; overflow: auto; margin-bottom: 10px; }
.tree-row { padding: 3px 8px; cursor: pointer; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-row:hover { background: var(--panel2); }
.comp-card { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; }
.comp-card.locked { opacity: .75; border-style: dashed; }
.comp-card.flash { outline: 2px solid var(--accent); }
.comp-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 7px 10px; background: rgba(0,0,0,.18); border-radius: 8px 8px 0 0; cursor: grab; }
.comp-actions { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.comp-body { padding: 6px 10px 10px; }
.comp-children { margin: 8px 0 0 10px; border-left: 2px solid var(--border); padding-left: 10px; }
.child-add { display: flex; gap: 6px; margin: 6px 0; }
.child-add select { width: auto; }
.gallery-items .field-row input { min-width: 90px; }

/* Send */
.send-status { white-space: pre-wrap; margin-top: 10px; font-size: 13.5px; }
.send-status.ok { color: var(--ok); }
.send-status.error { color: #ff9c9f; }
.req-history { max-height: 180px; overflow: auto; }
.req-item { display: flex; gap: 10px; padding: 4px 8px; border-radius: 6px; background: var(--panel2); margin-bottom: 4px; font-size: 12.5px; flex-wrap: wrap; }
.req-item.ok { border-left: 3px solid var(--ok); }
.req-item.bad { border-left: 3px solid var(--bad); }
.sched-row input[type="number"] { width: 90px; }

/* Preview */
.preview-col { position: sticky; top: 74px; }
@media (max-width: 980px) { .preview-col { position: static; } }
.preview-controls { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { background: none; border: none; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.seg-btn.active { background: var(--accent); color: var(--accent-dark); font-weight: 700; }
.preview-wrap { border-radius: 10px; padding: 18px 14px; border: 1px solid var(--border); transition: max-width .2s; }
.preview-wrap.dark { background: #313338; }
.preview-wrap.light { background: #ffffff; color: #2e3338; }
.preview-wrap.mobile { max-width: 390px; margin: 0 auto; }
.dc-msg { display: flex; gap: 12px; }
.dc-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.dc-body { flex: 1; min-width: 0; }
.dc-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.dc-name { font-weight: 700; color: #fff; }
.preview-wrap.light .dc-name { color: #060607; }
.dc-badge { background: var(--blurple); color: #fff; font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.dc-time { color: #949ba4; font-size: 12px; }
.dc-content { margin: 3px 0 6px; line-height: 1.45; word-break: break-word; }
.dc-content p { margin: 2px 0; }
.md-h { color: #fff; margin: 6px 0 2px; }
.preview-wrap.light .md-h { color: #060607; }
.md-code { background: rgba(0,0,0,.3); padding: 1px 5px; border-radius: 4px; font-family: Consolas, monospace; font-size: 13px; }
.md-codeblock { background: #2b2d31; border: 1px solid #1e1f22; border-radius: 6px; padding: 8px 10px; overflow-x: auto; font-family: Consolas, monospace; font-size: 13px; }
.preview-wrap.light .md-codeblock { background: #f2f3f5; border-color: #e3e5e8; }
.md-emoji { width: 20px; height: 20px; vertical-align: -4px; }
.md-mention { background: rgba(88,101,242,.3); color: #c9cdfb; border-radius: 3px; padding: 0 3px; font-weight: 600; }
.md-timestamp { background: rgba(255,255,255,.08); border-radius: 3px; padding: 0 3px; }
.spoiler { background: #1e1f22; color: transparent; border-radius: 4px; padding: 0 3px; cursor: pointer; }
.spoiler:hover { color: var(--text); }
blockquote { border-left: 4px solid #4e5058; margin: 4px 0; padding: 2px 0 2px 10px; color: var(--muted); }
.dc-embed { background: #2b2d31; border-left: 4px solid #202225; border-radius: 6px; padding: 12px; margin: 6px 0; max-width: 520px; }
.preview-wrap.light .dc-embed { background: #f2f3f5; }
.dc-embed-main { display: flex; gap: 12px; }
.dc-embed-text { flex: 1; min-width: 0; }
.dc-author { display: flex; gap: 7px; align-items: center; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.dc-author img { width: 22px; height: 22px; border-radius: 50%; }
.dc-title { font-weight: 800; color: #fff; margin-bottom: 4px; }
.preview-wrap.light .dc-title { color: #060607; }
.dc-title a { color: #00a8fc; text-decoration: none; }
.dc-desc { font-size: 13.8px; line-height: 1.45; word-break: break-word; }
.dc-desc p { margin: 2px 0; }
.dc-fields { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
.dc-field { width: 100%; }
.dc-field.inline { width: calc(33.3% - 8px); min-width: 110px; }
.dc-field-name { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.dc-field-value { font-size: 13.5px; }
.dc-image { max-width: 100%; border-radius: 6px; margin-top: 10px; }
.dc-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; flex: none; }
.dc-footer { display: flex; gap: 6px; align-items: center; margin-top: 9px; font-size: 12px; color: var(--muted); }
.dc-footer img { width: 18px; height: 18px; border-radius: 50%; }
.dc-files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dc-att-img { max-width: 300px; max-height: 240px; border-radius: 8px; }
.dc-poll { background: #2b2d31; border-radius: 8px; padding: 12px; margin: 6px 0; max-width: 460px; }
.dc-poll-q { font-weight: 700; margin-bottom: 8px; }
.dc-poll-a { background: #1e1f22; border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; position: relative; }
.pv-warn { background: #4a3e2e; color: #ffe1a8; border-radius: 6px; padding: 8px 10px; margin-top: 8px; font-size: 13px; }

/* V2 preview */
.v2-container { background: rgba(0,0,0,.16); border-left: 4px solid var(--blurple); border-radius: 6px; padding: 10px 12px; margin: 6px 0; max-width: 520px; }
.preview-wrap.light .v2-container { background: #f2f3f5; }
.v2-spoiler-tag { font-size: 10.5px; color: var(--warn); font-weight: 700; }
.v2-text p { margin: 2px 0; }
.v2-sep.spacing-1 { padding: 4px 0; } .v2-sep.spacing-2 { padding: 10px 0; }
.v2-sep hr { border: none; border-top: 1px solid rgba(255,255,255,.14); margin: 0; }
.v2-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin: 6px 0; }
.v2-gallery img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; }
.v2-section { display: flex; gap: 12px; }
.v2-section-texts { flex: 1; min-width: 0; }
.v2-thumb { width: 88px; height: 88px; object-fit: cover; border-radius: 8px; }
.v2-file { background: #2b2d31; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; display: inline-block; margin: 4px 0; }
.v2-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; align-items: flex-start; }
.dc-button { border: none; border-radius: 5px; padding: 8px 14px; font-weight: 600; cursor: pointer; color: #fff; text-decoration: none; display: inline-block; font-size: 13.5px; }
.dc-button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #5865f2; } .btn-secondary { background: #4e5058; } .btn-success { background: #248046; } .btn-danger { background: #da373c; } .btn-link { background: #4e5058; }
.dc-select { background: #1e1f22; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; min-width: 220px; display: flex; justify-content: space-between; color: var(--muted); margin: 4px 0; }
.dc-select.is-disabled { opacity: .55; }
.v2-unknown { color: var(--warn); font-size: 12.5px; }

/* Brand kit */
.swatches { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.swatch { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
.brand-assets .list-item { margin-bottom: 6px; }
.asset-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.asset-url { flex: 1; word-break: break-all; font-size: 12px; color: var(--muted); }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: flex-start; justify-content: center; z-index: 50; overflow-y: auto; padding: 30px 12px; }
.modal-box { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; width: min(880px, 100%); padding: 16px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; color: #fff; }
.modal-body textarea { width: 100%; font-family: Consolas, monospace; font-size: 13px; }
.code-box { background: var(--input); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow: auto; max-height: 480px; font-family: Consolas, monospace; font-size: 12.8px; white-space: pre-wrap; word-break: break-word; }
.list-box { margin-top: 10px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--panel2); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; flex-wrap: wrap; }
.list-item.col { flex-direction: column; align-items: flex-start; }
.code-tab.active { background: var(--accent); color: var(--accent-dark); font-weight: 700; }
.profile-list { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.profile-chip { display: inline-flex; gap: 3px; align-items: center; }

.app-footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 14px; }
