:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-soft: #f0f7f5;
  --text: #1f2423;
  --muted: #66706e;
  --line: #dfe4df;
  --accent: #176b5b;
  --accent-strong: #0f4d41;
  --sun: #d98a21;
  --blue: #2d5f8b;
  --red: #b8483d;
  --shadow: 0 18px 50px rgba(43, 54, 50, 0.1);
  --radius: 8px;
  --sidebar: 248px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: #fbfaf6;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

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

.brand-name {
  font-weight: 800;
  font-size: 18px;
}

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

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  width: 100%;
  height: 44px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  color: var(--accent-strong);
  background: #e5f1ee;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.sidebar-panel {
  margin-top: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-label,
.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.city-switch {
  border: 0;
  padding: 0;
  width: 100%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

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

.main {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: 520px;
}

.user-pill {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.user-avatar {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e5f1ee;
  color: var(--accent-strong);
  font-size: 12px;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.35;
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.ghost-button,
.primary-button,
.mini-button,
.text-button {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  height: 40px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0 2px;
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 18px;
}

.search-box {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(43, 54, 50, 0.06);
}

.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
}

.search-symbol {
  color: var(--accent);
  font-size: 20px;
}

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

.metric {
  min-width: 0;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 16px;
}

.metric-label,
.metric-change {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 21px;
}

.up {
  color: var(--accent);
}

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

.neutral {
  color: var(--blue);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

.main-column,
.right-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.news-block,
.section-split,
.stage-card,
.auth-card,
.ai-card,
.guide-card,
.safety-card {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 18px;
  box-shadow: var(--shadow);
}

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

.section-head.compact {
  margin-bottom: 12px;
}

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

.news-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid #e7ebe7;
  background: #fbfcfa;
}

.news-item.urgent {
  background: #fff8ef;
  border-color: #f3dfbd;
}

.news-type {
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #e5f1ee;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

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

.action-card {
  min-height: 128px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 8px;
}

.action-card:hover,
.listing-card:hover,
.job-item:hover {
  border-color: #b8d3ca;
}

.action-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 800;
}

.house {
  background: var(--accent);
}

.work {
  background: var(--blue);
}

.list {
  background: var(--sun);
}

.ai {
  background: #6254a8;
}

.action-card span:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.listing-card {
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fbfcfa;
}

.photo {
  height: 150px;
  background-size: cover;
  background-position: center;
}

.photo-1 {
  background-image:
    linear-gradient(135deg, rgba(23, 107, 91, 0.72), rgba(45, 95, 139, 0.18)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='480' viewBox='0 0 800 480'%3E%3Crect width='800' height='480' fill='%23dfe7e3'/%3E%3Crect x='85' y='82' width='630' height='315' rx='12' fill='%23f9faf7'/%3E%3Crect x='130' y='130' width='210' height='220' rx='6' fill='%23c5d5cf'/%3E%3Crect x='380' y='126' width='260' height='88' rx='6' fill='%23e4ece8'/%3E%3Crect x='380' y='240' width='260' height='88' rx='6' fill='%23e4ece8'/%3E%3Ccircle cx='238' cy='242' r='54' fill='%23f0c98a'/%3E%3C/svg%3E");
}

.photo-2 {
  background-image:
    linear-gradient(135deg, rgba(217, 138, 33, 0.72), rgba(23, 107, 91, 0.1)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='800' height='480' viewBox='0 0 800 480'%3E%3Crect width='800' height='480' fill='%23ede8dc'/%3E%3Crect x='80' y='92' width='640' height='305' rx='12' fill='%23fffaf0'/%3E%3Crect x='118' y='126' width='282' height='236' rx='8' fill='%23d8c3a1'/%3E%3Crect x='430' y='138' width='215' height='56' rx='6' fill='%23eadfcd'/%3E%3Crect x='430' y='220' width='215' height='56' rx='6' fill='%23eadfcd'/%3E%3Crect x='430' y='302' width='150' height='56' rx='6' fill='%23eadfcd'/%3E%3C/svg%3E");
}

.listing-body {
  padding: 14px;
}

.tag-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: #eef1ee;
}

.tag.verified {
  color: var(--accent);
  background: #e0f0ec;
}

.tag.caution {
  color: #8d5b16;
  background: #faedd8;
}

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

.job-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.job-type {
  border-radius: 999px;
  padding: 5px 8px;
  text-align: center;
  background: #eef1ee;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.mini-button {
  height: 34px;
}

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

.stage-grid button {
  height: 42px;
  border: 1px solid var(--line);
  background: #fbfcfa;
  border-radius: var(--radius);
  font-weight: 700;
}

.stage-grid button:hover {
  border-color: var(--accent);
}

.auth-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.auth-modal[hidden] {
  display: none;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 26, 24, 0.42);
  backdrop-filter: blur(8px);
}

.auth-dialog {
  position: relative;
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(19, 31, 28, 0.24);
  padding: 20px;
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--radius);
  background: #f3f5f2;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 184px;
  padding: 4px;
  border-radius: var(--radius);
  background: #eef1ee;
  margin-bottom: 18px;
}

.auth-tab {
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-tab.active {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 4px 14px rgba(43, 54, 50, 0.08);
}

.auth-copy {
  margin-bottom: 16px;
}

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

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
  color: var(--text);
  outline: none;
  padding: 0 12px;
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.12);
}

.auth-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.auth-message.success {
  color: var(--accent);
}

.ai-card {
  background: #0f4d41;
  color: #fff;
}

.ai-card p {
  color: rgba(255, 255, 255, 0.78);
}

.ai-orb {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.14);
  font-weight: 900;
  margin-bottom: 16px;
}

.wide {
  width: 100%;
  background: #fff;
  color: var(--accent-strong);
  border-color: #fff;
}

.guide-list {
  display: grid;
  gap: 8px;
}

.guide-list a {
  padding: 11px 12px;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  background: #f7f9f7;
  border: 1px solid #e7ebe7;
  font-weight: 700;
}

.safety-card ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.mobile-tabs {
  display: none;
}

@media (max-width: 1120px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .guide-card,
  .safety-card {
    grid-column: auto;
  }
}

@media (max-width: 860px) {
  .app-shell {
    display: block;
    padding-bottom: 74px;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    max-width: none;
  }

  h1 {
    font-size: 26px;
  }

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

  .quick-actions,
  .listing-row,
  .right-column {
    grid-template-columns: 1fr;
  }

  .mobile-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(251, 250, 246, 0.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(16px);
  }

  .mobile-tabs button {
    height: 42px;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-tabs button.active {
    background: #e5f1ee;
    color: var(--accent-strong);
  }
}

@media (max-width: 560px) {
  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions > button,
  .user-pill,
  .ghost-button {
    width: 100%;
  }

  .publish-button {
    order: 4;
  }

  .search-panel {
    grid-template-columns: 1fr;
  }

  .search-panel .primary-button {
    height: 46px;
  }

  .market-strip {
    grid-template-columns: 1fr;
  }

  .news-item,
  .job-item {
    grid-template-columns: 1fr;
  }

  .time {
    justify-self: start;
  }
}
