:root {
  --ink: #0b1220;
  --muted: #6b7280;
  --surface: #ffffff;
  --accent: #0ea5e9;
  --accent-dark: #0284c7;
  --bg: radial-gradient(circle at top, #e2e8f0, #f8fafc);
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.15);
  --radius: 18px;
  --font: "Space Grotesk", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand {
  display: block;
  font-size: 20px;
  font-weight: 600;
  width: min(180px, 100%);
  height: 58px;
  overflow: hidden;
  border-radius: 8px;
  background: #ffffff url("/assets/images/logo.png") center / calc(100% - 18px) auto no-repeat;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.18);
  color: transparent;
  text-indent: -999px;
  white-space: nowrap;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav a {
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.08);
}

.nav a.active {
  background: rgba(14, 165, 233, 0.25);
  color: #fff;
}

.content {
  padding: 40px clamp(24px, 4vw, 60px);
  min-width: 0;
}

.inbox-content {
  display: flex;
  height: 100vh;
  overflow: hidden;
  padding: 10px clamp(14px, 1.6vw, 24px);
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  min-width: 0;
}

.conversation-card {
  position: relative;
}

.inbox-page-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 10px;
  position: relative;
}

.inbox-page-card > h1 {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
}

.inbox-page-card > .alert {
  flex: 0 0 auto;
}

.inbox-page-card > .meta {
  display: none;
}

.inbox-page-card > .tabs {
  display: none;
}

.inbox-success-alert {
  margin: 0 0 10px;
}

.grid {
  display: grid;
  gap: 20px;
}

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

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

.form {
  display: grid;
  gap: 16px;
}

.form label {
  font-size: 13px;
  color: var(--muted);
}

.form input,
.form textarea,
.form select {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  font-family: var(--font);
}

.form input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  padding: 0;
}

.textarea-lg {
  min-height: 160px;
}

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

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.help-text {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.copy-field {
  display: flex;
  gap: 8px;
  align-items: center;
}

.copy-field input {
  flex: 1;
  min-width: 0;
}

.copy-field .password-field {
  flex: 1;
}

.password-field {
  position: relative;
  width: 100%;
}

.password-field input {
  padding-right: 72px;
}

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  min-width: 50px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.password-toggle-btn:hover,
.password-toggle-btn[aria-pressed="true"] {
  border-color: rgba(14, 165, 233, 0.48);
  background: #e0f2fe;
  color: #0369a1;
}

.btn {
  padding: 12px 18px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.btn.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.btn.secondary {
  background: #0f172a;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid #e2e8f0;
}

.btn.ghost:hover {
  background: #f8fafc;
}

.btn.danger {
  background: #dc2626;
}

.btn.danger:hover {
  background: #b91c1c;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 40px 16px;
}

.auth-card {
  width: min(420px, 92vw);
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-header {
  margin-bottom: 24px;
}

.auth-logo {
  display: block;
  width: min(220px, 82%);
  height: auto;
  margin: 0 0 18px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.inbox-filters {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.inbox-filters label {
  display: grid;
  gap: 6px;
}

.inbox-search-field {
  grid-column: 1 / -1;
}

.search-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input-row input[type="search"] {
  flex: 1;
}

.inbox-scroll-status {
  padding: 12px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
}

.inbox-shell {
  display: grid;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #ffffff;
}

.conversation-list-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border-right: 1px solid #dbe3ef;
  background: #ffffff;
}

.conversation-list-pane .form {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 10px;
  border-bottom: 1px solid #eef2f7;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 2;
}

.conversation-list-pane .inbox-filters {
  gap: 6px;
  grid-template-columns: 1fr 1fr;
}

.conversation-list-pane .inbox-filters label span {
  font-size: 12px;
}

.conversation-list-pane .search-input-row {
  gap: 5px;
}

.conversation-list-pane .form input,
.conversation-list-pane .form select {
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 13px;
}

.conversation-list-pane .icon-btn {
  width: 30px;
  height: 30px;
}

.conversation-list-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

.chat-list {
  display: grid;
}

.chat-list-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  min-height: 68px;
  padding: 10px 14px;
  border-bottom: 1px solid #eef2f7;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background 140ms ease;
}

.chat-list-item > * {
  position: relative;
  z-index: 1;
}

.chat-list-item:hover {
  background: #f8fafc;
}

.chat-list-item.row-selected {
  background: #eaf3ff;
}

.chat-list-item.row-unread {
  box-shadow: inset 3px 0 0 #2563eb;
}

.chat-list-item.row-unread .chat-title,
.chat-list-item.row-unread .chat-list-preview {
  color: #0f172a;
  font-weight: 700;
}

.chat-list-item.row-unread .chat-time::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 999px;
  background: #2563eb;
  vertical-align: 1px;
}

.chat-list-item.row-new-message::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.28), rgba(14, 165, 233, 0.2), rgba(219, 234, 254, 0.46)),
    radial-gradient(circle at 18px 50%, rgba(37, 99, 235, 0.34), transparent 46%);
  opacity: 0;
  animation: inbox-row-new-message 2.6s ease-out;
}

.chat-list-item.row-new-message {
  animation: inbox-row-subtle-lift 2.6s ease-out;
}

.chat-list-item.row-new-message .chat-avatar {
  animation: inbox-avatar-new-message 2.6s ease-out;
}

.chat-list-item.row-new-message .chat-time::before {
  animation: inbox-unread-dot-new-message 2.6s ease-out;
}

.chat-avatar {
  align-items: center;
  align-self: center;
  background: linear-gradient(135deg, #0f766e, #2563eb);
  border-radius: 999px;
  color: #ffffff;
  display: inline-flex;
  font-size: 16px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  overflow: hidden;
  text-transform: uppercase;
  width: 42px;
}

.chat-list-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.chat-list-topline {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.chat-title,
.chat-list-preview span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title {
  color: #0f172a;
  display: block;
  font-size: 14px;
}

.chat-time {
  color: #64748b;
  flex: 0 0 auto;
  font-size: 12px;
  white-space: nowrap;
}

.chat-list-preview {
  align-items: center;
  color: #64748b;
  display: flex;
  font-size: 13px;
  gap: 8px;
  min-width: 0;
}

.chat-row-actions {
  align-items: center;
  display: flex;
  gap: 6px;
  grid-column: 2;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.chat-list-item:hover .chat-row-actions,
.chat-list-item:focus-within .chat-row-actions {
  opacity: 1;
  pointer-events: auto;
}

.conversation-detail-pane {
  display: flex;
  min-height: 0;
  min-width: 0;
  background: #ffffff;
  isolation: isolate;
  overflow: hidden;
  position: relative;
  transition: box-shadow 220ms ease;
}

.conversation-detail-pane.ai-ambient-active {
  --ai-edge-radius: 0;
  box-shadow:
    inset 0 0 0 1px rgba(245, 158, 11, 0.22),
    inset 0 0 28px rgba(251, 191, 36, 0.075);
}

.conversation-frame {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: #ffffff;
}

.mobile-conversation-header {
  display: none;
}

.conversation-card.ai-ambient-active {
  --ai-edge-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(245, 158, 11, 0.18),
    0 18px 50px rgba(251, 191, 36, 0.08),
    var(--shadow);
}

.conversation-detail-pane.ai-ambient-active::before,
.conversation-detail-pane.ai-ambient-active::after,
.conversation-card.ai-ambient-active::before,
.conversation-card.ai-ambient-active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--ai-edge-radius, 10px);
  pointer-events: none;
}

.conversation-detail-pane.ai-ambient-active::before,
.conversation-card.ai-ambient-active::before {
  z-index: 3;
  box-shadow:
    inset 0 0 0 1px rgba(245, 158, 11, 0.28),
    inset 0 0 18px rgba(251, 191, 36, 0.075);
}

.conversation-detail-pane.ai-ambient-active::after,
.conversation-card.ai-ambient-active::after {
  z-index: 4;
  opacity: 0.5;
  background:
    linear-gradient(90deg, transparent 0%, rgba(245, 158, 11, 0) 18%, rgba(251, 191, 36, 0.78) 50%, rgba(250, 204, 21, 0.46) 64%, transparent 100%) top left / 34% 2px no-repeat,
    linear-gradient(180deg, transparent 0%, rgba(251, 191, 36, 0.66) 46%, rgba(250, 204, 21, 0.38) 62%, transparent 100%) right top / 2px 30% no-repeat,
    linear-gradient(270deg, transparent 0%, rgba(251, 191, 36, 0.66) 48%, rgba(250, 204, 21, 0.42) 64%, transparent 100%) bottom right / 34% 2px no-repeat,
    linear-gradient(0deg, transparent 0%, rgba(251, 191, 36, 0.6) 44%, rgba(250, 204, 21, 0.34) 62%, transparent 100%) left bottom / 2px 30% no-repeat;
  animation: ai-edge-neon-sweep 7.5s ease-in-out infinite;
}

.conversation-empty-state {
  display: grid;
  place-items: center;
  min-height: 420px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  color: #64748b;
  background: #f8fafc;
  font-weight: 600;
}

.embedded-conversation {
  height: 100vh;
  overflow: hidden;
  padding: 0;
  background: #ffffff;
}

.embedded-conversation .conversation-card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 8px 14px 12px;
  position: relative;
  transition: box-shadow 220ms ease;
}

.embedded-conversation .conversation-card.ai-ambient-active {
  --ai-edge-radius: 0;
  box-shadow:
    inset 0 0 0 1px rgba(245, 158, 11, 0.2),
    inset 0 0 30px rgba(251, 191, 36, 0.075);
}

.conversation-header-bar {
  align-items: center;
  border-bottom: 1px solid #eef2f7;
  display: flex;
  flex: 0 0 auto;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
  padding-bottom: 5px;
}

.conversation-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.conversation-heading h1 {
  font-size: 22px;
  line-height: 1.15;
  margin: 0;
}

.conversation-meta-line {
  display: flex;
  gap: 0;
  line-height: 1.35;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.conversation-meta-line span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-meta-line span + span::before {
  content: "·";
  color: #94a3b8;
  margin: 0 7px;
}

.conversation-time {
  white-space: nowrap;
}

.conversation-control-strip {
  align-items: center;
  border-bottom: 1px solid #eef2f7;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 5px 10px;
  justify-content: space-between;
  padding: 5px 0;
}

.conversation-control-main {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.conversation-header-actions {
  align-items: center;
  display: inline-flex;
  flex: 0 0 auto;
  gap: 6px;
}

.conversation-control-side {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  margin-left: auto;
}

.conversation-more-menu {
  position: relative;
}

.conversation-more-toggle {
  list-style: none;
}

.conversation-more-toggle::marker {
  content: "";
}

.conversation-more-toggle::-webkit-details-marker {
  display: none;
}

.conversation-more-menu[open] .conversation-more-toggle {
  border-color: rgba(14, 165, 233, 0.55);
  color: var(--accent-dark);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.conversation-more-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  display: grid;
  gap: 4px;
  min-width: 210px;
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.danger-menu-item {
  color: #b91c1c;
  font-weight: 700;
}

.danger-menu-item:hover {
  background: #fef2f2;
}

.embedded-conversation .conversation-header-bar {
  order: 1;
}

.embedded-conversation .conversation-control-strip {
  order: 2;
}

.embedded-conversation .conversation-heading h1 {
  font-size: 19px;
  line-height: 1.15;
  margin: 0;
}

.embedded-conversation .conversation-meta-line {
  line-height: 1.3;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embedded-conversation .conversation-action-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.embedded-conversation #assignment-notice,
.embedded-conversation .conversation-card > .alert {
  margin: 0;
  order: 3;
  padding: 8px 10px;
}

.embedded-conversation #reply-form {
  margin: 0;
  order: 30;
}

.embedded-conversation #conversation-status,
.embedded-conversation #outbound-failure-detail {
  margin: 0;
  order: 3;
}

.embedded-conversation .message-toolbar {
  margin: 0;
  order: 4;
}

.embedded-conversation .conversation-messages-panel {
  order: 10;
}

.embedded-conversation #reply-form,
.embedded-conversation .message-toolbar,
.embedded-conversation #conversation-status,
.embedded-conversation #outbound-failure-detail,
.embedded-conversation .conversation-header-bar,
.embedded-conversation .conversation-control-strip {
  flex: 0 0 auto;
}

.assignment-row {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  min-height: 30px;
  padding: 2px 3px 2px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #f8fafc;
  white-space: nowrap;
}

.embedded-conversation .assignment-row,
.embedded-conversation .conversation-action-row,
.embedded-conversation .conversation-control-main {
  gap: 6px;
}

.assignment-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.control-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.assignment-pill.unassigned {
  background: #f1f5f9;
  color: #64748b;
}

.assignment-pill.assigned {
  background: #dcfce7;
  color: #166534;
}

.assignment-notice {
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 13px;
  line-height: 1.4;
  padding: 10px 12px;
}

.message-status.is-sent {
  color: #94a3b8;
}

.message-status.is-delivered {
  color: #16a34a;
  font-weight: 600;
}

.message-status.is-failed {
  color: #dc2626;
  font-weight: 600;
}

.outbound-failure-detail {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.4;
}

.outbound-failure-row {
  color: #b91c1c;
  font-weight: 600;
}

.message-toolbar {
  display: none;
  margin: 0;
}

.message-toolbar.is-open {
  display: block;
  position: absolute;
  right: 14px;
  top: 42px;
  z-index: 80;
  width: min(360px, calc(100% - 28px));
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
}

.message-search-field {
  display: grid;
  gap: 6px;
}

.message-search-field > span,
.embedded-conversation #reply-form > label {
  display: none;
}

.message-search-field .search-input-row {
  position: relative;
}

.message-search-field input {
  padding-left: 36px;
}

.search-field-icon {
  color: #94a3b8;
  left: 12px;
  pointer-events: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
}

.embedded-conversation .message-search-field input {
  min-height: 32px;
  padding: 7px 10px 7px 36px;
  border-radius: 10px;
}

.conversation-composer,
.embedded-conversation #reply-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.conversation-composer {
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f8fafc;
}

.conversation-composer > label,
.conversation-composer .reply-target-bar,
.conversation-composer #reply-error {
  grid-column: 1 / -1;
}

.embedded-conversation #reply-form input[type="hidden"] {
  display: none;
}

.conversation-composer textarea,
.embedded-conversation #reply-form textarea {
  grid-column: 1;
  min-height: 58px;
  border-color: #cbd5e1;
  background: #ffffff;
  resize: none;
}

.quick-reply-compose {
  grid-column: 1;
  min-width: 0;
  position: relative;
}

.quick-reply-compose textarea {
  width: 100%;
  padding-right: 54px;
}

.quick-reply-picker {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 30;
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

.quick-reply-picker.hidden {
  display: none;
}

.quick-reply-option {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.quick-reply-option:hover,
.quick-reply-option.is-active {
  background: #e0f2fe;
}

.quick-reply-option__topline {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.quick-reply-option__code {
  color: #0369a1;
  font-size: 12px;
  font-weight: 800;
}

.quick-reply-option__body {
  color: #64748b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-textarea {
  line-height: 1.45;
  transition: background 140ms ease, opacity 140ms ease;
}

#reply-form.is-sending textarea {
  background: #f8fafc;
  opacity: 0.68;
}

.conversation-composer > .composer-send-button,
.embedded-conversation #reply-form > .composer-send-button {
  align-self: stretch;
  grid-column: 2;
  min-width: 104px;
  padding-inline: 16px;
}

.ai-draft-launcher {
  position: absolute;
  right: 10px;
  top: 10px;
  isolation: isolate;
  overflow: hidden;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border-color: rgba(245, 158, 11, 0.45);
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.96), transparent 36%),
    linear-gradient(135deg, #fffbeb, #fef3c7);
  color: #b45309;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08);
}

.ai-draft-launcher::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  padding: 2px;
  opacity: 0;
  background: conic-gradient(from 0deg, #f59e0b, #ef4444, #facc15, #38bdf8, #f59e0b);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.ai-draft-launcher:hover {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 8px 20px rgba(180, 83, 9, 0.14), 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.ai-draft-launcher .icon {
  width: 18px;
  height: 18px;
}

.ai-draft-launcher.is-ready {
  animation: ai-draft-ready-pulse 2.8s ease-in-out infinite;
}

.ai-draft-launcher.is-ready.is-new {
  animation:
    ai-draft-ready-pop 820ms cubic-bezier(0.22, 1, 0.36, 1),
    ai-draft-ready-pulse 2.8s ease-in-out 820ms infinite;
}

.ai-draft-launcher.is-loading {
  cursor: progress;
  opacity: 1;
}

.ai-draft-launcher.is-loading::before {
  opacity: 1;
  animation: ai-draft-border-spin 1.15s linear infinite;
}

.ai-draft-launcher.is-loading .icon {
  animation: ai-working-dot-pulse 1.2s ease-in-out infinite;
}

.composer-send-button {
  min-height: 44px;
}

.embedded-conversation #reply-form .reply-target-bar,
.embedded-conversation #reply-form #reply-error {
  grid-column: 1 / -1;
  margin: 0;
}

.conversation-messages-panel {
  flex: 1;
  min-height: 260px;
  margin-top: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)),
    repeating-linear-gradient(135deg, #f8fafc 0, #f8fafc 10px, #f1f5f9 10px, #f1f5f9 20px);
}

.embedded-conversation .conversation-messages-panel {
  flex: 1 1 auto;
  margin: 0;
  min-height: 0;
}

.message-scroll-status {
  padding: 4px 0 10px;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

.message-row {
  max-width: 78%;
  width: fit-content;
  margin: 5px 0;
  padding: 8px 10px 7px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  overflow-wrap: anywhere;
}

.message-row-assistant {
  margin-left: auto;
  background: #d9fbe7;
  border-color: #bbf7d0;
}

.message-row-user {
  margin-right: auto;
  background: #f8fafc;
  border-color: #cbd5e1;
}

.message-body-line {
  align-items: flex-start;
  display: flex;
  gap: 0;
}

.message-role-badge {
  align-items: center;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  display: inline-flex;
  flex: 0 0 22px;
  font-size: 11px;
  font-weight: 800;
  height: 22px;
  justify-content: center;
  line-height: 1;
  margin-top: 1px;
  width: 22px;
  display: none;
}

.message-row-assistant .message-role-badge {
  background: #16a34a;
  color: #ffffff;
}

.message-copy {
  display: grid;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
}

.message-content {
  line-height: 1.4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-author {
  display: block;
  margin: 0;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
}

.message-footer {
  align-items: center;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
  justify-self: end;
}

.message-time {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.message-reply-btn {
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 0;
}

.message-reply-btn:hover {
  text-decoration: underline;
}

.message-quote,
.reply-target-bar,
.ai-draft-note {
  border-left: 3px solid #cbd5e1;
  color: #475569;
  font-size: 13px;
}

.message-quote {
  margin: 4px 0;
  padding-left: 8px;
}

.reply-target-bar {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin: 6px 0 8px;
  padding: 6px 0 6px 8px;
}

.ai-draft-note {
  margin-top: 8px;
  padding-left: 8px;
}


.pill {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.ai-toggle {
  border: none;
  cursor: pointer;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #fff;
  color: #64748b;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.icon-btn:hover {
  transform: translateY(-1px) scale(1.03);
  border-color: rgba(14, 165, 233, 0.5);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.icon-btn:active {
  transform: translateY(0) scale(0.98);
}

.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
  box-shadow: none;
}

.icon-btn.ai-draft-launcher.is-loading:disabled {
  cursor: progress;
  opacity: 1;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn.ai-on {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
}

.icon-btn.ai-off {
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
}

.icon-btn.danger {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.28);
}

.icon-btn.danger:hover {
  border-color: rgba(220, 38, 38, 0.48);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.14);
}

.icon-btn.action-add {
  background: #e0f2fe;
  border-color: rgba(14, 165, 233, 0.5);
  color: #0369a1;
}

.icon-btn.action-add:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.icon-btn.action-edit {
  color: #475569;
  border-color: rgba(71, 85, 105, 0.28);
}

.icon-btn.action-edit:hover {
  border-color: rgba(14, 165, 233, 0.5);
  color: #0369a1;
}

.icon-btn.action-save {
  background: #dcfce7;
  border-color: rgba(22, 163, 74, 0.42);
  color: #166534;
}

.icon-btn.action-save:hover {
  background: #16a34a;
  border-color: #16a34a;
  color: #ffffff;
}

.icon-btn.action-use {
  background: #f0fdfa;
  border-color: rgba(15, 118, 110, 0.34);
  color: #0f766e;
}

.icon-btn.action-use:hover {
  background: #0f766e;
  border-color: #0f766e;
  color: #ffffff;
}

.icon-btn.action-hold {
  background: #fffbeb;
  border-color: rgba(245, 158, 11, 0.42);
  color: #b45309;
}

.icon-btn.action-hold:hover {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #ffffff;
}

.icon-btn.action-resume {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.34);
  color: #1d4ed8;
}

.icon-btn.action-resume:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.ai-mode-status {
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
}

.assignment-row .btn.compact {
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
}

.embedded-conversation .timeout-input,
.embedded-conversation .timeout-unit-select {
  height: 30px;
}

#toggle-message-search.is-active {
  border-color: rgba(14, 165, 233, 0.65);
  color: var(--accent-dark);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.ai-assistant-launcher {
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.35);
  background: #f0f9ff;
  overflow: visible;
  position: relative;
}

.ai-assistant-launcher::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #0ea5e9;
  box-shadow: 0 0 0 2px #ffffff;
}

.ai-assistant-launcher::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  z-index: 1;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transform: rotate(-38deg);
}

.ai-assistant-launcher.ai-mode-auto {
  color: #166534;
  border-color: rgba(22, 163, 74, 0.35);
  background: #f0fdf4;
}

.ai-assistant-launcher.ai-mode-auto::after {
  background: #16a34a;
}

.ai-assistant-launcher.ai-mode-draft {
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.45);
  background: #e0f2fe;
}

.ai-assistant-launcher.ai-mode-draft::after {
  background: #0ea5e9;
}

.ai-assistant-launcher.ai-mode-off {
  color: #64748b;
  border-color: rgba(148, 163, 184, 0.45);
  background: #f8fafc;
}

.ai-assistant-launcher.ai-mode-off::before {
  opacity: 0.85;
}

.ai-assistant-launcher.ai-mode-off::after {
  background: #94a3b8;
}

.ai-assistant-launcher.ai-mode-timeout {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.45);
  background: #fffbeb;
}

.ai-assistant-launcher.ai-mode-timeout::after {
  width: 10px;
  height: 10px;
  background: #f59e0b;
}

.ai-assistant-launcher.ai-mode-auto:not(.ai-mode-timeout)::after {
  animation: ai-active-pulse 2.4s ease-in-out infinite;
}

@keyframes ai-active-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 0 rgba(22, 163, 74, 0.28);
  }

  50% {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px rgba(22, 163, 74, 0);
  }
}

@keyframes ai-edge-neon-sweep {
  0%,
  100% {
    background-position: -36% 0, 100% -32%, 136% 100%, 0 136%;
    opacity: 0.34;
  }

  45% {
    opacity: 0.58;
  }

  55% {
    background-position: 116% 0, 100% 116%, -36% 100%, 0 -32%;
    opacity: 0.58;
  }
}

@keyframes ai-working-sheen {
  0%,
  100% {
    background-position: 0 0, 120% 0;
  }

  50% {
    background-position: 0 0, -40% 0;
  }
}

@keyframes ai-working-dot-pulse {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.72;
  }

  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes ai-draft-ready-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08), 0 0 0 0 rgba(245, 158, 11, 0.24);
  }

  50% {
    box-shadow: 0 8px 22px rgba(180, 83, 9, 0.14), 0 0 0 6px rgba(245, 158, 11, 0);
  }
}

@keyframes ai-draft-ready-pop {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.14), 0 0 0 0 rgba(56, 189, 248, 0.34);
  }

  45% {
    transform: scale(1.16);
    box-shadow: 0 10px 24px rgba(180, 83, 9, 0.18), 0 0 0 8px rgba(56, 189, 248, 0);
  }

  72% {
    transform: scale(0.98);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.08), 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

@keyframes ai-draft-border-spin {
  to {
    transform: rotate(360deg);
  }
}

@property --ai-draft-border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

@keyframes ai-draft-border-angle {
  to {
    --ai-draft-border-angle: 360deg;
  }
}

@keyframes ai-draft-modal-aura {
  0%,
  100% {
    opacity: 0.58;
  }

  50% {
    opacity: 1;
  }
}

@keyframes inbox-row-new-message {
  0%,
  22%,
  44%,
  66%,
  88%,
  100% {
    opacity: 0;
  }

  11%,
  33%,
  55% {
    opacity: 1;
  }
}

@keyframes inbox-row-subtle-lift {
  0%,
  22%,
  44%,
  66%,
  88%,
  100% {
    box-shadow: inset 3px 0 0 #2563eb;
  }

  11%,
  33%,
  55% {
    box-shadow: inset 6px 0 0 #2563eb, 0 8px 22px rgba(37, 99, 235, 0.18);
  }
}

@keyframes inbox-avatar-new-message {
  0%,
  22%,
  44%,
  66%,
  88%,
  100% {
    transform: scale(1);
  }

  11%,
  33%,
  55% {
    transform: scale(1.12);
  }
}

@keyframes inbox-unread-dot-new-message {
  0%,
  22%,
  44%,
  66%,
  88%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }

  11%,
  33%,
  55% {
    transform: scale(1.35);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  .conversation-detail-pane,
  .embedded-conversation .conversation-card {
    transition: none;
  }

  .conversation-detail-pane.ai-ambient-active::after,
  .conversation-card.ai-ambient-active::after {
    animation: none;
    opacity: 0.32;
  }

  .ai-assistant-launcher.ai-mode-auto:not(.ai-mode-timeout)::after {
    animation: none;
  }

  .ai-working-indicator,
  .ai-working-dot,
  .ai-draft-launcher.is-ready,
  .ai-draft-launcher.is-ready.is-new,
  .ai-draft-launcher.is-loading,
  .ai-draft-launcher.is-loading::before,
  .ai-draft-launcher.is-loading .icon,
  .ai-auto-reply-modal.open.is-timing .ai-auto-reply-modal-dialog::before,
  .ai-auto-reply-modal.open.is-timing .ai-auto-reply-modal-dialog::after,
  .ai-draft-modal.open.is-generating .ai-draft-modal-dialog::before,
  .ai-draft-modal.open.is-generating .ai-draft-modal-dialog::after,
  .ai-draft-retry-button.is-loading .icon,
  .chat-list-item.row-new-message,
  .chat-list-item.row-new-message::before,
  .chat-list-item.row-new-message .chat-avatar {
    animation: none;
  }
}

.ai-assistant-modal-dialog {
  width: min(560px, calc(100% - 32px));
  overflow: hidden;
  padding: 0;
}

.ai-assistant-modal-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px 20px;
}

.ai-assistant-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #f8fafc;
}

.ai-assistant-card h4 {
  margin: 0 0 3px;
  font-size: 14px;
}

.ai-assistant-card .ai-mode-select {
  width: min(220px, 100%);
  min-width: 0;
  height: 38px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  padding: 0 30px 0 12px;
  font-size: 14px;
  background: #ffffff;
}

.ai-timeout-settings {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.ai-timeout-settings .meta {
  flex: 0 0 auto;
  font-weight: 700;
}

.ai-timeout-settings.hidden {
  display: none;
}

.ai-timeout-settings .icon-btn {
  width: 34px;
  height: 34px;
}

.contact-modal-dialog {
  width: min(520px, calc(100% - 32px));
  overflow: hidden;
  padding: 0;
}

.contact-modal-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.contact-modal-header h3 {
  margin: 2px 0 0;
}

.contact-modal-body {
  display: grid;
  gap: 14px;
  padding: 16px 20px 20px;
}

.contact-summary-card {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f8fafc;
}

.contact-summary-card strong {
  color: var(--ink);
  font-size: 16px;
}

.contact-notes {
  color: #475569;
  max-height: 120px;
  overflow: auto;
  white-space: pre-wrap;
}

.contact-form {
  display: grid;
  gap: 8px;
}

.contact-form label {
  display: grid;
  gap: 4px;
  margin: 0;
}

.contact-form span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: #ffffff;
}

.contact-form textarea {
  resize: vertical;
}

.contact-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}

.segmented-control-2 {
  grid-template-columns: repeat(2, minmax(84px, 1fr));
}

.segmented-option {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid #e2e8f0;
  background: transparent;
  color: #475569;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.segmented-option:last-child {
  border-right: 0;
}

.segmented-option.active {
  background: #0f172a;
  color: #ffffff;
}

.ai-mode-select {
  min-width: 78px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  padding: 0 24px 0 9px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.timeout-input {
  width: 72px;
  height: 30px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.timeout-unit-select {
  min-width: 92px;
  height: 30px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0 28px 0 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.ai-mode-timeout {
  color: #b45309;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ai-working-indicator {
  display: grid;
  gap: 9px;
  min-height: 38px;
  overflow: visible;
  position: relative;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-left: 3px solid #f59e0b;
  border-radius: 10px;
  padding: 8px 10px;
  background:
    linear-gradient(90deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.96)),
    linear-gradient(110deg, transparent 0%, rgba(251, 191, 36, 0.28) 45%, transparent 70%);
  background-size: 100% 100%, 220% 100%;
  color: #92400e;
  font-size: 13px;
  font-weight: 700;
  animation: ai-working-sheen 2.8s ease-in-out infinite;
}

.ai-working-indicator.is-modal-open {
  display: none;
}

.ai-working-header {
  align-items: center;
  display: flex;
  gap: 9px;
  min-width: 0;
}

.ai-working-indicator #ai-working-text {
  min-width: 0;
}

.ai-working-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ai-pending-reply-preview {
  max-height: 148px;
  overflow: auto;
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: 8px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.82);
  color: #0f172a;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.ai-working-indicator.has-generated-reply {
  border-color: rgba(14, 165, 233, 0.34);
  border-left-color: #0ea5e9;
  background:
    linear-gradient(90deg, rgba(240, 249, 255, 0.96), rgba(255, 255, 255, 0.96)),
    linear-gradient(110deg, transparent 0%, rgba(56, 189, 248, 0.2) 45%, transparent 70%);
  color: #0369a1;
}

.ai-auto-reply-actions {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

.ai-auto-reply-actions.hidden {
  display: none;
}

.ai-auto-reply-actions .icon-btn {
  flex: 0 0 auto;
  height: 28px;
  width: 28px;
}

.ai-auto-reply-actions .icon {
  height: 15px;
  width: 15px;
}

.embedded-conversation #ai-working-indicator {
  margin: 0;
  order: 28;
}

.ai-working-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.14);
  animation: ai-working-dot-pulse 1.4s ease-in-out infinite;
}

.ai-working-indicator.has-generated-reply .ai-working-dot {
  background: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

.ai-working-indicator.has-generated-reply #open-ai-auto-reply-modal {
  border-color: rgba(14, 165, 233, 0.35);
  color: #0369a1;
  font-weight: 800;
}

.conversation-card.ai-generation-active .conversation-composer {
  border-color: rgba(245, 158, 11, 0.32);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.07);
}

.conversation-card.ai-generation-active .conversation-composer textarea {
  min-height: 50px;
}

.ai-auto-reply-modal-dialog {
  --ai-draft-border-angle: 0deg;
  width: min(620px, calc(100% - 32px));
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(14, 165, 233, 0.24);
  background: #ffffff;
  position: relative;
  isolation: isolate;
}

.ai-auto-reply-modal.open.is-timing .ai-auto-reply-modal-dialog {
  border-color: rgba(15, 23, 42, 0.14);
  box-shadow:
    0 18px 50px rgba(15, 23, 42, 0.22),
    0 0 0 2px rgba(56, 189, 248, 0.06),
    0 0 28px rgba(245, 158, 11, 0.1);
}

.ai-auto-reply-modal.open.is-held .ai-auto-reply-modal-dialog {
  border-color: rgba(245, 158, 11, 0.36);
  box-shadow:
    0 18px 50px rgba(15, 23, 42, 0.22),
    0 0 0 3px rgba(245, 158, 11, 0.08);
}

.ai-auto-reply-modal-dialog > * {
  position: relative;
  z-index: 1;
}

.ai-auto-reply-modal-dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  padding: 3px;
  opacity: 0;
  background: conic-gradient(
    from var(--ai-draft-border-angle),
    transparent 0deg,
    transparent 42deg,
    rgba(56, 189, 248, 0.08) 48deg,
    rgba(56, 189, 248, 0.78) 56deg,
    #fde68a 64deg,
    #f59e0b 70deg,
    rgba(56, 189, 248, 0.86) 78deg,
    rgba(56, 189, 248, 0.12) 88deg,
    transparent 104deg,
    transparent 244deg,
    rgba(250, 204, 21, 0.12) 252deg,
    rgba(250, 204, 21, 0.42) 262deg,
    transparent 278deg,
    transparent 360deg
  );
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.35)) drop-shadow(0 0 7px rgba(245, 158, 11, 0.24));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.ai-auto-reply-modal-dialog::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(56, 189, 248, 0.08), transparent 38%),
    radial-gradient(circle at 82% 100%, rgba(250, 204, 21, 0.07), transparent 42%);
}

.ai-auto-reply-modal.open.is-timing .ai-auto-reply-modal-dialog::before {
  opacity: 1;
  animation: ai-draft-border-angle 4.8s linear infinite;
}

.ai-auto-reply-modal.open.is-timing .ai-auto-reply-modal-dialog::after {
  opacity: 0.75;
  animation: ai-draft-modal-aura 5.8s ease-in-out infinite;
}

.ai-auto-reply-modal-body {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
}

.ai-auto-reply-modal-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  min-height: 34px;
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  background: #f0f9ff;
  color: #0369a1;
  font-size: 13px;
  font-weight: 800;
}

.ai-auto-reply-progress {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.12);
}

.ai-auto-reply-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #38bdf8, #facc15, #f59e0b);
  transition: width 0.35s linear;
}

.ai-auto-reply-modal.is-held .ai-auto-reply-progress span {
  background: linear-gradient(90deg, #f59e0b, #facc15);
}

.ai-auto-reply-modal .ai-pending-reply-preview {
  display: block;
  max-height: min(280px, 42vh);
  border-color: rgba(14, 165, 233, 0.24);
  background: #fbfdff;
  font-size: 14px;
}

.ai-auto-reply-modal .ai-pending-reply-preview.hidden {
  display: none;
}

.ai-auto-reply-guidance-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(14, 165, 233, 0.2);
  border-radius: 10px;
  background: #f8fafc;
}

.ai-auto-reply-guidance-panel.hidden {
  display: none;
}

.ai-auto-reply-guidance-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ai-auto-reply-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 18px;
}

.ai-auto-reply-modal-actions .ai-auto-reply-actions {
  margin-left: 0;
}

.ai-auto-reply-modal-actions .ai-auto-reply-actions .icon-btn {
  height: 36px;
  width: 36px;
}

.ai-draft-modal-dialog {
  --ai-draft-border-angle: 0deg;
  width: min(620px, calc(100% - 32px));
  overflow: hidden;
  padding: 0;
  position: relative;
  isolation: isolate;
  border: 1px solid #e2e8f0;
  background: #ffffff;
}

.ai-draft-modal.open.is-generating .ai-draft-modal-dialog {
  border-color: rgba(245, 158, 11, 0.38);
  box-shadow:
    0 18px 50px rgba(15, 23, 42, 0.24),
    0 0 0 3px rgba(245, 158, 11, 0.1),
    0 0 30px rgba(56, 189, 248, 0.18);
}

.ai-draft-modal-dialog > * {
  position: relative;
  z-index: 1;
}

.ai-draft-modal-dialog::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  padding: 3px;
  opacity: 0;
  background: conic-gradient(
    from var(--ai-draft-border-angle),
    transparent 0deg,
    transparent 38deg,
    rgba(56, 189, 248, 0.98) 48deg,
    #facc15 60deg,
    rgba(239, 68, 68, 0.9) 68deg,
    transparent 84deg,
    transparent 172deg,
    rgba(250, 204, 21, 0.9) 188deg,
    rgba(56, 189, 248, 0.95) 202deg,
    transparent 224deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}

.ai-draft-modal-dialog::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(56, 189, 248, 0.16), transparent 38%),
    radial-gradient(circle at 82% 100%, rgba(250, 204, 21, 0.12), transparent 42%);
}

.ai-draft-modal.open.is-generating .ai-draft-modal-dialog::before {
  opacity: 1;
  animation: ai-draft-border-angle 1.55s linear infinite;
}

.ai-draft-modal.open.is-generating .ai-draft-modal-dialog::after {
  opacity: 1;
  animation: ai-draft-modal-aura 2.4s ease-in-out infinite;
}

.ai-draft-modal-meta {
  align-items: center;
  display: inline-flex;
  gap: 10px;
}

.ai-draft-modal-body {
  display: grid;
  gap: 12px;
  padding: 16px 20px;
}

.ai-draft-content {
  display: block;
  min-height: 92px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 12px;
  padding: 13px 14px;
  background: #fffdf7;
  color: var(--ink);
  white-space: pre-wrap;
  line-height: 1.5;
}

.ai-draft-guidance-wrap {
  display: grid;
  gap: 6px;
}

.ai-draft-guidance-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.ai-draft-guidance {
  width: 100%;
  resize: vertical;
  min-height: 48px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.ai-draft-modal-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0 20px 18px;
}

.ai-draft-retry-button {
  color: #0369a1;
  border-color: rgba(14, 165, 233, 0.35);
  background: #f0f9ff;
}

.ai-draft-retry-button:hover {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.ai-draft-retry-button.is-loading {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.45);
  background: #fffbeb;
  opacity: 1;
}

.ai-draft-retry-button.is-loading .icon {
  animation: ai-draft-border-spin 1s linear infinite;
}

#bulk-menu {
  display: none;
  position: absolute;
  left: 0;
  top: 44px;
  padding: 8px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  min-width: 160px;
  z-index: 10;
}

#bulk-menu.open {
  display: block;
}

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: #0f172a;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.menu-item:hover {
  background: rgba(15, 23, 42, 0.06);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #111827;
  color: #f9fafb;
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
  position: relative;
  width: min(440px, calc(100% - 32px));
  background: #ffffff;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.28);
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.modal-dialog h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions .btn {
  min-width: 96px;
}

.toast .btn.secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #f9fafb;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.table .row-ai {
  background: #f8fafc;
}

.table .row-human {
  background: #fff7ed;
}

.table-actions-cell {
  text-align: right;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.assistant-timeout-table input,
.assistant-timeout-table select {
  width: 100%;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font: inherit;
}

.assistant-timeout-add-panel {
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
}

.assistant-timeout-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.assistant-timeout-search,
.assistant-timeout-per-page {
  display: grid;
  gap: 5px;
}

.assistant-timeout-search span,
.assistant-timeout-per-page span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.assistant-timeout-search input {
  min-width: min(260px, 72vw);
}

.assistant-timeout-search input,
.assistant-timeout-per-page select {
  height: 36px;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font: inherit;
}

.assistant-timeout-duration {
  display: grid;
  grid-template-columns: minmax(72px, 0.7fr) minmax(118px, 1fr);
  gap: 8px;
}

.assistant-timeout-actions {
  justify-content: flex-end;
  margin-top: 0;
}

.assistant-timeout-pagination {
  margin-top: 12px;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fee2e2;
  color: #991b1b;
  margin-bottom: 16px;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

.alert.warn {
  background: #fef3c7;
  color: #92400e;
}

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

.issue-list .meta {
  color: inherit;
  margin: 3px 0 0;
  opacity: 0.88;
}

.issue-row {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.issue-row > div,
.issue-row > p {
  min-width: 0;
}

.issue-row .btn {
  flex: 0 0 auto;
}

.row-link {
  cursor: pointer;
}

.row-link:hover {
  background: #f8fafc;
}

.entity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.entity-detail-card {
  padding-top: 22px;
}

.entity-detail-header {
  align-items: flex-start;
  margin-bottom: 10px;
}

.entity-detail-header h1 {
  margin: 0 0 5px;
}

.entity-detail-subtitle {
  margin: 0;
}

.entity-detail-tabs {
  margin: 10px 0 14px;
}

.entity-settings-block > label {
  display: block;
  margin: 14px 0 6px;
}

.entity-settings-block .checkbox-row {
  margin-top: 10px;
}

.entity-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #e2e8f0;
  margin: 16px 0 20px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--ink);
  border-color: var(--accent);
}

.tabs-primary {
  margin-top: 8px;
}

.tabs-secondary {
  margin-top: -8px;
}

.hidden {
  display: none;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.settings-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.settings-status {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.settings-status__label {
  font-size: 12px;
  color: var(--muted);
}

.settings-status__value {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 600;
}

.settings-status__meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border-radius: 999px;
  background: #94a3b8;
}

.status-dot.ok,
.status-pill.ok {
  background: #dcfce7;
  color: #166534;
}

.status-dot.ok {
  background: #16a34a;
}

.status-dot.warn,
.status-pill.warn {
  background: #fef3c7;
  color: #92400e;
}

.status-dot.warn {
  background: #f59e0b;
}

.status-dot.neutral,
.status-pill.neutral {
  background: #e2e8f0;
  color: #475569;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.channel-toggle {
  align-items: center;
  display: flex;
  gap: 12px;
  width: 100%;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.channel-toggle-compact {
  width: auto;
  min-width: 210px;
  min-height: 42px;
  padding: 8px 10px;
}

.channel-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.channel-toggle__control {
  position: relative;
  flex: 0 0 46px;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.channel-toggle__control::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 140ms ease;
}

.channel-toggle__input:checked + .channel-toggle__control {
  background: #16a34a;
}

.channel-toggle__input:checked + .channel-toggle__control::before {
  transform: translateX(20px);
}

.channel-toggle__input:focus-visible + .channel-toggle__control {
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.22);
}

.channel-toggle__text {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.25;
}

.channel-toggle__text strong {
  color: var(--ink);
  font-size: 13px;
}

.settings-section {
  padding: 18px 0;
  border-top: 1px solid #e2e8f0;
}

.danger-zone {
  border-top-color: #fecaca;
  background: #fff7f7;
  margin-top: 18px;
  padding: 18px;
  border-radius: 8px;
}

.delete-confirmation {
  max-width: 520px;
}

.section-save-actions {
  margin-top: 18px;
}

.kb-rebuild-section {
  margin-top: 8px;
  padding: 18px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.kb-rebuild-section .section-heading {
  align-items: center;
  margin-bottom: 0;
}

.kb-rebuild-section form {
  margin: 0;
}

.tab-panel > .settings-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.waha-session-list {
  display: grid;
  gap: 18px;
}

.channel-status-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 14px;
  padding: 12px 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fafc;
}

.channel-status-banner .status-dot {
  margin-top: 5px;
}

.channel-status-banner strong {
  display: block;
  font-size: 15px;
}

.channel-status-banner .meta {
  margin: 3px 0 0;
}

.channel-setup-panel {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fbfdff;
}

.setup-step-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.setup-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.setup-step__state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.setup-step.done .setup-step__state {
  background: #dcfce7;
  color: #166534;
}

.setup-step.pending .setup-step__state {
  background: #fef3c7;
  color: #92400e;
}

.setup-step__label,
.setup-step__detail {
  display: block;
}

.setup-step__label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.setup-step__detail {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

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

.waha-connect-panel {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fbfdff;
}

.waha-connect-panel.hidden {
  display: none;
}

.waha-session-block {
  padding: 18px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #ffffff;
}

.waha-session-block:nth-child(even) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.waha-add-session {
  margin-top: 18px;
  padding: 18px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #fbfdff;
}

.waha-session-heading {
  align-items: center;
}

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

.waha-managed-qr-panel {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 16px;
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #f8fafc;
}

.waha-linking-panel .meta {
  margin: 4px 0;
}

.waha-switch-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  max-width: 420px;
}

.waha-switch-code-row input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.waha-qr-image {
  width: 180px;
  height: 180px;
  object-fit: contain;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.waha-pairing-code {
  align-items: center;
  align-self: stretch;
  display: inline-flex;
  justify-content: center;
  min-height: 96px;
  padding: 16px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 32px;
  letter-spacing: 0;
  text-align: center;
}

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

.waha-health-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.waha-health-item strong {
  font-size: 14px;
}

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

.waha-grid > div {
  min-width: 0;
}

.waha-check {
  margin-top: 10px;
}

.waha-check-list {
  display: grid;
  gap: 10px;
  padding: 10px 0 0;
}

.waha-actions {
  margin-top: 16px;
}

.waha-session-actions {
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
}

.waha-diagnostics {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #dbe5ef;
}

.waha-diagnostics summary {
  width: fit-content;
  cursor: pointer;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.waha-diagnostics summary:hover {
  color: var(--ink);
}

.waha-diagnostics .inline-actions {
  margin-top: 10px;
}

.subsection-title {
  margin: 0;
  font-size: 15px;
}

.source-entry-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
}

.radio-toggle-group {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.radio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.radio-toggle input {
  width: 16px;
  height: 16px;
}

.source-entry-panel {
  display: block;
}

.source-entry-panel.hidden {
  display: none;
}

.resource-action-panel {
  display: grid;
  gap: 14px;
  margin: 12px 0 18px;
  padding: 14px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfdff;
}

.resource-action-panel.hidden {
  display: none;
}

.visually-hidden-copy {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.resource-toolbar {
  align-items: flex-end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  margin: 12px 0;
}

.entity-list-toolbar {
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
}

.resource-search,
.resource-per-page {
  display: grid;
  gap: 5px;
}

.resource-search span,
.resource-per-page span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.resource-search input,
.resource-per-page select {
  min-height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
}

.resource-card-grid {
  display: grid;
  gap: 12px;
}

.resource-card {
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  padding: 14px;
}

.resource-card:hover {
  border-color: rgba(14, 165, 233, 0.42);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.resource-card__select {
  padding-top: 4px;
}

.resource-card__body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.resource-card__header,
.resource-card__actions {
  align-items: flex-start;
  display: flex;
  gap: 10px;
}

.resource-card__header {
  justify-content: space-between;
}

.resource-card__actions {
  justify-content: flex-end;
}

.resource-card__title-wrap {
  min-width: 0;
}

.resource-card__eyebrow {
  color: #64748b;
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.resource-card__title {
  font-size: 15px;
  line-height: 1.35;
  margin: 0;
  overflow-wrap: anywhere;
}

.resource-card__title a:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.resource-meta-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.resource-meta-grid span {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #475569;
  font-size: 13px;
}

.resource-meta-grid strong {
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
}

.resource-file-card {
  grid-template-columns: minmax(0, 1fr) auto;
}

.resource-card.hidden {
  display: none;
}

.resource-file-icon {
  align-items: center;
  align-self: center;
  background: #e0f2fe;
  border-radius: 8px;
  color: #0369a1;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  height: 32px;
  justify-content: center;
  width: 38px;
}

.resource-pagination {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.resource-pagination .page-range {
  color: var(--muted);
  font-size: 12px;
}

.quick-reply-template-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.quick-reply-card {
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 10px 12px;
}

.quick-reply-row-main {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  min-width: 0;
}

.quick-reply-row-main p {
  color: #475569;
  font-size: 13px;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-reply-form {
  min-width: 0;
}

.quick-reply-row-actions {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.quick-reply-delete {
  width: 32px;
  height: 32px;
}

.quick-reply-modal-dialog {
  width: min(520px, calc(100% - 32px));
}

.quick-reply-modal-dialog .quick-reply-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.quick-reply-modal-dialog textarea {
  min-height: 120px;
  resize: vertical;
}

.settings-disclosure {
  border-top: 1px solid #e2e8f0;
  padding: 16px 0;
}

.settings-disclosure summary {
  cursor: pointer;
  font-weight: 600;
}

.settings-disclosure .settings-section {
  border-top: 0;
  padding: 16px 0 0;
}

.settings-disclosure-card {
  margin: 12px 0;
  padding: 0;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fbfdff;
}

.settings-disclosure-card summary {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  list-style: none;
  min-height: 48px;
  padding: 12px 14px;
}

.settings-disclosure-card summary::-webkit-details-marker {
  display: none;
}

.settings-disclosure-card summary::after {
  color: var(--accent);
  content: "+";
  flex: 0 0 auto;
  font-size: 18px;
  line-height: 1;
}

.settings-disclosure-card[open] summary::after {
  content: "-";
}

.settings-disclosure-card .settings-section {
  border-top: 1px solid #e2e8f0;
  padding: 14px;
}

.settings-disclosure-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-create-form {
  margin-top: 12px;
}

.entity-create-form > .settings-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.entity-form-actions,
.inline-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.entity-form-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.inline-actions {
  margin-top: 10px;
}

.bulk-selection-actions {
  justify-content: space-between;
  margin: 12px 0;
}

.inline-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.inline-form select {
  width: auto;
  min-width: 130px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  font-family: var(--font);
}

.table-scroll {
  margin-top: 12px;
  overflow: auto;
}

.transfer-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

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

.transfer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.transfer-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.18s ease;
}

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

.transfer-row {
  display: grid;
  gap: 6px;
}

.transfer-row__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
}

.transfer-row__name {
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-row__state {
  color: var(--muted);
  white-space: nowrap;
}

.transfer-row.is-complete .progress-bar {
  background: #16a34a;
}

.transfer-row.is-error .progress-bar {
  background: #dc2626;
}

.transfer-row.is-error .transfer-row__state {
  color: #991b1b;
}

.progress-bar.is-warn {
  background: #f59e0b;
}

.progress-bar.is-danger {
  background: #dc2626;
}

.progress-bar.is-complete {
  background: #16a34a;
}

.usage-warning {
  color: #b45309;
  font-weight: 700;
}

.dashboard-content {
  display: grid;
  gap: 16px;
}

.dashboard-panel {
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  padding: 18px;
  min-width: 0;
}

.dashboard-command-panel {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-command-copy {
  min-width: 0;
}

.dashboard-command-copy h1 {
  margin: 3px 0 5px;
}

.dashboard-eyebrow {
  color: #0369a1;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.dashboard-command-actions,
.dashboard-section-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.dashboard-command-actions {
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-section-heading {
  margin-bottom: 12px;
}

.dashboard-section-heading h2 {
  font-size: 18px;
  margin: 0 0 3px;
}

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

.dashboard-metric {
  display: grid;
  gap: 6px;
  min-height: 122px;
  padding: 16px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.dashboard-metric:hover,
.dashboard-action-list a:hover,
.dashboard-setup-step:hover {
  border-color: rgba(14, 165, 233, 0.45);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.09);
}

.dashboard-metric span,
.dashboard-metric small,
.dashboard-action-list span,
.dashboard-attention-item p,
.dashboard-empty-state span,
.dashboard-credit-summary span {
  color: #64748b;
  font-size: 13px;
}

.dashboard-metric strong {
  font-size: 32px;
  line-height: 1;
}

.dashboard-metric.is-warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.dashboard-metric.is-ok {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.dashboard-main-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
}

.dashboard-attention-list,
.dashboard-action-list,
.dashboard-setup-list {
  display: grid;
  gap: 10px;
}

.dashboard-attention-item {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f8fafc;
}

.dashboard-attention-item strong,
.dashboard-action-list strong,
.dashboard-empty-state strong,
.dashboard-setup-step strong {
  color: #0f172a;
}

.dashboard-attention-item p {
  margin: 4px 0 0;
}

.dashboard-attention-item.is-warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.dashboard-attention-item.is-danger {
  border-color: #fecaca;
  background: #fef2f2;
}

.dashboard-attention-item.is-info {
  border-color: #bae6fd;
  background: #f0f9ff;
}

.dashboard-empty-state {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.dashboard-setup-list {
  margin-top: 12px;
}

.dashboard-setup-step,
.dashboard-action-list a {
  display: grid;
  gap: 4px;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-setup-step {
  grid-template-columns: 56px minmax(0, 1fr);
  align-items: center;
}

.dashboard-setup-step span {
  justify-self: start;
  padding: 4px 7px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.dashboard-setup-step.is-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.dashboard-setup-step.is-done span {
  background: #dcfce7;
  color: #166534;
}

.dashboard-setup-step.is-next {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.dashboard-setup-step.is-next span {
  background: #e0f2fe;
  color: #0369a1;
}

.dashboard-credit-summary {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
}

.dashboard-credit-summary strong {
  font-size: 32px;
  line-height: 1;
}

.dashboard-recent-table td {
  vertical-align: top;
}

.onboarding-card {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.onboarding-header {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.onboarding-header h3 {
  margin: 0 0 4px;
}

.onboarding-steps {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.onboarding-step {
  align-items: center;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  background: #ffffff;
}

.onboarding-step.is-done {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.onboarding-step__marker {
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  min-width: 42px;
  padding: 4px 7px;
  text-align: center;
}

.onboarding-step.is-done .onboarding-step__marker {
  background: #dcfce7;
  color: #166534;
}

.billing-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.billing-summary > div,
.billing-usage-item,
.billing-plan-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.billing-summary > div {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.billing-usage-grid,
.billing-plan-grid,
.billing-credit-pack-grid {
  display: grid;
  gap: 14px;
}

.billing-usage-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.billing-usage-item {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.billing-usage-top,
.billing-plan-head,
.billing-limit-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.billing-usage-note {
  color: #047857;
  font-size: 12px;
  font-weight: 600;
  margin: -4px 0 0;
}

.billing-plan-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 18px;
}

.billing-plan-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.billing-credit-pack-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.billing-credit-pack-card,
.billing-request-list {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.billing-credit-pack-card {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.billing-credit-pack-card h4,
.billing-request-list h4 {
  margin: 0 0 4px;
}

.billing-request-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
}

.billing-request-row {
  align-items: center;
  border-top: 1px solid #eef2f7;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding-top: 8px;
}

.billing-plan-card.is-current {
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: 0 10px 32px rgba(14, 165, 233, 0.13);
}

.billing-plan-head h3 {
  margin: 0 0 4px;
}

.billing-limit-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.billing-limit-list dt {
  color: #64748b;
  font-size: 13px;
}

.billing-limit-list dd {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.operations-search-form {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: min(420px, 100%);
}

.operations-search-form input[type="search"] {
  min-height: 36px;
}

.operations-billing-table td {
  vertical-align: top;
}

.operations-actions {
  display: grid;
  gap: 8px;
}

.operations-inline-form {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.operations-inline-form input,
.operations-inline-form select {
  min-height: 34px;
  max-width: 180px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 9px;
  font: inherit;
}

.operations-inline-form input[type="number"] {
  max-width: 100px;
}

.account-layout {
  display: grid;
  gap: 18px;
}

.account-panel {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
}

.file-list {
  margin-top: 16px;
}

.file-list-actions {
  margin-bottom: 10px;
}

.file-list ul {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
}

.file-list li.resource-file-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.file-list li.resource-file-card.hidden {
  display: none;
}

.file-row-main {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.kb-file-name {
  display: block;
  overflow-wrap: anywhere;
}

.entity-cards {
  display: none;
  gap: 12px;
  margin-top: 18px;
}

.entity-card {
  display: block;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.entity-card.empty {
  text-align: center;
  color: var(--muted);
}

.entity-card__title {
  font-weight: 600;
  margin-bottom: 6px;
}

.entity-card__meta {
  font-size: 13px;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.pagination.top-right {
  margin-top: 8px;
}

.pagination.gmail .page-range {
  font-size: 12px;
  color: var(--muted);
}

.pagination.gmail .per-page {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pagination.gmail .per-page label {
  font-size: 12px;
  color: var(--muted);
}

.pagination.gmail .per-page select {
  height: 28px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  padding: 0 26px 0 10px;
  font-size: 12px;
  background: #fff;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 14px) 11px, calc(100% - 9px) 11px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.page-link.icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: var(--ink);
}

.page-link.icon .icon {
  width: 18px;
  height: 18px;
}

.page-link.icon.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.page-link.icon:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.empty-state {
  border: 1px dashed #cbd5f5;
  padding: 20px;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--muted);
}

.code-block {
  margin-top: 10px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 13px;
}

.code-block code {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

@media (max-width: 1100px) {
  .dashboard-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .inbox-content {
    height: auto;
    overflow: visible;
    padding: 24px 16px;
  }

  .inbox-page-card {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .inbox-shell {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .conversation-list-scroll {
    min-height: 280px;
    max-height: 45vh;
  }

  .conversation-list-pane {
    border-right: 0;
    border-bottom: 1px solid #dbe3ef;
  }

  .conversation-detail-pane {
    border-top: 0;
  }

  .conversation-frame {
    height: 72vh;
    min-height: 520px;
  }
}

@media (max-width: 860px) {
  body.mobile-chat-open {
    overflow: hidden;
  }

  .page {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 18px;
  }
  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav a {
    padding: 8px 12px;
    font-size: 14px;
  }

  .content {
    padding: 24px 16px;
  }

  .inbox-content {
    padding: 10px;
  }

  .inbox-page-card {
    border-radius: 12px;
    padding: 10px;
  }

  .inbox-shell {
    border-radius: 8px;
  }

  .conversation-list-scroll {
    max-height: calc(100dvh - 250px);
    min-height: 360px;
  }

  .conversation-detail-pane {
    display: none;
  }

  .conversation-detail-pane.mobile-open {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 0;
  }

  .mobile-conversation-header {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    z-index: 2;
  }

  .mobile-conversation-header strong {
    min-width: 0;
    overflow: hidden;
    color: #0f172a;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .conversation-detail-pane.mobile-open .conversation-frame {
    flex: 1 1 auto;
    height: calc(100dvh - 54px);
    min-height: 0;
  }

  .conversation-detail-pane.mobile-open .conversation-empty-state {
    display: none;
  }

  .dashboard-command-panel,
  .dashboard-section-heading,
  .dashboard-attention-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-command-actions,
  .dashboard-command-actions .btn,
  .dashboard-section-heading .btn,
  .dashboard-attention-item .btn {
    width: 100%;
  }

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

  .entity-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .entity-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .issue-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading {
    flex-direction: column;
    align-items: flex-start;
  }

  .kb-rebuild-section .section-heading {
    align-items: flex-start;
  }

  .kb-rebuild-section form,
  .kb-rebuild-section .btn {
    width: 100%;
  }

  .waha-heading-actions,
  .waha-session-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .waha-health-grid,
  .waha-grid {
    grid-template-columns: 1fr;
  }

  .waha-managed-qr-panel {
    grid-template-columns: 1fr;
  }

  .waha-switch-code-row {
    align-items: stretch;
    flex-direction: column;
  }

  .waha-switch-code-row .btn {
    width: 100%;
  }

  .waha-qr-image {
    width: min(220px, 100%);
    height: auto;
    aspect-ratio: 1;
  }

  .source-entry-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-disclosure-card summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .settings-disclosure-meta {
    margin-left: 0;
    max-width: 100%;
  }

  .resource-toolbar,
  .resource-card,
  .file-list li.resource-file-card {
    grid-template-columns: 1fr;
  }

  .resource-card__header,
  .resource-card__actions,
  .resource-pagination {
    align-items: flex-start;
    justify-content: flex-start;
  }

  .entity-form-actions {
    justify-content: flex-start;
  }

  .file-list li {
    align-items: flex-start;
    flex-direction: column;
  }

  .table-wrap {
    display: none;
  }

  .entity-cards {
    display: grid;
  }
}
