/* ── Reset / base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
        "Noto Sans Thai", sans-serif;
  color: #172033;
  background: #f6f7f9;
}
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 600; }
h1 { font-size: 26px; line-height: 1.15; }
h2 { font-size: 20px; letter-spacing: 0; color: #172033; }
h3 { font-size: 16px; }
.muted { color: #6d7686; font-weight: 400; }
.hint { color: #6d7686; font-size: 12px; font-weight: 400; }
code, pre {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}
pre {
  background: #0f1115; color: #e6e6e6;
  padding: 12px; border-radius: 6px; overflow: auto;
  max-height: 360px;
}

/* ── Top bar ──────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 22px; background: #fff; border-bottom: 1px solid #e1e5eb;
}
.brand { font-weight: 600; font-size: 15px; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-actions .btn {
  white-space: nowrap;
}
.business-switcher {
  width: min(260px, 34vw);
  margin: 0;
  padding: 5px 30px 5px 10px;
  font-size: 13px;
}

/* ── Layout ──────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 49px);
}
.auth-screen {
  background:
    linear-gradient(135deg, #f7faf8 0%, #eef4f7 52%, #f8f4ec 100%);
}
.auth-screen .topbar {
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
}
.auth-screen .layout {
  display: block;
}
.auth-screen .content {
  min-height: calc(100vh - 49px);
  padding: 0;
  overflow: auto;
}
.auth-screen #health {
  display: none;
}
.sidebar {
  background: #fff; border-right: 1px solid #e1e5eb;
  overflow-y: auto;
  padding: 16px;
}
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.sidebar-business-context {
  margin: -4px 0 14px;
  color: #6d7686;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}
.sidebar-foot {
  margin-top: 20px; padding-top: 12px;
  border-top: 1px solid #ececef;
  text-align: center;
}
.tenant-list { list-style: none; padding: 0; margin: 0; }
.tenant-list li {
  padding: 10px 12px; border-radius: 6px; cursor: pointer;
  margin-bottom: 4px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.tenant-list li:hover { background: #eef4f8; }
.tenant-list li.active {
  background: #1f7a8c; color: white;
}
.tenant-list li.active .badge { background: rgba(255,255,255,0.25); color: white; }
.tenant-list li.tenant-list-empty {
  display: block;
  cursor: default;
  color: #6d7686;
  background: #f7f8fa;
  border: 1px dashed #d8dde5;
}
.tenant-list li.tenant-list-empty:hover {
  background: #f7f8fa;
}
.tenant-list-empty strong,
.tenant-list-empty span {
  display: block;
}
.tenant-list-empty span {
  margin-top: 2px;
  font-size: 12px;
}
.tenant-list .name { font-weight: 500; }
.tenant-list .slug { font-size: 11px; opacity: 0.7; }
.badge {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  background: #e3e5ea; color: #555; padding: 2px 6px; border-radius: 10px;
}
.badge.active { background: #d9f5dd; color: #137a3c; }
.badge.pending { background: #fff5cc; color: #7a5b00; }
.badge.suspended, .badge.archived { background: #f5d9d9; color: #a82929; }

.content {
  overflow: auto;
  padding: 24px 32px 40px;
  min-width: 0;
}
.empty {
  margin: 80px auto; text-align: center; color: #888; font-size: 15px;
}
.login-shell {
  min-height: calc(100vh - 49px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  gap: 42px;
  align-items: center;
  width: min(1080px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 44px 0;
}
.login-copy {
  max-width: 560px;
}
.login-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #e4f3e7;
  color: #176b3a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}
.login-copy h1 {
  font-size: 38px;
  line-height: 1.16;
  max-width: 640px;
  margin-bottom: 14px;
  color: #121a28;
}
.login-copy p {
  margin: 0;
  max-width: 520px;
  color: #586273;
  font-size: 16px;
}
.login-panel {
  background: rgba(255,255,255,0.95);
  border: 1px solid #dce3e8;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 48px rgba(23,32,51,0.14);
}
.login-head {
  margin-bottom: 20px;
}
.login-head h2 {
  font-size: 24px;
  margin-bottom: 6px;
}
.login-head p {
  margin: 0;
  color: #6d7686;
  font-size: 13px;
}
.login-panel label {
  font-weight: 700;
}
.login-panel input {
  margin-top: 6px;
  min-height: 44px;
}
.login-panel .btn-block {
  margin-top: 6px;
  min-height: 44px;
}
.login-footnote {
  margin: 14px 0 0;
  color: #6d7686;
  font-size: 12px;
}
.invite-result {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d6e6ea;
  border-radius: 8px;
  background: #f4fbfc;
}
.copy-link {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.copy-link input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
}
.super-admin-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #ececef;
}
.super-admin-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
}
.compact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.compact-list li {
  padding: 8px;
  border: 1px solid #ececef;
  border-radius: 8px;
}
.compact-list strong,
.compact-list span {
  display: block;
}

/* ── Cards & sections ─────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid #e1e5eb; border-radius: 8px;
  padding: 16px; margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid #e1e5eb;
  margin: 16px 0 22px;
  overflow-x: auto;
}
.tab {
  padding: 8px 14px; cursor: pointer;
  border-bottom: 2px solid transparent; color: #586273;
  font-weight: 500;
  white-space: nowrap;
}
.tab:hover { color: #172033; }
.tab.active { color: #1f7a8c; border-bottom-color: #1f7a8c; }

/* ── Forms ───────────────────────────────────────────────── */
label {
  display: block; margin: 8px 0 12px;
  font-weight: 500; font-size: 13px;
}
input, select, textarea {
  display: block; width: 100%;
  padding: 8px 10px; margin-top: 4px;
  border: 1px solid #d2d8e1; border-radius: 6px;
  font: inherit;
  background: white;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #1f7a8c; outline-offset: -1px; border-color: transparent;
}
textarea { resize: vertical; font-family: inherit; font-size: 14px; }
.row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.menu-alert {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-weight: 700;
  line-height: 1.5;
  white-space: pre-wrap;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  padding: 7px 14px; border-radius: 6px; border: 1px solid #d2d8e1;
  background: #fff; cursor: pointer; font: inherit; font-weight: 500;
  color: #172033;
}
.btn:hover { background: #f4f5f7; }
.btn-primary {
  background: #1f7a8c; color: white; border-color: #1f7a8c;
}
.btn-primary:hover { background: #176273; }
.btn-danger {
  background: #fff; color: #c43030; border-color: #ddd;
}
.btn-danger:hover { background: #fff0f0; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ── Tables ──────────────────────────────────────────────── */
table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
th, td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid #ececef;
}
th { font-weight: 600; color: #555; background: #fafafa; }
tr:hover td { background: #fafbfc; }

/* ── Misc ────────────────────────────────────────────────── */
.actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 16px;
}
.kv {
  display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px;
  font-size: 13px;
}
.kv .k { color: #777; }
.kv .v { color: #1a1a1a; word-break: break-all; }

.oa-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.oa-title-group h1 {
  margin-bottom: 6px;
}
.oa-kicker {
  color: #1f7a8c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.oa-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.page-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.page-intro p {
  margin: 0;
  color: #586273;
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.summary-tile {
  background: #fff;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  padding: 16px;
}
.summary-tile strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
  margin: 4px 0;
}
.summary-label {
  color: #6d7686;
  font-size: 12px;
  font-weight: 600;
}

dialog {
  border: none; border-radius: 10px; padding: 20px;
  max-width: 520px; width: 90%;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
}
dialog::backdrop { background: rgba(0,0,0,0.4); }
.team-members {
  margin-top: 12px;
  border-top: 1px solid #ececef;
  padding-top: 10px;
  max-height: 220px;
  overflow: auto;
}
.team-member {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f1f3;
}
.team-member strong {
  display: block;
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.role-card {
  background: #fff;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  padding: 14px;
}
.role-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.role-card p {
  margin: 0;
  color: #586273;
  font-size: 13px;
}
.team-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.business-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}
.business-list {
  display: grid;
  gap: 10px;
}
.business-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.business-row:hover {
  border-color: #b9d9e0;
  background: #f8fbfc;
}
.business-row:focus-visible {
  outline: 2px solid #1f7a8c;
  outline-offset: 2px;
}
.business-row.selected {
  border-color: #1f7a8c;
  background: #f1f9fb;
  box-shadow: inset 3px 0 0 #1f7a8c;
}
.business-row-main {
  min-width: 0;
}
.business-row-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.business-capability {
  margin-top: 8px;
}
.business-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #586273;
  font-size: 13px;
  font-weight: 700;
}
.toggle-row input {
  width: auto;
  margin: 0;
}
.toggle-row.compact {
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
}
.business-next-steps {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #ececef;
  color: #586273;
  font-size: 13px;
}
.business-next-steps strong {
  display: block;
  color: #172033;
  margin-bottom: 6px;
}
.business-next-steps ol {
  margin: 0;
  padding-left: 18px;
}
.team-table select {
  min-width: 120px;
}
.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.role-badge-owner {
  background: #d7f6df;
  color: #157238;
}
.table-actions {
  text-align: right;
  white-space: nowrap;
}

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: #1a1a1a; color: white; padding: 10px 16px;
  border-radius: 6px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
  z-index: 100;
}
.toast.show { opacity: 1; }
.toast.error { background: #c43030; }
.toast.success { background: #137a3c; }

.simulate-grid {
  display: grid; grid-template-columns: 320px 1fr; gap: 16px;
}
.composer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px;
  align-items: start;
}
.composer-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}
.step-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  background: #fff;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  padding: 16px;
}
.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e7f3f5;
  color: #1f7a8c;
  font-weight: 700;
}
.step-body {
  min-width: 0;
}
.uid-panel {
  border: 1px dashed #c8d2dc;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}
.uid-summary {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 14px;
  background: #eef4f8;
  color: #4b5a6b;
  font-size: 12px;
}
.message-extra-fields {
  border: 1px solid #e1e8ef;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafb;
}
.message-image-source {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.message-image-source strong {
  display: block;
  margin-bottom: 2px;
}
.message-image-source p {
  margin: 0;
}
.message-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.message-upload-row .hint {
  max-width: 240px;
  text-align: right;
}
.qr-builder {
  display: grid; gap: 8px;
}
.qr-row {
  display: grid;
  grid-template-columns: minmax(108px, 0.8fr) minmax(116px, 1fr) minmax(132px, 1.2fr) minmax(88px, 0.7fr) 96px auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.qr-row input,
.qr-row select {
  margin-top: 0;
  min-width: 0;
}
.send-panel {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 14px;
  min-width: 0;
}
.phone-preview {
  background: #0f1720;
  border: 1px solid #cfd8e3;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 36px rgba(20, 31, 43, 0.18);
}
.line-phone {
  color: #1f2933;
}
.line-statusbar {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: #f7f8f9;
  font-size: 11px;
  font-weight: 700;
}
.line-status-icons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.line-status-icons span {
  display: inline-block;
  width: 11px;
  height: 7px;
  border: 1px solid #1f2933;
  border-radius: 2px;
}
.line-status-icons span:nth-child(1) {
  width: 12px;
  height: 8px;
  border-radius: 50%;
}
.line-status-icons span:nth-child(2) {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.line-chat-header {
  height: 50px;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  padding: 0 12px;
  background: #fff;
  border-bottom: 1px solid #e6ebef;
}
.line-back {
  font-size: 28px;
  line-height: 1;
  color: #1d2935;
}
.line-chat-title {
  text-align: center;
  line-height: 1.15;
}
.line-chat-title strong {
  display: block;
  font-size: 14px;
}
.line-chat-title span {
  color: #7d8792;
  font-size: 10px;
}
.line-menu-dots {
  justify-self: end;
  letter-spacing: 1px;
}
.line-chat-body {
  min-height: 360px;
  padding: 14px 12px 12px;
  background:
    linear-gradient(rgba(255,255,255,0.16), rgba(255,255,255,0.16)),
    #8fa7b8;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.line-date-pill {
  align-self: center;
  background: rgba(43, 58, 72, 0.36);
  color: #fff;
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
}
.line-message-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.line-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #06c755;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}
.line-message-stack {
  max-width: 78%;
}
.line-name {
  color: rgba(255,255,255,0.9);
  font-size: 11px;
  margin: 0 0 3px 2px;
}
.line-bubble {
  background: #fff;
  color: #172033;
  border-radius: 4px 16px 16px 16px;
  padding: 9px 12px;
  box-shadow: 0 1px 2px rgba(25, 39, 52, 0.15);
  white-space: pre-wrap;
  word-break: break-word;
}
.line-image-bubble {
  overflow: hidden;
  background: #fff;
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 1px 2px rgba(25, 39, 52, 0.15);
}
.line-image-bubble img {
  display: block;
  width: 210px;
  max-height: 160px;
  object-fit: cover;
  background: #edf2f5;
}
.line-image-placeholder {
  width: 210px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #edf2f5;
  color: #7d8792;
  font-size: 12px;
}
.line-image-action {
  padding: 7px 10px;
  color: #06c755;
  font-size: 12px;
  font-weight: 700;
  border-top: 1px solid #eef2f4;
}
.line-flex-bubble {
  background: #fff;
  color: #172033;
  border-radius: 4px 16px 16px 16px;
  padding: 12px;
  min-width: 190px;
  box-shadow: 0 1px 2px rgba(25, 39, 52, 0.15);
}
.line-flex-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e7f3f5;
  color: #1f7a8c;
  font-size: 11px;
  font-weight: 800;
}
.line-time {
  color: rgba(255,255,255,0.88);
  font-size: 10px;
  margin: 3px 0 0 4px;
}
.line-quick-reply-dock {
  margin-top: auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 2px;
}
.line-quick-reply {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  border: 1px solid #d7e0e8;
  background: #fff;
  color: #172033;
  border-radius: 18px;
  padding: 7px 12px;
  font: inherit;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(25, 39, 52, 0.12);
}
.line-quick-reply span {
  color: #06c755;
  font-weight: 800;
}
.line-quick-reply img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}
.line-no-qr {
  margin-top: auto;
  color: rgba(255,255,255,0.92);
  font-size: 12px;
  text-align: center;
}
.line-inputbar {
  height: 48px;
  display: grid;
  grid-template-columns: 28px 1fr 24px 24px;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-top: 1px solid #e6ebef;
  padding: 0 12px;
}
.line-plus {
  color: #7d8792;
  font-size: 24px;
  line-height: 1;
}
.line-input-placeholder {
  height: 30px;
  border-radius: 16px;
  background: #f1f3f5;
  color: #9aa3ad;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 13px;
}
.line-input-icon,
.line-send-icon {
  width: 20px;
  height: 20px;
  border: 2px solid #8a949f;
  border-radius: 50%;
}
.line-send-icon {
  border-color: #06c755;
  border-radius: 6px 50% 50% 50%;
  transform: rotate(-45deg);
}
.send-box {
  background: #fff;
  border: 1px solid #e1e5eb;
  border-radius: 8px;
  padding: 16px;
}
.send-result {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #f3f6f8;
  color: #586273;
  font-size: 12px;
}
.json-block {
  background: #0f1115; color: #e6e6e6;
  padding: 12px; border-radius: 6px; overflow: auto;
  font-family: "SF Mono", Menlo, monospace; font-size: 12px;
  white-space: pre-wrap; word-break: break-word;
}
.preview-msg {
  background: #1f7a8c; color: white;
  padding: 10px 14px; border-radius: 14px 14px 14px 4px;
  margin-bottom: 6px; max-width: 480px; white-space: pre-wrap;
}
.preview-qr {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px;
}
.preview-qr-item {
  background: white; border: 1px solid #1f7a8c; color: #1f7a8c;
  padding: 4px 10px; border-radius: 14px; font-size: 12px;
}
.preview-link-pill {
  display: inline-block; background: #fff5cc; color: #7a5b00;
  padding: 2px 8px; border-radius: 10px; font-size: 11px;
}

/* ── Sticky save bar (top) + bottom mirror ──────────────── */
.save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.save-bar-top {
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 10px rgba(15, 26, 51, 0.04);
}
.save-bar.is-dirty {
  background: #fff8e8;
  border-color: #f5d58a;
  box-shadow: 0 2px 14px rgba(212, 159, 41, 0.18);
}
.save-bar-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.save-bar-info strong { font-size: 14px; color: #1f2533; }
.dirty-indicator { font-size: 12px; color: #5f8d54; }
.dirty-indicator.is-dirty { color: #b8821b; font-weight: 500; }
.btn.btn-lg {
  font-size: 14px;
  padding: 9px 22px;
  font-weight: 600;
  border-radius: 7px;
  white-space: nowrap;
}
.btn.pulse {
  animation: pulse-btn 1.6s ease-in-out infinite;
}
@keyframes pulse-btn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 120, 246, 0.45); }
  50%      { box-shadow: 0 0 0 6px rgba(52, 120, 246, 0); }
}

/* Confirm save dialog */
dialog.confirm-save-dialog {
  border: 0;
  border-radius: 12px;
  padding: 22px 24px;
  max-width: 440px;
  width: calc(100% - 32px);
  box-shadow: 0 16px 60px rgba(15, 26, 51, 0.2);
  font-family: inherit;
  color: #1f2533;
}
dialog.confirm-save-dialog::backdrop { background: rgba(15, 26, 51, 0.45); }
dialog.confirm-save-dialog h3 { margin: 0 0 8px; font-size: 17px; }
dialog.confirm-save-dialog p  { margin: 0 0 18px; color: #586273; font-size: 13px; line-height: 1.55; }
dialog.confirm-save-dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Menu list (overview table) ─────────────────────────── */
.menu-list-card {
  margin-bottom: 16px;
}
.menu-list-card .card-head {
  flex-wrap: wrap;
  gap: 8px;
}
.menu-status-warning {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid #f3d58a;
  border-radius: 8px;
  background: #fff8e5;
  color: #6f520d;
  font-size: 13px;
  line-height: 1.45;
}
.menu-status-warning code {
  font-size: 12px;
}
.menu-list-table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
  -webkit-overflow-scrolling: touch;
}
.menu-list-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.menu-list-table col.col-id      { width: 200px; }
.menu-list-table col.col-title   { width: auto;  }
.menu-list-table col.col-size    { width: 70px;  }
.menu-list-table col.col-areas   { width: 60px;  }
.menu-list-table col.col-refs    { width: 170px; }
.menu-list-table col.col-line    { width: 170px; }
.menu-list-table col.col-actions { width: 170px; }
.menu-list-table thead th {
  text-align: left;
  font-weight: 600;
  color: #586273;
  padding: 9px 10px;
  border-bottom: 1px solid #e3e8ef;
  background: #f7f9fc;
  white-space: nowrap;
  position: sticky;
  top: 0;
}
.menu-list-table thead th.col-areas { text-align: center; }
.menu-list-table tbody td {
  padding: 10px;
  border-bottom: 1px solid #eef1f5;
  vertical-align: middle;
  word-break: break-word;
}
.menu-list-table .id-cell {
  white-space: normal;
  line-height: 1.7;
}
.menu-list-table .id-cell code {
  display: inline-block;
}
.menu-list-table .title-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-list-table .num-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #1f2533;
}
.menu-list-table tbody tr.selected {
  background: #eef5ff;
}
.menu-list-table tbody tr.selected td:first-child {
  border-left: 3px solid #3478f6;
  padding-left: 7px;
}
.menu-list-table .actions-col {
  white-space: nowrap;
  text-align: right;
}
.menu-list-table .actions-col .btn {
  margin-left: 4px;
  padding: 4px 9px;
  font-size: 12px;
  min-width: 32px;
}
.menu-list-table .refs-cell {
  font-size: 12px;
  color: #586273;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-list-table .refs-cell code {
  font-size: 11px;
}
.badge.editing {
  background: #fff4d6;
  color: #8a6d1d;
  margin-left: 4px;
}

@media (max-width: 1100px) {
  .menu-list-table col.col-refs    { width: 140px; }
  .menu-list-table col.col-line    { width: 150px; }
}
@media (max-width: 720px) {
  .menu-list-table { min-width: 780px; }
}

/* ── Rich menu builder ───────────────────────────────────── */
.rich-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 16px;
  align-items: start;
}
.rich-preview-card,
.rich-inspector {
  min-width: 0;
}
.rich-toolbar,
.actions-inline {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.rich-toolbar label,
.rich-preset-row label {
  margin: 0;
}
.rich-menu-meta {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 180px minmax(260px, 1fr);
  gap: 10px;
  align-items: start;
}
.header-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* Image uploader */
.image-uploader { display:flex; flex-direction:column; gap:6px; }
.image-drop {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px dashed #cfd8e3;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafbfd;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 60px;
}
.image-drop:hover, .image-drop.drag-over { border-color:#3478f6; background:#eef5ff; }
.image-drop.has-image { border-style:solid; border-color:#cfd8e3; background:#fff; }
.image-drop-thumb {
  width: 56px; height: 38px;
  border-radius: 4px;
  background: #eef1f5 center/cover no-repeat;
  flex-shrink: 0;
  border: 1px solid #e3e8ef;
}
.image-drop.has-image .image-drop-thumb { background-color:#fff; }
.image-drop-info { display:flex; flex-direction:column; gap:2px; min-width:0; }
.image-drop-info strong { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.image-drop-info .hint { font-size:11px; }
.image-actions { display:flex; gap:6px; flex-wrap:wrap; }

/* Canvas toolbar (add/delete area, just below the preview phone) */
.canvas-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
  flex-wrap: wrap;
}
.canvas-toolbar .btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
}
.canvas-toolbar .btn-primary {
  background: #3478f6;
  color: #fff;
  border-color: #3478f6;
}
.canvas-toolbar .btn-primary:hover { background: #2a66d5; }
.canvas-toolbar .btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.canvas-toolbar-hint {
  margin-left: auto;
  font-size: 11px;
}
.canvas-toolbar kbd {
  background: #f0f2f5;
  border: 1px solid #cfd8e3;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  font-family: Menlo, monospace;
  font-size: 10px;
  color: #1f2533;
}

/* Canvas image (replaces placeholder when image is uploaded) */
.rich-art-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.rich-preset-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 14px;
}
.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  color: #586273;
}
.inline-check input {
  width: auto;
  margin: 0;
}
.rich-phone {
  max-width: 430px;
  margin: 0 auto;
  border: 1px solid #cfd8e3;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 16px 32px rgba(20, 31, 43, 0.14);
}
.rich-chat-space {
  min-height: 170px;
  padding: 14px;
  background:
    linear-gradient(rgba(255,255,255,0.16), rgba(255,255,255,0.16)),
    #8fa7b8;
  display: flex;
  align-items: flex-start;
}
.rich-chat-note {
  max-width: 86%;
  background: rgba(255,255,255,0.92);
  border-radius: 4px 14px 14px 14px;
  padding: 8px 10px;
  color: #263442;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(25, 39, 52, 0.12);
}
.rich-chatbar {
  background: #fff;
  border-top: 1px solid #e6ebef;
  border-bottom: 1px solid #e6ebef;
  padding: 10px 12px;
  text-align: center;
  color: #586273;
  font-size: 13px;
  font-weight: 700;
}
.rich-canvas-wrap {
  padding: 10px;
  background: #fff;
}
.rich-canvas {
  position: relative;
  width: 100%;
  background: #eaf0f4;
  overflow: hidden;
  border-radius: 4px;
  touch-action: none;
}
.rich-art {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #506171;
  background:
    linear-gradient(135deg, rgba(31,122,140,0.16), rgba(6,199,85,0.12)),
    #eef4f7;
}
.rich-art.has-image {
  align-items: flex-start;
  justify-content: flex-end;
  padding: 10px;
  color: #1f5361;
}
.rich-art strong {
  font-size: 18px;
}
.rich-art span {
  font-size: 12px;
}
.rich-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(31, 122, 140, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 122, 140, 0.16) 1px, transparent 1px);
  background-size: var(--rich-grid-x, 10%) var(--rich-grid-y, 10%);
}
.rich-area {
  position: absolute;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 2px;
  padding: 6px;
  border: 2px solid rgba(31, 122, 140, 0.78);
  background: rgba(31, 122, 140, 0.16);
  color: #12333d;
  cursor: move;
  text-align: left;
  overflow: hidden;
  touch-action: none;
  will-change: left, top, width, height;
}
.rich-area.selected {
  border-color: #06c755;
  background: rgba(6, 199, 85, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.75);
  overflow: visible;
}
.rich-area span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  color: #1f7a8c;
  font-size: 11px;
  font-weight: 800;
}
.rich-area em {
  max-width: 100%;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 8 resize handles — only rendered on the selected area */
.rich-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 2px solid #06c755;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.06);
  z-index: 2;
  touch-action: none;
}
.rich-handle.h-nw { left: -7px;  top: -7px;     cursor: nwse-resize; }
.rich-handle.h-n  { left: 50%;   top: -7px;     transform: translateX(-50%); cursor: ns-resize; }
.rich-handle.h-ne { right: -7px; top: -7px;     cursor: nesw-resize; }
.rich-handle.h-e  { right: -7px; top: 50%;      transform: translateY(-50%); cursor: ew-resize; }
.rich-handle.h-se { right: -7px; bottom: -7px;  cursor: nwse-resize; }
.rich-handle.h-s  { left: 50%;   bottom: -7px;  transform: translateX(-50%); cursor: ns-resize; }
.rich-handle.h-sw { left: -7px;  bottom: -7px;  cursor: nesw-resize; }
.rich-handle.h-w  { left: -7px;  top: 50%;      transform: translateY(-50%); cursor: ew-resize; }

/* Quick Reply icon picker (in messages composer) */
.qr-icon-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}
.qr-icon-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #fff center/22px 22px no-repeat;
  border: 1px solid #cfd8e3;
  padding: 0;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.qr-icon-thumb:hover { border-color: #3478f6; }
.qr-icon-thumb:not(.has-icon) { background-color: #f7f9fc; }
.qr-icon-thumb:not(.has-icon)::before {
  content: "+";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa3b0;
  font-size: 20px;
  font-weight: 300;
}
.qr-icon-picker .qr-icon-clear {
  background: #fff;
  border: 1px solid #f4bdbd;
  color: #a32d2d;
  font-size: 14px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  padding: 0;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.qr-icon-picker .qr-icon-clear:hover { background: #fef2f2; }

/* Preset popover */
.qr-icon-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  width: 280px;
  background: #fff;
  border: 1px solid #e3e8ef;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(15, 26, 51, 0.16);
  padding: 12px;
  display: none;
}
.qr-icon-popover.open { display: block; }
.qr-icon-popover h5 {
  margin: 0 0 8px;
  font-size: 12px;
  color: #586273;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.qr-preset-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.qr-preset-tile {
  width: 100%;
  aspect-ratio: 1;
  background: #f7f9fc;
  border: 1px solid #e3e8ef;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  transition: border-color 0.15s, background 0.15s;
}
.qr-preset-tile:hover { border-color: #3478f6; background: #eef5ff; }
.qr-preset-tile.selected { border-color: #06c755; background: #e3f7eb; }
.qr-preset-tile svg { width: 100%; height: 100%; display: block; }
.qr-upload-row {
  display: flex;
  gap: 6px;
  border-top: 1px solid #eef1f5;
  padding-top: 10px;
}
.qr-upload-row .btn { flex: 1; font-size: 12px; padding: 6px; }

/* Credentials status (Settings tab) */
.creds-status {
  background: #f7f9fc;
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 14px;
}
.creds-status h4 { margin: 0 0 8px; font-size: 13px; color: #586273; font-weight: 600; }
.creds-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 13px;
}
.creds-label { min-width: 160px; color: #1f2533; }
.creds-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.creds-tag.ok      { background: #e3f7eb; color: #14793f; }
.creds-tag.pending { background: #fdecec; color: #a32d2d; }
.creds-mask {
  font-family: Menlo, monospace;
  font-size: 12px;
  background: #fff;
  border: 1px solid #e3e8ef;
  padding: 2px 8px;
  border-radius: 4px;
  color: #1f2533;
  letter-spacing: 0.5px;
}

.asset-library {
  display: grid;
  gap: 14px;
}
.asset-summary {
  display: grid;
  gap: 8px;
}
.asset-summary strong {
  margin-right: 6px;
}
.asset-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf3;
}
.asset-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #248899;
}
.asset-group {
  display: grid;
  gap: 8px;
}
.asset-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.asset-group h4 {
  margin: 0;
}
.asset-table td:first-child {
  min-width: 220px;
}

/* "บน LINE" cell — status tag + publish button */
.menu-list-table .line-cell { padding: 8px 10px; }
.line-status { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.line-status-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.line-status-tag.ok      { background: #e3f7eb; color: #14793f; }
.line-status-tag.pending { background: #fff4d6; color: #8a6d1d; }
.line-status-id { font-size: 11px; }
.btn-publish { white-space: nowrap; }

/* Quick Reply Flow editor */
.qr-template-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.qr-template-list {
  display: grid;
  gap: 8px;
}
.qr-template-row {
  display: flex;
  width: 100%;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  border: 1px solid #e1e5eb;
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  color: #172033;
}
.qr-template-row:hover { background: #f7fafc; }
.qr-template-row.selected {
  border-color: #1f7a8c;
  background: #eef8fa;
}
.qr-template-row span span {
  display: block;
  color: #6d7686;
  font-size: 12px;
  margin-top: 2px;
}
.qr-template-row em {
  font-size: 11px;
  color: #6d7686;
  font-style: normal;
  white-space: nowrap;
}
.qr-template-preview {
  border: 1px solid #e3e8ef;
  border-radius: 8px;
  background: #f4f7f5;
  padding: 14px;
  margin: 4px 0 14px;
}
.qr-template-items {
  display: grid;
  gap: 8px;
}
.qr-template-item {
  display: grid;
  grid-template-columns: 150px minmax(100px, 0.8fr) minmax(180px, 1.2fr) minmax(150px, 0.9fr) minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.qr-template-item input,
.qr-template-item select {
  margin-top: 0;
}
.qr-json-card summary {
  cursor: pointer;
  font-weight: 600;
}
.danger-zone {
  border-color: #efc7c7;
  background: #fffafa;
}
.rich-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.rich-validation {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12px;
}
.rich-validation.ok {
  background: #e7f7eb;
  color: #137a3c;
  border: 1px solid #bce7c6;
}
.rich-validation.has-error {
  background: #fff4e6;
  color: #7a4b00;
  border: 1px solid #f0d0a4;
}
.rich-validation ul {
  margin: 6px 0 0 18px;
  padding: 0;
}
.empty.compact {
  margin: 24px auto;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .composer-layout {
    grid-template-columns: 1fr;
  }
  .send-panel {
    position: static;
    max-width: 420px;
  }
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: 18px 16px 32px; }
  .auth-screen .content { padding: 0; }
  .login-shell {
    width: min(100% - 32px, 480px);
    grid-template-columns: 1fr;
    gap: 20px;
    align-content: center;
    padding: 28px 0;
  }
  .login-copy h1 { font-size: 28px; }
  .login-copy p { font-size: 14px; }
  .login-panel { padding: 22px; }
  .simulate-grid, .overview-grid, .rich-builder, .rich-menu-meta, .qr-template-layout, .role-grid, .team-layout, .business-layout { grid-template-columns: 1fr; }
  .business-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .business-row-actions {
    justify-content: flex-start;
  }
  .step-card { grid-template-columns: 1fr; }
  .qr-row { grid-template-columns: 1fr; }
  .qr-template-item { grid-template-columns: 1fr; }
  .message-image-source { flex-direction: column; }
  .message-upload-row { justify-content: flex-start; }
  .message-upload-row .hint { text-align: left; }
  .send-panel { max-width: none; }
  .oa-header, .page-intro { flex-direction: column; }
  .row { grid-template-columns: 1fr; }
}

/* ── Tooltip / help icon ──────────────────────────────────── */
.help {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 16px; height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  background: #d4d6db; color: #555;
  font-size: 11px; font-weight: 700;
  cursor: help; user-select: none;
  position: relative;
}
.help:hover { background: #1f6feb; color: white; }
.help::after {
  content: attr(data-tip);
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #1a1a1a; color: white;
  padding: 6px 10px; border-radius: 6px;
  font-size: 12px; font-weight: 400;
  white-space: pre-wrap;
  width: 280px;
  text-align: left;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
  z-index: 50;
}
.help:hover::after { opacity: 1; }

.banner {
  background: #fff5cc; color: #7a5b00;
  border: 1px solid #f0d97a;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.banner.info {
  background: #e0eeff; color: #1f4d8c; border-color: #a8c8ff;
}

/* ── Wizard ────────────────────────────────────────────────── */
.wizard-body { background: #f5f6f8; }
.wizard {
  max-width: 720px;
  margin: 32px auto;
  padding: 0 20px;
}

.wizard-steps {
  list-style: none; padding: 0; margin: 0 0 32px;
  display: flex; gap: 8px;
  background: white; border: 1px solid #e3e5ea; border-radius: 10px;
  padding: 12px;
}
.wizard-steps li {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: #888;
  padding: 6px 8px;
}
.wizard-steps .num {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #e3e5ea; color: #555;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px;
  flex-shrink: 0;
}
.wizard-steps li.current { color: #1f6feb; font-weight: 600; }
.wizard-steps li.current .num { background: #1f6feb; color: white; }
.wizard-steps li.done { color: #137a3c; }
.wizard-steps li.done .num { background: #137a3c; color: white; }
.wizard-steps li.done .num::after { content: '✓'; }
.wizard-steps li.done .num > * { display: none; }

.wizard-step {
  background: white; border: 1px solid #e3e5ea; border-radius: 10px;
  padding: 32px;
}
.wizard-step.hidden { display: none; }
.wizard-step h1 {
  font-size: 22px; margin-bottom: 12px;
}
.wizard-step p { color: #444; margin: 0 0 12px; }

.wizard-form { margin-top: 20px; }
.wizard-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 24px;
}
.btn-lg { padding: 10px 22px; font-size: 15px; }

.wizard-status {
  margin-top: 12px; padding: 10px 14px; border-radius: 6px;
  font-size: 13px;
}
.wizard-status.loading { background: #e0eeff; color: #1f4d8c; }
.wizard-status.error { background: #fde0e0; color: #a82929; }
.wizard-status.success { background: #d9f5dd; color: #137a3c; }
.wizard-status.hidden { display: none; }

/* Help/instruction card (inside wizard) */
.help-card {
  background: #f9fafb; border: 1px solid #e3e5ea; border-radius: 8px;
  padding: 14px 16px; margin: 16px 0;
}
.help-card-head {
  font-weight: 600; color: #1a1a1a; margin-bottom: 8px; font-size: 14px;
}
.help-steps {
  margin: 0; padding-left: 20px; font-size: 13px; color: #555;
  line-height: 1.7;
}
.help-steps code {
  background: #fff; padding: 1px 5px; border-radius: 3px;
  border: 1px solid #e3e5ea;
}

.checklist {
  list-style: none; padding: 0; margin: 12px 0;
  font-size: 14px;
}
.checklist li {
  padding: 6px 0; color: #444;
}

.mode-picker {
  display: grid; gap: 10px;
  margin: 18px 0;
}
.mode-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid #e3e5ea;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.mode-option.disabled {
  opacity: 0.55;
  background: #f6f8fa;
}
.mode-option input { width: auto; margin: 3px 0 0; }
.mode-option small {
  display: block;
  color: #666;
  font-weight: 400;
  margin-top: 2px;
}

/* Bot card (step 3) */
.bot-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px; margin: 16px 0;
  border: 1px solid #e3e5ea; border-radius: 10px;
  background: linear-gradient(180deg, #f9fafb 0%, white 100%);
}
.bot-pic img {
  width: 64px; height: 64px; border-radius: 50%;
  background: #e3e5ea; display: block;
}
.bot-info { flex: 1; }
.bot-name { font-weight: 600; font-size: 18px; margin-bottom: 4px; }
.bot-id { font-size: 12px; color: #555; line-height: 1.6; }
.bot-id code { font-size: 11px; }

/* Templates grid */
.templates-grid {
  display: grid; grid-template-columns: 1fr; gap: 12px;
  margin: 16px 0;
}
.template-card {
  background: white; border: 2px solid #e3e5ea; border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.template-card:hover {
  border-color: #1f6feb;
  transform: translateY(-1px);
}
.template-card.selected {
  border-color: #1f6feb;
  background: #f4f9ff;
}
.template-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
}
.template-label { font-weight: 600; font-size: 16px; }
.template-tick {
  background: #1f6feb; color: white;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.template-desc { color: #555; margin: 4px 0 8px; font-size: 13px; }
.template-meta { color: #888; font-size: 12px; }

/* Copy block (step 5) */
.copy-block {
  display: flex; align-items: center; gap: 8px;
  background: #0f1115; color: #e6e6e6;
  padding: 10px 14px; border-radius: 6px;
  margin: 8px 0;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 13px;
}
.copy-block code { flex: 1; word-break: break-all; }
.copy-block .btn { background: white; color: #1a1a1a; }
