﻿:root {
  --bg: #f3f5f1;
  --ink: #18201c;
  --muted: #647067;
  --line: #d7ddd3;
  --paper: #fffdf7;
  --paper-2: #eef3ea;
  --green: #0f7c46;
  --green-2: #dff1e5;
  --amber: #b47705;
  --amber-2: #fff0c9;
  --red: #b6382f;
  --blue: #2867b2;
  --shadow: 0 18px 45px rgba(31, 44, 35, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #17231c;
  color: #f7fbf2;
  padding: 24px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: #d9f2c7;
  color: #17231c;
  font-weight: 800;
  border-radius: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p, .summary-panel p, .panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
}

.sidebar .brand p {
  color: #b7c3b9;
}

.file-drop {
  display: block;
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  margin-bottom: 20px;
  cursor: pointer;
}

.file-drop span, .file-drop strong {
  display: block;
}

.file-drop strong {
  margin-top: 6px;
  color: #d9f2c7;
  font-size: 13px;
}

.file-drop input {
  display: none;
}

.nav-group {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.nav-item, .secondary, .primary, .danger {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
}

.nav-item {
  text-align: left;
  color: #e6eee8;
  background: transparent;
  min-height: 54px;
  display: grid;
  align-content: center;
  gap: 7px;
}

.nav-item.active, .nav-item:hover {
  background: #2b3b30;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  line-height: 1;
}

.filter-row strong {
  font-size: 17px;
  color: #f4f8ef;
}

.filter-meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(231, 236, 226, 0.13);
  overflow: hidden;
}

.filter-meter i {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: var(--filter-color, #cfe9bf);
  transition: width 0.2s ease;
}

.side-actions {
  display: grid;
  gap: 10px;
}

.primary {
  background: var(--green);
  color: white;
}

.secondary {
  background: #e7ece2;
  color: var(--ink);
}

.danger {
  background: rgba(182, 56, 47, 0.14);
  color: #ffd8d4;
}

.small {
  min-height: 34px;
}

.main {
  padding: 28px 28px 48px;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 520px);
  align-items: end;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-weight: 700;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 30px;
}

.search-wrap {
  width: 100%;
}

.search-wrap input, .date-mode input, .range-panel input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 0 12px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.range-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px auto;
  align-items: end;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.range-title {
  display: grid;
  gap: 4px;
}

.range-title strong {
  font-size: 15px;
}

.range-title span, .range-panel label, .date-mode label {
  color: var(--muted);
  font-size: 12px;
}

.range-panel label, .date-mode label {
  display: grid;
  gap: 5px;
}

.summary-panel, .table-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head.compact {
  align-items: center;
  padding: 14px 18px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pager button, .pager select, .pager label {
  flex: 0 0 auto;
}

.pager p {
  margin: 0 8px 0 0;
  color: var(--muted);
}

.pager label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.pager select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  padding: 0 8px;
}

.panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.date-mode {
  display: flex;
  align-items: end;
  gap: 8px;
}

.company-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--green-2);
  color: var(--green);
  font-weight: 700;
  white-space: nowrap;
}

.company-manual {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.company-manual select {
  width: 260px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--green-2);
  color: var(--green);
  font-weight: 700;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.date-mode label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.table-wrap, .summary-table-wrap {
  overflow: auto;
}

.table-wrap {
  scrollbar-gutter: stable;
}

.table-scroll-proxy {
  position: fixed;
  left: 300px;
  right: 28px;
  bottom: 0;
  z-index: 20;
  height: 18px;
  overflow-x: auto;
  overflow-y: hidden;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.72), var(--paper));
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 -8px 24px rgba(31, 44, 35, 0.12);
}

.table-scroll-proxy-inner {
  height: 1px;
}

.summary-visual {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.35fr);
  gap: 18px;
  padding: 18px;
  align-items: stretch;
}

.progress-stack {
  display: grid;
  gap: 14px;
  align-content: center;
  padding: 8px 0;
}

.progress-row {
  display: grid;
  gap: 7px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  height: 12px;
  background: #e5e9e1;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
}

.progress-fill.budget { background: var(--green); }
.progress-fill.construction { background: #d89b10; }
.progress-fill.acceptance { background: var(--red); }
.progress-fill.settlement { background: var(--blue); }

.bar-chart {
  height: 178px;
  display: grid;
  grid-template-columns: repeat(5, minmax(68px, 1fr));
  align-items: stretch;
  gap: 18px;
  padding: 10px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(#f1f5ee 1px, transparent 1px) 0 0 / 100% 25%;
  overflow: hidden;
}

.bar-item {
  display: grid;
  grid-template-rows: 22px 104px 28px;
  justify-items: center;
  align-items: end;
  gap: 4px;
  min-width: 0;
}

.bar {
  width: min(54px, 70%);
  min-height: 4px;
  border-radius: 7px 7px 0 0;
  background: var(--blue);
}

.bar.budget { background: var(--green); }
.bar.construction { background: #d89b10; }
.bar.acceptance { background: var(--red); }
.bar.settlement { background: var(--blue); }

.bar-value {
  font-weight: 800;
}

.bar-label {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  align-self: start;
}

.table-panel {
  margin-top: 16px;
  padding-bottom: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: #edf3ea;
  z-index: 1;
  font-weight: 700;
}

#ordersTable {
  table-layout: fixed;
  min-width: 1160px;
}

#ordersTable th {
  position: sticky;
  overflow: visible;
}

.resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  z-index: 3;
}

.resize-handle::after {
  content: "";
  position: absolute;
  top: 7px;
  bottom: 7px;
  left: 3px;
  width: 1px;
  background: transparent;
}

#ordersTable th:hover .resize-handle::after {
  background: var(--green);
}

td.title-cell {
  white-space: normal;
  line-height: 1.35;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 700;
}

.done {
  background: var(--green-2);
  color: var(--green);
}

.todo {
  background: var(--amber-2);
  color: var(--amber);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-start;
}

.complete-btn, .void-btn, .return-btn, .restore-btn, .delete-btn {
  height: 28px;
  padding: 0 9px;
  border-radius: 7px;
  background: #e8efe5;
  color: var(--ink);
}

#ordersTable th[data-col="actions"],
#ordersTable td.actions-cell {
  position: sticky;
  right: 0;
  z-index: 4;
  background: var(--paper);
  box-shadow: -10px 0 18px rgba(31, 44, 35, 0.08);
}

#ordersTable th[data-col="actions"] {
  z-index: 5;
  background: #edf3ea;
}

.complete-btn.is-done {
  background: var(--green);
  color: white;
}

.void-btn {
  background: rgba(182, 56, 47, 0.12);
  color: var(--red);
}

.return-btn {
  background: rgba(180, 119, 5, 0.15);
  color: var(--amber);
}


.delete-btn {
  background: #2d2119;
  color: #fff;
}

.ignored-badge {
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
}

.ignored-badge.is-returned {
  background: rgba(180, 119, 5, 0.15);
  color: var(--amber);
}

.ignored-badge.is-voided {
  background: rgba(182, 56, 47, 0.12);
  color: var(--red);
}

.manual-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.manual-dialog::backdrop {
  background: rgba(16, 24, 20, 0.35);
}

.manual-dialog form {
  padding: 22px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dialog-head h3 {
  margin: 0;
  font-size: 20px;
}

.icon-close {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: #eef3ea;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
}

.manual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.manual-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.manual-grid .full {
  grid-column: 1 / -1;
}

.manual-grid input,
.manual-grid textarea {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: var(--ink);
}

.manual-grid textarea {
  min-height: 180px;
  padding: 10px;
  resize: vertical;
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.date-input {
  width: 128px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: white;
}

.empty-state {
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 360px;
  padding: 42px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  border-radius: 8px;
  background: var(--green-2);
  color: var(--green);
  font-weight: 900;
  margin-bottom: 16px;
}

.empty-state p {
  max-width: 560px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .range-panel { grid-template-columns: 1fr 1fr; }
  .range-title { grid-column: 1 / -1; }
  .topbar { align-items: stretch; flex-direction: column; }
  .search-wrap { width: 100%; }
  .summary-visual { grid-template-columns: 1fr; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .table-scroll-proxy {
    left: 12px;
    right: 12px;
  }
}



