:root {
  --bg: #e8f1f0;
  --panel: #fff;
  --ink: #12201e;
  --muted: #5a6e6b;
  --brand: #0d6e6e;
  --brand-2: #0a5555;
  --line: #d3e2df;
  --danger: #b33a3a;
  --ok: #1f6b4a;
  --sidebar: #102422;
  --radius: 14px;
  --font: "Segoe UI", "Noto Sans TC", "PingFang TC", sans-serif;
  --shadow: 0 10px 28px rgba(16, 36, 34, 0.06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 55%),
    radial-gradient(ellipse 50% 35% at 0% 0%, color-mix(in srgb, var(--brand) 12%, transparent), transparent 50%),
    var(--bg);
  min-height: 100vh;
}
body:not(.is-authed) .shell { display: none !important; }
body.is-authed .auth-view { display: none !important; }
body.is-authed { background: var(--bg); }
button, input, textarea, select { font: inherit; }
a { color: var(--brand); }
.btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
}
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e2b4b4; background: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); }
.ok { color: var(--ok); }
.banner { margin: 0 24px 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.banner.err { background: #fdecec; }
.banner.ok { background: #e7f6ee; }

.auth-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 18px 40px rgba(16,36,34,.08);
}
.brand { margin: 0; color: var(--brand); font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.auth-card h1 { margin: 6px 0 8px; font-size: 1.7rem; }
.tabs { display: flex; gap: 6px; margin: 16px 0; }
.tab {
  flex: 1; border: 1px solid var(--line); background: #f7fbfa; border-radius: 8px;
  padding: 8px; cursor: pointer; color: var(--muted);
}
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.form label, label.block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
label.block input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  width: 100%;
}
.form input, .form textarea, .form select {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; color: var(--ink);
}
.form .btn { width: 100%; margin-top: 4px; }

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.22s ease;
}
.shell.sidebar-collapsed { grid-template-columns: 76px 1fr; }
.sidebar {
  background: var(--sidebar); color: #e7f3f1; padding: 12px 10px 14px;
  display: flex; flex-direction: column; gap: 4px;
  overflow: hidden;
}
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: #e7f3f1;
  border-radius: 10px;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.18s ease, background 0.15s ease;
}
.sidebar-toggle:hover {
  background: rgba(255,255,255,.14);
  transform: scale(1.06);
}
.sidebar-brand {
  font-weight: 700;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  min-width: 0;
  flex: 1;
}
.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  background: #fff;
  flex-shrink: 0;
  display: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.sidebar-logo.is-on,
.sidebar-brand.has-logo .sidebar-logo {
  display: block;
}
.sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
#sidebar-brand-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}
.user-chip {
  font-size: 11px;
  color: rgba(255,255,255,.48);
  padding: 0;
  word-break: break-all;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  font-weight: 500;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group {
  margin: 12px 10px 4px;
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.38);
  white-space: nowrap;
  overflow: hidden;
}
.nav {
  text-align: left; border: none; background: transparent; color: rgba(255,255,255,.72);
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  transition: transform 0.16s ease, background 0.15s ease, color 0.15s ease;
  transform-origin: center left;
}
.nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: grid; place-items: center;
}
.nav-icon svg {
  width: 18px; height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
  transform: scale(1.05);
}
.nav.active {
  background: rgba(255,255,255,.14);
  color: #fff;
}
.nav.active:hover { transform: scale(1.05); }
.sidebar-logout {
  margin-top: auto;
  color: #cfe3df;
  border-color: rgba(255,255,255,.14);
  display: flex;
  align-items: center;
  gap: 11px;
  justify-content: flex-start;
  width: 100%;
  padding: 10px 12px;
  transition: transform 0.16s ease, background 0.15s ease;
  transform-origin: center left;
}
.sidebar-logout .nav-icon svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.sidebar-logout:hover {
  transform: scale(1.05);
  background: rgba(255,255,255,.08);
}

/* collapsed rail — hover 暫時展開 */
.shell.sidebar-collapsed {
  grid-template-columns: 76px 1fr;
}
.shell.sidebar-collapsed .sidebar {
  width: 76px;
  min-height: 100%;
  padding: 10px 8px;
  align-items: center;
  z-index: 40;
  box-sizing: border-box;
  transition:
    width 0.2s ease,
    padding 0.2s ease,
    box-shadow 0.2s ease,
    align-items 0.2s ease;
}
.shell.sidebar-collapsed .sidebar-head {
  flex-direction: column;
  gap: 10px;
  padding: 2px 0 10px;
  width: 100%;
  border-bottom-color: rgba(255,255,255,.06);
}
.shell.sidebar-collapsed .sidebar-toggle { margin: 0; }
.shell.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  flex: none;
}
.shell.sidebar-collapsed .sidebar-brand-copy,
.shell.sidebar-collapsed .nav-group,
.shell.sidebar-collapsed .nav-label {
  display: none;
  opacity: 0;
}
.shell.sidebar-collapsed .sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}
.shell.sidebar-collapsed .sidebar nav { width: 100%; align-items: center; }
.shell.sidebar-collapsed .nav,
.shell.sidebar-collapsed .sidebar-logout {
  justify-content: center;
  padding: 11px 0;
  width: 48px;
  margin-inline: auto;
  transform-origin: center center;
}
.shell.sidebar-collapsed .nav:hover,
.shell.sidebar-collapsed .sidebar-logout:hover {
  transform: scale(1.08);
}
.shell.sidebar-collapsed .sidebar-brand:not(.has-logo) {
  display: none;
}

.shell.sidebar-collapsed .sidebar:hover {
  width: 248px;
  align-items: stretch;
  padding: 12px 10px 14px;
  box-shadow: 16px 0 40px rgba(0, 0, 0, 0.28);
}
.shell.sidebar-collapsed .sidebar:hover .sidebar-head {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 12px;
  border-bottom-color: rgba(255,255,255,.08);
}
.shell.sidebar-collapsed .sidebar:hover .sidebar-brand {
  justify-content: flex-start;
  flex: 1;
  display: flex;
}
.shell.sidebar-collapsed .sidebar:hover .sidebar-brand:not(.has-logo) {
  display: flex;
}
.shell.sidebar-collapsed .sidebar:hover .sidebar-brand-copy,
.shell.sidebar-collapsed .sidebar:hover .nav-group,
.shell.sidebar-collapsed .sidebar:hover .nav-label {
  display: initial;
  opacity: 1;
}
.shell.sidebar-collapsed .sidebar:hover .sidebar-brand-copy {
  display: flex;
}
.shell.sidebar-collapsed .sidebar:hover .nav-group {
  display: block;
}
.shell.sidebar-collapsed .sidebar:hover .sidebar nav {
  align-items: stretch;
}
.shell.sidebar-collapsed .sidebar:hover .nav,
.shell.sidebar-collapsed .sidebar:hover .sidebar-logout {
  justify-content: flex-start;
  width: 100%;
  margin-inline: 0;
  padding: 10px 12px;
  transform-origin: center left;
}
.shell.sidebar-collapsed .sidebar:hover .nav:hover,
.shell.sidebar-collapsed .sidebar:hover .sidebar-logout:hover {
  transform: scale(1.05);
}
.shell.sidebar-collapsed .sidebar:hover .sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}

.main { min-width: 0; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 22px 28px 10px; gap: 16px;
}
.topbar h1 { margin: 0; font-size: 1.45rem; letter-spacing: -0.02em; }
.topbar-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.view { padding: 8px 28px 36px; }

.card, .panel-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card h2, .panel-card h2 { margin: 0 0 8px; font-size: 1.05rem; }
.panel-card-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  margin-bottom: 12px;
}
.panel-card-head h2 { margin: 0 0 4px; }
.panel-card-head .muted { margin: 0; }
.page-stack { display: flex; flex-direction: column; gap: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 1.45rem; font-weight: 700; margin-top: 4px; }
.bar { height: 8px; background: #e4efed; border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--brand); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #f7fbfa;
}
.plan-card.current { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.plan-card.pending { border-style: dashed; }
.plan-card h3 { margin: 0 0 6px; }
.price { font-size: 1.4rem; font-weight: 700; margin: 8px 0 4px; }
.price span { font-size: 13px; font-weight: 500; color: var(--muted); }
.price-save {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: #166534;
  background: #ecfdf5;
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 8px;
}
.billing-toggle-row {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.billing-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef4f3;
}
.billing-opt {
  border: 0;
  background: transparent;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.billing-opt.active {
  background: var(--brand);
  color: #fff;
}
.billing-opt .save-tag {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 700;
}
.billing-opt:not(.active) .save-tag {
  color: #166534;
  background: #ecfdf5;
  border-radius: 999px;
  padding: 1px 6px;
}

.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #f7fbfa;
}
.doc-item .meta { font-size: 12px; color: var(--muted); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fields label.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; }
pre.embed {
  background: var(--sidebar); color: #d7efec; padding: 14px; border-radius: 12px;
  white-space: pre-wrap; word-break: break-all; font: 12px/1.45 ui-monospace, Menlo, monospace;
  margin: 0;
}

.channel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.channels-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin: 0 2px 14px;
  font-size: 13px;
  color: var(--muted);
}
.channels-intro p { margin: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.embed-panel .embed { margin-top: 4px; }

.channel-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-top: 3px solid var(--line);
}
.channel-card.tone-line { border-top-color: #06c755; }
.channel-card.tone-fb { border-top-color: #1877f2; }
.channel-card.tone-ig { border-top-color: #c13584; }
.channel-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.channel-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.channel-identity strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}
.channel-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.channel-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.channel-mark.line { background: #06c755; }
.channel-mark.fb { background: #1877f2; font-family: Georgia, serif; font-size: 18px; }
.channel-mark.ig {
  background: linear-gradient(135deg, #f58529, #dd2a7b 50%, #8134af);
  font-size: 11px;
}
.channel-badge {
  font-size: 12px; font-weight: 800; letter-spacing: .04em;
  padding: 5px 10px; border-radius: 999px;
}
.channel-badge.line { background: #d8f3dc; color: #1b6b2e; }
.channel-badge.fb { background: #dce8f8; color: #1f4f8a; }
.channel-badge.ig { background: #f7dcec; color: #8a2e5a; }
.status-pill {
  font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  background: #eef2f1; color: var(--muted); flex-shrink: 0;
}
.status-pill.on { background: #e2f3ea; color: var(--ok); }

.field-stack { display: flex; flex-direction: column; gap: 12px; }
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-grid .span-2 { grid-column: 1 / -1; }
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.input,
.field .input,
.channels-page input.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  color: var(--ink);
  background: color-mix(in srgb, var(--brand) 3%, #fff);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.35;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input:hover {
  border-color: color-mix(in srgb, var(--brand) 28%, var(--line));
}
.input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent);
}
.input[readonly] {
  background: color-mix(in srgb, var(--brand) 6%, #f4f7f6);
  color: color-mix(in srgb, var(--ink) 78%, var(--muted));
  cursor: default;
}
.input-with-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}
.input-with-action .btn {
  white-space: nowrap;
  align-self: stretch;
  padding-inline: 12px;
}
.verify-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--brand) 6%, #fff);
  border: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.verify-box code {
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
  word-break: break-all;
}
.channel-actions {
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
.btn.danger.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}
.btn.danger.ghost:hover {
  background: #fdecec;
  border-color: #f0d0d0;
}

.brand-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: start;
}
.logo-uploader { display: flex; gap: 14px; align-items: center; }
.logo-preview {
  width: 72px; height: 72px; border-radius: 18px;
  background: color-mix(in srgb, var(--brand) 14%, #fff);
  border: 1px dashed color-mix(in srgb, var(--brand) 35%, var(--line));
  display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
  font-size: 1.5rem; font-weight: 800; color: var(--brand);
}
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.color-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.color-fields label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; color: var(--muted); font-weight: 600;
}
.color-fields input[type="color"] {
  width: 100%; height: 44px; border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; background: #fff; cursor: pointer;
}

.users-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.users-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.users-table th {
  text-align: left; padding: 10px 12px; background: color-mix(in srgb, var(--brand) 6%, #fff);
  color: var(--muted); font-size: 11px; font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.users-table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users-table tr:last-child td { border-bottom: none; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell strong { display: block; }
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state p { margin: 0 0 4px; font-weight: 700; color: var(--ink); }

.flow-media-upload { display: flex; flex-direction: column; gap: 6px; }
.flow-field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.flow-media-row { display: flex; gap: 10px; align-items: center; }
.flow-media-thumb {
  width: 72px; height: 72px; border-radius: 10px; overflow: hidden;
  background: #e8f0ee; display: grid; place-items: center;
  font-size: 11px; color: var(--muted); flex-shrink: 0;
}
.flow-media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.flow-media-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.flow-media-upload.compact .flow-media-thumb { width: 52px; height: 52px; }

.inbox-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  min-height: calc(100vh - 128px);
  max-height: calc(100vh - 128px);
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(16, 36, 34, 0.06);
}
.inbox-list {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #f7fbfa 0%, #fff 48px);
}
.inbox-list-header {
  padding: 14px 14px 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.inbox-list-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.inbox-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #c47a1a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-grid;
  place-items: center;
}
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1f9a6a;
  box-shadow: 0 0 0 0 rgba(31, 154, 106, 0.55);
  animation: live-pulse 1.8s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(31, 154, 106, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(31, 154, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 154, 106, 0); }
}
.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
}
.inbox-filters {
  display: flex;
  gap: 6px;
  padding: 0 12px 12px;
}
.inbox-filter {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.inbox-filter:hover { border-color: #9fbfb9; color: var(--ink); }
.inbox-filter.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.inbox-threads { overflow: auto; flex: 1; min-height: 0; padding: 0 8px 12px; }
.inbox-empty-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 36px 20px;
  color: var(--muted);
}
.inbox-empty-list p,
.inbox-chat-empty p {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
}
.inbox-empty-list span,
.inbox-chat-empty span {
  font-size: 13px;
  line-height: 1.4;
  max-width: 220px;
}
.inbox-empty-icon,
.inbox-empty-visual {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  margin-bottom: 10px;
  background:
    radial-gradient(circle at 30% 30%, #fff 0 22%, transparent 23%),
    linear-gradient(145deg, #d7ebe8, #eef6f4);
  border: 1px dashed #9fbfb9;
}
.inbox-thread {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
  border-radius: 12px;
  margin-bottom: 2px;
}
.inbox-thread:hover { background: #f0f7f5; }
.inbox-thread.active {
  background: #e4f2ef;
  box-shadow: inset 3px 0 0 var(--brand);
}
.inbox-thread.needs-you .who::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: #c47a1a;
  vertical-align: middle;
}
.inbox-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #0d4f4f;
  background: linear-gradient(145deg, #d5ebe8, #b9d9d4);
  flex-shrink: 0;
}
.inbox-avatar.lg { width: 42px; height: 42px; border-radius: 13px; font-size: 13px; }
.inbox-avatar[data-ch="line"] { background: linear-gradient(145deg, #d4f0d8, #a8dbb2); color: #1b6b2e; }
.inbox-avatar[data-ch="facebook"] { background: linear-gradient(145deg, #d6e4f7, #aec6eb); color: #1f4f8a; }
.inbox-avatar[data-ch="instagram"] { background: linear-gradient(145deg, #f7d6ea, #ebc0d8); color: #8a2e5a; }
.inbox-thread-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.inbox-thread-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.inbox-thread .who {
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-thread .when {
  font-size: 11px;
  color: #8a9e9a;
  flex-shrink: 0;
}
.inbox-thread .preview {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-thread .meta {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 2px;
}
.ch-pill {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #3d5c58;
  background: #e8f1ef;
  border-radius: 999px;
  padding: 2px 7px;
}
.inbox-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgba(13, 110, 110, 0.07) 1px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(180deg, #eef5f3 0%, #e6f0ee 100%);
}
.inbox-chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  color: var(--muted);
  padding: 32px;
}
.inbox-chat-header {
  flex-shrink: 0;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}
.inbox-chat-ident {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.inbox-chat-who {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.inbox-chat-who strong {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-chat-sub {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.inbox-chat-header .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.inbox-messages {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-row {
  display: flex;
  width: 100%;
}
.chat-row.user { justify-content: flex-start; }
.chat-row.assistant,
.chat-row.agent { justify-content: flex-end; }
.chat-bubble {
  max-width: min(520px, 82%);
  padding: 10px 12px 8px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(16, 36, 34, 0.06);
}
.chat-text { white-space: pre-wrap; }
.chat-bubble.user {
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
  color: var(--ink);
}
.chat-bubble.assistant {
  background: var(--brand);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.chat-bubble.agent {
  background: #1e4d6b;
  color: #fff;
  border-bottom-right-radius: 5px;
}
.chat-bubble .tag {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  opacity: 0.72;
  margin-bottom: 3px;
  text-transform: uppercase;
}
.chat-time {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  opacity: 0.65;
  text-align: right;
}
.inbox-compose {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  background: #fff;
}
.inbox-compose textarea {
  width: 100%;
  min-height: 44px;
  max-height: 140px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--ink);
  background: #f7fbfa;
  line-height: 1.4;
}
.inbox-compose textarea:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(13, 110, 110, 0.12);
}
.inbox-send {
  height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  font-weight: 700;
}
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e4efed;
  color: var(--muted);
}
.badge.human { background: #fde8c8; color: #8a5a00; }
.badge.bot { background: #dceee9; color: #0d6e6e; }

/* —— 腳本管理 / 流程編輯器 —— */
.flow-editor.bot-manager {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0 -8px;
}
.bot-tabs-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 2px;
  padding: 0 4px;
  background: #ebeff0;
  border-radius: 10px 10px 0 0;
  min-height: 40px;
}
.bot-tab {
  position: relative;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: #5c6b69;
  font: 600 13px/1 var(--font);
  padding: 10px 16px 9px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bot-tab:hover { color: var(--ink); background: rgba(255,255,255,.45); }
.bot-tab.active {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 -1px 0 #fff;
  z-index: 1;
}
.bot-tab-add {
  font-size: 18px;
  font-weight: 500;
  padding: 8px 14px;
  color: #7a8f8b;
}
.bot-tab-dot,
.bot-tab i.bot-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  display: inline-block;
  font-style: normal;
}
.bot-crumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: none;
}
.bot-crumb-mark {
  color: #9aaba8;
  font-size: 16px;
  font-weight: 700;
}
.bot-crumb-name {
  border: none;
  background: transparent;
  font: 700 15px/1.2 var(--font);
  color: var(--ink);
  min-width: 120px;
  max-width: 280px;
  padding: 4px 2px;
}
.bot-crumb-name:focus {
  outline: none;
  border-bottom: 1px solid var(--brand);
}
.bot-crumb-spacer { flex: 1; }
.bot-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  padding: 12px 10px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 12px 12px;
  margin-bottom: 12px;
}
.bot-tool-wrap { position: relative; }
.bot-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 72px;
  padding: 10px 12px 8px;
  border: none;
  border-radius: 10px;
  background: #f0f2f3;
  color: #3a4745;
  font: 600 12px/1.2 var(--font);
  cursor: pointer;
}
.bot-tool:hover { background: #e4e9ea; color: var(--brand); }
.bot-tool-icon { display: grid; place-items: center; color: inherit; }
.bot-tool-icon svg { display: block; }
.zoom-tool {
  display: inline-grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  justify-items: center;
  column-gap: 4px;
  row-gap: 4px;
  padding: 8px 10px;
  background: #f0f2f3;
  border-radius: 10px;
  min-width: 110px;
  border: none;
}
.zoom-tool .bot-tool-icon-btn { grid-row: 1; }
.zoom-tool #flow-zoom-out { grid-column: 1; }
.zoom-tool .bot-zoom-label {
  grid-column: 2;
  grid-row: 1;
  font: 700 13px/1 var(--font);
  color: var(--ink);
  min-width: 40px;
  text-align: center;
}
.zoom-tool #flow-zoom-in { grid-column: 3; }
.zoom-tool .bot-tool-caption {
  grid-column: 1 / -1;
  grid-row: 2;
  font: 600 12px/1.2 var(--font);
  color: #3a4745;
}
.bot-tool-icon-btn {
  border: none;
  background: transparent;
  color: #c0392b;
  padding: 2px;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 6px;
}
.bot-tool-icon-btn:hover { background: rgba(192,57,43,.08); }
.bot-toolbar-hint {
  margin-left: auto;
  align-self: center;
  font-size: 12px;
  color: var(--muted);
}
.bot-module-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 240px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(16,36,34,.12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bot-module-menu[hidden] { display: none !important; }
.bot-module-item {
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bot-module-item:hover { background: #f0f7f6; }
.bot-module-item strong { font-size: 13px; color: var(--ink); }
.bot-module-item span { font-size: 11px; color: var(--muted); }
.bot-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #102422;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 50;
}
.flow-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
  user-select: none;
}
.flow-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.flow-switch-ui {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #c9d8d5;
  position: relative;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.flow-switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: transform 0.15s ease;
}
.flow-switch input:checked + .flow-switch-ui { background: var(--brand); }
.flow-switch input:checked + .flow-switch-ui::after { transform: translateX(16px); }
.flow-switch-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.btn.danger-text { color: var(--danger); border-color: transparent; }
.btn.danger-text:hover { background: #fdecec; border-color: #e2b4b4; }

.flow-workspace {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 360px);
  gap: 12px;
  min-height: calc(100vh - 280px);
}
.flow-canvas-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 1px 1px, #c5d9d5 1px, transparent 0) 0 0 / 22px 22px,
    linear-gradient(165deg, #f4faf8 0%, #e8f2f0 100%);
  overflow: hidden;
  min-height: 520px;
  position: relative;
  cursor: grab;
  touch-action: none;
}
.flow-canvas-wrap.is-panning {
  cursor: grabbing;
  user-select: none;
}
.flow-stage { position: absolute; left: 0; top: 0; min-width: 100%; min-height: 100%; will-change: transform; }
.flow-edges {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 1;
}
.flow-edge {
  fill: none; stroke: #5a6e6b; stroke-width: 2; opacity: .85;
}
.flow-edge-label {
  fill: #3d524f; font-size: 11px; font-family: var(--font);
}
.flow-nodes-layer { position: relative; z-index: 2; min-height: 100%; }
.flow-card {
  position: absolute;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(16,36,34,.08);
  cursor: grab;
  user-select: none;
  padding: 0;
  overflow: hidden;
}
.flow-card:active { cursor: grabbing; }
.flow-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(13,110,110,.25), 0 10px 24px rgba(16,36,34,.1);
}
.flow-card.linking { outline: 2px dashed #c47a1a; }
.flow-card.is-start { border-color: #0d6e6e; }
.flow-card-top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px 4px; gap: 6px;
}
.flow-card-type {
  font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: var(--brand);
}
.flow-card.tone-handoff .flow-card-type { color: #9a5b00; }
.flow-card.tone-ai .flow-card-type { color: #1f6b4a; }
.flow-card.tone-message .flow-card-type,
.flow-card.tone-media .flow-card-type { color: #345c75; }
.flow-card-start {
  font-size: 10px; background: #dceee9; color: #0d6e6e;
  padding: 2px 6px; border-radius: 999px;
}
.flow-card-body {
  padding: 2px 10px 8px; font-size: 12px; line-height: 1.4; color: var(--ink);
  min-height: 2.6em;
}
.flow-card-thumb {
  margin: 0 8px 4px;
  border-radius: 8px;
  overflow: hidden;
  background: #e2ece9;
  height: 64px;
}
.flow-card-thumb img {
  display: block;
  width: 100%;
  height: 64px;
  object-fit: cover;
}
.flow-card-thumb.ph {
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #7a8f8b;
}
.flow-card-thumb.strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  height: 52px;
}
.flow-card-thumb.strip img,
.flow-card-thumb.strip .ph-cell {
  width: 100%;
  height: 52px;
  object-fit: cover;
}
.flow-card-thumb.strip .ph-cell {
  display: grid;
  place-items: center;
  background: #d5e2df;
  font-size: 10px;
  color: #5a6e6b;
  font-weight: 700;
}
.flow-card-ports {
  border-top: 1px solid var(--line); padding: 4px 8px 6px; background: #f7fbfa;
}
.flow-port {
  border: none; background: transparent; color: var(--brand);
  font-size: 12px; cursor: pointer; padding: 2px 0;
}
.flow-port:hover { text-decoration: underline; }

.flow-inspector {
  margin: 0;
  overflow: auto;
  max-height: calc(100vh - 280px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 18px rgba(16, 36, 34, 0.04);
}
.flow-inspector-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  padding: 32px 20px;
  color: var(--ink);
}
.flow-inspector-empty p { margin: 0; font-weight: 600; }
.flow-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #d7ebe8, #eef6f4);
  border: 1px dashed #9fbfb9;
}
.flow-inspector-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f7fbfa, #fff);
}
.flow-inspector-title {
  margin: 6px 0 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.flow-type-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: #dceee9;
  color: var(--brand);
}
.flow-type-pill.tone-message,
.flow-type-pill.tone-media { background: #e4eef4; color: #345c75; }
.flow-type-pill.tone-handoff { background: #fde8c8; color: #9a5b00; }
.flow-type-pill.tone-ai { background: #e2f3ea; color: #1f6b4a; }
.flow-type-pill.tone-menu { background: #dceee9; color: var(--brand); }
.flow-node-id {
  font-size: 11px;
  color: var(--muted);
  background: #f0f5f4;
  padding: 4px 7px;
  border-radius: 6px;
}
.flow-preview {
  padding: 12px 16px 4px;
}
.flow-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.flow-phone {
  background: #1a2423;
  border-radius: 22px;
  padding: 10px 8px 14px;
  box-shadow: inset 0 0 0 2px #2c3a38, 0 10px 24px rgba(16, 36, 34, 0.18);
}
.flow-phone-notch {
  width: 72px;
  height: 5px;
  border-radius: 999px;
  background: #2f3f3d;
  margin: 0 auto 8px;
}
.flow-phone-screen {
  background: linear-gradient(180deg, #e8f0ee 0%, #dfeae7 100%);
  border-radius: 14px;
  min-height: 168px;
  max-height: 280px;
  overflow: auto;
  padding: 12px 10px;
}
.fp-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
}
.fp-bubble {
  background: #fff;
  border-radius: 4px 14px 14px 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #1c2c2a;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 92%;
}
.fp-bubble.muted { color: #6a7f7b; font-style: italic; }
.fp-chip {
  font-size: 11px;
  font-weight: 700;
  color: #9a5b00;
  background: #fde8c8;
  padding: 3px 8px;
  border-radius: 999px;
}
.fp-placeholder {
  width: 100%;
  min-height: 88px;
  display: grid;
  place-items: center;
  background: #cfd9d6;
  color: #5a6e6b;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.fp-img-wrap {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #cfd9d6;
}
.fp-img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}
.fp-caption {
  font-size: 11px;
  color: #5a6e6b;
  padding: 0 2px;
}
.fp-flex-card,
.fp-car-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  width: 100%;
  max-width: 220px;
}
.fp-flex-img,
.fp-car-img {
  display: block;
  width: 100%;
  height: 96px;
  object-fit: cover;
  background: #cfd9d6;
}
.fp-flex-img.ph,
.fp-car-img.ph {
  display: grid;
  place-items: center;
  color: #5a6e6b;
  font-size: 12px;
  font-weight: 600;
}
.fp-flex-body,
.fp-car-body {
  padding: 8px 10px 10px;
}
.fp-flex-title {
  font-size: 13px;
  font-weight: 700;
  color: #1c2c2a;
  margin-bottom: 3px;
}
.fp-flex-text {
  font-size: 12px;
  line-height: 1.4;
  color: #3d524f;
  white-space: pre-wrap;
  word-break: break-word;
}
.fp-car-action {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #0d6e6e;
}
.fp-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  width: 100%;
  scrollbar-width: thin;
}
.fp-car-card {
  flex: 0 0 148px;
  max-width: 148px;
}
.fp-car-img { height: 78px; }
.fp-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}
.fp-btn {
  font-size: 12px;
  font-weight: 600;
  color: #0d6e6e;
  background: #fff;
  border: 1px solid #b7d4cf;
  border-radius: 999px;
  padding: 5px 10px;
}
.flow-link-hint {
  margin: 12px 16px 0;
  background: #fff6e8;
  border: 1px solid #f0d7a8;
  color: #8a5a00;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
}
.flow-field-group {
  padding: 14px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.flow-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.flow-field.tight { gap: 4px; }
.flow-field em {
  font-style: normal;
  font-weight: 400;
  font-size: 11px;
  color: #7a8f8b;
}
.flow-field input,
.flow-field textarea,
.flow-field select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  color: var(--ink);
  font-weight: 400;
  background: #fff;
  width: 100%;
}
.flow-field textarea { resize: vertical; min-height: 88px; line-height: 1.45; }
.flow-field input:focus,
.flow-field textarea:focus,
.flow-field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 110, 110, 0.12);
}
.flow-ai-note {
  font-size: 13px;
  line-height: 1.45;
  color: #1f6b4a;
  background: #e7f6ee;
  border-radius: 9px;
  padding: 10px 12px;
}
.flow-opt-block {
  margin: 8px 16px 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.flow-opt-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.flow-opt-empty {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  background: #f7fbfa;
  border-radius: 9px;
  padding: 12px;
}
.flow-opt-card {
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.flow-next-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  align-items: center;
}
.flow-inspector-actions {
  margin-top: auto;
  padding: 14px 16px 16px;
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  background: #fafcfb;
}

@media (max-width: 900px) {
  .shell,
  .shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 12px;
  }
  .sidebar-top {
    flex-direction: row;
    align-items: center;
    width: 100%;
    gap: 10px;
  }
  .sidebar-head {
    width: 100%;
    margin-bottom: 0;
  }
  .shell.sidebar-collapsed .sidebar-brand-copy,
  .shell.sidebar-collapsed .user-chip,
  .shell.sidebar-collapsed .nav-group,
  .shell.sidebar-collapsed .nav-label {
    display: none;
  }
  .shell.sidebar-collapsed .sidebar-head {
    flex-direction: row;
    width: auto;
    border-bottom: none;
    padding-bottom: 0;
  }
  .shell.sidebar-collapsed .sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
    flex: 1;
  }
  .shell.sidebar-collapsed .nav,
  .shell.sidebar-collapsed .sidebar-logout {
    width: 44px;
    margin: 0;
  }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .sidebar-logout { margin-top: 0; width: auto; }
  .nav:hover, .sidebar-logout:hover { transform: scale(1.08); }
  .fields { grid-template-columns: 1fr; }
  .brand-row { grid-template-columns: 1fr; }
  .color-fields { grid-template-columns: 1fr 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .channel-grid { grid-template-columns: 1fr; }
  .inbox-layout {
    grid-template-columns: 1fr;
    min-height: 70vh;
    max-height: none;
  }
  .inbox-list {
    max-height: 280px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .inbox-chat {
    min-height: 420px;
    height: auto;
    max-height: 65vh;
  }
  .flow-workspace { grid-template-columns: 1fr; }
  .flow-inspector { max-height: none; }
  .bot-toolbar-hint { margin-left: 0; width: 100%; }
}
