:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #27334b;
  background: #f5f7fc;
  font-synthesis: none;
  --brand: #0c1d71;
  --accent: #6978b7;
  --border: #dce2ef;
  --muted: #69758a;
  --danger: #b33a42;
  --surface: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid var(--border); background: #fff; color: var(--brand); border-radius: 8px; padding: 9px 13px; cursor: pointer; }
button:hover { border-color: var(--accent); background: #f1f3fb; }
button.primary { background: var(--brand); border-color: var(--brand); color: white; }
button.primary:hover { background: #172b86; }
button.danger { color: var(--danger); }
button:disabled { opacity: .55; cursor: wait; }
.button-link { display: inline-block; border: 1px solid var(--border); background: #fff; color: var(--brand); border-radius: 8px; padding: 9px 13px; text-decoration: none; white-space: nowrap; }
.button-link:hover { border-color: var(--accent); background: #f1f3fb; }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px; color: inherit; background: #fff; }
textarea { resize: vertical; min-height: 70px; }
label { display: grid; gap: 6px; color: #43506a; font-size: 13px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 20px; margin: 0; color: var(--brand); }
h2 { font-size: 20px; margin-bottom: 7px; }
h3 { font-size: 16px; margin-bottom: 10px; }
small, .muted { color: var(--muted); }
.loading, .login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(420px, 100%); background: white; border: 1px solid var(--border); border-radius: 16px; padding: 30px; box-shadow: 0 12px 40px #15275b12; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--brand); color: white; font-weight: 700; letter-spacing: 2px; }
.login-card .brand { margin-bottom: 24px; }
.stack { display: grid; gap: 14px; }
.shell { min-height: 100vh; }
.topbar { height: 68px; background: white; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 20px; position: sticky; top: 0; z-index: 2; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { background: white; border-right: 1px solid var(--border); padding: 20px 12px; }
.nav { display: grid; gap: 6px; }
.nav button { text-align: left; border-color: transparent; color: #536078; }
.nav button.active { background: #e8ecf8; color: var(--brand); font-weight: 600; }
main { padding: 28px; min-width: 0; max-width: 1500px; width: 100%; margin: 0 auto; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.toolbar-actions, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card.toolbar .toolbar-actions { margin-left: auto; }
.estimate-total { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.estimate-actions { flex: 0 0 100%; width: 100%; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; margin-bottom: 14px; }
.notice, .error, .success { padding: 11px 13px; border-radius: 8px; margin: 12px 0; }
.notice { background: #eef1fa; color: var(--brand); }
.error { background: #fff0f0; color: #8e252c; }
.success { background: #edf7f0; color: #23633a; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; background: white; }
table { border-collapse: collapse; width: 100%; min-width: 850px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid #e8ecf3; vertical-align: top; }
th { color: #52607a; background: #f8f9fc; font-size: 12px; white-space: nowrap; }
td input, td select { min-width: 100px; }
.row-fields { display: grid; gap: 6px; min-width: 210px; }
.reference { background: #f8f9fd; border-radius: 7px; padding: 9px; min-width: 230px; font-size: 12px; line-height: 1.6; }
.result-card { display: grid; gap: 8px; }
.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.price { color: var(--brand); font-size: 21px; font-weight: 700; }
.tag { display: inline-flex; border-radius: 999px; background: #edf0fa; color: var(--brand); padding: 3px 9px; font-size: 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 14px 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.status { min-height: 22px; }
@media (max-width: 850px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 8px; overflow-x: auto; }
  .nav { display: flex; min-width: max-content; }
  main { padding: 18px 12px; }
  .topbar { padding: 0 12px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
