:root {
  --paper: #f5f2eb;
  --sand: #ded7ca;
  --ink: #111411;
  --forest: #1b211d;
  --moss: #697269;
  --wine: #754642;
  --gold: #d6c4a2;
  --line: rgba(17, 20, 17, .16);
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }

.shell { min-height: 100dvh; }
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  min-height: 76px;
  grid-template-columns: auto 1fr auto;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 242, 235, .96);
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  border-right: 1px solid var(--line);
}
.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  color: white;
  background: var(--ink);
  font-family: var(--serif);
  font-size: 24px;
  font-style: italic;
}
.brand-copy { display: grid; }
.brand-copy small {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: .1em;
}
.brand-copy strong {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
}
.nav {
  display: flex;
  justify-content: center;
}
.nav a {
  display: flex;
  min-width: 130px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.nav a:hover { background: var(--sand); }
.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-left: 1px solid var(--line);
}
.user-menu div { display: grid; gap: 2px; }
.user-menu strong { font-size: 13px; }
.user-menu span {
  color: var(--moss);
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
}
.link-button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid;
  color: var(--wine);
  background: transparent;
  font-size: 11px;
}

.page {
  width: min(100% - 48px, 1280px);
  margin: 0 auto;
  padding: 64px 0 100px;
}
.page-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
  margin-bottom: 46px;
}
.eyebrow {
  color: var(--wine);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; }
h1 {
  max-width: 850px;
  margin-bottom: 12px;
  font-size: clamp(54px, 7vw, 92px);
  line-height: .9;
  letter-spacing: -.045em;
}
.page-head p:last-child {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--moss);
  line-height: 1.65;
}
.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: 1px solid var(--ink);
  color: white;
  background: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.button:hover { background: #333; }
.button-secondary { color: var(--ink); background: transparent; }
.button-wine { border-color: var(--wine); background: var(--wine); }
.button-danger { border-color: #8c3028; background: #8c3028; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 56px;
  border: 1px solid var(--line);
  background: #fbfaf7;
}
.stat {
  min-height: 126px;
  padding: 22px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: 0; }
.stat span {
  display: block;
  color: var(--moss);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.stat strong {
  display: block;
  margin-top: 24px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
}

.section-block { margin-top: 64px; }
.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.section-title h2 { margin: 0; font-size: 38px; }
.section-title p { max-width: 500px; margin: 0; color: var(--moss); font-size: 13px; }

.order-list { border-bottom: 1px solid var(--line); }
.order-row {
  display: grid;
  grid-template-columns: 90px minmax(230px, 1fr) 170px 150px 100px;
  gap: 22px;
  align-items: center;
  min-height: 118px;
  padding: 20px 12px;
  border-top: 1px solid var(--line);
  transition: background .18s ease;
}
.order-row:hover { background: #fbfaf7; }
.order-id {
  color: var(--wine);
  font-family: var(--mono);
  font-size: 10px;
}
.order-row h3 { margin: 0 0 7px; font-size: 25px; }
.order-row p { margin: 0; color: var(--moss); font-size: 12px; }
.order-meta span, .order-money span {
  display: block;
  color: var(--moss);
  font-size: 11px;
  line-height: 1.7;
}
.order-money strong { font-family: var(--serif); font-size: 24px; }
.chevron { color: var(--wine); font-size: 26px; text-align: right; }

.status {
  display: inline-flex;
  width: fit-content;
  padding: 6px 8px;
  color: white;
  background: var(--moss);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.status-new { background: var(--wine); }
.status-completed { background: #355f47; }
.status-disputed, .status-changes_requested { background: #914437; }
.status-awaiting_review { color: var(--ink); background: var(--gold); }

.empty {
  padding: 52px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--moss);
  text-align: center;
}

.form-card {
  max-width: 860px;
  padding: 38px;
  border: 1px solid var(--line);
  background: #fbfaf7;
}
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
label {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 12px;
  font-weight: 600;
}
input, select, textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  color: var(--ink);
  background: white;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--wine);
  box-shadow: 0 0 0 3px rgba(117, 70, 66, .12);
}
.helper { margin: -10px 0 20px; color: var(--moss); font-size: 11px; line-height: 1.5; }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.error, .notice {
  margin-bottom: 24px;
  padding: 15px 18px;
  border-left: 3px solid #9c372f;
  color: #76251f;
  background: #f4dfdc;
  font-size: 13px;
}
.notice {
  border-color: #477058;
  color: #294b38;
  background: #dfeadf;
}

.auth-page {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: minmax(0, 1fr) minmax(430px, .72fr);
}
.auth-story {
  position: relative;
  display: flex;
  min-height: 100dvh;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: 46px clamp(30px, 6vw, 90px);
  color: white;
  background: var(--forest);
}
.auth-story::after {
  position: absolute;
  right: -5%;
  bottom: -28%;
  color: rgba(255,255,255,.04);
  content: "P";
  font-family: var(--serif);
  font-size: 720px;
  font-style: italic;
}
.auth-story .brand { z-index: 1; width: fit-content; padding: 0; border: 0; }
.auth-story h1 { position: relative; z-index: 1; max-width: 760px; }
.auth-story p { position: relative; z-index: 1; max-width: 580px; color: #c7cec8; line-height: 1.7; }
.auth-panel {
  display: flex;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 46px;
  background: var(--sand);
}
.auth-form { width: min(100%, 470px); }
.auth-form h2 { margin-bottom: 12px; font-size: 50px; }
.auth-form > p { margin-bottom: 32px; color: var(--moss); line-height: 1.6; }
.role-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}
.role-picker label { position: relative; margin: 0; }
.role-picker input { position: absolute; opacity: 0; }
.role-picker span {
  min-height: 86px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: var(--serif);
  font-size: 21px;
}
.role-picker input:checked + span {
  border-color: var(--wine);
  box-shadow: inset 0 -3px var(--wine);
}
.auth-switch { margin-top: 24px; color: var(--moss); font-size: 12px; }
.auth-switch a { color: var(--wine); text-decoration: underline; }
.consent-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--moss);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.55;
}
.consent-line input {
  width: 17px;
  min-height: 17px;
  flex: none;
  margin-top: 1px;
  accent-color: var(--wine);
}
.consent-line a { color: var(--wine); text-decoration: underline; }

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}
.detail-card, .side-card {
  padding: 30px;
  border: 1px solid var(--line);
  background: #fbfaf7;
}
.detail-card h2 { font-size: 42px; }
.detail-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 30px 0;
  border-top: 1px solid var(--line);
}
.detail-facts div { padding: 18px 12px 18px 0; border-bottom: 1px solid var(--line); }
.detail-facts span { display: block; color: var(--moss); font-size: 10px; }
.detail-facts strong { display: block; margin-top: 7px; font-size: 14px; }
.description { color: #4e574f; line-height: 1.75; white-space: pre-wrap; }
.side-card { margin-bottom: 20px; }
.side-card h3 { font-size: 28px; }
.payout {
  padding: 22px;
  color: white;
  background: var(--forest);
}
.payout span { color: #c7cec8; font-size: 11px; }
.payout strong { display: block; margin-top: 8px; font-family: var(--serif); font-size: 38px; }
.proposal {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.proposal-head { display: flex; justify-content: space-between; gap: 20px; }
.proposal p { color: var(--moss); font-size: 12px; line-height: 1.6; }

.messages { margin-top: 28px; }
.message {
  max-width: 78%;
  margin-bottom: 12px;
  padding: 14px;
  background: var(--sand);
}
.message-own { margin-left: auto; background: #bdc5bd; }
.message small { color: var(--moss); font-family: var(--mono); font-size: 8px; }
.message p { margin: 7px 0 0; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.message-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 20px; }
.message-form textarea { min-height: 52px; margin: 0; }

.report {
  margin-top: 18px;
  padding: 22px;
  border-left: 3px solid var(--wine);
  background: #eee8dc;
}
.report-files { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.report-files img { width: 100%; height: 140px; object-fit: cover; }

@media (max-width: 980px) {
  .nav { display: none; }
  .topbar { grid-template-columns: 1fr auto; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .order-row { grid-template-columns: 70px 1fr 150px 70px; }
  .order-meta { display: none; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-story { min-height: 520px; }
  .auth-panel { min-height: auto; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 660px) {
  .page { width: min(100% - 28px, 1280px); padding-top: 42px; }
  .brand { padding: 0 14px; }
  .user-menu { padding: 0 12px; }
  .user-menu div { display: none; }
  .page-head { grid-template-columns: 1fr; }
  h1 { font-size: 54px; }
  .stats { grid-template-columns: 1fr; }
  .stat { min-height: 96px; border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .stat strong { margin-top: 12px; }
  .order-row { grid-template-columns: 58px 1fr 42px; gap: 12px; }
  .order-money { display: none; }
  .field-grid, .detail-facts { grid-template-columns: 1fr; }
  .form-card { padding: 24px 18px; }
  .auth-story { min-height: 450px; padding: 28px 22px; }
  .auth-story h1 { font-size: 58px; }
  .auth-panel { padding: 42px 20px; }
  .role-picker { grid-template-columns: 1fr; }
  .message { max-width: 92%; }
  .message-form { grid-template-columns: 1fr; }
  .report-files { grid-template-columns: 1fr 1fr; }
}
