:root {
  color-scheme: light;
  --canvas: #f6f8fb;
  --surface: #ffffff;
  --brand: #2867e8;
  --brand-soft: #eaf1ff;
  --text: #172033;
  --muted: #667085;
  --line: #e5e9ef;
  --success: #2f8d5a;
  --warning: #b36c0f;
  --danger: #c33b3b;
  --sidebar: 220px;
  --topbar: 64px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--canvas);
  color: var(--text);
}

body {
  font-size: 14px;
  line-height: 1.5;
}

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

button,
a,
select,
input {
  min-height: 44px;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid rgba(40, 103, 232, 0.28);
  outline-offset: 2px;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: var(--surface);
}

.login-panel {
  width: min(420px, 100%);
  padding: 52px 44px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.brand {
  color: #1260d9;
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand-login {
  margin-bottom: 34px;
  font-size: 34px;
}

.login-panel h1 {
  margin: 0 0 10px;
  font-size: 28px;
  line-height: 1.25;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
}

.login-button {
  width: 100%;
  margin: 32px 0 18px;
}

.login-panel .login-footnote {
  font-size: 13px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template: var(--topbar) 1fr / var(--sidebar) minmax(0, 1fr);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  min-height: var(--topbar);
  padding: 0 26px 0 34px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar .brand {
  width: calc(var(--sidebar) - 58px);
}

.topbar-spacer {
  flex: 1;
}

.menu-button {
  position: relative;
}

.menu-button::before,
.menu-button::after {
  position: absolute;
  left: 12px;
  width: 20px;
  height: 2px;
  content: "";
  background: currentColor;
}

.menu-button::before {
  top: 15px;
  box-shadow: 0 6px currentColor;
}

.menu-button::after {
  top: 27px;
}

.icon-button,
.text-button {
  border: 0;
  background: transparent;
}

.icon-button {
  width: 44px;
  padding: 0;
}

.text-button {
  min-width: 44px;
  color: var(--brand);
}

.sync-state {
  margin-right: 28px;
  color: var(--muted);
  white-space: nowrap;
}

.sync-state[data-ok="true"] {
  color: var(--success);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu strong,
.user-menu span {
  display: block;
}

.user-menu strong {
  font-size: 14px;
}

.user-menu div span {
  color: var(--muted);
  font-size: 12px;
}

.user-avatar,
.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: var(--surface);
  font-weight: 650;
}

.user-avatar {
  width: 36px;
  height: 36px;
}

.avatar {
  width: 30px;
  height: 30px;
}

.sidebar {
  position: sticky;
  top: var(--topbar);
  display: flex;
  height: calc(100vh - var(--topbar));
  flex-direction: column;
  gap: 4px;
  padding: 18px 8px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 0 14px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: #344054;
  text-align: left;
}

.nav-item:hover,
.nav-item[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand);
}

.nav-item[aria-current="page"] {
  border-left-color: var(--brand);
  font-weight: 650;
}

.nav-item svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.75;
}

.view-root {
  min-width: 0;
  padding: 20px 24px 28px;
}

.view-header,
.detail-hero,
.section-header,
.toolbar,
.pagination,
.drawer-header,
.action-row {
  display: flex;
  align-items: center;
}

.view-header {
  justify-content: space-between;
  min-height: 52px;
  margin-bottom: 14px;
}

.view-title,
.detail-title {
  margin: 0;
  letter-spacing: -0.025em;
}

.view-title {
  font-size: 28px;
}

.detail-title {
  font-size: 30px;
}

.view-subtitle,
.eyeline,
.muted {
  color: var(--muted);
}

.view-subtitle {
  margin: 4px 0 0;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  display: grid;
  min-height: 118px;
  padding: 24px;
  grid-template-columns: 42px 1fr;
  gap: 13px;
  align-items: center;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
}

.metric-icon svg {
  width: 22px;
  height: 22px;
}

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

.metric-value {
  display: block;
  margin-top: 2px;
  font-size: 28px;
  font-weight: 720;
  line-height: 1.2;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 16px;
}

.overview-main {
  min-width: 0;
}

.panel,
.rail-section,
.detail-section,
.detail-side,
.task-workspace {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.section-header {
  min-height: 56px;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.section-header h2,
.rail-section h2,
.detail-section h2,
.detail-side h2,
.drawer h2 {
  margin: 0;
  font-size: 17px;
}

.toolbar {
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.field,
.search-field {
  min-width: 148px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #cad2df;
  border-radius: 6px;
  background: var(--surface);
}

.search-field {
  min-width: 250px;
  flex: 1;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 620;
  text-decoration: none;
}

.button-primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--surface);
}

.button-secondary {
  border-color: #b9c5d6;
  background: var(--surface);
  color: var(--text);
}

.button-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
}

.button-danger {
  border-color: #e2b6b6;
  background: var(--surface);
  color: var(--danger);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

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

.data-table th {
  background: #fbfcfe;
  color: #475467;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background-color 120ms ease;
}

.data-table tbody tr:hover {
  background: #f8faff;
}

.customer-link {
  color: var(--brand);
  font-weight: 650;
  text-decoration: none;
}

.cell-secondary {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.score {
  color: var(--success);
  font-weight: 700;
}

.score.medium {
  color: var(--warning);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #98a2b3;
  content: "";
}

.status[data-tone="success"]::before {
  background: var(--success);
}

.status[data-tone="warning"]::before {
  background: #f0a01b;
}

.status[data-tone="info"]::before {
  background: var(--brand);
}

.pagination {
  min-height: 58px;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  padding: 0 14px;
  color: var(--muted);
}

.page-controls,
.page-size-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.page-size {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.page-number {
  min-width: 92px;
  text-align: center;
}

.side-rail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rail-section {
  padding: 18px;
}

.rail-section h2 {
  margin-bottom: 12px;
}

.advice-list,
.service-list,
.timeline,
.compact-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.advice-item,
.service-item {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.advice-item:last-child,
.service-item:last-child {
  border-bottom: 0;
}

.advice-number {
  color: var(--brand);
  font-size: 21px;
  font-weight: 700;
}

.service-item strong {
  color: var(--success);
}

.detail-hero {
  flex-wrap: wrap;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 6px 2px 14px;
  border-bottom: 1px solid var(--line);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 8px;
}

.detail-stat {
  padding-right: 24px;
  border-right: 1px solid var(--line);
}

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

.detail-stat strong {
  display: block;
  color: var(--brand);
  font-size: 22px;
}

.detail-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.detail-main {
  display: flex;
  flex-direction: column;
}

.detail-section {
  border-radius: 0;
  border-bottom: 0;
  padding: 16px;
}

.detail-section:first-child {
  border-radius: 8px 8px 0 0;
}

.detail-section:last-child {
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
}

.detail-section h2,
.detail-side h2 {
  margin-bottom: 12px;
}

.detail-section p {
  margin: 0;
}

.detail-side {
  align-self: start;
  overflow: hidden;
}

.detail-side-block {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-side-block:last-child {
  border-bottom: 0;
}

.definition-list {
  display: grid;
  margin: 0;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px 14px;
}

.definition-list dt {
  color: var(--muted);
}

.definition-list dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.external-link {
  color: var(--brand);
  overflow-wrap: anywhere;
}

.timeline {
  padding-left: 12px;
  border-left: 2px solid var(--line);
}

.timeline li {
  position: relative;
  padding: 0 0 18px 15px;
}

.timeline li::before {
  position: absolute;
  top: 5px;
  left: -18px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--brand);
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.timeline time {
  color: var(--muted);
  font-size: 12px;
}

.form-stack {
  display: grid;
  gap: 13px;
}

.form-row {
  display: grid;
  gap: 6px;
}

.form-row label {
  font-weight: 620;
}

.form-row input,
.form-row select,
.form-row textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #bdc8d8;
  border-radius: 6px;
  background: var(--surface);
}

.form-row textarea {
  min-height: 108px;
  resize: vertical;
}

.form-help {
  color: var(--muted);
  font-size: 12px;
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  min-height: calc(100vh - 104px);
  margin: -20px -24px -28px;
}

.task-workspace {
  border-width: 0 1px 0 0;
  border-radius: 0;
  padding: 20px 20px 28px;
}

.drawer {
  padding: 20px 22px;
  background: var(--surface);
}

.drawer-header {
  justify-content: space-between;
  margin-bottom: 22px;
}

.stepper {
  display: grid;
  margin-bottom: 28px;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.step {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
}

.step.active {
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 650;
}

.budget-box,
.notice-box {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #b9cef8;
  border-radius: 6px;
  background: #f8faff;
}

.budget-box ul {
  margin: 8px 0 0;
  padding-left: 22px;
}

.drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.task-title {
  max-width: 250px;
  font-weight: 650;
}

.state-panel {
  display: grid;
  min-height: 320px;
  place-items: center;
  padding: 40px 24px;
  text-align: center;
}

.state-panel h2 {
  margin: 0 0 6px;
  font-size: 19px;
}

.state-panel p {
  max-width: 460px;
  margin: 0 0 18px;
  color: var(--muted);
}

.loading-mark {
  width: 30px;
  height: 30px;
  margin: 0 auto 14px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast-region {
  position: fixed;
  z-index: 90;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: min(360px, calc(100vw - 40px));
  gap: 8px;
}

.toast {
  padding: 13px 15px;
  border: 1px solid #c7d3e2;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(23, 32, 51, 0.16);
}

.toast.error {
  border-color: #e4b9b9;
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 32, 51, 0.42);
}

.confirm-modal {
  width: min(520px, 100%);
  padding: 24px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(23, 32, 51, 0.24);
}

.confirm-modal h2 {
  margin: 0 0 8px;
  font-size: 21px;
}

.confirm-modal p {
  margin: 0;
  color: var(--muted);
}

.confirm-summary {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.modal-actions {
  justify-content: flex-end;
}

.app-shell.nav-collapsed {
  --sidebar: 72px;
}

.nav-collapsed .nav-item span:last-child,
.nav-collapsed .topbar .brand {
  overflow: hidden;
  width: 0;
}

@media (max-width: 1100px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .side-rail {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .task-layout {
    grid-template-columns: minmax(0, 1fr) 390px;
  }
}

@media (max-width: 819px) {
  :root {
    --topbar: 60px;
  }

  body {
    padding-bottom: 70px;
  }

  .app-shell {
    display: block;
  }

  .topbar {
    min-height: var(--topbar);
    padding: 0 14px;
  }

  .topbar .brand {
    width: auto;
    font-size: 23px;
  }

  .menu-button,
  .sync-state,
  .user-menu div {
    display: none;
  }

  #logout-button {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    z-index: 70;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    height: 70px;
    padding: 4px;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    border: 0;
    border-top: 1px solid var(--line);
  }

  .nav-item {
    min-width: 0;
    height: 62px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 2px;
    border: 0;
    border-top: 3px solid transparent;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
  }

  .nav-item[aria-current="page"] {
    border-top-color: var(--brand);
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .view-root {
    padding: 14px 12px 20px;
  }

  .view-title {
    font-size: 23px;
  }

  .metric-strip {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    min-height: 94px;
    padding: 15px;
    border-bottom: 1px solid var(--line);
  }

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

  .metric:nth-child(n + 3) {
    border-bottom: 0;
  }

  .metric-value {
    font-size: 22px;
  }

  .side-rail,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar > * {
    min-width: calc(50% - 4px);
  }

  .toolbar .search-field {
    min-width: 100%;
  }

  .data-table,
  .data-table tbody {
    display: block;
  }

  .data-table thead {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .data-table tr {
    display: grid;
    margin: 0;
    padding: 14px;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
    border-bottom: 1px solid var(--line);
  }

  .data-table td {
    display: block;
    padding: 0;
    border: 0;
  }

  .data-table td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
  }

  .data-table td:first-child {
    grid-column: 1 / -1;
  }

  .detail-hero {
    align-items: flex-start;
  }

  .detail-actions {
    width: 100%;
  }

  .detail-actions .button {
    flex: 1;
  }

  .definition-list {
    grid-template-columns: 95px minmax(0, 1fr);
  }

  .task-layout {
    display: block;
    min-height: auto;
    margin: -14px -12px -20px;
  }

  .task-workspace {
    padding: 14px 12px 20px;
    border: 0;
  }

  .drawer {
    position: fixed;
    z-index: 80;
    inset: var(--topbar) 0 70px;
    overflow-y: auto;
    padding: 18px 16px;
  }

  .drawer-actions {
    flex-direction: column-reverse;
  }

  .drawer-actions .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
