:root {
  color-scheme: light;
  --bg: #fffdf7;
  --surface: #fffdf7;
  --surface-soft: #f3f0eb;
  --line: #efede3;
  --line-strong: #d8d4c9;
  --text: #080808;
  --muted: #666666;
  --blue: #222222;
  --blue-soft: #f3f0eb;
  --green: #379d4a;
  --green-soft: #f4fdeb;
  --red: #ec5e41;
  --red-soft: #fff7f6;
  --amber: #ee9e0b;
  --shadow: 0 12px 32px rgba(8, 8, 8, 0.06);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  min-height: 70px;
  padding: 0 28px;
  background: rgba(255, 253, 247, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(8, 8, 8, 0.1);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
}

.nav a {
  padding: 23px 14px 19px;
  color: #666666;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}

.nav a:hover,
.nav a.active {
  color: #080808;
  border-bottom-color: #080808;
}

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

.page {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 28px;
  align-items: center;
  min-height: calc(100vh - 130px);
  padding: 48px 6vw;
}

.hero-copy h1 {
  max-width: 760px;
  margin: 0 0 18px;
  font-size: clamp(38px, 5vw, 70px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.hero-copy p {
  max-width: 650px;
  margin: 0;
  color: #666666;
  font-size: 19px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.hero-panel {
  padding: 26px;
  background: linear-gradient(145deg, #080808, #2b2b2b);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(8, 8, 8, 0.18);
}

.hero-panel pre {
  overflow: auto;
  margin: 0;
  color: #f8f8f8;
  font: 14px/1.8 Consolas, monospace;
  white-space: pre-wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 17px;
  color: #fff;
  font-weight: 700;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 10px;
  cursor: pointer;
}

.button:hover {
  filter: brightness(0.96);
}

.button.secondary {
  color: #222222;
  background: var(--surface);
  border-color: var(--line-strong);
}

.button.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffcec5;
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

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

.section-heading h1,
.section-heading h2 {
  margin: 0;
}

.section-heading p {
  margin: 8px 0 0;
  color: var(--muted);
}

.model-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
}

.sidebar,
.panel,
.model-card,
.stat-card,
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sidebar {
  align-self: start;
  padding: 20px;
  border-radius: 14px;
}

.sidebar-title {
  margin: 0 0 12px;
  color: #999999;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.filter-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 10px 12px;
  color: #666666;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.filter-button.active {
  color: #080808;
  background: #f3f0eb;
  border-color: var(--line-strong);
}

.count {
  min-width: 26px;
  padding: 2px 7px;
  color: #666666;
  background: #f3f0eb;
  border-radius: 999px;
  text-align: center;
}

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

.model-card {
  display: flex;
  min-width: 0;
  min-height: 300px;
  flex-direction: column;
  padding: 24px;
  border-radius: 14px;
}

.model-card-top {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.model-title-block {
  min-width: 0;
}

.model-title-line {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.model-title-line .status-dot {
  flex: 0 0 auto;
}

.model-public-id {
  display: block;
  max-width: 100%;
  margin-top: 7px;
  color: #999999;
  font: 12px/1.5 Consolas, monospace;
  overflow-wrap: anywhere;
}

.model-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.model-icon {
  display: grid;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #222222;
  font-size: 24px;
  font-weight: 900;
  background: #f3f0eb;
  border-radius: 12px;
}

.model-name {
  min-width: 0;
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.model-price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 26px 0;
}

.model-price-box {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 15px;
  background: #f3f0eb;
  border: 1px solid #efede3;
  border-radius: 11px;
}

.model-price-box span {
  color: #666666;
  font-size: 13px;
  font-weight: 700;
}

.model-price-box strong {
  color: #080808;
  font-size: 20px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.model-price-box small {
  color: #999999;
  font-size: 11px;
}

.model-card-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid #efede3;
}

.model-context {
  display: grid;
  gap: 4px;
  color: #999999;
  font-size: 12px;
  text-align: right;
}

.model-context strong {
  color: #666666;
  font-size: 13px;
  white-space: nowrap;
}

.model-empty-state {
  grid-column: 1 / -1;
}

.status-dot {
  width: 10px;
  height: 10px;
  background: #379d4a;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #f4fdeb;
}

.price-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  justify-content: center;
  margin: 30px 0 22px;
}

.price-item {
  color: #666666;
}

.price-value {
  display: inline-block;
  margin-left: 8px;
  padding: 6px 10px;
  color: #080808;
  font-weight: 800;
  background: #f3f0eb;
  border: 1px solid #d8d4c9;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  padding: 5px 10px;
  color: #444444;
  font-size: 13px;
  background: #f3f0eb;
  border-radius: 999px;
}

.model-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.login-shell {
  display: grid;
  min-height: calc(100vh - 70px);
  place-items: center;
  padding: 34px 20px;
}

.login-card {
  width: min(460px, 100%);
  padding: 34px;
  border-radius: 18px;
}

.login-card h1 {
  margin: 0 0 8px;
}

.login-card > p {
  margin: 0 0 24px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: #f3f0eb;
  border-radius: 10px;
}

.tab-button {
  flex: 1;
  padding: 9px 12px;
  color: #666666;
  font-weight: 700;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.tab-button.active {
  color: #080808;
  background: var(--surface);
  box-shadow: 0 3px 10px rgba(8, 8, 8, 0.08);
}

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

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #666666;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: #222222;
  box-shadow: 0 0 0 3px rgba(34, 34, 34, 0.1);
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 20px;
}

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

.monthly-chart {
  min-height: 280px;
}

.monthly-chart-scroll {
  overflow-x: auto;
  padding: 4px 0 8px;
}

.monthly-chart-svg {
  display: block;
  width: 100%;
  height: 270px;
}

.chart-grid-line {
  stroke: #dedbd2;
  stroke-width: 1;
  stroke-dasharray: 4 5;
}

.chart-axis-text {
  fill: #888888;
  font-size: 11px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.chart-area {
  fill: rgba(34, 34, 34, 0.08);
}

.chart-line {
  fill: none;
  stroke: #222222;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-point {
  fill: #fffdf7;
  stroke: #222222;
  stroke-width: 3;
}

.stat-card {
  padding: 20px;
  border-radius: 13px;
}

.stat-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  font-size: 26px;
  overflow-wrap: anywhere;
}

.panel {
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
}

.key-box,
.code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f3f0eb;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.key-box code,
.code-box code {
  min-width: 0;
  flex: 1;
  color: #222222;
  font-family: Consolas, monospace;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid #efede3;
  text-align: left;
  vertical-align: top;
}

th {
  color: #888888;
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

td code {
  font-family: Consolas, monospace;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  padding: 4px 9px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  background: var(--green-soft);
  border-radius: 999px;
}

.status-pill.off {
  color: var(--red);
  background: var(--red-soft);
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
}

.admin-menu {
  display: grid;
  align-self: start;
  gap: 7px;
  padding: 14px;
  background: #222222;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.admin-menu button {
  padding: 12px 14px;
  color: #d9d9d9;
  background: transparent;
  border: 0;
  border-radius: 9px;
  text-align: left;
  cursor: pointer;
}

.admin-menu button.active,
.admin-menu button:hover {
  color: #fff;
  background: #444444;
}

.admin-section[hidden],
.login-form[hidden] {
  display: none;
}

.notice {
  display: none;
  margin: 14px 0;
  padding: 11px 13px;
  color: #379d4a;
  background: var(--green-soft);
  border: 1px solid #c7eabd;
  border-radius: 9px;
}

.notice.show {
  display: block;
}

.notice.error {
  color: #a53716;
  background: var(--red-soft);
  border-color: #ffcec5;
}

.empty-state {
  padding: 46px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  text-align: center;
}

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

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.actions-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

@media (max-width: 980px) {
  .hero,
  .model-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 56px 0;
  }

  .sidebar {
    display: none;
  }

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

  .admin-menu {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }
}

@media (max-width: 1180px) and (min-width: 981px) {
  .model-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .topbar {
    padding: 0 14px;
  }

  .nav {
    gap: 0;
  }

  .nav a {
    padding: 23px 8px 19px;
    font-size: 13px;
  }

  .top-actions {
    display: none;
  }

  .page {
    width: min(100% - 24px, 1440px);
    padding-top: 20px;
  }

  .model-grid,
  .dashboard-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .model-card-top {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .model-card-top .copy-model {
    grid-column: 1 / -1;
    width: 100%;
  }

  .model-price-grid,
  .model-card-footer {
    grid-template-columns: 1fr;
  }

  .model-context {
    text-align: left;
  }

  .field.full {
    grid-column: auto;
  }

  .hero-copy h1 {
    font-size: 42px;
  }

  .login-card {
    padding: 24px;
  }
}
