:root {
  color-scheme: dark;
  --bg: #080a0d;
  --bg-raised: #0d1015;
  --panel: #11151c;
  --panel-2: #151a23;
  --panel-3: #1a202b;
  --line: #262d39;
  --line-soft: #1b212b;
  --text: #f3f0e9;
  --muted: #9299a7;
  --muted-2: #69717f;
  --gold: #d8b365;
  --gold-bright: #edcc7d;
  --gold-soft: rgba(216, 179, 101, 0.11);
  --cyan: #43d8e8;
  --cyan-soft: rgba(67, 216, 232, 0.10);
  --green: #56d58c;
  --green-soft: rgba(86, 213, 140, 0.11);
  --coral: #ef8576;
  --coral-soft: rgba(239, 133, 118, 0.11);
  --blue: #84a9ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 262px;
  --topbar: 78px;
  --composer-bottom: max(18px, env(safe-area-inset-bottom));
  --ui: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* Public QualeQuest PA requests */
.request-detail { display: grid; gap: 24px; }
.request-detail-kicker { display: flex; align-items: center; gap: 12px; margin: 10px 0 8px; color: var(--muted); font-family: var(--mono); font-size: .72rem; }
.request-block,
.request-consent { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); padding: clamp(18px, 3vw, 28px); }
.request-summary { white-space: pre-wrap; font-size: 1.05rem; line-height: 1.7; }
.request-areas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.request-areas span { border: 1px solid rgba(216, 179, 101, .28); color: var(--gold); border-radius: 999px; padding: 6px 10px; font: 500 .68rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.request-message { border-top: 1px solid var(--line); padding: 14px 0 0; margin-top: 14px; }
.request-message strong { color: var(--cyan); font: 500 .68rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.request-message p { white-space: pre-wrap; margin: 7px 0 0; }
.request-consent { border-color: rgba(48, 201, 196, .28); }
.request-consent > strong { color: var(--cyan); }
.request-consent p { color: var(--muted); margin: 8px 0; }
.request-consent code { display: block; overflow-wrap: anywhere; color: var(--muted-2); font-size: .67rem; }
.request-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.status-badge.new { color: var(--gold); border-color: rgba(216, 179, 101, .28); background: rgba(201, 162, 39, .08); }
.status-badge.reviewing,
.status-badge.reply_drafted { color: var(--cyan); border-color: rgba(48, 201, 196, .28); background: rgba(48, 201, 196, .07); }
.status-badge.contacted,
.status-badge.closed { color: var(--green); border-color: rgba(75, 205, 137, .25); background: rgba(75, 205, 137, .07); }
.status-badge.declined,
.status-badge.spam { color: var(--muted); border-color: var(--line); }

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button,
select {
  cursor: pointer;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button {
  border: 0;
}

a {
  color: var(--cyan);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-weight: 500;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: 0;
  background: #0b0e13;
}

input,
select {
  min-height: 44px;
  padding: 0 13px;
}

textarea {
  min-height: 108px;
  padding: 12px 13px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(67, 216, 232, 0.14);
  outline: 0;
}

::selection {
  background: rgba(67, 216, 232, 0.23);
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 7px;
  background: var(--cyan);
  color: #061013;
  font-weight: 800;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
  line-height: 1.4;
  text-transform: uppercase;
}

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

.fine-print {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11px;
}

.mono {
  font-family: var(--mono);
}

.text-gold {
  color: var(--gold-bright);
}

.text-cyan {
  color: var(--cyan);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px rgba(105, 113, 127, 0.1);
}

.status-dot.online,
.status-dot-green {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(86, 213, 140, 0.11), 0 0 12px rgba(86, 213, 140, 0.4);
}

.status-dot-cyan {
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(67, 216, 232, 0.11), 0 0 12px rgba(67, 216, 232, 0.35);
}

.status-dot.error {
  background: var(--coral);
}

.icon-button {
  display: inline-grid;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.icon-button:hover {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.primary-button,
.secondary-button,
.danger-button,
.ghost-button,
.text-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.primary-button {
  border-color: var(--gold);
  background: var(--gold);
  color: #151007;
}

.primary-button:hover {
  border-color: var(--gold-bright);
  background: var(--gold-bright);
}

.secondary-button {
  border-color: var(--line);
  background: var(--panel-2);
  color: var(--text);
}

.secondary-button:hover {
  border-color: #3d4656;
  background: var(--panel-3);
}

.ghost-button {
  border-color: var(--line-soft);
  background: transparent;
  color: var(--muted);
}

.ghost-button:hover {
  border-color: var(--line);
  color: var(--text);
}

.danger-button {
  border-color: rgba(239, 133, 118, 0.4);
  background: var(--coral-soft);
  color: #ffaaa0;
}

.danger-button:hover {
  border-color: var(--coral);
}

.text-button {
  min-height: 36px;
  padding: 0 9px;
  background: transparent;
  color: var(--cyan);
}

.compact-button {
  min-height: 36px;
  padding-inline: 11px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

/* Login */
.login-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  overflow: hidden;
  padding: 28px 18px;
}

.login-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(50% - 1px), rgba(216, 179, 101, 0.04) 50%, transparent calc(50% + 1px)),
    radial-gradient(circle at 18% 22%, rgba(67, 216, 232, 0.07), transparent 31%),
    radial-gradient(circle at 82% 78%, rgba(216, 179, 101, 0.08), transparent 34%);
}

.login-atmosphere::after {
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(216, 179, 101, 0.08);
  content: "";
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  border: 1px solid var(--line);
  border-top-color: rgba(216, 179, 101, 0.52);
  border-radius: 18px;
  padding: 38px;
  background: rgba(13, 16, 21, 0.96);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(216, 179, 101, 0.6);
  border-radius: 9px;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 21px;
}

.brand-mark-large {
  width: 52px;
  height: 52px;
  margin-bottom: 28px;
  border-radius: 12px;
  font-size: 28px;
}

.login-card h1 {
  margin-bottom: 9px;
  font-family: var(--display);
  font-size: clamp(34px, 8vw, 46px);
  letter-spacing: -0.025em;
  line-height: 1.05;
}

.login-copy {
  margin-bottom: 29px;
  color: var(--muted);
}

.login-form label {
  display: block;
  margin-bottom: 7px;
  color: #c7cbd2;
  font-size: 12px;
  font-weight: 700;
}

.password-field {
  position: relative;
}

.password-field input {
  height: 51px;
  padding-right: 65px;
  font-size: 16px;
}

.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 55px;
  min-height: 43px;
  font-size: 12px;
}

.form-error {
  min-height: 21px;
  margin: 8px 0 8px;
  color: #ff9d92;
  font-size: 12px;
}

.login-button {
  width: 100%;
  min-height: 50px;
  justify-content: space-between;
}

.login-assurance {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 23px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* Shell */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  width: var(--sidebar);
  flex-direction: column;
  border-right: 1px solid var(--line-soft);
  background: #0b0e12;
}

.sidebar-head {
  display: flex;
  min-height: var(--topbar);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 17px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: transparent;
  text-align: left;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
}

.brand-lockup strong {
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 500;
}

.brand-lockup small {
  margin-top: 1px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.drawer-close {
  display: none;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 12px;
}

.drawer-tab {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font: 700 9px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.drawer-tab.active {
  border-color: rgba(216, 179, 101, .65);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.drawer-panel {
  min-height: 0;
  flex: 1;
}

.drawer-menu-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.drawer-recent-panel {
  display: grid;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.drawer-new-chat {
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 12px;
}

.drawer-new-chat .primary-button {
  width: 100%;
}

.drawer-new-chat p {
  margin: 9px 3px 0;
  color: var(--muted-2);
  font-size: 10px;
}

.drawer-recent-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.nav-groups {
  flex: 1;
  overflow-y: auto;
  padding: 17px 12px;
  scrollbar-width: thin;
}

.nav-group + .nav-group {
  margin-top: 20px;
}

.nav-label {
  margin: 0 10px 7px;
  color: #555e6d;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.nav-item {
  display: grid;
  width: 100%;
  min-height: 42px;
  grid-template-columns: 27px minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0 10px;
  background: transparent;
  color: #9da4b1;
  font-size: 13px;
  text-align: left;
}

.nav-item:hover {
  background: var(--panel);
  color: var(--text);
}

.nav-item.active {
  border-color: rgba(216, 179, 101, 0.17);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.nav-item.active .nav-icon {
  color: var(--gold-bright);
}

.nav-icon {
  color: #6f7888;
  font-size: 17px;
  line-height: 1;
}

.nav-badge {
  min-width: 20px;
  border-radius: 20px;
  padding: 2px 6px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
}

.nav-badge-gold {
  background: var(--gold-soft);
  color: var(--gold-bright);
}

kbd {
  border: 1px solid var(--line);
  border-bottom-color: #3b4350;
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--panel);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
}

.sidebar-foot {
  border-top: 1px solid var(--line-soft);
  padding: 11px 12px max(12px, env(safe-area-inset-bottom));
}

.qq-presence {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 7px 0;
  border-top: 1px solid var(--line-soft);
  padding: 14px 3px 3px;
}

.qq-presence strong,
.qq-presence small {
  display: block;
}

.qq-presence strong {
  color: #c9cdd4;
  font-size: 11px;
}

.qq-presence small {
  color: var(--muted-2);
  font-size: 9px;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar);
}

body.chat-route {
  height: 100dvh;
  overflow: hidden;
}

body.chat-route .app-shell,
body.chat-route .workspace {
  height: 100dvh;
  min-height: 0;
}

body.chat-route .workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

body.chat-route .topbar {
  position: relative;
}

body.chat-route .main-view {
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
  padding: clamp(10px, 1.6vw, 22px) clamp(10px, 2vw, 28px);
}

body.chat-route .main-view > .page,
body.chat-route .chat-shell {
  height: 100%;
  min-height: 0;
}

body.chat-route .global-composer {
  position: relative;
  bottom: auto;
  left: auto;
  width: min(880px, calc(100% - 28px));
  margin: 8px auto max(10px, env(safe-area-inset-bottom));
  transform: none;
}

.topbar {
  position: sticky;
  z-index: 25;
  top: 0;
  display: flex;
  min-height: var(--topbar);
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line-soft);
  padding: 0 clamp(20px, 3vw, 42px);
  background: rgba(8, 10, 13, 0.93);
  backdrop-filter: blur(16px);
}

.menu-button {
  display: none;
  font-size: 19px;
}

.topbar-title {
  min-width: 0;
  margin-right: auto;
}

.topbar-title .eyebrow {
  margin-bottom: 0;
}

.topbar-title h1 {
  overflow: hidden;
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.search-launch {
  display: flex;
  min-width: 178px;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  background: var(--panel);
  color: var(--muted);
  text-align: left;
}

.search-launch span:nth-child(2) {
  flex: 1;
}

.search-launch:hover {
  border-color: #394250;
  color: var(--text);
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.avatar {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(216, 179, 101, 0.45);
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 17px;
}

.main-view {
  width: min(100%, 1440px);
  min-height: calc(100vh - var(--topbar));
  margin: 0 auto;
  padding: clamp(24px, 3.3vw, 48px) clamp(20px, 3.5vw, 52px) 136px;
}

.drawer-scrim {
  display: none;
}

/* Global composer */
.global-composer {
  position: fixed;
  z-index: 30;
  bottom: var(--composer-bottom);
  left: calc(var(--sidebar) + (100vw - var(--sidebar)) / 2);
  display: grid;
  width: min(880px, calc(100vw - var(--sidebar) - 70px));
  min-height: 58px;
  grid-template-columns: 42px minmax(0, 1fr) 80px 42px;
  align-items: end;
  gap: 8px;
  border: 1px solid #303846;
  border-radius: 16px;
  padding: 7px;
  background: rgba(18, 22, 29, 0.97);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.52);
  transform: translateX(-50%);
  backdrop-filter: blur(18px);
}

.global-composer:focus-within {
  border-color: rgba(67, 216, 232, 0.52);
  box-shadow: 0 0 0 3px rgba(67, 216, 232, 0.08), 0 18px 60px rgba(0, 0, 0, 0.52);
}

.global-composer textarea {
  max-height: 150px;
  min-height: 42px;
  border: 0;
  padding: 10px 6px;
  background: transparent;
  resize: none;
}

.global-composer textarea:focus {
  box-shadow: none;
}

.composer-plus,
.send-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
}

.composer-plus {
  background: var(--panel-3);
  color: var(--muted);
  font-size: 20px;
}

.send-button {
  background: var(--gold);
  color: #171107;
  font-size: 21px;
  font-weight: 800;
}

.thinking-select {
  min-height: 42px;
  border-color: var(--line-soft);
  padding: 0 7px;
  background: var(--panel);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

/* Shared page and card patterns */
.page {
  animation: page-in 170ms ease-out;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 27px;
}

.page-heading h2 {
  margin-bottom: 6px;
  font-family: var(--display);
  font-size: clamp(30px, 4vw, 45px);
  letter-spacing: -0.025em;
  line-height: 1.06;
}

.page-heading p:last-child {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
}

.page-heading-compact {
  align-items: center;
}

.page-heading-compact h2 {
  font-size: clamp(27px, 3vw, 36px);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.panel-gold {
  border-color: rgba(216, 179, 101, 0.35);
}

.panel-cyan {
  border-color: rgba(67, 216, 232, 0.30);
}

.panel-pad {
  padding: clamp(18px, 2.3vw, 27px);
}

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

.section-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
}

.section-head .eyebrow {
  margin: 0;
}

.section-count {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
}

.divider {
  height: 1px;
  margin: 19px 0;
  background: var(--line-soft);
}

.stack {
  display: grid;
  gap: 13px;
}

.stack-tight {
  display: grid;
  gap: 8px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 20px;
}

.three-column {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar .grow {
  flex: 1;
}

.filter-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 4px;
  background: #0b0e13;
}

.filter-button {
  min-height: 34px;
  border-radius: 7px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.filter-button:hover {
  color: var(--text);
}

.filter-button.active {
  background: var(--panel-3);
  color: var(--gold-bright);
}

.search-field {
  position: relative;
}

.search-field::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  color: var(--muted-2);
  content: "⌕";
  font-size: 17px;
  transform: translateY(-52%);
}

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

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

.field-grid .span-all {
  grid-column: 1 / -1;
}

.field label,
.form-field label {
  display: block;
  margin-bottom: 6px;
  color: #b7bdc7;
  font-size: 11px;
  font-weight: 700;
}

.field-hint {
  margin: 5px 0 0;
  color: var(--muted-2);
  font-size: 10px;
}

.status-badge,
.identity-badge,
.source-badge {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2px 8px;
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.status-badge.pending_approval,
.status-badge.active,
.status-badge.next {
  border-color: rgba(216, 179, 101, 0.28);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.status-badge.sent,
.status-badge.done,
.status-badge.ok {
  border-color: rgba(86, 213, 140, 0.26);
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.blocked,
.status-badge.failed,
.status-badge.send_unknown,
.status-badge.error {
  border-color: rgba(239, 133, 118, 0.28);
  background: var(--coral-soft);
  color: #ffa197;
}

.status-badge.sending,
.status-badge.processing {
  border-color: rgba(67, 216, 232, 0.28);
  background: var(--cyan-soft);
  color: var(--cyan);
}

.identity-badge.gmail {
  border-color: rgba(67, 216, 232, 0.26);
  color: var(--cyan);
}

.identity-badge.qualequest,
.source-badge.praxis {
  border-color: rgba(216, 179, 101, 0.3);
  color: var(--gold-bright);
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 34px;
  text-align: center;
}

.empty-state-compact {
  min-height: 130px;
  padding: 20px;
}

.empty-state .empty-icon {
  margin-bottom: 10px;
  color: var(--muted-2);
  font-family: var(--display);
  font-size: 34px;
}

.empty-state h3 {
  margin-bottom: 6px;
  font-family: var(--display);
  font-size: 21px;
}

.empty-state p {
  max-width: 420px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.loading-state {
  display: grid;
  min-height: 300px;
  place-items: center;
  color: var(--muted);
}

.spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-state {
  border-color: rgba(239, 133, 118, 0.25);
}

/* Dashboard */
.greeting-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.greeting-title {
  margin-bottom: 9px;
  font-family: var(--display);
  font-size: clamp(38px, 5vw, 57px);
  letter-spacing: -0.035em;
  line-height: 1;
}

.greeting-title em {
  color: var(--gold-bright);
  font-style: normal;
}

.dashboard-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 30px;
}

.dashboard-intro > p {
  max-width: 570px;
  margin-bottom: 3px;
  color: var(--muted);
}

.last-updated {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
  text-align: right;
  text-transform: uppercase;
}

.needs-card {
  display: grid;
  min-height: 91px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 17px;
  margin-bottom: 18px;
  border: 1px solid rgba(67, 216, 232, 0.33);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 18px 21px;
  background: var(--cyan-soft);
}

.needs-card.clear {
  border-color: rgba(86, 213, 140, 0.27);
  background: var(--green-soft);
}

.needs-number {
  color: var(--cyan);
  font-family: var(--display);
  font-size: 34px;
  line-height: 1;
}

.needs-card.clear .needs-number {
  color: var(--green);
}

.needs-copy strong,
.needs-copy span {
  display: block;
}

.needs-copy strong {
  margin-bottom: 3px;
  font-family: var(--display);
  font-size: 18px;
  font-weight: 500;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 23px;
}

.metric-card {
  min-height: 105px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 17px;
  background: var(--panel);
}

.metric-card button {
  width: 100%;
  padding: 0;
  background: transparent;
  text-align: left;
}

.metric-card:hover {
  border-color: #37404d;
}

.metric-value {
  display: block;
  margin-bottom: 13px;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 30px;
  line-height: 1;
}

.metric-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(330px, 0.95fr);
  gap: 18px;
}

.dashboard-column {
  display: grid;
  align-content: start;
  gap: 18px;
}

.compact-list {
  display: grid;
  gap: 2px;
}

.compact-row {
  display: grid;
  width: 100%;
  min-height: 60px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
  border-top: 1px solid var(--line-soft);
  padding: 10px 2px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.compact-row:first-child {
  border-top: 0;
}

.compact-row:hover .row-title {
  color: var(--gold-bright);
}

.row-title,
.row-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title {
  color: #dfe2e8;
  font-size: 13px;
  font-weight: 650;
}

.row-meta {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
}

.continuity-card {
  overflow: hidden;
  border: 1px solid rgba(216, 179, 101, 0.3);
  border-radius: var(--radius);
  background: var(--gold-soft);
}

.continuity-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
}

.continuity-symbol {
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 30px;
  line-height: 1;
}

.continuity-card h3 {
  margin-bottom: 5px;
  font-family: var(--display);
  font-size: 19px;
}

.continuity-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.continuity-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid rgba(216, 179, 101, 0.14);
}

.continuity-stats div {
  padding: 13px 20px;
}

.continuity-stats div + div {
  border-left: 1px solid rgba(216, 179, 101, 0.14);
}

.continuity-stats strong,
.continuity-stats span {
  display: block;
}

.continuity-stats strong {
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
}

.continuity-stats span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Split views */
.split-shell {
  display: grid;
  min-height: min(720px, calc(100vh - 235px));
  grid-template-columns: minmax(285px, 0.38fr) minmax(0, 0.62fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.split-list {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: #0d1015;
}

.split-list-head {
  position: sticky;
  z-index: 3;
  top: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px;
  background: #0d1015;
}

.split-list-scroll {
  max-height: calc(100vh - 330px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.split-detail {
  min-width: 0;
  overflow-y: auto;
  background: var(--panel);
}

.split-back {
  display: none;
}

.list-entry {
  position: relative;
  display: block;
  width: 100%;
  min-height: 102px;
  border-bottom: 1px solid var(--line-soft);
  padding: 15px 16px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.list-entry:hover {
  background: var(--panel);
}

.list-entry.selected {
  background: var(--panel-2);
  box-shadow: inset 3px 0 var(--gold);
}

.list-entry.unread::after {
  position: absolute;
  top: 20px;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  content: "";
}

.list-entry-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.list-entry-name {
  overflow: hidden;
  flex: 1;
  color: #e1e3e8;
  font-size: 12px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-entry-time {
  flex: 0 0 auto;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
}

.list-entry-subject {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  color: #c6cbd3;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-entry-snippet {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 10px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.detail-head {
  border-bottom: 1px solid var(--line);
  padding: clamp(19px, 2.5vw, 29px);
}

.detail-head h2 {
  margin: 9px 0 15px;
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}

.message-addressing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 15px;
  color: var(--muted);
  font-size: 11px;
}

.address-line + .address-line {
  margin-top: 3px;
}

.address-line strong {
  color: #cdd1d8;
}

.message-body {
  min-height: 180px;
  padding: clamp(22px, 3vw, 36px);
  color: #d6d9df;
  font-family: Georgia, serif;
  font-size: 15px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.no-message-body {
  display: grid;
  gap: 5px;
  margin: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 16px;
  background: var(--panel-2);
  color: var(--muted);
}

.no-message-body strong {
  color: var(--text);
}

.email-attachments {
  margin: 0 clamp(18px, 3vw, 32px) clamp(22px, 3vw, 32px);
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.attachment-list {
  display: grid;
  gap: 9px;
}

.attachment-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  background: var(--panel-2);
}

.attachment-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(216, 179, 101, .35);
  border-radius: 8px;
  color: var(--gold-bright);
  font: 700 8px/1 var(--mono);
}

.attachment-copy,
.attachment-copy strong,
.attachment-copy span,
.attachment-copy small {
  display: block;
  min-width: 0;
}

.attachment-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-copy span,
.attachment-copy small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
  overflow-wrap: anywhere;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.attachment-text {
  max-height: 62vh;
  overflow: auto;
  margin: 0;
  color: #d7dbe2;
  font: 12px/1.65 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.extraction-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  font: 700 8px/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.extraction-pill.complete,
.extraction-pill.truncated {
  border-color: rgba(86, 213, 140, .3);
  background: var(--green-soft);
  color: var(--green);
}

.extraction-pill.failed,
.extraction-pill.unsupported {
  border-color: rgba(239, 133, 118, .28);
  background: var(--coral-soft);
  color: var(--coral);
}

.file-extraction-state {
  display: grid;
  gap: 4px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px;
  background: var(--panel-2);
  color: var(--muted);
}

.file-extraction-state.complete strong,
.file-extraction-state.truncated strong {
  color: var(--green);
}

.file-extraction-state.failed strong,
.file-extraction-state.unsupported strong {
  color: var(--coral);
}

.reply-box {
  margin: 0 clamp(18px, 3vw, 32px) clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0d1015;
}

.reply-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 15px;
}

.reply-box-head strong {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 500;
}

.reply-form {
  display: grid;
  gap: 11px;
  padding: 15px;
}

.reply-form textarea {
  min-height: 150px;
}

/* Chat + Praxis */
.chat-shell {
  display: grid;
  min-height: min(720px, calc(100vh - 190px));
  grid-template-columns: 280px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.conversation-rail {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #0d1015;
}

.conversation-rail-head {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.conversation-list {
  flex: 1;
  overflow-y: auto;
}

.conversation-entry {
  display: block;
  width: 100%;
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 15px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.conversation-entry:hover,
.conversation-entry.selected {
  background: var(--panel-2);
}

.conversation-entry.selected {
  box-shadow: inset 3px 0 var(--cyan);
}

.conversation-entry strong {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  color: #daddE3;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-entry span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.chat-stage {
  position: relative;
  display: grid;
  min-height: 0;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.chat-head {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 63px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 18px;
}

.chat-head h2 {
  overflow: hidden;
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-title {
  min-width: 0;
  flex: 1;
}

.chat-title p {
  overflow: hidden;
  margin: 3px 0 0;
  color: var(--muted-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-mobile-actions {
  display: none;
}

.think-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.think-control label {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.think-control select {
  width: 82px;
  min-height: 34px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 10px;
}

.message-stream {
  width: 100%;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px clamp(17px, 3vw, 34px);
  scroll-behavior: smooth;
}

.jump-latest {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 14px;
  min-height: 38px;
  border: 1px solid rgba(216, 179, 101, .5);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(18, 22, 29, .96);
  color: var(--gold-bright);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  font: 700 10px/1 var(--mono);
}

.chat-message {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  max-width: 880px;
  margin: 0 auto 24px;
}

.chat-message.user {
  grid-template-columns: minmax(0, 1fr) 32px;
}

.message-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 14px;
}

.chat-message.user .message-avatar {
  grid-column: 2;
  grid-row: 1;
  border-color: rgba(67, 216, 232, 0.25);
  color: var(--cyan);
}

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

.message-meta {
  margin-bottom: 6px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.chat-message.user .message-meta {
  text-align: right;
}

.message-text {
  color: #d8dbe1;
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message.assistant .message-text {
  white-space: normal;
}

.message-text p {
  margin: 0 0 0.72em;
}

.message-text p:last-child {
  margin-bottom: 0;
}

.message-text ul,
.message-text ol {
  display: grid;
  gap: 0.34em;
  margin: 0.42em 0 0.8em;
  padding-left: 1.35em;
}

.message-text ul:last-child,
.message-text ol:last-child {
  margin-bottom: 0;
}

.message-text strong {
  color: var(--text);
  font-weight: 750;
}

.message-text h1,
.message-text h2,
.message-text h3,
.message-text h4,
.message-text h5,
.message-text h6 {
  margin: 1em 0 .45em;
  color: var(--text);
  font-family: var(--display);
  line-height: 1.2;
}

.message-text h1:first-child,
.message-text h2:first-child,
.message-text h3:first-child {
  margin-top: 0;
}

.message-text blockquote {
  margin: .7em 0;
  border-left: 3px solid var(--gold);
  padding: .15em 0 .15em 1em;
  color: #bfc4cc;
}

.message-text hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1em 0;
}

.message-text pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: #080a0d;
  white-space: pre;
}

.message-text code {
  border-radius: 4px;
  padding: .12em .34em;
  background: #080a0d;
  color: #dce4ed;
  font: .9em/1.5 var(--mono);
}

.message-text pre code {
  padding: 0;
  background: transparent;
}

.chat-message.user .message-text {
  border: 1px solid rgba(67, 216, 232, 0.17);
  border-radius: 12px 3px 12px 12px;
  padding: 12px 14px;
  background: var(--cyan-soft);
}

.conversation-sheet {
  width: min(520px, calc(100vw - 28px));
  max-height: min(680px, 82dvh);
  margin: auto auto 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 -24px 80px rgba(0, 0, 0, 0.55);
}

.conversation-sheet::backdrop {
  background: rgba(1, 2, 3, 0.72);
  backdrop-filter: blur(2px);
}

.conversation-sheet-card {
  display: grid;
  max-height: min(680px, 82dvh);
  grid-template-rows: auto auto minmax(0, 1fr);
}

.conversation-sheet-head {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
}

.conversation-sheet-head .eyebrow {
  margin-bottom: 3px;
}

.conversation-sheet-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 24px;
}

.conversation-sheet-new {
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 18px;
}

.conversation-sheet-new .primary-button {
  width: 100%;
  min-height: 44px;
}

.conversation-sheet-list {
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.conversation-sheet .conversation-entry {
  min-height: 62px;
  padding: 13px 18px;
}

.action-receipts {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.action-receipt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #0b0e13;
  color: var(--muted);
  font-size: 10px;
}

.action-receipt.ok .receipt-icon {
  color: var(--green);
}

.action-receipt.error .receipt-icon {
  color: var(--coral);
}

.receipt-copy {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.web-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.web-source-link {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
  border: 1px solid rgba(67, 216, 232, 0.16);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(67, 216, 232, 0.05);
  color: var(--cyan);
  text-decoration: none;
}

.web-source-link:hover,
.web-source-link:focus-visible {
  border-color: rgba(67, 216, 232, 0.4);
  background: rgba(67, 216, 232, 0.1);
}

.web-source-link span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
}

.web-source-link b {
  color: var(--muted-2);
  font-weight: 400;
}

.chat-input-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 13px;
  background: #0d1015;
}

.chat-input-form textarea {
  max-height: 160px;
  min-height: 46px;
  padding-block: 11px;
  resize: none;
}

.chat-input-form .send-button {
  width: 46px;
  height: 46px;
}

.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.thinking-indicator i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.1s infinite ease-in-out;
}

.thinking-indicator i:nth-child(2) { animation-delay: 0.15s; }
.thinking-indicator i:nth-child(3) { animation-delay: 0.3s; }

@keyframes pulse {
  0%, 70%, 100% { opacity: 0.25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.praxis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.praxis-card {
  min-height: 155px;
  border: 1px solid var(--line);
  border-top-color: rgba(216, 179, 101, 0.45);
  border-radius: 12px;
  padding: 18px;
  background: var(--panel);
  color: inherit;
  text-align: left;
}

.praxis-card:hover {
  border-color: rgba(216, 179, 101, 0.52);
  background: var(--panel-2);
}

.praxis-card h3 {
  display: -webkit-box;
  overflow: hidden;
  margin: 20px 0 16px;
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.praxis-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
}

.history-viewer {
  max-width: 900px;
  margin: 0 auto;
}

.history-viewer .message-stream {
  max-height: none;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

/* Draft review */
.draft-review {
  padding: clamp(19px, 2.8vw, 32px);
}

.draft-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 23px;
}

.draft-review-head h2 {
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: clamp(23px, 3vw, 32px);
  line-height: 1.15;
}

.revision-stamp {
  flex: 0 0 auto;
  border: 1px solid rgba(216, 179, 101, 0.31);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--gold-soft);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

.draft-safety {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  margin-bottom: 18px;
  border: 1px solid rgba(67, 216, 232, 0.22);
  border-radius: 9px;
  padding: 12px;
  background: var(--cyan-soft);
  color: #b9c8cc;
  font-size: 11px;
}

.draft-safety strong {
  color: var(--cyan);
}

.draft-editor {
  display: grid;
  gap: 13px;
}

.draft-editor textarea {
  min-height: 260px;
  font-family: Georgia, serif;
  line-height: 1.65;
}

.draft-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 17px;
  border-top: 1px solid var(--line);
  padding-top: 17px;
}

.draft-actions-right {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.approve-button {
  min-width: 150px;
}

.audit-timeline {
  display: grid;
  gap: 0;
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.audit-event {
  position: relative;
  display: grid;
  grid-template-columns: 11px minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 45px;
  color: var(--muted);
  font-size: 10px;
}

.audit-event::before {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--gold);
  content: "";
}

.audit-event:not(:last-child)::after {
  position: absolute;
  top: 14px;
  bottom: -1px;
  left: 3px;
  width: 1px;
  background: var(--line);
  content: "";
}

.audit-event strong {
  display: block;
  color: #cbd0d8;
  font-size: 11px;
}

.audit-event time {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
}

/* Tasks, captures, files, notes */
.create-panel {
  margin-bottom: 18px;
}

.create-panel summary {
  display: flex;
  min-height: 53px;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  color: var(--gold-bright);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.create-panel summary::-webkit-details-marker { display: none; }

.create-panel summary::after {
  content: "+";
  font-size: 20px;
  font-weight: 400;
}

.create-panel[open] summary::after { content: "−"; }

.create-panel form {
  border-top: 1px solid var(--line);
  padding: 18px;
}

.task-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.task-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 120px 105px auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px 15px;
  background: var(--panel);
}

.task-row:last-child {
  border-bottom: 0;
}

.task-row:hover {
  background: var(--panel-2);
}

.task-check {
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid #47505e;
  border-radius: 6px;
  background: transparent;
  color: transparent;
}

.task-check:hover {
  border-color: var(--green);
  color: var(--green);
}

.task-title {
  overflow: hidden;
  color: #dde0e6;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-detail {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-row select {
  min-height: 34px;
  padding: 0 7px;
  font-size: 10px;
}

.task-due {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
}

.capture-grid,
.note-grid,
.file-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.capture-card,
.note-card,
.file-card {
  display: flex;
  min-width: 0;
  min-height: 190px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
  background: var(--panel);
  color: inherit;
  text-align: left;
}

.capture-card:hover,
.note-card:hover,
.file-card:hover {
  border-color: #394250;
  background: var(--panel-2);
}

.capture-card-head,
.note-card-head,
.file-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 17px;
}

.capture-kind {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.capture-card h3,
.note-card h3,
.file-card h3 {
  overflow: hidden;
  margin-bottom: 9px;
  font-family: var(--display);
  font-size: 18px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.capture-card p,
.note-card p,
.file-card p {
  display: -webkit-box;
  overflow: hidden;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 11px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 8px;
}

.file-symbol {
  display: grid;
  width: 36px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(216, 179, 101, 0.34);
  border-radius: 6px;
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}

.file-card {
  min-height: 205px;
}

.detail-overlay {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 4, 6, 0.78);
  backdrop-filter: blur(8px);
}

.detail-overlay-card {
  display: flex;
  width: min(760px, 100%);
  max-height: min(820px, 92vh);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.detail-overlay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--line);
  padding: 19px 21px;
}

.detail-overlay-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 24px;
}

.detail-overlay-body {
  overflow-y: auto;
  padding: 22px;
  color: #d3d6dc;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* Search */
.search-hero {
  max-width: 850px;
  margin: 0 auto 28px;
}

.search-hero h2 {
  margin-bottom: 17px;
  font-family: var(--display);
  font-size: clamp(35px, 5vw, 53px);
  letter-spacing: -0.03em;
  text-align: center;
}

.search-input-large {
  position: relative;
}

.search-input-large input {
  min-height: 62px;
  border-color: #343d4b;
  padding: 0 56px 0 50px;
  background: var(--panel);
  font-size: 17px;
  box-shadow: var(--shadow);
}

.search-input-large::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 18px;
  color: var(--cyan);
  content: "⌕";
  font-size: 23px;
  transform: translateY(-52%);
}

.search-input-large kbd {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 17px;
  transform: translateY(-50%);
}

.search-summary {
  margin-top: 11px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 9px;
  text-align: center;
  text-transform: uppercase;
}

.search-results {
  display: grid;
  max-width: 970px;
  gap: 15px;
  margin: 0 auto;
}

.search-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}

.search-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 16px;
}

.search-group-head h3 {
  margin: 0;
  color: var(--gold-bright);
  font-family: var(--display);
  font-size: 17px;
}

.search-result {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--line-soft);
  padding: 13px 16px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: var(--panel-2); }
.search-result strong { display: block; color: #dfe2e7; font-size: 12px; }
.search-result span { display: block; overflow: hidden; margin-top: 3px; color: var(--muted-2); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.search-result > small { color: var(--muted-2); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }

/* Settings */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.settings-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background: var(--panel);
}

.settings-card.wide {
  grid-column: 1 / -1;
}

.settings-card h3 {
  margin-bottom: 17px;
  font-family: var(--display);
  font-size: 21px;
}

.definition-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.definition-row {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 15px;
  border-top: 1px solid var(--line-soft);
  padding: 11px 0;
}

.definition-row:first-child { border-top: 0; padding-top: 0; }
.definition-row dt { color: var(--muted-2); font-size: 10px; }
.definition-row dd { min-width: 0; margin: 0; color: #d8dbe1; font-size: 11px; overflow-wrap: anywhere; }

.identity-list {
  display: grid;
  gap: 9px;
}

.identity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 11px;
  background: #0d1015;
}

.identity-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-family: var(--display);
}

.identity-row strong,
.identity-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-row strong { color: #d7dbe1; font-size: 11px; }
.identity-row span { color: var(--muted-2); font-size: 9px; }

.authorization-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  border: 1px solid rgba(67, 216, 232, 0.24);
  border-radius: 10px;
  padding: 14px;
  background: var(--cyan-soft);
}

.authorization-note strong,
.authorization-note span { display: block; }
.authorization-note strong { margin-bottom: 3px; color: var(--cyan); font-size: 11px; }
.authorization-note span { color: var(--muted); font-size: 10px; }

/* Toast and dialogs */
.toast-region {
  position: fixed;
  z-index: 110;
  top: 18px;
  right: 18px;
  display: grid;
  width: min(380px, calc(100vw - 36px));
  gap: 8px;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--cyan);
  border-radius: 10px;
  padding: 12px;
  background: rgba(18, 22, 29, 0.98);
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--coral); }
.toast strong { display: block; margin-bottom: 2px; font-size: 11px; }
.toast span { color: var(--muted); font-size: 10px; }
.toast button { min-width: 28px; min-height: 28px; background: transparent; color: var(--muted); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

dialog {
  color: var(--text);
}

.confirm-dialog {
  width: min(470px, calc(100vw - 28px));
  border: 0;
  border-radius: 16px;
  padding: 0;
  background: transparent;
}

.confirm-dialog::backdrop {
  background: rgba(2, 3, 5, 0.8);
  backdrop-filter: blur(7px);
}

.dialog-card {
  border: 1px solid #323a47;
  border-top-color: rgba(216, 179, 101, 0.6);
  border-radius: 16px;
  padding: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dialog-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  margin-bottom: 21px;
  border: 1px solid rgba(216, 179, 101, 0.35);
  border-radius: 10px;
  background: var(--gold-soft);
  color: var(--gold-bright);
  font-size: 19px;
}

.dialog-icon-muted {
  border-color: rgba(239, 133, 118, 0.3);
  background: var(--coral-soft);
  color: var(--coral);
}

.dialog-card h2 {
  margin-bottom: 10px;
  font-family: var(--display);
  font-size: 27px;
}

.dialog-card > p:not(.eyebrow) {
  color: var(--muted);
  font-size: 12px;
}

.dialog-warning {
  margin: 19px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 12px;
  background: #0d1015;
}

.dialog-warning strong,
.dialog-warning span {
  display: block;
}

.dialog-warning strong {
  margin-bottom: 3px;
  color: var(--gold-bright);
  font-size: 11px;
}

.dialog-warning span {
  color: var(--muted);
  font-size: 10px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.danger-send {
  min-width: 145px;
}

/* Responsive */
@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .praxis-grid,
  .capture-grid,
  .note-grid,
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-row { grid-template-columns: 26px minmax(0, 1fr) 110px auto; }
  .task-due { display: none; }
}

@media (max-width: 960px) {
  :root { --sidebar: 0px; --topbar: 68px; }

  .sidebar {
    width: min(310px, 88vw);
    border-right-color: var(--line);
    box-shadow: 22px 0 70px rgba(0, 0, 0, 0.5);
    transform: translateX(-105%);
    transition: transform 190ms ease-out;
  }

  body.drawer-open { overflow: hidden; }
  body.drawer-open .sidebar { transform: translateX(0); }

  .drawer-close,
  .menu-button { display: inline-grid; }

  .drawer-scrim {
    position: fixed;
    z-index: 35;
    inset: 0;
    border: 0;
    background: rgba(1, 2, 3, 0.68);
    opacity: 0;
    transition: opacity 190ms;
  }

  body.drawer-open .drawer-scrim { display: block; opacity: 1; }

  .workspace { margin-left: 0; }

  .global-composer {
    left: 50%;
    width: min(850px, calc(100vw - 34px));
  }

  .dashboard-grid,
  .two-column { grid-template-columns: 1fr; }

  .search-launch { min-width: 42px; width: 42px; justify-content: center; }
  .search-launch span:nth-child(2),
  .search-launch kbd { display: none; }

  .chat-shell { grid-template-columns: 235px minmax(0, 1fr); }
}

@media (max-width: 740px) {
  body { font-size: 14px; }

  body.chat-route .main-view { padding: 8px; }
  body.chat-route .global-composer {
    width: calc(100% - 18px);
    margin-top: 7px;
    margin-bottom: max(7px, env(safe-area-inset-bottom));
  }

  .topbar { gap: 9px; padding: 0 13px; }
  .topbar-title .eyebrow { display: none; }
  .topbar-title h1 { font-size: 19px; }
  .topbar-status { display: none; }
  .avatar { width: 35px; height: 35px; }
  .main-view { padding: 22px 14px 125px; }

  .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; margin-bottom: 21px; }
  .page-heading h2 { font-size: 32px; }
  .page-heading .button-row { width: 100%; }
  .page-heading .button-row > * { flex: 1; }

  .dashboard-intro { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 23px; }
  .greeting-title { font-size: 42px; }
  .last-updated { text-align: left; }

  .needs-card { grid-template-columns: auto minmax(0, 1fr); padding: 15px; }
  .needs-card .primary-button { grid-column: 1 / -1; width: 100%; }

  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 94px; padding: 14px; }
  .metric-value { font-size: 27px; }

  .panel-pad { padding: 17px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .span-all { grid-column: auto; }

  .split-shell {
    min-height: calc(100vh - 205px);
    grid-template-columns: 1fr;
  }

  .split-list { border-right: 0; }
  .split-list-scroll { max-height: calc(100vh - 335px); }
  .split-shell.mobile-detail .split-list { display: none; }
  .split-shell:not(.mobile-detail) .split-detail { display: none; }
  .split-back { display: inline-flex; margin-bottom: 13px; }

  .chat-shell { min-height: calc(100vh - 155px); grid-template-columns: 1fr; }
  .conversation-rail { display: none; }
  .chat-head { flex-wrap: wrap; padding: 10px 12px 12px; }
  .chat-head h2 { max-width: calc(100% - 106px); }
  .chat-title p {
    max-width: 100%;
    font-size: 9px;
  }
  .think-control select { min-height: 44px; }
  .chat-mobile-actions {
    display: grid;
    width: 100%;
    flex: 1 0 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .mobile-chat-button { min-height: 44px; padding-inline: 10px; }
  .message-stream { padding: 20px 13px; }
  .jump-latest { right: 10px; bottom: 10px; }
  .chat-message { grid-template-columns: 29px minmax(0, 1fr); gap: 9px; }
  .chat-message.user { grid-template-columns: minmax(0, 1fr) 29px; }
  .message-avatar { width: 29px; height: 29px; }

  .praxis-grid,
  .capture-grid,
  .note-grid,
  .file-grid { grid-template-columns: 1fr; }

  .praxis-card { min-height: 134px; }
  .capture-card,
  .note-card,
  .file-card { min-height: 160px; }

  .task-row {
    grid-template-columns: 25px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 11px;
  }
  .task-row select { display: none; }

  .settings-grid { grid-template-columns: 1fr; }
  .settings-card.wide { grid-column: auto; }
  .definition-row { grid-template-columns: 105px minmax(0, 1fr); }

  .global-composer {
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 18px);
    min-height: 55px;
    grid-template-columns: 39px minmax(0, 1fr) 39px;
    gap: 5px;
    border-radius: 14px;
    padding: 6px;
  }

  .global-composer .thinking-select { display: none; }
  .composer-plus,
  .send-button { width: 39px; height: 39px; }
  .global-composer textarea { min-height: 39px; padding-block: 8px; }

  .draft-review { padding: 17px; }
  .draft-review-head { flex-direction: column; }
  .draft-editor textarea { min-height: 220px; }
  .draft-actions { align-items: stretch; flex-direction: column; }
  .draft-actions-right { display: grid; grid-template-columns: 1fr; }
  .draft-actions-right > * { width: 100%; }

  .message-addressing { grid-template-columns: 1fr; }
  .message-addressing time { grid-row: 1; }
  .message-body { padding: 20px; }
  .attachment-card { grid-template-columns: 40px minmax(0, 1fr); }
  .attachment-icon { width: 40px; height: 40px; }
  .attachment-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .reply-box { margin: 0 12px 16px; }

  .search-hero h2 { text-align: left; }
  .search-summary { text-align: left; }

  .detail-overlay { padding: 9px; }
  .detail-overlay-card { max-height: 95vh; }
  .detail-overlay-head,
  .detail-overlay-body { padding: 17px; }

  .conversation-sheet {
    width: 100%;
    max-width: none;
    max-height: min(700px, 84dvh);
  }
  .conversation-sheet-card { max-height: min(700px, 84dvh); }
}

@media (max-width: 430px) {
  .login-card { padding: 29px 22px; }
  .login-atmosphere::after { inset: 9px; }
  .topbar-actions { gap: 5px; }
  .search-launch { display: none; }
  .metric-grid { gap: 8px; }
  .metric-card { min-height: 88px; }
  .continuity-stats div { padding-inline: 13px; }
  .filter-group { width: 100%; }
  .filter-button { flex: 1; padding-inline: 7px; }
  .toolbar > .search-field,
  .toolbar > .grow { flex-basis: 100%; width: 100%; }
  .dialog-card { padding: 22px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr; }
}

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