:root {
    --bg: #0a1224;
    --panel: #101b33;
    --panel-2: #15233f;
    --border: #1f3158;
    --text: #e6edff;
    --muted: #8da2cf;
    --blue: #2563eb;
    --blue-hi: #3b82f6;
    --blue-lo: #1d4ed8;
    --sky: #60a5fa;
    --danger: #ef4444;
    --warn: #f59e0b;
    --ok: #38bdf8;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: radial-gradient(1200px 600px at 20% -10%, #14285a 0%, var(--bg) 60%) fixed;
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 700; }
.brand .dot { width: 12px; height: 12px; border-radius: 4px; background: var(--blue-hi); box-shadow: 0 0 14px var(--blue-hi); }
.user { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.user img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--blue); }

/* buttons */
.btn {
    appearance: none; border: 1px solid var(--blue-lo); background: var(--blue); color: #fff;
    padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
    transition: background .15s, transform .05s;
}
.btn:hover { background: var(--blue-hi); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.danger { background: var(--danger); border-color: #b91c1c; }
.icon-btn {
    width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--panel-2); color: var(--sky); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue-hi); }
.icon-btn.del:hover { background: var(--danger); border-color: var(--danger); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn svg { width: 18px; height: 18px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 30px; font-weight: 700; margin-top: 2px; }
.stat .sub { color: var(--muted); font-size: 13px; }

.banner { background: #1a2d5a; border: 1px solid var(--blue); color: #cfe0ff; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }
.banner.warn { border-color: var(--warn); background: #3a2d12; color: #ffe2a8; }
.banner.err { border-color: var(--danger); background: #3a1616; color: #ffc9c9; }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 12px; }
.section-head h2 { margin: 0; font-size: 18px; }

/* message list */
.list { display: flex; flex-direction: column; gap: 12px; }
.msg { display: grid; grid-template-columns: 1fr auto; gap: 14px; border-left: 4px solid var(--blue); }
.msg h3 { margin: 0 0 2px; font-size: 16px; }
.msg .desc { color: var(--muted); font-size: 14px; margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg .meta { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; align-items: flex-start; }
.progress { height: 8px; border-radius: 99px; background: var(--panel-2); overflow: hidden; margin: 8px 0 6px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--blue), var(--sky)); transition: width .4s; }
.counts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.counts b { color: var(--text); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; background: var(--panel-2); color: var(--sky); border: 1px solid var(--border); margin-left: 8px; vertical-align: middle; }
.chip.sending { background: #10305f; color: #9cc4ff; border-color: var(--blue); }
.chip.deleting { background: #3a1616; color: #ffb4b4; border-color: var(--danger); }
.btnstats { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.btnstat { font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; color: var(--muted); }
.btnstat b { color: var(--sky); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { max-width: 380px; width: 100%; text-align: center; padding: 32px 28px; }
.login h1 { margin: 8px 0 6px; }
.login p { color: var(--muted); margin: 0 0 22px; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(3, 8, 20, .75); display: grid; place-items: start center; overflow-y: auto; padding: 24px 12px; z-index: 10; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 920px; padding: 22px; }
.modal h2 { margin: 0 0 16px; }
.modal.wide { max-width: 1240px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } .pv-col { position: static; max-height: none; } }
@media (max-width: 800px) { .msg { grid-template-columns: 1fr; } }
label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 5px; }
input, textarea {
    width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border);
    border-radius: 8px; padding: 9px 11px; font: inherit;
}
input:focus, textarea:focus { outline: 2px solid var(--blue-hi); outline-offset: -1px; }
textarea { min-height: 130px; resize: vertical; }
.counter { float: right; text-transform: none; letter-spacing: 0; }
.btn-row { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 8px; margin-bottom: 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; align-items: center; }
.modal-foot .msgs { margin-right: auto; font-size: 14px; min-width: 0; }
.modal-foot .err { color: #ffb4b4; }
.modal-foot .err:empty { display: none; }
.modal-foot .hint { color: var(--muted); }

/* builder */
select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; font: inherit; }
.note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--blue-hi); }
.counters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.pill { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); }
.pill.over { border-color: var(--danger); color: #ffb4b4; }
.blocks { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.bcard { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; }
.bcard.bad { border-color: #7f2d2d; }
.bhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.btype { font-weight: 700; font-size: 13px; color: var(--sky); text-transform: uppercase; letter-spacing: .05em; }
.bctl { display: flex; gap: 4px; }
.icon-btn.sm { width: 30px; height: 30px; background: var(--panel); }
.icon-btn.sm svg { width: 16px; height: 16px; }
.bmsg { color: #ffb4b4; font-size: 12px; margin-top: 6px; }
.bmsg:empty { display: none; }
.mdarea textarea { min-height: 70px; border-top-left-radius: 0; border-top-right-radius: 0; }
.tbar { display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 4px; }
.tb { appearance: none; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; padding: 2px 7px; border-radius: 5px; cursor: pointer; }
.tb:hover { background: var(--panel-2); color: var(--text); }
.tb.b { font-weight: 800; }
.tb.i { font-style: italic; }
.tb.u { text-decoration: underline; }
.tb.s { text-decoration: line-through; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: start; margin-bottom: 8px; }
.line-row > .mdarea:only-child { grid-column: 1 / -1; }
.inline-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.inline-row select { width: auto; }
label.check { display: inline-flex; align-items: center; gap: 8px; margin: 0; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
label.check input { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.seg button { appearance: none; border: 0; background: var(--bg); color: var(--muted); font: inherit; padding: 6px 14px; cursor: pointer; }
.seg button.on { background: var(--blue); color: #fff; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn-row.g { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.btn-row:not(.g) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.addbar { display: flex; flex-wrap: wrap; gap: 8px; }

/* preview, discord components v2 look */
.preview-title { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 5px; }
.pv-col { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; }
.pv-col .preview-title { margin-top: 0; }
.pv-pane { background: #313338; border-radius: 10px; padding: 16px; }
.dc { background: #2b2d31; border: 1px solid #3f4147; border-left: 4px solid var(--blue); border-radius: 8px; padding: 12px 14px;
    max-width: 520px; display: flex; flex-direction: column; gap: 6px; color: #dbdee1; font-size: 15px; line-height: 1.375;
    font-family: "gg sans", "Noto Sans", system-ui, "Segoe UI", sans-serif; overflow-wrap: anywhere; }
.dc a { color: #00a8fc; text-decoration: none; }
.dc a:hover { text-decoration: underline; }
.md-line, .md-quote > div, .md-li { white-space: pre-wrap; }
.md-line:empty { min-height: 1.375em; }
.md-blank { height: 1.375em; }
.md-empty { color: #80848e; font-style: italic; }
.md-h1 { font-size: 24px; font-weight: 700; line-height: 1.25; margin: 6px 0 2px; }
.md-h2 { font-size: 20px; font-weight: 700; line-height: 1.25; margin: 6px 0 2px; }
.md-h3 { font-size: 16px; font-weight: 700; line-height: 1.375; margin: 4px 0 2px; }
.md-sub { font-size: 12px; color: #949ba4; line-height: 1.33; }
.md-quote { border-left: 4px solid #4e5058; padding-left: 10px; margin: 2px 0; }
.md-li { display: flex; gap: 8px; padding-left: 6px; }
.md-code { background: #1e1f22; border-radius: 4px; padding: 1px 5px; font: 13px/1.4 Consolas, "Courier New", monospace; }
.md-pre { background: #1e1f22; border: 1px solid #3f4147; border-radius: 6px; padding: 8px 10px; margin: 4px 0; overflow-x: auto; }
.md-pre code { font: 13px/1.4 Consolas, "Courier New", monospace; white-space: pre; }
.md-spoiler { background: #1e1f22; color: transparent; border-radius: 4px; padding: 0 2px; cursor: pointer; }
.md-spoiler * { color: transparent; }
.md-spoiler.shown { background: #3f4147; color: inherit; }
.md-spoiler.shown * { color: inherit; }
.dc-sep { display: flex; align-items: center; }
.dc-sep.small { min-height: 8px; }
.dc-sep.large { min-height: 20px; }
.dc-sep hr { flex: 1; border: 0; border-top: 1px solid #4e5058; margin: 0; }
.dc-section { display: flex; gap: 14px; align-items: center; justify-content: space-between; }
.dc-sec-texts { flex: 1; min-width: 0; }
.dc-acc { flex: none; }
.dc-thumb { width: 80px; height: 80px; border-radius: 8px; overflow: hidden; background: #1e1f22; }
.dc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dc-thumb.broken, .dc-tile.broken { display: flex; align-items: center; justify-content: center; text-align: center; color: #80848e; font-size: 11px; padding: 4px; }
.dc-btn { display: inline-flex; align-items: center; gap: 8px; background: #4e5058; color: #fff; border-radius: 8px; padding: 6px 14px; font-size: 14px; font-weight: 500; }
.dc-btn .ext svg { width: 14px; height: 14px; display: block; }
.dc-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dc-gallery { display: flex; flex-direction: column; gap: 4px; border-radius: 8px; overflow: hidden; }
.dc-grow { display: flex; gap: 4px; height: 150px; }
.dc-grow.n1 { height: 260px; }
.dc-tile { flex: 1; min-width: 0; background: #1e1f22; overflow: hidden; }
.dc-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
