:root {
  color-scheme: light;
  --ink: #182522;
  --ink-soft: #40504a;
  --muted: #74817b;
  --line: #dfe7e1;
  --line-strong: #ccd9d1;
  --canvas: #f5f7f5;
  --canvas-alt: #edf2ee;
  --panel: #ffffff;
  --panel-soft: #eef4ef;
  --sidebar: #15332b;
  --sidebar-soft: #24483d;
  --sidebar-text: #eaf1eb;
  --green: #287456;
  --green-dark: #18523d;
  --green-soft: #e0eee5;
  --amber: #b97820;
  --amber-soft: #fff1d7;
  --danger: #a64138;
  --danger-soft: #fbe9e6;
  --shadow: 0 12px 35px rgba(31, 54, 44, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(40, 116, 86, 0.28);
  outline-offset: 2px;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  padding: 24px 16px 18px;
  background: var(--sidebar);
  color: var(--sidebar-text);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(225, 242, 230, 0.28) transparent;
  scrollbar-width: thin;
  box-shadow: 10px 0 28px rgba(15, 31, 25, 0.08);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 7px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(234, 241, 235, 0.3);
  border-radius: 10px;
  background: #2b594a;
  color: #f7fbf7;
  font-size: 19px;
  font-weight: 700;
}

.brand-copy {
  display: grid;
  line-height: 1.15;
}

.brand-copy strong {
  font-size: 16px;
  font-weight: 650;
}

.brand-copy span {
  margin-top: 3px;
  color: #a9bcb1;
  font-size: 12px;
}

.new-session {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  margin-top: 31px;
  border: 1px solid rgba(225, 242, 230, 0.2);
  border-radius: 7px;
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.new-session:hover {
  border-color: rgba(225, 242, 230, 0.42);
  background: var(--sidebar-soft);
}

.sidebar-label {
  margin: 28px 10px 9px;
  color: #91a69a;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.history-list {
  display: grid;
  gap: 4px;
  min-width: 0;
  max-height: min(420px, 50vh);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(225, 242, 230, 0.24) transparent;
}

.history-empty {
  min-height: 40px;
  padding: 11px;
  color: #81968a;
  font-size: 12px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 11px;
  border-radius: 6px;
  background: transparent;
  color: #c5d3c9;
  text-align: left;
  cursor: pointer;
}

.history-item:hover,
.history-item.active {
  background: var(--sidebar-soft);
  color: #ffffff;
}

.history-item span {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-chevron {
  width: 15px;
  height: 15px;
  margin-left: auto;
  color: #8ca095;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 13px 10px;
  border: 1px solid rgba(229, 242, 233, 0.13);
  border-radius: 7px;
  background: rgba(239, 249, 242, 0.045);
  color: #aabdb1;
  font-size: 12px;
}

.sidebar-badge,
.preview-tag,
.status-pill,
.row-status {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
}

.sidebar-badge {
  margin-left: auto;
  padding: 2px 7px;
  background: rgba(211, 235, 218, 0.13);
  color: #c8e6ce;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #54b77d;
  box-shadow: 0 0 0 3px rgba(84, 183, 125, 0.13);
  flex: 0 0 auto;
}

.main-column {
  display: flex;
  min-width: 0;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: var(--canvas);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  height: 74px;
  flex: 0 0 auto;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 0 rgba(31, 54, 44, 0.02), 0 7px 20px rgba(31, 54, 44, 0.035);
  backdrop-filter: blur(12px);
}

.topbar-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.topbar-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.topbar-context {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-context strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 680;
}

.topbar-context-divider {
  width: 1px;
  height: 13px;
  margin: 0 2px;
  background: var(--line-strong);
}

.preview-tag {
  padding: 3px 8px;
  background: var(--amber-soft);
  color: var(--amber);
}

.topbar-user-wrap {
  position: relative;
  margin-left: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 4px 7px 4px 5px;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.user-chip:hover {
  background: var(--panel-soft);
}

.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-dark);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.user-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.user-copy strong {
  font-size: 13px;
  font-weight: 650;
}

.user-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.user-chevron {
  width: 15px;
  height: 15px;
  margin-left: 5px;
  color: var(--muted);
}

.user-popover {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  min-width: 210px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--ink-soft);
  font-size: 12px;
}

.user-popover[hidden] {
  display: none;
}

.popover-title {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
}

.popover-note {
  color: var(--amber);
}

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

.popover-action {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.popover-action:hover {
  color: var(--green-dark);
}

.conversation {
  display: flex;
  width: 100%;
  flex: 1;
  flex-direction: column;
  align-self: stretch;
  min-height: 0;
  padding: 32px clamp(22px, 4vw, 58px) 34px;
  background: var(--canvas);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

.welcome {
  width: min(100%, 1080px);
  margin: 0 auto 32px;
}

.workspace-home {
  display: grid;
}

.workspace-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 30px;
  min-height: 192px;
  padding: 30px 34px;
  border-top: 4px solid #61bb88;
  border-radius: 8px 8px 0 0;
  background: var(--sidebar);
  color: #f6fbf7;
}

.workspace-hero-copy {
  display: grid;
  align-content: center;
}

.workspace-eyebrow,
.workspace-activity-heading p {
  margin: 0;
  color: #9fc4ae;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-hero h1 {
  margin: 9px 0 0;
  color: #ffffff;
  font-size: 31px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.workspace-subtitle {
  margin: 10px 0 0;
  color: #c6d8ce;
  font-size: 14px;
}

.workspace-period-block {
  display: grid;
  align-content: center;
  min-width: 194px;
  padding-left: 30px;
  border-left: 1px solid rgba(231, 243, 235, 0.18);
}

.workspace-period-block > span:first-child {
  color: #9fc4ae;
  font-size: 11px;
  font-weight: 650;
}

.workspace-period-block strong {
  margin-top: 8px;
  color: #ffffff;
  font-size: 25px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.workspace-period-status {
  width: fit-content;
  margin-top: 11px;
  padding: 3px 8px;
  border: 1px solid rgba(192, 234, 207, 0.25);
  border-radius: 999px;
  background: rgba(104, 184, 132, 0.13);
  color: #c8edcf;
  font-size: 11px;
  font-weight: 650;
}

.workspace-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--panel);
}

.workspace-stat {
  min-width: 0;
  padding: 20px 24px 21px;
  border-right: 1px solid var(--line);
}

.workspace-stat:last-child {
  border-right: 0;
}

.workspace-stat dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.workspace-stat dd {
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-stat span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-activity {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.workspace-activity-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.workspace-activity-heading h2 {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.workspace-boundary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.workspace-boundary .icon {
  width: 16px;
  height: 16px;
  color: var(--green);
}

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

.workspace-recommendation {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 66px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.workspace-recommendation:hover {
  border-color: #aac9b5;
  box-shadow: 0 7px 16px rgba(31, 54, 44, 0.06);
  transform: translateY(-1px);
}

.workspace-recommendation-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #cfe0d5;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--green);
}

.workspace-recommendation-icon .icon,
.workspace-recommendation-arrow {
  width: 17px;
  height: 17px;
}

.workspace-recommendation-copy {
  display: grid;
  min-width: 0;
}

.workspace-recommendation-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-recommendation-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 680;
}

.workspace-recommendation-arrow {
  color: #8ba196;
}

.message-followups {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.message-followups-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.message-followups-heading span {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-followups-heading strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

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

.message-followups .workspace-recommendation {
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 52px;
  padding: 9px 10px;
  gap: 8px;
}

.message-followups .workspace-recommendation-icon {
  width: 28px;
  height: 28px;
}

.message-followups .workspace-recommendation-icon .icon {
  width: 14px;
  height: 14px;
}

.message-followups .workspace-recommendation-arrow {
  display: none;
}

.message-followups .workspace-recommendation-title {
  font-size: 12px;
  white-space: normal;
}

.messages {
  display: grid;
  gap: 25px;
  width: min(100%, 1080px);
  margin-right: auto;
  margin-left: auto;
}

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.message.user {
  grid-template-columns: minmax(0, 1fr);
  justify-items: end;
}

.message-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: var(--green-dark);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
}

.message.user .message-bubble {
  max-width: min(80%, 580px);
  padding: 11px 14px;
  border-radius: 8px 8px 2px 8px;
  background: var(--green-dark);
  color: #ffffff;
}

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

.message-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 9px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.message-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.result-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(31, 54, 44, 0.07);
}

.result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 23px 24px 17px;
  border-bottom: 1px solid var(--line);
}

.result-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.result-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.result-kpi-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #fbfdfb;
}

.result-kpi {
  min-width: 0;
  padding: 18px 20px 17px;
  border-right: 1px solid var(--line);
}

.result-kpi:last-child {
  border-right: 0;
}

.result-kpi-label {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-kpi-value {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: var(--ink);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-kpi-unit {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px 4px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.result-section-label span:last-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.result-interpretation {
  margin: 15px 24px 6px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent, #2f7d5b);
  background: var(--panel-soft, rgba(47, 125, 91, 0.06));
  border-radius: 0 8px 8px 0;
  color: var(--text, inherit);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.comparison-wrap {
  margin: 4px 24px 14px;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
  width: 52px;
  text-align: center;
  color: var(--muted);
}

.status-pill {
  padding: 4px 8px;
  background: var(--amber-soft);
  color: var(--amber);
}

.metrics-table {
  width: 100%;
  margin-top: 4px;
  border-collapse: collapse;
}

.result-panel > .metrics-table {
  width: calc(100% - 48px);
  margin: 4px 24px 0;
}

.detail-table-wrap {
  margin: 4px 24px 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.detail-table {
  min-width: 650px;
}

.detail-table td {
  white-space: nowrap;
}

.detail-id {
  color: var(--muted) !important;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px !important;
}

.detail-count {
  margin: 11px 24px 0;
  color: var(--muted);
  font-size: 12px;
}

.metrics-table th,
.metrics-table td {
  padding: 13px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.metrics-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.metrics-table td {
  color: var(--ink-soft);
  font-size: 13px;
}

.metrics-table td:first-child {
  color: var(--ink);
  font-weight: 600;
}

.metric-value {
  color: var(--ink);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.metric-unit {
  color: var(--muted);
  font-size: 12px;
}

.row-status {
  padding: 3px 7px;
  background: var(--green-soft);
  color: var(--green-dark);
}

.data-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 24px 0;
  padding: 10px 11px;
  border-left: 3px solid #d59c48;
  background: #fff9ed;
  color: #6f552d;
  font-size: 12px;
}

.data-note .icon {
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.limitations {
  margin: 14px 24px 0;
  color: var(--muted);
  font-size: 12px;
}

.limitations summary {
  width: fit-content;
  cursor: pointer;
  color: var(--green);
  font-weight: 600;
}

.limitations ul {
  margin: 9px 0 0 17px;
  padding: 0;
}

.file-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 18px 24px 24px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-soft);
}

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

.file-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: #d3e7d9;
  color: var(--green-dark);
}

.file-copy {
  display: grid;
  min-width: 0;
}

.file-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  background: var(--green);
  color: #ffffff;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background 160ms ease;
}

.download-button:hover {
  background: var(--green-dark);
}

.blocked-panel {
  padding: 16px 17px;
  border: 1px solid #efc7c1;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}

.message-panel {
  padding: 16px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
}

.message-panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
}

.blocked-panel strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.blocked-panel p {
  margin: 0;
  font-size: 12px;
}

.loading-bubble {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.loading-bubble span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.1s ease-in-out infinite;
}

.loading-bubble span:nth-child(2) { animation-delay: 120ms; }
.loading-bubble span:nth-child(3) { animation-delay: 240ms; }

@keyframes pulse {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.composer-zone {
  width: 100%;
  flex: 0 0 auto;
  align-self: stretch;
  padding: 11px clamp(22px, 4vw, 58px) 18px;
  border-top: 1px solid rgba(204, 217, 209, 0.72);
  background: rgba(245, 247, 245, 0.94);
  box-shadow: 0 -8px 24px rgba(31, 54, 44, 0.035);
  backdrop-filter: blur(12px);
}

.composer-zone > * {
  width: min(100%, 1080px);
  margin-right: auto;
  margin-left: auto;
}

.composer-context {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  color: var(--muted);
  font-size: 11px;
}

.composer-context label {
  font-weight: 600;
}

.composer-context select {
  padding: 3px 21px 3px 3px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.context-divider {
  width: 1px;
  height: 13px;
  background: var(--line-strong);
}

.context-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.context-status .status-dot {
  width: 6px;
  height: 6px;
  box-shadow: none;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  min-height: 58px;
  padding: 9px 10px 9px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(31, 54, 44, 0.075);
}

.composer:focus-within {
  border-color: #8bb69a;
  box-shadow: 0 8px 24px rgba(31, 94, 67, 0.11);
}

.composer textarea {
  width: 100%;
  min-height: 38px;
  max-height: 130px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: #98a7a0;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 11px;
}

.composer-hint {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.send-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
}

.send-button {
  background: var(--green-dark);
  color: #ffffff;
  transition: background 160ms ease, transform 160ms ease;
}

.send-button:hover {
  background: #103b2c;
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.icon-button {
  background: transparent;
  color: var(--ink-soft);
}

.mobile-menu {
  display: none;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--ink);
  color: #ffffff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.mobile-scrim {
  display: none;
}

.login-overlay {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 35, 29, 0.42);
}

.login-overlay[hidden] {
  display: none;
}

.login-card {
  width: min(100%, 390px);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 55px rgba(20, 35, 29, 0.18);
}

.login-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: var(--green-dark);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
}

.login-eyebrow {
  margin: 20px 0 5px;
  color: var(--green);
  font-size: 12px;
  font-weight: 650;
}

.login-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: 25px;
  font-weight: 680;
  letter-spacing: 0;
}

.login-description {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.login-form label {
  margin-top: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.login-form input {
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.login-form input:focus {
  border-color: #8bb69a;
  box-shadow: 0 0 0 3px rgba(31, 94, 67, 0.11);
}

.login-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
}

.login-submit {
  min-height: 42px;
  margin-top: 13px;
  border-radius: 6px;
  background: var(--green-dark);
  color: #ffffff;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.login-submit:hover {
  background: #103b2c;
}

.password-cancel {
  min-height: 36px;
  margin-top: 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.password-cancel:hover {
  color: var(--ink-soft);
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(286px, 88vw);
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-grid;
  }

  .topbar {
    height: 64px;
    padding: 0 16px;
  }

  .topbar-heading {
    margin-right: auto;
    margin-left: 9px;
  }

  .topbar-kicker,
  .topbar-context {
    display: none;
  }

  .user-copy,
  .user-chevron {
    display: none;
  }

  .user-chip {
    padding-right: 0;
  }

  .conversation {
    padding: 24px 18px;
  }

  .composer-zone {
    padding: 10px 18px 16px;
  }

  .workspace-hero {
    min-height: 174px;
    padding: 26px 28px;
  }

  .workspace-stat {
    padding: 18px;
  }

  .mobile-scrim:not([hidden]) {
    position: fixed;
    z-index: 30;
    inset: 0;
    display: block;
    background: rgba(20, 35, 29, 0.35);
  }
}

@media (max-width: 560px) {
  .welcome {
    margin-bottom: 24px;
  }

  .workspace-hero {
    flex-direction: column;
    gap: 22px;
    min-height: 0;
    padding: 23px 20px 21px;
  }

  .workspace-hero h1 {
    font-size: 27px;
  }

  .workspace-period-block {
    grid-template-columns: 1fr auto;
    align-items: center;
    min-width: 0;
    padding: 15px 0 0;
    border-top: 1px solid rgba(231, 243, 235, 0.18);
    border-left: 0;
  }

  .workspace-period-block > span:first-child {
    grid-column: 1;
    grid-row: 1;
  }

  .workspace-period-block strong {
    grid-column: 1;
    grid-row: 2;
    margin-top: 4px;
    font-size: 22px;
  }

  .workspace-period-status {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-top: 0;
  }

  .workspace-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-stat {
    padding: 17px 15px;
  }

  .workspace-stat:nth-child(2) {
    border-right: 0;
  }

  .workspace-stat:nth-child(3) {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .workspace-stat dd {
    font-size: 16px;
  }

  .workspace-activity {
    margin-top: 20px;
    padding-top: 17px;
  }

  .workspace-activity-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .workspace-boundary {
    font-size: 11px;
  }

  .workspace-recommendations {
    grid-template-columns: 1fr;
  }

  .message-followups-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    border-radius: 7px;
  }

  .result-heading {
    display: grid;
    gap: 8px;
    padding: 18px 15px 14px;
  }

  .result-kpi-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-kpi {
    padding: 15px;
  }

  .result-kpi:nth-child(2) {
    border-right: 0;
  }

  .result-kpi:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .result-kpi-value {
    font-size: 21px;
  }

  .result-section-label {
    padding: 15px 15px 3px;
  }

  .metrics-table th,
  .metrics-table td {
    padding: 11px 4px;
  }

  .metrics-table th:nth-child(3),
  .metrics-table td:nth-child(3) {
    display: none;
  }

  .detail-table {
    min-width: 650px;
  }

  .detail-table th:nth-child(3),
  .detail-table td:nth-child(3) {
    display: table-cell;
  }

  .file-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .download-button {
    width: 100%;
  }

  .composer-context {
    gap: 7px;
  }

  .composer-hint {
    display: none;
  }

  .composer {
    min-height: 56px;
    padding-left: 12px;
  }

  .result-panel > .metrics-table {
    width: calc(100% - 30px);
    margin-right: 15px;
    margin-left: 15px;
  }

  .comparison-wrap,
  .result-interpretation,
  .data-note,
  .limitations,
  .detail-count,
  .file-panel {
    margin-right: 15px;
    margin-left: 15px;
  }

  .detail-table-wrap {
    margin-right: 15px;
    margin-left: 15px;
  }
}
