:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #dfe5df;
  --green: #177245;
  --green-soft: #e7f4ed;
  --blue: #246b9f;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #f8fbff;
  border-right: 1px solid #d8e4f2;
  color: var(--ink);
}

.brand {
  display: grid;
  gap: 8px;
  align-items: start;
  margin-bottom: 32px;
  padding-bottom: 18px;
  border-bottom: 1px solid #d8e4f2;
}

.brand-logo {
  width: 172px;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.brand p,
.brand span {
  margin: 0;
}

.brand span {
  color: #5b6b7f;
  font-size: 12px;
  font-weight: 700;
}

.nav {
  display: grid;
}

.flow-nav {
  position: relative;
  gap: 0;
}

.flow-nav::before {
  content: "";
  position: absolute;
  top: 23px;
  bottom: 23px;
  left: 19px;
  width: 2px;
  background: #c9d8e8;
}

.flow-nav a {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 10px;
  min-height: 70px;
  padding: 8px 10px 8px 0;
  color: #41546b;
  text-decoration: none;
}

.flow-step {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 2px solid #c9d8e8;
  border-radius: 999px;
  background: #f8fbff;
  color: #5b6b7f;
  font-size: 12px;
  font-weight: 800;
}

.flow-copy {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.flow-copy strong {
  color: #24364b;
  font-size: 14px;
  line-height: 1.2;
}

.flow-copy small {
  color: #6b7b8e;
  font-size: 12px;
  line-height: 1.35;
}

.flow-nav a.active .flow-step,
.flow-nav a:hover .flow-step {
  border-color: #0b6fc6;
  background: #0b6fc6;
  color: #ffffff;
}

.flow-nav a.active .flow-copy,
.flow-nav a:hover .flow-copy {
  border-color: #cfe4fb;
  background: #e8f2ff;
}

.flow-nav a.active .flow-copy strong,
.flow-nav a:hover .flow-copy strong {
  color: #075eb7;
}

.workspace {
  padding: 28px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 0.8fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.hero-main {
  display: grid;
  align-content: space-between;
  gap: 18px;
  min-height: 300px;
  padding: 22px;
  border: 1px solid #d8e4f2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.topbar h1,
.topbar p,
.panel h2 {
  margin: 0;
}

.topbar h1 {
  margin-top: 5px;
  font-size: 28px;
  line-height: 1.22;
  font-weight: 720;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
  max-width: 720px;
  font-size: 14px;
  line-height: 1.65;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #edf2f7;
  color: #334155;
  font-size: 13px;
  white-space: nowrap;
}

.tag.success,
.status-pill.done {
  background: var(--green-soft);
  color: var(--green);
}

.tag.warn {
  background: #fff7e6;
  color: var(--amber);
}

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

.connector-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.connector-strip div {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.connector-strip span {
  color: var(--muted);
  font-size: 12px;
}

.connector-strip strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}

.metric-grid article,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-grid article {
  padding: 16px;
  box-shadow: none;
}

.approval-center {
  padding: 18px;
  border: 1px solid #b9d7c7;
  border-radius: 8px;
  background: #fbfffc;
  box-shadow: var(--shadow);
}

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

.approval-center h2 {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 720;
}

.approval-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.approval-summary-grid div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: #f2f8f4;
}

.approval-summary-grid span {
  color: var(--muted);
  font-size: 12px;
}

.approval-summary-grid strong {
  font-size: 20px;
}

.approval-list {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.approval-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

.approval-list-item span {
  margin-top: 4px;
  color: var(--muted);
}

.metric-grid span,
.metric-grid small,
.eyebrow,
label,
.approval-card span {
  color: var(--muted);
  font-size: 12px;
}

.metric-grid strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 24px;
  font-weight: 720;
}

.process-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel h2 {
  margin-top: 3px;
  font-size: 16px;
  font-weight: 720;
}

.step-next {
  display: inline-flex;
  margin-top: 7px;
  color: #075eb7;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.step-next:hover {
  text-decoration: underline;
}

.step-next.done {
  color: var(--green);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 154px;
  padding: 22px;
  border: 1px dashed #9bb7a8;
  border-radius: 8px;
  background: #f7fbf8;
  text-align: center;
}

.drop-zone input {
  display: none;
}

.drop-zone span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-size: 26px;
}

.drop-zone small {
  max-width: 360px;
  margin-top: 6px;
  color: var(--muted);
}

.preview-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 220px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.preview-wrap img {
  display: none;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
}

#emptyPreview {
  color: var(--muted);
}

.primary-btn,
.ghost-btn,
.danger-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-btn {
  width: 100%;
  background: var(--green);
  color: white;
}

.ghost-btn {
  background: #f8fafc;
  border-color: var(--line);
  color: var(--ink);
}

.danger-btn {
  background: #fff1f0;
  color: var(--red);
  border-color: #ffd4d0;
}

.small {
  width: auto;
  min-height: 36px;
}

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

label {
  display: grid;
  gap: 6px;
}

input {
  width: 100%;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

.rule-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.rule-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8fafc;
  font-size: 13px;
}

.rule-item.pass {
  background: var(--green-soft);
}

.rule-item.warn {
  background: #fff7e6;
}

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

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

th {
  color: var(--muted);
  font-weight: 700;
}

td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.voucher {
  display: grid;
  gap: 10px;
  min-height: 190px;
  padding: 14px;
  border-radius: 8px;
  background: #f8fafc;
}

.voucher-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.approval-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.approval-card p {
  margin: 0;
  color: var(--muted);
}

.approval-insight {
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
}

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

.report-panel {
  grid-column: 1 / -1;
}

.cost-bars {
  display: grid;
  gap: 10px;
}

.report-subhead {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
  margin: 18px 0 10px;
}

.report-subhead span {
  color: var(--muted);
  font-size: 12px;
}

.report-subhead strong {
  font-size: 15px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 90px;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

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

.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  transition: width 400ms ease;
}

.saving-box {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: #f2f8f4;
}

.saving-box span {
  color: var(--muted);
}

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

.executive-insights > div {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 190px;
  padding: 18px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.executive-insights span {
  font-size: 12px;
  font-weight: 800;
}

.executive-insights strong {
  font-size: 16px;
  line-height: 1.25;
}

.risk-card {
  background: #fff7e6;
  color: #7a4a00;
}

.saving-card {
  background: #e7f4ed;
  color: #14532d;
}

.insight-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: inherit;
  font-size: 13px;
  line-height: 1.45;
}

.insight-list li {
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .side-note {
    position: static;
    margin-top: 24px;
  }

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

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

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

@media (max-width: 620px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .panel-head,
  .approval-center-head,
  .approval-list-item,
  .approval-actions {
    flex-direction: column;
  }

  .metric-grid,
  .approval-summary-grid,
  .executive-insights,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .hero-main {
    min-height: auto;
  }

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