@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #313338;
  --bg-alt: #2b2d31;
  --bg-dark: #1e1f22;
  --bg-black: #111214;
  --bg-hover: #35373c;
  --bg-active: #404249;
  --bg-input: #1e1f22;
  --bg-mod: #111214;
  --bg-user: #232428;
  --text: #dbdee1;
  --header: #f2f3f5;
  --muted: #b5bac1;
  --faint: #949ba4;
  --link: #00a8fc;
  --brand: #5865f2;
  --brand-hover: #4752c4;
  --brand-glow: #5865f266;
  --green: #248046;
  --green-hover: #1a6334;
  --green-fg: #23a559;
  --red: #da373c;
  --red-hover: #a12828;
  --yellow: #f0b232;
  --online: #23a559;
  --blurple: #5865f2;
  --accent: #23a559;
  --accent2: #f0b232;
  --danger: #da373c;
  --embed: #2b2d31;
  --line: #3f4147;
  --line-soft: rgba(255, 255, 255, 0.06);
  --radius: 8px;
  --radius-lg: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --font: "gg sans", Inter, "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --shadow: 0 8px 24px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg-dark); color: var(--text); font-family: var(--font); }
body { display: flex; flex-direction: column; }
a { color: var(--link); }
button, select, input, textarea { font: inherit; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #0c0c0e; background-clip: padding-box; }
::selection { background: #5865f255; }

/* ——— Login ——— */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-dark);
}
.login-orbs {
  position: absolute; inset: -20%; z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 38% at 12% 8%, #5865f255 0%, transparent 58%),
    radial-gradient(36% 32% at 88% 92%, #23a55933 0%, transparent 55%),
    radial-gradient(28% 24% at 70% 18%, #3c45a540 0%, transparent 60%);
  filter: blur(8px);
  animation: orbs 18s var(--ease) infinite alternate;
}
@keyframes orbs {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.06); }
}
.login-box {
  position: relative; z-index: 1;
  width: min(440px, calc(100% - 32px));
  background: rgba(43, 45, 49, .86);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 36px 32px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: pop-in .45s var(--ease-out);
}
.mark {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, #6873f7 0%, var(--brand) 100%);
  display: grid; place-items: center;
  font-size: 36px;
  box-shadow: 0 10px 28px var(--brand-glow);
  animation: mark-float 4.5s var(--ease) infinite;
}
@keyframes mark-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
.login h1 { font-size: 24px; margin: 0 0 8px; color: var(--header); font-weight: 700; letter-spacing: -.02em; }
.login p { color: var(--muted); margin: 0 0 24px; font-size: 16px; }
.btn-discord {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; background: var(--brand); color: #fff; text-decoration: none;
  padding: 12px 16px; border-radius: 8px; font-weight: 600;
  box-shadow: 0 8px 20px var(--brand-glow);
  transition: background .15s, transform .15s var(--ease), box-shadow .15s;
}
.btn-discord:hover { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 12px 24px var(--brand-glow); }
.btn-discord:active { transform: translateY(1px); }
.btn-discord svg { width: 22px; height: 22px; }
.err { color: #fa777c; margin-bottom: 16px; }

/* ——— App shell ——— */
.d-app {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 72px 240px minmax(0, 1fr);
  background: var(--bg-dark);
  transition: grid-template-columns .22s var(--ease);
}
.d-app.home {
  grid-template-columns: 72px minmax(0, 1fr);
}
.d-app.home .d-channels { display: none; }

.d-servers {
  background: var(--bg-dark);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 8px; overflow-y: auto;
}
.d-server-sep {
  width: 32px; height: 2px; background: #35363c; border-radius: 1px; margin: 4px 0;
}
#server-list { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; flex: 1; min-height: 0; overflow-y: auto; }
.d-server {
  position: relative;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--bg);
  display: grid; place-items: center;
  overflow: visible;
  flex-shrink: 0;
  color: var(--header); text-decoration: none; font-weight: 700;
  transition: border-radius .2s var(--ease), background .2s, transform .15s var(--ease), box-shadow .2s;
}
.d-server-face {
  width: 48px; height: 48px;
  border-radius: inherit;
  overflow: hidden;
  display: grid; place-items: center;
  background: var(--bg);
}
.d-server img, .d-server .letter {
  grid-area: 1 / 1;
}
.d-server img {
  width: 48px; height: 48px; object-fit: cover;
  display: block; position: relative; z-index: 1;
}
.d-server .letter { font-size: 18px; font-weight: 700; }
.d-server:hover, .d-server.on { border-radius: 16px; }
.d-server:hover { transform: translateY(-1px); }
.d-server.home { background: var(--bg); font-size: 22px; overflow: hidden; }
.d-server.home:hover, .d-server.home.on {
  background: var(--green-fg);
  box-shadow: 0 8px 18px #23a55955;
}
.d-server .d-pill {
  position: absolute; left: -16px; top: 50%;
  width: 8px; height: 8px; border-radius: 0 4px 4px 0;
  background: #fff; transform: translateY(-50%) scaleY(0);
  transition: transform .18s var(--ease), height .18s var(--ease);
}
.d-server:hover .d-pill { transform: translateY(-50%) scaleY(1); height: 20px; }
.d-server.on .d-pill { transform: translateY(-50%) scaleY(1); height: 40px; }

.d-channels {
  background: var(--bg-alt);
  display: flex; flex-direction: column; min-height: 0;
  border-top-left-radius: 8px;
  animation: slide-ch .28s var(--ease-out);
}
@keyframes slide-ch {
  from { opacity: .4; transform: translateX(-8px); }
  to { opacity: 1; transform: none; }
}
.d-guild-head {
  height: 48px; padding: 0 16px;
  display: flex; align-items: center;
  box-shadow: 0 1px 0 #0003, 0 1px 2px #0002;
  font-weight: 700; color: var(--header);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 0;
  letter-spacing: -.01em;
}
.d-ch-scroll { flex: 1; overflow: auto; padding: 8px 8px 16px; }
.d-cat {
  display: flex; align-items: center; gap: 4px;
  padding: 16px 8px 4px;
  color: var(--faint); font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  user-select: none;
}
.d-cat::before {
  content: "▾";
  font-size: 9px;
  margin-right: 2px;
  opacity: .85;
}
.d-ch, .side a.nav, .side a.back, a.d-ch {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 8px; margin: 1px 0;
  border-radius: 8px; color: var(--muted);
  text-decoration: none; font-weight: 500; font-size: 16px;
  background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
  transition: background .12s, color .12s, transform .12s var(--ease);
}
.d-ch:hover, .side a.nav:hover, .side a.back:hover {
  background: var(--bg-hover); color: var(--header);
}
.d-ch.on, .side a.nav.on { background: var(--bg-active); color: var(--header); }
.d-ch:active { transform: scale(.985); }
.d-ch.has-ping { color: var(--header); }
.d-ch.has-ping .d-hash { color: #f23f43; }
.d-ch.has-ping::after {
  content: ""; width: 8px; height: 8px; margin-left: auto;
  border-radius: 50%; background: #f23f43; box-shadow: 0 0 0 0 #f23f43aa;
  animation: ping-pulse 1.6s ease-out infinite;
}
@keyframes ping-pulse {
  0% { box-shadow: 0 0 0 0 #f23f4388; }
  70% { box-shadow: 0 0 0 8px #f23f4300; }
  100% { box-shadow: 0 0 0 0 #f23f4300; }
}
.desk-item.fresh {
  outline: 1px solid #5865f2;
  background: #3c45a533;
  animation: fresh-glow 1.8s var(--ease);
}
@keyframes fresh-glow {
  from { box-shadow: 0 0 0 0 #5865f288; }
  to { box-shadow: 0 0 0 10px #5865f200; }
}
#toasts {
  position: fixed; top: 16px; right: 16px; z-index: 80;
  display: flex; flex-direction: column; gap: 8px;
  width: min(320px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(17, 18, 20, .94);
  backdrop-filter: blur(12px);
  border: 1px solid #3f4147; border-left: 4px solid var(--brand);
  border-radius: 10px; padding: 12px 14px; color: var(--header);
  box-shadow: var(--shadow);
  animation: toast-in .28s var(--ease-out);
}
.toast.ticket, .toast.bug { cursor: pointer; }
.toast.ok { border-left-color: var(--green-fg); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--yellow); }
.toast.bug { border-left-color: #f0b232; }
.toast-ico {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 800; line-height: 1;
  background: var(--brand); color: #fff; margin-top: 1px;
}
.toast.ok .toast-ico { background: var(--green); }
.toast.err .toast-ico { background: var(--red); }
.toast.warn .toast-ico { background: #c0892a; }
.toast.ticket .toast-ico { background: var(--brand); }
.toast.bug .toast-ico { background: #c0892a; }
.toast-body { min-width: 0; flex: 1; }
.toast b { display: block; font-size: 14px; margin-bottom: 2px; }
.toast-body span { display: block; font-size: 13px; color: var(--muted); }
.toast:hover { transform: translateY(-1px); }
.toast.out { opacity: 0; transform: translateX(16px); transition: .28s var(--ease); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(18px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.d-hash, .d-ch-ico {
  width: 20px; text-align: center; color: var(--faint); font-weight: 700; flex-shrink: 0;
}
.d-user {
  height: 52px; background: var(--bg-user);
  display: flex; align-items: center; gap: 8px;
  padding: 0 8px; flex-shrink: 0;
  border-top: 1px solid #0004;
  min-width: 0;
}
.d-av-wrap { position: relative; width: 32px; height: 32px; flex-shrink: 0; }
.d-user img, .d-av-wrap img {
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg-dark); display: block;
}
.d-status {
  position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--online);
  border: 3px solid var(--bg-user);
  box-shadow: 0 0 0 0 #23a55988;
  animation: status-pulse 2.4s ease-out infinite;
}
@keyframes status-pulse {
  0% { box-shadow: 0 0 0 0 #23a55966; }
  70% { box-shadow: 0 0 0 6px #23a55900; }
  100% { box-shadow: 0 0 0 0 #23a55900; }
}
.d-user .who { flex: 1; min-width: 0; }
.d-user .who b { display: block; font-size: 14px; color: var(--header); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-user .who span { font-size: 12px; color: var(--faint); }
.ghost {
  background: transparent; color: var(--muted); border: 0;
  border-radius: 6px; padding: 6px 8px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center;
  transition: background .12s, color .12s, transform .12s;
}
.ghost:hover { background: var(--bg-hover); color: var(--header); }
.ghost:active { transform: scale(.95); }
.ghost.ico {
  width: 32px; height: 32px; padding: 0; flex-shrink: 0;
  justify-content: center; color: var(--muted);
}
.ghost.ico svg { display: block; }

.d-main {
  background: var(--bg);
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border-top-left-radius: 0;
}
.d-toolbar {
  height: 48px; padding: 0 16px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 1px 0 #0003, 0 1px 2px #0002;
  flex-shrink: 0; color: var(--header); font-weight: 700;
  z-index: 2;
}
.d-toolbar .d-hash { color: var(--faint); font-size: 22px; }
#channel-title { font-size: 16px; letter-spacing: -.01em; }
.d-toolbar .sp { flex: 1; }
.d-body {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  overflow: hidden;
}
#view-picker, #view-guild { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
#view-guild:not(.hidden) { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ——— Accueil serveurs ——— */
.picker {
  flex: 1; overflow: auto;
  padding: 24px 32px 48px;
  background:
    radial-gradient(900px 280px at 0% 0%, #5865f214 0%, transparent 55%),
    var(--bg);
}
.picker h2 { margin: 0 0 6px; font-size: 20px; color: var(--header); letter-spacing: -.02em; }
.picker .sub { color: var(--muted); margin: 0 0 16px; }
.picker-search {
  max-width: 640px; margin-bottom: 18px;
}
.picker-search input {
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 10px 14px 10px 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23949ba4' viewBox='0 0 16 16'%3E%3Cpath d='M11.7 10.3a6 6 0 1 0-1.4 1.4l3.5 3.5.7-.7zM6.5 11A4.5 4.5 0 1 1 11 6.5 4.5 4.5 0 0 1 6.5 11'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px 50%;
}
.grid { display: flex; flex-direction: column; gap: 2px; max-width: 640px; }
.gcard, .d-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: inherit; text-decoration: none; cursor: pointer;
  animation: fade-up .32s calc(var(--i, 0) * 35ms) var(--ease-out) both;
  transition: background .15s, transform .15s var(--ease);
}
.gcard:hover, .d-row:hover { background: var(--bg-hover); transform: translateX(2px); }
.gcard .sq, .d-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-dark); overflow: hidden;
  display: grid; place-items: center; flex-shrink: 0;
  position: relative;
  transition: border-radius .2s var(--ease);
}
.d-av img, .d-av .letter { grid-area: 1 / 1; }
.d-av img { position: relative; z-index: 1; }
.gcard:hover .sq, .d-row:hover .d-av { border-radius: 14px; }
.gcard img, .d-av img { width: 100%; height: 100%; object-fit: cover; }
.gcard .letter, .d-av .letter { font-size: 18px; font-weight: 700; color: var(--header); }
.gcard span, .d-row span { font-weight: 600; color: var(--header); }

/* ——— Contenu ——— */
.main {
  padding: 16px 20px 40px;
  overflow: auto; flex: 1; min-height: 0; min-width: 0;
}
.main.page-fill {
  max-width: none; width: 100%; height: 100%;
  display: flex; flex-direction: column;
  padding: 0; overflow: hidden;
}
.page-fill .toolbar, .page-fill .cl-modes, .page-fill .desk-tools, .page-fill #cl-msg, .page-fill #desk-msg { flex-shrink: 0; }
.page-fill > h3 { display: none; }
.page-fill #cl-msg, .page-fill #desk-msg { margin: 0 16px; min-height: 1.2em; }
.page-fill #cl-msg:empty, .page-fill #desk-msg:empty { display: none; }
.page-fill .toolbar { padding: 12px 16px 0; margin: 0; }
.page-fill .split-fill { padding: 12px 16px 16px; }
.page-enter { animation: page-enter .32s var(--ease-out); }
@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: none; }
}

h3 { margin: 0 0 16px; color: var(--header); font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.hero {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 20px; padding: 16px 18px;
  background: linear-gradient(135deg, #3c45a533 0%, #2b2d31 55%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  animation: fade-up .35s var(--ease-out);
}
.hero .d-av { width: 52px; height: 52px; }
.hero h3 { margin: 0 0 2px; font-size: 18px; }
.hero .sub { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.stat {
  background: var(--bg-alt); border-radius: var(--radius-lg); padding: 16px;
  color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  border: 1px solid transparent;
  animation: fade-up .35s calc(var(--i, 0) * 50ms) var(--ease-out) both;
  transition: transform .18s var(--ease), border-color .18s, box-shadow .18s;
}
.stat:hover {
  transform: translateY(-2px);
  border-color: #5865f244;
  box-shadow: 0 10px 24px #0004;
}
.stat b {
  display: block; font-size: 26px; margin-top: 8px; color: var(--header);
  text-transform: none; letter-spacing: -.03em; font-weight: 800;
}

.d-sec {
  margin: 0 0 16px;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 14px 16px 6px;
  border: 1px solid var(--line-soft);
  animation: fade-up .32s var(--ease-out);
}
.d-sec > h4 {
  margin: 0 0 4px; color: var(--header); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.row {
  display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.row:last-of-type { border-bottom: 0; }
label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; }
select, input, textarea {
  width: 100%; background: var(--bg-input); color: var(--text);
  border: none; border-radius: 8px; padding: 10px 12px;
  outline: none; letter-spacing: 0;
  transition: box-shadow .15s, background .15s;
}
select:hover, input:hover, textarea:hover { background: #1a1b1e; }
select:focus, input:focus, textarea:focus { box-shadow: 0 0 0 2px var(--brand); }
textarea {
  min-height: 180px; resize: vertical;
  font-family: var(--font);
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.btn {
  background: var(--brand); color: #fff; border: 0; border-radius: 8px;
  padding: 8px 16px; font-weight: 600; cursor: pointer; min-height: 38px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, transform .12s var(--ease), box-shadow .15s, filter .15s;
}
.btn:hover { background: var(--brand-hover); transform: translateY(-1px); box-shadow: 0 8px 16px var(--brand-glow); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.sec { background: #4e5058; color: #fff; box-shadow: none; }
.btn.sec:hover { background: #6d6f78; box-shadow: none; }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: var(--red-hover); box-shadow: 0 8px 16px #da373c44; }
.btn.green { background: var(--green); color: #fff; }
.btn.green:hover { background: var(--green-hover); box-shadow: 0 8px 16px #23a55944; }
.btn.look { background: transparent; color: var(--header); min-height: auto; padding: 8px 16px; box-shadow: none; }
.btn.look:hover { background: transparent; text-decoration: underline; transform: none; box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.mini { padding: 2px 12px; font-size: 14px; min-height: 32px; }

.toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr auto;
  gap: 10px; align-items: center; margin-bottom: 10px;
}
.cl-modes {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
  padding: 4px 0 0; margin: 0 0 6px;
}
.page-fill .cl-modes { padding: 8px 16px 0; margin: 0; }
.chk {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none; color: var(--muted); font-size: 13px; font-weight: 600;
  transition: color .12s;
}
.chk:has(input:checked) { color: var(--header); }
.chk input {
  appearance: none; -webkit-appearance: none;
  width: 18px; height: 18px; margin: 0; flex-shrink: 0;
  border: 2px solid #80848e; border-radius: 4px; background: var(--bg-input);
  display: grid; place-items: center;
  transition: background .12s, border-color .12s, transform .12s;
}
.chk input:hover { transform: scale(1.06); }
.chk input:checked { background: var(--brand); border-color: var(--brand); }
.chk input:checked::after {
  content: ""; width: 10px; height: 5px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
}
.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px; align-items: start;
}
.split-fill { align-items: stretch; flex: 1; min-height: 0; }
.frame {
  display: flex; flex-direction: column;
  background: var(--bg-alt); border-radius: var(--radius-lg);
  min-height: 0; overflow: hidden;
  border: 1px solid var(--line-soft);
}
.frame > h3 { padding: 14px 16px 0; margin: 0; flex-shrink: 0; font-size: 16px; }
.frame .blocks {
  flex: 1; display: flex; flex-direction: column;
  margin: 12px 16px 16px; min-height: 0; overflow: hidden;
}
.frame .cblock:has(textarea) {
  flex: 1; display: flex; flex-direction: column;
  min-height: 0; background: transparent; border: 0; padding: 0;
}
.frame .cblock:has(textarea) .cblock-tools { flex-shrink: 0; }
.frame .cblock:has(textarea) .composer { flex: 1; min-height: 0; position: relative; }
.frame .cblock:has(textarea) textarea {
  position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; resize: none;
}
.frame .block-add { flex-shrink: 0; }
.frame .preview { flex: 1; margin: 12px 16px 16px; min-height: 0; overflow: auto; }

.desk {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  flex: 1; min-height: 0;
  background: var(--bg);
}
.desk-list {
  background: var(--bg-alt); min-height: 0; overflow: auto;
  border-right: 1px solid #0003;
  padding: 8px 0;
}
.desk-empty {
  margin: 0;
  padding: 28px 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.desk-view > .desk-empty {
  padding: 56px 28px;
  text-align: center;
}
.desk-view {
  padding: 0; overflow: hidden; min-height: 0; background: var(--bg);
  display: flex; flex-direction: column;
  animation: page-enter .28s var(--ease-out);
}
.desk-view-col { flex: 1; min-height: 0; height: 100%; display: flex; flex-direction: column; }
.desk-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.desk-head h3 { margin: 0 0 4px; font-size: 16px; }
.desk-head .sub { margin: 0; }
.desk-head .actions { margin: 0; flex-shrink: 0; justify-content: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { background: var(--bg-input); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.chip b { color: var(--header); margin-right: 4px; }
.chat-legend {
  display: flex; justify-content: space-between; padding: 6px 16px 0;
  color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  flex-shrink: 0;
}
.chat {
  flex: 1; min-height: 0; overflow: auto; padding: 12px 16px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.typing {
  min-height: 22px; padding: 0 16px 8px; color: var(--muted); font-size: 13px;
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.typing.hidden { display: none; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-3px); opacity: 1; }
}
.bubble {
  max-width: 78%; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.4;
  animation: bubble-in .22s var(--ease-out);
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.bubble.staff { align-self: flex-start; background: #2b2d31; border-bottom-left-radius: 4px; }
.bubble.player { align-self: flex-end; background: #3c45a5; border-bottom-right-radius: 4px; }
.bubble .who { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.bubble.player .who { color: #c9cdfb; text-align: right; }
.bubble .txt { word-break: break-word; }
.bubble-img { max-width: 260px; max-height: 180px; border-radius: 6px; display: block; margin-top: 6px; }
.bubble-file { display: inline-block; margin-top: 6px; color: var(--link); }
.backup-frame {
  flex: 1; min-height: 0; width: 100%; border: 0; background: #111214; border-radius: 0;
}
.desk-compose {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 16px 14px; border-top: 1px solid var(--line); flex-shrink: 0;
}
.desk-compose .composer { flex: 1; min-width: 0; margin: 0; }
.desk-compose textarea { min-height: 64px; margin: 0; }
.desk-compose .btn { flex-shrink: 0; }
.desk-tools { margin: 0 16px 8px; flex-shrink: 0; }
.desk-item {
  display: flex; flex-direction: row; align-items: flex-start; gap: 8px;
  text-align: left; background: none; border: 0;
  color: var(--muted); padding: 8px 12px; cursor: pointer; border-radius: 8px;
  margin: 2px 6px; width: calc(100% - 12px);
  transition: background .12s, color .12s, transform .12s;
}
.desk-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.desk-check { display: flex; align-items: center; padding-top: 2px; flex-shrink: 0; }
.desk-check input { width: 16px; height: 16px; accent-color: var(--brand); }
.desk-item:hover { background: var(--bg-hover); color: var(--header); }
.desk-item.on { background: var(--bg-active); color: var(--header); }
.desk-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.desk-title { font-weight: 600; color: inherit; }
.desk-view .kv {
  display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: start;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.desk-view .kv span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.desk-view textarea { min-height: 90px; margin: 8px 0; }
.desk-view .composer { margin: 8px 0; }
.desk-view .composer textarea { margin: 0; }
.d-modal-bd .composer textarea { min-height: 120px; }

.embed {
  background: var(--embed);
  border-left: 4px solid var(--brand);
  border-radius: 8px;
  padding: 12px 16px 16px;
  margin: 8px 0 16px;
}
.embed h3 { font-size: 16px; margin: 0 0 8px; }

.blocks { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.cblock { background: var(--bg-input); border-radius: 8px; padding: 10px 12px; }
.cblock-tools { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cblock-kind { color: var(--muted); font-size: 12px; font-weight: 700; margin-right: auto; text-transform: uppercase; }
.ghost.mini { padding: 4px 8px; font-size: 13px; border-radius: 4px; }
.ghost.mini:disabled { opacity: .35; cursor: default; }
.sep-line { height: 0; border-top: 1px dashed var(--line); margin: 8px 2px; }
.cbtn-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; margin: 6px 0; }
.block-add { display: flex; flex-wrap: wrap; gap: 8px; }
.pv-sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.pv-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.pv-btn {
  display: inline-flex; align-items: center;
  background: var(--brand); color: #fff; border-radius: 8px;
  padding: 2px 16px; font-weight: 500; font-size: 14px; min-height: 32px;
}
.pv-img { max-width: 100%; border-radius: 8px; margin: 10px 0; display: block; }
.pv-text { margin: 8px 0; color: var(--text); }

.composer {
  position: relative; width: 100%;
  display: flex; flex-direction: column;
  background: var(--bg-input); border-radius: 8px;
}
.composer-mirror, .composer textarea {
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  font-style: normal;
  line-height: 24px;
  letter-spacing: 0;
  text-indent: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  tab-size: 4;
  padding: 10px 12px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  box-sizing: border-box;
}
.composer-mirror {
  position: absolute; inset: 0;
  overflow: auto; pointer-events: none; color: var(--text);
  scrollbar-width: none;
}
.composer-mirror::-webkit-scrollbar { display: none; }
.composer-mirror .ph { color: var(--faint); }
.composer-mirror .ping { padding: 0; }
.composer-mirror .ping-fit { position: relative; display: inline; }
.composer-mirror .ping-ghost { visibility: hidden; }
.composer-mirror .ping-label {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0;
  overflow: hidden; white-space: nowrap;
}
.composer textarea {
  position: relative; z-index: 1; background: transparent;
  color: transparent; caret-color: var(--text);
  resize: vertical; overflow: auto;
  box-shadow: none !important;
}
.composer textarea::placeholder { color: transparent; }
.composer textarea::selection { background: #5865f255; color: transparent; }
.emote {
  height: 1.25em; width: 1.25em; vertical-align: -0.22em;
  object-fit: contain; display: inline;
}

.ac {
  position: fixed; left: 0; top: 0;
  min-width: 280px; max-width: 360px; max-height: 280px;
  overflow: auto; background: #111214;
  border-radius: 8px; z-index: 80;
  box-shadow: var(--shadow-lg);
  padding: 6px 8px;
  animation: pop-in .14s var(--ease-out);
}
.ac-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; background: none; border: 0;
  color: var(--text); padding: 6px 8px; cursor: pointer; border-radius: 4px;
}
.ac-item.on, .ac-item:hover { background: var(--brand); color: #fff; }
.ac-item .lab { font-weight: 600; }
.ac-item .tag { color: var(--faint); font-size: 12px; margin-left: auto; }
.ac-item.on .tag, .ac-item:hover .tag { color: #fff9; }
.ac-av { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #2b2d31; }
.ac-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ac-hash { width: 22px; height: 22px; display: grid; place-items: center; color: var(--muted); font-weight: 800; flex-shrink: 0; }

.split-preview { position: sticky; top: 16px; }
.split-preview h3 { margin-top: 0; }
.split-preview .preview { margin-top: 0; min-height: 320px; }
.preview {
  background: var(--bg); border-radius: 8px; padding: 16px 8px;
  line-height: 1.5;
}
.preview h1, .preview h2, .preview h3 { margin: 8px 0; color: var(--header); }
.d-msg { display: flex; gap: 16px; padding: 4px 8px 12px; }
.d-msg-av {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); display: grid; place-items: center; flex-shrink: 0;
  font-size: 20px;
}
.d-msg-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.d-msg-name { font-weight: 600; color: var(--header); }
.d-msg-bot {
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 3px; padding: 0 4px; line-height: 16px;
}
.d-embed {
  background: #2b2d31; border-left: 4px solid var(--green-fg);
  border-radius: 4px; padding: 8px 16px 12px; margin-top: 4px;
}
.ping { color: #c9cdfb; background: #5865f233; border-radius: 3px; padding: 0 2px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.td-act { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  border-radius: 999px; padding: 2px 8px; letter-spacing: .02em;
}
.badge.open { background: #24804633; color: #2dc770; }
.badge.closed, .badge.resolved { background: #4e505833; color: var(--muted); }
.details {
  background: var(--bg-input); border-radius: 8px;
  padding: 12px 14px; white-space: pre-wrap; color: var(--text); font-size: 14px;
  max-height: 280px; overflow: auto;
}
.ok { color: var(--green-fg); }
.warn { color: var(--yellow); }
.hidden { display: none !important; }
.sub { color: var(--muted); }
.back { margin: 0 0 8px; }

/* ——— Skeleton / tooltip ——— */
.skel { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.skel-bar, .skel-card {
  background: linear-gradient(90deg, #2b2d31 0%, #3a3c42 50%, #2b2d31 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 8px;
}
.skel-bar { height: 14px; width: 100%; }
.skel-bar.w32 { width: 32%; height: 22px; }
.skel-bar.w70 { width: 70%; }
.skel-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.skel-card { height: 84px; border-radius: var(--radius-lg); }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
#tip {
  position: fixed; z-index: 200; pointer-events: none;
  background: #111214; color: #fff;
  font-weight: 600; font-size: 14px; line-height: 1.2;
  padding: 8px 12px; border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateX(-4px) scale(.98);
  transition: opacity .12s var(--ease), transform .12s var(--ease), visibility .12s;
  white-space: nowrap; max-width: 240px;
}
#tip.on { opacity: 1; visibility: visible; transform: none; }
#tip::before {
  content: ""; position: absolute; left: -5px; top: 50%;
  width: 8px; height: 8px; background: #111214;
  transform: translateY(-50%) rotate(45deg);
}

/* ——— Modal Discord ——— */
.d-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px;
  animation: fade-up .18s var(--ease-out);
}
.d-modal {
  width: min(440px, 100%);
  background: #313338;
  color: #dbdee1;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px #0006, var(--shadow-lg);
  overflow: hidden;
  animation: d-pop .22s var(--ease-out);
}
@keyframes d-pop {
  from { transform: scale(.94) translateY(10px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.d-modal-hd { padding: 16px 16px 0; }
.d-modal-hd h2 { margin: 0; font-size: 20px; color: var(--header); }
.d-modal-hd p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.d-modal-bd { padding: 16px; }
.d-modal-bd label { display: block; margin-bottom: 8px; }
.d-modal-bd textarea { min-height: 120px; }
.d-modal-ft {
  background: var(--bg-alt);
  padding: 16px;
  display: flex; justify-content: flex-end; gap: 8px;
}

@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .split-preview { position: static; }
  .split-fill { min-height: 240px; }
  .main.page-fill { overflow: auto; }
  .toolbar { grid-template-columns: 1fr; }
  .desk { grid-template-columns: 1fr; min-height: 70vh; }
}
@media (max-width: 860px) {
  .d-app, .d-app.home { grid-template-columns: 72px 1fr; }
  .d-channels {
    position: absolute; left: 72px; top: 0; bottom: 0; z-index: 6;
    width: 240px; box-shadow: 8px 0 24px #0008;
  }
  .d-app.home .d-channels { display: none; }
  .row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
