:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --blue: #2f55d4;
  --blue-dark: #2542a6;
  --cyan: #06b6d4;
  --violet: #7c3aed;
  --ink: #101828;
  --muted: #667085;
  --line: #dbe4f0;
  --panel: #ffffff;
  --canvas: #f3f7fb;
  --soft: #eef4fb;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 20px 50px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 12px 26px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at top left, rgba(47, 85, 212, 0.05), transparent 30vw),
    linear-gradient(135deg, #fbfdff 0%, #f3f6fa 55%, #f8fbff 100%);
  color: var(--ink);
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.splash,
.login-page {
  align-items: center;
  display: flex;
  min-height: 100vh;
  justify-content: center;
}

.splash {
  flex-direction: column;
  gap: 10px;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 14px;
  box-shadow: 0 14px 30px rgba(49, 87, 255, 0.24);
  color: #fff;
  display: inline-flex;
  height: 52px;
  justify-content: center;
  overflow: hidden;
  width: 52px;
}

.brand-mark img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.login-page {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.28), transparent 24vw),
    radial-gradient(circle at 82% 20%, rgba(6, 182, 212, 0.34), transparent 28vw),
    linear-gradient(135deg, #07111f 0%, #0f2a5f 48%, #113d66 100%);
  padding: 32px;
}

.login-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  box-shadow: 0 34px 100px rgba(0, 0, 0, 0.32);
  display: grid;
  grid-template-columns: 1.15fr 420px;
  max-width: 1120px;
  min-height: 560px;
  overflow: hidden;
  width: 100%;
}

.login-copy {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(236, 245, 255, 0.55)),
    radial-gradient(circle at 75% 20%, rgba(49, 87, 255, 0.16), transparent 22vw);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 54px;
  position: relative;
  overflow: hidden;
}

.login-orbit {
  height: 260px;
  pointer-events: none;
  position: absolute;
  right: -70px;
  top: -60px;
  width: 260px;
}

.login-orbit span {
  border: 1px solid rgba(49, 87, 255, 0.18);
  border-radius: 999px;
  inset: 0;
  position: absolute;
}

.login-orbit span:nth-child(2) {
  inset: 42px;
}

.login-orbit span:nth-child(3) {
  background: linear-gradient(135deg, rgba(49, 87, 255, 0.13), rgba(6, 182, 212, 0.16));
  inset: 92px;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 14px;
}

.brand-lockup strong {
  display: block;
  font-size: 20px;
}

.brand-lockup small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.brand-lockup.compact .brand-mark {
  border-radius: 10px;
  height: 42px;
  width: 42px;
}

.brand-lockup.compact strong {
  color: var(--ink);
  font-size: 16px;
}

.brand-lockup.compact small {
  color: var(--muted);
}

.login-copy h1 {
  color: #0b1730;
  font-size: 48px;
  letter-spacing: 0;
  line-height: 1.02;
  margin: 46px 0 18px;
  max-width: 620px;
}

.login-copy p {
  color: #4b5872;
  font-size: 18px;
  line-height: 1.6;
  max-width: 650px;
}

.login-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.login-highlights span {
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(219, 228, 240, 0.88);
  border-radius: 999px;
  display: inline-flex;
  gap: 8px;
  padding: 10px 12px;
  box-shadow: 0 8px 22px rgba(16, 24, 40, 0.06);
}

.login-form {
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid rgba(219, 228, 240, 0.88);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 42px;
}

.login-form h2 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
}

.login-kicker {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

label {
  color: #3b465f;
  display: grid;
  font-size: 14px;
  font-weight: 750;
  gap: 8px;
  margin-bottom: 16px;
}

input,
select,
textarea {
  background: #fbfdff;
  border: 1px solid #d5dfec;
  border-radius: 11px;
  color: var(--ink);
  min-height: 44px;
  padding: 10px 13px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
  outline: none;
}

textarea {
  resize: vertical;
}

.primary-button {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), #2348d7);
  border: 0;
  border-radius: 11px;
  box-shadow: 0 12px 24px rgba(49, 87, 255, 0.22);
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
}

.primary-button:hover {
  background: linear-gradient(135deg, #254beb, var(--blue-dark));
  transform: translateY(-1px);
}

.link-button {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
  padding: 8px 0;
  text-align: left;
}

.form-error {
  background: #fff5f5;
  border: 1px solid #fecaca;
  border-radius: 10px;
  color: #b32222;
  padding: 10px;
}

.generated-password {
  background: #f0fff8;
  border: 1px solid #b9efd7;
  border-radius: 6px;
  color: #176342;
  line-height: 1.5;
  padding: 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.shell {
  display: grid;
  grid-template-columns: 268px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(18px);
  border-right: 1px solid rgba(219, 228, 240, 0.9);
  box-shadow: 10px 0 34px rgba(16, 24, 40, 0.05);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar nav {
  display: grid;
  gap: 7px;
}

.sidebar nav a,
.sidebar nav button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 13px;
  color: #475569;
  display: flex;
  gap: 10px;
  font-weight: 750;
  min-height: 44px;
  padding: 11px 13px;
  position: relative;
  text-align: left;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.sidebar nav a:hover,
.sidebar nav button:hover {
  background: #f1f5f9;
  color: var(--ink);
  transform: translateX(2px);
}

.sidebar nav .active,
.sidebar nav button.active {
  background: linear-gradient(135deg, #eef4ff, #f8fbff);
  box-shadow: inset 3px 0 0 var(--blue), 0 10px 22px rgba(49, 87, 255, 0.08);
  color: var(--blue-dark);
}

.sidebar-footer {
  align-items: center;
  background: rgba(248, 251, 255, 0.86);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 16px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: auto;
  padding: 10px;
}

.profile-trigger {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex: 1;
  gap: 10px;
  min-width: 0;
  padding: 0;
  text-align: left;
}

.profile-avatar {
  align-items: center;
  background: linear-gradient(135deg, #e0f2fe, #eef2ff);
  color: var(--blue-dark);
  border-radius: 12px;
  display: inline-flex;
  flex: 0 0 auto;
  height: 34px;
  justify-content: center;
  overflow: hidden;
  width: 34px;
}

.profile-avatar img,
.profile-logo-preview img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.sidebar-footer small {
  color: var(--muted);
  display: block;
}

.sidebar-footer button {
  background: #eef4fb;
  border: 0;
  border-radius: 11px;
  color: #475569;
  height: 38px;
  width: 38px;
}

.sidebar-footer .profile-trigger {
  background: transparent;
  border-radius: 0;
  height: auto;
  width: auto;
}

.sidebar-footer > button:last-child {
  flex: 0 0 auto;
}

.profile-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 22px 70px rgba(12, 21, 48, 0.28);
  color: #34405b;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 20px;
  width: min(560px, 94vw);
}

.profile-logo-row {
  align-items: center;
  background: #f7f9fd;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 14px;
  padding: 14px;
}

.profile-logo-preview {
  align-items: center;
  background: #eaf0ff;
  border-radius: 14px;
  color: var(--blue);
  display: inline-flex;
  flex: 0 0 auto;
  height: 84px;
  justify-content: center;
  overflow: hidden;
  width: 84px;
}

.profile-logo-row strong,
.profile-logo-row small {
  display: block;
}

.logo-upload {
  cursor: pointer;
  display: inline-flex;
  margin-top: 10px;
  position: relative;
}

.logo-upload input {
  inset: 0;
  opacity: 0;
  position: absolute;
}

.compact-danger {
  margin-left: 8px;
  min-height: 36px;
  padding: 7px 12px;
}

.workspace {
  min-width: 0;
  padding: 30px 34px 42px;
}

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(219, 228, 240, 0.86);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 22px;
  padding: 18px 20px;
}

.topbar h1 {
  font-size: 31px;
  letter-spacing: -0.025em;
  margin: 0;
}

.topbar p {
  color: var(--muted);
  margin: 6px 0 0;
}

.ghost-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: #334155;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 40px;
  padding: 9px 16px;
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric,
.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.metric {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
  display: grid;
  gap: 9px;
  min-height: 130px;
  padding: 18px;
}

.metric svg {
  color: var(--blue);
}

.metric span {
  color: var(--muted);
}

.metric strong {
  font-size: 28px;
  letter-spacing: -0.02em;
}

.metric.green strong {
  color: #12875d;
}

.metric.amber strong {
  color: #b86b00;
}

.admin-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.4fr) minmax(340px, 0.8fr);
}

.whatsapp-settings-grid {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.whatsapp-connection-panel {
  grid-column: 1 / -1;
}

.response-behavior-panel {
  align-self: start;
  height: auto;
  min-height: 0;
}

.response-behavior-panel .hint-text,
.sandbox-settings-panel .hint-text {
  margin: 0;
}

.users-panel {
  margin-top: 18px;
}

.documentation-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 280px minmax(0, 1fr);
}

.documentation-index {
  position: sticky;
  top: 20px;
}

.documentation-search {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0 12px;
}

.documentation-search input {
  background: transparent;
  border: 0;
  box-shadow: none;
  flex: 1;
  min-height: 42px;
  padding: 0;
}

.documentation-search input:focus {
  box-shadow: none;
  outline: 0;
}

.documentation-index a {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #35405a;
  display: flex;
  gap: 8px;
  padding: 10px 8px;
  text-decoration: none;
}

.documentation-index a:hover {
  background: #f4f7ff;
  border-color: var(--line);
  color: var(--blue);
}

.documentation-content {
  display: grid;
  gap: 14px;
}

.documentation-section h2 {
  font-size: 20px;
  margin: 0 0 12px;
}

.documentation-summary {
  color: #63708a;
  line-height: 1.55;
  margin: -4px 0 18px;
}

.doc-subsection {
  border-top: 1px solid #eef2f7;
  padding: 16px 0 0;
}

.doc-subsection + .doc-subsection,
.doc-paragraph + .doc-subsection,
.doc-subsection + .doc-paragraph {
  margin-top: 16px;
}

.doc-subsection h3 {
  color: #102044;
  font-size: 16px;
  margin: 0 0 8px;
}

.doc-subsection p,
.doc-paragraph,
.doc-empty p {
  color: #35405a;
  line-height: 1.65;
  margin: 0;
}

.documentation-section ul {
  color: #35405a;
  line-height: 1.65;
  margin: 0;
  padding-left: 22px;
}

.documentation-section li + li {
  margin-top: 8px;
}

.panel {
  padding: 20px;
}

.panel-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title h2 {
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.table-list {
  display: grid;
  gap: 10px;
}

.row-card,
.conversation-card {
  align-items: center;
  background: linear-gradient(180deg, #fbfdff, #f7faff);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto 1fr auto;
  padding: 14px;
}

.row-card small,
.conversation-card small {
  color: var(--muted);
  display: block;
  margin-top: 3px;
}

.status-dot {
  border-radius: 999px;
  height: 10px;
  width: 10px;
}

.status-dot.active {
  background: #16a36f;
}

code,
.token-box {
  background: #eef2ff;
  border-radius: 5px;
  color: #1f3a9f;
  display: inline-block;
  padding: 7px 9px;
  word-break: break-all;
}

.form-panel .primary-button {
  width: 100%;
}

.roadmap {
  display: grid;
  gap: 12px;
}

.roadmap span {
  align-items: center;
  display: flex;
  gap: 10px;
}

.dashboard-tabs {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 14px;
  display: inline-flex;
  gap: 4px;
  margin: -4px 0 18px;
  padding: 4px;
}

.dashboard-tabs button {
  background: transparent;
  border: 0;
  border-radius: 11px;
  color: #64748b;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 14px;
  position: relative;
}

.dashboard-tabs button.active {
  background: linear-gradient(135deg, var(--blue), #2348d7);
  box-shadow: 0 10px 20px rgba(49, 87, 255, 0.18);
  color: #fff;
}

.dashboard-metrics {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.35fr repeat(5, minmax(118px, 1fr));
  margin-bottom: 14px;
}

.ai-cost-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 16px;
}

.ai-cost-head {
  align-items: center;
  display: flex;
  gap: 12px;
}

.ai-cost-head strong {
  color: #172042;
  display: block;
  font-size: 16px;
}

.ai-cost-head small,
.ai-cost-values small,
.ai-cost-foot {
  color: var(--muted);
  font-size: 13px;
}

.ai-cost-values {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

.ai-cost-values span {
  background: #f8fbff;
  border: 1px solid #e4ebf8;
  border-radius: 12px;
  padding: 9px 10px;
}

.ai-cost-values b {
  color: #172042;
  display: block;
  font-size: 16px;
  margin-top: 3px;
}

.ai-cost-foot {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.ai-cost-foot button {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 0;
}

.welcome-card,
.kpi-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 150px;
}

.welcome-card {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 18px;
}

.welcome-card strong {
  display: block;
  font-size: 17px;
  margin-bottom: 18px;
}

.welcome-card p {
  color: #58637b;
  font-size: 16px;
  line-height: 1.45;
  margin: 0;
}

.welcome-card b {
  color: var(--blue);
}

.avatar-ring {
  align-items: center;
  border: 4px solid #5a5b74;
  border-radius: 999px;
  color: #5a5b74;
  display: inline-flex;
  flex: 0 0 auto;
  height: 88px;
  justify-content: center;
  width: 88px;
}

.kpi-card {
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.94));
  border: 1px solid rgba(219, 228, 240, 0.9);
  display: grid;
  justify-items: center;
  padding: 15px 12px;
  text-align: center;
}

.kpi-card.clickable {
  cursor: pointer;
  font: inherit;
}

.kpi-card.clickable:hover {
  box-shadow: 0 12px 26px rgba(22, 33, 62, .12);
  transform: translateY(-1px);
}

.kpi-card strong {
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.kpi-card small {
  color: #68718a;
  line-height: 1.25;
}

.kpi-icon {
  align-items: center;
  background: linear-gradient(135deg, #eef2ff, #e0f2fe);
  border-radius: 16px;
  color: var(--blue);
  display: inline-flex;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.kpi-icon.cyan {
  background: #dff8fa;
  color: #1b9dac;
}

.kpi-icon.orange {
  background: #fff1df;
  color: #df8428;
}

.kpi-icon.red {
  background: #ffe7e7;
  color: #d95a5a;
}

.kpi-icon.green {
  background: #ddf9e8;
  color: #19a969;
}

.kpi-icon.yellow {
  background: #fff3bd;
  color: #d69d00;
}

.dashboard-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 330px 1fr;
}

.smart-kpis {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 14px;
}

.section-subnav {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 14px;
  padding: 5px;
}

.section-subnav button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 42px;
  padding: 10px 14px;
}

.section-subnav button.active {
  background: linear-gradient(135deg, var(--blue), #2348d7);
  box-shadow: 0 10px 20px rgba(49, 87, 255, 0.16);
  color: #fff;
}

.smart-dashboard-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.smart-status-list {
  display: grid;
  gap: 10px;
}

.smart-status-list span {
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 13px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 11px 12px;
}

.smart-status-list b {
  color: var(--blue-dark);
  text-align: right;
}

.smart-commerce-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(250px, 290px) minmax(0, 1fr) minmax(280px, 330px);
}

.smart-commerce-grid > * {
  min-width: 0;
}

.smart-sandbox-panel {
  margin-bottom: 14px;
}

.smart-simulator-panel {
  margin-bottom: 14px;
}

.smart-sandbox-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.smart-simulator-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.smart-simulator-grid label {
  margin-bottom: 0;
}

.smart-simulator-grid label:nth-of-type(9) {
  grid-column: span 2;
}

.smart-simulator-options {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) auto;
}

.smart-simulator-options .primary-button {
  min-width: 180px;
}

.smart-list {
  align-content: start;
  display: grid;
  gap: 10px;
}

.send-mode-box {
  background: linear-gradient(135deg, #ffffff, #f1f6ff);
  border: 1px solid rgba(191, 213, 246, 0.9);
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.06);
  display: grid;
  gap: 12px;
  padding: 14px;
}

.send-mode-box > span {
  color: #1e2f4d;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.send-mode-box > small {
  color: var(--muted);
  line-height: 1.35;
}

.send-mode-toggle {
  background: #e7edf7;
  border: 1px solid #d8e2f0;
  border-radius: 15px;
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  padding: 5px;
}

.send-mode-toggle button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: #475569;
  display: grid;
  font-weight: 900;
  gap: 4px;
  justify-items: center;
  min-height: 74px;
  padding: 11px 8px;
  position: relative;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, color 0.18s ease;
}

.send-mode-toggle button::before {
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  content: "✓";
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 22px;
  justify-content: center;
  margin-bottom: 2px;
  width: 22px;
}

.send-mode-toggle button.risky::before,
.send-mode-toggle button:not(.active):last-child::before {
  content: "!";
}

.send-mode-toggle button:hover {
  transform: translateY(-1px);
}

.send-mode-toggle button small {
  color: inherit;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.send-mode-toggle button.active {
  box-shadow: 0 14px 26px rgba(15, 23, 42, 0.14);
  color: #fff;
}

.send-mode-toggle button.active.safe {
  background: linear-gradient(135deg, #16a34a, #0f766e);
}

.send-mode-toggle button.active.risky {
  background: linear-gradient(135deg, #f97316, #dc2626);
}

.send-mode-box {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.04);
  gap: 10px;
  padding: 12px;
}

.send-mode-box > span {
  color: #334155;
}

.send-mode-toggle {
  background: #eef3f8;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  gap: 6px;
  padding: 5px;
}

.send-mode-toggle button {
  align-items: flex-start;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #334155;
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
  justify-items: initial;
  min-height: 58px;
  padding: 10px 12px 10px 14px;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.send-mode-toggle button::before {
  background: #cbd5e1;
  border-radius: 999px;
  content: "";
  display: block;
  height: 26px;
  left: 6px;
  margin: 0;
  opacity: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
}

.send-mode-toggle button:not(.active):last-child::before {
  content: "";
}

.send-mode-toggle button:hover {
  background: rgba(255, 255, 255, 0.68);
  transform: none;
}

.send-mode-toggle button small {
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  text-align: left;
}

.send-mode-toggle button.active {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08);
  color: #0f172a;
}

.send-mode-toggle button.active.safe {
  background: #ffffff;
  border-color: #86efac;
}

.send-mode-toggle button.active.risky {
  background: #ffffff;
  border-color: #fdba74;
}

.send-mode-toggle button.active::before {
  opacity: 1;
}

.send-mode-toggle button.active.safe::before {
  background: #16a34a;
}

.send-mode-toggle button.active.risky::before {
  background: #f97316;
}

.smart-list button {
  align-items: center;
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 14px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 12px;
  text-align: left;
}

.smart-list button.active {
  background: #eff6ff;
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.meta-template-editor {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
}

.meta-api-editor {
  padding: 0;
  overflow: hidden;
}

.meta-editor-head {
  align-items: flex-start;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: 20px 22px;
}

.meta-editor-head h2 {
  font-size: 24px;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.meta-editor-head p {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
  max-width: 680px;
}

.meta-api-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 620px;
}

.meta-api-side {
  background: #fbfdff;
  border-right: 1px solid #e2e8f0;
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 18px;
}

.meta-pending-box,
.meta-side-actions,
.meta-duplicate-box,
.meta-history-box,
.meta-rejection-box,
.meta-validation-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.meta-pending-box {
  margin-bottom: 12px;
}

.meta-pending-box > strong,
.meta-side-actions > span,
.meta-duplicate-box > span,
.meta-validation-box > strong,
.meta-rejection-box > strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
}

.meta-pending-box button,
.meta-side-actions button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  color: #334155;
  cursor: pointer;
  display: flex;
  font-size: 12px;
  font-weight: 750;
  justify-content: space-between;
  min-height: 34px;
  padding: 8px 10px;
  text-align: left;
}

.meta-pending-box b {
  border-radius: 999px;
  font-size: 10px;
  padding: 3px 7px;
  text-transform: uppercase;
}

.meta-pending-box b.draft {
  background: #f1f5f9;
  color: #475569;
}

.meta-pending-box b.pending {
  background: #fef3c7;
  color: #92400e;
}

.meta-pending-box b.rejected {
  background: #ffe4e6;
  color: #be123c;
}

.meta-pending-box small {
  color: #64748b;
}

.meta-side-actions {
  grid-template-columns: 1fr;
}

.meta-duplicate-box select {
  min-height: 36px;
}

.meta-api-main {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 22px;
}

.meta-language-list {
  display: grid;
  gap: 7px;
}

.meta-language-list span {
  color: #475569;
  font-weight: 800;
}

.meta-language-list button {
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  font-weight: 800;
  padding: 6px 0;
  text-align: left;
}

.meta-language-list button.active {
  color: #059669;
}

.meta-status-pill {
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  padding: 10px;
}

.meta-status-pill.approved {
  background: #ecfdf5;
  border-color: #86efac;
}

.meta-status-pill.rejected {
  background: #fff1f2;
  border-color: #fda4af;
}

.danger-text {
  color: #be123c;
}

.meta-validation-box {
  background: #fff7ed;
  border-color: #fed7aa;
  max-width: 100%;
  overflow: hidden;
  padding: 10px 12px;
}

.meta-validation-box.ok {
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.meta-validation-box ul {
  color: #9a3412;
  display: grid;
  gap: 5px;
  margin: 0;
  max-height: 112px;
  overflow: auto;
  padding-left: 18px;
}

.meta-validation-box li {
  overflow-wrap: anywhere;
}

.meta-validation-box.ok p {
  color: #047857;
  margin: 0;
}

.meta-header-options {
  display: grid;
  gap: 10px;
}

.meta-header-options > span {
  color: #1f2937;
  font-weight: 900;
}

.meta-header-options > span small,
.meta-api-main label small {
  color: var(--muted);
  font-weight: 700;
}

.meta-header-options > div {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(105px, 1fr));
}

.meta-header-options button {
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #334155;
  cursor: pointer;
  font-weight: 900;
  min-height: 58px;
}

.meta-header-options button.active {
  background: #eff6ff;
  border-color: var(--blue);
  color: var(--blue-dark);
}

.meta-samples-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.meta-samples-box strong {
  color: #1e3a8a;
}

.meta-samples-box p {
  color: #475569;
  margin: 0;
}

.meta-sample-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(140px, 0.8fr) auto minmax(160px, 1fr);
}

.meta-sample-row span {
  background: #e2e8f0;
  border-radius: 8px;
  color: #334155;
  font-weight: 800;
  padding: 10px 12px;
}

.inline-alert.danger {
  background: #fff1f2;
  border-color: #fda4af;
  color: #9f1239;
}

.meta-template-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
}

.meta-buttons-editor {
  display: grid;
  gap: 10px;
}

.meta-button-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-phone-preview {
  background: #f1f5f9;
  border: 1px solid #dbe4f0;
  border-radius: 26px;
  margin: 14px 0;
  padding: 10px;
}

.meta-phone-top {
  align-items: center;
  color: #64748b;
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  padding: 4px 8px 10px;
}

.meta-phone-top b {
  background: #e0f2fe;
  border-radius: 999px;
  color: #0369a1;
  font-size: 11px;
  padding: 3px 8px;
}

.meta-phone-screen {
  background: #efe7da;
  border-radius: 20px;
  min-height: 260px;
  padding: 18px 12px;
}

.meta-rejection-box {
  background: #fff1f2;
  border-color: #fda4af;
  margin-top: 12px;
}

.meta-rejection-box p {
  color: #9f1239;
  margin: 0;
}

.meta-history-box {
  margin-top: 12px;
}

.compact-title {
  margin: 0;
}

.meta-history-box article {
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 4px;
  padding-top: 10px;
}

.meta-history-box article:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.meta-history-box article strong {
  color: #0f172a;
  font-size: 13px;
  text-transform: capitalize;
}

.meta-history-box article strong span {
  color: #64748b;
  font-size: 11px;
  margin-left: 4px;
  text-transform: uppercase;
}

.meta-history-box article p {
  color: #334155;
  font-size: 13px;
  margin: 0;
}

.meta-history-box article small,
.meta-history-box article em {
  color: #64748b;
  font-size: 12px;
  font-style: normal;
}

.meta-phone-screen > strong,
.meta-phone-screen > p,
.meta-phone-screen > small {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  display: block;
  line-height: 1.4;
  margin: 0 0 8px;
  padding: 9px 10px;
  white-space: pre-wrap;
}

.meta-phone-screen > p {
  color: #111827;
  font-size: 13px;
}

.meta-phone-screen > small {
  color: #64748b;
}

.meta-media-placeholder {
  align-items: center;
  background: #e2e8f0;
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  color: #475569;
  display: flex;
  font-weight: 800;
  height: 92px;
  justify-content: center;
  margin-bottom: 8px;
}

.meta-preview-buttons {
  display: grid;
  gap: 6px;
}

.meta-preview-buttons button {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  color: var(--blue);
  font-weight: 800;
  padding: 8px;
}

.smart-list button strong,
.smart-log-list strong {
  display: block;
  font-size: 14px;
}

.smart-list button small,
.smart-log-list span,
.smart-log-list small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

.smart-log-customer {
  color: var(--ink);
  display: block;
  font-size: 13px;
  font-weight: 800;
  margin-top: 6px;
}

.smart-log-customer.muted {
  color: #9aa3b7;
  font-weight: 700;
}

.smart-list button b {
  color: #1b8f5a;
  font-size: 12px;
}

.smart-editor textarea {
  min-height: 230px;
}

.smart-flags {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.payment-reminder-box {
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 14px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.variable-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variable-row button {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #25305a;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  padding: 6px 10px;
}

.form-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.message-preview {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font-family: inherit;
  line-height: 1.45;
  margin: 0 0 12px;
  min-height: 160px;
  padding: 14px;
  white-space: pre-wrap;
}

.compact-title {
  margin-top: 18px;
}

.smart-log-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.dashboard-log-list,
.smart-log-list-full {
  max-height: none;
}

.smart-section-actions {
  margin-top: 14px;
}

.smart-queue-panel {
  display: grid;
  gap: 14px;
}

.queue-toolbar,
.queue-actions {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.queue-toolbar label {
  display: grid;
  flex: 1 1 190px;
  gap: 6px;
  margin: 0;
}

.queue-toolbar input,
.queue-toolbar select {
  min-height: 40px;
}

.queue-actions {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

.queue-actions span {
  color: var(--muted);
  font-weight: 800;
  margin-right: auto;
}

.queue-groups {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.queue-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 0;
  padding: 12px;
}

.queue-group-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.queue-group-title h3 {
  font-size: 16px;
  margin: 0;
}

.queue-group-title small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-top: 3px;
}

.queue-group-title button,
.queue-mini-actions button {
  background: transparent;
  border: 0;
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

.queue-row {
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) minmax(150px, auto);
  margin-top: 9px;
  padding: 10px;
}

.queue-row.selected {
  background: #eff6ff;
  border-color: var(--blue);
}

.queue-main {
  min-width: 0;
}

.queue-main strong,
.queue-main span,
.queue-main small {
  display: block;
}

.queue-main span,
.queue-main small,
.queue-side span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.queue-side {
  display: grid;
  gap: 4px;
  justify-items: end;
  text-align: right;
}

.queue-status {
  background: #eef2ff;
  border-radius: 999px;
  color: #3346a3;
  font-size: 12px;
  padding: 4px 8px;
}

.queue-status.queued {
  background: #fff7ed;
  color: #b45309;
}

.queue-status.sent,
.queue-status.sandbox_sent {
  background: #ecfdf3;
  color: #147346;
}

.queue-status.error {
  background: #fef2f2;
  color: #b91c1c;
}

.queue-status.cancelled,
.queue-status.ignored {
  background: #f1f5f9;
  color: #64748b;
}

.queue-mini-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.smart-log-list article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px;
}

.toast-inline,
.save-toast {
  background: #ecfdf3;
  border: 1px solid #b9ebcc;
  border-radius: 8px;
  color: #146c43;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.chart-card {
  min-height: 276px;
}

.timeline-card {
  min-width: 0;
}

.donut-wrap {
  align-items: center;
  display: grid;
  gap: 18px;
  justify-items: center;
  padding: 18px 0 0;
}

.donut {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  height: 172px;
  justify-content: center;
  position: relative;
  width: 172px;
}

.donut::after {
  background: #fff;
  border-radius: inherit;
  content: "";
  height: 86px;
  position: absolute;
  width: 86px;
}

.donut span {
  color: #27623d;
  font-weight: 900;
  position: relative;
  z-index: 1;
}

.legend-row {
  color: #4f5a72;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}

.legend-row i {
  display: inline-block;
  height: 12px;
  margin-right: 6px;
  vertical-align: -1px;
  width: 12px;
}

.legend-row .sent {
  background: #39b966;
}

.legend-row .received {
  background: #80dea0;
}

.hour-chart {
  align-items: end;
  border-left: 1px solid #aeb5c4;
  border-bottom: 1px solid #aeb5c4;
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(24, minmax(18px, 1fr));
  height: 214px;
  padding: 8px 10px 0;
}

.hour-slot {
  align-items: center;
  display: grid;
  gap: 5px;
  height: 100%;
  min-width: 0;
}

.hour-bars {
  align-items: end;
  display: flex;
  gap: 3px;
  height: 170px;
  justify-content: center;
}

.bar {
  border-radius: 999px;
  display: block;
  min-height: 4px;
  width: 9px;
}

.bar.received {
  background: #86e2a7;
}

.bar.sent {
  background: #218b49;
}

.hour-slot small {
  color: #737c91;
  display: block;
  font-size: 11px;
  text-align: center;
}

.dashboard-list {
  min-height: 238px;
}

.ranking-table {
  display: grid;
  gap: 8px;
}

.ranking-table article {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr 60px 70px;
  min-height: 36px;
}

.ranking-table strong {
  color: #4d5871;
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.ranking-table small {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.ranking-table b,
.ranking-table em {
  color: #596279;
  font-style: normal;
  text-align: right;
}

.dashboard-alerts {
  min-height: 238px;
}

.alert-list {
  display: grid;
  gap: 8px;
}

.alert-list button {
  align-items: center;
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #25304b;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  min-height: 48px;
  padding: 10px;
  text-align: left;
}

.alert-list button.warning {
  background: #fff8e8;
  border-color: #f3d38a;
}

.alert-list button.danger {
  background: #fff0f0;
  border-color: #f0b5b5;
}

.alert-list button.info {
  background: #eef5ff;
  border-color: #c8d9ff;
}

.alert-list button.success {
  background: #effcf5;
  border-color: #bfe9cf;
}

.alert-list strong,
.alert-list small {
  display: block;
}

.alert-list small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.mini-avatar {
  align-items: center;
  background: #eef2f8;
  border-radius: 999px;
  color: #b3bccb;
  display: inline-flex;
  height: 24px;
  justify-content: center;
  width: 24px;
}

@media (max-width: 1500px) {
  .dashboard-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .welcome-card {
    grid-column: span 3;
  }
}

@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .smart-commerce-grid {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .smart-commerce-grid .smart-preview {
    grid-column: 1 / -1;
  }

  .meta-api-layout {
    grid-template-columns: 1fr;
  }

  .meta-api-side {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meta-side-actions,
  .meta-duplicate-box,
  .meta-status-pill,
  .meta-language-list {
    grid-column: span 2;
  }

  .ai-cost-values {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hour-chart {
    overflow-x: auto;
  }

  .hour-slot {
    min-width: 28px;
  }
}

/* Button polish: lighter SaaS controls across the app. */
.primary-button,
.form-panel .primary-button,
.flow-actions .primary-button,
.flow-test-form .primary-button,
.menu-modal-title .primary-button,
.menu-modal-footer .primary-button {
  background: #2f55d4;
  border: 1px solid #2f55d4;
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(47, 85, 212, 0.16);
  font-size: 14px;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 13px;
  width: auto;
}

.primary-button:hover,
.form-panel .primary-button:hover,
.flow-actions .primary-button:hover,
.flow-test-form .primary-button:hover,
.menu-modal-title .primary-button:hover,
.menu-modal-footer .primary-button:hover {
  background: #2848bd;
  box-shadow: 0 8px 18px rgba(47, 85, 212, 0.18);
  transform: none;
}

.secondary-button,
.danger-button,
.flow-actions button,
.menu-modal-title button,
.menu-modal-footer button,
.add-option {
  border-radius: 10px;
  font-size: 14px;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 13px;
}

.secondary-button,
.flow-actions button,
.menu-modal-title button,
.menu-modal-footer button {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  color: #1f2937;
}

.danger-button,
.flow-actions .danger-button {
  background: #ffffff;
  border-color: #fecdd3;
  color: #be123c;
}

.add-option {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1f2937;
}

@media (max-width: 720px) {
  .login-page {
    padding: 18px;
  }

  .login-copy,
  .login-form {
    padding: 28px;
  }

  .login-copy h1 {
    font-size: 34px;
  }

  .workspace {
    padding: 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-metrics,
  .smart-kpis,
  .ai-cost-values,
  .queue-groups,
  .meta-api-side,
  .meta-header-options > div,
  .meta-button-row,
  .meta-sample-row {
    grid-template-columns: 1fr;
  }

  .meta-side-actions,
  .meta-duplicate-box,
  .meta-status-pill,
  .meta-language-list {
    grid-column: auto;
  }

  .meta-editor-head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 820px) {
  .dashboard-metrics {
    grid-template-columns: 1fr;
  }

  .welcome-card {
    grid-column: auto;
  }

  .dashboard-tabs {
    grid-template-columns: 1fr;
  }

  .ai-cost-values {
    grid-template-columns: 1fr;
  }

  .ranking-table article {
    grid-template-columns: auto 1fr auto;
  }

  .ranking-table em {
    display: none;
  }
}

.flow-screen {
  display: grid;
  grid-template-rows: auto 1fr;
  height: calc(100vh - 52px);
  min-height: 720px;
  position: relative;
}

.save-notice {
  align-items: center;
  background: #122a73;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(18, 42, 115, 0.22);
  color: #fff;
  display: flex;
  font-weight: 800;
  gap: 8px;
  left: 50%;
  min-height: 48px;
  padding: 0 22px;
  position: absolute;
  top: 18px;
  transform: translateX(-50%);
  z-index: 30;
}

.flow-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.flow-actions button,
.danger-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 700;
  gap: 7px;
  min-height: 38px;
  padding: 8px 11px;
}

.flow-actions .primary-button {
  background: linear-gradient(135deg, var(--blue), #2348d7);
  border-color: var(--blue);
  color: #fff;
}

.flow-actions .danger-button {
  border-color: #ffc4c4;
  color: #c41e3a;
}

.global-alert,
.inline-alert {
  align-items: center;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
  color: #92400e;
  display: flex;
  font-size: 13px;
  font-weight: 650;
  gap: 7px;
  line-height: 1.2;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.global-alert.is-connected {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.global-alert.is-disconnected {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.global-alert.is-reconnecting {
  background: #eef6ff;
  border-color: #a7cfff;
  color: #174a7c;
}

.inline-alert {
  margin: 0 0 12px;
}

.global-alert svg,
.inline-alert svg {
  height: 14px;
  width: 14px;
}

.flow-utility-row {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 10px;
}

.flow-search {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex: 1;
  gap: 8px;
  padding: 8px 10px;
}

.option-style-toggle {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
  padding: 4px;
}

.option-style-toggle span {
  color: #68718a;
  font-size: 13px;
  font-weight: 700;
  padding: 0 6px;
}

.option-style-toggle button {
  border: 0;
  min-height: 30px;
  padding: 6px 10px;
}

.option-style-toggle button.active {
  background: var(--blue);
  color: #fff;
}

.flow-search input {
  border: 0;
  min-height: 26px;
  padding: 0;
}

.flow-search button {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-size: 18px;
  height: 28px;
  justify-content: center;
  min-width: 30px;
  padding: 0;
}

.search-count {
  background: #e9efff;
  border-radius: 999px;
  color: #1f46d1;
  font-size: 12px;
  font-weight: 900;
  padding: 4px 8px;
  white-space: nowrap;
}

.search-count.empty {
  background: #fff0f2;
  color: #a70f2d;
}

.advanced-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.advanced-fields summary {
  cursor: pointer;
  font-weight: 900;
}

.advanced-fields label {
  margin-top: 10px;
}

.flow-health {
  border-radius: 999px;
  font-weight: 900;
  padding: 7px 11px;
}

.flow-health.ok {
  background: #e9f9ef;
  color: #137b37;
}

.flow-health.warn {
  background: #fff6df;
  color: #8a5b00;
}

.flow-health.bad {
  background: #fff0f2;
  color: #a70f2d;
}

.flow-reconnect-hint {
  align-items: center;
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  color: #047857;
  display: flex;
  font-size: 13px;
  font-weight: 750;
  justify-content: space-between;
  margin-top: 10px;
  padding: 9px 12px;
}

.flow-reconnect-hint button {
  background: #ffffff;
  border: 1px solid #86efac;
  border-radius: 999px;
  color: #047857;
  font-weight: 800;
  padding: 4px 10px;
}

.flow-validation-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flow-validation-summary {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid #d69d00;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(20, 35, 80, 0.07);
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
}

.flow-validation-summary.error {
  border-left-color: #c41e3a;
}

.flow-validation-summary > div:first-child {
  display: grid;
  gap: 4px;
}

.flow-validation-summary strong {
  color: var(--ink);
}

.flow-validation-summary span {
  color: var(--muted);
  font-size: 13px;
}

.flow-validation-panel button {
  align-items: center;
  background: #fff6df;
  border: 1px solid #ffe0a3;
  border-radius: 999px;
  color: #745000;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 6px;
  padding: 7px 10px;
}

.flow-validation-panel button span {
  color: inherit;
  font-size: 12px;
}

.flow-validation-panel button small {
  background: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  color: inherit;
  font-size: 11px;
  padding: 3px 7px;
}

.flow-validation-panel button.error {
  background: #fff0f2;
  border-color: #ffc8d0;
  color: #a70f2d;
}

.history-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(20, 35, 80, 0.08);
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 14px;
}

.flow-insights-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
  padding: 14px;
}

.flow-insights-panel header {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.flow-insights-panel header div,
.flow-insights-panel article,
.insight-row,
.suggestion-card {
  display: grid;
  gap: 5px;
}

.flow-insights-panel h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

.insight-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.insight-row {
  background: #f7f9fd;
  border: 1px solid #e3e8f3;
  border-radius: 8px;
  color: var(--ink);
  margin-bottom: 8px;
  padding: 10px;
  text-align: left;
}

.insight-row.clickable {
  cursor: pointer;
  width: 100%;
}

.insight-row.clickable:hover,
.suggestion-card:hover {
  border-color: #b9c7ef;
}

.suggestion-card {
  border: 1px solid #e3e8f3;
  border-radius: 8px;
  padding: 10px;
}

.suggestion-card span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.suggestion-card p,
.suggestion-card em {
  color: #58627a;
  font-style: normal;
  margin: 0;
}

.suggestion-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.suggestion-actions .primary-button {
  min-height: 36px;
  padding: 8px 12px;
}

.insight-logs {
  border-top: 1px solid #edf1f7;
  padding-top: 8px;
}

.insight-logs code {
  display: block;
  margin-top: 6px;
  white-space: normal;
}

.history-row {
  background: #f7f9fd;
  border: 1px solid #e7ebf5;
  border-radius: 6px;
  display: grid;
  gap: 3px;
  padding: 10px;
}

.history-row span {
  font-weight: 800;
}

.history-row small,
.history-panel small {
  color: var(--muted);
}

.flow-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 0;
}

.palette-panel,
.canvas-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 0;
}

.palette-panel {
  align-content: start;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.palette-panel strong {
  margin-bottom: 4px;
}

.palette-panel button {
  align-items: center;
  background: var(--node-color);
  border: 0;
  border-radius: 12px;
  color: #fff;
  display: flex;
  font-weight: 700;
  gap: 9px;
  min-height: 42px;
  padding: 10px 12px;
  text-align: left;
}

.canvas-panel {
  overflow: hidden;
}

.flow-node {
  background: #fff;
  border: 2px solid color-mix(in srgb, var(--node-color), white 35%);
  border-radius: 11px;
  box-shadow: 0 12px 28px rgba(21, 33, 72, 0.14);
  min-width: 230px;
  overflow: visible;
  position: relative;
}

.flow-node-search-hit .flow-node {
  box-shadow: 0 0 0 4px rgba(31, 70, 209, 0.2), 0 12px 28px rgba(21, 33, 72, 0.14);
}

.flow-node-focused .flow-node {
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.26), 0 16px 34px rgba(21, 33, 72, 0.18);
}

.flow-node-edge-target .flow-node {
  box-shadow: 0 0 0 5px rgba(31, 70, 209, 0.3), 0 16px 34px rgba(21, 33, 72, 0.2);
}

.flow-node-edge-target .flow-node::after {
  background: #1f46d1;
  border-radius: 999px;
  color: #fff;
  content: "Destino";
  font-size: 11px;
  font-weight: 900;
  padding: 5px 9px;
  position: absolute;
  right: 10px;
  top: -28px;
}

.flow-screen-fullscreen {
  background: var(--canvas);
  inset: 0;
  min-height: 100vh;
  padding: 18px;
  position: fixed;
  z-index: 50;
}

.flow-screen-fullscreen .flow-layout {
  grid-template-columns: 220px minmax(0, 1fr);
}

.flow-screen-fullscreen .canvas-panel {
  min-height: 0;
}

.start-badge {
  background: #16a34a;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.24);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  left: 10px;
  letter-spacing: 0;
  padding: 4px 8px;
  position: absolute;
  text-transform: uppercase;
  top: -22px;
}

.flow-node header {
  align-items: center;
  background: var(--node-color);
  border-radius: 5px 5px 0 0;
  color: #fff;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
}

.flow-node header span,
.node-tools {
  align-items: center;
  display: flex;
  gap: 8px;
}

.node-tools button {
  align-items: center;
  background: rgba(255, 255, 255, 0.24);
  border: 0;
  border-radius: 5px;
  color: #fff;
  display: inline-flex;
  height: 27px;
  justify-content: center;
  width: 27px;
}

.flow-node p {
  color: #34405b;
  font-size: 13px;
  line-height: 1.45;
  margin: 10px;
  max-width: 270px;
  white-space: pre-line;
}

.flow-node ol {
  display: grid;
  gap: 5px;
  list-style: none;
  margin: 8px;
  overflow: visible;
  padding: 0;
}

.flow-node li {
  background: #f1f4f9;
  border-radius: 4px;
  color: #3d4860;
  font-size: 12px;
  padding: 6px 7px;
}

.node-option-row {
  align-items: center;
  cursor: pointer;
  display: flex;
  min-height: 27px;
  overflow: visible;
  padding-right: 20px;
  position: relative;
}

.node-option-row:hover {
  background: #e7edf9;
}

.node-option-row span:first-child {
  flex: 1;
  overflow: hidden;
  padding-right: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-node .node-connect {
  border: 2px solid #fff;
  box-shadow: 0 8px 18px rgba(21, 33, 72, 0.18);
  opacity: 1;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 12;
}

.flow-node:hover .node-connect {
  opacity: 1;
}

.flow-node .node-connect-in {
  align-items: center;
  background: #aeb6c8;
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 20px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  left: -17px;
  transform: translateY(-50%);
  width: 28px;
}

.flow-node .node-connect-out {
  align-items: center;
  background: var(--node-color);
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 22px;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  right: -17px;
  transform: translateY(-50%) scale(0.92);
  width: 28px;
}

.flow-node .node-option-connect {
  align-items: center;
  background: #2b9aad;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  display: flex;
  font-size: 12px;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  left: auto !important;
  min-width: 18px;
  right: -18px !important;
  top: 50% !important;
  transform: translateY(-50%) scale(1) !important;
  width: 18px;
}

.flow-node .node-option-row .react-flow__handle-right {
  right: -18px !important;
  top: 50% !important;
  transform: translateY(-50%) scale(1) !important;
}

.flow-node .node-return-connect {
  align-items: center;
  background: #4a556f;
  border-radius: 999px;
  bottom: -16px;
  color: #fff;
  display: flex;
  font-size: 13px;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.flow-node:hover .node-connect-out {
  transform: translateY(-50%) scale(1);
}

.flow-node:hover .node-option-connect {
  transform: translateY(-50%) scale(1);
}

.flow-node .node-connect-out span {
  line-height: 1;
  margin-top: -2px;
  pointer-events: none;
}

.flow-node .node-connect-in span,
.flow-node .node-option-connect span,
.flow-node .node-return-connect span {
  line-height: 1;
  margin-top: -2px;
  pointer-events: none;
}

.edge-hitbox {
  cursor: grab;
  pointer-events: stroke;
  stroke: transparent;
  stroke-width: 28;
}

.flow-edge-relinking,
.flow-edge-relinking * {
  cursor: grabbing !important;
}

.flow-edge-relinking .react-flow__node {
  outline: 2px dashed rgba(22, 163, 74, 0.45);
  outline-offset: 4px;
}

.flow-edge-group .react-flow__edge-path {
  stroke-dasharray: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.edge-delete,
.edge-text {
  position: absolute;
  pointer-events: all;
}

.edge-delete {
  align-items: center;
  background: #fff;
  border: 1px solid #ffc0c7;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(20, 35, 80, 0.16);
  color: #c41e3a;
  display: inline-flex;
  height: 27px;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  width: 27px;
}

.edge-delete.visible,
.edge-delete:hover {
  opacity: 1;
}

.edge-text {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #566176;
  font-size: 11px;
  max-width: 160px;
  overflow: hidden;
  padding: 4px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector {
  overflow: auto;
  padding: 16px;
}

.inspector.empty {
  align-content: center;
  color: var(--muted);
  display: grid;
  justify-items: center;
  text-align: center;
}

.inspector.empty strong {
  color: var(--ink);
  margin-top: 12px;
}

.inspector-title {
  align-items: center;
  border-bottom: 3px solid var(--node-color);
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
}

.inspector-title span {
  font-weight: 800;
}

.inspector-title button,
.options-editor button,
.start-node-button {
  background: #eef2f8;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
}

.start-node-button {
  color: #1f2a44;
  font-weight: 800;
  margin-bottom: 14px;
  min-height: 40px;
  width: 100%;
}

.start-node-button.compact {
  margin-bottom: 0;
  min-height: 42px;
  width: auto;
}

.start-node-button.active {
  background: #e9f9ef;
  border-color: #86efac;
  color: #137b37;
}

.options-editor {
  display: grid;
  gap: 10px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(11, 18, 38, 0.42);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 28px;
  position: fixed;
  z-index: 40;
}

.menu-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(12, 21, 48, 0.28);
  color: #34405b;
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 56px);
  overflow: auto;
  padding: 20px;
  width: min(1120px, 96vw);
}

.flow-test-modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(12, 21, 48, 0.28);
  color: #34405b;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 56px);
  padding: 20px;
  width: min(980px, 96vw);
}

.flow-test-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 260px;
  min-height: 460px;
}

.flow-test-chat {
  align-content: start;
  background: #f5f7fb;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  max-height: 54vh;
  overflow: auto;
  padding: 14px;
}

.test-bubble {
  border-radius: 8px;
  display: grid;
  gap: 6px;
  max-width: 82%;
  padding: 11px 13px;
  white-space: pre-wrap;
}

.test-bubble span {
  align-items: center;
  display: flex;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  justify-content: space-between;
  text-transform: uppercase;
}

.test-bubble p {
  line-height: 1.45;
  margin: 0;
}

.test-bubble small {
  color: #64708a;
  font-size: 12px;
}

.test-edit-button {
  align-items: center;
  background: #eef2ff;
  border: 1px solid #cbd5ff;
  border-radius: 999px;
  color: #1f46d1;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  gap: 4px;
  min-height: 26px;
  padding: 4px 8px;
  text-transform: none;
}

.flow-test-save-notice {
  left: 50%;
  position: fixed;
  top: 22px;
  z-index: 60;
}

.test-bubble.user {
  background: #dbe7ff;
  justify-self: end;
}

.test-bubble.bot {
  background: #fff;
  border: 1px solid #d8deec;
  justify-self: start;
}

.test-bubble.system,
.test-bubble.error {
  background: #fff6df;
  border: 1px solid #ffe0a3;
  justify-self: center;
}

.test-bubble.error {
  background: #fff0f2;
  border-color: #ffc8d0;
  color: #a70f2d;
}

.flow-test-state {
  align-content: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.flow-test-state code {
  background: #f3f5fa;
  border-radius: 6px;
  color: #1f2a44;
  display: block;
  padding: 8px;
  white-space: pre-wrap;
}

.flow-test-form {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.flow-test-form input {
  min-height: 44px;
}

.flow-test-form button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
}

.flow-test-form .primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.menu-modal-title,
.menu-modal-footer,
.toggle-row,
.char-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.menu-modal-title div {
  align-items: center;
  color: #8f4fd8;
  display: flex;
  gap: 10px;
  font-size: 24px;
}

.modal-title-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.menu-modal-title button,
.menu-modal-footer button,
.add-option {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 700;
  min-height: 42px;
  padding: 9px 16px;
}

.menu-modal-title .primary-button,
.menu-modal-footer .primary-button {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.add-option {
  align-items: center;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.menu-modal-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.toggle-row small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 7px;
}

.toggle-row input {
  width: auto;
}

.menu-option-list {
  display: grid;
  gap: 14px;
}

.menu-option-card {
  background: #f2f4f8;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.menu-option-card[draggable="true"] {
  cursor: grab;
}

.menu-option-card[draggable="true"]:active {
  cursor: grabbing;
}

.menu-option-card-header {
  align-items: center;
  color: #4c5872;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.menu-option-card-header strong {
  margin-right: auto;
}

.target-picker-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
}

.target-picker-row button:first-child {
  background: #fff;
  border: 1px solid #aeb7cc;
  border-radius: 6px;
  color: #273252;
  cursor: pointer;
  min-height: 42px;
  overflow: hidden;
  padding: 9px 11px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button-soft {
  align-items: center;
  background: #fff4f4;
  border: 1px solid #ffd0d0;
  border-radius: 6px;
  color: #d62342;
  cursor: pointer;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.nested-modal {
  z-index: 80;
}

.target-picker-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(20, 28, 48, 0.24);
  display: grid;
  gap: 14px;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: min(760px, 92vh);
  min-height: 0;
  overflow: hidden;
  padding: 18px;
  width: min(920px, 94vw);
}

.target-search-input {
  border: 1px solid #aeb7cc;
  border-radius: 8px;
  font-size: 15px;
  min-height: 44px;
  padding: 10px 12px;
}

.target-group-list {
  display: grid;
  gap: 14px;
  max-height: calc(92vh - 170px);
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
}

.target-group {
  display: grid;
  gap: 8px;
}

.target-group h3 {
  align-items: center;
  display: flex;
  font-size: 15px;
  gap: 7px;
  margin: 0;
}

.target-card-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.target-card-grid button {
  background: #f8faff;
  border: 1px solid #dfe4f0;
  border-radius: 8px;
  color: #172042;
  cursor: pointer;
  min-height: 84px;
  padding: 10px;
  text-align: left;
}

.target-card-grid button:hover {
  border-color: var(--blue);
  box-shadow: 0 8px 22px rgba(38, 72, 191, 0.12);
}

.target-card-grid strong {
  display: block;
  font-size: 14px;
  margin-bottom: 5px;
}

.target-card-grid span {
  color: #66718c;
  display: block;
  font-size: 12px;
  line-height: 1.35;
}

.drag-option-handle {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #69728b;
  display: inline-flex;
  height: 32px;
  justify-content: center;
  padding: 0;
  width: 32px;
}

.char-row {
  color: #8b93a8;
  font-size: 13px;
}

.delete-option {
  background: #fff;
  border: 1px solid #ff5b6d;
  border-radius: 7px;
  color: #ef2744;
  font-weight: 800;
  min-height: 44px;
}

.menu-modal-footer {
  border-top: 1px solid var(--line);
  gap: 12px;
  justify-content: flex-end;
  padding-top: 14px;
}

.conversation-grid {
  display: grid;
  gap: 12px;
}

.conversation-warning {
  margin-bottom: 12px;
}

.conversation-card {
  align-items: stretch;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  margin-bottom: 0;
}

.conversation-card.human {
  background: #fff8f0;
  border-color: #fed7aa;
}

.conversation-person {
  align-content: start;
  display: grid;
  gap: 6px;
}

.conversation-avatar {
  align-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  border-radius: 14px;
  color: #fff;
  display: inline-flex;
  font-size: 18px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  margin-bottom: 2px;
  width: 42px;
}

.conversation-person strong {
  color: #172042;
  font-size: 16px;
}

.conversation-person small b {
  color: #172042;
}

.conversation-phone {
  background: #f3f7ff;
  border: 1px solid #dbe6ff;
  border-radius: 999px;
  justify-self: start;
  padding: 5px 8px;
}

.conversation-person span {
  background: #e9f8f1;
  border-radius: 999px;
  color: #13764f;
  justify-self: start;
  padding: 7px 10px;
}

.conversation-card.human .conversation-person span {
  background: #fff1d6;
  color: #a45a00;
}

.conversation-main {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.conversation-identity {
  align-items: center;
  background: #f8fbff;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  justify-content: space-between;
  padding: 9px 10px;
}

.conversation-identity strong {
  color: #172042;
}

.conversation-identity span {
  color: var(--muted);
  font-size: 12px;
}

.conversation-main p {
  margin: 0;
}

.conversation-meta,
.context-pills,
.conversation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.conversation-meta span {
  background: #eef2ff;
  border-radius: 999px;
  color: #46506a;
  font-size: 12px;
  padding: 6px 9px;
}

.context-pills code {
  font-size: 12px;
  padding: 6px 8px;
}

.context-pills small {
  color: var(--muted);
}

.conversation-actions {
  align-content: start;
  display: grid;
}

.conversation-actions button {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-weight: 800;
  min-height: 38px;
  padding: 8px 10px;
}

.conversation-actions .primary-button {
  background: linear-gradient(135deg, var(--blue), #2348d7);
  border-color: var(--blue);
  color: #fff;
}

.conversation-confirm {
  background: #fff8e8;
  border: 1px solid #f3d38a;
  border-radius: 13px;
  display: grid;
  gap: 7px;
  padding: 8px;
}

.conversation-confirm strong {
  color: #7b4b00;
  font-size: 12px;
}

.conversation-confirm button:first-of-type {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
}

.empty-conversations {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 220px;
  text-align: center;
}

.empty-conversations strong {
  color: var(--ink);
}

.qr-box {
  align-items: center;
  background: linear-gradient(180deg, #f8fbff, #f3f7ff);
  border: 1px dashed #bfc7da;
  border-radius: 16px;
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 240px;
  text-align: center;
}

.qr-image {
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 210px;
  width: 210px;
}

.qr-box span {
  color: var(--muted);
}

.integration-actions,
.send-test-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.integration-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.integration-tabs button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  min-height: 42px;
  padding: 9px 14px;
}

.integration-tabs button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.hint-text {
  color: var(--muted);
  line-height: 1.5;
}

.knowledge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.knowledge-actions button:not(.primary-button) {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  gap: 7px;
  min-height: 42px;
  padding: 9px 12px;
}

.knowledge-panel {
  align-content: start;
  display: grid;
  gap: 12px;
}

.knowledge-card {
  background: #f7f9fd;
  border: 1px solid #e5eaf4;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 13px;
}

.knowledge-card strong,
.knowledge-card-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.knowledge-card small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.knowledge-card p {
  line-height: 1.45;
  margin: 0;
  max-height: 96px;
  overflow: auto;
  white-space: pre-line;
}

.knowledge-card-actions button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: inline-flex;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
}

.order-result {
  display: grid;
  gap: 10px;
}

.order-result a {
  color: var(--blue);
  font-weight: 800;
}

.integration-actions button:not(.primary-button),
.send-test-form button:not(.primary-button) {
  background: #eef4fb;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 11px;
  min-height: 42px;
}

.send-test-form {
  align-items: end;
  margin-top: 14px;
}

.send-test-form label {
  margin-bottom: 0;
}

.debug-box {
  background: #101828;
  border-radius: 14px;
  color: #d7e1ff;
  font-size: 12px;
  max-height: 180px;
  overflow: auto;
  padding: 12px;
}

.check-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.check-row input {
  min-height: auto;
}

.debug-panel {
  margin-top: 18px;
}

.debug-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .debug-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .shell,
  .login-panel,
  .admin-grid,
  .documentation-layout,
  .flow-layout,
  .smart-dashboard-grid,
  .metric-grid,
  .smart-simulator-grid,
  .smart-simulator-options {
    grid-template-columns: 1fr;
  }

  .smart-simulator-grid label:nth-of-type(9) {
    grid-column: auto;
  }

  .documentation-index {
    position: static;
  }

  .sidebar {
    height: auto;
    min-height: auto;
    position: static;
  }

  .flow-screen {
    height: auto;
  }

  .canvas-panel {
    height: 620px;
  }

  .menu-modal-grid {
    grid-template-columns: 1fr;
  }

  .flow-test-grid,
  .flow-test-form {
    grid-template-columns: 1fr;
  }
}
