:root {
  --bg: #f3f6f7;
  --ink: #102129;
  --muted: #657782;
  --line: #d6e0e3;
  --teal: #0f7a7d;
  --teal-dark: #0b5358;
  --gold: #c7a24d;
  --surface: #ffffff;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

button,
.button,
.outline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #adc6ca;
  border-radius: 7px;
  padding: 8px 13px;
  color: #172b34;
  background: #ffffff;
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
}

button.primary,
.button.primary {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: 0 14px 28px rgba(15, 122, 125, 0.24);
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 56px);
  background: rgba(247, 250, 250, 0.93);
  border-bottom: 1px solid rgba(177, 196, 199, 0.78);
  backdrop-filter: blur(14px);
}

.brand,
.nav nav,
.account {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand,
.nav a {
  color: inherit;
  text-decoration: none;
}

.brand span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: var(--teal);
  font-weight: 900;
}

.nav nav {
  gap: clamp(12px, 3vw, 28px);
  color: #52646e;
  font-weight: 760;
}

.nav nav a.active {
  color: var(--teal-dark);
}

.hero {
  min-height: min(760px, calc(100vh - 65px));
  display: grid;
  place-items: center;
  padding: clamp(48px, 7vw, 92px) clamp(18px, 5vw, 70px);
  text-align: center;
  color: #ffffff;
  background:
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #09161a 0%, #10282a 45%, #17362f 100%);
  background-size: 42px 42px, 42px 42px, auto;
}

.hero-inner {
  max-width: 880px;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(52px, 7vw, 96px);
  line-height: 1;
}

.hero p {
  max-width: 720px;
  margin: 22px auto 0;
  color: #d2dcdd;
  font-size: 17px;
  line-height: 1.75;
}

.hero-actions,
.actions,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  justify-content: center;
  margin-top: 30px;
}

.section {
  padding: clamp(42px, 6vw, 74px) clamp(18px, 5vw, 70px);
}

.page-section {
  min-height: calc(100vh - 67px);
}

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

.section-title h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
}

.filters button.active {
  color: #ffffff;
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.products {
  background:
    linear-gradient(rgba(15, 72, 75, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 72, 75, 0.035) 1px, transparent 1px),
    #ffffff;
  background-size: 34px 34px, 34px 34px, auto;
}

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

.product-card,
.login-panel,
.feature-card,
.panel-form,
.ledger-records,
.empty-state,
.ai-panel,
.service-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(18, 37, 42, 0.09);
}

.home-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  background: #ffffff;
}

.feature-card {
  display: grid;
  gap: 10px;
  min-height: 184px;
  padding: 22px;
  color: inherit;
  text-decoration: none;
  box-shadow: inset 0 3px 0 var(--teal), 0 12px 24px rgba(18, 37, 42, 0.07);
}

.feature-card span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.feature-card h2 {
  margin: 0;
}

.feature-card p,
.ai-panel p,
.panel-form p,
.purchase-row p,
.purchase-row small,
.account-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.product-card {
  overflow: hidden;
}

.product-media {
  height: 184px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(17, 89, 92, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 89, 92, 0.045) 1px, transparent 1px),
    #eef4f3;
  background-size: 18px 18px, 18px 18px, auto;
  border-bottom: 1px solid var(--line);
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 12px;
  filter: drop-shadow(0 12px 18px rgba(31, 52, 61, 0.16));
}

.product-info {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.product-info span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 850;
}

.product-info h3 {
  margin: 0;
  font-size: 16px;
}

.product-info p,
.service-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.price-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

.price-row strong {
  color: #9b6412;
  font-size: 20px;
}

.price-row small {
  color: var(--muted);
}

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

.service-item {
  min-height: 166px;
  padding: 20px;
  box-shadow: inset 0 3px 0 var(--teal), 0 12px 24px rgba(18, 37, 42, 0.07);
}

.service-item h3 {
  margin: 0 0 10px;
}

.entry {
  display: grid;
  place-items: center;
  background: #f8fafb;
}

.login-panel {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
}

.login-panel h2,
.panel-form h3,
.ledger-records h3 {
  margin: 0;
}

.message {
  min-height: 22px;
  color: #24664c;
}

.message.error {
  color: #b02a1f;
}

.ledger-message {
  margin: -8px 0 16px;
}

.ledger-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.ledger-grid.single {
  grid-template-columns: minmax(300px, 520px);
}

.ledger-grid.single.wide {
  grid-template-columns: 1fr;
}

.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -8px 0 20px;
}

.subnav a {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid #adc6ca;
  border-radius: 7px;
  padding: 8px 13px;
  color: #172b34;
  background: #ffffff;
  text-decoration: none;
  font-weight: 750;
}

.subnav a.active {
  color: #ffffff;
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.ledger-overview,
.ledger-dashboard {
  display: grid;
  gap: 16px;
}

.ledger-intro,
.ledger-summary,
.ledger-feature {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(18, 37, 42, 0.08);
}

.ledger-intro {
  max-width: 900px;
  padding: 24px;
}

.ledger-intro h3,
.ledger-feature h3 {
  margin: 0;
}

.ledger-intro p,
.ledger-feature p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

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

.ledger-feature {
  display: grid;
  gap: 8px;
  min-height: 160px;
  padding: 20px;
  color: inherit;
  text-decoration: none;
  box-shadow: inset 0 3px 0 var(--teal), 0 12px 24px rgba(18, 37, 42, 0.07);
}

.ledger-feature span {
  color: var(--gold);
  font-weight: 900;
}

.ledger-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
}

.ledger-summary div {
  padding: 18px;
  background: #ffffff;
}

.ledger-summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ledger-summary strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.panel-form,
.ledger-records,
.empty-state,
.ai-panel {
  padding: 22px;
}

.panel-form {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.ledger-records {
  display: grid;
  gap: 12px;
}

.records-head,
.purchase-row,
.member-row,
.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}

.records-head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.records-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.records-head span,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #c6d7d9;
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--muted);
  background: #f7fafb;
  font-size: 12px;
  font-weight: 800;
}

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

.purchase-row,
.member-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfd;
}

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

.inline-form {
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-bottom: 12px;
}

.purchase-price {
  display: grid;
  gap: 4px;
  text-align: right;
}

.purchase-price strong {
  color: #9b6412;
  font-size: 18px;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 12px;
  max-width: 620px;
}

.empty-state.compact {
  max-width: none;
  justify-items: center;
  color: var(--muted);
}

.fatal {
  padding: 30px;
  color: #b02a1f;
}

@media (max-width: 980px) {
  .product-grid,
  .services,
  .home-cards,
  .ledger-feature-grid,
  .ledger-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ledger-grid,
  .section-title {
    grid-template-columns: 1fr;
  }

  .section-title {
    display: grid;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .nav {
    align-items: stretch;
    flex-direction: column;
  }

  .nav nav {
    overflow-x: auto;
  }

  .hero h1 {
    font-size: 44px;
  }

  .product-grid,
  .services,
  .home-cards,
  .ledger-feature-grid,
  .ledger-summary,
  .form-row,
  .purchase-row,
  .member-row,
  .records-head,
  .records-tools,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .purchase-price {
    text-align: left;
  }
}
