:root {
  color-scheme: light;
  --ink: #102a2d;
  --muted: #607579;
  --faint: #8ca0a3;
  --line: #dbe6e4;
  --line-strong: #c9d9d6;
  --canvas: #edf3f2;
  --surface: #ffffff;
  --surface-soft: #f5f9f8;
  --brand: #0f766e;
  --brand-dark: #0a5c57;
  --brand-soft: #dff3ef;
  --gold: #c88926;
  --gold-soft: #fff3d9;
  --red: #c14c43;
  --red-soft: #ffebe8;
  --blue: #3469a9;
  --blue-soft: #e9f1fb;
  --shadow: 0 14px 38px rgba(23, 66, 64, 0.08);
  --shadow-sm: 0 5px 18px rgba(23, 66, 64, 0.07);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 11px;
  font-family:
    "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -8%, rgba(15, 118, 110, 0.13), transparent 31rem),
    var(--canvas);
}

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

button,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 9px 13px;
  color: #fff;
  background: var(--brand-dark);
  border-radius: 8px;
  transform: translateY(-150%);
}

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

.app-shell {
  width: min(1800px, 100%);
  min-height: 100vh;
  margin: 0 auto;
}

.topbar {
  min-height: 84px;
  padding: 14px clamp(18px, 3vw, 48px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(201, 217, 214, 0.9);
  backdrop-filter: blur(16px);
}

.brand-group,
.brand-line,
.topbar-actions,
.identity-pill,
.ai-identity,
.ai-title-line {
  display: flex;
  align-items: center;
}

.brand-group {
  gap: 13px;
  min-width: 0;
}

.brand-mark,
.ai-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: linear-gradient(145deg, #11857b, #075b56);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  font-size: 23px;
  font-weight: 800;
}

.brand-line {
  gap: 11px;
}

.brand-line h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.brand-group p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.035em;
}

.read-only-badge {
  padding: 4px 8px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #c8e7e1;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.read-only-badge span {
  margin-right: 4px;
  color: #27a496;
  font-size: 8px;
}

.topbar-actions {
  justify-content: flex-end;
  gap: 16px;
}

.company-picker {
  display: grid;
  gap: 4px;
}

.company-picker > span {
  color: var(--faint);
  font-size: 10px;
  font-weight: 650;
}

.company-picker select {
  width: min(320px, 29vw);
  min-height: 38px;
  padding: 0 34px 0 11px;
  color: var(--ink);
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.identity-pill {
  gap: 9px;
  min-width: max-content;
}

.identity-avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #fff;
  background: #2d4548;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.identity-pill > span:last-child {
  display: grid;
  line-height: 1.25;
}

.identity-pill strong {
  font-size: 12px;
}

.identity-pill small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
}

.system-notice {
  min-height: 36px;
  padding: 6px clamp(18px, 3vw, 48px);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #5b4d29;
  background: #fff8e8;
  border-bottom: 1px solid #efe0b6;
  font-size: 12px;
}

.system-notice.is-online {
  color: var(--brand-dark);
  background: #ecf8f5;
  border-color: #d0eae5;
}

.notice-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: #d6a33f;
  border-radius: 50%;
}

.is-online .notice-dot {
  background: #28a493;
}

.system-notice button {
  margin-left: auto;
  padding: 4px 9px;
  color: inherit;
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 7px;
  font-size: 11px;
  cursor: pointer;
}

.workspace {
  height: calc(100vh - 121px);
  min-height: 670px;
  padding: 18px clamp(16px, 2vw, 32px) 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(390px, 0.84fr);
  gap: 18px;
}

.cockpit-panel,
.ai-panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid rgba(201, 217, 214, 0.92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.cockpit-panel {
  padding: clamp(18px, 2vw, 28px);
  overflow-y: auto;
  scrollbar-color: #bfd2cf transparent;
}

.section-heading,
.dashboard-toolbar,
.ai-heading,
.card-foot,
.privacy-strip,
.input-tools,
.active-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.17em;
}

.section-heading h2,
.ai-heading h2 {
  margin: 0;
}

.section-heading h2 {
  font-size: clamp(21px, 2.1vw, 29px);
}

.sync-time {
  margin: 0;
  color: var(--faint);
  font-size: 11px;
}

.overview-card {
  position: relative;
  margin-top: 19px;
  padding: clamp(18px, 2vw, 25px);
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(340px, 1.2fr);
  align-items: center;
  gap: 22px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 92% 18%, rgba(244, 198, 106, 0.28), transparent 28%),
    linear-gradient(125deg, #0c6963, #124d50);
  border-radius: 19px;
}

.overview-card::after {
  content: "";
  position: absolute;
  right: -42px;
  bottom: -64px;
  width: 190px;
  height: 190px;
  border: 38px solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
}

.overview-copy,
.overview-metrics {
  position: relative;
  z-index: 1;
}

.overview-kicker {
  margin: 0 0 7px;
  color: #bde3dc;
  font-size: 11px;
  font-weight: 700;
}

.overview-copy h3 {
  margin: 0;
  font-size: clamp(19px, 1.65vw, 26px);
  font-weight: 720;
}

.overview-copy > p:last-child {
  max-width: 360px;
  margin: 9px 0 0;
  color: rgba(238, 251, 248, 0.77);
  font-size: 12px;
  line-height: 1.6;
}

.overview-metrics {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(70px, 1fr));
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  backdrop-filter: blur(8px);
}

.overview-metrics > div {
  min-width: 0;
  padding: 16px 10px;
  text-align: center;
}

.overview-metrics > div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.overview-metrics dt {
  color: rgba(231, 248, 245, 0.75);
  font-size: 10px;
}

.overview-metrics dd {
  min-height: 27px;
  margin: 6px 0 0;
  overflow: hidden;
  font-size: clamp(18px, 1.7vw, 25px);
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-toolbar {
  margin: 23px 0 13px;
  gap: 14px;
}

.dashboard-toolbar h3 {
  margin: 0;
  font-size: 15px;
}

.dashboard-toolbar p {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.permission-hint {
  flex: 0 0 auto;
  padding: 5px 9px;
  color: var(--brand-dark);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
}

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

.dashboard-card {
  position: relative;
  min-height: 142px;
  padding: 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  gap: 10px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 0 rgba(27, 73, 71, 0.015);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.dashboard-card:hover {
  z-index: 1;
  border-color: #a8ccc6;
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.dashboard-card:focus-visible,
.suggestion-list button:focus-visible,
.clear-chat:focus-visible,
.input-tools button:focus-visible,
.send-button:focus-visible,
.company-picker select:focus-visible,
.composer textarea:focus-visible,
.system-notice button:focus-visible,
.mobile-nav a:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

.dashboard-card.is-active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.11), var(--shadow-sm);
}

.card-icon {
  width: 33px;
  height: 33px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}

.card-risk .card-icon,
.card-alert .card-icon {
  color: var(--red);
  background: var(--red-soft);
}

.card-collection .card-icon,
.card-funds .card-icon,
.card-operation .card-icon {
  color: #986214;
  background: var(--gold-soft);
}

.card-project .card-icon,
.card-contract .card-icon,
.card-analysis .card-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

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

.card-copy strong {
  font-size: 13px;
}

.card-copy small {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-value {
  max-width: 72px;
  overflow: hidden;
  color: var(--ink);
  font-size: 18px;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-foot {
  grid-column: 1 / -1;
  width: 100%;
  align-self: end;
  padding-top: 10px;
  color: var(--faint);
  border-top: 1px solid #edf2f1;
  font-size: 10px;
}

.card-foot span:last-child {
  color: var(--brand);
  font-size: 15px;
}

.ai-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.ai-heading {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.ai-identity {
  gap: 11px;
  min-width: 0;
}

.ai-avatar {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  font-size: 18px;
  font-weight: 800;
}

.ai-title-line {
  gap: 9px;
}

.ai-title-line h2 {
  font-size: 17px;
}

.ai-heading p {
  margin: 3px 0 0;
  color: var(--faint);
  font-size: 10px;
}

.ai-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  color: #746126;
  background: #fff7e4;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 650;
}

.ai-status i {
  width: 6px;
  height: 6px;
  background: #d2a12c;
  border-radius: 50%;
}

.ai-status.is-online {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.ai-status.is-online i {
  background: #29a492;
}

.clear-chat {
  padding: 6px 9px;
  color: var(--faint);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 11px;
  cursor: pointer;
}

.clear-chat:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.privacy-strip {
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 20px;
  color: #52716e;
  background: #f0f8f6;
  border-bottom: 1px solid #dcebe8;
}

.privacy-strip > span {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  background: #d8eee9;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 800;
}

.privacy-strip p {
  margin: 0;
  font-size: 10px;
}

.conversation {
  min-height: 0;
  padding: 21px 20px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #bfd2cf transparent;
  background:
    linear-gradient(rgba(250, 252, 252, 0.94), rgba(250, 252, 252, 0.94)),
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(15, 118, 110, 0.03) 24px);
}

.message {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.message-avatar {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--brand);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 750;
}

.message-body {
  max-width: min(88%, 560px);
  padding: 11px 13px;
  color: #2d484a;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  box-shadow: 0 4px 14px rgba(23, 66, 64, 0.05);
  font-size: 12px;
  line-height: 1.68;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message-body p {
  margin: 0;
}

.message-body p + p {
  margin-top: 7px;
}

.message-note {
  color: var(--faint);
  font-size: 10px;
}

.user-message {
  justify-content: flex-end;
}

.user-message .message-body {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
  border-radius: 14px 4px 14px 14px;
}

.message.is-loading .message-body {
  color: var(--faint);
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
}

.typing-dots i {
  width: 5px;
  height: 5px;
  background: #8ca9a5;
  border-radius: 50%;
  animation: typing 1.1s infinite ease-in-out;
}

.typing-dots i:nth-child(2) {
  animation-delay: 130ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 260ms;
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.suggestion-block {
  margin: 10px 0 0 36px;
}

.suggestion-block > p {
  margin: 0 0 8px;
  color: var(--faint);
  font-size: 10px;
}

.suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.suggestion-list button {
  padding: 7px 10px;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid #cfe3df;
  border-radius: 999px;
  font-size: 10px;
  cursor: pointer;
}

.suggestion-list button:hover {
  background: var(--brand-soft);
  border-color: #afd3cc;
}

.composer-area {
  padding: 12px 16px calc(13px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
}

.active-context {
  margin-bottom: 7px;
  padding: 6px 9px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 9px;
  font-size: 10px;
}

.active-context button {
  width: 22px;
  height: 22px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-chip {
  max-width: 100%;
  margin-bottom: 7px;
  padding: 5px 7px 5px 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #476467;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 9px;
}

.attachment-chip span {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip button {
  width: 19px;
  height: 19px;
  padding: 0;
  color: var(--faint);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.composer {
  padding: 7px 7px 7px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.composer:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.composer textarea {
  width: 100%;
  max-height: 120px;
  min-height: 34px;
  padding: 7px 0;
  resize: none;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  font-size: 12px;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: #91a2a4;
}

.send-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  font-size: 19px;
  font-weight: 700;
  cursor: pointer;
}

.send-button:hover {
  background: var(--brand-dark);
}

.send-button:disabled {
  opacity: 0.48;
  cursor: wait;
}

.input-tools {
  margin-top: 7px;
  gap: 8px;
}

.input-tools > div {
  display: flex;
  gap: 3px;
}

.input-tools button {
  padding: 5px 7px;
  color: #617679;
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 10px;
  cursor: pointer;
}

.input-tools button:hover,
.input-tools button[aria-pressed="true"] {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.input-tools > span {
  color: #a0adaf;
  font-size: 8px;
}

.composer-status {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 8px;
  text-align: center;
}

.mobile-nav {
  display: none;
}

.security-settings-button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--brand-dark);
  background: var(--surface-soft);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
}

.security-settings-button:hover {
  background: var(--brand-soft);
  border-color: #afd3cc;
}

.settings-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 20px;
  overflow: auto;
}

.settings-dialog::backdrop {
  background: rgba(13, 34, 36, 0.56);
  backdrop-filter: blur(4px);
}

.settings-dialog-shell {
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 22px 70px rgba(10, 43, 43, 0.24);
}

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

.settings-heading h2 {
  margin: 0;
  font-size: 21px;
}

.settings-close {
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
}

.settings-intro {
  margin: 14px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

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

.settings-status-grid > div {
  min-width: 0;
  padding: 11px;
  display: grid;
  gap: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.settings-status-grid span {
  color: var(--faint);
  font-size: 10px;
}

.settings-status-grid strong {
  overflow: hidden;
  color: var(--brand-dark);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-reauth {
  margin-top: 14px;
  padding: 12px;
  color: #72561e;
  background: #fff7e4;
  border: 1px solid #eedcae;
  border-radius: 11px;
}

.settings-reauth p {
  margin: 0 0 9px;
  font-size: 11px;
  line-height: 1.55;
}

.settings-reauth button,
.settings-save {
  padding: 9px 13px;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

#settings-form {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.model-routing-section {
  margin-top: 16px;
  padding: 14px;
  background: #f7fbfa;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.settings-subheading h3 {
  margin: 0;
  font-size: 14px;
}

.settings-subheading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

#model-routing-form {
  margin-top: 11px;
  display: grid;
  gap: 10px;
}

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

#settings-form label,
#model-routing-form label {
  display: grid;
  gap: 6px;
}

#settings-form label > span,
#model-routing-form label > span {
  color: #39575a;
  font-size: 11px;
  font-weight: 700;
}

#settings-form select,
#settings-form input,
#model-routing-form select {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
}

#settings-form select:focus,
#settings-form input:focus,
#model-routing-form select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.settings-guidance {
  padding: 10px 11px;
  color: var(--muted);
  background: #f0f8f6;
  border-radius: 9px;
  font-size: 10px;
  line-height: 1.6;
}

.settings-result {
  min-height: 18px;
  margin: 0;
  color: var(--brand-dark);
  font-size: 11px;
}

.settings-result.is-error {
  color: var(--red);
}

.settings-actions {
  justify-content: flex-end;
  margin-top: 2px;
}

.settings-cancel {
  padding: 8px 12px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.settings-save:disabled,
.settings-reauth button:disabled,
#model-routing-save:disabled {
  opacity: 0.5;
  cursor: wait;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(355px, 0.76fr);
  }

  .overview-card {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
  }

  .identity-pill {
    display: none;
  }

  .company-picker select {
    width: min(310px, 42vw);
  }

  .workspace {
    height: auto;
    min-height: 0;
    grid-template-columns: 1fr;
  }

  .cockpit-panel {
    overflow: visible;
  }

  .ai-panel {
    min-height: 680px;
  }
}

@media (max-width: 620px) {
  body {
    padding-bottom: calc(59px + env(safe-area-inset-bottom));
    background: var(--canvas);
  }

  .topbar {
    min-height: 0;
    padding: 12px 14px;
    display: grid;
    gap: 12px;
  }

  .brand-mark {
    width: 41px;
    height: 41px;
    border-radius: 13px;
    font-size: 19px;
  }

  .brand-line h1 {
    font-size: 19px;
  }

  .brand-group p {
    font-size: 10px;
  }

  .topbar-actions,
  .company-picker,
  .company-picker select {
    width: 100%;
  }

  .security-settings-button {
    flex: 0 0 auto;
  }

  .settings-dialog-shell {
    padding: 18px 15px;
  }

  .settings-status-grid {
    grid-template-columns: 1fr;
  }

  .model-routing-grid {
    grid-template-columns: 1fr;
  }

  .company-picker select {
    min-height: 42px;
    font-size: 12px;
  }

  .system-notice {
    padding: 8px 14px;
  }

  .workspace {
    padding: 10px;
    gap: 10px;
  }

  .cockpit-panel,
  .ai-panel {
    border-radius: 18px;
  }

  .cockpit-panel {
    padding: 16px 13px;
  }

  .section-heading {
    align-items: flex-end;
  }

  .sync-time {
    max-width: 130px;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .overview-card {
    margin-top: 14px;
    padding: 17px 14px;
    gap: 16px;
  }

  .overview-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .overview-metrics > div:nth-child(3) {
    border-left: 0;
  }

  .overview-metrics > div:nth-child(n + 3) {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .dashboard-toolbar {
    align-items: flex-end;
  }

  .dashboard-toolbar p,
  .permission-hint {
    font-size: 9px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dashboard-card {
    min-height: 104px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 13px;
  }

  .card-copy small {
    white-space: normal;
  }

  .ai-panel {
    min-height: min(720px, calc(100vh - 78px));
    scroll-margin-top: 8px;
  }

  .conversation {
    padding: 17px 13px 11px;
  }

  .message-body {
    max-width: 90%;
    font-size: 12px;
  }

  .suggestion-block {
    margin-left: 0;
  }

  .suggestion-list {
    display: grid;
  }

  .suggestion-list button {
    text-align: left;
  }

  .composer-area {
    padding-right: 11px;
    padding-left: 11px;
  }

  .input-tools > span {
    display: none;
  }

  .mobile-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    min-height: 58px;
    padding: 6px max(12px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px rgba(30, 68, 67, 0.09);
    backdrop-filter: blur(14px);
  }

  .mobile-nav a {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #486467;
    background: var(--surface-soft);
    border-radius: 11px;
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
  }

  .mobile-nav a:last-child {
    color: #fff;
    background: var(--brand);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
