:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #202a37;
  --muted: #667386;
  --line: #d9dee7;
  --line-strong: #c2ccd9;
  --navy: #183656;
  --teal: #257e84;
  --green: #2d7b59;
  --amber: #b76e13;
  --red: #a94442;
  --soft-blue: #eef5fa;
  --soft-teal: #eaf7f6;
  --soft-amber: #fff6e8;
  --shadow: 0 10px 26px rgba(31, 42, 55, 0.08);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 18%, rgba(37, 126, 132, 0.28), transparent 34%),
    linear-gradient(135deg, #102b47 0%, #183656 52%, #235f71 100%);
}

.login-card {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 24px 70px rgba(5, 20, 35, 0.3);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-brand h1 {
  color: var(--navy);
  font-size: 22px;
}

.login-brand p {
  margin-top: 6px;
  color: var(--muted);
}

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

.login-form {
  gap: 17px;
}

.login-form label span,
.standalone-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  outline: none;
}

.login-form input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(37, 126, 132, 0.13);
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 12px;
  align-items: end;
}

.captcha-image-button {
  height: 44px;
  padding: 0;
  overflow: hidden;
  background: #eef5fa;
}

.captcha-image-button img {
  display: block;
  width: 100%;
  height: 100%;
}

.login-submit {
  min-height: 46px;
  font-size: 16px;
}

.login-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.form-error,
.form-warning {
  color: var(--red) !important;
}

.auth-flow-version {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

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

button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  padding: 0 12px;
  cursor: pointer;
}

button:hover {
  border-color: var(--teal);
  background: #f8fcfc;
}

button.primary,
button.header-primary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  font-weight: 700;
}

button.danger {
  background: #fff;
  color: var(--red);
  border-color: #d8b8b7;
  font-weight: 700;
}

button.danger:hover {
  background: #fff7f7;
  border-color: var(--red);
}

button.compact {
  min-height: 30px;
  padding: 0 10px;
}

button.ghost-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.32);
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  outline: none;
  line-height: 1.6;
}

.app-header {
  height: 72px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding: 0 24px;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  font-weight: 800;
  font-size: 20px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.brand-area h1 {
  font-size: 21px;
  line-height: 1.2;
}

.brand-area p,
.chat-header p {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
}

.top-mode-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.account-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.current-user-badge {
  max-width: 240px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-nav button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.account-modal-panel,
.permission-modal-panel {
  width: min(920px, calc(100vw - 32px));
}

.admin-modal-panel {
  width: min(1180px, calc(100vw - 32px));
}

.account-modal-grid,
.permission-layout,
.admin-user-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.admin-user-layout {
  grid-template-columns: minmax(330px, 0.8fr) minmax(520px, 1.4fr);
}

.user-list-band {
  min-width: 0;
}

.admin-user-table,
.permission-list {
  display: grid;
  gap: 8px;
}

.admin-user-row,
.permission-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.permission-row {
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.admin-user-row > div:first-child,
.permission-row > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-user-row > div:first-child span,
.permission-row > div:first-child span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
}

.admin-user-actions button,
.permission-row button {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.status-dot {
  font-size: 12px;
  font-weight: 700;
}

.status-dot.active {
  color: var(--green);
}

.status-dot.disabled {
  color: var(--red);
}

.top-mode-nav button {
  min-width: 96px;
  color: rgba(255, 255, 255, 0.86);
  background: transparent;
  border-color: transparent;
  font-weight: 800;
}

.top-mode-nav button:hover,
.top-mode-nav button.active {
  color: var(--navy);
  background: #fff;
  border-color: #fff;
}

.app-shell {
  height: calc(100vh - 72px);
  min-height: 680px;
  padding: 14px;
  display: grid;
  grid-template-columns: 280px minmax(620px, 1fr) 360px;
  gap: 14px;
  overflow: hidden;
}

.report-mode-page .app-shell {
  height: calc(100vh - 72px - 58px);
  min-height: 600px;
}

.report-filter-bar {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(760px, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 42, 55, 0.06);
}

.report-filter-fields {
  display: grid;
  grid-template-columns: minmax(390px, 1.35fr) minmax(260px, 0.8fr) minmax(260px, 0.8fr);
  gap: 12px;
  align-items: center;
}

.report-filter-fields label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.report-filter-fields label span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.report-filter-fields select,
.report-filter-fields input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
}

.report-filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  align-self: center;
}

.app-shell.batch-mode {
  grid-template-columns: 310px 390px minmax(520px, 1fr);
}

.app-shell.report-mode.chat-collapsed {
  grid-template-columns: 280px minmax(620px, 1fr) 48px;
}

.nav-panel,
.result-panel,
.chat-panel {
  min-width: 0;
  min-height: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.nav-panel,
.chat-panel,
.result-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.status-panel {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.panel-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.status-panel strong {
  display: block;
  margin-top: 6px;
  color: var(--navy);
  font-size: 22px;
}

.status-panel p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.batch-mode .status-panel,
.batch-mode .side-detail,
.batch-mode .result-header,
.batch-mode .filter-echo {
  display: none;
}

.report-mode .status-panel,
.report-mode .mode-pill,
.report-mode .result-header p,
.report-mode .filter-echo {
  display: none;
}

.report-mode .result-header {
  min-height: 54px;
  align-items: center;
  padding: 12px 20px;
}

.report-mode .result-header h2 {
  margin-top: 0;
  line-height: 1.2;
}

.report-mode .summary-badges {
  align-items: center;
}

.report-mode .content-area {
  padding-top: 12px;
}

.module-nav {
  padding: 10px;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.report-mode .module-nav {
  display: block;
  padding: 16px 12px;
  background: #f8fafc;
  overflow: auto;
}

.batch-mode .module-nav {
  flex: 1;
  min-height: 0;
  align-content: start;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.module-nav button {
  width: 100%;
  height: auto;
  min-height: 58px;
  padding: 9px 10px;
  text-align: left;
}

.report-mode .module-nav button {
  min-height: 0;
}

.report-mode .nav-section {
  margin-bottom: 14px;
}

.report-mode .nav-section-title {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 10px;
}

.report-mode .nav-section-title.active {
  background: #e8f0f8;
}

.report-mode .nav-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.report-mode .nav-subitems {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 3px 0 8px 10px;
  padding-left: 8px;
  border-left: 1px solid #d8dee8;
}

.report-mode .nav-item {
  position: relative;
  display: flex;
  align-items: center;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #3b4654;
  font-size: 13px;
  font-weight: 400;
  min-height: 34px;
  padding: 0 4px 0 0;
}

.report-mode .nav-item:hover {
  background: #eef3f8;
}

.report-mode .nav-item.active,
.report-mode .nav-item.active-parent {
  background: #fff;
  border-left-color: var(--teal);
  color: var(--navy);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.report-mode .nav-item.active-parent:not(.active) {
  background: #e8f0f8;
  box-shadow: none;
}

.report-mode .nav-item.nav-level-1 {
  color: var(--navy);
  font-weight: 700;
}

.report-mode .nav-item.nav-level-2,
.report-mode .nav-item.nav-level-3 {
  color: #526173;
  font-size: 12px;
}

.module-nav button.active {
  border-color: var(--teal);
  background: var(--soft-teal);
}

.module-nav strong,
.module-nav span {
  display: block;
}

.module-nav span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.report-mode .nav-label {
  flex: 1;
  width: auto;
  min-width: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  min-height: 34px;
  padding: 7px 6px 7px 18px;
  text-align: left;
}

.report-mode .nav-level-2 .nav-label,
.report-mode .nav-level-3 .nav-label {
  padding-left: 14px;
}

.report-mode .nav-toggle {
  flex: 0 0 30px;
  width: 30px;
  min-height: 30px;
  height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.report-mode .nav-toggle:hover,
.report-mode .nav-toggle:focus-visible {
  background: #dfe9f3;
}

.report-mode .nav-toggle-icon {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: 0.76;
}

.report-mode .nav-item.expanded .nav-toggle-icon {
  transform: translateY(2px) rotate(225deg);
}

.report-mode .nav-item strong {
  display: block;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.35;
}

.report-mode .nav-item.active {
  background: #fff;
  border-left-color: var(--teal);
  color: var(--navy);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.empty-left-state {
  padding: 10px;
  line-height: 1.6;
}

.batch-list-header {
  display: grid;
  gap: 10px;
  padding: 4px 2px 8px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #ffffff;
}

.batch-list-header h2,
.middle-panel-title h2 {
  color: var(--navy);
  font-size: 17px;
  line-height: 1.25;
}

.batch-list-header button {
  width: 100%;
  min-height: 34px;
  padding: 0 12px;
  text-align: center;
}

.batch-card {
  border: 1px solid #eeeeee;
  border-left: 4px solid #dddddd;
  border-radius: 6px;
  background: #ffffff;
  padding: 10px;
  cursor: pointer;
  outline: none;
}

.batch-card:hover,
.batch-card:focus {
  background: #f5f9fd;
  border-left-color: #0069bb;
}

.batch-card.active {
  background: #ebf4fc;
  border-color: #b8d9f0;
  border-left-color: #0069bb;
}

.batch-card-status {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.batch-card-title {
  display: block;
  margin-top: 7px;
  color: var(--navy);
  font-size: 13px;
  line-height: 1.45;
}

.batch-card.active .batch-card-title {
  color: #0069bb;
}

.batch-card-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.batch-card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.batch-card-actions button {
  width: auto;
  min-height: 28px;
  padding: 0 6px;
  text-align: center;
  font-size: 12px;
}

.side-detail {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.side-detail h2 {
  color: var(--navy);
  font-size: 16px;
}

.batch-maintenance p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.batch-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.batch-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.batch-item strong,
.batch-item span {
  display: block;
}

.batch-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.field-label {
  display: block;
  margin: 12px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-control,
.range-grid input,
.form-grid input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 9px;
}

.range-grid {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.range-grid label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.side-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.side-actions.single {
  grid-template-columns: 1fr;
}

.side-note {
  margin-top: 12px;
  padding: 10px;
  border-radius: 6px;
  background: var(--soft-blue);
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.result-header {
  min-height: 104px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.mode-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  background: var(--soft-blue);
  color: var(--navy);
}

.result-header h2 {
  margin-top: 8px;
  color: var(--navy);
  font-size: 22px;
  line-height: 1.25;
}

.result-header p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.result-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.report-export-button {
  min-height: 30px;
  color: var(--teal);
  border-color: #b9d8d9;
  background: #f8fcfc;
  font-weight: 700;
  white-space: nowrap;
}

.report-export-button:hover {
  border-color: var(--teal);
  background: #eef8f8;
}

.report-export-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.summary-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter-echo {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.content-area {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 20px 24px;
}

.batch-mode .content-area {
  padding: 12px;
}

.middle-panel-title {
  padding: 4px 2px 12px;
}

.feature-list {
  display: grid;
  gap: 10px;
}

.project-browser-active .feature-list {
  gap: 7px;
}

.project-browser-active .feature-card {
  min-height: 64px;
  padding: 9px 10px;
}

.feature-card {
  width: 100%;
  min-height: 76px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  text-align: left;
  border-left: 4px solid #d3dbe5;
}

.feature-card:hover,
.feature-card.active {
  border-color: #0069bb;
  border-left-color: #0069bb;
  background: #ebf4fc;
}

.feature-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #eef3f8;
  color: var(--navy);
  font-size: 12px;
  font-weight: 800;
}

.feature-card strong,
.feature-card em {
  display: block;
}

.feature-card strong {
  color: var(--navy);
  font-size: 14px;
}

.feature-card em {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.telecom-share-metric-groups {
  display: grid;
  gap: 14px;
}

.telecom-share-metric-title {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
}

.telecom-share-metric-grid {
  grid-template-columns: repeat(3, 1fr);
}

.metric-card,
.content-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric-card {
  min-height: 108px;
  padding: 14px;
}

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

.metric-value {
  margin-top: 6px;
  color: var(--navy);
  font-size: 22px;
  font-weight: 800;
}

.metric-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.content-band {
  margin-top: 12px;
  padding: 16px;
}

.content-band h3 {
  color: var(--navy);
  font-size: 16px;
  margin-bottom: 10px;
}

.content-band p {
  color: #364356;
  line-height: 1.8;
}

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

.two-column .content-band {
  margin-top: 0;
}

.block-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.block-stack .content-band {
  margin-top: 0;
}

.visual-summary-band {
  padding: 14px 16px;
}

.visual-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.visual-title-row h3 {
  margin-bottom: 0;
}

.visual-title-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.chart-type-pill {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: #eef6f7;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
}

.visual-band {
  overflow: hidden;
}

.sankey-band {
  padding: 14px 16px 10px;
}

.sankey-chart {
  width: 100%;
  height: clamp(460px, 58vh, 680px);
  margin-top: 8px;
}

.pie-chart {
  width: 100%;
  height: 360px;
  min-height: 280px;
  margin-top: 8px;
}

.sankey-resizer {
  height: 12px;
  margin: 4px -16px -10px;
  border-top: 1px solid #d8dee8;
  border-bottom: 1px solid #cbd5e1;
  background: linear-gradient(to bottom, #f4f7fb, #e2e8f0);
  cursor: row-resize;
  position: relative;
}

.sankey-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 3px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #94a3b8;
}

.sankey-resizer:hover::before,
.sankey-resizer.dragging::before {
  background: var(--teal);
}

body.resizing-sankey {
  cursor: row-resize;
  user-select: none;
}

.chart-fallback {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: #fbfcfd;
}

.interpretation-band {
  background: #fbfcfe;
}

.interpretation-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.interpretation-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.interpretation-title-group h3 {
  margin: 0;
}

.interpretation-source {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.interpretation-source.rule {
  color: var(--teal);
  background: #eef6f7;
}

.interpretation-source.ai {
  color: #174a7c;
  background: #eaf2fb;
}

.interpretation-source.pending {
  color: var(--amber);
  background: #fff6e8;
}

.interpretation-source.failed {
  color: var(--red);
  background: #fff1f1;
}

.interpretation-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.interpretation-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.interpretation-controls select {
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 8px;
  background: #fff;
  color: var(--ink);
}

.interpretation-body {
  color: #2d3b4f;
  line-height: 1.75;
}

.interpretation-body p {
  margin: 0 0 10px;
}

.interpretation-body h4 {
  margin: 12px 0 6px;
  color: var(--navy);
  font-size: 14px;
}

.interpretation-body ul {
  margin: 0 0 10px;
  padding-left: 20px;
}

.maintenance-records-band {
  grid-column: 1 / -1;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title-row h3 {
  margin-bottom: 0;
}

.data-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.project-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 220px)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.project-filter-grid label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.project-filter-grid select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}

.batch-project-browser-shell {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.batch-project-browser-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.batch-project-browser-title div {
  display: grid;
  gap: 2px;
}

.batch-project-browser-title span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.batch-project-browser-title strong {
  color: var(--navy);
  font-size: 14px;
}

.batch-project-browser-title em {
  color: var(--teal);
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}

.batch-project-browser-shell .project-filter-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 0;
  padding: 9px;
}

.batch-project-browser-shell .project-filter-grid > button {
  grid-column: 1 / -1;
}

.batch-project-browser-shell .project-dimension-browser {
  margin-bottom: 0;
}

.project-dimension-selector {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.project-dimension-selector label {
  min-width: 0;
}

.project-dimension-selector label span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.project-dimension-selector select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--navy);
  padding: 0 8px;
  font-weight: 700;
}

.project-dimension-selector > strong {
  max-width: 155px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-align: right;
}

.batch-project-browser-shell .project-dimension-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.batch-project-browser-shell .project-dimension-tabs button {
  min-height: 58px;
}

.batch-project-browser-shell .project-path-row,
.batch-project-browser-shell .project-tree-heading {
  align-items: flex-start;
  flex-direction: column;
}

.batch-project-browser-shell .project-path-row {
  gap: 7px;
}

.batch-project-browser-shell .project-path-summary {
  display: none;
}

.batch-project-browser-shell .project-tree-heading {
  gap: 3px;
}

.batch-project-browser-shell .project-tree {
  max-height: 460px;
}

.batch-project-browser-shell .project-tree-node {
  grid-template-columns: 25px minmax(82px, 1fr) auto minmax(72px, auto);
  gap: 4px;
  margin-left: calc(var(--project-tree-level) * 12px);
  padding-right: 5px;
}

.batch-project-browser-shell .project-tree-toggle,
.batch-project-browser-shell .project-tree-leaf {
  width: 24px;
}

.batch-project-browser-shell .project-tree-metric {
  font-size: 10px;
}

.batch-project-browser-shell .project-tree-label {
  padding-left: 2px;
}

.project-dimension-browser {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.project-dimension-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.project-dimension-tabs button {
  min-width: 0;
  min-height: 62px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 8px 10px;
  text-align: left;
  border-color: var(--line);
  background: #fff;
}

.project-dimension-tabs button strong,
.project-dimension-tabs button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-dimension-tabs button strong {
  color: var(--navy);
  font-size: 13px;
  white-space: nowrap;
}

.project-dimension-tabs button span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.project-dimension-tabs button.active {
  border-color: var(--teal);
  background: var(--soft-teal);
  box-shadow: inset 0 0 0 1px rgba(37, 126, 132, 0.12);
}

.project-tree-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.project-path-row {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.project-path-breadcrumb {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.project-path-breadcrumb button {
  min-height: 34px;
  display: grid;
  gap: 1px;
  padding: 4px 8px;
  border-color: #cfe1e1;
  background: var(--soft-teal);
  text-align: left;
}

.project-path-breadcrumb button.root {
  border-color: var(--line);
  background: #f7f9fb;
}

.project-path-breadcrumb button small {
  color: var(--muted);
  font-size: 10px;
}

.project-path-breadcrumb button strong {
  color: var(--navy);
  font-size: 12px;
}

.project-path-separator {
  color: #96a3b3;
  font-weight: 800;
}

.project-path-summary {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.project-tree-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px 5px;
}

.project-tree-heading strong {
  color: var(--navy);
  font-size: 13px;
}

.project-tree-heading span {
  color: var(--muted);
  font-size: 11px;
}

.project-tree {
  max-height: 420px;
  overflow: auto;
  padding: 5px 8px 10px;
}

.project-tree-node {
  min-height: 42px;
  display: grid;
  grid-template-columns: 28px minmax(120px, 1fr) auto minmax(94px, auto);
  align-items: center;
  gap: 6px;
  margin-left: calc(var(--project-tree-level) * 18px);
  padding: 3px 7px 3px 3px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.project-tree-node:hover {
  background: #f0f5f8;
}

.project-tree-node.active {
  border-color: #b9dada;
  background: var(--soft-teal);
}

.project-tree-toggle,
.project-tree-leaf {
  width: 26px;
  height: 28px;
}

.project-tree-toggle {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
}

.project-tree-toggle span {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translate(-2px, 0) rotate(-45deg);
}

.project-tree-toggle.expanded span {
  transform: translate(0, -2px) rotate(45deg);
}

.project-tree-leaf {
  display: block;
  position: relative;
}

.project-tree-leaf::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 13px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #aab5c2;
}

.project-tree-label {
  min-width: 0;
  min-height: 34px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 3px 5px;
  border: 0;
  background: transparent;
  text-align: left;
}

.project-tree-label small {
  color: var(--muted);
  font-size: 10px;
}

.project-tree-label strong {
  overflow: hidden;
  color: var(--navy);
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-tree-metric {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.project-tree-metric.amount {
  color: var(--navy);
  font-weight: 700;
  text-align: right;
}

.project-tree-empty,
.project-card-empty {
  padding: 26px 12px;
  color: var(--muted);
  text-align: center;
}

.project-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}

.project-detail-band .project-card-grid {
  grid-template-columns: 1fr;
}

.project-detail-band {
  margin-top: 0;
  padding: 0;
  border: 0;
}

.project-results-toolbar {
  margin-bottom: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-results-toolbar .section-title-row {
  margin-bottom: 8px;
}

.project-results-toolbar-body {
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(390px, 1.1fr);
  gap: 10px;
  align-items: stretch;
}

.project-results-toolbar .project-filter-grid {
  grid-template-columns: repeat(3, minmax(115px, 1fr)) auto;
  gap: 7px;
  margin-bottom: 0;
  padding: 8px;
  border-color: #d8e4ea;
  background: #f7fafb;
}

.project-results-toolbar .project-filter-grid label span {
  margin-bottom: 3px;
  font-size: 10px;
}

.project-results-toolbar .project-filter-grid select {
  min-height: 32px;
}

.project-results-toolbar .project-filter-grid > button {
  min-height: 32px;
  padding: 0 9px;
}

.project-result-scope {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
  padding: 9px 11px;
  border: 1px solid #cfe1e1;
  border-radius: 7px;
  background: var(--soft-teal);
}

.project-result-path {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.project-result-path span {
  color: var(--muted);
  font-size: 10px;
}

.project-result-path strong {
  overflow: hidden;
  color: var(--navy);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-result-tags {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.project-result-tags span {
  padding: 3px 6px;
  border: 1px solid rgba(37, 126, 132, 0.18);
  border-radius: 4px;
  background: #fff;
  color: #476276;
  font-size: 10px;
  font-weight: 700;
}

.project-record-card {
  min-width: 0;
  display: grid;
  gap: 7px;
  padding: 11px 16px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid #91bcc0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(31, 42, 55, 0.04);
}

.project-record-card.excluded-from-detail-stats {
  border-color: rgba(217, 143, 37, 0.42);
  border-left-color: #d98f25;
  background: #fffaf1;
}

.project-record-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.project-record-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.project-stat-inclusion-control {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.project-stat-inclusion-control select {
  min-width: 92px;
  height: 28px;
  padding: 2px 24px 2px 8px;
  border: 1px solid rgba(37, 126, 132, 0.26);
  border-radius: 5px;
  background-color: #fff;
  color: #29485b;
  font-size: 11px;
  font-weight: 700;
}

.excluded-from-detail-stats .project-stat-inclusion-control select {
  border-color: rgba(217, 143, 37, 0.55);
  color: #9a5b0a;
}

.project-record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.project-record-tags span {
  padding: 3px 6px;
  border-radius: 4px;
  background: #edf3f7;
  color: #536579;
  font-size: 10px;
  font-weight: 700;
}

.project-record-amount {
  flex: 0 0 auto;
  color: var(--teal);
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.project-record-card h4 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--navy);
  font-size: 16px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-record-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  column-gap: 18px;
  row-gap: 7px;
}

.project-record-info-grid .project-record-tags {
  min-height: 22px;
  align-content: start;
}

.project-record-meta {
  min-width: 0;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
}

.project-record-meta span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.project-record-meta strong {
  min-width: 0;
  color: #273b52;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.pager-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.pager-actions {
  display: flex;
  gap: 8px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.standalone-form {
  margin-top: 0;
}

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

.form-grid.compact {
  gap: 10px;
}

.form-grid label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.form-wide,
.form-wide-band {
  grid-column: 1 / -1;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

.checkbox-line span {
  margin: 0;
}

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

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

.bar-row {
  display: grid;
  grid-template-columns: minmax(96px, var(--bar-label-width, 150px)) 1fr 164px;
  gap: 10px;
  align-items: center;
}

.month-trend-row {
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(160px, 1fr) minmax(164px, var(--month-trend-values-width, 164px));
  gap: 10px;
  align-items: center;
}

.month-trend-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bar-name {
  color: var(--navy);
  font-size: var(--bar-name-font-size, 14px);
  font-weight: 700;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: var(--bar-name-white-space, nowrap);
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #edf1f5;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
}

.bar-value {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar-list.split-values .bar-row {
  grid-template-columns: minmax(96px, var(--bar-label-width, 150px)) 1fr minmax(174px, var(--bar-values-width, 214px));
}

.bar-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bar-values {
  display: grid;
  grid-template-columns: repeat(var(--bar-value-columns, 2), minmax(76px, 1fr));
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.bar-value-cell {
  min-width: 0;
  line-height: 1.25;
  white-space: pre-line;
}

.month-trend-values {
  display: grid;
  grid-template-columns: repeat(var(--month-trend-value-columns, 1), minmax(150px, 1fr));
  gap: 14px;
  align-items: center;
}

.month-trend-value-group {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.month-dual-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.month-dual-legend-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  line-height: 1.25;
  white-space: pre-line;
}

.month-dual-legend-item i {
  width: 18px;
  height: 8px;
  border-radius: 999px;
  background: var(--teal);
  flex: 0 0 auto;
  margin-top: 4px;
}

.month-dual-legend-item.series-1 i {
  background: #3b6ea8;
}

.month-dual-bars {
  display: grid;
  gap: 5px;
}

.month-dual-track {
  height: 8px;
  border-radius: 999px;
  background: #edf1f5;
  overflow: hidden;
}

.month-dual-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
}

.month-dual-fill.series-1 {
  background: #3b6ea8;
}

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

.month-split-chart {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 12px 10px;
  background: #ffffff;
}

.month-split-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--navy);
  font-weight: 800;
}

.month-split-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.month-split-row {
  display: grid;
  grid-template-columns: 78px minmax(96px, 1fr) 86px;
  gap: 10px;
  align-items: center;
  min-height: 31px;
}

.month-split-head {
  min-height: 24px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.month-split-value {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.bar-fill.series-1 {
  background: #3b6ea8;
}

.bar-dual-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.bar-dual-legend-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--muted);
  line-height: 1.25;
  white-space: pre-line;
}

.bar-dual-legend-item i {
  width: 18px;
  height: 8px;
  border-radius: 999px;
  background: var(--bar-dual-color-0, var(--teal));
  flex: 0 0 auto;
  margin-top: 4px;
}

.bar-dual-legend-item.series-1 i {
  background: var(--bar-dual-color-1, #3b6ea8);
}

.bar-dual-bars {
  display: grid;
  gap: 0;
}

.bar-dual-track {
  height: 8px;
  border-radius: 0;
  background: #edf1f5;
  overflow: hidden;
}

.bar-dual-track:first-child {
  border-radius: 999px 999px 0 0;
}

.bar-dual-track:last-child {
  border-radius: 0 0 999px 999px;
}

.bar-dual-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--bar-dual-color-0, var(--teal));
}

.bar-dual-fill.series-1 {
  background: var(--bar-dual-color-1, #3b6ea8);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--navy);
  background: #eef3f8;
  font-weight: 800;
  white-space: nowrap;
}

td {
  color: #344154;
  line-height: 1.55;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.empty-state {
  min-height: 360px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  color: var(--navy);
  font-size: 20px;
  margin-bottom: 6px;
}

.empty-state p {
  max-width: 540px;
  margin-bottom: 14px;
  line-height: 1.7;
}

.chat-workspace,
.batch-detail-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.batch-detail-header {
  min-height: 88px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

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

.batch-detail-header h2 {
  margin-top: 5px;
  color: var(--navy);
  font-size: 18px;
}

.batch-detail-header p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.batch-detail-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background: #ffffff;
}

.batch-detail-panel.project-detail-compact .batch-detail-body {
  padding: 10px 12px 14px;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 34, 51, 0.46);
}

.modal-panel {
  width: min(860px, 94vw);
  max-height: min(760px, 92vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal-header {
  min-height: 86px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.modal-header h2 {
  margin-top: 5px;
  color: var(--navy);
  font-size: 20px;
}

.modal-header p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.55;
}

.icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
}

.modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px;
}

.chat-header {
  min-height: 56px;
  padding: 12px 16px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-header h2 {
  font-size: 17px;
}

.chat-toggle-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.32);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.chat-toggle-button:hover {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.2);
}

.project-chip {
  align-self: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
}

.report-mode.chat-collapsed .chat-panel,
.report-mode.chat-collapsed .chat-workspace {
  background: var(--navy);
}

.report-mode.chat-collapsed .chat-header {
  flex: 1;
  min-height: 0;
  flex-direction: column;
  justify-content: flex-start;
  padding: 8px 5px;
}

.report-mode.chat-collapsed .chat-header > div,
.report-mode.chat-collapsed .project-chip,
.report-mode.chat-collapsed .chat-messages,
.report-mode.chat-collapsed .chat-form {
  display: none;
}

.report-mode.chat-collapsed .chat-header::after {
  content: "Agent Chat";
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: #f8fafb;
}

.message {
  display: flex;
  margin-bottom: 12px;
}

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

.bubble {
  max-width: 90%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  line-height: 1.65;
  white-space: pre-wrap;
}

.message.user .bubble {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.message.thinking .bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #42546a;
  background: #fff;
  border-color: var(--line);
}

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

.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--teal);
  opacity: 0.35;
  animation: thinkingPulse 1.05s infinite ease-in-out;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes thinkingPulse {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 34px;
}

.quick-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.quick-actions button.confirm {
  color: #0f766e;
  border-color: #9fd4ce;
  background: #f1fbf9;
}

.quick-actions button.discard {
  color: #b42318;
  border-color: #e4aaa4;
  background: #fff7f6;
}

.action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
}

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

.chat-form textarea {
  grid-column: 1 / -1;
}

.chat-form .quick-actions {
  grid-column: 1;
  padding: 0;
  border-top: 0;
  background: transparent;
}

.chat-form .quick-actions:empty {
  visibility: hidden;
}

.chat-form button.primary {
  grid-column: 2;
  align-self: center;
  min-width: 74px;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 50;
  transform: translateX(-50%);
  min-width: 220px;
  max-width: min(560px, 92vw);
  padding: 10px 14px;
  border-radius: 6px;
  background: #172233;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  transition: opacity 0.18s ease;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 1450px) {
  .project-results-toolbar-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .report-filter-bar {
    grid-template-columns: 1fr;
  }

  .report-filter-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .app-shell {
    grid-template-columns: 240px 1fr;
    overflow: auto;
    height: auto;
  }

  .app-shell.batch-mode {
    grid-template-columns: 280px 340px minmax(500px, 1fr);
  }

  .app-shell.report-mode.chat-collapsed {
    grid-template-columns: 240px 1fr;
  }

  .chat-panel {
    grid-column: 1 / -1;
    min-height: 420px;
  }

  .report-mode.chat-collapsed .chat-panel {
    min-height: 48px;
  }

  .report-mode.chat-collapsed .chat-header {
    flex-direction: row;
    justify-content: flex-start;
  }

  .report-mode.chat-collapsed .chat-header::after {
    margin-top: 0;
    margin-left: 8px;
    writing-mode: horizontal-tb;
  }
}

@media (max-width: 860px) {
  .app-header {
    height: auto;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-mode-nav {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .account-nav {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .current-user-badge {
    width: 100%;
    max-width: none;
  }

  .account-modal-grid,
  .permission-layout,
  .admin-user-layout {
    grid-template-columns: 1fr;
  }

  .admin-user-row {
    grid-template-columns: 1fr auto;
  }

  .admin-user-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
  }

  .captcha-row {
    grid-template-columns: 1fr;
  }

  .captcha-image-button {
    width: 160px;
  }

  .app-shell,
  .metric-grid,
  .two-column,
  .report-filter-fields {
    grid-template-columns: 1fr;
  }

  .app-shell.batch-mode {
    grid-template-columns: 1fr;
  }

  .report-filter-bar {
    padding: 12px;
  }

  .report-filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .result-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .chat-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .project-filter-grid {
    grid-template-columns: 1fr;
  }

  .project-results-toolbar .project-filter-grid {
    grid-template-columns: 1fr;
  }

  .project-dimension-selector {
    grid-template-columns: 1fr;
  }

  .project-dimension-selector > strong {
    max-width: none;
    padding-bottom: 0;
    text-align: left;
  }

  .project-dimension-tabs {
    grid-template-columns: 1fr;
  }

  .project-path-row,
  .project-tree-heading,
  .project-result-scope {
    align-items: flex-start;
    flex-direction: column;
  }

  .project-result-tags {
    justify-content: flex-start;
  }

  .project-tree-node {
    grid-template-columns: 28px minmax(100px, 1fr) auto;
  }

  .project-tree-metric.amount {
    display: none;
  }

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

  .visual-title-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .sankey-chart {
    height: 520px;
  }

  .interpretation-toolbar,
  .interpretation-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-title-row,
  .pager-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .bar-row {
    grid-template-columns: 100px 1fr;
  }

  .bar-list.split-values .bar-row {
    grid-template-columns: 100px 1fr;
  }

  .bar-list.split-values .bar-values {
    grid-column: 1 / -1;
  }

  .month-trend-row {
    grid-template-columns: 78px minmax(72px, 1fr);
    gap: 8px;
  }

  .month-trend-values {
    grid-column: 1 / -1;
    grid-template-columns: repeat(var(--month-trend-value-columns, 1), minmax(132px, 1fr));
  }

  .month-split-grid {
    grid-template-columns: 1fr;
  }

  .month-split-row {
    grid-template-columns: 72px minmax(72px, 1fr) 80px;
    gap: 8px;
  }

.month-trend-head {
  font-size: 11px;
}

.bar-value {
    grid-column: 1 / -1;
    text-align: left;
  }
}
