:root {
  --ink: #14243b;
  --muted: #6e7480;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --line: #dedbd3;
  --gold: #d9ad3d;
  --orange: #cf6f2e;
  --green: #2f7d66;
  --coral: #c95544;
  --blue: #285f8f;
  --shadow: 0 12px 34px rgba(20, 36, 59, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  padding: 34px 5vw 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: #7f7c76;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 6px;
}

h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.15;
}

h2 {
  margin: 0;
  font-size: 20px;
}

p {
  margin: 0;
}

.subtitle {
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
}

.header-actions,
.section-head,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.ghost,
.primary,
.dark {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--ink);
  padding: 0 18px;
  font-weight: 700;
}

.ghost {
  background: transparent;
  color: var(--ink);
}

.primary {
  background: var(--gold);
  color: #18140a;
  border-color: var(--gold);
}

.dark {
  background: #1d1b1a;
  color: white;
  border-color: #1d1b1a;
}

.tabs {
  display: flex;
  gap: 10px;
  padding: 0 5vw 22px;
  border-bottom: 3px solid var(--ink);
}

.tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  min-height: 42px;
  padding: 0 18px;
  font-weight: 800;
}

.tab.active {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

main {
  padding: 34px 5vw 60px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(340px, 0.95fr);
  gap: 26px;
  align-items: start;
}

.workspace,
.sidebar {
  display: grid;
  gap: 24px;
}

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

.panel-title {
  justify-content: flex-start;
  margin-bottom: 24px;
}

.panel-title p,
.section-head p {
  margin-top: 8px;
  color: var(--muted);
}

.accent {
  width: 5px;
  height: 30px;
  background: var(--orange);
}

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

label {
  display: grid;
  gap: 10px;
  color: #4f504f;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid #d6d2ca;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--ink);
}

.segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.segment button {
  min-height: 54px;
  border: 1px solid #d6d2ca;
  background: #fff;
  border-radius: 6px;
  color: #555;
  font-weight: 800;
}

.segment button.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

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

.scope-item {
  border: 1px solid #d7d3ca;
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  background: #fff;
}

.scope-item strong {
  font-size: 16px;
}

.scope-item small {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  border-bottom: 1px solid #ece8df;
  padding: 12px 8px;
  text-align: left;
}

th {
  color: #77736c;
  font-size: 13px;
}

td input,
td select {
  min-height: 40px;
}

.remove {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #ead5d0;
  color: var(--coral);
  background: #fff7f5;
  font-weight: 900;
}

.line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  color: #5d5d5d;
}

.line strong {
  color: var(--ink);
}

.divider {
  border-top: 1px solid #e5e0d7;
  margin: 8px 0;
}

.line.total {
  font-size: 18px;
  font-weight: 900;
}

.price-card {
  padding: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #14243b, #24405f);
  color: white;
  box-shadow: var(--shadow);
}

.price-card p {
  color: #c8d2dc;
  font-weight: 800;
}

.price-card > strong {
  display: block;
  color: var(--gold);
  font-size: 52px;
  line-height: 1;
  margin: 18px 0 8px;
}

.price-card > span {
  color: #d6dee6;
}

.price-lines {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin-top: 24px;
  padding-top: 18px;
}

.price-lines div,
.tier,
.status-grid div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.controls {
  display: grid;
  gap: 20px;
}

.tiers {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.tier {
  align-items: center;
  padding: 15px 16px;
  border-radius: 8px;
  background: #f7f6f2;
}

.tier strong {
  font-size: 20px;
}

.alerts {
  border-top: 5px solid var(--green);
}

.alert {
  padding: 12px 0;
  border-bottom: 1px solid #ebe6dd;
  color: #4d4f4c;
}

.alert.warn {
  color: var(--coral);
}

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

.metric {
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 24px;
}

.metric span {
  color: #c6d0dc;
}

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
}

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

.status-grid div {
  flex-direction: column;
  border: 1px solid #e3ded5;
  border-radius: 8px;
  padding: 18px;
  background: #f8f7f3;
}

.status-grid span,
.cards-grid small {
  color: var(--muted);
}

.status-grid b {
  font-size: 24px;
}

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

.data-card {
  border: 1px solid #dfd9cf;
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  display: grid;
  gap: 10px;
}

.data-card strong {
  font-size: 18px;
}

.data-card .badge {
  justify-self: start;
  border-radius: 999px;
  background: #eaf3ef;
  color: var(--green);
  padding: 5px 10px;
  font-weight: 800;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .layout,
  .dashboard,
  .cards-grid {
    grid-template-columns: 1fr 1fr;
  }

  .sidebar {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 30px;
  }

  .tabs {
    overflow-x: auto;
  }

  .layout,
  .form-grid,
  .finance-grid,
  .scope-grid,
  .dashboard,
  .status-grid,
  .cards-grid {
    grid-template-columns: 1fr;
  }

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

  .price-card > strong {
    font-size: 42px;
  }
}
