:root {
  --ink: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --page: #f4f7fb;
  --card: #ffffff;
  --accent: #0f6fb7;
  --accent-dark: #0c4f82;
  --red: #c2412d;
  --green: #14804a;
  --gray: #6b7280;
  --amber: #b7791f;
  --shadow: 0 14px 36px rgba(23, 32, 51, .08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: #202735;
  color: #fff;
  padding: 34px 0;
}

.site-header.compact {
  padding: 24px 0;
}

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

.brand {
  color: #bfd3e6;
  font-size: 14px;
  margin-bottom: 8px;
}

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

h1 {
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}

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

h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.site-header p {
  margin-bottom: 0;
  color: #d8e2ec;
}

.header-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  text-align: right;
}

.page-stack {
  display: grid;
  gap: 22px;
  padding: 24px 0 42px;
}

.card {
  background: var(--card);
  border: 1px solid #e4ebf3;
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

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

.stat-card {
  min-height: 104px;
  padding: 18px 20px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e4ebf3;
  box-shadow: var(--shadow);
  display: grid;
  align-content: center;
  gap: 8px;
}

.stat-card span {
  color: var(--muted);
  font-size: 14px;
}

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

.stat-card.up strong,
.trend-up {
  color: var(--red);
}

.stat-card.down strong,
.trend-down {
  color: var(--green);
}

.stat-card.flat strong,
.trend-flat {
  color: var(--gray);
}

.stat-card.total strong {
  color: var(--accent-dark);
}

.comment-text {
  margin-bottom: 0;
  color: #344054;
  white-space: pre-wrap;
}

.filters,
.form-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.form-grid.single {
  grid-template-columns: 1fr;
  max-width: 520px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-weight: 700;
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 111, 183, .2);
  border-color: var(--accent);
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--accent-dark);
  text-decoration: none;
}

.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, .55);
  color: #fff;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, .1);
}

.btn.light {
  background: #eef6fd;
  color: var(--accent-dark);
  border-color: #c8dff2;
}

.btn.light:hover {
  background: #dbeefa;
}

.btn.danger {
  border-color: #b42318;
  background: #b42318;
  color: #fff;
}

.btn.danger:hover {
  background: #8f1b13;
}

.table-delete-btn {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 13px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.log-actions {
  justify-content: flex-end;
}

.log-cleanup-select {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475467;
  font-size: 13px;
  white-space: nowrap;
}

.log-cleanup-select select {
  width: 116px;
  min-height: 38px;
  padding: 7px 8px;
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e4ebf3;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #f7fafc;
  color: #344054;
  font-size: 14px;
  white-space: nowrap;
}

tbody tr:hover {
  background: #fbfdff;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-width: 58px;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 13px;
  font-weight: 700;
}

.badge.up {
  color: var(--red);
  background: #fff1ed;
}

.badge.down {
  color: var(--green);
  background: #ecfdf3;
}

.badge.flat {
  color: var(--gray);
  background: #f2f4f7;
}

.chart-box {
  position: relative;
  height: 420px;
  border: 1px solid #e4ebf3;
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.chart-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-tooltip {
  position: absolute;
  display: none;
  pointer-events: none;
  max-width: 260px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(23, 32, 51, .92);
  color: #fff;
  font-size: 13px;
  line-height: 1.5;
}

.chart-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: #475467;
  font-size: 14px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
}

.info-grid,
.admin-grid,
.comment-admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.contact-list {
  margin: 12px 0 0;
  padding-left: 18px;
}

.hidden {
  display: none !important;
}

.login-panel {
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
}

.form-message {
  margin: 12px 0 0;
  color: var(--muted);
}

.form-message.ok {
  color: var(--green);
}

.form-message.error {
  color: var(--red);
}

.result-box {
  margin-top: 14px;
  color: #344054;
  background: #f7fafc;
  border: 1px solid #e4ebf3;
  border-radius: 6px;
  padding: 12px;
  min-height: 48px;
  white-space: pre-wrap;
}

.preview-box {
  min-height: 210px;
  padding: 14px;
  border: 1px solid #d9e2ec;
  border-radius: 6px;
  background: #f7fafc;
  color: #344054;
  white-space: pre-wrap;
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .header-inner,
  .info-grid,
  .admin-grid,
  .comment-admin-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .header-meta {
    justify-content: start;
    text-align: left;
  }

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

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

@media (max-width: 560px) {
  .container {
    width: min(100% - 20px, 1180px);
  }

  .site-header {
    padding: 24px 0;
  }

  h1 {
    font-size: 24px;
  }

  .card {
    padding: 16px;
  }

  .stats-grid,
  .filters,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .stat-card strong {
    font-size: 28px;
  }
}

/* Front page styling aligned with the existing Fortex price page. */
.front-page {
  --market-primary: #0A2463;
  --market-primary-deep: #071a49;
  --market-gold: #D4AF37;
  --market-gold-soft: rgba(212, 175, 55, .12);
  --market-card: rgba(255, 255, 255, .96);
  --market-text: #374151;
  --market-muted: #6B7280;
  background: var(--market-primary);
  color: #fff;
}

.market-container {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.market-topbar {
  background: var(--market-primary);
  border-bottom: 2px solid var(--market-gold);
}

.market-nav {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 15px 0;
}

.market-brand-row {
  display: flex;
  align-items: center;
  gap: 28px;
}

.market-logo {
  color: var(--market-gold);
  font-size: 25px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.market-logo:hover {
  color: #f2d878;
  text-decoration: none;
}

.market-nav-name {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  font-weight: 700;
}

.market-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  color: rgba(255, 255, 255, .9);
}

.gold-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 11px 20px;
  background: var(--market-gold);
  color: var(--market-primary);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.gold-button:hover {
  background: #e0bd48;
  color: var(--market-primary);
  text-decoration: none;
}

.gold-button.small {
  min-height: 32px;
  padding: 6px 14px;
  font-size: 14px;
}

.icon-lock {
  display: inline-block;
  margin-right: 6px;
  font-size: 12px;
  line-height: 1;
}

.market-page {
  padding: 30px 0 42px;
}

.market-title {
  text-align: center;
  margin: 0 0 38px;
}

.title-rule {
  display: inline-block;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--market-gold);
}

.market-title h1 {
  margin: 0;
  color: var(--market-gold);
  font-size: 32px;
  line-height: 1.3;
  font-weight: 800;
}

.market-title p {
  margin: 0;
  color: rgba(255, 255, 255, .88);
}

.market-grid {
  display: grid;
  gap: 28px;
}

.intro-grid {
  grid-template-columns: 1fr 2fr;
  margin-bottom: 34px;
}

.bottom-grid {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr);
  align-items: stretch;
}

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

.market-card {
  background: var(--market-card);
  color: var(--market-text);
  border-radius: 8px;
  border: 0;
  border-top: 4px solid var(--market-gold);
  box-shadow: 0 4px 6px rgba(0, 0, 0, .10), 0 1px 3px rgba(0, 0, 0, .08);
  padding: 24px;
  margin-bottom: 34px;
  transition: box-shadow .25s ease, transform .25s ease;
}

.template-card {
  overflow: hidden;
  border-top-width: 4px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, .10), 0 1px 3px rgba(0, 0, 0, .08);
}

.template-card > .section-head:first-child {
  margin: -24px -24px 18px;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(10, 36, 99, .05);
}

.market-card:hover,
.company-hero:hover {
  box-shadow: 0 10px 15px rgba(0, 0, 0, .12), 0 4px 6px rgba(0, 0, 0, .07);
}

.intro-grid .market-card,
.bottom-grid .market-card {
  margin-bottom: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.card-title h3 {
  margin: 0;
  color: var(--market-primary);
  font-size: 18px;
  line-height: 1.35;
  font-weight: 800;
}

.title-icon {
  width: 22px;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--market-gold);
  font-weight: 900;
}

.fa-like {
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: var(--market-gold);
}

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

.mini-stats div {
  min-height: 102px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  border: 1px solid rgba(212, 175, 55, .24);
  border-radius: 6px;
  background: var(--market-gold-soft);
  text-align: center;
}

.mini-stats strong {
  font-size: 32px;
  line-height: 1;
}

.mini-stats span {
  color: var(--market-text);
  font-size: 14px;
}

.compare-note {
  margin: 14px 0 0;
  color: var(--market-muted);
  font-size: 14px;
  text-align: center;
}

.commentary-panel .comment-text {
  color: var(--market-text);
  line-height: 1.85;
}

.company-hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 32px;
  align-items: center;
  padding: 32px;
  margin-bottom: 34px;
  border-radius: 8px;
  border-top: 4px solid var(--market-gold);
  background: linear-gradient(90deg, var(--market-primary), #09225c);
  box-shadow: 0 4px 6px rgba(0, 0, 0, .10), 0 1px 3px rgba(0, 0, 0, .08);
}

.company-copy h2 {
  margin: 0 0 16px;
  font-size: 25px;
  line-height: 1.35;
}

.company-copy h2 a {
  color: var(--market-gold);
}

.company-copy p {
  color: rgba(255, 255, 255, .9);
  line-height: 1.85;
  margin-bottom: 16px;
}

.advantage-box {
  padding: 24px;
  border-radius: 8px;
  border: 1px solid rgba(212, 175, 55, .34);
  background: rgba(255, 255, 255, .10);
}

.advantage-box h3 {
  color: var(--market-gold);
  font-size: 20px;
  margin-bottom: 16px;
}

.advantage-box ul,
.company-detail ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.advantage-box li {
  position: relative;
  padding-left: 22px;
  margin: 12px 0;
  color: rgba(255, 255, 255, .9);
}

.advantage-box li::before,
.company-detail li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--market-gold);
  font-weight: 900;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 18px;
  margin-bottom: 0;
}

.section-head .card-title {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.market-filters {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.market-filters label {
  min-width: 150px;
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: var(--market-muted);
}

.market-filters.compact label {
  min-width: 138px;
}

.market-filters select,
.market-filters input {
  min-height: 39px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  color: #333;
  font-size: 14px;
}

.history-filters {
  justify-content: flex-start;
  margin-bottom: 18px;
}

.history-filters label {
  flex: 0 0 150px;
  min-width: 150px;
}

.history-filters select,
.history-filters .date-display {
  width: 100%;
  height: 40px;
  min-height: 40px;
  line-height: 40px;
  padding: 0 12px;
  font-size: 14px;
}

.date-display::placeholder {
  color: #374151;
  opacity: .78;
}

.date-picker-pop {
  position: absolute;
  z-index: 9999;
  width: 280px;
  padding: 12px;
  border: 1px solid #d6dfeb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
  color: #1f2937;
}

.date-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.date-picker-head button,
.date-picker-days button {
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #1f2937;
  cursor: pointer;
  font: inherit;
}

.date-picker-head button {
  width: 32px;
  height: 32px;
  color: var(--market-primary, #0f4c81);
  font-size: 22px;
  line-height: 1;
}

.date-picker-head .date-picker-title {
  width: auto;
  min-width: 142px;
  padding: 0 10px;
  color: #1f2937;
  font-size: 15px;
  font-weight: 800;
}

.date-picker-head button:hover,
.date-picker-days button:hover {
  background: rgba(10, 36, 99, .08);
}

.date-picker-week,
.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.date-picker-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.date-picker-months button {
  height: 38px;
  border: 0;
  border-radius: 5px;
  background: #f7fafc;
  color: #1f2937;
  cursor: pointer;
  font: inherit;
}

.date-picker-months button:hover {
  background: rgba(10, 36, 99, .10);
  color: var(--market-primary, #0f4c81);
}

.date-picker-week {
  margin-bottom: 6px;
  color: #667085;
  font-size: 12px;
}

.date-picker-days button,
.date-picker-days span {
  height: 32px;
  line-height: 32px;
}

.date-picker-days button {
  background: #f7fafc;
}

.gold-button.query {
  align-self: end;
  min-height: 39px;
  padding: 9px 20px;
}

.market-table-wrap {
  border-color: #e5e7eb;
  border-radius: 0;
}

.market-table {
  min-width: 900px;
}

.market-table thead th {
  background: var(--market-primary);
  color: #fff;
  text-align: center;
  font-weight: 700;
}

.market-table td {
  text-align: center;
  color: #374151;
}

.market-table tbody tr:hover {
  background: #f9fafb;
}

.price-stack {
  display: grid;
  justify-items: center;
  gap: 2px;
  line-height: 1.25;
}

.price-stack strong {
  color: #1f2937;
  font-size: 20px;
  font-weight: 800;
}

.price-stack small {
  color: #6b7280;
  font-size: 12px;
  font-weight: 600;
}

.previous-price strong,
.previous-price small,
.muted-price strong,
.muted-price small {
  color: #9ca3af;
}

.market-disclaimer {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #fde68a;
  border-radius: 6px;
  background: #fffbeb;
  color: #4b5563;
  font-size: 14px;
  line-height: 1.75;
}

.market-disclaimer strong {
  color: #9a6b00;
  font-weight: 800;
}

.market-chart-box {
  height: 400px;
  border-radius: 6px;
  background: #fff;
}

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

.feature-grid > div {
  padding: 16px;
  border: 1px solid rgba(212, 175, 55, .24);
  border-radius: 6px;
  background: rgba(10, 36, 99, .05);
}

.feature-grid h4 {
  margin: 0 0 10px;
  color: var(--market-primary);
}

.service-summary {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.service-grid {
  margin-top: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.service-grid > div {
  min-height: 152px;
}

.service-grid h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
}

.mini-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--market-gold);
  font-size: 13px;
}

.contact-strip {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid rgba(212, 175, 55, .24);
  border-radius: 6px;
  background: rgba(10, 36, 99, .05);
  color: var(--market-text);
  text-align: center;
  font-size: 16px;
  line-height: 1.6;
}

.price-note {
  min-height: 100%;
}

.company-detail p,
.risk-note p {
  color: var(--market-text);
  line-height: 1.85;
}

.company-detail li {
  position: relative;
  padding-left: 18px;
  margin: 7px 0;
  color: var(--market-text);
}

@media (max-width: 920px) {
  .market-nav,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .market-actions,
  .market-filters {
    justify-content: flex-start;
  }

  .intro-grid,
  .company-hero,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 620px) {
  .market-container {
    width: min(100% - 20px, 1200px);
  }

  .market-brand-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .market-title h2 {
    font-size: 26px;
  }

  .market-card,
  .company-hero {
    padding: 18px;
  }

  .mini-stats,
  .feature-grid,
  .service-grid {
    grid-template-columns: 1fr;
  }

  .contact-strip {
    justify-items: start;
    text-align: left;
    font-size: 14px;
  }

  .market-filters,
  .market-filters label {
    width: 100%;
  }

  .history-filters label {
    flex: 1 1 100%;
    min-width: 0;
  }
}
