:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f7f7fb;
  color: #21213a;
  font-size: 15px;
  --canvas: #f7f7fb;
  --ink: #21213a;
  --muted: #66677e;
  --line: #e9e8f1;
  --primary: #6248da;
  --primary-dark: #5239c4;
  --side: #19192f;
  --surface: #fff;
  --success: #15745e;
  --warning: #94530b;
  --error: #a72750;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
a { color: var(--primary-dark); text-decoration: none; }
:focus-visible { outline: 3px solid #a898ff; outline-offset: 2px; }
p { margin: 0; line-height: 1.55; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: clamp(1.85rem, 3vw, 2.38rem); letter-spacing: -.055em; }
h2 { font-size: 1.12rem; letter-spacing: -.027em; }
h3 { font-size: 1rem; }
small { font-size: .82rem; }
code { font: .85em ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }

.workspace { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100dvh; color: #f7f6ff; background: var(--side);
  display: flex; flex-direction: column; padding: 25px 15px 17px; }
.brand, .login-brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand { margin: 1px 9px 46px; }
.brand strong { display: block; letter-spacing: -.04em; font-size: 1.2rem; }
.brand small { display: block; margin-top: 3px; color: #b8b4d3; font-size: .74rem; }
.brand-icon { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 12px;
  background: linear-gradient(145deg, #9e8aff, #6950f1); color: #fff; font-size: 23px; flex: 0 0 auto;
  box-shadow: 0 5px 15px #100c3452; }
.brand-icon span { transform: rotate(-29deg) translateY(-1px); }
.nav-caption { margin: 0 12px 12px; color: #b0abc8; font-size: .69rem; font-weight: 700; letter-spacing: .15em; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 8px 12px;
  color: #d2cfe6; border-radius: 9px; font-weight: 600; font-size: .9rem; }
.sidebar nav a:hover { background: #27263f; color: #fff; }
.sidebar nav a[aria-current="page"] { background: #383157; color: #f4efff; }
.sidebar nav a span { width: 21px; text-align: center; font-size: 1.22rem; line-height: 1; color: #c2afff; }
.sidebar-footer { margin-top: auto; padding: 12px 9px 1px; font-size: .81rem; }
.local-status { display: flex; align-items: center; gap: 8px; padding: 10px 0 13px; color: #c6c1db; }
.dot { display: inline-block; border-radius: 100%; width: 8px; height: 8px; background: #67d9ab; flex: 0 0 auto; }
.logout { display: flex; gap: 10px; align-items: center; padding: 12px 0 4px; width: 100%;
  border: 0; border-top: 1px solid #39374f; background: transparent; color: #dedaf0; text-align: left; }
.logout:hover { color: #fff; }

.main-shell { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; gap: 15px; align-items: center; min-height: 66px;
  padding: 10px 32px; background: #fff; border-bottom: 1px solid var(--line); }
.breadcrumbs { display: flex; gap: 11px; align-items: center; color: var(--muted); font-size: .88rem; }
.breadcrumbs strong { color: var(--ink); font-weight: 650; }
.timezone { margin-left: auto; color: var(--muted); font-size: .8rem; white-space: nowrap; }
.timezone span { color: var(--primary); font-size: 1rem; }
.avatar { display: grid; place-items: center; height: 33px; width: 33px; border-radius: 50%;
  background: #eee8ff; color: #5740b9; font-weight: 750; font-size: .73rem; }
.icon.mobile-only { display: none; }
.content { max-width: 1530px; margin: auto; padding: 29px 32px 40px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-header p { margin-top: 7px; color: var(--muted); }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 37px;
  border: 1px solid #e4e1ef; border-radius: 8px; padding: 7px 12px; background: #fff;
  color: #393651; font-weight: 650; line-height: 1.2; font-size: .86rem; white-space: nowrap; }
.button:hover { background: #f5f2fe; border-color: #d7cdee; }
.button.primary { min-height: 41px; background: var(--primary); color: white; border-color: var(--primary);
  padding: 8px 14px; box-shadow: 0 3px 7px #6248da20; }
.button.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.button.danger { color: var(--error); }
.button.quiet { color: var(--primary-dark); background: transparent; border-color: transparent; }
.button.quiet:hover { background: #f1ebff; }
.button.icon { min-height: 32px; min-width: 32px; padding: 4px; font-size: 1.25rem; }
.button.full { width: 100%; }
.mini-icon { display: grid; place-items: center; width: 37px; height: 37px; border-radius: 10px;
  font-weight: 700; font-size: 1.18rem; flex: 0 0 auto; }
.violet { background: #eee9ff; color: #6248da; }
.mint { background: #e2f7ef; color: #17765e; }
.amber { background: #fff1df; color: #9e5c13; }
.blue { background: #e8f0ff; color: #3c66b8; }
.muted { color: var(--muted); }

.card, .metric { background: #fff; border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 2px 4px #29234d05; min-width: 0; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric { display: flex; align-items: center; gap: 13px; padding: 15px; min-height: 82px; }
.metric strong { display: block; font-size: 1.48rem; letter-spacing: -.045em; line-height: 1.14; }
.metric small { display: block; color: var(--muted); margin-top: 4px; font-size: .77rem; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(255px, 1fr); gap: 16px; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 17px; }
.card-head p { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.card-body { padding: 0 17px 17px; }
.chart { display: grid; grid-template-columns: minmax(27px, auto) minmax(0, 1fr); padding-top: 4px; }
.chart-values { display: flex; flex-direction: column; justify-content: space-between; color: var(--muted);
  font-size: .71rem; height: 118px; padding-bottom: 1px; }
.chart-plot { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); height: 118px;
  background: repeating-linear-gradient(to bottom, #eeedf5 0 1px, transparent 1px calc(100% / 3)); border-bottom: 1px solid #eeedf5; }
.chart-day { display: flex; align-items: flex-end; justify-content: center; height: 118px; position: relative; gap: 4px; }
.chart-day small { position: absolute; white-space: nowrap; bottom: -18px; font-size: .68rem; color: var(--muted); }
.bar { width: min(13px, 20%); height: calc(var(--bar, 0) * 1%); min-height: 2px;
  border-radius: 4px 4px 0 0; background: #745ae9; }
.bar.issues { background: #e5a468; }
.bar.zero { opacity: .28; }
.chart-footer { display: flex; flex-wrap: wrap; gap: 13px; margin: 29px 0 0 27px; color: var(--muted); font-size: .74rem; }
.legend { display: flex; align-items: center; gap: 5px; }
.legend b { height: 8px; width: 8px; border-radius: 2px; background: #745ae9; }
.legend b.issues { background: #e5a468; }
.schedule { display: grid; gap: 10px; }
.schedule-row { display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 9px; background: #f8f7fc; }
.schedule-row strong, .schedule-row small { display: block; overflow-wrap: anywhere; }
.schedule-row small { margin-top: 4px; color: var(--muted); }
.schedule-row .mini-icon { width: 33px; height: 33px; }
.schedule-empty { min-height: 153px; display: grid; place-content: center; justify-items: center; gap: 9px; text-align: center; }
.schedule-empty p { color: var(--muted); font-size: .85rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: .86rem; }
th { background: #f8f7fc; color: #62617b; font-weight: 650; font-size: .76rem; white-space: nowrap; }
th, td { padding: 11px 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td strong { font-weight: 680; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; font-size: .73rem; font-weight: 700;
  color: #53516b; background: #eeedf4; border-radius: 100px; white-space: nowrap; }
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.scheduled, .pill.running, .pill.sending { background: #ede7ff; color: #5639bd; }
.pill.completed, .pill.sent, .pill.connected { background: #e2f7ef; color: var(--success); }
.pill.paused, .pill.pending { background: #fff0dd; color: var(--warning); }
.pill.failed, .pill.unknown { background: #fae7ef; color: var(--error); }
.empty { padding: 29px 16px; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 8px; }
.empty strong { color: var(--ink); }
.empty p { max-width: 430px; font-size: .84rem; }
.row-empty { padding: 24px 15px; text-align: center; color: var(--muted); }
.table-controls { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 17px 14px; align-items: center; }
.table-controls input, .table-controls select { width: auto; min-width: 130px; min-height: 34px; max-width: 100%; }
.table-controls .search { flex: 1 1 170px; max-width: 320px; }
.chat-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.chat-selection span { color: var(--muted); font-size: .83rem; }
.chat-check-cell { width: 43px; }
.chat-check-cell input, #chat-select-all { vertical-align: middle; cursor: pointer; }
.destination-title { position: relative; min-width: 170px; overflow-wrap: anywhere; }
.destination-topic-row { background: #f0f8f5; }
.destination-topic-row .destination-title { padding-inline-start: 30px; }
.destination-branch { position: absolute; inset-inline-start: 13px; top: 11px; color: #32806b; }
.topic-count { display: inline-flex; margin-top: 5px; padding: 2px 7px; border-radius: 20px;
  background: #e0f2ea; color: #1b6b57; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.destination-switch { display: inline-block; position: relative; width: 38px; height: 21px; padding: 0;
  border: 0; border-radius: 20px; vertical-align: middle; background: #c7d2df; }
.destination-switch span { position: absolute; top: 3px; left: 3px; height: 15px; width: 15px;
  border-radius: 50%; background: white; box-shadow: 0 1px 2px #18284230; }
.destination-switch[aria-checked="true"] { background: #178556; }
.destination-switch[aria-checked="true"] span { transform: translateX(17px); }
.destination-switch:disabled, .chat-check-cell input:disabled { cursor: not-allowed; }
.page-controls { padding: 12px 15px; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  color: var(--muted); font-size: .83rem; border-top: 1px solid var(--line); }
.account-tabs { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 17px 14px; }
.account-tabs .selected { background: #eee8ff; color: var(--primary-dark); border-color: #ded3fc; }
.section-gap { margin-top: 16px; }

.folder-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.folder-toolbar label { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: .84rem;
  font-weight: 650; color: var(--muted); }
.folder-toolbar select { width: min(240px, 55vw); font-weight: 500; }
.folder-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.22fr); gap: 15px; align-items: start; }
.folder-panel { padding: 14px; min-width: 0; }
.folder-panel-head { display: flex; align-items: center; gap: 10px; margin: 0 0 13px; }
.folder-panel-head p { margin-top: 3px; font-size: .79rem; color: var(--muted); }
.folder-emblem { width: 34px; height: 34px; border-radius: 10px; background: #f0eaff;
  display: grid; place-items: center; flex: 0 0 auto; color: #674acb; }
.folder-emblem::before { content: ""; width: 16px; height: 13px; border-radius: 3px;
  background: currentColor; clip-path: polygon(0 0, 43% 0, 57% 21%, 100% 21%, 100% 100%, 0 100%); }
.inbox-emblem { background: #e5f5ef; color: #23846a; }
.inbox-emblem::before { width: 14px; height: 12px; background: transparent; clip-path: none;
  border: 2px solid currentColor; border-radius: 4px; box-shadow: inset 0 -3px currentColor; }
.folder-inbox-search { margin-bottom: 10px; }
.folder-inbox-list, .folder-list, .folder-members { display: grid; gap: 8px; min-width: 0; }
.folder-inbox-list { max-height: 62dvh; overflow-y: auto; scrollbar-gutter: stable; padding-right: 3px; }
.folder-destination { display: grid; grid-template-columns: 14px minmax(0, 1fr) minmax(110px, .8fr); gap: 8px; align-items: center;
  min-width: 0; border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: #fff; }
.folder-destination:hover { border-color: #d6c9f7; }
.folder-grip { color: #77718d; font-size: 1.04rem; cursor: grab; user-select: none; }
.folder-destination-name, .folder-box-label { min-width: 0; overflow-wrap: anywhere; }
.folder-destination-name strong, .folder-box-label strong { display: block; font-size: .86rem; line-height: 1.3; }
.folder-destination-name small, .folder-box-label small { display: block; color: var(--muted); margin-top: 3px;
  font-size: .74rem; line-height: 1.28; }
.folder-picker { min-width: 0; min-height: 33px; padding: 4px 6px; font-size: .79rem; }
.folder-box { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: #faf9fd; }
.folder-box-head { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; min-width: 0; }
.folder-expand { display: flex; align-items: center; gap: 9px; flex: 1 1 auto; min-width: 0;
  border: 0; border-radius: 7px; background: transparent; color: inherit; text-align: left; padding: 6px; }
.folder-expand:hover { background: #f1ecfc; }
.folder-chevron { display: block; width: 8px; height: 8px; flex: 0 0 8px; margin-inline: auto 6px;
  border: solid #716589; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); }
.folder-expand[aria-expanded="true"] .folder-chevron { transform: rotate(225deg) translateY(-2px); }
.folder-box-actions { display: flex; gap: 5px; }
.folder-box-actions .button { min-height: 30px; padding: 4px 8px; }
.folder-members { padding: 8px; border-top: 1px solid var(--line); }
.folder-empty { padding: 15px 8px; color: var(--muted); font-size: .84rem; text-align: center; }
.folder-drop-active { background: #f4efff; outline: 2px solid #8c72e0; outline-offset: -2px; }
.folder-dragged { opacity: .5; }

form label { display: grid; gap: 6px; font-size: .87rem; font-weight: 650; }
input, textarea, select { width: 100%; color: var(--ink); background: #fff; border: 1px solid #dbd9e9;
  border-radius: 8px; padding: 8px 10px; min-height: 38px; }
input[type="checkbox"] { min-height: 0; width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
input[type="file"] { font-weight: 400; }
input:disabled, select:disabled { background: #f6f5fa; color: var(--muted); }
textarea { resize: vertical; min-height: 94px; }
.field-hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
.message-preview { background: var(--canvas); border: 1px solid var(--line); border-radius: 8px;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 170px; overflow: auto; padding: 10px; }
.check { display: flex; align-items: center; gap: 8px; width: fit-content; font-weight: 500; }
.form-stack { display: grid; gap: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.campaign-schedule-fields { align-items: start; }
.campaign-start-field { display: grid; gap: 6px; min-width: 0; }
.campaign-start-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.campaign-start-control input, .campaign-schedule-fields select { height: 38px; min-width: 0; }
.campaign-start-control .button { width: 36px; }
.choice-list { display: grid; gap: 0; max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.choice-list label { width: 100%; padding: 9px; border-bottom: 1px solid var(--line); cursor: pointer; }
.choice-list label:last-child { border-bottom: 0; }
.choice-list label:hover { background: #f8f5ff; }
.choice-list .destination-choice-topic { padding-inline-start: 25px; background: #f0f8f5; }
.choice-list .destination-note { display: block; margin-top: 3px; color: var(--muted); }
.choice-list label span { min-width: 0; overflow-wrap: anywhere; }
.choice-list .source-choice small { display: block; color: var(--muted); margin: 3px 0 0; font-size: .74rem; }
.choice-hint { padding: 9px; font-size: .84rem; color: var(--muted); }
.form-error { background: #fbeaf0; color: #8e2148; border-radius: 8px; padding: 9px 12px; font-size: .86rem; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 5px; font-size: .87rem; font-weight: 700; }
dialog { width: min(654px, calc(100% - 26px)); max-height: calc(100dvh - 36px); border: 1px solid var(--line);
  border-radius: 14px; padding: 0; color: var(--ink); box-shadow: 0 18px 85px #1d154e54; }
dialog::backdrop { background: #17132977; }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 38px); }
.dialog-head { padding: 16px 19px; border-bottom: 1px solid var(--line); display: flex;
  justify-content: space-between; align-items: flex-start; gap: 12px; }
.dialog-head h2 { font-size: 1.24rem; }
.dialog-head p { margin-top: 4px; font-size: .84rem; }
.dialog-body { padding: 16px 19px; overflow: auto; }
.dialog-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 19px;
  border-top: 1px solid var(--line); }
.qr-login { justify-items: center; text-align: center; }
.login-qr { display: block; width: min(228px, 100%); height: auto; aspect-ratio: 1;
  background: white; border: 1px solid var(--line); border-radius: 10px; }
dialog .form-error { margin: 0 19px 9px; }
.toast { position: fixed; bottom: 18px; right: 18px; z-index: 5; max-width: min(440px, calc(100% - 36px));
  background: #25233f; color: #fff; border-radius: 9px; padding: 10px 14px; box-shadow: 0 6px 30px #211f363b;
  font-size: .9rem; }
.toast[data-error="true"] { background: #8f2447; }

.login-screen { background: #fff; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.login-visual { position: relative; isolation: isolate; display: flex; min-height: 100dvh; flex-direction: column;
  justify-content: space-between; overflow: hidden; padding: clamp(26px, 6vw, 90px); color: #fff;
  background: radial-gradient(ellipse at 78% 55%, #3e3187 0, #231f4b 45%, #19192f 75%); }
.login-brand { font-size: 1.4rem; font-weight: 750; }
.login-illustration { position: absolute; z-index: -1; top: 47%; left: 54%; display: grid; place-items: center;
  width: clamp(135px, 20vw, 330px); aspect-ratio: 1; border-radius: 30%; transform: translate(-50%, -50%) rotate(-15deg);
  background: linear-gradient(145deg, #b19cff, #785bed 55%, #5c41c8); border: 1px solid #c1aaffba;
  box-shadow: 0 25px 75px #120a42a1, 0 0 0 22px #aaa0ff0b, 0 0 0 49px #aaa0ff09, 0 0 0 83px #aaa0ff08; }
.login-illustration span { color: #fff; font-size: clamp(70px, 13vw, 205px); transform: rotate(-17deg); }
.login-tagline p { margin-top: 8px; font-size: clamp(1.9rem, 4vw, 4.2rem); line-height: 1.03; letter-spacing: -.066em; font-weight: 750; }
.login-main { display: grid; place-items: center; min-width: 0; padding: 27px; }
.login-form { display: grid; gap: 13px; width: min(100%, 365px); }
.login-form label { margin-top: 8px; }
.login-form .mini-icon { margin-bottom: 2px; }
.login-form .button { justify-content: space-between; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 183px minmax(0, 1fr); }
  .content, .topbar { padding-left: 22px; padding-right: 22px; }
  .metric { gap: 8px; padding: 12px; }
}
@media (max-width: 820px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; position: fixed; z-index: 4; inset: 0 auto 0 0; width: 226px; box-shadow: 0 0 50px #1915316b; }
  .sidebar.open { display: flex; }
  .icon.mobile-only { display: inline-flex; }
  .overview-grid { grid-template-columns: 1fr; }
  .folder-board { grid-template-columns: 1fr; }
  .schedule-empty { min-height: 85px; }
}
@media (max-width: 565px) {
  .content, .topbar { padding-left: 13px; padding-right: 13px; }
  .topbar { gap: 9px; min-height: 53px; }
  .breadcrumbs span { display: none; }
  .page-header { align-items: flex-start; flex-wrap: wrap; gap: 9px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 70px; }
  .form-grid { grid-template-columns: 1fr; }
  .folder-destination { grid-template-columns: 14px minmax(0, 1fr); }
  .folder-picker { grid-column: 2; }
  .login-screen { grid-template-columns: 1fr; grid-template-rows: minmax(140px, 31dvh) 1fr; }
  .login-visual { min-height: 0; padding: 19px; }
  .login-tagline p { font-size: 1.55rem; }
  .login-illustration { width: 109px; left: 77%; top: 54%; }
  .login-illustration span { font-size: 69px; }
  .login-main { align-items: start; padding: 32px 19px; }
}
