:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #20242a;
  --muted: #6a7280;
  --line: #dfe4ea;
  --accent: #08a6e0;
  --accent-soft: #e7f7fd;
  --warn: #a65f00;
  --danger: #b42318;
  --blue: #2563a8;
  --shadow: 0 10px 30px rgba(22, 34, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #18212d;
  color: #fff;
  padding: 22px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  padding: 3px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12px;
}

.menu {
  padding: 18px 0;
}

.menu button {
  width: 100%;
  height: 40px;
  margin: 2px 0;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
}

.menu button:hover,
.menu button.active {
  background: rgba(8, 166, 224, 0.22);
  color: #fff;
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 92px;
  padding: 0 30px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.page-kicker {
  color: var(--muted);
  font-size: 13px;
}

h1 {
  margin: 4px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.role-switcher {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.current-user {
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.content {
  padding: 24px 30px 40px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.metric {
  padding: 18px;
}

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

.metric-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 750;
}

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

.metric-action {
  margin-top: 10px;
}

.cockpit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.cockpit-card.ok {
  border-color: #b7eb8f;
  background: #f6ffed;
}

.cockpit-card.warn {
  border-color: #ffe58f;
  background: #fffbe6;
}

.cockpit-card.danger {
  border-color: #fecdca;
  background: #fff1f0;
}

.judgment-strip {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.judgment-title {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  font-size: 20px;
  font-weight: 750;
}

.summary-text {
  font-size: 15px;
  line-height: 1.8;
}

.business-summary-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.business-summary-card.ok {
  border-color: #b7eb8f;
  background: #f6ffed;
}

.business-summary-card.danger {
  border-color: #fecdca;
  background: #fff7f7;
}

.business-summary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.business-summary-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}

.business-summary-tag.ok {
  background: #dcfae6;
  color: #067647;
}

.business-summary-tag.danger {
  background: #fee4e2;
  color: #b42318;
}

.business-summary-text {
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  line-height: 1.75;
}

.decision-hero {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.decision-hero.ok {
  border-color: #b7eb8f;
  background: #f6ffed;
}

.decision-hero.danger {
  border-color: #fecdca;
  background: #fff7f7;
}

.decision-sentence {
  margin: 8px 0 6px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.45;
}

.decision-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.decision-risk {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.decision-risk.ok {
  border-color: #b7eb8f;
  background: #f6ffed;
}

.decision-risk.warn {
  border-color: #ffe58f;
  background: #fffbe6;
}

.decision-risk.danger {
  border-color: #fecdca;
  background: #fff1f0;
}

.decision-risk-title {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 800;
}

.decision-risk-text {
  max-width: 520px;
  color: #475467;
  font-size: 14px;
  line-height: 1.6;
  text-align: right;
}

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

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

.principal-problem,
.principal-advice {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 8px;
  line-height: 1.7;
}

.principal-problem.ok {
  border: 1px solid #b7eb8f;
  background: #f6ffed;
  color: #067647;
}

.principal-problem.warn {
  border: 1px solid #ffe58f;
  background: #fffbe6;
  color: #854a0e;
}

.principal-problem.danger {
  border: 1px solid #fecdca;
  background: #fff1f0;
  color: #b42318;
}

.principal-problem strong {
  font-size: 20px;
}

.principal-advice {
  border: 1px solid #abefc6;
  background: #ecfdf3;
  color: #067647;
  font-size: 18px;
  font-weight: 750;
}

.cost-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.cost-row {
  display: grid;
  grid-template-columns: 150px 1fr 110px 80px;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

.cost-name {
  font-weight: 650;
}

.cost-bar {
  height: 10px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.cost-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: #1677ff;
}

.cost-amount,
.cost-ratio {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.soft-hidden {
  display: none;
}

.section {
  margin-top: 18px;
  padding: 18px;
}

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

.section-title {
  font-size: 16px;
  font-weight: 700;
}

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

.button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.button.small {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #eef8fc;
  padding: 24px;
}

.login-card {
  width: min(880px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 330px;
  overflow: hidden;
}

.login-main {
  padding: 34px;
}

.login-logo {
  width: 240px;
  max-width: 100%;
  height: auto;
  display: block;
  margin-bottom: 18px;
}

.login-title {
  font-size: 22px;
  font-weight: 750;
  margin-bottom: 8px;
}

.login-note {
  color: var(--muted);
  margin-bottom: 22px;
  line-height: 1.6;
}

.login-visual {
  position: relative;
  min-height: 420px;
  padding: 32px 26px;
  background: #08a6e0;
  color: #fff;
  overflow: hidden;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 260px;
  height: 260px;
  border: 34px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.login-visual-title {
  position: relative;
  z-index: 1;
  font-size: 28px;
  font-weight: 800;
}

.login-visual-text {
  position: relative;
  z-index: 1;
  margin-top: 10px;
  max-width: 230px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.88);
}

.login-mascot {
  position: absolute;
  z-index: 1;
  right: 6px;
  bottom: -8px;
  width: 270px;
  height: auto;
  filter: drop-shadow(0 16px 24px rgba(13, 65, 94, 0.22));
}

@media (max-width: 860px) {
  body {
    min-width: 0;
  }

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

  .login-visual {
    display: none;
  }
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: #4b5563;
  background: #f9fafb;
  font-weight: 650;
}

tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #344054;
  font-size: 12px;
}

.status.ok {
  background: var(--accent-soft);
  color: var(--accent);
}

.status.warn {
  background: #fff4df;
  color: var(--warn);
}

.status.danger {
  background: #fee4e2;
  color: var(--danger);
}

.split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
}

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

.alert {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
}

.alert.danger {
  border-color: #fecdca;
  background: #fff1f0;
  color: var(--danger);
}

.empty {
  padding: 34px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.route-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

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

.tab-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.row-actions {
  display: flex;
  gap: 10px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  padding: 0;
  cursor: pointer;
  font-size: 13px;
}

.danger-link {
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.38);
  z-index: 20;
}

.modal {
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100vh - 60px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
}

.wide-modal {
  width: min(980px, calc(100vw - 48px));
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.evidence-preview {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.evidence-preview img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
  margin: 0 auto;
}

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

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.button.small {
  padding: 6px 10px;
  min-height: 30px;
  font-size: 12px;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

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

.form-field {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
}

.form-field.inline {
  align-content: end;
}

.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
}

.form-field textarea {
  resize: vertical;
}

.receipt-month-note {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  color: var(--muted);
  font-size: 13px;
}

.receipt-month-note strong {
  color: var(--ink);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding-top: 22px;
}

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

.checkbox-grid .checkbox-field {
  padding-top: 0;
}

.agency-type-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.agency-type-heading {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.agency-type-note {
  margin-top: -8px;
  color: var(--muted);
  font-size: 12px;
}

.agency-type-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #edf0f3;
  border-radius: 8px;
  background: #fff;
}

.agency-type-title {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.agency-type-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 8px;
}

.agency-type-option {
  display: flex;
  align-items: center;
  min-height: 36px;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #344054;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}

.agency-type-option input {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
}

.agency-type-option span {
  min-width: 0;
}

.agency-type-option:has(input:checked) {
  border-color: rgba(31, 122, 92, 0.45);
  background: var(--accent-soft);
  color: #12543f;
}

@media (max-width: 1280px) {
  .agency-type-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

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

@media (max-width: 760px) {
  .agency-type-grid {
    grid-template-columns: 1fr;
  }

  .cockpit-grid {
    grid-template-columns: 1fr;
  }

  .decision-metrics {
    grid-template-columns: 1fr;
  }

  .principal-metric-grid,
  .principal-health-grid {
    grid-template-columns: 1fr;
  }

  .decision-risk {
    display: grid;
  }

  .decision-risk-text {
    text-align: left;
  }

  .judgment-strip {
    display: grid;
  }

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

  .cost-amount,
  .cost-ratio {
    text-align: left;
  }
}

.required,
.form-error {
  color: var(--danger);
}

.form-error {
  grid-column: 1 / -1;
  min-height: 18px;
  font-size: 13px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

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

.form-hint {
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #eff6ff;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.form-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9fafb;
  color: var(--muted);
  font-size: 13px;
}

.positive-amount {
  color: #116149;
  font-variant-numeric: tabular-nums;
}

.negative-amount {
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.filters label {
  display: grid;
  gap: 6px;
  color: #4b5563;
  font-size: 12px;
}

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