:root {
  color-scheme: light;
  --ink: #17251f;
  --ink-soft: #50625a;
  --forest: #214e3d;
  --forest-dark: #172f27;
  --mint: #dcebe2;
  --mint-soft: #f2f7f3;
  --cream: #f7f5ef;
  --paper: #fffefd;
  --line: #dde3de;
  --amber: #f4c95d;
  --amber-soft: #fff5d6;
  --red: #b94b4b;
  --red-soft: #fae8e6;
  --blue: #437d88;
  --shadow: 0 18px 55px rgba(23, 37, 31, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, .brand strong { font-family: ui-rounded, "SF Pro Rounded", Inter, ui-sans-serif, sans-serif; letter-spacing: -.035em; }
h1 { margin-bottom: 0; font-size: clamp(1.65rem, 2vw, 2.15rem); }
h2 { font-size: clamp(1.25rem, 2vw, 1.75rem); margin-bottom: .4rem; }
h3 { margin-bottom: .55rem; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; padding: 26px 18px; background: var(--forest-dark); color: #f4f8f5; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; padding: 0 8px 30px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--amber); color: var(--forest-dark); font-family: ui-rounded, sans-serif; font-weight: 800; font-size: 21px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: #a8bbb1; font-size: 12px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { width: 100%; border: 0; background: transparent; color: #afbeb7; padding: 12px 13px; border-radius: 11px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; text-align: left; transition: .18s ease; }
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { background: #315d4b; color: white; box-shadow: inset 3px 0 var(--amber); }
.nav-item kbd, .nav-count { font-family: inherit; font-size: 11px; border: 0; background: rgba(255,255,255,.09); border-radius: 6px; min-width: 23px; padding: 3px 6px; text-align: center; color: #dbe5df; }
.sidebar-card { margin-top: auto; padding: 15px; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; background: rgba(255,255,255,.04); }
.sidebar-card p { color: #b9c8c0; line-height: 1.55; font-size: 12px; margin: 8px 0 0; }
.sidebar-footer { display: flex; align-items: center; gap: 8px; color: #a8bbb1; font-size: 12px; padding: 18px 6px 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(244,201,93,.12); }
.status-dot.online { background: #7ad6a6; box-shadow: 0 0 0 4px rgba(122,214,166,.12); }

.main-content { grid-column: 2; min-width: 0; padding: 0 34px 48px; }
.topbar { min-height: 112px; display: flex; align-items: center; gap: 20px; justify-content: space-between; border-bottom: 1px solid rgba(80,98,90,.13); margin-bottom: 28px; }
.topbar-actions { display: flex; gap: 9px; align-items: center; }
.mobile-nav { display: none; border: 0; background: transparent; font-size: 24px; }
.eyebrow { display: block; text-transform: uppercase; letter-spacing: .14em; font-size: 10px; font-weight: 700; color: #6f8178; margin-bottom: 7px; }
.eyebrow.light { color: #c7d8cf; }
.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 15px; font-weight: 650; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: transform .15s ease, background .15s ease, border-color .15s ease; text-decoration: none; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--forest); color: white; box-shadow: 0 8px 18px rgba(33,78,61,.15); }
.button.primary:hover { background: #173f30; }
.button.ghost { background: rgba(255,255,255,.65); border-color: var(--line); color: var(--ink); }
.button.light { background: white; color: var(--forest); }
.button.small { padding: 7px 10px; font-size: 12px; }
.file-button input { display: none; }
.full-button { width: 100%; padding: 13px; }
.text-button { border: 0; background: transparent; color: var(--forest); font-weight: 700; cursor: pointer; }
.icon-button { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 25px; color: var(--ink-soft); }
.icon-button:hover { background: var(--mint-soft); }

.view { display: none; animation: rise .28s ease both; }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.hero-panel { background: radial-gradient(circle at 80% 0%, #3a6d58, transparent 42%), var(--forest-dark); color: white; border-radius: 24px; padding: 32px 34px; display: flex; justify-content: space-between; align-items: end; box-shadow: var(--shadow); overflow: hidden; }
.hero-panel h2 { font-size: clamp(1.55rem, 3vw, 2.4rem); margin-bottom: 8px; }
.hero-panel p { color: #c4d2ca; margin: 0; max-width: 600px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.metric-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-height: 114px; box-shadow: 0 5px 22px rgba(23,37,31,.03); }
.metric-card strong { display: block; font-family: ui-rounded, sans-serif; font-size: 28px; letter-spacing: -.04em; margin: 6px 0 4px; }
.metric-card small { color: var(--ink-soft); }
.metric-card .metric-icon { float: right; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--mint-soft); color: var(--forest); }
.skeleton { background: linear-gradient(110deg, #f0f2ef 8%, #fafbf9 18%, #f0f2ef 33%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-color: transparent; }
@keyframes shimmer { to { background-position-x: -200%; } }
.dashboard-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 8px 30px rgba(23,37,31,.035); }
.panel.compact { padding: 13px; }
.panel-heading, .section-intro { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.panel-heading { margin-bottom: 16px; }
.panel-heading h2, .panel-heading h3 { margin-bottom: 0; }
.span-two { grid-row: span 2; }
.candidate-list { display: grid; }
.candidate-row { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 14px; align-items: center; padding: 14px 0; border-top: 1px solid #ebefec; cursor: pointer; }
.candidate-row:first-child { border-top: 0; }
.rank-badge { width: 34px; height: 34px; display: grid; place-items: center; background: var(--mint-soft); color: var(--forest); border-radius: 10px; font-weight: 800; }
.candidate-row strong { display: block; }
.candidate-row small { color: var(--ink-soft); }
.score-pill { padding: 5px 9px; border-radius: 999px; background: var(--mint); color: var(--forest-dark); font-weight: 800; font-size: 12px; white-space: nowrap; }
.price { text-align: right; white-space: nowrap; }
.price strong { font-family: ui-rounded, sans-serif; }
.timeline { display: grid; gap: 4px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 10px 0; }
.timeline-item::before { content: ""; position: absolute; left: 57px; top: 0; bottom: 0; width: 1px; background: var(--line); }
.timeline-date { text-align: center; font-size: 11px; font-weight: 700; color: var(--forest); background: var(--mint-soft); border-radius: 10px; padding: 7px 4px; height: fit-content; }
.timeline-date strong { display: block; font-size: 17px; }
.timeline-content { padding-left: 14px; }
.timeline-content strong { display: block; }
.timeline-content small { color: var(--ink-soft); }
.guardrail-list { display: grid; gap: 10px; }
.guardrail { padding: 11px 12px; border-radius: 12px; background: var(--mint-soft); }
.guardrail strong { display: block; font-size: 13px; margin-bottom: 2px; }
.guardrail p { margin: 0; font-size: 12px; color: var(--ink-soft); line-height: 1.45; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-box { flex: 1; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: white; border-radius: 10px; padding: 0 12px; min-width: 240px; }
.search-box input { width: 100%; border: 0; outline: 0; padding: 10px 0; background: transparent; }
select, input, textarea { color: var(--ink); }
.toolbar select { border: 1px solid var(--line); background: white; border-radius: 10px; padding: 10px 12px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle span { width: 34px; height: 20px; border-radius: 999px; background: #cad2cd; position: relative; transition: .2s; }
.toggle span::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: white; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.toggle input:checked + span { background: var(--forest); }
.toggle input:checked + span::after { transform: translateX(14px); }
.properties-summary { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 13px; margin: 0 3px 9px; }
.property-table-wrap { padding: 0; overflow: hidden; }
.property-table { width: 100%; border-collapse: collapse; }
.property-table th { text-align: left; padding: 12px 13px; color: #718078; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; background: #fafbf9; border-bottom: 1px solid var(--line); }
.property-table td { padding: 14px 13px; border-bottom: 1px solid #ecf0ed; vertical-align: middle; }
.property-table tbody tr { transition: background .15s; }
.property-table tbody tr:hover { background: #fafcf9; }
.property-table tbody tr:last-child td { border-bottom: 0; }
.property-table .address-cell { cursor: pointer; }
.property-table .address-cell strong { display: block; }
.property-table .address-cell small, .muted { color: var(--ink-soft); }
.compare-check { width: 17px; height: 17px; accent-color: var(--forest); cursor: pointer; }
.status-select { border: 0; border-radius: 999px; padding: 7px 9px; background: var(--mint-soft); max-width: 135px; font-size: 12px; font-weight: 700; }
.status-select.rejected { background: var(--red-soft); color: var(--red); }
.floor-tag { white-space: nowrap; }
.mobile-property-list { display: none; }
.empty-state { text-align: center; padding: 55px 20px; }
.empty-state p { color: var(--ink-soft); }

.section-intro { margin-bottom: 18px; }
.section-intro p { margin: 0; color: var(--ink-soft); }
.compare-empty { text-align: center; padding: 70px 20px; }
.compare-empty p { color: var(--ink-soft); }
.compare-grid { display: grid; grid-template-columns: 170px repeat(4, minmax(210px, 1fr)); overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.compare-grid:empty { display: none; }
.compare-cell { padding: 14px 15px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 55px; }
.compare-cell.label { position: sticky; left: 0; z-index: 2; background: #fafbf9; font-weight: 700; color: var(--ink-soft); }
.compare-cell.header { padding-top: 20px; min-height: 130px; }
.compare-cell.header strong { display: block; font-family: ui-rounded, sans-serif; font-size: 17px; margin-bottom: 5px; }
.compare-cell.good { background: #f0f8f2; color: #1f6845; font-weight: 700; }
.compare-cell.risk { background: #fff5ef; color: #8b4d32; }

.viewing-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .75fr); gap: 18px; }
.viewing-list { display: grid; gap: 12px; }
.viewing-card { display: grid; grid-template-columns: 82px 1fr auto; gap: 16px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.viewing-card.not-requested { opacity: .68; }
.viewing-date-block { text-align: center; padding: 9px 5px; border-radius: 12px; background: var(--mint-soft); color: var(--forest); }
.viewing-date-block strong { display: block; font-family: ui-rounded, sans-serif; font-size: 21px; }
.viewing-date-block small { text-transform: uppercase; font-weight: 800; letter-spacing: .08em; }
.viewing-card h3 { margin-bottom: 3px; }
.viewing-card p { color: var(--ink-soft); margin: 5px 0 0; font-size: 13px; }
.viewing-guide { height: fit-content; position: sticky; top: 18px; }
.viewing-guide ol { padding-left: 20px; color: var(--ink-soft); line-height: 1.5; }
.viewing-guide li { margin-bottom: 11px; padding-left: 5px; }
.task-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.task-column { background: rgba(255,255,255,.5); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; min-height: 240px; }
.task-column-header { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 12px; }
.task-column-header h3 { margin: 0; font-size: 14px; }
.task-column-header span { background: white; border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; font-size: 11px; }
.task-card { background: white; border: 1px solid #e2e7e3; border-radius: 13px; padding: 14px; margin-bottom: 10px; cursor: pointer; box-shadow: 0 4px 12px rgba(23,37,31,.03); }
.task-card:hover { border-color: #b8c9bf; }
.task-card .task-meta { display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 11px; margin-bottom: 8px; }
.task-card p { font-size: 13px; line-height: 1.45; margin-bottom: 10px; }
.priority { display: inline-block; border-radius: 999px; padding: 3px 7px; font-size: 10px; font-weight: 800; }
.priority.high { background: var(--red-soft); color: var(--red); }
.priority.medium { background: var(--amber-soft); color: #755811; }
.priority.low { background: var(--mint-soft); color: var(--forest); }
.feedback-layout { display: grid; grid-template-columns: .9fr 1.3fr; gap: 18px; }
.criteria-table { display: grid; gap: 8px; }
.criterion { display: grid; grid-template-columns: 92px 1fr; gap: 12px; border-top: 1px solid #e8ece9; padding-top: 10px; }
.criterion:first-child { border: 0; padding-top: 0; }
.criterion strong { font-size: 12px; }
.criterion p { font-size: 12px; line-height: 1.45; color: var(--ink-soft); margin: 0; }
.feedback-list { display: grid; }
.feedback-item { padding: 14px 0; border-top: 1px solid #e8ece9; }
.feedback-item:first-child { padding-top: 0; border: 0; }
.feedback-item header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.feedback-item p { color: var(--ink-soft); line-height: 1.5; margin-bottom: 7px; }
.feedback-rule { border-left: 3px solid var(--amber); padding-left: 10px; font-size: 12px; color: var(--ink); }

dialog { padding: 0; border: 0; background: transparent; max-height: 92vh; width: min(680px, calc(100% - 28px)); }
dialog.wide { width: min(900px, calc(100% - 28px)); }
dialog.small { width: min(460px, calc(100% - 28px)); }
dialog::backdrop { background: rgba(10,25,19,.55); backdrop-filter: blur(5px); }
.modal-shell { background: var(--paper); border-radius: 20px; overflow: hidden; box-shadow: 0 30px 80px rgba(10,25,19,.25); max-height: 92vh; display: flex; flex-direction: column; }
.modal-header { padding: 21px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-footer { border-top: 1px solid var(--line); padding: 15px 24px; display: flex; justify-content: flex-end; gap: 9px; background: #fafbf9; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .score-grid label { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.field input, .field textarea, .field select, .score-grid input { width: 100%; border: 1px solid #ced8d2; border-radius: 10px; background: white; padding: 10px 11px; outline: 0; transition: border .15s, box-shadow .15s; }
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus, .score-grid input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(33,78,61,.1); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-two, .field.full, .full { grid-column: 1 / -1; }
.form-section { padding: 8px 0 19px; border-bottom: 1px solid #e7ebe8; margin-bottom: 15px; }
.form-section:last-child { border: 0; }
.form-section h3 { font-size: 14px; margin-bottom: 13px; }
.paste-fallback { margin: 14px 0; }
.paste-fallback summary { cursor: pointer; color: var(--forest); font-weight: 700; font-size: 13px; margin-bottom: 10px; }
.analysis-note, .warning-box { display: flex; gap: 12px; border-radius: 12px; padding: 13px; margin: 14px 0; font-size: 12px; line-height: 1.5; }
.analysis-note { background: var(--mint-soft); color: var(--ink-soft); }
.analysis-note span { width: 22px; height: 22px; border-radius: 50%; background: var(--forest); color: white; display: grid; place-items: center; flex: none; }
.analysis-note p { margin: 0; }
.warning-box { display: block; background: var(--amber-soft); color: #705819; }
.warning-box strong { display: block; margin-bottom: 4px; }
.score-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin-bottom: 16px; }
.score-grid label { display: grid; gap: 5px; }
.toast-region { position: fixed; right: 22px; bottom: 22px; display: grid; gap: 8px; z-index: 100; }
.toast { min-width: 260px; max-width: 380px; padding: 13px 15px; border-radius: 11px; background: var(--forest-dark); color: white; box-shadow: var(--shadow); animation: toast-in .25s ease; }
.toast.error { background: #792f2f; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.hidden { display: none !important; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .property-table th:nth-child(3), .property-table td:nth-child(3), .property-table th:nth-child(6), .property-table td:nth-child(6) { display: none; }
  .task-board { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 20px 0 50px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .main-content { padding: 0 16px 34px; }
  .topbar { min-height: 92px; margin-bottom: 20px; }
  .mobile-nav { display: block; }
  .topbar-actions .button.ghost, .file-button { display: none; }
  .topbar-actions .button.primary { font-size: 0; padding: 10px 12px; }
  .topbar-actions .button.primary span { font-size: 18px; }
  .hero-panel { align-items: flex-start; flex-direction: column; gap: 20px; padding: 25px; }
  .dashboard-grid, .viewing-layout, .feedback-layout { grid-template-columns: 1fr; }
  .span-two { grid-row: auto; }
  .viewing-guide { position: static; }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .property-table { display: none; }
  .mobile-property-list { display: grid; }
  .mobile-property-card { display: grid; gap: 11px; padding: 16px; border-bottom: 1px solid var(--line); }
  .mobile-property-card header, .mobile-property-card footer { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
  .mobile-property-card p { margin: 0; color: var(--ink-soft); font-size: 12px; }
  .task-board { grid-template-columns: 1fr; }
  .viewing-card { grid-template-columns: 65px 1fr; }
  .viewing-card .button { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { padding: 14px; min-height: 100px; }
  .metric-card strong { font-size: 22px; }
  .candidate-row { grid-template-columns: 32px 1fr auto; }
  .candidate-row .price { display: none; }
  .panel { padding: 17px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .score-grid { grid-template-columns: repeat(3, 1fr); }
  .section-intro { flex-direction: column; }
}
