:root {
  --ink: #20362f;
  --muted: #68766e;
  --brand: #245d48;
  --bg: #f5f6f2;
  --line: #dce2da;
  --paper: #fff;
  --soft: #eaf1e9;
  --danger: #a32d25;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    15px/1.6 system-ui,
    "Microsoft YaHei",
    sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 7px;
}
button:hover {
  background: var(--soft);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
.primary:hover {
  background: #1c4939;
}
.danger {
  color: var(--danger);
}
a {
  color: var(--brand);
}
input,
select,
textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
}
input:focus,
textarea:focus,
select:focus,
button:focus-visible {
  outline: 2px solid #478869;
  outline-offset: 2px;
}
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  vertical-align: middle;
}
label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}
label input,
label textarea {
  margin-top: 6px;
}
h1 {
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -1px;
  margin: 0;
}
h2 {
  font-size: 20px;
  margin: 0 0 16px;
}
p {
  margin: 8px 0 20px;
  color: var(--muted);
}
.shell {
  display: flex;
  min-height: 100vh;
}
aside {
  width: 225px;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 32px 24px;
  background: #edf0e9;
  border-right: 1px solid var(--line);
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  font-size: 25px;
  font-weight: 750;
  color: var(--brand);
}
.brand span {
  font-size: 20px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 2px;
  margin: 50px 8px 16px;
}
nav {
  display: grid;
  gap: 8px;
}
nav button {
  border: 0;
  background: transparent;
  text-align: left;
}
nav button.active {
  background: #dce6d9;
  color: var(--brand);
  font-weight: 650;
}
.aside-bottom {
  position: absolute;
  bottom: 30px;
  font-size: 12px;
  color: var(--muted);
  line-height: 2.2;
}
main {
  margin-left: 225px;
  width: calc(100% - 225px);
}
header {
  height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 0 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
#content {
  padding: 36px 44px;
  max-width: 1500px;
  margin: auto;
}
.topline {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
  margin-bottom: 28px;
}
.topline p {
  margin-bottom: 0;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin: 20px 0;
}
.toolbar,
.tabs {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.tabs {
  margin: 25px 0;
  border-bottom: 1px solid var(--line);
  gap: 24px;
}
.tabs button {
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 12px 0;
}
.tabs button.active {
  border-bottom: 3px solid var(--brand);
  color: var(--brand);
  font-weight: 650;
}
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}
.card {
  padding: 24px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.card h3 {
  margin: 10px 0;
  font-size: 18px;
}
.card .price {
  font-size: 30px;
  font-weight: 650;
  margin: 12px 0;
}
.tag {
  display: inline-block;
  background: var(--soft);
  color: var(--brand);
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
}
.table-wrap {
  overflow: auto;
  margin-top: 18px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  background: #f1f4ef;
  color: #5f7064;
  font-weight: 500;
}
th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td input {
  min-width: 95px;
  font-size: 13px;
  padding: 8px;
}
td .name {
  min-width: 160px;
}
.empty {
  padding: 65px 20px;
  text-align: center;
  background: white;
  border: 1px dashed #bacabd;
  border-radius: 12px;
}
.empty h2 {
  margin-top: 10px;
}
.empty p {
  max-width: 400px;
  margin: 8px auto 24px;
}
.summary {
  padding: 22px 0;
  display: flex;
  gap: 56px;
  border-bottom: 1px solid var(--line);
}
.summary strong {
  display: block;
  font-size: 25px;
}
.summary span {
  font-size: 12px;
  color: var(--muted);
}
.errors {
  color: var(--danger);
  background: #fff4ed;
  padding: 16px 22px;
  border-radius: 6px;
}
.errors li {
  margin: 4px 0;
}
.small {
  font-size: 12px;
  color: var(--muted);
}
.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.quote-source {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 14px;
}
.quote-photo {
  max-height: 220px;
  max-width: 100%;
}
.file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  max-width: 460px;
}
dialog::backdrop {
  background: #20362f66;
}
dialog h2 {
  margin: 0;
}
#notice {
  position: fixed;
  right: 24px;
  top: 16px;
  z-index: 5;
  background: #203e31;
  color: white;
  padding: 0;
  border-radius: 8px;
  max-width: min(600px, 90vw);
}
#notice:not(:empty) {
  padding: 12px 20px;
}
.admin-login {
  max-width: 500px;
  margin: 70px auto;
}
.page-narrow {
  max-width: 800px;
}
.note {
  font-size: 13px;
  color: var(--muted);
  padding: 10px 0;
}
.status {
  font-size: 12px;
  font-weight: 650;
}
.check-label {
  display: flex;
  gap: 8px;
  align-items: center;
}
.ocr-text {
  min-height: 180px;
}
.upload {
  display: inline-block;
  position: relative;
  overflow: hidden;
}
.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
footer {
  margin: 30px 0;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 850px) {
  aside {
    width: 74px;
    padding: 24px 12px;
  }
  .brand {
    font-size: 24px;
    justify-content: center;
  }
  .brand span,
  .eyebrow,
  .aside-bottom {
    display: none;
  }
  nav {
    margin-top: 32px;
  }
  nav button {
    font-size: 12px;
    padding: 8px 0;
    text-align: center;
  }
  main {
    margin-left: 74px;
    width: calc(100% - 74px);
  }
  header {
    padding: 0 20px;
  }
  #content {
    padding: 24px 20px;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .fields,
  .quote-source {
    grid-template-columns: 1fr;
  }
  .topline {
    flex-direction: column;
  }
  .summary {
    gap: 28px;
  }
  .panel {
    padding: 16px;
  }
  h1 {
    font-size: 25px;
  }
}
.lowest {
  background: var(--soft);
  color: var(--brand);
}
.projects-grid {
  margin-top: 24px;
}

/* Procurement workspace */
.workspace { --ink:#203b34; --bg:#f4f6f3; --brand:#17634c; --line:#dce5df; font-family:Inter,"Microsoft YaHei",sans-serif; }
.workspace aside { background:#133c34; color:#fff; border:0; }
.workspace .brand { color:#fff; gap:10px; }
.workspace .brand b { display:grid; place-items:center; width:38px; height:38px; border-radius:11px; background:#d0ee9e; color:#204336; font-size:22px; }
.workspace .eyebrow { color:#b5cec3; }
.workspace nav button { color:#e1eae5; }
.workspace nav button:hover { background:#285248; }
.workspace nav .active { background:#31594d; color:#e7f7cd; box-shadow:inset 3px 0 #c4e794; }
.workspace .aside-bottom a { color:#d9ebdf; text-decoration:none; }
.workspace header { background:#fff; height:64px; }
.workspace #account { font-size:12px; }
.workspace #account::before { content:"";display:inline-block;width:7px;height:7px;border-radius:50%;background:#428264;margin-right:8px; }
.workspace .topline { align-items:center; }
.workspace .primary { border-radius:9px; box-shadow:0 2px 4px #163d2920; }
.metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin:0 0 28px; }
.metrics > div { position:relative;overflow:hidden;padding:22px 26px;background:#fff;border:1px solid var(--line);border-radius:14px; }
.metrics > div:first-child { background:#214e41;color:white;border-color:#214e41; }
.metrics > div:first-child::after { content:"";position:absolute;right:-25px;bottom:-55px;width:122px;height:122px;border:1px solid #81a89155; border-radius:50%;box-shadow:0 0 0 14px #81a89115,0 0 0 30px #81a89110; }
.metrics span { font-size:14px; }
.metrics strong { display:block;font-size:38px;font-weight:650;line-height:1.2;margin-top:12px;font-variant-numeric:tabular-nums; }
.metrics small { font-size:12px;font-weight:400;margin-left:8px; }
.register,.workspace .panel,.workspace .card { background:white;border:1px solid var(--line);border-radius:14px;box-shadow:0 3px 12px #213c2e05; }
.register { overflow:hidden; }
.register h2 { padding:20px 24px;margin:0;font-size:18px; }
.register .table-wrap { margin:0; }
.register th,.register td { padding:14px 20px; }
.register tbody tr:last-child td { border-bottom:none; }
.register td button { border:0;color:var(--brand);padding:4px 7px;min-height:34px;font-weight:600; }
.project-state { display:inline-flex;align-items:center;gap:7px;padding:3px 9px;border-radius:20px;background:#fff3d9;color:#775418;font-size:12px; }
.project-state.selected { color:#256344;background:#e8f3e7; }
.project-state::before { content:"";width:6px;height:6px;background:currentColor;border-radius:50%; }
.workspace .tabs { background:#fff;border:1px solid var(--line);border-radius:12px;gap:4px;padding:5px; }
.workspace .tabs button { padding:9px 14px;border:0;border-radius:8px; }
.workspace .tabs .active { background:#e2efe4; }
.workspace #editor .fields { margin:12px 0; }
.workspace select[data-party] { flex:1;min-width:110px; }
@media(max-width:850px){.workspace .topline{align-items:flex-start}.metrics{gap:8px}.metrics>div{padding:14px}.metrics strong{font-size:28px}}
@media(max-width:600px){.workspace .shell{display:block}.workspace aside{position:static;width:auto;display:flex;align-items:center;justify-content:space-between;padding:10px 14px}.workspace .brand span{display:inline;font-size:16px}.workspace nav{display:flex;margin:0}.workspace nav button{padding:8px}.workspace main{width:100%;margin:0}.workspace header{height:44px}.workspace #content{padding:20px 12px}.metrics span{font-size:12px}.metrics>div{padding:10px}.workspace .tabs button{font-size:13px;padding:7px}.register th,.register td{padding:10px}}

.license-preview {width:min(900px,94vw);max-width:none;max-height:90vh;overflow:auto}
.license-preview img {display:block;max-width:100%;max-height:70vh;object-fit:contain;margin:12px auto 0}
@media print {
  body:has(.license-preview[open]) > :not(.license-preview), .license-preview .toolbar {display:none!important}
  .license-preview[open] {position:static;inset:auto;width:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:visible}
  .license-preview::backdrop {background:transparent}
  .license-preview img {width:100%;height:auto;max-height:95vh;margin:0;object-fit:contain;break-inside:avoid}
}

.party-picker { position:relative; }
.party-menu { position:absolute; top:100%; left:0; right:0; z-index:4; padding:4px; max-height:230px; overflow:auto; background:white; border:1px solid var(--line); border-radius:8px; box-shadow:0 6px 18px #20362f20; }
.party-menu button { display:block; width:100%; text-align:left; border:0; }

.review-layout {display:grid;grid-template-columns:minmax(240px,36%) minmax(0,1fr);align-items:start;gap:16px}
.review-photo {position:sticky;top:10px;background:var(--paper);border:1px solid var(--line);border-radius:10px;padding:10px}
.photo-scroll {overflow:auto;max-height:72vh}
.photo-scroll img {display:block;width:100%;height:auto}
.review-photo.enlarged img {width:200%;max-width:none}
.review-edit {min-width:0}
.review-edit pre {white-space:pre-wrap;overflow-wrap:anywhere}
.review-edit .table-wrap {max-height:72vh}
.review-edit th {position:sticky;top:0;z-index:1}
.review-edit td {padding:6px;white-space:normal}
.review-edit td input {min-width:4em}
.review-edit td input[type=checkbox]{min-width:0}
.review-edit td select {min-width:8em;max-width:12em}
@media(max-width:850px){.review-layout{grid-template-columns:minmax(0,1fr)}.review-photo{position:static}.photo-scroll{max-height:38vh}}

.contract-preview {width:min(1100px,96vw); max-width:96vw; padding:12px; border:0; border-radius:10px}
.contract-preview header {display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px}
.contract-preview iframe {width:100%; height:75vh; border:0}
.contract-preview::backdrop {background:#14282080}
