:root {
  color-scheme: light;
  --bg: #eef2f4;
  --surface: #ffffff;
  --line: #d7dee3;
  --text: #172026;
  --muted: #63707a;
  --accent: #126b5f;
  --accent-2: #d48b35;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(22, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(18, 107, 95, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(212, 139, 53, 0.14), transparent 30%),
    var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

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

button.secondary {
  background: #e7ecef;
  color: var(--text);
}

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

.is-hidden {
  display: none !important;
}

.login-view {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 24px;
}

.brand-panel,
.login-form,
.editor,
.chart-panel,
.table-section,
.metrics article {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.brand-panel {
  min-height: 420px;
  padding: 42px;
  display: flex;
  align-items: center;
  gap: 26px;
}

.brand-mark {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 54px;
  font-weight: 900;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.06;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 20px;
}

.muted,
.hint {
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  padding: 30px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.login-form label + label,
.login-form button {
  margin-top: 16px;
}

.login-form button {
  width: 100%;
}

.hint {
  margin: 14px 0 0;
  font-size: 13px;
}

.error {
  min-height: 20px;
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 14px;
  font-weight: 700;
}

.setup-warning {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border: 1px solid #f1c37d;
  border-radius: 6px;
  padding: 14px 16px;
  background: #fff7e8;
  color: #684100;
}

.setup-warning strong {
  color: #513100;
}

.dashboard {
  display: grid;
  gap: 22px;
}

.topbar,
.panel-title,
.top-actions,
.filters {
  display: flex;
  align-items: center;
}

.topbar,
.panel-title {
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

#currentUser {
  color: var(--muted);
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metrics article {
  padding: 20px;
}

.metrics span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metrics strong {
  font-size: 28px;
}

.workbench {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
}

.registry-layout {
  grid-template-columns: 1.35fr 0.65fr;
}

.editor,
.chart-panel,
.table-section {
  padding: 22px;
}

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

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

.editor button {
  margin-top: 18px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bar-chart {
  height: 280px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  align-items: end;
  gap: 10px;
  padding-top: 20px;
}

.bar {
  min-width: 0;
  display: grid;
  align-content: end;
  gap: 8px;
  height: 100%;
}

.bar-value {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.bar-fill {
  min-height: 8px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
}

.bar-date {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.filters {
  gap: 10px;
}

.filters input {
  width: 220px;
}

.filters select {
  width: 130px;
}

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

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

.sale-table {
  min-width: 1080px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef2f4;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.status.settled {
  background: #e2f4ee;
  color: #0f6b4f;
}

.status.pending {
  background: #fff0d9;
  color: #8a5200;
}

.status.rented {
  background: #e8eefc;
  color: #2548a5;
}

.status.listed {
  background: #e9f7fb;
  color: #0b5c74;
}

.status.closed {
  background: #ece8f8;
  color: #56339a;
}

.status-panel {
  min-height: 100%;
}

.status-summary {
  display: grid;
  gap: 18px;
  padding-top: 10px;
}

.status-row {
  display: grid;
  gap: 10px;
}

.status-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-row-head strong {
  font-size: 18px;
}

.status-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecef;
}

.status-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.row-actions .delete {
  background: #f5e3e1;
  color: var(--danger);
}

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

@media (max-width: 860px) {
  .login-view,
  .workbench,
  .metrics {
    grid-template-columns: 1fr;
  }

  .brand-panel {
    min-height: auto;
    padding: 26px;
  }

  .topbar,
  .panel-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions,
  .filters {
    width: 100%;
    justify-content: flex-start;
  }

  .filters input,
  .filters select {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 10px 0;
  }

  .brand-panel {
    display: grid;
  }

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

  .bar-chart {
    gap: 6px;
  }

  .bar-value,
  .bar-date {
    font-size: 10px;
  }
}
