:root {
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6f8fb;
  --fg: #0f172a;
  --muted: #5f6b7c;
  --panel: #ffffff;
  --panel-alt: #f0f4ff;
  --border: #e5e9f2;
  --accent: #2563eb;
  --accent-2: #38bdf8;
  --success: #16a34a;
  --danger: #dc2626;
}

.hidden {
  display: none !important;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 10% 10%, rgba(56, 189, 248, 0.18), transparent 25%),
    radial-gradient(circle at 90% 0%, rgba(37, 99, 235, 0.18), transparent 28%),
    linear-gradient(180deg, #f9fbff 0%, #f3f6fb 100%);
  color: var(--fg);
  min-height: 100vh;
}

a {
  color: inherit;
}

body.authed #auth-screen {
  display: none;
}

body.authed #platform-auth-screen {
  display: none;
}

body:not(.authed) .app-shell {
  display: none;
}

body:not(.authed) .platform-shell {
  display: none;
}

.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(120deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.92)),
    url("https://images.unsplash.com/photo-1489515217757-5fd1be406fef?auto=format&fit=crop&w=1400&q=80") center/cover;
  color: white;
  z-index: 1000;
}

.auth-card {
  width: min(420px, 100%);
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(12px);
}

.auth-brand {
  margin-bottom: 1.5rem;
}

.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #ffffff;
  color: #111827;
  padding: 0.85rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.google-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.google-btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.google-btn::before {
  content: "";
  width: 18px;
  height: 18px;
  background: url("https://www.svgrepo.com/show/475656/google-color.svg") center/contain no-repeat;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.auth-divider span {
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.4);
}
.email-login label {
  display: block;
  margin-bottom: 0.8rem;
}
.email-login input {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(15, 23, 42, 0.35);
  color: white;
}
.email-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.6rem 0 0.2rem;
}
.email-actions button {
  flex: 1;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  gap: 1.5rem;
  padding: 1.5rem 1rem 2rem;
}

.content {
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: sticky;
  top: 1.5rem;
  height: fit-content;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand .logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 0.5rem;
}

.nav-link {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.nav-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(56, 189, 248, 0.12));
  border-color: var(--accent);
  color: var(--accent);
}

.page-header {
  background: linear-gradient(120deg, #0b1222, #121b33);
  border: 1px solid #1e293b;
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.2rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
  background-image: radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.12), transparent 38%),
    radial-gradient(circle at 80% 20%, rgba(56, 189, 248, 0.12), transparent 32%);
}

.page-header h1 {
  margin: 0.15rem 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.lead {
  margin: 0.1rem 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  gap: 0.6rem;
}

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

button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  box-shadow: none;
}

.banner {
  border: 1px solid var(--border);
  background: #f8faff;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  font-size: 0.9rem;
}

.banner.success {
  border-color: #16a34a;
  background: #ecfdf3;
  color: #166534;
}

.banner.error {
  border-color: #dc2626;
  background: #fef2f2;
  color: #991b1b;
}

.section {
  display: none;
  flex-direction: column;
  gap: 1.2rem;
}

.section.visible {
  display: flex;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.92rem;
  color: var(--muted);
}

input,
textarea,
select {
  background: #f8faff;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 12px;
  padding: 0.75rem;
}

textarea {
  resize: vertical;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
  display: grid;
  gap: 0.35rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.card span {
  color: var(--muted);
  letter-spacing: 0.06em;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.card strong {
  font-size: 1.8rem;
}

.card .small {
  margin: 0;
}

.grid {
  display: grid;
  gap: 1.2rem;
}

.two-col {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.hero-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.panel header h2 {
  margin: 0;
}

.panel header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.slim {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  max-height: 520px;
  overflow: auto;
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.9rem;
}

.creation-panel {
  gap: 1.2rem;
}

.creation-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem;
  gap: 0.2rem;
  background: #f8fafc;
}

.creation-tab-btn {
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 600;
  color: var(--muted);
}

.creation-tab-btn.active {
  background: #fff;
  color: var(--fg);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.creation-pane.hidden {
  display: none;
}

.template-pane-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 1.2rem;
  align-items: stretch;
}

.template-list-column {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 60vh;
  max-height: calc(100vh - 280px);
}

.template-gallery {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  overflow-y: auto;
  padding-right: 0.5rem;
  flex: 1;
}

.template-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  position: sticky;
  top: 0;
  background: #fff;
  padding-bottom: 0.25rem;
  z-index: 1;
}

.template-list-column .template-toolbar + .template-gallery {
  margin-top: 0.35rem;
}

.template-toolbar input,
.template-toolbar select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.65rem;
  font-size: 0.95rem;
  width: 100%;
}

.template-toolbar select {
  max-width: 220px;
  background: #fff;
}

.template-gallery .template-card {
  height: 100%;
}

.template-detail {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: #fff;
  min-height: 320px;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.template-placeholder {
  text-align: center;
  padding: 2rem 1rem;
}

.template-detail-body.hidden {
  display: none;
}

.template-detail-header {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.template-detail-icon {
  font-size: 1.75rem;
}

.template-detail-section {
  margin-bottom: 0.8rem;
}

.template-detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.template-detail-meta strong {
  font-size: 1rem;
}

.template-capabilities {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--fg);
}

.template-capabilities li {
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.template-purpose-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.template-purpose-examples .chip {
  border-color: var(--border);
  background: #fff;
  cursor: pointer;
}

.template-form button[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 860px) {
  .template-pane-body {
    grid-template-columns: 1fr;
  }

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

  .template-detail {
    position: static;
    max-height: none;
  }

  .template-gallery {
    max-height: none;
    padding-right: 0;
  }
}

.agent-card {
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8faff;
  transition: border-color 0.15s ease, transform 0.15s ease;
  position: relative;
  overflow: hidden;
}

.agent-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.agent-card h3 {
  margin: 0 0 0.25rem;
}

.agent-card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  align-items: center;
}

.agent-card-head .pill {
  justify-self: end;
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
}

.agent-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(56, 189, 248, 0.16));
  font-weight: 800;
  color: var(--accent);
}

.agent-meta,
.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.tools-shell {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.message-workspace {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.message-simple-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
}

.message-module {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.85rem;
}

.message-module-wide {
  grid-column: 1 / -1;
}

.message-module-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.65rem;
}

.message-module-head p {
  margin: 0.2rem 0 0;
}

.message-module-body {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(0, 1.05fr);
  gap: 0.9rem;
  min-height: 0;
}

.message-editor {
  min-width: 0;
}

.message-catalog {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.65rem;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 0.5rem;
}

.message-catalog h4 {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.message-scroll {
  max-height: 440px;
  overflow: auto;
  padding-right: 0.25rem;
}

.message-scroll::-webkit-scrollbar {
  width: 8px;
}

.message-scroll::-webkit-scrollbar-thumb {
  background: #d4deee;
  border-radius: 999px;
}

.automation-hub {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.automation-redirect {
  min-height: auto;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: flex-start;
  background:
    radial-gradient(circle at top right, rgba(14, 116, 144, 0.1), transparent 32%),
    linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
}

.automation-redirect h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.automation-hero {
  min-height: auto;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
  gap: 1rem;
  background:
    radial-gradient(circle at top right, rgba(14, 116, 144, 0.12), transparent 35%),
    linear-gradient(180deg, #fbfdff 0%, #f4f8ff 100%);
}

.automation-hero h2 {
  margin: 0.15rem 0 0.45rem;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.automation-hero__copy {
  max-width: 62ch;
}

.automation-hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.automation-stat-card {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  padding: 0.9rem;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.automation-stat-card span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.automation-stat-card strong {
  font-size: 1.7rem;
  line-height: 1;
}

.automation-stat-card small {
  color: var(--muted);
  line-height: 1.35;
}

.automation-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(0, 1.12fr);
  gap: 1rem;
  align-items: start;
}

.automation-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.automation-panel,
.automation-guide {
  min-height: auto;
}

.automation-panel__head {
  padding-bottom: 0.8rem;
  margin-bottom: 0.95rem;
  border-bottom: 1px solid var(--border);
}

.automation-panel__head strong,
.automation-guide__head strong {
  display: block;
  font-size: 1.05rem;
}

.automation-panel__head p,
.automation-guide__head p {
  margin-top: 0.2rem;
}

.automation-panel__body {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.08fr);
  gap: 0.95rem;
  min-height: 0;
}

.automation-editor {
  min-width: 0;
}

.automation-catalog {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #fcfdff 0%, #f7faff 100%);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.automation-catalog__head h4 {
  margin: 0;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.automation-catalog__head p {
  margin: 0.25rem 0 0;
}

.automation-form-section {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 0.85rem;
  background: #fafcff;
}

.automation-quick-preset {
  border: 1px solid rgba(14, 116, 144, 0.16);
  border-radius: 14px;
  padding: 0.85rem;
  background: linear-gradient(180deg, rgba(240, 249, 255, 0.95) 0%, rgba(248, 252, 255, 0.95) 100%);
}

.automation-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.65rem;
}

.automation-preset-btn {
  justify-content: flex-start;
  text-align: left;
  min-height: 54px;
}

.automation-preset-btn.is-active {
  border-color: rgba(14, 116, 144, 0.4);
  background: rgba(14, 116, 144, 0.1);
  color: #0f4c5c;
}

.automation-form-section + .automation-form-section {
  margin-top: 0.2rem;
}

.automation-form-section__head {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  margin-bottom: 0.7rem;
}

.automation-inline-note {
  margin-top: 0.7rem;
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(14, 116, 144, 0.22);
  background: linear-gradient(180deg, rgba(232, 245, 250, 0.98) 0%, rgba(242, 249, 252, 0.98) 100%);
  color: #0f3f4b;
  line-height: 1.45;
}

.automation-helper-card {
  border: 1px dashed rgba(148, 163, 184, 0.6);
  border-radius: 12px;
  padding: 0.8rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.automation-helper-card span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.automation-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.automation-segmented button {
  flex: 1 1 130px;
  min-height: 46px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 12px;
  background: #ffffff;
  color: #15323a;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.automation-segmented button:hover {
  border-color: rgba(14, 116, 144, 0.5);
  transform: translateY(-1px);
}

.automation-segmented button.is-active {
  border-color: rgba(14, 116, 144, 0.65);
  background: rgba(14, 116, 144, 0.12);
  color: #0f4c5c;
  box-shadow: inset 0 0 0 1px rgba(14, 116, 144, 0.35);
}

.visually-hidden-select {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.automation-summary {
  border: 1px solid rgba(14, 116, 144, 0.3);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: linear-gradient(180deg, rgba(232, 245, 250, 0.98) 0%, rgba(242, 249, 252, 0.98) 100%);
  color: #0f3f4b;
  font-size: 0.9rem;
  line-height: 1.5;
}

.automation-summary:empty {
  display: none;
}

.automation-advanced {
  border: 1px dashed rgba(148, 163, 184, 0.55);
  border-radius: 12px;
  padding: 0.55rem 0.85rem;
  background: #fdfefe;
}

.automation-advanced summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
}

.automation-advanced[open] summary {
  margin-bottom: 0.7rem;
  color: #0f4c5c;
}

.automation-variable-groups {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.automation-variable-group strong {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  color: #0f4c5c;
}

.automation-variable-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.automation-variable-chip {
  border: 1px solid rgba(14, 116, 144, 0.26);
  border-radius: 999px;
  background: #ffffff;
  color: #15323a;
  padding: 0.34rem 0.62rem;
  font-size: 0.78rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.automation-variable-chip--button {
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.automation-variable-chip--button:hover {
  border-color: rgba(14, 116, 144, 0.5);
  background: rgba(214, 238, 246, 0.96);
  color: #0b3f4d;
  transform: translateY(-1px);
}

.automation-variable-chip--button:focus-visible {
  outline: 2px solid rgba(14, 116, 144, 0.55);
  outline-offset: 2px;
}

.automation-guide {
  background:
    linear-gradient(180deg, #f9fcff 0%, #f4f8ff 100%);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.automation-steps {
  margin: 0;
  padding-left: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  color: var(--text);
}

.automation-steps li {
  line-height: 1.45;
}

.automation-note {
  border: 1px solid rgba(14, 116, 144, 0.18);
  background: rgba(14, 116, 144, 0.06);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.automation-note strong {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f4c5c;
}

.platform-row-selectable {
  cursor: pointer;
}

.platform-row-selectable:hover td {
  background: #f3f7ff;
}

.platform-row-selectable.is-selected td {
  background: rgba(37, 99, 235, 0.1);
}

.platform-json-view {
  margin: 0;
  min-height: 220px;
  max-height: 520px;
  overflow: auto;
  padding: 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f172a;
  color: #dbeafe;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.platform-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}

.platform-subhead {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
}

@media (max-width: 1600px) {
  .message-workspace {
    grid-template-columns: 1fr;
  }
  .message-simple-grid {
    grid-template-columns: 1fr;
  }
  .message-module-wide {
    grid-column: auto;
  }
  .automation-layout,
  .automation-hero,
  .automation-panel__body {
    grid-template-columns: 1fr;
  }
  .automation-hero__stats {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
  .message-scroll {
    max-height: 320px;
  }
}

@media (max-width: 920px) {
  .message-module-body {
    grid-template-columns: 1fr;
  }
  .message-scroll {
    max-height: 360px;
  }
  .automation-hero__stats {
    grid-template-columns: 1fr;
  }
}

.integration-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.integration-form-panel,
.integration-list-panel {
  width: 100%;
}

.integration-request-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fbfdff;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.integration-advanced-block {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  background: rgba(148, 163, 184, 0.05);
}

.integration-advanced-block > summary {
  cursor: pointer;
  font-weight: 600;
}

.integration-advanced-content {
  margin-top: 0.55rem;
}

.tools-panel {
  min-height: 0;
}

.tools-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tools-tab {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.tools-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
}

.tools-panel-view {
  display: none;
}

.tools-panel-view.active {
  display: block;
}

.tool-library {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  overflow-x: hidden;
}

.tool-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tool-group__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.empty-state-card {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 1rem;
  background: rgba(148, 163, 184, 0.08);
}

.tool-card {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
  min-width: 0;
}

.tool-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.tool-card h3 {
  margin: 0 0 0.25rem;
}

.tool-card__head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  min-width: 0;
}

.tool-card__head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.tool-card__meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.integration-card-details {
  margin-top: 0.65rem;
  border-top: 1px dashed var(--border);
  padding-top: 0.6rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.45rem 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.integration-card-details code {
  white-space: pre-wrap;
  word-break: break-word;
}

.tool-card__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.7rem;
  flex-wrap: wrap;
}

.tool-card__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
  min-width: 0;
}

.tool-card__fact {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  background: #f9fbff;
  min-width: 0;
}

.tool-card__fact span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.22rem;
}

.tool-card__fact strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tool-card h3,
.tool-card p,
.tool-card small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tool-tag {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  background: #f8faff;
  color: var(--muted);
  white-space: nowrap;
}

.tool-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.tool-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.tool-choice:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.tool-choice input {
  margin-top: 0.3rem;
}

.tool-choice__body {
  display: grid;
  gap: 0.35rem;
}

.tool-choice__title {
  font-weight: 600;
}

.tool-choice__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.tool-choice__desc {
  color: var(--muted);
  font-size: 0.85rem;
}

.rules-cheatsheet {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.rules-extra {
  margin-top: 0.75rem;
}

.rules-cheatsheet h4 {
  margin: 0.5rem 0 0.35rem;
  font-size: 0.95rem;
}

.rules-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rules-notebooks {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rules-notebooks li {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
}

.agent-actions {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.agent-actions .small {
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
}

.agent-actions .danger {
  background: #fee2e2;
  color: #991b1b;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8faff;
  font-size: 0.85rem;
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}

.chip input {
  width: auto;
  accent-color: var(--accent);
}

.chips.selectable {
  display: flex;
  flex-direction: column;
}

.agent-drawer__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.75rem 0.85rem 0.95rem;
  border: 1px solid #e4e9f4;
  border-radius: 14px;
  background: linear-gradient(150deg, #f8fbff 0%, #ffffff 60%, #f2f7ff 100%);
  margin-bottom: 1rem;
  position: sticky;
  top: 0;
  z-index: 6;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.agent-drawer__title {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.agent-drawer__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  max-width: 100%;
}

.agent-chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.2rem 0.75rem;
  background: #f8faff;
  color: var(--muted);
}

.agent-drawer__actions .icon {
  margin-right: 0.35rem;
}

.agent-drawer__actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.agent-drawer__actions button {
  white-space: nowrap;
  border-radius: 999px;
  font-weight: 600;
}

.agent-tab-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
  overflow-x: auto;
  padding: 0.35rem 0.25rem 0.35rem;
  border: 1px solid #e8edf7;
  border-radius: 12px;
  background: #fbfdff;
  scrollbar-width: thin;
}

.agent-tab-btn {
  background: #ffffff;
  border: 1px solid #dce6f5;
  color: var(--fg);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  flex: 0 0 auto;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.agent-tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
}

.agent-tab-btn:hover {
  border-color: #b8c8e6;
  transform: translateY(-1px);
}

.agent-config-ribbon {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.agent-config-health,
.agent-tab-context {
  border: 1px solid #dde7f6;
  border-radius: 12px;
  background: #f9fbff;
  padding: 0.75rem 0.85rem;
}

.agent-config-health {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.agent-config-health__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.agent-config-health__track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8eef9;
  overflow: hidden;
}

.agent-config-health__track span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb 0%, #0ea5e9 100%);
  transition: width 0.25s ease;
}

.agent-tab-context {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.agent-drawer {
  overflow-y: auto;
}

.agent-drawer p,
.agent-drawer strong,
.agent-drawer span,
.agent-drawer label,
.agent-drawer .muted,
.agent-drawer .agent-chip {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.agent-drawer input,
.agent-drawer select,
.agent-drawer textarea {
  width: 100%;
  min-width: 0;
}

.agent-tab-panels {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  overflow-y: auto;
  padding-right: 0.4rem;
  min-height: 0;
}

.agent-tab-pane {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.agent-tab-pane.hidden {
  display: none;
}

.collection-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.collection-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.collection-field-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.collection-field-row .field-row-top {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 0.8fr);
  gap: 0.75rem;
}

.collection-field-row .field-row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rule-toggle-grid {
  display: grid;
  gap: 0.85rem;
}

.rule-toggle-card {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.85rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rule-toggle-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.rule-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rule-toggle-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.switch input {
  display: none;
}

.switch-track {
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: #e2e8f0;
  position: relative;
  transition: background 0.2s ease;
}

.switch-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(20px);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.75rem;
}

.choice-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: pointer;
}

.choice-card input {
  margin-right: 0.35rem;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.choice-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.automation-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.automation-detail {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.automation-detail.hidden {
  display: none;
}

@media (max-width: 720px) {
  .collection-field-row .field-row-top {
    grid-template-columns: 1fr;
  }
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

fieldset.panel-lite {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px;
  min-height: 0;
  background: #f8fafc;
}

fieldset.panel-lite legend {
  padding: 0 6px;
}

.panel-lite.collapsible {
  min-height: 0;
}

details.collapsible {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  background: #ffffff;
  margin: 0.5rem 0;
}

details.collapsible > summary {
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

details.collapsible > summary::after {
  content: "+";
  font-weight: 600;
  color: var(--muted);
}

details.collapsible[open] > summary::after {
  content: "-";
}

details.collapsible > summary::-webkit-details-marker {
  display: none;
}

details.collapsible[open] > summary {
  margin-bottom: 0.6rem;
}

.divider-line {
  height: 1px;
  background: var(--border);
  width: 100%;
}

.prompt-preview-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #f8fafc;
}

.note-card {
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px;
  background: var(--panel);
}

.note-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.note-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.form-grid.two-col {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.banner {
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: #f8faff;
  border: 1px solid var(--border);
}

.prompt-editor {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prompt-editor__columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.prompt-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.prompt-block textarea {
  min-height: 160px;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

.prompt-block.secondary {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #f8faff;
}

.prompt-block__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.agent-pane-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.rules-groups {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.rules-helper {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  background: #f7fafc;
  margin-bottom: 0.8rem;
}

.rules-helper ul {
  margin: 0.4rem 0 0.6rem;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.rules-helper li {
  margin-bottom: 0.25rem;
}

.rule-quick-templates {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.rule-quick-templates button {
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.25rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.rule-quick-templates button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.rule-tool-fields.hidden {
  display: none;
}

.rule-tool-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rule-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: #fff;
}

.rule-group h4 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.rule-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.6rem;
  background: #f8faff;
}

.rule-card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

.rule-card__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.rule-card__actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.rule-card__actions button {
  font-size: 0.82rem;
  padding: 0.35rem 0.6rem;
}

@media (max-width: 1200px) {
  .agent-drawer__actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) {
  .agent-config-ribbon {
    grid-template-columns: 1fr;
  }
}

.agent-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.7rem;
}

.agent-summary-grid article {
  border: 1px solid #dbe4f1;
  border-radius: 12px;
  padding: 0.65rem 0.8rem;
  background: #f8fbff;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02);
}

.agent-summary-grid article strong {
  display: block;
  margin-top: 0.15rem;
  line-height: 1.35;
}

.prompt-preview {
  min-height: 140px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 0.85rem;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.agent-preview-panel {
  position: relative;
}

.preview-console {
  background:
    linear-gradient(180deg, rgba(37, 99, 235, 0.06), transparent 220px),
    var(--panel);
  overflow: hidden;
}

.preview-console-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.preview-console-header strong {
  display: block;
  font-size: 1.15rem;
}

.preview-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 52%;
  padding: 0.42rem 0.7rem;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: #1e3a8a;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: right;
}

.preview-status-pill::before {
  content: "";
  width: 0.48rem;
  height: 0.48rem;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #94a3b8;
}

.preview-status-pill.success::before {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.preview-console-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(220px, 0.8fr);
  gap: 0.85rem;
  align-items: stretch;
  margin-bottom: 0.95rem;
}

.preview-permissions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.preview-permissions legend {
  grid-column: 1 / -1;
  margin-bottom: -0.25rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.preview-permission-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 118px;
  padding: 0.78rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.preview-permission-card strong {
  display: block;
  font-size: 0.92rem;
  color: var(--fg);
}

.preview-permission-card small {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.segmented-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  align-items: center;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafc;
}

.segmented-inline label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  min-width: 58px;
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

.segmented-inline label:has(input:checked) {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.segmented-inline input {
  margin: 0;
  accent-color: currentColor;
}

.preview-control-deck {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.78rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.86);
}

.preview-side-note {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.preview-controls,
.preview-input {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.preview-controls button {
  flex: 1;
}

.preview-transcript-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0.4rem 0 0.55rem;
}

.preview-transcript-head strong,
.preview-transcript-head span {
  display: block;
}

.preview-transcript-head span {
  color: var(--muted);
  font-size: 0.78rem;
}

.preview-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.preview-legend span {
  padding: 0.22rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.preview-input input {
  flex: 1;
}

.preview-composer {
  margin-top: 0.7rem;
  margin-bottom: 0;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.06);
}

.preview-composer input {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.preview-log {
  min-height: 260px;
  max-height: 380px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  padding: 0.85rem;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.02), rgba(15, 23, 42, 0.04)),
    #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.preview-log > div {
  max-width: 92%;
  margin: 0.45rem 0;
  padding: 0.58rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--fg);
  line-height: 1.45;
}

.preview-log > div strong {
  display: block;
  margin-bottom: 0.18rem;
  color: #334155;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.preview-line-you {
  margin-left: auto !important;
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
}

.preview-line-agent,
.preview-line-system {
  background: #f8fafc;
}

.preview-event {
  margin-top: 0.35rem;
  padding: 0.58rem 0.7rem;
  border-radius: 12px;
}

.preview-event-tools {
  background: #ecfeff;
  border: 1px solid #a5f3fc;
}

.preview-event-rules {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.preview-event-capture {
  background: #ecfdf5;
  border: 1px solid #bbf7d0;
}

.channel-inbox-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.channel-inbox-actions select {
  min-width: 210px;
}

.channel-inbox-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
  gap: 0.9rem;
  min-height: 560px;
}

.channel-inbox-list,
.channel-interaction-detail {
  min-height: 520px;
  max-height: 68vh;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 14px;
  background: #f8fafc;
}

.channel-inbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem;
}

.channel-inbox-item {
  width: 100%;
  display: grid;
  gap: 0.38rem;
  text-align: left;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 12px;
  padding: 0.72rem;
  background: #ffffff;
  color: var(--fg);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.channel-inbox-item:hover,
.channel-inbox-item.active {
  border-color: #93c5fd;
  background: #f8fbff;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.1);
}

.channel-inbox-topline,
.channel-message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.channel-time,
.channel-meta-line,
.channel-summary {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.channel-summary {
  color: #475569;
}

.channel-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.16rem 0.48rem;
  background: #ffffff;
  color: #334155;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.channel-badge-web_widget {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.channel-badge-web_widget_voice {
  background: #ecfeff;
  border-color: #a5f3fc;
  color: #0e7490;
}

.channel-badge-web_widget_call {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.channel-badge-facebook {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #3730a3;
}

.channel-badge-instagram {
  background: #fdf2f8;
  border-color: #fbcfe8;
  color: #be185d;
}

.channel-interaction-detail {
  padding: 0;
  background: #ffffff;
}

.channel-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

.channel-detail-head h3 {
  margin: 0.4rem 0 0.18rem;
}

.channel-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 0.55rem;
}

.channel-detail-stats span {
  display: grid;
  gap: 0.18rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 10px;
  background: #ffffff;
}

.channel-detail-stats strong {
  font-size: 0.78rem;
}

.channel-detail-stats small {
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.channel-detail-summary {
  margin: 1rem;
  padding: 0.85rem;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
}

.channel-detail-summary span {
  display: block;
  margin-bottom: 0.35rem;
  color: #1d4ed8;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.channel-detail-summary p {
  margin: 0;
  color: #334155;
  line-height: 1.55;
}

.channel-transcript {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0 1rem 1rem;
}

.channel-message {
  max-width: 78%;
  padding: 0.72rem 0.82rem;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 12px;
  background: #f8fafc;
}

.channel-message.user {
  align-self: flex-end;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.channel-message.agent {
  align-self: flex-start;
  background: #ffffff;
}

.channel-message.system {
  max-width: 100%;
  align-self: center;
  background: #f1f5f9;
}

.channel-message p {
  margin: 0.35rem 0 0;
  color: #1f2937;
  line-height: 1.55;
  white-space: pre-wrap;
}

.channel-message-meta strong,
.channel-message-meta span {
  color: var(--muted);
  font-size: 0.72rem;
}

.channel-empty-state,
.channel-inbox-empty,
.channel-inbox-loading,
.channel-detail-loading {
  display: grid;
  place-items: center;
  gap: 0.45rem;
  min-height: 180px;
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

.channel-empty-state strong {
  color: var(--fg);
}

.channel-empty-state.compact {
  min-height: 120px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  border-radius: 12px;
}

@media (max-width: 860px) {
  .preview-console-header,
  .preview-transcript-head {
    flex-direction: column;
    align-items: stretch;
  }
  .preview-status-pill {
    max-width: 100%;
    justify-content: flex-start;
    text-align: left;
  }
  .preview-console-grid,
  .preview-permissions {
    grid-template-columns: 1fr;
  }
  .channel-inbox-shell,
  .channel-detail-head,
  .channel-detail-stats {
    grid-template-columns: 1fr;
  }
  .channel-inbox-list,
  .channel-interaction-detail {
    max-height: none;
  }
  .channel-message {
    max-width: 92%;
  }
}

.stacked-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

.stacked-form input,
.stacked-form textarea,
.stacked-form select {
  margin-bottom: 0;
}

.stacked-form .form-grid {
  gap: 0.9rem;
}

.agent-tab-pane .panel-lite {
  padding: 0.95rem 1rem;
}

.section-subheader {
  margin-bottom: 0.6rem;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.test-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
}

.test-status-badge.neutral {
  color: var(--muted);
  background: #f8faff;
}

.test-status-badge.success {
  color: #166534;
  background: #ecfdf3;
  border-color: #86efac;
}

.test-status-badge.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.full-width {
  width: 100%;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.calendar-grid-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  margin-top: 0.4rem;
}

.calendar-slot-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}

.slot-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.65rem 0.7rem;
  background: #f8fbff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 0.3rem;
}

.slot-card.free {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.slot-card.busy {
  border-color: #fecaca;
  background: #fff1f2;
}

.slot-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.slot-status {
  font-size: 0.72rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}

.slot-time {
  margin: 0;
  font-weight: 600;
  color: #0f172a;
}

.slot-meta {
  margin: 0;
  font-size: 0.83rem;
  color: var(--muted);
}

.notes-table-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.notes-table {
  border: 1px solid var(--border);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.08);
}

.notes-table thead th {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.02));
  color: #1f2a44;
  font-weight: 600;
}

.notes-table tbody tr:nth-child(even) {
  background: #f8fbff;
}

.note-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.note-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #dbe4f8;
  background: #eef3ff;
  font-size: 0.78rem;
  color: #1e2a44;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-chip-label {
  font-weight: 600;
}

.note-cell {
  display: inline-block;
  max-width: min(560px, 65vw);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.note-value {
  display: inline-block;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border-radius: 12px;
  overflow: hidden;
}

.table-wide th,
.table-wide td {
  min-width: 110px;
}
.table-wide {
  width: 100%;
  table-layout: auto;
  min-width: 100%;
}

th,
td {
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f0f4ff;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.selected-row {
  background: #e8f0ff;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.pill-in-progress {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.pill-completed {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.pill-success {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.pill-failed,
.pill-busy {
  background: #fef2f2;
  border-color: #fecdd3;
  color: #991b1b;
}

.scroll {
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: #f8faff;
}

.recordings {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.6rem;
}

.recording-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: #fff;
  display: grid;
  gap: 0.3rem;
}

.transcript-line {
  padding: 0.5rem 0.6rem;
  border-radius: 12px;
  margin-bottom: 0.5rem;
}

.bubble-user {
  background: #e0f2fe;
  color: #0f172a;
}

.bubble-assistant {
  background: #ede9fe;
  color: #312e81;
}

.bubble-system {
  background: #eef2f7;
  color: #1f2937;
  border: 1px solid #d9e2ee;
}

.bubble-meta {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.bubble-text {
  line-height: 1.4;
}

.call-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
  align-items: start;
}

.call-detail-grid .panel-lite {
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  padding: 1.1rem;
}

.hero-panel h2,
.panel h2 {
  letter-spacing: -0.01em;
}

.panel header p {
  color: #5b6477;
}

.summary-text {
  font-size: 1rem;
  line-height: 1.6;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 0.8rem;
}

.insight-card {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #f8fbff, #ffffff);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  display: grid;
  gap: 0.35rem;
}

.insight-card strong {
  display: block;
  font-size: 1.45rem;
  letter-spacing: -0.01em;
}

.call-meta {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(135deg, #0f172a, #0b1222);
  color: #e2e8f0;
  padding: 1rem;
  display: grid;
  gap: 0.75rem;
}

.call-meta div {
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
}

.call-summary-chip {
  grid-column: span 2;
  padding: 0.9rem;
  background: linear-gradient(120deg, #eef3ff, #ffffff);
  border: 1px solid #dce5f5;
  border-radius: 12px;
}

.call-summary-chip p {
  margin: 0.35rem 0 0;
  color: #0f172a;
}

.recording-item {
  background: #f8fbff;
  border: 1px solid #d6e4ff;
  padding: 0.8rem;
  border-radius: 12px;
}

.transcript-line {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.45rem;
}

.transcript-line .bubble-meta {
  font-size: 0.75rem;
}

table td .ghost.small {
  padding: 0.3rem 0.55rem;
}

.live-panel {
  position: sticky;
  top: 1rem;
  background: #ffffff;
  border: 1px solid #dce5f5;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 20px 45px rgba(31, 41, 55, 0.12);
  margin-bottom: 1rem;
}

.live-panel.hidden {
  display: none;
}

.live-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.live-panel-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.2rem;
}

.live-call-card {
  border: 1px solid #dce5f5;
  background: #f8fbff;
  padding: 0.75rem;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.live-call-card.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px #2563eb33;
}

.live-transcript {
  border: 1px solid #dce5f5;
  border-radius: 10px;
  padding: 0.75rem;
  background: #ffffff;
  min-height: 200px;
  max-height: 300px;
  overflow: auto;
}

.summary-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #eef3ff, #ffffff);
  color: #0f172a;
  border: 1px solid #dce5f5;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.08);
}

.summary-text {
  margin-top: 0.35rem;
  line-height: 1.5;
}

.summary-grid {
  display: grid;
  gap: 0.65rem;
}

.summary-copy {
  font-size: 1rem;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.summary-fields {
  margin-top: 0.8rem;
}

.call-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.call-field {
  border: 1px solid #dce5f5;
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pill-muted {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

.pill-positive {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.pill-negative {
  background: #fef2f2;
  border-color: #fecdd3;
  color: #991b1b;
}

.pill-neutral {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

.pill-info {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #1e3a8a;
}

.insights-row {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  align-items: center;
}

.insight-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.6rem;
}

.insight-chip {
  border: 1px solid var(--border);
  background: #f8faff;
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.insight-chip strong {
  font-size: 1.05rem;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.insight-card {
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #f8fbff, #ffffff);
  border-radius: 12px;
  padding: 0.9rem;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.insight-card strong {
  display: block;
  font-size: 1.4rem;
  margin-top: 0.3rem;
}

.panel-lite canvas {
  width: 100%;
}

.panel-lite {
  background: #ffffff;
  border: 1px solid #dce5f5;
  border-radius: 12px;
  padding: 0.9rem;
  min-height: 240px;
}

table {
  background: #ffffff;
}

.table-wrap {
  max-height: 70vh;
  overflow-x: auto;
  overflow-y: auto;
  border-radius: 12px;
}

.detail-stack {
  display: block;
}

@media (max-width: 1024px) {
  .detail-stack {
    display: block;
  }
}

.table-panel {
  display: flex;
  flex-direction: column;
}
.table-panel .table-wrap {
  flex: 1;
}

.detail-panel {
  position: static;
  top: auto;
  align-self: stretch;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 999;
}
.drawer-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(760px, 98vw);
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid var(--border);
  box-shadow: -14px 0 38px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.8rem;
}
.detail-drawer.open {
  transform: translateX(0);
}
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}
.drawer-header h3 {
  margin: 0.15rem 0 0;
  color: var(--fg);
}
.drawer-body {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0 0.2rem;
}
.tab-btn {
  background: #f8faff;
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font-weight: 600;
}
.tab-btn.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}
.tab-content.hidden {
  display: none;
}
.drawer-body .panel-lite,
.drawer-body .summary-card,
.drawer-body .call-meta {
  background: #ffffff;
  border-color: #e5e9f2;
  color: var(--fg);
}
.drawer-body .muted {
  color: var(--muted);
}
.drawer-body {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.env-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.6rem;
}

.env-actions {
  display: flex;
  gap: 0.6rem;
}

.env-section-title {
  grid-column: 1 / -1;
  margin-top: 0.75rem;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

.integration-list {
  display: grid;
  gap: 0.75rem;
  margin: 1rem 0;
}

.integration-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.integration-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.integration-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.integration-actions button {
  flex: 0 0 auto;
}

.integration-helper {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  background: rgba(148, 163, 184, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.integration-params-builder {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--panel);
}

.param-help-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  background: rgba(148, 163, 184, 0.06);
}

.help-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: help;
  background: #fff;
}

.default-tool-metadata-section {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.85rem;
  background: rgba(148, 163, 184, 0.06);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.default-tool-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.65rem;
}

.default-tool-meta-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.default-tool-meta-card .muted {
  margin-top: -0.2rem;
}

.default-tool-meta-card label {
  margin: 0;
}

.integration-param-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.integration-param-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1fr 1.4fr auto;
  gap: 0.5rem;
  align-items: end;
}

.integration-param-row label {
  margin: 0;
}

.integration-param-row .param-required {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.integration-param-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
}

.integration-param-details {
  grid-column: 1 / -1;
  border-top: 1px dashed var(--border);
  padding-top: 0.35rem;
}

.integration-param-details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.integration-param-details-grid {
  margin-top: 0.45rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.integration-param-hint {
  grid-column: 1 / -1;
}

@media (max-width: 1000px) {
  .integration-param-row {
    grid-template-columns: 1fr;
  }

  .integration-param-details-grid {
    grid-template-columns: 1fr;
  }
}

.twilio-platform {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.grid.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

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

.muted.error {
  color: var(--danger);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.template-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  padding: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  min-height: 170px;
}

.template-card.active {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.18);
  transform: translateY(-2px);
}

.template-card__icon {
  font-size: 1.4rem;
}

.template-card__top {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  width: 100%;
}

.template-card__category {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  color: var(--muted);
}

.template-card__name {
  margin: 0.15rem 0 0.35rem;
  font-size: 1rem;
  color: var(--fg);
  line-height: 1.25;
}

.settings-shell {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.settings-menu {
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  height: fit-content;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.settings-link {
  width: 100%;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  text-align: left;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-link.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(56, 189, 248, 0.12));
  border-color: var(--accent);
  color: var(--accent);
}

.settings-panels {
  flex: 1;
}

.settings-pane.hidden {
  display: none;
}

.panel-stack {
  display: grid;
  gap: 1.2rem;
}

.profile-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--panel-alt);
}

.profile-summary strong {
  font-size: 1rem;
}

.org-switcher {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  background: var(--panel);
}

.org-switcher select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

.org-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.calendar-list-modern {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.calendar-list-modern .integration-card {
  border-radius: 16px;
  border-color: #dbe4f3;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.calendar-builder {
  border: 1px solid #dbe4f3;
  border-radius: 16px;
  padding: 1rem;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.calendar-hours-card,
.calendar-google-card {
  border: 1px solid #dbe4f3;
  border-radius: 14px;
  background: #f8fbff;
}

.calendar-offdates-card,
.calendar-preview-card {
  border: 1px solid #dbe4f3;
  border-radius: 14px;
  background: #f8fbff;
}

.form-grid.three-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}

.availability-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
}

.availability-card {
  border: 1px solid #d6e1f2;
  border-radius: 12px;
  padding: 0.6rem;
  background: #fff;
}

.availability-card header {
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
  color: #1f2937;
}

.availability-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.calendar-day-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.45rem;
}

.calendar-day-grid .checkbox {
  justify-content: center;
  border: 1px solid #d6e1f2;
  border-radius: 10px;
  padding: 0.35rem 0.4rem;
  background: #fff;
}

@media (max-width: 720px) {
  .calendar-day-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Voice configuration cards */
.voice-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
.voice-card {
  border: 1px solid var(--border, rgba(120, 130, 150, 0.35));
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.voice-card:hover {
  border-color: var(--accent, #4f7cff);
}
.voice-card--selected {
  border-color: var(--accent, #4f7cff);
  background: rgba(79, 124, 255, 0.08);
  box-shadow: 0 0 0 1px var(--accent, #4f7cff) inset;
}
.voice-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.voice-card__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.voice-card__actions button {
  min-width: 30px;
}
.voice-card p {
  margin: 6px 0 0;
}
