:root {
  color-scheme: light;
  --ink: #16211d;
  --muted: #66726d;
  --line: #dfe7e3;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --green: #16734f;
  --green-soft: #e5f5ed;
  --blue: #285e9b;
  --blue-soft: #edf5ff;
  --orange: #a95116;
  --orange-soft: #fff1e8;
  --danger: #b42318;
  --shadow: 0 12px 35px rgba(22, 40, 32, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 2%, rgba(69, 190, 134, 0.13), transparent 32rem),
    var(--canvas);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 8px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

button:hover {
  border-color: #a9bcb3;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(22, 115, 79, 0.22);
  outline-offset: 2px;
}

button.primary {
  color: white;
  background: var(--green);
  border-color: var(--green);
}

.topbar {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  padding: 18px max(22px, calc((100vw - 1160px) / 2));
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.02em;
}

h2 {
  margin-bottom: 4px;
  font-size: 21px;
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

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

.account {
  max-width: 180px;
  padding-right: 8px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  width: min(1160px, calc(100% - 32px));
  margin: 28px auto 54px;
}

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

.hero {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  padding: 26px;
  background:
    linear-gradient(115deg, rgba(229, 245, 237, 0.9), rgba(255, 255, 255, 0.88)),
    var(--surface);
}

.hero p:last-child {
  margin-bottom: 0;
}

.status-badge {
  flex: 0 0 auto;
  padding: 8px 13px;
  color: var(--muted);
  background: #eff2f0;
  border-radius: 999px;
  font-weight: 700;
}

.status-badge.online {
  color: var(--green);
  background: var(--green-soft);
}

.status-badge.offline {
  color: var(--danger);
  background: #fff0ee;
}

.status-badge.warning {
  color: var(--orange);
  background: var(--orange-soft);
}

section + section {
  margin-top: 32px;
}

.section-title {
  display: flex;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 13px;
}

.section-title h2,
.section-title p {
  margin-bottom: 0;
}

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

.metric {
  min-width: 0;
  padding: 18px;
}

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

.metric strong {
  display: block;
  overflow: hidden;
  font-size: clamp(20px, 2.6vw, 29px);
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric.accent strong {
  color: var(--green);
}

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

.purchase-pending strong {
  color: var(--orange);
}

.purchase-confirmed strong {
  color: var(--green);
}

.purchase-anomaly strong {
  color: var(--danger);
}

.purchase-table-panel {
  overflow: hidden;
}

.purchase-table-heading {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 13px;
  border-bottom: 1px solid var(--line);
}

.purchase-table-heading p {
  margin-bottom: 0;
}

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

.purchase-table {
  width: 100%;
  border-collapse: collapse;
}

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

.purchase-table th {
  color: var(--muted);
  background: #f7f9f8;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.purchase-table tbody tr:last-child td {
  border-bottom: 0;
}

.purchase-table tbody tr:hover {
  background: #fafcfb;
}

.purchase-table .numeric {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.purchase-empty {
  color: var(--muted);
  text-align: center !important;
}

.purchase-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.purchase-status.pending {
  color: var(--orange);
  background: var(--orange-soft);
}

.purchase-status.confirmed {
  color: var(--green);
  background: var(--green-soft);
}

.purchase-status.rejected {
  color: var(--muted);
  background: #eff2f0;
}

.purchase-status.anomaly {
  color: var(--danger);
  background: #fff0ee;
}

.detail-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 18px;
}

.detail-row p {
  margin-bottom: 0;
  word-break: break-word;
}

.state-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.state-list li {
  padding: 10px 12px;
  background: #f7f9f8;
  border-radius: 10px;
}

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

.error-banner {
  margin-top: 18px;
  padding: 14px 16px;
  background: #fff0ee;
  border: 1px solid #ffd1cc;
  border-radius: 12px;
}

.hidden {
  display: none;
}

footer {
  padding: 0 20px 30px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
}

.login-card {
  width: min(430px, 100%);
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: white;
  background: var(--green);
  border-radius: 14px;
  font-size: 22px;
  font-weight: 800;
  place-items: center;
}

.login-card form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.login-card input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid #bdcbc4;
  border-radius: 10px;
}

@media (max-width: 820px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 620px) {
  .topbar {
    position: static;
    display: block;
    padding: 16px;
  }

  .top-actions {
    margin-top: 12px;
  }

  .account {
    margin-right: auto;
  }

  .content {
    width: min(100% - 20px, 1160px);
    margin-top: 14px;
  }

  .hero {
    align-items: flex-start;
    padding: 20px;
  }

  .metric-grid,
  .detail-row,
  .purchase-metrics {
    grid-template-columns: 1fr;
  }

  .metric {
    padding: 15px;
  }

  .section-title {
    display: block;
  }

  .section-title > .muted {
    margin-top: 4px;
  }

  .purchase-table-heading {
    display: block;
  }

  .purchase-table-heading > .muted {
    display: block;
    margin-top: 5px;
  }

  .purchase-table,
  .purchase-table tbody,
  .purchase-table tr,
  .purchase-table td {
    display: block;
    width: 100%;
  }

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

  .purchase-table tbody {
    padding: 10px;
  }

  .purchase-table tbody tr {
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #fafcfb;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .purchase-table tbody tr:last-child {
    margin-bottom: 0;
  }

  .purchase-table td {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
    padding: 7px 0;
    border: 0;
    text-align: right;
  }

  .purchase-table td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 12px;
    font-weight: 700;
    text-align: left;
  }

  .purchase-table td.purchase-empty {
    display: block;
    padding: 18px 8px;
  }

  .purchase-table td.purchase-empty::before {
    content: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }
}
/* Independent adhesive-tape calculator */
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: 9px;
  color: inherit;
  background: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  font-weight: 600;
}

.primary-link {
  border-color: #0a84ff;
  color: #fff;
  background: #0a84ff;
}

.calculator-content {
  max-width: 1180px;
}

.calculator-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.calculator-form {
  padding: 24px;
}

.compact-title {
  margin-top: 0;
}

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

.calculator-grid label {
  display: grid;
  gap: 7px;
  color: #636366;
  font-size: 13px;
  font-weight: 600;
}

.calculator-grid input,
.calculator-grid select {
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid rgba(60, 60, 67, 0.24);
  border-radius: 9px;
  color: #1c1c1e;
  background: #fff;
  font: inherit;
  font-weight: 500;
}

.calculator-grid input:focus,
.calculator-grid select:focus {
  border-color: #0a84ff;
  outline: 3px solid rgba(10, 132, 255, 0.14);
}

.calculator-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

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

.calculator-audit p {
  white-space: normal;
}

@media (max-width: 900px) {
  .calculator-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 560px) {
  .calculator-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .calculator-grid,
  .calculator-results {
    grid-template-columns: 1fr;
  }
}
