:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #68736c;
  --line: #dfe5df;
  --soft-line: #edf1ed;
  --canvas: #f4f6f2;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --accent: #214f3d;
  --accent-strong: #153c2d;
  --accent-soft: #e5f0e9;
  --warm: #c87846;
  --danger: #a7473c;
  --shadow: 0 18px 55px rgba(31, 48, 40, 0.08);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.hidden { display: none !important; }

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 18px 18px;
  background: #182920;
  color: #eaf0eb;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 6px 26px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px;
  background: #2b4e3d;
  font: 700 18px/1 Georgia, serif;
}

.brand span:last-child { display: grid; gap: 1px; }
.brand strong { font: 700 18px/1.2 Georgia, serif; }
.brand small { color: #9fb0a5; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.button {
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 650;
  transition: .18s ease;
}

.button:disabled { cursor: wait; opacity: .55; }
.button-wide { width: 100%; }
.button-primary { background: var(--accent); color: #fff; }
.sidebar .button-primary { background: #dbe9df; color: #173428; }
.button-primary:hover:not(:disabled) { background: var(--accent-strong); transform: translateY(-1px); }
.sidebar .button-primary:hover:not(:disabled) { background: #fff; }
.button-secondary { border-color: var(--line); background: var(--surface); }
.button-secondary:hover:not(:disabled) { border-color: #bcc8c0; background: var(--surface-soft); }
.button-danger { border-color: #d9aaa4; background: #fff5f3; color: var(--danger); }
.button-danger:hover:not(:disabled) { border-color: var(--danger); background: #fbe7e3; }

.sidebar-section { min-height: 0; margin-top: 12px; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 9px; color: #91a299; font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-heading b { margin-left: 4px; font-size: 10px; }
.project-heading-actions { display: flex; align-items: center; gap: 7px; letter-spacing: 0; text-transform: none; }
.compact-icon-button { display: grid; width: 30px; height: 30px; padding: 0; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 9px; background: rgba(255,255,255,.07); color: #fff; cursor: pointer; font-size: 20px; }
.project-navigation { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 38px; gap: 7px; }
.project-select-button, .project-menu-button { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.08); color: #fff; cursor: pointer; }
.project-select-button { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 12px; text-align: left; }
.project-select-button > span { min-width: 0; }
.project-select-button strong, .project-select-button small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-select-button strong { font-size: 13px; }
.project-select-button small { margin-top: 4px; color: #a9b9af; font-size: 9px; }
.project-menu-button { border-radius: 12px; font-size: 22px; }
.project-popover { position: absolute; top: calc(100% + 7px); right: 0; left: 0; z-index: 30; padding: 8px; border: 1px solid rgba(255,255,255,.18); border-radius: 13px; background: #20382c; box-shadow: 0 20px 45px rgba(0,0,0,.3); }
.project-picker { max-height: min(430px, 65vh); }
.project-picker input { width: 100%; margin-bottom: 7px; padding: 10px 11px; border: 1px solid rgba(255,255,255,.15); border-radius: 9px; outline: none; background: #fff; color: var(--ink); }
.project-list { display: grid; gap: 4px; max-height: min(350px, 52vh); overflow-y: auto; }
.project-list-empty { margin: 12px; color: #a9b9af; font-size: 11px; text-align: center; }
.project-menu { left: auto; display: grid; width: min(250px, calc(100vw - 36px)); gap: 3px; }
.project-menu button { display: flex; justify-content: space-between; padding: 11px 12px; border: 0; border-radius: 8px; background: transparent; color: #d9e4dd; cursor: pointer; text-align: left; }
.project-menu button:hover, .project-menu button.active { background: rgba(255,255,255,.1); color: #fff; }

.project-list button {
  display: grid;
  grid-template-columns: 9px 1fr;
  gap: 10px;
  width: 100%;
  padding: 11px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #c8d3cc;
  text-align: left;
  cursor: pointer;
}

.project-list button:hover, .project-list button.active { background: rgba(255,255,255,.08); color: #fff; }
.project-list i { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: #7e8e84; }
.project-list button.active i { background: #8bd4a7; box-shadow: 0 0 0 4px rgba(139,212,167,.12); }
.project-list strong, .project-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-list strong { font-size: 13px; }
.project-list small { margin-top: 4px; color: #8fa097; font-size: 11px; }
.project-list button.archived { opacity: .64; }
.project-list button.archived i { background: #8b938e; box-shadow: none; }
.archive-toggle { display: flex; align-items: center; gap: 5px; margin: 0; color: #aab9b0; cursor: pointer; font-size: 10px; }
.archive-toggle input { accent-color: #8bd4a7; }

.sidebar-footer { display: flex; justify-content: space-between; margin-top: auto; padding: 16px 7px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-footer a, .link-button { border: 0; background: none; color: #96a79d; font-size: 12px; text-decoration: none; cursor: pointer; }
.sidebar-footer a:hover, .link-button:hover { color: #fff; }

.workspace { min-width: 0; }
.center-panel { display: grid; min-height: 100vh; padding: 30px; place-items: center; }
.empty-card, .login-card { width: min(460px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.empty-card { text-align: center; }
.empty-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 18px; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 28px; }
.empty-card h1, .login-card h1 { margin: 0 0 10px; font: 600 30px/1.15 Georgia, serif; }
.empty-card p, .login-card p { margin: 0 0 24px; color: var(--muted); line-height: 1.6; }
.login-card { display: grid; gap: 16px; }

.project-panel { min-height: 100vh; background: var(--surface); }
.project-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 30px 38px 23px; border-bottom: 1px solid var(--soft-line); }
.project-header h1 { margin: 8px 0 0; font: 600 clamp(25px, 3vw, 34px)/1.12 Georgia, serif; }
.project-kicker { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.status-pill { padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10px; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.codex-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.codex-status i { width: 7px; height: 7px; border-radius: 50%; background: #59a875; }
.codex-status.busy i { background: var(--warm); animation: pulse 1.4s infinite; }

.stage-strip { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); padding: 0 38px; overflow-x: auto; border-bottom: 1px solid var(--soft-line); }
.stage-strip button { position: relative; padding: 17px 10px 15px; border: 0; border-bottom: 2px solid transparent; background: none; color: #8a948e; cursor: default; font-size: 12px; font-weight: 650; white-space: nowrap; }
.stage-strip button span { margin-right: 6px; color: #acb5af; font: 600 10px/1 ui-monospace, monospace; }
.stage-strip button.active { border-color: var(--accent); color: var(--accent); }
.stage-strip button.done { color: #445c50; }

.tabs { display: flex; gap: 26px; padding: 0 38px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 18px 0 14px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 650; }
.tabs button.active { border-color: var(--accent); color: var(--ink); }
.tabs button span:not(.dot) { margin-left: 5px; color: #99a39d; }
.dot { display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: #b8c1bb; }
.dot.connected { background: #50a06e; }

.tab-panel { padding: 28px 38px 38px; }
.work-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; background: var(--canvas); min-height: calc(100vh - 118px); }
.chat-card { display: flex; flex-direction: column; min-height: 590px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 8px 30px rgba(30,47,38,.04); }
.conversation-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 180px)) 1fr; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--soft-line); background: #fbfcfa; }
.conversation-switch button { display: grid; gap: 2px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); text-align: left; cursor: pointer; }
.conversation-switch button.active { border-color: #8caf9d; background: var(--accent-soft); color: var(--accent); }
.conversation-switch button:disabled { cursor: default; opacity: .5; }
.conversation-switch button span { font-size: 12px; font-weight: 750; }
.conversation-switch button small { font-size: 10px; }
.conversation-switch p { margin: 0 0 0 8px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.conversation-settings { flex: 0 0 auto; border-bottom: 1px solid var(--soft-line); background: #fbfcfa; }
.conversation-settings summary { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; list-style: none; }
.conversation-settings summary::-webkit-details-marker { display: none; }
.conversation-settings summary::after { content: "›"; margin-left: 2px; transform: rotate(90deg); color: var(--accent); font-size: 19px; line-height: 1; }
.conversation-settings[open] summary::after { transform: rotate(-90deg); }
.conversation-settings summary small { margin-left: auto; overflow: hidden; color: var(--accent); font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.conversation-settings-fields { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; padding: 0 16px 12px; }
.conversation-settings-fields label { display: grid; min-width: 0; gap: 4px; color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.conversation-settings-fields select { width: 100%; min-width: 0; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font-size: 11px; }
.conversation-settings-fields select:focus { border-color: #83a392; outline: none; box-shadow: 0 0 0 3px rgba(45,94,72,.08); }
.conversation-settings-fields select:disabled { opacity: .6; }
.conversation-settings-status { min-width: 72px; padding-bottom: 9px; color: var(--muted); font-size: 10px; }
.conversation-settings-status.error { color: var(--danger); }
.messages { flex: 1; display: flex; flex-direction: column; gap: 18px; min-height: 0; max-height: calc(100vh - 355px); padding: 28px; overflow-y: auto; }
.message { display: grid; gap: 7px; max-width: 82%; }
.message.user { align-self: flex-end; }
.message.assistant { align-self: flex-start; }
.message-meta { color: #8a948e; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.message.user .message-meta { text-align: right; }
.message-body { padding: 13px 16px; border-radius: 5px 15px 15px 15px; background: var(--surface-soft); color: #27322c; line-height: 1.58; }
.message.user .message-body { border-radius: 15px 5px 15px 15px; background: var(--accent); color: #fff; }
.message-body p { margin: 0 0 10px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body pre { max-width: 100%; padding: 12px; overflow-x: auto; border-radius: 8px; background: #111a15; color: #e8f2eb; }
.message-body code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
.message-body ul, .message-body ol { padding-left: 20px; }
.message-body a { color: inherit; }
.message-empty { margin: auto; color: var(--muted); text-align: center; line-height: 1.6; }

.pending-box { display: flex; align-items: center; gap: 10px; padding: 10px 28px; color: var(--muted); font-size: 12px; }
.approval-box { display: grid; gap: 9px; margin: 0 16px 12px; padding: 14px 16px; border: 1px solid #d8b96d; border-radius: 12px; background: #fff9e9; color: #3a3425; }
.approval-box strong { font-size: 13px; }
.approval-box code { width: fit-content; max-width: 100%; padding: 5px 8px; overflow-wrap: anywhere; border-radius: 6px; background: rgba(117, 84, 10, .08); font-size: 11px; }
.approval-box p { margin: 0; color: #6d6248; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.loader { width: 15px; height: 15px; border: 2px solid #dfe7e1; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto 43px; gap: 10px; padding: 16px; border-top: 1px solid var(--soft-line); background: #fbfcfa; }
.composer textarea { width: 100%; min-height: 72px; resize: vertical; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; outline: none; background: #fff; }
.composer textarea:focus, .field input:focus, .field textarea:focus, .field select:focus, .context-card textarea:focus { border-color: #83a392; box-shadow: 0 0 0 3px rgba(45,94,72,.08); }
.stop-button { align-self: end; min-width: 58px; height: 43px; padding: 0 12px; border: 1px solid #caa7a4; border-radius: 12px; background: #fff6f5; color: var(--danger); cursor: pointer; font-size: 12px; font-weight: 750; }
.stop-button:disabled { cursor: wait; opacity: .6; }
.send-button { align-self: end; width: 43px; height: 43px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; cursor: pointer; font-size: 22px; }

.context-panel { display: grid; align-content: start; gap: 14px; }
.context-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.context-card textarea { width: 100%; margin-top: 12px; resize: vertical; padding: 0; border: 0; outline: 0; color: var(--ink); line-height: 1.55; }
.lifecycle-card { display: grid; gap: 12px; border-color: #c7d8ce; background: linear-gradient(150deg, #fbfdfb, #f1f7f3); }
.lifecycle-card > strong { font: 600 18px/1.25 Georgia, serif; }
.lifecycle-card .context-empty { margin: 0; }
.lifecycle-binding { margin: 2px 0 0; }
.lifecycle-actions { display: grid; gap: 8px; }
.lifecycle-actions .button { width: 100%; justify-content: center; }
.lifecycle-page-card { width: min(620px, 100%); }
.context-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eyebrow { color: #718078; font-size: 10px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.text-button { padding: 0; border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 11px; font-weight: 650; }
.compact-documents { display: grid; gap: 9px; margin-top: 13px; }
.compact-document { display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 9px; }
.compact-document span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 800; }
.compact-document strong, .compact-document small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-document strong { font-size: 11px; }
.compact-document small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.context-empty { color: var(--muted); font-size: 12px; line-height: 1.5; }
.integration-summary strong, .integration-summary small { display: block; }
.integration-summary strong { margin-top: 12px; }
.integration-summary small { margin-top: 6px; color: var(--muted); line-height: 1.5; }
.ceh-pairing-card { margin-bottom: 18px; }
.pairing-code-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: 14px 0; }
.pairing-code-box code { min-width: 0; padding: 11px; overflow-wrap: anywhere; border-radius: 9px; background: var(--surface-soft); font-size: 11px; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.section-heading h2 { margin: 7px 0 5px; font: 600 29px/1.2 Georgia, serif; }
.section-heading p { max-width: 680px; margin: 0; color: var(--muted); line-height: 1.55; }
.document-heading-actions { display: flex; align-items: center; gap: 12px; }
.show-archived-documents { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; cursor: pointer; }
.file-button { display: inline-flex; align-items: center; white-space: nowrap; }
.file-button input { display: none; }
.document-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.document-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.document-card.is-archived { border-style: dashed; opacity: .78; }
.document-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.document-card h3 { overflow-wrap: anywhere; margin: 0; font-size: 13px; line-height: 1.4; }
.document-card p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.document-badges { display: flex; flex: 0 0 auto; align-items: flex-end; gap: 5px; flex-direction: column; }
.document-status { padding: 4px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.document-visibility { padding: 4px 7px; border-radius: 999px; background: #eef1ee; color: var(--muted); font-size: 9px; font-weight: 800; white-space: nowrap; }
.document-visibility.visibility-shared { background: #e5f0e9; color: #214f3d; }
.document-visibility.visibility-customer { background: #e7eef8; color: #315b8a; }
.document-visibility.visibility-internal { background: #f4eadf; color: #8a5a31; }
.document-visibility.visibility-none { background: #eceeed; color: #737b76; }
.document-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.document-controls label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.document-card select { width: 100%; min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.document-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 900px; }
.field { display: grid; gap: 7px; color: #536058; font-size: 12px; font-weight: 650; }
.field-wide { grid-column: 1 / -1; }
.field input, .field textarea, .field select { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: #fff; color: var(--ink); }
.connection-badge { padding: 8px 11px; border-radius: 999px; background: #eef1ee; color: var(--muted); font-size: 11px; font-weight: 700; }
.connection-badge.connected { background: var(--accent-soft); color: var(--accent); }
.connection-badge.error { background: #f7e9e6; color: var(--danger); }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; flex: 0 0 auto; width: 40px; height: 23px; border-radius: 999px; background: #cdd5d0; transition: .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.15); transition: .2s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(17px); }
.switch-row strong, .switch-row small { display: block; }
.switch-row small { margin-top: 3px; color: var(--muted); font-weight: 400; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-message { color: var(--muted); font-size: 12px; }
.inline-message.error, .form-error { color: var(--danger); }

.communication-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 1100px; margin-top: 30px; }
.history-grid { margin-top: 0; }
.communication-card { display: grid; align-content: start; gap: 13px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.participants-settings { max-width: 900px; margin-top: 28px; }
.danger-zone { display: grid; gap: 18px; max-width: 900px; margin-top: 28px; padding: 20px; border: 1px solid #ead0cc; border-radius: 14px; background: #fffafa; }
.danger-zone h3 { margin: 6px 0 0; font: 600 19px/1.3 Georgia, serif; }
.danger-zone p { margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.danger-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.communication-card h3 { margin: 0; font: 600 19px/1.3 Georgia, serif; }
.communication-card textarea, .communication-card input, .communication-card select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: #fff; color: var(--ink); }
.participant-list, .task-list, .communication-log, .global-tool-list, .notification-list { display: grid; gap: 9px; }
.participant-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--soft-line); border-radius: 10px; background: #fff; }
.participant-row strong, .participant-row small, .task-row strong, .task-row small, .log-row strong, .log-row small { display: block; }
.participant-row strong, .task-row strong, .log-row strong { font-size: 12px; line-height: 1.45; }
.participant-row small, .task-row small, .log-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.task-row, .log-row { padding: 11px 12px; border: 1px solid var(--soft-line); border-radius: 10px; background: #fff; }
.communication-log { max-height: 228px; overflow-y: auto; padding-right: 4px; }
.communication-log .log-row { min-height: 70px; max-height: 70px; overflow: hidden; }
.communication-log .log-row strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.global-tool-row { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--soft-line); border-radius: 10px; background: #fff; }
.global-tool-row strong, .global-tool-row small { display: block; }
.global-tool-row strong { font-size: 12px; }
.global-tool-row p { margin: 5px 0; color: var(--ink); font-size: 11px; line-height: 1.5; }
.global-tool-row small { color: var(--muted); font-size: 10px; }
.global-tool-row.status-active { border-color: #bcd8c6; background: #f6fbf7; }
.global-tool-row.status-rejected { opacity: .65; }
.global-tool-row.status-ready { border-color: #c8d7e8; background: #f7faff; }
.tool-error { color: var(--danger) !important; }
.global-tool-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notification-row { display: grid; width: 100%; gap: 4px; padding: 11px 12px; border: 1px solid var(--soft-line); border-radius: 10px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.notification-row:hover { border-color: var(--accent); }
.notification-row.read { opacity: .65; }
.notification-row strong, .notification-row span, .notification-row small { display: block; }
.notification-row strong { font-size: 12px; }
.notification-row span { white-space: pre-line; font-size: 11px; line-height: 1.45; }
.notification-row small { color: var(--muted); font-size: 10px; }
.system-notifications { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
.system-notifications summary { margin-bottom: 10px; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 700; }
.task-row.status-completed { border-color: #bcd8c6; background: #f6fbf7; }
.task-row.status-needs_retry { border-color: #e8c1b9; background: #fff8f6; }
.communication-help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.context-only-marker { color: var(--muted); font-size: 10px; font-weight: 650; }
.external-chat-card { display: grid; justify-items: start; gap: 8px; margin-bottom: 8px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); text-align: left; }
.external-chat-card strong { font: 600 17px/1.3 Georgia, serif; }
.external-chat-card p { max-width: 480px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.modal { position: fixed; inset: 0; z-index: 20; display: grid; padding: 22px; place-items: center; background: rgba(13,24,18,.55); backdrop-filter: blur(5px); }
.modal-card { position: relative; display: grid; gap: 17px; width: min(500px, 100%); padding: 30px; border-radius: 18px; background: #fff; box-shadow: 0 28px 90px rgba(0,0,0,.24); }
.modal-card h2 { margin: -4px 0 2px; font: 600 28px/1.2 Georgia, serif; }
.modal-close { position: absolute; top: 15px; right: 15px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--muted); cursor: pointer; font-size: 22px; }
.form-error { min-height: 16px; margin: 0; font-size: 12px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .work-layout { grid-template-columns: 1fr; }
  .context-panel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .messages { max-height: 580px; }
}

@media (max-width: 720px) {
  html, body { width: 100%; height: 100%; min-height: 0; overflow: hidden; }
  .app-shell { display: flex; width: 100%; height: 100dvh; min-height: 0; flex-direction: column; overflow: hidden; }
  .sidebar { position: relative; z-index: 10; width: 100%; height: auto; flex: 0 0 auto; padding: 8px 12px 10px; }
  .brand { gap: 8px; margin: 0 2px 7px; }
  .brand-mark { width: 29px; height: 29px; border-radius: 9px; font-size: 15px; }
  .brand strong { font-size: 15px; }
  .brand small { display: none; }
  .sidebar-section { margin-top: 0; }
  .sidebar-heading { padding-bottom: 5px; }
  .project-navigation { grid-template-columns: minmax(0, 1fr) 38px; }
  .project-select-button { min-height: 42px; padding-block: 7px; }
  .project-picker { max-height: min(400px, calc(100dvh - 125px)); }
  .project-list { display: grid; max-height: min(315px, calc(100dvh - 205px)); overflow-x: hidden; overflow-y: auto; }
  .project-list button { min-width: 0; }
  .sidebar-footer { display: none; }
  .workspace { min-height: 0; flex: 1 1 auto; overflow: hidden; }
  .center-panel { min-height: 100%; padding: 14px; overflow-y: auto; }
  .project-panel { display: flex; height: 100%; min-height: 0; flex-direction: column; overflow: hidden; }
  .compact-project-header { display: none; }
  .tab-panel { height: 100%; min-height: 0; padding: 12px; overflow-y: auto; }
  .work-layout { display: block; min-height: 0; overflow: hidden; }
  .work-layout:not(.hidden) { height: 100%; }
  .chat-card { height: 100%; min-height: 0; border-radius: 13px; }
  .context-panel { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .communication-grid { grid-template-columns: 1fr; }
  .pairing-code-box { grid-template-columns: 1fr; }
  .conversation-switch { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .conversation-switch { flex: 0 0 auto; padding: 8px; }
  .conversation-switch button { min-height: 43px; padding: 6px 9px; }
  .conversation-switch button small { display: none; }
  .conversation-switch p { display: none; }
  .conversation-settings summary { min-height: 34px; padding: 6px 10px; }
  .conversation-settings-fields { grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); gap: 7px; padding: 0 8px 8px; }
  .conversation-settings-fields select { padding: 7px; font-size: 10px; }
  .conversation-settings-status { grid-column: 1 / -1; min-height: 12px; padding: 0; }
  .field-wide { grid-column: auto; }
  .messages { min-height: 0; max-height: none; padding: 14px; overscroll-behavior: contain; }
  .message { max-width: 92%; }
  .message-body { padding: 11px 13px; }
  .pending-box { flex: 0 0 auto; padding: 8px 14px; }
  .approval-box { flex: 0 0 auto; max-height: 32dvh; overflow-y: auto; }
  .composer { flex: 0 0 auto; grid-template-columns: minmax(0, 1fr) auto 42px; gap: 6px; padding: 8px; }
  .composer textarea { height: 44px; min-height: 44px; max-height: 88px; resize: none; padding: 10px 12px; }
  .stop-button { min-width: 50px; height: 42px; padding: 0 8px; font-size: 11px; }
  .send-button { width: 42px; height: 42px; }
  .document-controls { grid-template-columns: 1fr; }
  .document-heading-actions { align-items: stretch; flex-direction: column; }
  .participant-row { grid-template-columns: 1fr; }
  .section-heading { align-items: stretch; flex-direction: column; }
}
