/* eDeskCloud Chatbot dashboard */
:root {
  --navy: #071B56;
  --blue: #146CF2;
  --cyan: #10A8EE;
  --purple: #6D16E8;
  --magenta: #D70CA9;
  --pink: #F1197A;
  --orange: #FF7A00;
  --ink: #0F172A;
  --mute: #5D687B;
  --faint: #94A0B4;
  --line: #E6EAF2;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --grad: linear-gradient(135deg, #6D16E8, #146CF2);
  --sig: linear-gradient(90deg, #FF7A00 0%, #F1197A 34%, #6D16E8 67%, #146CF2 100%);
  --green: #059669;
  --red: #DC2626;
  --amber: #D97706;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(7, 27, 86, .04), 0 8px 24px rgba(7, 27, 86, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px; line-height: 1.55; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: Montserrat, Poppins, sans-serif; margin: 0; letter-spacing: -.015em; color: var(--navy); }
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
svg { flex: none; }
[hidden] { display: none !important; }

/* ── Shell ─────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.side {
  width: 252px; flex: none; background: var(--navy); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.side::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(90% 40% at 0% 0%, rgba(109, 22, 232, .5), transparent 70%),
              radial-gradient(80% 36% at 100% 100%, rgba(20, 108, 242, .35), transparent 70%);
}
.side > * { position: relative; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 20px; }
.brand img { width: 40px; height: 40px; border-radius: 12px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .14); object-fit: cover; }
.brand b { display: block; font-family: Montserrat, sans-serif; font-weight: 800; font-size: 16.5px; letter-spacing: -.01em; line-height: 1.15; }
.brand span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .6); font-weight: 500; }
.nav { flex: 1; overflow-y: auto; padding: 6px 12px; }
.nav small { display: block; padding: 16px 10px 7px; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .42); font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: rgba(255, 255, 255, .76);
  font-weight: 500; font-size: 13.5px; position: relative; transition: background .15s, color .15s; margin-bottom: 2px;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(255, 255, 255, .12); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, #FF7A00, #F1197A); }
.nav a svg { width: 18px; height: 18px; opacity: .9; }
.nav .count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--pink); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.side-foot { padding: 14px 16px 18px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 12px; color: rgba(255, 255, 255, .62); }
.side-foot b { display: block; color: #fff; font-weight: 500; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot form { margin-top: 10px; }
.side-foot button { width: 100%; padding: 8px 10px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .2); background: transparent; color: #fff; font-size: 12.5px; transition: background .15s; }
.side-foot button:hover { background: rgba(255, 255, 255, .1); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 22px 32px 6px; }
.top h1 { font-size: 23px; font-weight: 800; }
.top p { margin: 2px 0 0; color: var(--mute); font-size: 13.5px; }
.top .grow { flex: 1; min-width: 0; }
.content { padding: 18px 32px 40px; flex: 1; }
.burger { display: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; place-items: center; }

/* ── Building blocks ───────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.card-h h3 { font-size: 15px; font-weight: 700; flex: 1; }
.card-h span.sub { font-size: 12.5px; color: var(--mute); }
.card-b { padding: 16px 20px 20px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--mute); }
.small { font-size: 12.5px; }
.right { margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 500; font-size: 13.5px; line-height: 1.2;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: #CBD3E1; background: #FAFBFD; }
.btn.primary { border: 0; background: var(--grad); color: #fff; font-weight: 600; box-shadow: 0 6px 16px rgba(109, 22, 232, .24); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(109, 22, 232, .32); }
.btn.dark { border: 0; background: var(--navy); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: #FEF2F2; border-color: #FECACA; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn svg { width: 16px; height: 16px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #EEF1F7; color: var(--mute); white-space: nowrap; }
.pill.green { background: #D1FAE5; color: #047857; }
.pill.red { background: #FEE2E2; color: #B91C1C; }
.pill.amber { background: #FEF3C7; color: #B45309; }
.pill.blue { background: #DBEAFE; color: #1D4ED8; }
.pill.purple { background: #EDE4FF; color: #5B21B6; }
.pill.pink { background: #FCE7F3; color: #BE185D; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.flash { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; font-weight: 500; }
.flash.err { background: #FEF2F2; border-color: #FECACA; color: #991B1B; }
.flash ul { margin: 0; padding-left: 18px; }
.banner { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px; background: #FFF7ED; border: 1px solid #FED7AA; color: #9A3412; margin-bottom: 18px; }
.banner b { color: #7C2D12; }
.empty { text-align: center; padding: 44px 20px; color: var(--mute); }
.empty h4 { font-size: 15px; margin-bottom: 4px; }

/* ── Forms ─────────────────────────────────────────────── */
label.f { display: block; margin-bottom: 16px; }
label.f > span { display: block; font-weight: 600; font-size: 13px; color: var(--navy); margin-bottom: 6px; }
label.f > em { display: block; font-style: normal; font-size: 12px; color: var(--mute); margin-top: 6px; line-height: 1.45; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 13.5px; color: var(--ink); background: #FBFCFE; border: 1.5px solid var(--line);
  border-radius: 10px; padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(109, 22, 232, .12); background: #fff; }
input[type=color] { width: 46px; height: 40px; padding: 3px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.switch { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch i { flex: none; width: 40px; height: 23px; border-radius: 12px; background: #CBD3E1; position: relative; transition: background .18s; margin-top: 1px; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .18s; }
.switch input:checked + i { background: var(--purple); }
.switch input:checked + i::after { transform: translateX(17px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(109, 22, 232, .25); }
.switch b { display: block; font-weight: 600; font-size: 13px; color: var(--navy); }
.switch span { display: block; font-size: 12px; color: var(--mute); }
.savebar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 14px 0 4px; background: linear-gradient(180deg, rgba(244, 246, 251, 0), var(--bg) 40%); margin-top: 8px; }

/* ── Tables ────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid #EFF2F8; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #FAFBFE; }
.table tbody tr.click { cursor: pointer; }
.table b { font-weight: 600; color: var(--navy); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 500; color: var(--mute); background: #fff; border: 1px solid var(--line); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.tabs a span { opacity: .65; margin-left: 4px; }
.search { position: relative; min-width: 240px; }
.search input { padding-left: 36px; background: #fff; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--mute); font-size: 13px; }
.score { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; color: var(--navy); }
.score i { width: 54px; height: 6px; border-radius: 3px; background: #E9EDF5; overflow: hidden; display: block; }
.score i b { display: block; height: 100%; border-radius: 3px; background: var(--sig); }

/* ── Overview ──────────────────────────────────────────── */
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi .ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; margin-bottom: 14px; }
.kpi .ico svg { width: 19px; height: 19px; }
.kpi .lbl { font-size: 12.5px; color: var(--mute); font-weight: 500; }
.kpi .val { font-family: Montserrat, sans-serif; font-weight: 800; font-size: 28px; color: var(--navy); line-height: 1.15; letter-spacing: -.02em; margin-top: 2px; }
.kpi .val small { font-size: 16px; font-weight: 700; }
.kpi .delta { position: absolute; top: 18px; right: 18px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; background: #EEF1F7; color: var(--mute); }
.kpi .delta.up { background: #D1FAE5; color: #047857; }
.kpi .delta.down { background: #FEE2E2; color: #B91C1C; }
.chart { width: 100%; height: 250px; display: block; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--mute); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bars .bar { margin-bottom: 13px; }
.bars .bar:last-child { margin-bottom: 0; }
.bars .bar div:first-child { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; gap: 10px; }
.bars .bar div:first-child span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .bar div:first-child b { font-weight: 600; color: var(--navy); }
.bars .track { height: 8px; border-radius: 4px; background: #EEF1F7; overflow: hidden; }
.bars .track i { display: block; height: 100%; border-radius: 4px; background: var(--grad); }
.funnel .step { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.funnel .step:last-child { margin-bottom: 0; }
.funnel .shape { height: 42px; border-radius: 10px; background: var(--grad); min-width: 46px; display: flex; align-items: center; padding: 0 14px; color: #fff; font-family: Montserrat, sans-serif; font-weight: 700; font-size: 15px; }
.funnel .step:nth-child(2) .shape { opacity: .88; }
.funnel .step:nth-child(3) .shape { opacity: .76; }
.funnel .step:nth-child(4) .shape { background: linear-gradient(135deg, #FF7A00, #F1197A); }
.funnel .txt { font-size: 13px; }
.funnel .txt span { display: block; color: var(--mute); font-size: 12px; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #EFF2F8; color: inherit; }
.list .item:last-child { border-bottom: 0; padding-bottom: 0; }
.list .item:first-child { padding-top: 0; }
.list a.item:hover { text-decoration: none; }
.list a.item:hover b { color: var(--purple); }
.list .item b { display: block; font-weight: 600; color: var(--navy); font-size: 13.5px; }
.list .item span.s { display: block; font-size: 12.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item .meta { margin-left: auto; text-align: right; font-size: 12px; color: var(--faint); white-space: nowrap; }
.ava { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-weight: 600; font-size: 13.5px; color: #fff; background: var(--grad); flex: none; text-transform: uppercase; }
.ava.o { background: linear-gradient(135deg, #FF7A00, #F1197A); }
.ava.g { background: #E9EDF5; color: var(--mute); }
.checklist .step { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #CBD3E1; flex: none; display: grid; place-items: center; margin-top: 1px; color: #fff; }
.checklist .done .tick { background: var(--green); border-color: var(--green); }
.checklist .tick svg { width: 12px; height: 12px; }
.checklist b { display: block; font-weight: 600; color: var(--navy); font-size: 13.5px; }
.checklist span { font-size: 12.5px; color: var(--mute); }

/* ── Conversations ─────────────────────────────────────── */
.inbox { display: grid; grid-template-columns: 350px minmax(0, 1fr) 290px; height: calc(100vh - 152px); min-height: 480px; overflow: hidden; }
.inbox > div { min-height: 0; }
.inbox .col-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.inbox .filters { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.inbox .filters .tabs { margin-top: 10px; }
.inbox .filters .tabs a { padding: 5px 11px; font-size: 12.5px; }
.inbox .items { flex: 1; overflow-y: auto; }
.conv { display: flex; gap: 11px; padding: 13px 14px; border-bottom: 1px solid #EFF2F8; cursor: pointer; position: relative; transition: background .12s; }
.conv:hover { background: #FAFBFE; }
.conv.on { background: #F3EEFF; }
.conv.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grad); }
.conv .body { flex: 1; min-width: 0; }
.conv .l1 { display: flex; align-items: center; gap: 8px; }
.conv .l1 b { font-weight: 600; color: var(--navy); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .l1 time { margin-left: auto; font-size: 11.5px; color: var(--faint); flex: none; }
.conv .l2 { font-size: 12.5px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 1px 0 6px; }
.conv.unread .l2 { color: var(--ink); font-weight: 500; }
.conv .l3 { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.conv .l3 .pill { font-size: 10.5px; padding: 2px 8px; }
.conv .dotu { min-width: 19px; height: 19px; border-radius: 10px; padding: 0 6px; background: var(--pink); color: #fff; font-size: 10.5px; font-weight: 600; display: grid; place-items: center; margin-left: auto; }
.inbox .col-thread { display: flex; flex-direction: column; background: #F7F8FC; }
.thread-h { display: flex; align-items: center; gap: 12px; padding: 13px 18px; background: #fff; border-bottom: 1px solid var(--line); }
.thread-h b { font-family: Montserrat, sans-serif; font-weight: 700; font-size: 15px; color: var(--navy); }
.thread-h .sub { font-size: 12px; color: var(--mute); }
.thread { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 76%; display: flex; flex-direction: column; }
.msg .b { padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: #fff; box-shadow: 0 1px 2px rgba(7, 27, 86, .06), 0 0 0 1px rgba(7, 27, 86, .04); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.msg .m { font-size: 11px; color: var(--faint); margin-top: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.msg .m .tag { padding: 1px 7px; border-radius: 999px; background: #E9EDF5; color: var(--mute); font-weight: 500; }
.msg .m .tag.r { background: #FEE2E2; color: #B91C1C; }
.msg .m .tag.p { background: #EDE4FF; color: #5B21B6; }
.msg.user { align-self: flex-start; }
.msg.user .who, .msg.assistant .who, .msg.agent .who { font-size: 11px; font-weight: 600; color: var(--mute); margin-bottom: 3px; }
.msg.assistant, .msg.agent { align-self: flex-end; align-items: flex-end; }
.msg.assistant .b { background: #EFE7FF; border-radius: 14px 14px 4px 14px; box-shadow: none; color: #2E1065; }
.msg.agent .b { background: var(--grad); color: #fff; border-radius: 14px 14px 4px 14px; box-shadow: 0 6px 14px rgba(109, 22, 232, .2); }
.msg.system { align-self: center; max-width: 90%; }
.msg.system .b { background: #E9EDF5; box-shadow: none; border-radius: 999px; font-size: 12px; color: var(--mute); padding: 5px 13px; text-align: center; }
.reply { padding: 12px 16px 14px; background: #fff; border-top: 1px solid var(--line); }
.reply .hint { font-size: 12px; color: var(--mute); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.reply .box { display: flex; gap: 10px; align-items: flex-end; }
.reply textarea { min-height: 44px; max-height: 140px; background: #fff; }
.inbox .col-info { border-left: 1px solid var(--line); overflow-y: auto; padding: 18px; background: #fff; }
.info h4 { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); font-family: Poppins, sans-serif; font-weight: 600; margin: 18px 0 8px; }
.info h4:first-child { margin-top: 0; }
.info dl { margin: 0; display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 6px 10px; font-size: 12.5px; }
.info dt { color: var(--mute); }
.info dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; font-weight: 500; }
.info .box { padding: 10px 12px; border-radius: 10px; background: #F7F8FC; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.info .actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.placeholder { flex: 1; display: grid; place-items: center; text-align: center; color: var(--mute); padding: 30px; }
.placeholder svg { width: 54px; height: 54px; color: #CBD3E1; margin-bottom: 12px; }

/* ── Drawer and modal ──────────────────────────────────── */
.veil { position: fixed; inset: 0; background: rgba(7, 27, 86, .38); backdrop-filter: blur(2px); z-index: 50; opacity: 0; visibility: hidden; transition: opacity .2s, visibility 0s linear .2s; }
.veil.on { opacity: 1; visibility: visible; transition: opacity .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100vw; background: #fff; z-index: 51; box-shadow: -20px 0 60px rgba(7, 27, 86, .2); transform: translateX(100%); transition: transform .26s cubic-bezier(.2, .8, .2, 1); display: flex; flex-direction: column; }
.drawer.on { transform: none; }
.drawer-h { padding: 20px 22px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; gap: 12px; position: relative; }
.drawer-h::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--sig); }
.drawer-h h3 { font-size: 18px; font-weight: 800; }
.drawer-b { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.x { width: 34px; height: 34px; border-radius: 9px; border: 0; background: #F1F4F9; display: grid; place-items: center; color: var(--mute); margin-left: auto; }
.x:hover { background: #E4E9F2; color: var(--ink); }
.modal { position: fixed; z-index: 51; left: 50%; top: 50%; width: 720px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); background: #fff; border-radius: 18px; box-shadow: 0 40px 100px rgba(7, 27, 86, .35); transform: translate(-50%, -46%) scale(.97); opacity: 0; visibility: hidden; transition: opacity .2s, transform .24s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .24s; display: flex; flex-direction: column; overflow: hidden; }
.modal.on { opacity: 1; visibility: visible; transform: translate(-50%, -50%); transition: opacity .2s, transform .24s cubic-bezier(.2, .8, .2, 1); }
.modal form { display: flex; flex-direction: column; min-height: 0; }

/* ── Knowledge ─────────────────────────────────────────── */
.kn { display: flex; gap: 14px; padding: 15px 18px; border-bottom: 1px solid #EFF2F8; align-items: flex-start; }
.kn:last-child { border-bottom: 0; }
.kn.off { opacity: .55; }
.kn .t { flex: 1; min-width: 0; cursor: pointer; }
.kn .t b { font-weight: 600; color: var(--navy); font-size: 14px; }
.kn .t:hover b { color: var(--purple); }
.kn .t p { margin: 3px 0 7px; font-size: 12.5px; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kn .acts { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--mute); }
.icon-btn:hover { color: var(--ink); border-color: #CBD3E1; }
.icon-btn.on { color: var(--orange); border-color: #FED7AA; background: #FFF7ED; }
.icon-btn.del:hover { color: var(--red); border-color: #FECACA; background: #FEF2F2; }
.icon-btn svg { width: 15px; height: 15px; }

/* ── Widget page ───────────────────────────────────────── */
.code { position: relative; background: #0B1437; color: #E2E8F0; border-radius: 12px; padding: 16px 18px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.code .copy { position: absolute; top: 10px; right: 10px; }
.swatches { display: flex; gap: 16px; flex-wrap: wrap; }
.swatches label { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; }
.frame { width: 100%; height: calc(100vh - 150px); min-height: 560px; border: 0; border-radius: var(--radius); background: #fff; display: block; }

/* ── Auth ──────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth-art { background: var(--navy); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(70% 55% at 85% 10%, rgba(109, 22, 232, .65), transparent 70%), radial-gradient(70% 55% at 5% 95%, rgba(20, 108, 242, .5), transparent 70%), radial-gradient(40% 30% at 60% 70%, rgba(241, 25, 122, .28), transparent 70%); }
.auth-art::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--sig); }
.auth-art > * { position: relative; }
.auth-art .brand { padding: 0; }
.auth-art h2 { color: #fff; font-size: 38px; font-weight: 800; line-height: 1.12; max-width: 480px; }
.auth-art h2 span { background: linear-gradient(90deg, #FFB800, #FF7A00, #F1197A); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p { color: rgba(255, 255, 255, .78); max-width: 440px; font-size: 15px; margin: 16px 0 0; }
.auth-art ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-art li { display: flex; gap: 12px; align-items: center; color: rgba(255, 255, 255, .9); font-size: 14px; }
.auth-art li i { width: 26px; height: 26px; border-radius: 8px; background: rgba(255, 255, 255, .12); display: grid; place-items: center; flex: none; }
.auth-art li svg { width: 14px; height: 14px; }
.auth-art small { color: rgba(255, 255, 255, .5); font-size: 12px; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.auth-form .inner { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 26px; font-weight: 800; }
.auth-form p.lead { color: var(--mute); margin: 6px 0 26px; }
.auth-form .btn { width: 100%; padding: 13px; font-size: 14.5px; }
.auth-form .fixed { padding: 10px 12px; border-radius: 10px; background: #F4F6FB; border: 1.5px solid var(--line); font-weight: 500; color: var(--navy); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); margin: -4px 0 18px; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1280px) {
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inbox { grid-template-columns: 310px minmax(0, 1fr); }
  .inbox .col-info { display: none; }
}
@media (max-width: 1000px) {
  .side { position: fixed; z-index: 60; transform: translateX(-100%); transition: transform .24s; }
  body.nav-open .side { transform: none; box-shadow: 20px 0 60px rgba(7, 27, 86, .3); }
  .burger { display: grid; }
  .top { padding: 16px 18px 4px; }
  .content { padding: 14px 18px 32px; }
  .g2, .g3, .g-main, .field-row, .field-row.three { grid-template-columns: minmax(0, 1fr); }
  .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .inbox { grid-template-columns: minmax(0, 1fr); height: auto; }
  .inbox .col-list { max-height: 46vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .inbox .col-thread { height: 70vh; }
  .table-wrap { overflow-x: auto; }
}
