:root {
  --bg: #0f1012;
  --sidebar: #151619;
  --panel: #191b1f;
  --panel-2: #202329;
  --panel-3: #272a31;
  --line: #30343c;
  --line-soft: #25282e;
  --text: #f5f5f3;
  --muted: #9ca3af;
  --muted-2: #6b7280;
  --accent: #a94347;
  --accent-bright: #c45a5e;
  --accent-soft: rgba(169, 67, 71, .15);
  --green: #39b980;
  --green-soft: rgba(57, 185, 128, .13);
  --blue: #5d9cec;
  --blue-soft: rgba(93, 156, 236, .13);
  --yellow: #e5aa49;
  --yellow-soft: rgba(229, 170, 73, .13);
  --red: #e05a65;
  --shadow: 0 18px 60px rgba(0, 0, 0, .38);
  --radius: 14px;
  --radius-sm: 9px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
body { font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.muted { color: var(--muted); }
.tiny { color: var(--muted); font-size: 11px; }
.danger-text { color: var(--red); }
.success-text { color: var(--green); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: relative; z-index: 30; min-height: 100vh; background: var(--sidebar); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; padding: 18px 12px 12px; }
.brand, .auth-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 19px; }
.brand-mark { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; background: linear-gradient(145deg, var(--accent-bright), #7f2f33); color: white; font-weight: 900; box-shadow: 0 8px 24px rgba(169, 67, 71, .3); }
.brand strong, .auth-brand strong { display: block; font-size: 14px; letter-spacing: .1px; }
.brand small, .auth-brand small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
.main-nav { display: flex; flex-direction: column; gap: 2px; }
.main-nav button { appearance: none; border: 0; background: transparent; color: #a9afb9; border-radius: 9px; min-height: 39px; padding: 0 10px; display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; font-weight: 560; font-size: 13px; }
.main-nav button > span { width: 18px; color: #7f8793; font-size: 16px; text-align: center; }
.main-nav button:hover { background: #1e2025; color: white; }
.main-nav button.active { background: var(--accent-soft); color: #f9e8e9; }
.main-nav button.active > span { color: var(--accent-bright); }
.nav-count { margin-left: auto; min-width: 20px; height: 19px; padding: 0 6px; display: none; place-items: center; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10px; }
.nav-count:not(:empty) { display: grid; }
.nav-label { color: #606773; font-size: 9px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; padding: 19px 10px 7px; }
.sidebar-foot { margin-top: auto; position: relative; }
.connection-pill { margin: 0 6px 10px; color: var(--muted); background: #111215; border: 1px solid var(--line-soft); min-height: 31px; padding: 7px 9px; border-radius: 8px; display: flex; align-items: center; gap: 7px; font-size: 10px; }
.connection-pill i { width: 7px; height: 7px; border-radius: 99px; background: var(--yellow); box-shadow: 0 0 0 3px rgba(229, 170, 73, .1); }
.connection-pill i.open { background: var(--green); box-shadow: 0 0 0 3px rgba(57, 185, 128, .1); }
.connection-pill i.close, .connection-pill i.erro { background: var(--red); }
.profile { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; border-radius: 10px; padding: 8px; cursor: pointer; text-align: left; }
.profile:hover { background: var(--panel-2); }
.profile > span:nth-child(2) { min-width: 0; flex: 1; }
.profile strong, .profile small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.profile strong { font-size: 12px; }
.profile small { color: var(--muted); font-size: 10px; margin-top: 2px; }
.profile b { color: var(--muted); }
.avatar { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; background: var(--panel-3); border: 1px solid var(--line); border-radius: 9px; font-size: 11px; font-weight: 800; }
.profile-menu { position: absolute; bottom: 52px; left: 5px; right: 5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 5px; box-shadow: var(--shadow); }
.profile-menu button { width: 100%; border: 0; background: transparent; padding: 9px 10px; text-align: left; border-radius: 7px; cursor: pointer; font-size: 12px; }
.profile-menu button:hover { background: var(--panel-3); }

.workspace { min-width: 0; height: 100vh; display: grid; grid-template-rows: 67px minmax(0, 1fr); overflow: hidden; }
.topbar { min-width: 0; border-bottom: 1px solid var(--line-soft); background: rgba(15, 16, 18, .94); backdrop-filter: blur(14px); display: flex; align-items: center; gap: 12px; padding: 0 22px; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 720; }
.topbar p { color: var(--muted); font-size: 10px; margin: 4px 0 0; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
#content { min-width: 0; min-height: 0; overflow: auto; outline: none; }
.page { padding: 21px 22px 40px; max-width: 1600px; margin: 0 auto; }
.page.flush { padding: 0; max-width: none; height: 100%; overflow: hidden; }
.loading-page { min-height: 55vh; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent-bright); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.button, .icon-button { appearance: none; border: 1px solid var(--line); background: var(--panel-2); min-height: 35px; border-radius: 8px; padding: 0 12px; cursor: pointer; font-weight: 650; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.button:hover, .icon-button:hover { border-color: #4b505c; background: var(--panel-3); }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-bright); }
.button.success { background: var(--green); border-color: var(--green); color: #07150f; }
.button.danger { color: #ffb7bd; border-color: rgba(224, 90, 101, .38); background: rgba(224, 90, 101, .08); }
.button.ghost { background: transparent; }
.button.small { min-height: 29px; padding: 0 9px; font-size: 11px; }
.button.wide { width: 100%; min-height: 43px; }
.button:disabled { opacity: .48; cursor: not-allowed; }
.icon-button { width: 35px; padding: 0; }

.hero-strip { border: 1px solid var(--line-soft); border-radius: var(--radius); background: linear-gradient(120deg, rgba(169, 67, 71, .13), rgba(31, 34, 40, .6)); padding: 21px; display: flex; align-items: center; gap: 20px; margin-bottom: 17px; overflow: hidden; position: relative; }
.hero-strip::after { content: ''; position: absolute; width: 230px; height: 230px; right: -90px; top: -120px; border-radius: 50%; background: radial-gradient(circle, rgba(196, 90, 94, .25), transparent 68%); }
.hero-strip h2 { margin: 0 0 6px; font-size: 19px; }
.hero-strip p { margin: 0; color: var(--muted); font-size: 12px; }
.hero-strip .hero-actions { margin-left: auto; z-index: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 11px; margin-bottom: 17px; }
.stat-card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; padding: 15px; min-height: 104px; }
.stat-card header { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.stat-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent-bright); }
.stat-card strong { display: block; margin-top: 14px; font-size: 25px; line-height: 1; letter-spacing: -.6px; }
.stat-card small { color: var(--muted-2); display: block; margin-top: 6px; font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .8fr); gap: 13px; }
.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); min-width: 0; }
.card-head { min-height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 9px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 13px; }
.card-head p { color: var(--muted); font-size: 10px; margin: 3px 0 0; }
.card-head .head-actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 16px; }
.card + .card { margin-top: 13px; }
.chart { height: 218px; display: flex; align-items: flex-end; gap: 7px; padding-top: 15px; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 5px; }
.chart-bars { height: calc(100% - 19px); width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.chart-bar { width: min(9px, 42%); min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); }
.chart-bar.secondary { background: #39404a; }
.chart-col small { color: var(--muted-2); font-size: 8px; }
.queue-list { display: flex; flex-direction: column; }
.queue-row { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.queue-row:last-child { border: 0; }
.queue-row i { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); }
.queue-row span { font-size: 11px; }
.queue-row small { color: var(--muted); display: block; margin-top: 3px; }
.queue-row b { font-size: 12px; }

.inbox-layout { height: 100%; min-height: 0; display: grid; grid-template-columns: 330px minmax(390px, 1fr) 286px; background: var(--bg); }
.conversation-pane, .thread-pane, .contact-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.conversation-pane, .thread-pane { border-right: 1px solid var(--line-soft); }
.pane-head { min-height: 65px; padding: 11px 13px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 9px; }
.pane-head strong { font-size: 13px; }
.search { position: relative; flex: 1; }
.search input { padding-left: 33px; }
.search::before { content: '⌕'; position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); z-index: 1; }
.filter-bar { display: flex; gap: 5px; padding: 9px 11px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.chip { appearance: none; border: 1px solid var(--line); background: transparent; color: var(--muted); min-height: 27px; border-radius: 99px; padding: 0 9px; white-space: nowrap; cursor: pointer; font-size: 10px; }
.chip.active { border-color: rgba(169, 67, 71, .55); background: var(--accent-soft); color: #f0c8ca; }
.conversation-list { flex: 1; overflow: auto; }
.conversation-item { padding: 12px 13px; border-bottom: 1px solid var(--line-soft); cursor: pointer; display: grid; grid-template-columns: 37px minmax(0, 1fr); gap: 10px; position: relative; }
.conversation-item:hover { background: rgba(255,255,255,.018); }
.conversation-item.selected { background: var(--accent-soft); box-shadow: inset 2px 0 var(--accent-bright); }
.contact-avatar { width: 37px; height: 37px; border-radius: 11px; display: grid; place-items: center; background: var(--panel-3); color: #d5d8dd; font-weight: 800; font-size: 11px; }
.conversation-item.selected .contact-avatar { background: rgba(169, 67, 71, .28); color: #f3d9da; }
.conv-main { min-width: 0; }
.conv-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.conv-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.conv-line time { color: var(--muted-2); margin-left: auto; font-size: 9px; }
.conv-preview { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; margin-top: 5px; }
.conv-tags { display: flex; gap: 4px; margin-top: 7px; overflow: hidden; }
.unread { position: absolute; right: 13px; bottom: 11px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; display: grid; place-items: center; background: var(--accent); font-size: 8px; font-weight: 800; }
.label { display: inline-flex; align-items: center; gap: 4px; max-width: 105px; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--panel-3); color: var(--muted); font-size: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label::before { content: ''; width: 5px; height: 5px; flex: 0 0 5px; border-radius: 99px; background: var(--tag-color, var(--muted)); }
.empty-state { flex: 1; min-height: 220px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 30px; }
.empty-state span { display: block; font-size: 28px; color: var(--muted-2); margin-bottom: 10px; }
.empty-state strong { display: block; color: #c3c7ce; font-size: 13px; }
.empty-state p { margin: 6px 0 0; font-size: 10px; max-width: 270px; line-height: 1.55; }
.thread-header { min-height: 65px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 9px; }
.thread-header .identity { min-width: 0; flex: 1; }
.thread-header strong, .thread-header small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-header strong { font-size: 12px; }
.thread-header small { color: var(--muted); font-size: 9px; margin-top: 3px; }
.message-list { flex: 1; min-height: 0; overflow: auto; padding: 17px 5.5%; background: radial-gradient(ellipse at 50% 0, rgba(169, 67, 71, .035), transparent 58%); display: flex; flex-direction: column; gap: 7px; }
.bubble { max-width: min(74%, 580px); padding: 8px 11px 6px; border-radius: 11px; line-height: 1.43; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
.bubble.in { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line-soft); border-bottom-left-radius: 3px; }
.bubble.out { align-self: flex-end; background: rgba(169, 67, 71, .2); border: 1px solid rgba(169, 67, 71, .3); border-bottom-right-radius: 3px; }
.bubble.system { align-self: center; background: transparent; border: 1px dashed var(--line); color: var(--muted); max-width: 85%; text-align: center; font-size: 10px; }
.msg-media { display: block; max-width: 250px; max-height: 320px; border-radius: 9px; cursor: zoom-in; }
video.msg-media { cursor: default; }
.msg-audio { max-width: 235px; height: 34px; }
.msg-legenda { margin-top: 4px; }
.msg-arquivo { display: inline-block; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: inherit; text-decoration: none; }
.msg-arquivo:hover { border-color: var(--line-soft); text-decoration: underline; }
.bubble footer { display: flex; justify-content: flex-end; gap: 5px; color: var(--muted-2); font-size: 8px; margin-top: 4px; }
.bubble .failed { color: var(--red); }
.composer-wrap { border-top: 1px solid var(--line-soft); padding: 9px 12px 11px; }
.quick-row { display: flex; gap: 5px; overflow-x: auto; margin-bottom: 7px; }
.composer { display: flex; align-items: flex-end; gap: 7px; }
.composer textarea { flex: 1; min-height: 39px; max-height: 110px; resize: none; }
.contact-pane { background: var(--sidebar); overflow: auto; }
.contact-summary { padding: 18px 15px; text-align: center; border-bottom: 1px solid var(--line-soft); }
.contact-summary .contact-avatar { margin: 0 auto 9px; width: 47px; height: 47px; font-size: 14px; }
.contact-summary h3 { margin: 0; font-size: 13px; }
.contact-summary p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.side-section { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); }
.side-section > header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.side-section h4 { margin: 0; font-size: 9px; text-transform: uppercase; letter-spacing: .8px; color: #777f8b; }
.detail-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 8px 0; font-size: 10px; }
.detail-row span { color: var(--muted); }
.detail-row b { text-align: right; font-weight: 600; }
.note { border-left: 2px solid var(--accent); background: var(--panel); border-radius: 0 7px 7px 0; padding: 8px; margin-top: 7px; font-size: 10px; line-height: 1.45; }
.note footer { color: var(--muted); font-size: 8px; margin-top: 5px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 13px; }
.toolbar .search { max-width: 330px; }
.toolbar-spacer { margin-left: auto; }
.table-card { overflow: hidden; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 13px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
th { color: #747c88; font-size: 9px; text-transform: uppercase; letter-spacing: .6px; font-weight: 800; background: #17191c; white-space: nowrap; }
td { font-size: 11px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.012); }
.cell-main strong { display: block; font-size: 11px; }
.cell-main small { color: var(--muted); display: block; margin-top: 3px; font-size: 9px; }
.status { display: inline-flex; align-items: center; height: 21px; padding: 0 7px; border-radius: 99px; font-size: 8px; font-weight: 750; text-transform: uppercase; letter-spacing: .3px; background: var(--panel-3); color: var(--muted); }
.status.active, .status.open, .status.sent, .status.completed { color: #74daa9; background: var(--green-soft); }
.status.ia, .status.running, .status.scheduled { color: #e18a8e; background: var(--accent-soft); }
.status.humano, .status.queued { color: #8ab8f2; background: var(--blue-soft); }
.status.draft, .status.paused, .status.pending { color: #ecc479; background: var(--yellow-soft); }
.status.failed, .status.cancelled { color: #f18b94; background: rgba(224,90,101,.13); }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 11px 13px; border-top: 1px solid var(--line-soft); }
.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line-soft); margin-bottom: 15px; overflow-x: auto; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 10px 12px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 11px; }
.tab.active { color: white; border-color: var(--accent-bright); }
.list-grid { display: grid; grid-template-columns: repeat(3, minmax(230px, 1fr)); gap: 11px; }
.item-card { padding: 15px; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px; }
.item-card header { display: flex; align-items: flex-start; gap: 8px; }
.item-card header > div { flex: 1; min-width: 0; }
.item-card h3 { font-size: 12px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-card p { color: var(--muted); font-size: 10px; line-height: 1.5; }
.item-card footer { display: flex; align-items: center; gap: 6px; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--line-soft); }
.metric-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 11px 0; }
.metric-pair div { background: var(--panel-2); border-radius: 8px; padding: 9px; }
.metric-pair b { display: block; font-size: 15px; }
.metric-pair small { color: var(--muted); font-size: 8px; }
.settings-grid { display: grid; grid-template-columns: 220px minmax(0, 760px); gap: 16px; align-items: start; }
.settings-nav { padding: 6px; position: sticky; top: 0; }
.settings-nav button { width: 100%; border: 0; background: transparent; color: var(--muted); text-align: left; padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: 11px; }
.settings-nav button.active, .settings-nav button:hover { background: var(--panel-2); color: white; }
.form-section { padding: 18px; }
.form-section h2 { margin: 0 0 5px; font-size: 14px; }
.form-section > p { color: var(--muted); margin: 0 0 17px; font-size: 10px; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
label.field { display: block; color: #c4c8ce; font-size: 10px; font-weight: 650; }
label.field small { color: var(--muted); display: block; font-weight: 400; margin: 4px 0 6px; line-height: 1.4; }
input, select, textarea { width: 100%; color: var(--text); background: #131519; border: 1px solid var(--line); border-radius: 8px; min-height: 37px; padding: 8px 10px; outline: none; font-size: 11px; }
textarea { min-height: 95px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: rgba(196, 90, 94, .72); box-shadow: 0 0 0 3px rgba(169, 67, 71, .08); }
input[type=checkbox] { width: 16px; min-height: 16px; accent-color: var(--accent); }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 11px; cursor: pointer; }
.form-actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.info-box, .warning-box, .danger-box { border: 1px solid rgba(93,156,236,.24); background: var(--blue-soft); border-radius: 9px; padding: 10px 12px; color: #b9d2f3; font-size: 10px; line-height: 1.5; margin: 10px 0; }
.warning-box { border-color: rgba(229,170,73,.28); background: var(--yellow-soft); color: #efd092; }
.danger-box { border-color: rgba(224,90,101,.28); background: rgba(224,90,101,.1); color: #f2a9af; }
.flow-blocks { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; }
.flow-block { display: grid; grid-template-columns: 33px 130px minmax(0, 1fr) 33px; gap: 7px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); padding: 7px; border-radius: 9px; }
.flow-index { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent-bright); font-size: 9px; font-weight: 800; }
.flow-toolbar .flow-search { width: min(310px, 34vw); flex: 0 1 310px; }
.flow-folder { display: block; margin: 0 0 15px; }
.flow-folder > summary { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line-soft); border-radius: 10px 10px 0 0; background: #17191d; cursor: pointer; list-style: none; }
.flow-folder > summary::-webkit-details-marker { display: none; }
.flow-folder:not([open]) > summary { border-radius: 10px; }
.flow-folder > summary span { flex: 1; }
.flow-folder > summary strong, .flow-folder > summary small { display: block; }
.flow-folder > summary strong { font-size: 11px; }
.flow-folder > summary small { color: var(--muted); font-size: 8px; margin-top: 3px; }
.flow-folder > summary > b { color: var(--muted); transition: transform .16s; }
.flow-folder:not([open]) > summary > b { transform: rotate(-90deg); }
.flow-list-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-top: 0; border-radius: 0 0 10px 10px; background: var(--panel); }
.flow-list-head, .flow-list-row { min-width: 940px; display: grid; grid-template-columns: minmax(280px, 2fr) minmax(150px, 1fr) 65px 65px 82px 95px 166px; gap: 10px; align-items: center; }
.flow-list-head { min-height: 34px; padding: 0 13px; border-bottom: 1px solid var(--line-soft); background: #15171a; color: #747c88; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .55px; }
.flow-list-row { min-height: 58px; padding: 7px 13px; border-bottom: 1px solid var(--line-soft); cursor: pointer; outline: none; transition: background .12s, box-shadow .12s; }
.flow-list-row:last-child { border-bottom: 0; }
.flow-list-row:hover, .flow-list-row:focus-visible { background: rgba(169,67,71,.075); box-shadow: inset 2px 0 var(--accent-bright); }
.flow-list-name { min-width: 0; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 9px; align-items: center; }
.flow-list-name > i { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent-bright); font-style: normal; font-size: 14px; }
.flow-list-name strong, .flow-list-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-list-name strong { font-size: 10px; }
.flow-list-name small { color: var(--muted); font-size: 8px; margin-top: 4px; }
.flow-list-origin { color: var(--muted); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow-list-row > b { font-size: 10px; font-weight: 650; }
.flow-list-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.flow-open-arrow { width: 24px; height: 24px; display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.flow-list-row:hover .flow-open-arrow { color: var(--accent-bright); transform: translateX(2px); }

.flow-designer-layer { position: fixed; inset: 0; z-index: 150; background: #111317; }
.flow-designer { width: 100%; height: 100dvh; min-height: 0; display: grid; grid-template-rows: 64px minmax(0, 1fr); color: var(--text); }
.designer-topbar { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #181a1f; border-bottom: 1px solid var(--line); box-shadow: 0 8px 26px rgba(0,0,0,.2); z-index: 4; }
.designer-title { width: min(290px, 24vw); min-width: 180px; }
.designer-title input { min-height: 30px; padding: 2px 7px; background: transparent; border-color: transparent; color: white; font-size: 13px; font-weight: 800; }
.designer-title input:focus { background: #111317; border-color: var(--line); }
.designer-title small { display: block; padding: 0 8px; margin-top: 2px; color: var(--muted); font-size: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.designer-topbar > label { color: var(--muted); font-size: 8px; text-transform: uppercase; letter-spacing: .5px; }
.designer-topbar > label select { display: block; min-height: 31px; min-width: 108px; margin-top: 2px; padding: 4px 8px; }
.designer-topbar .trigger-value { width: min(230px, 18vw); min-height: 33px; }
.designer-spacer { flex: 1; }
.designer-body { min-width: 0; min-height: 0; display: grid; grid-template-columns: 190px minmax(400px, 1fr) 292px; }
.node-palette, .node-inspector { min-height: 0; overflow: auto; background: #181a1f; z-index: 3; }
.node-palette { padding: 16px 12px; border-right: 1px solid var(--line); }
.node-palette > strong, .node-palette > small { display: block; }
.node-palette > strong { font-size: 12px; }
.node-palette > small { color: var(--muted); font-size: 9px; margin: 4px 0 14px; }
.node-palette button { width: 100%; min-height: 42px; display: grid; grid-template-columns: 27px 1fr 18px; align-items: center; gap: 7px; margin: 0 0 7px; padding: 6px 8px; border: 1px solid var(--line-soft); border-radius: 9px; background: var(--panel-2); color: var(--text); text-align: left; cursor: pointer; font-size: 10px; }
.node-palette button:hover { border-color: color-mix(in srgb, var(--node-color), transparent 45%); transform: translateX(2px); }
.node-palette button i { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: color-mix(in srgb, var(--node-color), transparent 82%); color: var(--node-color); font-style: normal; font-size: 13px; }
.node-palette button b { color: var(--muted); font-size: 15px; }
.flow-canvas-wrap { min-width: 0; min-height: 0; overflow: auto; position: relative; background: #101216; }
.flow-canvas { width: 2300px; height: 1400px; position: relative; background-image: radial-gradient(circle, rgba(133,143,158,.24) 1px, transparent 1px); background-size: 22px 22px; }
#flowEdges { position: absolute; inset: 0; width: 2300px; height: 1400px; overflow: visible; pointer-events: none; }
.flow-edge { fill: none; stroke: currentColor; stroke-width: 2.2; opacity: .78; }
.canvas-node { width: 270px; min-height: 118px; position: absolute; border: 1px solid var(--line); border-radius: 11px; background: #202329; box-shadow: 0 10px 26px rgba(0,0,0,.28); color: var(--text); cursor: pointer; }
.canvas-node::before { content: ''; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 4px 4px 0; background: var(--node-color); }
.canvas-node:hover { border-color: color-mix(in srgb, var(--node-color), transparent 45%); }
.canvas-node.selected { border-color: var(--node-color); box-shadow: 0 0 0 3px color-mix(in srgb, var(--node-color), transparent 82%), 0 16px 32px rgba(0,0,0,.35); }
.flow-node-handle { min-height: 48px; display: grid; grid-template-columns: 29px 1fr 25px; align-items: center; gap: 8px; padding: 8px 9px 8px 12px; border-bottom: 1px solid var(--line-soft); cursor: grab; }
.flow-node-handle:active { cursor: grabbing; }
.flow-node-handle > i { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: color-mix(in srgb, var(--node-color), transparent 83%); color: var(--node-color); font-style: normal; }
.flow-node-handle > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 750; }
.flow-node-handle small { display: block; color: var(--muted); font-size: 8px; font-weight: 400; margin-top: 2px; }
.node-menu { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; }
.canvas-node-content { min-height: 58px; max-height: 92px; overflow: hidden; padding: 10px 13px 14px; color: #b9bec7; font-size: 9px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.start-badge { position: absolute; left: 10px; top: -19px; color: #83ddb3; font-size: 7px; letter-spacing: .8px; }
.node-port { width: 12px; height: 12px; position: absolute; top: calc(50% - 6px); border: 2px solid #111317; border-radius: 99px; background: var(--node-color); }
.node-port.input { left: -7px; }
.node-port.output { right: -7px; }
.node-inspector { border-left: 1px solid var(--line); }
.node-inspector > div > header { min-height: 64px; display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
.node-inspector header > i { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: color-mix(in srgb, var(--node-color), transparent 83%); color: var(--node-color); font-style: normal; }
.node-inspector header strong, .node-inspector header small { display: block; }
.node-inspector header strong { font-size: 12px; }
.node-inspector header small { color: var(--muted); font-size: 8px; margin-top: 3px; }
.inspector-form { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.inspector-form textarea { min-height: 110px; }
.inspector-form .branch { padding-left: 9px; border-left: 2px solid; }
.inspector-form .branch.true { border-color: #22c55e; }
.inspector-form .branch.false { border-color: #ef8354; }
.inspector-form .button.danger { color: #f2a9af; border-color: rgba(224,90,101,.35); }
.inspector-empty { padding: 25px 16px; color: var(--muted); font-size: 10px; }

.modal-layer { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.67); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 18px; }
.modal { width: min(610px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); position: relative; }
.modal.wide { width: min(880px, 100%); }
.modal-close { position: absolute; right: 12px; top: 11px; z-index: 2; width: 30px; height: 30px; border-radius: 8px; border: 0; background: var(--panel-2); color: var(--muted); cursor: pointer; font-size: 18px; }
.modal-head { padding: 19px 50px 14px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-head p { color: var(--muted); margin: 5px 0 0; font-size: 10px; }
.modal-content { padding: 17px 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 7px; padding: 13px 18px; border-top: 1px solid var(--line-soft); }
.toast-stack { position: fixed; right: 17px; bottom: 17px; z-index: 130; display: flex; flex-direction: column; gap: 7px; }
.toast { min-width: 240px; max-width: 370px; background: #25282e; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 9px; padding: 10px 12px; font-size: 11px; animation: toast-in .2s ease-out; }
.toast.error { border-color: rgba(224,90,101,.45); }
.toast.success { border-color: rgba(57,185,128,.4); }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 0, rgba(169,67,71,.16), transparent 36%), var(--bg); }
.auth-card { width: min(395px, 100%); background: var(--panel); border: 1px solid var(--line-soft); border-radius: 17px; box-shadow: var(--shadow); padding: 27px; }
.auth-brand { padding: 0 0 30px; }
.auth-card .eyebrow { color: var(--accent-bright); font-size: 9px; font-weight: 900; letter-spacing: 1.2px; }
.auth-card h1 { font-size: 22px; margin: 8px 0 8px; }
.auth-card p { color: var(--muted); font-size: 11px; line-height: 1.55; margin: 0 0 21px; }
.auth-card label { display: block; color: #c4c8ce; font-size: 10px; font-weight: 650; margin: 12px 0; }
.auth-card label input { margin-top: 6px; min-height: 42px; }
.auth-card form > small { display: block; color: var(--muted); font-size: 9px; margin: -4px 0 13px; line-height: 1.5; }
.auth-card footer { color: var(--muted-2); font-size: 9px; text-align: center; margin-top: 24px; }
.form-error { margin-top: 13px; padding: 9px 10px; border-radius: 8px; color: #f2a9af; background: rgba(224,90,101,.1); border: 1px solid rgba(224,90,101,.25); font-size: 10px; }
.form-error.success { color: #83ddb3; background: var(--green-soft); border-color: rgba(57,185,128,.25); }

@media (max-width: 1180px) {
  .inbox-layout { grid-template-columns: 310px minmax(390px, 1fr); }
  .contact-pane { display: none; }
  .list-grid { grid-template-columns: repeat(2, minmax(230px, 1fr)); }
}

@media (max-width: 900px) {
  .mobile-only { display: inline-flex !important; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 236px; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .workspace { height: 100dvh; grid-template-rows: 61px minmax(0, 1fr); }
  .topbar { padding: 0 13px; }
  .page { padding: 15px 13px 35px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav button { width: auto; white-space: nowrap; }
  .designer-topbar { overflow-x: auto; }
  .designer-topbar .trigger-value, .designer-topbar > label { display: none; }
  .designer-body { grid-template-columns: 82px minmax(390px, 1fr); }
  .node-palette { padding: 12px 8px; }
  .node-palette > strong, .node-palette > small, .node-palette button span, .node-palette button b { display: none; }
  .node-palette button { grid-template-columns: 1fr; place-items: center; padding: 6px; }
  .node-inspector { position: fixed; right: 0; top: 64px; bottom: 0; width: min(292px, 82vw); box-shadow: -14px 0 36px rgba(0,0,0,.42); }
}

@media (max-width: 680px) {
  .topbar p { display: none; }
  .top-actions .button:not(.primary) { display: none; }
  .hero-strip { align-items: flex-start; flex-direction: column; }
  .hero-strip .hero-actions { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 12px; min-height: 92px; }
  .stat-card strong { font-size: 21px; }
  .list-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .inbox-layout { display: block; position: relative; }
  .conversation-pane, .thread-pane { position: absolute; inset: 0; border: 0; background: var(--bg); }
  .thread-pane { transform: translateX(100%); transition: transform .2s; z-index: 3; }
  .inbox-layout.thread-open .thread-pane { transform: translateX(0); }
  .message-list { padding-left: 13px; padding-right: 13px; }
  .bubble { max-width: 86%; }
  .flow-block { grid-template-columns: 30px 1fr 30px; }
  .flow-block .flow-value { grid-column: 2 / 3; }
  .toolbar .search { max-width: none; width: 100%; flex-basis: 100%; }
  .flow-toolbar .flow-search { width: 100%; flex-basis: 100%; }
  .flow-list-head { display: none; }
  .flow-list-row { min-width: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 9px; min-height: 70px; }
  .flow-list-name { grid-column: 1; grid-row: 1; }
  .flow-list-origin { grid-column: 1; grid-row: 2; padding-left: 39px; }
  .flow-list-row > b { display: none; }
  .flow-list-row > span:nth-of-type(2) { grid-column: 2; grid-row: 1; }
  .flow-list-actions { grid-column: 2; grid-row: 2; }
  .flow-list-actions .button { display: none; }
  .modal-layer { padding: 0; place-items: end stretch; }
  .modal, .modal.wide { width: 100%; max-height: 92dvh; border-radius: 15px 15px 0 0; }
}
