:root {
  color-scheme: light;
  --paper: #f6f8fc;
  --paper-2: #eef3fb;
  --white: #ffffff;
  --ink: #151821;
  --charcoal: #20232d;
  --muted: #555f72;
  --line: #cbd3e1;
  --blue: #4a9fff;
  --lavender: #9588ff;
  --sidebar: #171b26;
  --shadow: 0 24px 80px rgba(35, 44, 76, 0.18);
  font-family: "SF Pro Text", "Helvetica Neue", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

/* Layout styles must not expose controls hidden by the current client state. */
[hidden]:not([hidden="until-found" i]) { display: none !important; }

/* Available to screen readers, absent from the visual design. Used by the
   status region that announces sidebar actions. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  overflow-y: auto;
  font-size: 16px;
  line-height: 1.5;
}

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

h1, h2, h3, .wordmark, .conversation-title, .role-button-copy strong,
.message-meta, .dialog-title {
  font-family: "SF Pro Display", "Helvetica Neue", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button { color: inherit; }

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #275fc7;
  outline-offset: 3px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px 14px 16px;
  height: 100vh;
  min-height: 0;
  overflow-y: auto;
  color: #eef2fb;
  background:
    radial-gradient(circle at 0 100%, rgba(149, 136, 255, 0.2), transparent 36%),
    linear-gradient(165deg, #202942 0%, #171b26 60%);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 6px 12px;
}

.sidebar-close-button { margin-left: auto; width: 44px; height: 44px; border: 0; border-radius: 10px; color: #eef2fb; background: transparent; cursor: pointer; font-size: 26px; }
.sidebar-close-button:hover { background: rgba(255,255,255,.08); }

.scrim { position: fixed; inset: 0; z-index: 19; background: rgba(12, 18, 32, .42); }
.scrim[hidden] { display: none; }

.brand-mark, .hero-mark, .role-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--lavender));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
}

.brand-mark {
  width: 27px;
  height: 27px;
  font-size: 18px;
  font-weight: 800;
  color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--lavender));
  background-clip: text;
  -webkit-background-clip: text;
  box-shadow: none;
}

.wordmark { font-size: 15px; font-weight: 700; letter-spacing: .065em; }
.product-name { color: #c5ccdc; font-size: 12px; font-weight: 700; letter-spacing: .07em; }

.new-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 9px;
  color: #f7f9ff;
  background: transparent;
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}

.new-chat > span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: rgba(255,255,255,.09); font-size: 15px; }
.new-chat:hover { background: rgba(255,255,255,.055); }
.conversation-new-chat { margin-top: 22px; }

.role-section {
  margin-top: 7px;
  padding: 0 2px;
}
.personality-section { margin-top: 2px; }

.role-section-label {
  margin: 0 0 5px 7px;
  color: #b6bfd2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.engineering-plans-nav { display: grid; grid-template-columns: 24px minmax(0, 1fr); align-items: center; gap: 10px; width: 100%; min-height: 52px; margin: 2px 0 10px; padding: 8px 10px; border: 0; border-radius: 9px; color: #e6eaf3; background: transparent; text-align: left; cursor: pointer; }
.engineering-plans-nav[hidden], .engineering-plan-workspace > [hidden], .engineering-plan-list-pane [hidden] { display: none !important; }
.engineering-plans-nav:hover { background: rgba(255,255,255,.065); }
.engineering-plans-nav > span:last-child { display: grid; gap: 2px; }
.engineering-plans-nav strong { font-size: 14px; }
.engineering-plans-nav small { color: #aeb7ca; font-size: 11px; }

.history-heading {
  padding: 14px 10px 10px;
  color: #b6bfd2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.conversation-list { overflow-y: auto; overflow-x: hidden; padding-bottom: 150px; }

.history-row { position: relative; display: flex; align-items: center; gap: 3px; border-radius: 11px; }
.history-row:hover { background: rgba(255,255,255,.035); }

.history-item {
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 12px 12px;
  border: 0;
  border-radius: 11px;
  overflow: hidden;
  color: #d1d7e5;
  background: transparent;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.history-item:hover { color: white; background: transparent; }
.history-item.active { color: white; background: transparent; font-weight: 700; }
.conversation-menu-button {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 0 5px 5px;
  border: 0;
  border-radius: 8px;
  color: #c2cada;
  background: transparent;
  opacity: 0;
  cursor: pointer;
  font-size: 13px;
  letter-spacing: 1px;
}
.history-row:hover .conversation-menu-button,
.conversation-menu-button:focus,
.conversation-menu-button[aria-expanded="true"] { opacity: 1; }
.conversation-menu-button:hover { color: white; background: rgba(255,255,255,.07); }
.conversation-menu {
  position: absolute;
  overflow-y: auto;
  max-width: calc(100% - 4px);
  z-index: 60;
  top: 35px;
  right: 2px;
  display: grid;
  width: 186px;
  padding: 6px;
  border: 1px solid #e2e6ee;
  border-radius: 11px;
  color: #242936;
  background: white;
  box-shadow: 0 15px 38px rgba(8,13,25,.24);
}
.conversation-menu-item,
.workflow-menu-item {
  width: 100%;
  min-height: 42px;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
}
.conversation-menu-item:hover,
.workflow-menu-item:hover { background: #f2f4f8; }
.conversation-menu-item.danger { color: #c63e4f; }
.workflow-toggle::after { content: "›"; float: right; color: #929bad; font-size: 16px; }
.workflow-menu-list { margin: 2px 0 4px; padding: 4px 0 4px 9px; border-left: 1px solid #e5e8ef; }
.workflow-menu-item { min-height: 30px; color: #50596a; }
.workflow-menu-item.create { color: #5968d9; font-weight: 700; }
.history-empty { padding: 12px 10px; color: #c0c8d8; font-size: 14px; line-height: 1.55; }

.sidebar-footer {
  display: grid;
  gap: 3px;
  margin-top: auto;
  padding: 10px 0 0;
  border-top: 1px solid rgba(255,255,255,.09);
}

.settings-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 6px 9px;
  border: 0;
  border-radius: 999px;
  color: #eef2fb;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}
.settings-button:hover,
.settings-button[aria-expanded="true"] { background: rgba(255,255,255,.065); }
.settings-button-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.account-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  color: #f5f7fc;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.account-button:hover { background: rgba(255,255,255,.06); }
.account-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  color: white;
  background: rgba(255,255,255,.07);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}
.account-copy { display: grid; min-width: 0; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: 14px; font-weight: 700; }
.account-copy small { color: #bfc8da; font-size: 12px; }

.business-context-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  margin: 10px 0 2px;
  padding: 7px 8px;
  border: 0;
  border-radius: 10px;
  color: #f5f7fc;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.business-context-nav[hidden] { display: none; }
.projects-section[hidden] { display: none !important; }
.business-context-nav:hover { background: rgba(255,255,255,.06); }
.business-context-nav-icon { display: grid; place-items: center; width: 34px; height: 34px; color: #9e99ff; font-size: 25px; }
.business-context-nav > span:last-child { display: grid; min-width: 0; }
.business-context-nav strong { font-size: 14px; }
.business-context-nav small { color: #bfc8da; font-size: 12px; }

.chat-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 78px auto minmax(128px, 1fr) auto;
  min-width: 0;
  height: 100vh;
  background:
    radial-gradient(circle at 92% 5%, rgba(74, 159, 255, .12), transparent 30%),
    radial-gradient(circle at 10% 98%, rgba(149, 136, 255, .10), transparent 36%),
    linear-gradient(135deg, #fbfdff, #f4f7fc 52%, #f6f3ff);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 26px;
  border-bottom: 1px solid rgba(218, 224, 235, .82);
  background: rgba(250,252,255,.76);
  backdrop-filter: blur(18px);
}

.conversation-title { font-size: 14px; font-weight: 650; letter-spacing: -.005em; }

.role-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  padding: 4px 7px 4px 5px;
  border: 0;
  border-radius: 9px;
  color: #f5f7fc;
  background: transparent;
  cursor: pointer;
}

.role-button:hover { background: rgba(255,255,255,.055); }
.role-avatar { width: 22px; height: 25px; border-radius: 0; background: transparent; box-shadow: none; font-size: 12px; font-weight: 850; }
.role-button-copy { display: grid; gap: 1px; text-align: left; }
.role-button-copy small { color: #c0c8d8; font-size: 12px; font-weight: 600; }
.role-button-copy strong { font-size: 15px; }
.chevron { margin-left: auto; padding-right: 2px; color: #c0c8d8; font-size: 15px; }
.preview-notice { margin: 0; padding: 8px 26px; border-bottom: 1px solid rgba(218, 224, 235, .82); color: #43516b; background: rgba(231, 242, 255, .72); font-size: 12px; font-weight: 650; }

.projects-section { margin-top: 22px; min-height: 0; flex-shrink: 0; }
.sidebar-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 8px;
  color: #b6bfd2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.section-add-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: #d1d7e5;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
}
.section-add-button:hover { color: white; background: rgba(255,255,255,.08); }
.project-list { display: grid; gap: 2px; max-height: 150px; overflow-y: auto; }
.project-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  padding: 6px 9px;
  border: 0;
  border-radius: 9px;
  color: #d1d7e5;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.project-item:hover { color: white; background: rgba(255,255,255,.045); }
.project-item.active { color: white; background: transparent; font-weight: 700; }
.project-icon { width: 16px; color: #8f9aaf; font-size: 15px; text-align: center; }
.project-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.project-count { color: #b8c1d3; font-size: 12px; }

.conversation { min-height: 0; overflow-y: auto; scroll-behavior: smooth; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(760px, calc(100% - 40px));
  min-height: 100%;
  margin: 0 auto;
  padding: 22vh 0 42px;
  text-align: center;
}

.hero-mark { width: 40px; height: 40px; margin-bottom: 14px; border-radius: 0; color: transparent; background: linear-gradient(135deg, var(--blue), var(--lavender)); background-clip: text; -webkit-background-clip: text; font-size: 32px; font-weight: 850; box-shadow: none; }
.eyebrow { margin: 20px 0 8px; color: #555f72; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.empty-state[hidden] { display: none; }
.empty-state h1 { margin: 0; font-size: clamp(28px, 3.2vw, 36px); line-height: 1.12; letter-spacing: -.035em; font-weight: 650; }
.welcome-copy { max-width: 520px; margin: 17px auto 0; color: var(--muted); font-size: 17px; line-height: 1.55; }

.messages { width: min(850px, calc(100% - 44px)); margin: 0 auto; padding: 42px 0 30px; }
.messages:empty { display: none; }

.message { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 14px; margin-bottom: 30px; }
.message.user { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.message-avatar { display: grid; place-items: start center; width: 28px; height: 32px; padding-top: 2px; border-radius: 0; background: transparent; font-weight: 850; }
.message-body { max-width: 720px; color: #1d2230; font-size: 17px; font-weight: 400; line-height: 1.68; letter-spacing: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user .message-body { padding: 12px 16px; border-radius: 17px 17px 4px 17px; background: #e7ebf4; line-height: 1.5; }
.message-meta { margin-bottom: 8px; color: #4f596c; font-size: 14px; font-weight: 700; letter-spacing: 0; }
.assistant-message-content { white-space: normal; }
.assistant-message-content.plain-message-content { white-space: pre-wrap; }
.assistant-message-content p { margin: 0 0 .75em; white-space: pre-wrap; }
.assistant-message-content ul, .assistant-message-content ol { margin: .15em 0 .75em; padding-left: 1.5em; }
.assistant-message-content li { margin: .15em 0; white-space: pre-wrap; }
.assistant-message-content code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; }
.assistant-message-content pre { max-width: 100%; margin: .75em 0; padding: 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--paper-2); white-space: pre; overflow-wrap: normal; tab-size: 2; }
.assistant-message-content pre code { white-space: pre; }
.message-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-height: 32px; margin-top: 9px; }
.message-feedback-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #657084;
  background: transparent;
  cursor: pointer;
}
.message-feedback-button:hover { color: #34405a; background: #e9edf5; }
.message-feedback-button.selected { color: #4858c8; background: #e8ebff; }
.message-feedback-button:disabled { opacity: .5; cursor: wait; }
.message-feedback-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.message-feedback-status { margin-left: 4px; color: #697386; font-size: 12px; }
.message-feedback-refresh { flex: 0 0 auto; min-height: 34px; padding: 5px 9px; border: 1px solid #cbd2df; border-radius: 8px; color: #465065; background: white; cursor: pointer; font-size: 12px; }
.message-feedback-refresh[aria-disabled="true"] { color: #697386; cursor: wait; }

.message-feedback-form {
  display: grid;
  gap: 12px;
  max-width: 620px;
  margin-top: 7px;
  padding: 15px;
  border: 1px solid #d8deea;
  border-radius: 12px;
  background: #fbfcff;
}
.message-feedback-heading { color: #30394b; font-size: 14px; }
.message-feedback-choices { display: flex; flex-wrap: wrap; gap: 7px; }
.message-feedback-choices label { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 5px 10px; border: 1px solid #d7ddea; border-radius: 999px; color: #465065; background: white; cursor: pointer; font-size: 13px; }
.message-feedback-choices label:has(input:checked) { color: #3443af; border-color: #8e99e9; background: #eef0ff; }
.message-feedback-choices input { width: 17px; height: 17px; accent-color: #5865d5; }
.message-feedback-form textarea { width: 100%; min-height: 66px; padding: 9px 10px; border: 1px solid #c8cfdd; border-radius: 8px; outline: 0; color: var(--ink); background: white; resize: vertical; font-size: 14px; line-height: 1.5; }
.message-feedback-form textarea:focus { border-color: #6672df; box-shadow: 0 0 0 3px rgba(102,114,223,.12); }
.message-feedback-form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.message-feedback-form-actions button { min-height: 40px; padding: 0 13px; border: 1px solid #cbd2df; border-radius: 8px; background: white; cursor: pointer; font-size: 13px; font-weight: 750; }
.message-feedback-form-actions button.primary { color: white; border-color: #5361cd; background: #5361cd; }
.message-feedback-error { margin: 7px 0 0; color: #a0293c; font-size: 13px; }
.typing { display: inline-flex; gap: 5px; padding-top: 7px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #8792a7; animation: pulse 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .14s; }
.typing span:nth-child(3) { animation-delay: .28s; }
@keyframes pulse { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.composer-wrap { width: min(850px, calc(100% - 44px)); margin: 0 auto; padding: 10px 0 14px; }
.response-depth-bar { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 0 7px 7px; color: #555f72; }
.response-depth-bar label { color: #343c4b; font-size: 14px; font-weight: 700; }
.response-depth-bar select { min-height: 36px; padding: 4px 25px 4px 5px; border: 0; border-bottom: 1px solid #aeb8c9; border-radius: 0; color: #30384a; background-color: transparent; cursor: pointer; font-size: 15px; font-weight: 650; }
.response-depth-bar select:hover { border-bottom-color: #6f7eff; }
.response-depth-bar span { overflow: hidden; color: #626c7e; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.composer { display: flex; align-items: flex-end; gap: 12px; padding: 10px 10px 10px 17px; border: 1px solid #d4dae6; border-radius: 21px; background: rgba(255,255,255,.9); box-shadow: 0 12px 34px rgba(39,49,75,.09); }
.composer:focus-within { border-color: #9a9ff3; box-shadow: 0 12px 38px rgba(91,102,221,.14); }
.media-controls { position: relative; align-self: center; flex: 0 0 auto; }
.media-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #4b5567;
  background: transparent;
  cursor: pointer;
  font-size: 26px;
  font-weight: 350;
  line-height: 1;
}
.media-button:hover, .media-button[aria-expanded="true"] { color: #3443af; background: #eef1f8; }
.media-button:focus-visible { outline: 3px solid rgba(88,100,213,.28); outline-offset: 2px; }
.media-menu {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 13px);
  left: -8px;
  width: min(286px, calc(100vw - 42px));
  padding: 8px;
  border: 1px solid #dce1ea;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(24,31,50,.18);
}
.media-menu[hidden] { display: none; }
.media-menu-heading { padding: 8px 10px 7px; color: #697386; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.media-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 43px;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: #252b38;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 650;
  text-align: left;
}
.media-menu button:hover:not(:disabled), .media-menu button:focus-visible:not(:disabled) { background: #f1f3f8; outline: 0; }
.media-menu button span { color: #788296; font-size: 12px; font-weight: 650; }
.media-menu button:disabled { color: #747d8d; cursor: not-allowed; }
.media-menu button:disabled span { color: #929aaa; }
.media-status { margin: 5px 7px 3px; padding-top: 9px; border-top: 1px solid #e7eaf0; color: #596376; font-size: 12px; line-height: 1.45; }
.composer textarea { flex: 1; max-height: 180px; padding: 8px 0; border: 0; outline: 0; resize: none; color: var(--ink); background: transparent; font-size: 17px; line-height: 1.5; }
.composer textarea::placeholder { color: #667084; opacity: 1; }
.send-button { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 13px; color: white; background: linear-gradient(135deg, #277edc, #7465df); font-size: 22px; font-weight: 800; cursor: pointer; }
.send-button.stop-button { background: linear-gradient(135deg, #475569, #334155); font-size: 15px; }
.send-button:disabled { opacity: .45; cursor: not-allowed; }
.composer-note { margin: 8px 0 0; color: #626c7e; font-size: 12px; text-align: center; }
.composer-note.wellness-notice { max-width: 760px; margin: 9px auto 0; color: #4f596c; font-size: 13px; line-height: 1.45; }

.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 11px; background: white; cursor: pointer; font-size: 21px; }
.mobile-only { display: none; }

.role-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: min(680px, calc(100vh - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.role-dialog::backdrop { background: rgba(16,20,30,.44); backdrop-filter: blur(5px); }
.engineering-plans-dialog { width: min(980px, calc(100% - 32px)); height: min(720px, calc(100vh - 32px)); height: min(720px, calc(100dvh - 32px)); margin: auto; padding: 0; border: 0; border-radius: 18px; color: var(--ink); background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.engineering-plans-dialog::backdrop { background: rgba(16,20,30,.5); backdrop-filter: blur(5px); }
.engineering-plans-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.engineering-plans-body { display: grid; grid-template-columns: minmax(250px, 34%) minmax(0, 1fr); min-height: 0; }
.engineering-plan-list-pane { padding: 18px; border-right: 1px solid #e3e7ef; background: #f8f9fc; overflow-y: auto; }
.engineering-plan-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.engineering-plan-list-heading h3, .engineering-plan-workspace h3 { margin: 0; font-size: 19px; }
.engineering-plan-status { min-height: 20px; margin: 12px 0; color: #59667d; font-size: 13px; line-height: 1.45; }
.engineering-plan-list { display: grid; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.engineering-plan-list-item { display: grid; gap: 4px; width: 100%; min-height: 58px; padding: 10px 11px; border: 1px solid transparent; border-radius: 8px; color: #263044; background: transparent; text-align: left; cursor: pointer; }
.engineering-plan-list-item:hover { background: #eef1f7; }
.engineering-plan-list-item[aria-current="true"] { border-color: #aab4da; background: #e9edf8; }
.engineering-plan-list-item span { color: #5d687b; font-size: 12px; line-height: 1.4; }
.engineering-plan-workspace { min-width: 0; padding: 28px; overflow-y: auto; }
.engineering-plan-workspace > div, .engineering-plan-workspace > form, .engineering-plan-workspace > section { max-width: 620px; margin: 0 auto; }
.engineering-plan-workspace form { display: grid; gap: 8px; }
.engineering-plan-workspace form label { margin-top: 10px; color: #30394b; font-size: 14px; font-weight: 700; }
.engineering-plan-workspace input, .engineering-plan-workspace textarea { width: 100%; padding: 10px 12px; border: 1px solid #c8cfdd; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; line-height: 1.5; }
.engineering-plan-workspace textarea { resize: vertical; }
.engineering-plan-workspace small, .engineering-plan-boundary { color: #626d80; font-size: 12px; line-height: 1.5; }
.engineering-plan-workspace .engineering-plan-field-error { margin-top: 2px; color: #8a1d2b; font-weight: 700; }
.engineering-plan-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.engineering-plan-status-copy { padding: 11px 13px; border-left: 3px solid #7280bd; color: #364158; background: #f3f5fa; line-height: 1.5; }
.engineering-plan-team[hidden] { display: none !important; }
.engineering-plan-team-boundary { margin: 0 0 10px; color: #596274; font-size: 13px; line-height: 1.5; }
.engineering-plan-responsibility strong, .engineering-plan-responsibility span { display: block; }
.engineering-plan-responsibility span { margin-top: 2px; color: #596274; }
.engineering-plan-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.engineering-plan-facts div { padding: 10px; border: 1px solid #e0e4ec; border-radius: 8px; }
.engineering-plan-facts dt { color: #667085; font-size: 12px; }
.engineering-plan-facts dd { margin: 4px 0 0; font-weight: 700; }
.engineering-plan-workspace h4 { margin: 22px 0 8px; }
.engineering-plan-workspace li { margin-bottom: 7px; line-height: 1.5; }
.engineering-plan-workspace details { margin: 20px 0; color: #596274; }
.danger-button { min-height: 44px; padding: 9px 14px; border: 1px solid #b9364d; border-radius: 8px; color: #9e263b; background: #fff; cursor: pointer; font-weight: 700; }
.danger-button:hover { background: #fff1f3; }
.engineering-mobile-back { display: none; min-height: 44px; margin-bottom: 12px; border: 0; color: #4654b3; background: transparent; text-align: left; cursor: pointer; }
.engineering-plans-dialog :focus-visible { outline: 3px solid #3148c7; outline-offset: 3px; box-shadow: 0 0 0 6px #fff; }
.engineering-plans-nav:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px #3148c7; }
.dialog-header { display: flex; align-items: center; gap: 20px; padding: 18px 20px 14px 22px; border-bottom: 1px solid #e8ebf1; background: white; }
.dialog-header h2 { margin: 0; font-size: 23px; font-weight: 650; letter-spacing: -.03em; }
.dialog-header h2 + p { margin: 4px 0 0; color: #596274; font-size: 13px; line-height: 1.45; }
.dialog-header .icon-button { margin-left: auto; }
.dialog-header .icon-button { width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; font-size: 20px; }
.dialog-header .icon-button:hover { background: #f1f3f7; }
.role-filters { display: flex; gap: 20px; padding: 7px 22px 0; border-bottom: 1px solid #eef0f4; overflow-x: auto; }
.filter-button { min-height: 44px; padding: 10px 0 9px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: #596274; background: transparent; cursor: pointer; font-size: 14px; font-weight: 700; text-transform: capitalize; }
.filter-button.active { color: #5968d9; border-bottom-color: #7180f5; background: transparent; }
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 8px; padding: 12px 14px 16px; max-height: 526px; overflow: auto; }
.role-card { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 11px; min-height: 82px; padding: 12px; border: 0; border-radius: 11px; background: transparent; text-align: left; cursor: pointer; }
.role-card:hover { background: #f4f6fa; box-shadow: none; }
.role-card.selected { background: #eef0ff; box-shadow: none; }
.role-card.locked { color: #424a5a; }
.role-card.locked:hover, .role-card.locked:focus-visible { background: #f7f4fb; }
.role-card-symbol { display: grid; place-items: start center; width: 28px; height: 28px; padding-top: 2px; border-radius: 0; background: transparent; font-size: 14px; font-weight: 800; }
.role-card-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 7px; margin-bottom: 4px; }
.role-card h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.role-card p { display: -webkit-box; margin: 0; overflow: hidden; color: #596274; font-size: 13px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.role-access-badge, .role-usage-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; border-radius: 999px; font-size: 11px; font-weight: 750; line-height: 1; white-space: nowrap; }
.role-access-badge { color: #5946a2; background: #f0ecff; }
.role-usage-badge { color: #435066; background: #eef1f6; }
.personality-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 64px; padding: 10px 22px; border-bottom: 1px solid #eef0f4; color: #596274; font-size: 13px; }
.personality-toolbar .secondary-button { min-height: 40px; white-space: nowrap; }
.personality-grid { max-height: 470px; }
.personality-card:disabled { opacity: .58; cursor: not-allowed; }

.custom-personality-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: min(820px, calc(100vh - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.custom-personality-dialog::backdrop { background: rgba(16,20,30,.52); backdrop-filter: blur(5px); }
.custom-personality-dialog form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: inherit; }
.custom-personality-header { display: flex; align-items: flex-start; gap: 24px; padding: 22px 24px 18px; border-bottom: 1px solid #e4e8f0; background: linear-gradient(135deg, #fff, #f7f8ff); }
.custom-personality-header > div { min-width: 0; }
.custom-personality-header .icon-button { flex: 0 0 auto; margin-left: auto; border: 0; background: transparent; }
.custom-personality-eyebrow { margin: 0 0 5px; color: #5c62c8; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.custom-personality-header h2 { margin: 0; font-size: 24px; font-weight: 680; letter-spacing: -.03em; }
.custom-personality-header h2 + p { max-width: 620px; margin: 6px 0 0; color: #596274; font-size: 14px; line-height: 1.5; }
.custom-personality-body { display: grid; gap: 22px; padding: 22px 24px 28px; overflow-y: auto; }
.builder-question { min-width: 0; margin: 0; padding: 0; border: 0; }
.builder-question > label, .builder-question > legend { display: block; margin: 0 0 9px; color: #222a39; font-size: 15px; font-weight: 700; line-height: 1.4; }
.builder-question > label span { color: #697386; font-size: 12px; font-weight: 600; }
.builder-question > input, .builder-question > textarea, .builder-select-grid select { width: 100%; min-height: 46px; border: 1px solid #ccd3df; border-radius: 10px; color: #1e2635; background: #fff; font: inherit; }
.builder-question > input { padding: 10px 12px; }
.builder-question > textarea { min-height: 122px; padding: 11px 12px; resize: vertical; line-height: 1.5; }
.builder-question > input:focus, .builder-question > textarea:focus, .builder-select-grid select:focus { outline: 3px solid rgba(99,111,233,.2); border-color: #6f7eff; }
.choice-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.choice-grid label { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 7px 9px; border: 1px solid #dce1ea; border-radius: 9px; color: #374154; background: #fbfcfe; font-size: 13px; font-weight: 650; cursor: pointer; }
.choice-grid input { width: 17px; height: 17px; accent-color: #6574eb; }
.compact-choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.builder-select-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.builder-select-grid label { display: grid; gap: 6px; color: #596274; font-size: 12px; font-weight: 700; }
.builder-select-grid select { padding: 0 10px; }
.privacy-note { margin: 8px 0 0; color: #5e687b; font-size: 12px; line-height: 1.5; }
.custom-personality-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid #e4e8f0; background: #fbfcff; }
.custom-personality-actions button { min-height: 44px; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 9px; color: #8a1d2b; background: #fff0f2; font-size: 13px; font-weight: 650; }

.business-access-dialog {
  width: min(420px, calc(100% - 28px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow);
}
.business-access-dialog::backdrop { background: rgba(16,20,30,.5); backdrop-filter: blur(5px); }
.business-access-content { position: relative; padding: 28px; }
.business-access-close { position: absolute; top: 14px; right: 14px; border: 0; background: #f4f6fa; }
.business-access-eyebrow { margin: 0 48px 8px 0; color: #6458bf; font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.business-access-dialog h2 { margin: 0; font-size: 24px; font-weight: 680; letter-spacing: -.03em; }
.business-access-dialog h2 + p { margin: 8px 0 20px; color: #596274; font-size: 15px; line-height: 1.55; }
.business-access-terms { display: grid; gap: 1px; overflow: hidden; border: 1px solid #e2e6ee; border-radius: 12px; background: #e2e6ee; }
.business-access-terms div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 14px; background: #fbfcff; }
.business-access-terms strong { font-size: 14px; }
.business-access-terms span { color: #596274; font-size: 14px; text-align: right; }
.business-access-done { width: 100%; margin-top: 20px; }

.business-context-dialog {
  width: min(1120px, calc(100% - 32px));
  height: min(820px, calc(100vh - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.business-context-dialog::backdrop { background: rgba(16,20,30,.52); backdrop-filter: blur(5px); }
.business-context-dialog > form { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; height: 100%; }
.business-context-header { grid-row: 1; }
.business-context-notice {
  grid-row: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 14px;
  max-height: 35vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 24px;
  border-bottom: 1px solid #e4e8f0;
  background: #fff9e8;
}
.business-context-notice p { flex: 1 1 24rem; margin: 0; color: #705615; line-height: 1.5; }
.business-context-notice button { flex: 0 0 auto; }
.business-context-loading, .business-context-workspace { grid-row: 3; }
.business-context-footer { grid-row: 4; }
.business-context-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #e4e8f0;
  background: linear-gradient(135deg, #fff, #f7f8ff);
}
.business-context-eyebrow { margin: 0 0 5px; color: #5c62c8; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.business-context-header h2 { margin: 0; font-size: 25px; font-weight: 680; letter-spacing: -.03em; }
.business-context-header h2 + p { max-width: 650px; margin: 5px 0 0; color: #596274; font-size: 14px; }
.business-context-header-meta { display: flex; align-items: center; gap: 13px; color: #606a7c; font-size: 13px; font-weight: 700; white-space: nowrap; }
.business-context-header-meta .icon-button { border: 0; background: #f0f2f7; }
.business-context-loading { display: grid; place-items: center; min-height: 260px; padding: 32px; color: #596274; font-size: 16px; }
.business-context-workspace { display: grid; grid-template-columns: 190px minmax(0, 1fr); min-height: 0; background: #fff; }
.business-context-tabs { display: flex; flex-direction: column; gap: 3px; padding: 18px 12px; border-right: 1px solid #e4e8f0; background: #f7f9fc; }
.business-context-tab { min-height: 44px; padding: 9px 12px; border: 0; border-radius: 9px; color: #515b6d; background: transparent; text-align: left; cursor: pointer; font-size: 14px; font-weight: 700; }
.business-context-tab:hover { color: #222936; background: #eef1f7; }
.business-context-tab.active { color: #4e57c5; background: #e9ecff; }
.business-context-panels { min-width: 0; overflow-y: auto; overscroll-behavior: contain; }
.business-context-panel { width: min(100%, 820px); margin: 0 auto; padding: 26px 30px 42px; }
.business-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.business-panel-heading h3 { margin: 0; font-size: 21px; font-weight: 680; letter-spacing: -.02em; }
.business-panel-heading p { margin: 5px 0 0; color: #596274; font-size: 14px; line-height: 1.55; }
.business-add-button { flex: 0 0 auto; white-space: nowrap; }
.business-field { display: grid; gap: 7px; margin-bottom: 20px; color: #343b49; font-size: 14px; font-weight: 700; }
.business-field-label { display: block; }
.business-field input,
.business-field textarea,
.business-role-direction textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #bfc7d6;
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: #fbfcff;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  resize: vertical;
}
.business-field input { min-height: 46px; }
.business-field input:focus,
.business-field textarea:focus,
.business-role-direction textarea:focus { border-color: #6672df; box-shadow: 0 0 0 3px rgba(102,114,223,.13); }
.business-context-boundary { padding: 17px 18px; border-left: 3px solid #7774df; border-radius: 0 10px 10px 0; color: #3f4858; background: #f2f3ff; }
.business-context-boundary strong { font-size: 14px; }
.business-context-boundary p { margin: 5px 0 0; font-size: 14px; line-height: 1.6; }
.business-list { display: grid; gap: 14px; }
.business-list-empty { padding: 34px 20px; border: 1px dashed #c5ccda; border-radius: 12px; color: #657083; background: #fafbfe; text-align: center; }
.business-list-item { padding: 18px; border: 1px solid #d8dee9; border-radius: 12px; background: #fff; }
.business-list-item-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 15px; }
.business-list-item-header strong { font-size: 16px; }
.business-remove-button { min-height: 40px; padding: 5px 9px; border: 0; border-radius: 7px; color: #a62d42; background: transparent; cursor: pointer; font-size: 13px; font-weight: 700; }
.business-remove-button:hover { background: #fff0f2; }
.business-list-item-fields { display: grid; grid-template-columns: minmax(170px, .7fr) minmax(280px, 1.3fr); gap: 14px; }
.business-list-item-fields .business-field { margin-bottom: 12px; }
.business-list-item-fields .business-field:has(.business-item-source) { grid-column: 1 / -1; }
.business-role-scope { display: flex; flex-wrap: wrap; gap: 8px 15px; margin: 3px 0 0; padding: 13px 0 0; border: 0; border-top: 1px solid #edf0f5; }
.business-role-scope legend { float: left; width: 100%; margin-bottom: 7px; color: #4b5465; font-size: 13px; font-weight: 750; }
.business-role-scope label { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; color: #505a6d; cursor: pointer; font-size: 13px; }
.business-role-scope input { width: 18px; height: 18px; accent-color: #5864d5; }
.business-role-directions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.business-role-direction { display: grid; align-content: start; gap: 10px; padding: 16px; border: 1px solid #d8dee9; border-radius: 12px; }
.business-role-direction-heading { display: grid; }
.business-role-direction-heading strong { font-size: 15px; }
.business-role-direction-heading small { margin-top: 2px; color: #697386; font-size: 12px; }
.business-role-direction textarea { min-height: 128px; }
.business-context-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 20px; border-top: 1px solid #dde2eb; background: #fbfcff; }
.business-context-save-state { display: grid; min-width: 0; color: #697386; font-size: 12px; }
.business-context-save-state strong { overflow: hidden; color: #4c5668; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.business-context-save-state strong.dirty { color: #725913; }
.business-context-save-state strong.saved { color: #197043; }
.business-context-save-state strong.error,
.business-context-save-state .over-limit { color: #a72037; }
.business-context-actions { display: flex; flex: 0 0 auto; gap: 9px; }
.business-context-actions button:disabled { opacity: .55; cursor: not-allowed; }

.project-dialog {
  width: min(380px, calc(100% - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow);
}
.project-dialog::backdrop { background: rgba(16,20,30,.44); backdrop-filter: blur(5px); }
.project-dialog form { padding: 22px; }
.project-dialog h2 { margin: 0 0 5px; font-size: 20px; letter-spacing: -.02em; }
.project-dialog p { margin: 0 0 19px; color: var(--muted); font-size: 15px; }
.project-dialog label { display: block; margin-bottom: 6px; color: #3f4757; font-size: 14px; font-weight: 700; }
.project-dialog input { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: #fbfcff; font-size: 16px; }
.project-dialog input:focus { border-color: #9295ee; box-shadow: 0 0 0 2px rgba(146,149,238,.1); }
.project-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.secondary-button, .primary-button { min-height: 44px; padding: 0 16px; border-radius: 9px; cursor: pointer; font-size: 15px; font-weight: 700; }

.account-dialog {
  width: min(440px, calc(100% - 28px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.account-dialog::backdrop { background: rgba(16,20,30,.5); backdrop-filter: blur(5px); }
.account-dialog-header { display: flex; align-items: flex-start; gap: 16px; padding: 24px 24px 18px; }
.account-dialog-header > div { flex: 1; }
.account-dialog-header .icon-button { flex: 0 0 auto; border: 0; background: #f4f6fa; }
.account-brand-mark { display: block; margin-bottom: 12px; color: #6875e8; font-size: 25px; font-weight: 850; line-height: 1; }
.account-dialog h2 { margin: 0; font-size: 24px; font-weight: 680; letter-spacing: -.03em; }
.account-dialog-header p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 0 24px; border-bottom: 1px solid #e4e8f0; }
.auth-tabs[hidden], .account-data-reveal[hidden], .account-delete-reveal[hidden] { display: none; }
.auth-tab { min-height: 44px; padding: 8px 4px; border: 0; border-bottom: 2px solid transparent; color: #606a7c; background: transparent; cursor: pointer; font-weight: 700; }
.auth-tab.active { color: #4f5dce; border-bottom-color: #6875e8; }
.auth-form { padding: 20px 24px 24px; }
.auth-field { margin-bottom: 15px; }
.auth-field label { display: block; margin-bottom: 6px; color: #343b49; font-size: 14px; font-weight: 700; }
.auth-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid #bfc7d6;
  border-radius: 9px;
  color: var(--ink);
  background: #fbfcff;
  font-size: 16px;
}
.auth-field input:focus { border-color: #6c78e8; box-shadow: 0 0 0 3px rgba(108,120,232,.12); outline: 0; }
.auth-field input[aria-invalid="true"] { border-color: #b72f45; }
.field-hint { margin: 6px 0 0; color: #596274; font-size: 12px; }
.field-error, .auth-form-error { margin: 6px 0 0; color: #a72037; font-size: 13px; }
.auth-form-error { padding: 10px 12px; border-radius: 8px; background: #fff1f3; }
.auth-submit { width: 100%; min-height: 46px; margin-top: 4px; border: 0; border-radius: 10px; color: white; background: linear-gradient(135deg, #397fd1, #7569df); cursor: pointer; font-weight: 750; }
.auth-submit:disabled { opacity: .55; cursor: wait; }
.auth-text-button { min-height: 44px; padding: 8px 4px; border: 0; color: #4f5dce; background: transparent; cursor: pointer; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.auth-form-success { margin: 10px 0; padding: 10px 12px; border-radius: 8px; color: #245b3b; background: #edf8f1; font-size: 13px; line-height: 1.45; }
.account-panel { padding: 8px 24px 26px; text-align: center; }
.signed-in-avatar { display: grid; place-items: center; width: 56px; height: 56px; margin: 10px auto 12px; border-radius: 50%; color: white; background: linear-gradient(135deg, #397fd1, #7569df); font-size: 20px; font-weight: 800; text-transform: uppercase; }
.account-panel h3 { margin: 0; font-size: 20px; }
.account-panel p { margin: 5px 0 20px; color: var(--muted); overflow-wrap: anywhere; }
.account-verification { display: grid; justify-items: center; gap: 2px; margin: -8px 0 16px; color: #566176; font-size: 13px; }
.account-verification.verified { color: #245b3b; }
.account-logout { background: white; }
.account-data-reveal {
  display: block;
  min-height: 44px;
  margin: 8px auto 0;
  padding: 7px 10px;
  border: 0;
  color: #4655bd;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.account-data-reveal:disabled { color: #8a92a3; cursor: not-allowed; }
.account-data-form {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid #cbd3e4;
  border-radius: 12px;
  background: #f8faff;
  text-align: left;
}
.account-data-form h4 { margin: 0; color: #263052; font-size: 17px; }
.account-data-form > p { margin: 7px 0 16px; color: #505b70; font-size: 13px; line-height: 1.5; }
.account-delete-reveal {
  display: block;
  margin: 16px auto 0;
  padding: 7px 10px;
  border: 0;
  color: #9d2940;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.account-delete-form {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid #e5b9c2;
  border-radius: 12px;
  background: #fff8f9;
  text-align: left;
}
.account-delete-form h4 { margin: 0; color: #761c31; font-size: 17px; }
.account-delete-form > p { margin: 7px 0 16px; color: #5f4350; font-size: 13px; line-height: 1.5; }
.account-delete-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 14px; }
.danger-button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid #9d2940;
  border-radius: 9px;
  color: white;
  background: #9d2940;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}
.danger-button:disabled { opacity: .55; cursor: wait; }

.settings-dialog {
  width: min(940px, calc(100% - 32px));
  height: min(720px, calc(100vh - 42px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-dialog::backdrop { background: rgba(16,20,30,.52); backdrop-filter: blur(5px); }
.settings-dialog-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.settings-dialog-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid #e3e7ef;
}
.settings-dialog-header > div { flex: 1; }
.settings-dialog-header h2 { margin: 0; font-size: 25px; font-weight: 700; letter-spacing: -.03em; }
.settings-dialog-header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.settings-close { flex: 0 0 auto; border: 0; background: #f3f5f9; }
.settings-layout { display: grid; grid-template-columns: 215px minmax(0, 1fr); min-height: 0; }
.settings-navigation { padding: 17px 12px; border-right: 1px solid #e3e7ef; background: #f8f9fc; }
.settings-navigation-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  color: #465065;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-weight: 700;
}
.settings-navigation-item.active { color: #28345b; background: #e9edf6; }
.settings-navigation-item[hidden] { display: none !important; }
.settings-navigation-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.settings-panel { min-width: 0; overflow-y: auto; padding: 25px 28px 34px; }
.settings-panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.settings-panel-heading h3 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.settings-panel-heading p { max-width: 620px; margin: 5px 0 0; color: var(--muted); font-size: 15px; }
.connections-boundary { margin: 19px 0 18px; padding: 14px 16px; border: 1px solid #d8def0; border-radius: 12px; background: #f6f7ff; }
.connections-boundary strong { color: #293663; font-size: 14px; }
.connections-boundary p { margin: 3px 0 0; color: #4f596d; font-size: 13px; line-height: 1.55; }
.connections-status { min-height: 22px; margin: 0 0 9px; color: #515c70; font-size: 13px; }
.connections-list { display: grid; margin: 0; padding: 0; list-style: none; }
.connection-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px 2px;
  border-bottom: 1px solid #e4e8f0;
}
.connection-item:first-child { border-top: 1px solid #e4e8f0; }
.connection-copy { min-width: 0; }
.connection-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 12px; }
.connection-heading h4 { margin: 0; font-size: 16px; font-weight: 750; letter-spacing: -.01em; }
.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #525d70;
  font-size: 12px;
  font-weight: 750;
}
.connection-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8993a4; }
.connection-state.available { color: #176044; }
.connection-state.available::before { background: #2c9b70; }
.connection-state.partial { color: #4254a5; }
.connection-state.partial::before { background: #6f7eff; }
.connection-state.configuration-required { color: #7b5721; }
.connection-state.configuration-required::before { background: #c98a35; }
.connection-state.connected { color: #176044; }
.connection-state.connected::before { background: #2c9b70; }
.connection-state.needs-reauthorization { color: #7b5721; }
.connection-state.needs-reauthorization::before { background: #c98a35; }
.connection-description { margin: 5px 0 8px; color: #4d576a; font-size: 14px; line-height: 1.5; }
.connection-capabilities { margin: 0; color: #687286; font-size: 12px; line-height: 1.5; white-space: pre-line; }
.connection-account { margin: 9px 0 0; color: #35415a; font-size: 13px; font-weight: 700; }
.connection-permissions { margin-top: 8px; color: #536078; font-size: 12px; }
.connection-permissions summary { width: max-content; cursor: pointer; font-weight: 700; }
.connection-permissions ul { margin: 7px 0 0; padding-left: 20px; line-height: 1.6; }
.connection-controls { display: grid; align-content: start; justify-items: stretch; gap: 8px; width: 142px; }
.connection-policy,
.connection-button { min-height: 44px; padding: 0 12px; border: 1px solid #c8cfdd; border-radius: 9px; font-size: 13px; font-weight: 750; text-align: center; }
.connection-policy { display: grid; place-items: center; color: #515b6d; background: #f4f6f9; }
.connection-button { color: #27375e; background: #fff; cursor: pointer; }
.connection-button:hover:not(:disabled) { border-color: #7788db; background: #f4f6ff; }
.connection-button-danger { color: #8b2f35; }
.connection-button-danger:hover:not(:disabled) { border-color: #be6b72; background: #fff7f7; }
.connection-button:disabled { color: #687286; background: #f4f6f9; cursor: not-allowed; }
.connections-footnote { margin: 17px 0 0; color: #626d80; font-size: 12px; line-height: 1.55; }
.memory-status { min-height: 22px; margin: 0 0 12px; color: #515c70; font-size: 13px; }
#dismissMemoryMutationNotice { margin-bottom: 12px; }
.memory-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 16px;
  border: 1px solid #d8deeb;
  border-radius: 12px;
  background: #fbfcff;
  cursor: pointer;
}
.memory-toggle span { display: grid; gap: 3px; }
.memory-toggle strong { color: #29334b; font-size: 14px; }
.memory-toggle small { color: #626d80; font-size: 12px; line-height: 1.45; }
.memory-toggle input { width: 22px; height: 22px; flex: 0 0 auto; accent-color: #6673df; }
.memory-form { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; align-items: end; gap: 12px; margin-top: 18px; }
.memory-form label { display: grid; gap: 6px; color: #3f4757; font-size: 13px; font-weight: 700; }
.memory-form select,
.memory-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: #fbfcff; font: inherit; font-weight: 500; }
.memory-form select { min-height: 46px; padding: 0 10px; }
.memory-form textarea { min-height: 72px; padding: 10px 11px; resize: vertical; line-height: 1.45; }
.memory-form select:focus,
.memory-form textarea:focus { border-color: #6c78e8; box-shadow: 0 0 0 3px rgba(108,120,232,.12); }
.agent-name-form { grid-template-columns: minmax(0, 1fr) auto auto; }
.agent-name-form input { box-sizing: border-box; width: 100%; min-width: 0; min-height: 46px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fbfcff; font: inherit; font-weight: 500; }
.agent-name-form input:focus { border-color: #6c78e8; box-shadow: 0 0 0 3px rgba(108,120,232,.12); }
.memory-add { min-height: 46px; }
.memory-list { display: grid; gap: 0; margin: 20px 0 0; padding: 0; list-style: none; border-top: 1px solid #e4e8f0; }
.memory-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 15px 2px; border-bottom: 1px solid #e4e8f0; }
.memory-category { color: #6572cf; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.memory-content { margin: 4px 0 0; color: #30394c; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.memory-delete,
.memory-clear { min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; color: #8b2f35; background: #fff3f4; cursor: pointer; font-weight: 750; }
.memory-delete:hover,
.memory-clear:hover { background: #ffe7e9; }
.memory-delete:disabled,
.memory-clear:disabled { opacity: .55; cursor: wait; }
.memory-empty { padding: 22px 2px; color: #717b8d; font-size: 14px; border-bottom: 1px solid #e4e8f0; }
.memory-clear { margin-top: 18px; }
.feedback-boundary { border-color: #d7dcef; background: #f7f8ff; }


.calendar-dialog {
  width: min(660px, calc(100% - 28px));
  max-height: calc(100vh - 34px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 18px;
  color: var(--ink);
  background: white;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.calendar-dialog::backdrop { background: rgba(16,20,30,.54); backdrop-filter: blur(5px); }
.calendar-dialog-shell { max-height: calc(100vh - 34px); overflow-y: auto; }
.calendar-dialog-header { display: flex; align-items: flex-start; gap: 18px; padding: 22px 24px 18px; border-bottom: 1px solid #e3e7ef; }
.calendar-dialog-header > div { flex: 1; }
.calendar-dialog-header h2 { margin: 2px 0 0; font-size: 24px; letter-spacing: -.03em; }
.calendar-dialog-header h2 + p { margin: 5px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.calendar-dialog-header .icon-button { flex: 0 0 auto; border: 0; background: #f3f5f9; }
.calendar-dialog-eyebrow { margin: 0; color: #6673cf; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.calendar-event-form { padding: 22px 24px 24px; }
.calendar-event-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.calendar-field { display: grid; gap: 6px; color: #3f4757; font-size: 14px; font-weight: 700; }
.calendar-field > span { color: #737c8d; font-size: 12px; font-weight: 600; }
.calendar-field-wide { grid-column: 1 / -1; }
.calendar-field input,
.calendar-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; outline: 0; color: var(--ink); background: #fbfcff; font: inherit; font-weight: 500; }
.calendar-field input { min-height: 46px; padding: 0 12px; }
.calendar-field textarea { min-height: 82px; padding: 11px 12px; resize: vertical; }
.calendar-field input:focus,
.calendar-field textarea:focus { border-color: #6c78e8; box-shadow: 0 0 0 3px rgba(108,120,232,.12); }
.calendar-field input[readonly] { color: #4f596c; background: #f2f4f8; }
.calendar-field small { color: #697386; font-size: 12px; font-weight: 500; }
.calendar-notify { display: flex; align-items: flex-start; gap: 11px; padding: 12px 13px; border: 1px solid #d8deeb; border-radius: 10px; background: #f8f9fc; cursor: pointer; }
.calendar-notify input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: #6473de; }
.calendar-notify span { display: grid; gap: 3px; }
.calendar-notify strong { font-size: 14px; }
.calendar-notify small { color: #5c6679; font-size: 12px; line-height: 1.45; }
.calendar-form-status { margin: 0; padding: 10px 12px; border-radius: 8px; color: #92243a; background: #fff1f3; font-size: 13px; line-height: 1.45; }
.calendar-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }
.calendar-dialog-actions button,
.calendar-event-complete button { min-height: 44px; padding: 0 16px; border-radius: 9px; font-weight: 750; cursor: pointer; }
.calendar-dialog-actions button:disabled { opacity: .55; cursor: wait; }
.calendar-event-review h3 { margin: 0 0 15px; font-size: 21px; }
.calendar-review-state { width: max-content; margin: 0 0 9px; padding: 5px 8px; border-radius: 6px; color: #5f4d1f; background: #fff5d8; font-size: 12px; font-weight: 750; }
.calendar-event-review dl { display: grid; margin: 0; border-top: 1px solid #e3e7ef; }
.calendar-event-review dl > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-bottom: 1px solid #e3e7ef; }
.calendar-event-review dt { color: #677185; font-size: 13px; font-weight: 700; }
.calendar-event-review dd { margin: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.email-dialog { width: min(700px, calc(100% - 28px)); }
.email-review-body-row dd { min-height: 72px; white-space: pre-wrap; }
.calendar-event-complete.email-delivery-unknown > span { background: #a56b19; }
.calendar-event-complete.email-delivery-unknown p { max-width: 460px; margin: 6px auto 17px; line-height: 1.5; }
.calendar-confirmation-note { margin: 15px 0; color: #4f596d; font-size: 13px; line-height: 1.55; }
.calendar-event-complete { padding: 18px 0 4px; text-align: center; }
.calendar-event-complete > span { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; color: white; background: #2c9b70; font-size: 22px; font-weight: 800; }
.calendar-event-complete h3 { margin: 0; font-size: 22px; }
.calendar-event-complete p { margin: 5px 0 13px; color: var(--muted); }
.calendar-event-complete a { display: block; width: max-content; margin: 0 auto 17px; color: #4058bd; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --muted: #343b49; --line: #929bab; }
  .chat-area { background: #fff; }
  .message.user .message-body { background: #dce3ef; }
  .role-card.selected { outline: 2px solid #334fc1; }
}
.secondary-button { border: 1px solid var(--line); background: white; }
.primary-button { border: 0; color: white; background: linear-gradient(135deg, var(--blue), var(--lavender)); }

/* Short windows keep a usable transcript; the notice and composer remain
   reachable through page scrolling instead of collapsing the reading area. */
@media (max-height: 600px) {
  body { overflow-y: auto; }
  .chat-area { height: 600px; }
}

@media (max-width: 860px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: 20px 0 70px rgba(10,15,28,.25); }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: grid; }
  .role-grid { grid-template-columns: repeat(2, 1fr); }
  .choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .business-context-workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .business-context-tabs { flex-direction: row; gap: 5px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid #e4e8f0; overflow-x: auto; }
  .business-context-tab { flex: 0 0 auto; }
  .business-context-panel { padding: 22px 20px 36px; }
  .settings-dialog { width: calc(100% - 18px); height: calc(100vh - 18px); border-radius: 16px; }
  .settings-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .settings-navigation { padding: 8px 12px; border-right: 0; border-bottom: 1px solid #e3e7ef; }
  .settings-navigation-item { width: max-content; padding-inline: 12px; }
  .engineering-plans-dialog { width: calc(100% - 18px); height: calc(100vh - 18px); height: calc(100dvh - 18px); border-radius: 15px; }
  .engineering-plans-body { grid-template-columns: 1fr; }
  .engineering-plan-list-pane { border-right: 0; }
  .engineering-plan-workspace { padding: 20px 16px 28px; }
  .engineering-plans-dialog:has(.engineering-plan-workspace > form:not([hidden]), .engineering-plan-workspace > section:not([hidden])) .engineering-plan-list-pane { display: none; }
  .engineering-mobile-back { display: block; }
  .engineering-plan-facts { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar { padding: 12px 14px; }
  .preview-notice { padding: 8px 14px; }
  .empty-state { padding-top: 16vh; }
  .welcome-copy { font-size: 16px; }
  .messages, .composer-wrap { width: min(850px, calc(100% - 26px)); }
  .response-depth-bar { align-items: baseline; flex-wrap: wrap; gap: 7px; padding-inline: 3px; }
  .response-depth-bar select { flex: 1; min-width: 0; max-width: 100%; }
  .response-depth-bar span { flex-basis: 100%; overflow: visible; font-size: 13px; white-space: normal; }
  .composer { gap: 7px; padding-left: 8px; }
  .media-menu { left: -1px; }
  .role-dialog { width: calc(100% - 18px); max-height: calc(100vh - 18px); border-radius: 15px; }
  .dialog-header { padding: 16px 14px 12px 16px; }
  .dialog-header h2 { font-size: 21px; }
  .role-filters { gap: 17px; padding: 6px 16px 0; }
  .role-grid { grid-template-columns: 1fr; padding: 10px 8px 14px; }
  .personality-toolbar { align-items: flex-start; flex-direction: column; gap: 8px; padding: 12px 16px; }
  .personality-toolbar .secondary-button { width: 100%; }
  .custom-personality-dialog { width: calc(100% - 14px); max-height: calc(100vh - 14px); border-radius: 14px; }
  .custom-personality-header { padding: 18px 16px 15px; }
  .custom-personality-header h2 { font-size: 21px; }
  .custom-personality-header h2 + p { display: none; }
  .custom-personality-body { padding: 18px 16px 24px; }
  .choice-grid, .compact-choice-grid, .builder-select-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .custom-personality-actions { padding: 12px 16px; }
  .business-context-dialog { width: calc(100% - 12px); height: calc(100vh - 12px); border-radius: 14px; }
  .business-context-header { padding: 17px 16px 14px; }
  .business-context-header h2 { font-size: 22px; }
  .business-context-header h2 + p { display: none; }
  .business-context-header-meta > span { display: none; }
  .business-context-notice { padding: 12px 16px; }
  .business-context-panel { padding: 19px 15px 32px; }
  .business-panel-heading { display: grid; gap: 13px; }
  .business-add-button { width: 100%; }
  .business-list-item { padding: 15px; }
  .business-list-item-fields,
  .business-role-directions { grid-template-columns: 1fr; }
  .business-context-footer { align-items: stretch; flex-direction: column; gap: 9px; padding: 10px 13px 13px; }
  .business-context-save-state strong { white-space: normal; }
  .business-context-actions { display: grid; grid-template-columns: .7fr 1.3fr; }
  .settings-dialog-header { padding: 18px 16px 15px; }
  .settings-dialog-header h2 { font-size: 22px; }
  .settings-dialog-header p { display: none; }
  .settings-panel { padding: 20px 16px 28px; }
  .memory-form { grid-template-columns: 1fr; }
  .memory-add { width: 100%; }
  .connection-item { grid-template-columns: 1fr; gap: 10px; }
  .connection-controls { width: 100%; }
  .calendar-dialog { width: calc(100% - 14px); max-height: calc(100vh - 14px); border-radius: 14px; }
  .calendar-dialog-shell { max-height: calc(100vh - 14px); }
  .calendar-dialog-header { padding: 18px 16px 15px; }
  .calendar-dialog-header h2 { font-size: 21px; }
  .calendar-dialog-header h2 + p { display: none; }
  .calendar-event-form { padding: 18px 16px 20px; }
  .calendar-event-editor { grid-template-columns: 1fr; }
  .calendar-field-wide { grid-column: auto; }
  .calendar-event-review dl > div { grid-template-columns: 88px minmax(0, 1fr); }
  .calendar-dialog-actions { display: grid; grid-template-columns: 1fr 1.35fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
