:root {
  --navy: #102a43;
  --navy-2: #243b53;
  --teal: #0f766e;
  --teal-dark: #0b625c;
  --teal-soft: #dff3ef;
  --canvas: #f4f7f8;
  --surface: #ffffff;
  --muted: #627d98;
  --line: #d9e2ec;
  --warning: #d99b32;
  --warning-soft: #fff4d6;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --success: #167b45;
  --success-soft: #dcfce7;
  --info-soft: #dbeafe;
  --shadow: 0 16px 46px rgba(16, 42, 67, .08);
  --sidebar: 278px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--navy);
  background: var(--canvas);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, select, input[type="file"] { cursor: pointer; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(15, 118, 110, .18);
  outline-offset: 2px;
}

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: var(--sidebar);
  padding: 24px 18px 20px;
  color: white;
  background:
    radial-gradient(circle at 15% 92%, rgba(15, 118, 110, .24), transparent 13rem),
    var(--navy);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  color: white;
  background: transparent;
  border: 0;
  border-radius: 12px;
}
.brand:hover { background: rgba(255, 255, 255, .06); }
.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  color: white;
  background: linear-gradient(145deg, #12a397, var(--teal));
  border-radius: 9px;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(5, 28, 45, .2);
}
.brand-logo {
  display: block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  object-fit: cover;
  border: 1px solid rgba(224, 183, 103, .45);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 15px rgba(5, 28, 45, .24);
}
.brand-copy { min-width: 0; }
.brand-copy strong, .brand-copy small { display: block; white-space: nowrap; }
.brand-copy strong { font-size: 15px; }
.brand-copy small { margin-top: 3px; color: #a7bac9; font-size: 9px; }

.side-nav { display: grid; gap: 7px; margin-top: 19px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  color: rgba(255, 255, 255, .75);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  transition: .18s ease;
}
.nav-item span { width: 16px; font: 600 10px Consolas, monospace; }
.nav-item b { font-size: 13px; font-weight: 500; }
.nav-item:hover { color: white; background: rgba(255, 255, 255, .07); }
.nav-item.active { color: white; background: var(--teal); box-shadow: 0 9px 24px rgba(4, 36, 45, .2); }

.sidebar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: auto;
  padding: 11px 10px;
  color: white;
  text-align: left;
  background: transparent;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-top: 1px solid rgba(255, 255, 255, .09);
  cursor: pointer;
}
.sidebar-info:hover { background: rgba(255,255,255,.06); }
.user-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #325269; font-size: 12px; font-weight: 700; }
.sidebar-info strong, .sidebar-info small { display: block; }
.sidebar-info strong { font-size: 11px; }
.sidebar-info small { margin-top: 4px; color: #a7bac9; font-size: 9px; }
.sidebar-info i { display: inline-block; width: 6px; height: 6px; margin-right: 4px; background: #55d69a; border-radius: 50%; }

.app-main { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 32px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid #edf1f4;
  backdrop-filter: blur(14px);
}
.topbar > div { display: flex; align-items: center; }
.topbar strong { font-size: 14px; }
.topbar-meta { gap: 9px; color: var(--muted); font-size: 11px; }
.topbar-meta b { color: var(--muted); font-weight: 500; }
.online-dot { width: 7px; height: 7px; background: #33a867; border-radius: 50%; box-shadow: 0 0 0 4px rgba(51,168,103,.1); }
.divider { width: 1px; height: 14px; background: var(--line); }
.screen { min-height: calc(100vh - 72px); padding: 28px 32px 54px; }
.screen-inner { width: min(1280px, 100%); margin: 0 auto; animation: screen-in .22s ease both; }
@keyframes screen-in { from { opacity: .4; transform: translateY(4px); } }

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}
.page-heading h1 { margin: 0; font-size: clamp(23px, 2.3vw, 29px); line-height: 1.35; letter-spacing: -.02em; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--teal); font-size: 9px; letter-spacing: .16em; font-weight: 800; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 17px;
  color: white;
  background: var(--teal);
  border: 1px solid var(--teal);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: .16s ease;
}
.button:hover { background: var(--teal-dark); border-color: var(--teal-dark); transform: translateY(-1px); }
.button.secondary { color: var(--teal); background: white; border-color: var(--teal); }
.button.secondary:hover { background: #f0f9f7; }
.button.ghost { color: var(--navy-2); background: white; border-color: var(--line); }
.button.ghost:hover { color: var(--teal); border-color: #88c7c0; }
.button.danger { color: var(--danger); background: white; border-color: #e9a8a3; }
.button.small { min-height: 33px; padding: 6px 11px; border-radius: 8px; font-size: 10px; }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.icon-button { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: white; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(16, 42, 67, .035);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #edf1f4;
}
.card-head h2 { margin: 0; font-size: 15px; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.card-body { padding: 20px; }

.hero-banner {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.4fr .8fr;
  gap: 30px;
  padding: 27px 30px;
  color: white;
  background: linear-gradient(118deg, #102a43, #17465b 68%, #0f766e 150%);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.hero-banner::after { content: ""; position: absolute; right: -60px; bottom: -150px; width: 340px; height: 340px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 50px rgba(255,255,255,.025), 0 0 0 100px rgba(255,255,255,.018); }
.hero-banner > * { position: relative; z-index: 1; }
.hero-banner h1 { margin: 4px 0 8px; font-size: clamp(22px, 2.5vw, 32px); }
.hero-banner p { margin: 0; max-width: 650px; color: #c8d8e3; font-size: 12px; line-height: 1.7; }
.hero-banner .button { align-self: center; justify-self: end; color: var(--navy); background: white; border-color: white; }
.hero-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.hero-actions .button.secondary { color: white; background: transparent; border-color: rgba(255,255,255,.72); }

.stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; margin: 17px 0; }
.stat-card { display: flex; align-items: center; justify-content: space-between; min-height: 76px; padding: 16px 18px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.stat-card small { display: block; color: var(--muted); font-size: 10px; }
.stat-card strong { display: block; margin-top: 5px; font-size: 22px; }
.stat-icon { display: grid; place-items: center; width: 36px; height: 36px; color: var(--teal); background: var(--teal-soft); border-radius: 10px; font-size: 13px; font-weight: 800; }

.two-column { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 16px; }
.project-list { display: grid; }
.project-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) .55fr .6fr .8fr auto;
  align-items: center;
  gap: 15px;
  min-height: 73px;
  padding: 12px 20px;
  border-bottom: 1px solid #edf1f4;
}
.project-row:last-child { border-bottom: 0; }
.project-row h3 { margin: 0; font-size: 12px; }
.project-name-editable { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; margin: 0; padding: 0; overflow: hidden; color: var(--navy); font: inherit; font-size: 12px; font-weight: 800; line-height: 1.35; text-align: left; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; background: transparent; border: 0; border-bottom: 1px dashed transparent; }
.project-name-editable:hover, .project-name-editable:focus-visible { color: var(--teal); border-bottom-color: currentColor; outline: 0; }
.project-name-editable span { flex: 0 0 auto; color: var(--teal); font-size: 11px; opacity: .72; }
.inline-project-name-form { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.inline-project-name-form .input { width: min(260px, 100%); min-width: 120px; padding: 7px 9px; font-size: 12px; }
.inline-project-name-form .button { flex: 0 0 auto; }
.project-row p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.project-row > span { color: var(--muted); font-size: 10px; }
.project-row .button { justify-self: end; }
.project-row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.project-row-actions .button { white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 4px 9px;
  color: var(--teal);
  background: var(--teal-soft);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
}
.badge.warning { color: #8b5c08; background: var(--warning-soft); }
.badge.danger { color: var(--danger); background: var(--danger-soft); }
.badge.success { color: var(--success); background: var(--success-soft); }
.badge.info { color: #205a9b; background: var(--info-soft); }
.badge.dark { color: white; background: var(--navy); }

.queue-list { display: grid; gap: 10px; padding: 15px; }
.queue-item { display: grid; grid-template-columns: 35px 1fr; gap: 10px; padding: 12px; background: var(--canvas); border-radius: 11px; }
.queue-no { display: grid; place-items: center; width: 35px; height: 35px; color: var(--teal); background: white; border-radius: 9px; font-size: 11px; font-weight: 800; }
.queue-item strong { display: block; font-size: 11px; }
.queue-item small { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; line-height: 1.5; }

.stepper { display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 22px; }
.step {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: #95a6b4;
  font-size: 9px;
}
.step:not(:last-child)::after { content: ""; position: absolute; z-index: 0; top: 14px; left: 58%; width: 84%; height: 2px; background: var(--line); }
.step i { position: relative; z-index: 1; display: grid; place-items: center; width: 30px; height: 30px; color: #8394a1; background: #e8eef2; border: 4px solid var(--canvas); border-radius: 50%; font: normal 700 10px Consolas; }
.step.active { color: var(--teal); font-weight: 700; }
.step.active i { color: white; background: var(--teal); }
.step.done i { color: white; background: var(--success); }
.step.done:not(:last-child)::after { background: #8fcec3; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-field { display: grid; gap: 7px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label, .field-label { color: #40596d; font-size: 10px; font-weight: 700; }
.business-scope-note { margin-top: -2px; }
.business-scope-summary { display: grid; gap: 4px; padding: 11px 12px; color: #617483; background: #f3f6f8; border: 1px dashed #ccd8df; border-radius: 9px; font-size: 9px; line-height: 1.5; }
.business-scope-summary strong { color: #40596d; font-size: 10px; }
.business-scope-summary.ready { color: #176d66; background: #edf9f6; border-color: #9fd8cf; }
.business-scope-summary.ready strong { color: #0c7168; }
.business-context-card { margin-bottom: 16px; }
.required::after { content: " *"; color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  color: var(--navy);
  background: #fbfcfd;
  border: 1px solid #ccd8e1;
  border-radius: 9px;
  outline: 0;
  font-size: 12px;
}
.textarea { min-height: 82px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { background: white; border-color: var(--teal); box-shadow: 0 0 0 4px rgba(15,118,110,.07); }
.field-hint { color: var(--muted); font-size: 9px; line-height: 1.6; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 18px; margin-top: 18px; border-top: 1px solid #edf1f4; }

.specialty-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
.specialty-option { position: relative; }
.specialty-option input { position: absolute; opacity: 0; pointer-events: none; }
.specialty-option span {
  display: grid;
  place-items: center;
  min-height: 62px;
  padding: 9px;
  color: #526b7e;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: 11px;
  font-weight: 700;
}
.specialty-option input:checked + span { color: var(--teal); background: var(--teal-soft); border-color: var(--teal); box-shadow: 0 0 0 2px rgba(15,118,110,.07); }

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 215px;
  padding: 28px;
  text-align: center;
  background: #f9fbfc;
  border: 1.5px dashed #9fb5c4;
  border-radius: 14px;
  transition: .18s ease;
}
.upload-zone.drag { background: var(--teal-soft); border-color: var(--teal); }
.upload-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 12px; color: white; background: linear-gradient(145deg, var(--navy), var(--teal)); border-radius: 15px; font-size: 22px; }
.upload-zone h3 { margin: 0; font-size: 14px; }
.upload-zone p { margin: 7px 0 15px; color: var(--muted); font-size: 10px; }
.file-list { display: grid; gap: 8px; margin-top: 13px; }
.file-item { display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.file-type { display: grid; place-items: center; width: 36px; height: 36px; color: var(--teal); background: var(--teal-soft); border-radius: 9px; font-size: 9px; font-weight: 800; }
.file-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.file-item small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.file-item button { border: 0; color: var(--danger); background: transparent; font-size: 15px; }

.notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 10px; line-height: 1.65; }
.notice::before { content: "!"; display: grid; flex: 0 0 auto; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-weight: 800; }
.notice.info { color: #31506a; background: var(--info-soft); }
.notice.info::before { color: white; background: #2b6cb0; }
.notice.warning { color: #765008; background: var(--warning-soft); }
.notice.warning::before { color: white; background: var(--warning); }
.notice.danger { color: var(--danger); background: var(--danger-soft); }
.notice.danger::before { color: white; background: var(--danger); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; }
.data-table { width: 100%; min-width: 940px; border-collapse: collapse; background: white; font-size: 10px; }
.data-table th { position: sticky; z-index: 2; top: 0; padding: 11px 10px; color: #506a7c; text-align: left; white-space: nowrap; background: #edf2f5; border-bottom: 1px solid var(--line); }
.data-table td { padding: 9px 10px; vertical-align: middle; border-bottom: 1px solid #edf1f4; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdfd; }
.data-table input { min-width: 90px; height: 34px; padding: 6px 8px; border: 1px solid transparent; border-radius: 7px; background: transparent; font-size: 10px; }
.data-table input[type="checkbox"] { min-width: 16px; width: 16px; height: 16px; padding: 0; accent-color: var(--teal); }
.data-table input:hover, .data-table input:focus { background: white; border-color: #aabdc9; outline: 0; }
.data-table input.invalid { color: var(--danger); background: var(--danger-soft); border-color: #e8a29d; }
.source-link { color: var(--teal); border: 0; background: transparent; font-size: 9px; text-decoration: underline; text-underline-offset: 3px; }
.confidence { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.confidence i { width: 7px; height: 7px; background: var(--success); border-radius: 50%; }
.confidence.low { color: #8b5c08; }
.confidence.low i { background: var(--warning); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-input { position: relative; min-width: 240px; }
.search-input::before { content: "⌕"; position: absolute; left: 11px; top: 9px; color: var(--muted); }
.search-input input { padding-left: 31px; }

.match-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 14px; }
.match-stat { display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 10px 14px; border-radius: 11px; }
.match-stat small { color: var(--muted); font-size: 9px; }
.match-stat strong { font-size: 16px; }
.match-stat.warning { background: var(--warning-soft); }
.match-stat.warning strong { color: var(--warning); }
.match-stat.info { background: var(--info-soft); }
.match-stat.info strong { color: var(--teal); }
.match-stat.danger { background: var(--danger-soft); }
.match-stat.danger strong { color: var(--danger); }
.match-stat.success { background: var(--success-soft); }
.match-stat.success strong { color: var(--success); }

.match-list-card { overflow: hidden; }
.match-list-toolbar { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: white; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.match-search { flex: 1 1 320px; }
.match-filter-list { display: flex; align-items: center; gap: 5px; flex: 2 1 auto; overflow-x: auto; padding: 2px; }
.match-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 10px; color: var(--muted); white-space: nowrap; background: var(--canvas); border: 1px solid var(--line); border-radius: 999px; font-size: 9px; }
.match-filter b { min-width: 18px; padding: 2px 5px; color: #4b6576; text-align: center; background: white; border-radius: 999px; font-size: 8px; }
.match-filter:hover { color: var(--teal); border-color: #92c9c2; }
.match-filter.active { color: white; background: var(--teal); border-color: var(--teal); }
.match-filter.active b { color: var(--teal); }
.match-table-wrap { max-height: 650px; overflow: auto; background: white; }
.match-list-table { width: 100%; min-width: 1480px; border-collapse: separate; border-spacing: 0; font-size: 9px; }
.match-list-table th { position: sticky; z-index: 4; top: 0; padding: 10px; color: #506a7c; text-align: left; white-space: nowrap; background: #edf2f5; border-bottom: 1px solid var(--line); }
.match-list-table td { padding: 10px; vertical-align: middle; background: white; border-bottom: 1px solid #edf1f4; }
.match-list-table tbody tr:hover td { background: #fbfdfd; }
.match-list-table tr.confirmed td { background: #f6fbf8; }
.match-list-table tr.mismatch td { background: #fffaf3; }
.match-list-table tr.missing td { background: #fff8f7; }
.match-list-table th:nth-child(1), .match-list-table td:nth-child(1) { position: sticky; z-index: 3; left: 0; width: 42px; min-width: 42px; text-align: center; }
.match-list-table th:nth-child(2), .match-list-table td:nth-child(2) { position: sticky; z-index: 3; left: 42px; width: 46px; min-width: 46px; text-align: center; }
.match-list-table th:nth-child(3), .match-list-table td:nth-child(3) { position: sticky; z-index: 3; left: 88px; width: 172px; min-width: 172px; box-shadow: 8px 0 12px rgba(14,42,58,.04); }
.match-list-table th:nth-child(-n+3) { z-index: 6; }
.match-list-table th:last-child, .match-list-table td:last-child { position: sticky; z-index: 3; right: 0; width: 142px; min-width: 142px; box-shadow: -8px 0 12px rgba(14,42,58,.06); }
.match-list-table th:last-child { z-index: 7; background: #edf2f5; }
.match-list-table tbody tr.confirmed td:last-child { background: #f6fbf8; }
.match-list-table tbody tr.mismatch td:last-child { background: #fffaf3; }
.match-list-table tbody tr.missing td:last-child { background: #fff8f7; }
.match-list-table tbody tr:hover td:last-child { background: #fbfdfd; }
.match-list-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--teal); }
.match-original, .match-quantity, .match-standard, .unit-compare { display: grid; gap: 5px; }
.match-original { max-width: 155px; overflow-wrap: anywhere; }
.match-original strong, .match-standard strong { color: var(--ink); font-size: 10px; }
.match-original span, .match-standard span, .match-quantity span { color: #526a79; line-height: 1.45; }
.match-original small, .match-standard small { color: var(--muted); line-height: 1.45; }
.match-quantity label { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.match-quantity input { width: 88px; height: 30px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 9px; }
.match-quantity input.invalid { color: var(--danger); background: var(--danger-soft); border-color: #e8a29d; }
.match-candidate { display: block; width: 276px; max-width: 276px; height: 34px; padding: 5px 28px 5px 8px; color: var(--ink); background: white; border: 1px solid #a9bdc9; border-radius: 7px; font-size: 9px; }
.match-candidate:focus { border-color: var(--teal); outline: 2px solid rgba(18,139,130,.12); }
.match-code { display: block; margin-top: 6px; color: var(--teal); font: 700 8px Consolas, monospace; }
.match-code.missing { color: var(--danger); font-family: inherit; }
.match-code.warning { color: #9a6505; }
.code-risk { display: block; margin-top: 4px; color: var(--danger); font-size: 8px; line-height: 1.4; }
.library-select-field { display: grid; width: 228px; padding: 8px 10px; color: var(--teal); text-align: left; background: #f5fbfa; border: 1px solid #87c8c0; border-radius: 8px; cursor: pointer; }
.library-select-field:hover { background: #eaf7f5; border-color: var(--teal); }
.library-select-field span { font-size: 9px; font-weight: 800; }
.library-select-field small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.new-code-select { display: block; width: 228px; height: 32px; margin-top: 7px; padding: 5px 28px 5px 8px; color: #5e4a16; background: #fffaf0; border: 1px solid #d8bd79; border-radius: 7px; font-size: 8px; }
.new-code-select:disabled { color: #8a9aa4; background: #f3f6f7; border-color: var(--line); }
.unit-compare { min-width: 118px; padding: 8px; background: var(--success-soft); border-radius: 8px; }
.unit-compare.error { color: var(--danger); background: var(--danger-soft); }
.unit-compare span { white-space: nowrap; }
.unit-compare strong { font-size: 8px; }
.same-tip { display: block; margin-top: 6px; color: var(--muted); white-space: nowrap; }
.row-actions { display: grid; gap: 6px; min-width: 126px; }

.cost-intro { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 14px; }
.cost-library-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cost-library-card { min-height: 176px; padding: 17px; background: white; border: 1px solid var(--line); border-radius: 14px; }
.cost-library-card .cost-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 11px; color: var(--teal); background: var(--teal-soft); border-radius: 10px; font-weight: 800; }
.cost-library-card h3 { margin: 0 0 6px; font-size: 13px; }
.cost-library-card p { min-height: 39px; margin: 0 0 10px; color: var(--muted); font-size: 9px; line-height: 1.55; }
.cost-file-status { display: block; min-height: 34px; margin-bottom: 11px; color: var(--muted); font-size: 8px; line-height: 1.5; }
.cost-file-status.ready { color: #138277; }
.cost-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; gap: 10px; padding: 16px; background: #f8fbfc; border: 1px solid var(--line); border-radius: 14px; }
.cost-flow-step { padding: 10px; background: white; border: 1px solid var(--line); border-radius: 10px; }
.cost-flow-step strong { display: block; margin-bottom: 4px; font-size: 10px; }
.cost-flow-step small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.cost-flow-arrow { color: var(--teal); font-size: 18px; }
.cost-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.cost-table { width: 100%; min-width: 1220px; border-collapse: collapse; font-size: 9px; }
.cost-table th { padding: 10px; color: #506a7c; text-align: left; white-space: nowrap; background: #edf2f5; border-bottom: 1px solid var(--line); }
.cost-table td { padding: 9px 10px; vertical-align: middle; border-bottom: 1px solid #edf1f4; }
.cost-table tr:last-child td { border-bottom: 0; }
.cost-table input { width: 82px; height: 30px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 9px; }
.cost-table input.wide { width: 165px; }
.cost-table .cost-total { color: var(--teal); font: 700 9px Consolas, monospace; white-space: nowrap; }
.cost-template-table { min-width: 1480px; }
.cost-selection-placeholder { margin-top: 16px; }
.cost-selection-card { margin-top: 16px; }
.cost-boq-resource-list { display: grid; gap: 10px; padding: 14px; }
.cost-boq-resource-card { padding: 13px; background: #fbfdfe; border: 1px solid var(--line); border-radius: 11px; }
.cost-boq-resource-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.cost-boq-resource-head code { color: var(--teal); font-size: 9px; }
.cost-boq-resource-head h3 { margin: 4px 0; font-size: 12px; }
.cost-boq-resource-head p { margin: 0; color: var(--muted); font-size: 9px; }
.cost-resource-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 7px; }
.cost-boq-resource-selected { display: flex; flex-wrap: wrap; gap: 7px; min-height: 23px; margin-top: 11px; color: var(--muted); font-size: 9px; }
.cost-suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 11px; }
.cost-suggestion { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px; background: #f3fbfa; border: 1px solid #cfe9e4; border-radius: 9px; }
.cost-suggestion > span { padding: 3px 5px; color: #08796f; background: #dff5f0; border-radius: 4px; font-size: 8px; font-weight: 800; white-space: nowrap; }
.cost-suggestion > div { display: grid; gap: 5px; min-width: 0; }
.cost-suggestion button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 6px 7px; color: var(--ink); text-align: left; background: white; border: 1px solid #d6ebe8; border-radius: 6px; cursor: pointer; }
.cost-suggestion button:hover { border-color: #54aaa1; box-shadow: 0 3px 9px rgba(14,117,107,.09); }
.cost-suggestion button strong { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.cost-suggestion button small { overflow: hidden; grid-column: 1; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.cost-suggestion button b { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--teal); font-size: 8px; white-space: nowrap; }
.cost-suggestion.pending, .cost-suggestion.empty { display: flex; align-items: center; min-height: 50px; }
.cost-suggestion.pending { background: #fff9ed; border-color: #f1dfb0; }
.cost-suggestion.pending > span { color: #8b5d11; background: #ffefd1; }
.cost-suggestion.empty { background: #fafcfd; border-color: var(--line); }
.cost-suggestion.empty > span { color: #657a89; background: #eaf0f3; }
.cost-suggestion > small { align-self: center; color: var(--muted); font-size: 8px; line-height: 1.45; }
.cost-resource-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 5px 7px; color: #506a7c; background: #eef7f7; border: 1px solid #cfe8e5; border-radius: 999px; }
.cost-resource-chip.labor { color: #8b5d11; background: #fff8e8; border-color: #f0ddb0; }
.cost-resource-chip code { overflow: hidden; max-width: 150px; color: inherit; text-overflow: ellipsis; white-space: nowrap; }
.cost-resource-chip button { padding: 0 2px; color: inherit; background: transparent; border: 0; cursor: pointer; font-size: 15px; line-height: 12px; }
.draft-tag { color: #b76508; font-weight: 700; }
.cost-action-col { position: sticky; z-index: 2; right: 0; min-width: 55px; background: white; box-shadow: -7px 0 10px rgba(16,42,67,.06); }
.cost-table th.cost-action-col { background: #edf2f5; }
.cost-table .cost-select { min-width: 64px; height: 30px; padding: 4px 6px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 6px; font-size: 9px; }
.cost-table .text-button { display: inline-block; margin-top: 5px; padding: 0; color: var(--teal); font-size: 9px; line-height: 1.2; background: transparent; border: 0; cursor: pointer; }
.cost-table .text-button:hover { text-decoration: underline; }
.cost-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cost-summary .match-stat { min-height: 78px; }
.match-list-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; background: #f8fbfc; border-top: 1px solid var(--line); }
.match-list-footer p { max-width: 780px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.match-empty { min-height: 250px; }
.muted { color: var(--muted); }

.matching-workspace { display: grid; grid-template-columns: 292px minmax(390px, 1fr) 320px; gap: 14px; align-items: stretch; }
.workspace-panel { min-height: 630px; padding: 15px; background: white; border: 1px solid var(--line); border-radius: 16px; }
.workspace-panel h2 { margin: 0 0 12px; font-size: 15px; }
.material-list { display: grid; gap: 8px; margin-top: 10px; }
.material-item {
  position: relative;
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  text-align: left;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.material-item:hover { border-color: #9bcfc8; }
.material-item.active { background: var(--teal-soft); border-color: var(--teal); }
.material-item.selected::after { content: "✓"; position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 17px; height: 17px; color: white; background: var(--teal); border-radius: 5px; font-size: 9px; }
.material-item strong { font-size: 11px; }
.material-item span { color: var(--muted); font-size: 9px; }
.material-item em { color: var(--teal); font-size: 8px; font-style: normal; }
.material-item em.warn { color: var(--danger); }

.candidate-list { display: grid; gap: 9px; }
.candidate-card {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 125px;
  padding: 13px 15px;
  text-align: left;
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.candidate-card:hover { border-color: #8dc8c0; }
.candidate-card.active { background: var(--teal-soft); border: 1.5px solid var(--teal); }
.candidate-card header { display: flex; justify-content: space-between; align-items: center; }
.candidate-card header > span { color: var(--muted); font-family: Consolas, monospace; font-size: 9px; }
.candidate-card strong { font-size: 13px; }
.candidate-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.candidate-score { display: inline-flex; gap: 7px; align-items: center; color: var(--teal); font-size: 9px; font-weight: 700; }
.candidate-score b { padding: 4px 8px; color: white; background: var(--teal); border-radius: 999px; font-size: 9px; }
.no-match {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 0;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

.confirm-block { padding: 11px 12px; background: var(--canvas); border-radius: 10px; }
.confirm-block.standard { background: var(--teal-soft); }
.confirm-block.error { color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger); }
.confirm-block h3 { margin: 0 0 6px; color: inherit; font-size: 10px; }
.confirm-block p { margin: 3px 0; font-size: 10px; line-height: 1.5; }
.confirm-block small { color: var(--muted); font-size: 8px; }
.check-row { display: flex; align-items: flex-start; gap: 8px; padding: 11px; background: var(--canvas); border-radius: 10px; font-size: 9px; line-height: 1.5; }
.check-row input { accent-color: var(--teal); }
.confirm-actions { display: grid; gap: 9px; margin-top: 12px; }

.suggestion-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 16px; }
.classification-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.classification-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin: 22px 0 12px; }
.classification-heading h3 { margin: 0 0 4px; font-size: 13px; }
.classification-heading p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.category-recommendations { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.category-recommendation { display: grid; gap: 5px; min-height: 92px; padding: 11px 12px; color: var(--ink); text-align: left; background: var(--canvas); border: 1px solid var(--line); border-radius: 10px; }
.category-recommendation:hover { border-color: #8dc8c0; }
.category-recommendation.active { background: var(--teal-soft); border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.category-recommendation span { color: var(--teal); font-size: 8px; font-weight: 800; }
.category-recommendation strong { font-size: 10px; line-height: 1.5; }
.category-recommendation small { color: var(--muted); font-size: 8px; }
.classification-select-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.category-select { min-width: 0; }
.classification-select-grid .form-field small { color: var(--muted); font-size: 8px; }
.code-preview {
  display: grid;
  place-items: center;
  min-height: 108px;
  margin: 14px 0;
  padding: 18px;
  color: white;
  text-align: center;
  background: linear-gradient(135deg, var(--navy), #174e62);
  border-radius: 13px;
}
.code-preview small { color: #aac5d3; font-size: 9px; }
.code-preview strong { margin-top: 8px; font: 800 22px Consolas, monospace; letter-spacing: .05em; }
.reason-list { display: grid; gap: 8px; }
.reason-item { display: grid; grid-template-columns: 23px 1fr; gap: 9px; align-items: start; padding: 10px; background: var(--canvas); border-radius: 9px; }
.reason-item span { display: grid; place-items: center; width: 23px; height: 23px; color: var(--teal); background: var(--teal-soft); border-radius: 7px; font-size: 9px; font-weight: 800; }
.reason-item strong { display: block; font-size: 10px; }
.reason-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.5; }

.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding-bottom: 22px; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; top: 32px; left: 16px; bottom: 0; width: 2px; background: var(--line); }
.timeline-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; color: var(--teal); background: var(--teal-soft); border: 4px solid white; border-radius: 50%; font-size: 10px; font-weight: 800; }
.timeline-item.done .timeline-icon { color: white; background: var(--success); }
.timeline-item.active .timeline-icon { color: white; background: var(--teal); box-shadow: 0 0 0 5px rgba(15,118,110,.09); }
.timeline-content { padding: 7px 0 0; }
.timeline-content strong { display: block; font-size: 11px; }
.timeline-content p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }

.export-files { display: grid; gap: 10px; }
.export-file { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; padding: 13px; background: var(--canvas); border: 1px solid var(--line); border-radius: 11px; }
.export-file .file-type { background: white; }
.export-file strong { display: block; font-size: 10px; }
.export-file small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }

.sync-panel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 24px; }
.sync-side { padding: 18px; background: var(--canvas); border-radius: 12px; }
.sync-side h3 { margin: 0; font-size: 13px; }
.sync-side p { margin: 6px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.sync-arrow { display: grid; place-items: center; width: 44px; height: 44px; color: white; background: var(--teal); border-radius: 50%; font-size: 18px; }
.progress { height: 7px; margin-top: 12px; overflow: hidden; background: #dde6eb; border-radius: 999px; }
.progress i { display: block; width: 0; height: 100%; background: var(--teal); border-radius: inherit; transition: width .65s ease; }
.progress.complete i { width: 100%; }
.user-choice-list { display: grid; gap: 9px; margin-top: 14px; }
.user-choice-list .candidate-card { width: 100%; text-align: left; }
.danger-text { color: var(--danger) !important; }

.query-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
.filter-card { align-self: start; padding: 18px; }
.filter-card .form-field + .form-field { margin-top: 13px; }
.query-results { display: grid; gap: 9px; }
.code-result {
  display: grid;
  grid-template-columns: 155px 1fr 1.5fr 55px auto;
  gap: 13px;
  align-items: center;
  padding: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 11px;
}
.code-result:hover { border-color: #91cbc4; box-shadow: 0 7px 18px rgba(16,42,67,.05); }
.code-result code { color: var(--navy); font-weight: 800; font-size: 10px; }
.code-result code, .candidate-card header > span:last-child, .code-preview strong, .match-code, .library-picker-code {
  user-select: none;
  -webkit-user-select: none;
}
.code-result strong { font-size: 11px; }
.code-result span, .code-result small { color: var(--muted); font-size: 9px; }
.code-result button { border: 0; color: var(--teal); background: transparent; font-size: 15px; }

.history-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.history-list { display: grid; gap: 10px; }
.history-card { display: grid; grid-template-columns: minmax(200px, 1.4fr) .6fr .6fr .8fr auto; align-items: center; gap: 15px; padding: 16px 18px; }
.history-card h3 { margin: 0; font-size: 12px; }
.history-card p { margin: 5px 0 0; color: var(--muted); font-size: 9px; }
.history-card > span { color: var(--muted); font-size: 10px; }
.history-actions { display: flex; gap: 6px; justify-content: flex-end; }

.admin-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 16px; }
.library-card { padding: 21px; }
.library-hero { display: flex; align-items: center; gap: 14px; padding: 17px; background: linear-gradient(120deg, #e8f5f2, #f7fbfb); border-radius: 12px; }
.library-icon { display: grid; flex: 0 0 auto; place-items: center; width: 48px; height: 48px; color: white; background: var(--teal); border-radius: 13px; font-size: 16px; font-weight: 800; }
.library-hero h2 { margin: 0; font-size: 14px; }
.library-hero p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.library-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 15px 0; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 10px; }
.library-meta div { padding: 12px; background: white; }
.library-meta small { display: block; color: var(--muted); font-size: 8px; }
.library-meta strong { display: block; margin-top: 5px; font-size: 11px; }
.security-list { display: grid; gap: 10px; padding: 15px; }
.security-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px; background: var(--canvas); border-radius: 9px; }
.security-row strong { display: block; font-size: 10px; }
.security-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.toggle { position: relative; width: 36px; height: 20px; background: #b9c6ce; border-radius: 999px; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: white; border-radius: 50%; transition: .2s; }
.toggle.on { background: var(--teal); }
.toggle.on::after { left: 19px; }

.empty-state { display: grid; place-items: center; min-height: 280px; padding: 30px; text-align: center; }
.empty-state span { display: grid; place-items: center; width: 56px; height: 56px; color: white; background: linear-gradient(145deg, var(--navy), var(--teal)); border-radius: 16px; font-size: 19px; font-weight: 800; }
.empty-state h2 { margin: 14px 0 5px; font-size: 16px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 10px; }

.modal-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 26, 43, .48);
  opacity: 0;
  pointer-events: none;
  transition: .2s;
}
.modal-backdrop.open, .drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  --modal-x: 0px;
  --modal-y: 0px;
  width: min(480px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 22px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(8,26,43,.22);
  transform: translate(var(--modal-x), calc(var(--modal-y) + 12px));
  transition: .2s;
  will-change: transform;
}
.modal.wide { width: min(1180px, 100%); }
.modal-backdrop.open .modal { transform: translate(var(--modal-x), var(--modal-y)); }
.modal.dragging { cursor: grabbing; user-select: none; transition: none; }
.modal h2 { margin: 0; font-size: 17px; }
.modal-drag-handle { display: flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; cursor: grab; touch-action: none; user-select: none; }
.modal-drag-handle::after { content: "↕ 按住拖动"; flex: 0 0 auto; padding: 3px 7px; color: var(--muted); background: var(--canvas); border: 1px solid var(--line); border-radius: 999px; font-size: 8px; font-weight: 600; }
.modal-drag-area { cursor: grab; touch-action: none; }
.modal.dragging .modal-drag-handle, .modal.dragging .modal-drag-area { cursor: grabbing; }
.modal p { margin: 7px 0 16px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 17px; }
.library-picker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.library-picker-head p { margin-bottom: 10px; }
.cost-picker-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 13px; margin-top: 12px; }
.cost-picker-category-panel { display: flex; flex-direction: column; gap: 10px; padding: 12px; background: #f7fbfc; border: 1px solid var(--line); border-radius: 10px; }
.cost-picker-category-title { display: grid; gap: 3px; }
.cost-picker-category-title strong { font-size: 10px; }
.cost-picker-category-title small { color: var(--muted); font-size: 8px; }
.cost-picker-category-fields { display: grid; gap: 8px; }
.cost-picker-category-panel .form-field { gap: 4px; }
.cost-picker-category-panel label { font-size: 8px; }
.cost-picker-category-panel .input { height: 31px; padding: 5px 7px; font-size: 8px; }
.cost-picker-main { min-width: 0; }
.library-picker-search { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto auto; gap: 8px; padding: 12px; background: var(--canvas); border-radius: 11px; }
.library-picker-search .search-input { min-width: 0; }
.library-picker-categories { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin: 11px 0; }
.library-picker-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px; color: var(--muted); font-size: 9px; }
.library-picker-summary b { color: var(--teal); font-size: 11px; }
.library-picker-results { display: grid; gap: 6px; max-height: 48vh; overflow: auto; padding: 2px; }
.library-picker-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 11px 13px; background: white; border: 1px solid var(--line); border-radius: 9px; }
.library-picker-row:hover { background: #fbfdfd; border-color: #91cbc4; }
.library-picker-row.code-warning { background: #fffaf3; border-color: #e6bf76; }
.library-picker-row > div { display: grid; grid-template-columns: 160px minmax(180px, .8fr) minmax(240px, 1fr); align-items: center; gap: 10px; }
.library-picker-code { color: var(--navy); font: 800 9px Consolas, monospace; }
.library-picker-row strong { font-size: 10px; }
.library-picker-row p, .library-picker-row small { margin: 0; color: var(--muted); font-size: 8px; }
.library-picker-row small { grid-column: 2 / -1; }
.library-picker-row em { grid-column: 2 / -1; color: var(--danger); font-size: 8px; font-style: normal; font-weight: 700; }
.library-picker-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; color: var(--muted); font-size: 9px; }
.picker-empty { min-height: 260px; }
.cost-sheet1-fold { padding: 0; overflow: hidden; }
.cost-sheet1-fold > summary { cursor: pointer; list-style: none; }
.cost-sheet1-fold > summary::-webkit-details-marker { display: none; }
.cost-sheet1-fold > summary .badge { white-space: nowrap; }
.cost-sheet1-summary { display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-bottom: 1px solid var(--line); background: #f8fbfc; }
.cost-sheet1-summary > div { display: grid; gap: 2px; min-width: 145px; padding: 7px 10px; background: white; border: 1px solid #dbe7ed; border-radius: 8px; }
.cost-sheet1-summary span { color: var(--muted); font-size: 8px; }
.cost-sheet1-summary strong { color: var(--ink); font-size: 13px; }
.cost-sheet1-summary form { display: flex; align-items: end; gap: 7px; margin-left: auto; }
.cost-sheet1-summary label { display: grid; gap: 4px; color: var(--muted); font-size: 8px; }
.cost-sheet1-summary .input { width: 88px; height: 31px; padding: 6px 8px; }
.cost-sheet1-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 15px; border-top: 1px solid var(--line); background: #fbfefe; }
.cost-sheet1-actions > div { display: grid; gap: 3px; }
.cost-sheet1-actions strong { color: var(--ink); font-size: 11px; }
.cost-sheet1-actions small { color: var(--muted); font-size: 8px; }
.list-pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 13px; color: var(--muted); background: #fff; border-top: 1px solid var(--line); font-size: 8px; }
.list-pagination > div { display: flex; gap: 7px; }
.copy-target-list { display: grid; gap: 7px; max-height: 220px; padding: 9px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #fbfdfd; }
.copy-target-list label { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: 10px; }
.cost-workbench-card { overflow: hidden; }
.cost-workbench { display: grid; grid-template-columns: minmax(330px, .82fr) minmax(590px, 1.45fr); min-height: 650px; border-top: 1px solid var(--line); }
.cost-boq-panel { display: flex; min-width: 0; flex-direction: column; background: #f8fbfc; border-right: 1px solid var(--line); }
.cost-resource-panel { display: flex; min-width: 0; flex-direction: column; background: white; }
.cost-workbench-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px 16px 11px; border-bottom: 1px solid var(--line); }
.cost-workbench-title > div { display: grid; gap: 3px; min-width: 0; }
.cost-workbench-title strong { font-size: 12px; }
.cost-workbench-title small { overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.cost-workbench-title > span:not(.badge) { flex: 0 0 auto; color: var(--teal); font-size: 9px; font-weight: 800; }
.cost-boq-toolbar { display: grid; gap: 8px; padding: 10px 13px; border-bottom: 1px solid var(--line); }
.cost-boq-toolbar .input { height: 33px; padding: 6px 9px; font-size: 9px; }
.cost-boq-toolbar > div { display: flex; justify-content: space-between; gap: 10px; }
.cost-boq-toolbar .text-button { padding: 0; color: var(--teal); background: transparent; border: 0; cursor: pointer; font-size: 9px; font-weight: 700; }
.cost-boq-tree { min-height: 0; max-height: 640px; overflow: auto; padding: 9px; }
.cost-boq-group { margin-bottom: 7px; background: white; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cost-boq-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; cursor: pointer; list-style: none; color: var(--navy); font-size: 10px; font-weight: 800; }
.cost-boq-group > summary::-webkit-details-marker { display: none; }
.cost-boq-group > summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-boq-group > summary code { margin-right: 6px; color: var(--teal); font-size: 8px; }
.cost-boq-group > summary b { flex: 0 0 auto; padding: 3px 5px; color: var(--muted); background: #eef3f5; border-radius: 999px; font-size: 8px; }
.cost-boq-group-lines { border-top: 1px solid #edf2f4; }
.cost-boq-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; padding: 9px 10px; cursor: pointer; border-bottom: 1px solid #edf2f4; }
.cost-boq-row:last-child { border-bottom: 0; }
.cost-boq-row:hover { background: #f7fcfb; }
.cost-boq-row.selected { background: #eaf8f5; box-shadow: inset 3px 0 0 var(--teal); }
.cost-boq-row input { width: 14px; height: 14px; margin-top: 2px; accent-color: var(--teal); }
.cost-boq-row-main { display: grid; gap: 3px; min-width: 0; }
.cost-boq-row-main code { overflow: hidden; color: var(--teal); font: 700 8px Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.cost-boq-row-main strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.cost-boq-row-main small { overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.cost-boq-row em { align-self: center; padding: 3px 5px; color: #638093; background: #eef3f5; border-radius: 4px; font-size: 7px; font-style: normal; white-space: nowrap; }
.plan-match-workbench { grid-template-columns: minmax(360px, .9fr) minmax(590px, 1.45fr); }
.plan-match-material-panel { background: #f8fbfc; }
.plan-match-tree { max-height: 650px; }
.plan-match-row { grid-template-columns: auto minmax(0, 1fr) auto; }
.plan-match-row .cost-boq-row-main { gap: 4px; }
.plan-match-row .plan-match-current { color: #08796f; font-weight: 700; }
.plan-match-row .plan-match-warning { color: #a06a06; }
.plan-match-row .plan-match-unit-warning { color: #c53030; font-weight: 800; }
.plan-match-row em.plan-match-confirmed { color: #067b5b; background: #dff7ed; }
.plan-match-row em.plan-match-missing { color: #a84842; background: #ffe9e6; }
.plan-match-filter-list { display: flex; flex-wrap: wrap; gap: 5px; }
.plan-match-filter-list .match-filter { padding: 4px 6px; font-size: 8px; }
.plan-match-filter-list .match-filter b { min-width: 15px; height: 15px; font-size: 7px; }
.plan-match-confirm-zone { position: sticky; top: 0; z-index: 2; padding-top: 1px; background: white; }
.plan-match-select-status { color: #597080 !important; background: #edf3f6 !important; }
.candidate-card.selected .plan-match-select-status { color: #08796f !important; background: #dff7ed !important; }
.cost-resource-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 11px 16px 0; }
.cost-resource-tabs button { min-height: 35px; color: #668093; background: #f5f8fa; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 10px; font-weight: 700; }
.cost-resource-tabs button.active { color: white; background: var(--teal); border-color: var(--teal); }
.cost-resource-selector { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 0; flex: 1; gap: 12px; padding: 12px 16px; }
.cost-resource-categories { display: flex; align-content: start; flex-direction: column; gap: 9px; padding: 11px; background: #f7fbfc; border: 1px solid var(--line); border-radius: 10px; }
.cost-resource-categories .form-field { gap: 4px; }
.cost-resource-categories .form-field label { font-size: 8px; }
.cost-resource-categories .input { height: 32px; padding: 5px 7px; font-size: 8px; }
.cost-resource-results { display: flex; min-width: 0; flex-direction: column; }
.cost-resource-results .library-picker-search { grid-template-columns: minmax(0, 1fr) auto; padding: 0; background: transparent; }
.cost-category-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px; margin-bottom: 8px; }
.cost-category-search .input { min-width: 0; height: 31px; padding: 6px 8px; font-size: 8px; }
.cost-category-search .button { padding-inline: 8px; }
.cost-category-matches { display: grid; gap: 4px; margin: 0 0 8px; padding: 7px; background: #f2fbf9; border: 1px solid #cfe9e4; border-radius: 7px; }
.cost-category-matches small { color: #08796f; font-size: 8px; font-weight: 800; }
.cost-category-matches button { overflow: hidden; padding: 4px 5px; color: #24556d; text-align: left; text-overflow: ellipsis; white-space: nowrap; background: white; border: 1px solid #d7e7e9; border-radius: 5px; cursor: pointer; font-size: 8px; }
.cost-category-matches button:hover { border-color: var(--teal); color: var(--teal); }
.cost-workbench-suggestions { display: grid; gap: 6px; margin: 7px 0; padding: 8px; background: #f2fbf9; border: 1px solid #cfe9e4; border-radius: 8px; }
.cost-workbench-suggestions > strong { color: #08796f; font-size: 8px; }
.cost-workbench-suggestions > div { display: flex; flex-wrap: wrap; gap: 6px; }
.cost-workbench-suggestions button { display: grid; gap: 2px; max-width: 210px; padding: 5px 7px; color: var(--ink); text-align: left; background: white; border: 1px solid #cfe9e4; border-radius: 6px; cursor: pointer; }
.cost-workbench-suggestions button:hover { border-color: var(--teal); }
.cost-workbench-suggestions button.selected { border-color: var(--teal); background: #dff7ed; box-shadow: inset 3px 0 0 var(--teal); }
.cost-workbench-suggestions b { overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.cost-workbench-suggestions small { overflow: hidden; color: var(--muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.plan-match-auto-matches { display: grid; gap: 8px; margin: 8px 0; padding: 10px; background: #effbf8; border: 1px solid #bfe7dd; border-radius: 9px; }
.plan-match-auto-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.plan-match-auto-heading > div { display: grid; gap: 2px; }
.plan-match-auto-heading strong { color: #08796f; font-size: 10px; }
.plan-match-auto-heading small { color: #587487; font-size: 8px; }
.plan-match-auto-heading > span { flex: 0 0 auto; padding: 3px 7px; color: #08796f; background: #d9f5ed; border-radius: 99px; font-size: 8px; font-weight: 800; }
.plan-match-auto-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 7px; overflow: visible; }
.plan-match-auto-card { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 9px; background: white; border: 1px solid #cfe9e4; border-radius: 7px; }
.plan-match-auto-card.selected { border-color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
.plan-match-auto-rank { color: #08796f; font-size: 8px; font-weight: 800; }
.plan-match-auto-card > strong { overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.plan-match-auto-card p, .plan-match-auto-card > small { overflow: hidden; margin: 0; color: var(--muted); font-size: 8px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.plan-match-auto-actions { display: flex; gap: 6px; margin-top: 3px; }
.plan-match-auto-actions .button { flex: 1; min-height: 27px; padding-inline: 7px; font-size: 8px; }
.cost-workbench-candidates { min-height: 0; max-height: 450px; overflow: auto; padding: 2px; }
.cost-workbench-candidates .candidate-card { min-height: 74px; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 10px 12px; }
.cost-workbench-candidates .candidate-card.selected { border-color: var(--teal); background: #effbf8; box-shadow: inset 3px 0 0 var(--teal); }
.cost-workbench-candidates .candidate-score { justify-content: center; min-width: 96px; padding: 6px 8px; color: var(--teal); background: var(--teal-soft); border-radius: 6px; font-size: 8px; }
.cost-workbench-candidates .candidate-card:disabled { cursor: not-allowed; opacity: .58; }
.cost-workbench-candidates .candidate-card strong { font-size: 10px; }
.cost-workbench-candidates .candidate-card p, .cost-workbench-candidates .candidate-card small { overflow: hidden; margin: 0; color: var(--muted); font-size: 8px; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.cost-workbench-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--line); }
.cost-workbench-actions span { color: var(--muted); font-size: 8px; line-height: 1.45; }
.cost-confirm-resource { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0; padding: 9px 11px; background: #f0fbf8; border: 1px solid #bfe7dc; border-radius: 8px; }
.cost-confirm-resource > div { display: grid; gap: 3px; min-width: 0; }
.cost-confirm-resource strong, .cost-confirm-resource small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cost-confirm-resource strong { color: #08796f; font-size: 9px; }
.cost-confirm-resource small { color: var(--muted); font-size: 8px; }
.cost-confirm-resource > div:last-child { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.cost-confirm-resource.empty { justify-content: flex-start; color: var(--muted); background: #fafcfd; border-style: dashed; font-size: 8px; }
.cost-inline-draft { display: grid; align-items: stretch; grid-template-columns: 1fr; padding: 12px; background: #f1faf8; }
.cost-inline-draft-title { display: grid; gap: 3px; }
.cost-inline-draft-title strong { color: var(--teal); font-size: 10px; }
.cost-inline-draft-title small, .cost-inline-draft-category small { color: var(--muted); font-size: 8px; }
.cost-inline-draft-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
.cost-inline-draft-grid label { display: grid; gap: 4px; color: #38566a; font-size: 8px; font-weight: 700; }
.cost-inline-draft-grid .input { min-width: 0; height: 31px; padding: 6px 8px; font-size: 9px; }
.cost-inline-draft-category { display: grid; gap: 3px; margin-top: 9px; padding: 7px 8px; background: white; border: 1px solid #d5eae5; border-radius: 6px; }
.cost-inline-draft-category span { color: #08796f; font-size: 8px; font-weight: 800; }
.cost-inline-draft-actions { display: flex; justify-content: flex-end; gap: 7px; margin-top: 10px; }
.cost-draft-fields { min-width: 0; margin: 0 0 13px; padding: 12px; background: #f8fbfc; border: 1px solid var(--line); border-radius: 10px; }
.cost-draft-fields legend { padding: 0 6px; color: var(--teal); font-size: 10px; font-weight: 800; }
.empty-state.compact { min-height: 170px; padding: 20px; }
.toast {
  position: fixed;
  z-index: 130;
  left: 50%;
  bottom: 24px;
  max-width: min(90vw, 600px);
  padding: 10px 16px;
  color: white;
  text-align: center;
  background: var(--navy);
  border-radius: 999px;
  box-shadow: 0 12px 34px rgba(8,26,43,.22);
  opacity: 0;
  transform: translate(-50%, 13px);
  pointer-events: none;
  transition: .2s;
  font-size: 10px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-only, .mobile-drawer, .bottom-nav { display: none; }

@media (max-width: 1180px) {
  .matching-workspace { grid-template-columns: 250px minmax(360px, 1fr); }
  .confirmation-panel { grid-column: 1 / -1; min-height: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .confirmation-panel > h2, .confirmation-panel > .confirm-actions { grid-column: 1 / -1; }
  .confirm-actions { grid-template-columns: 1fr 1fr; }
  .specialty-grid { grid-template-columns: repeat(3, 1fr); }
  .cost-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-workbench { grid-template-columns: minmax(280px, .8fr) minmax(500px, 1.2fr); }
  .cost-resource-selector { grid-template-columns: 196px minmax(0, 1fr); padding-inline: 12px; }
}

@media (max-width: 900px) {
  :root { --sidebar: 238px; }
  .sidebar { padding-inline: 12px; }
  .brand-copy strong { font-size: 13px; }
  .brand-copy small { font-size: 8px; }
  .topbar, .screen { padding-inline: 22px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column, .suggestion-grid, .admin-grid { grid-template-columns: 1fr; }
  .matching-workspace { grid-template-columns: 1fr; }
  .workspace-panel { min-height: auto; }
  .material-list { grid-template-columns: repeat(2, 1fr); }
  .confirmation-panel { grid-column: auto; }
  .project-row { grid-template-columns: minmax(180px, 1fr) .6fr .8fr auto; }
  .project-row > span:nth-of-type(2) { display: none; }
  .project-row-actions { gap: 5px; }
  .query-layout { grid-template-columns: 1fr; }
  .filter-card { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .filter-card .form-field + .form-field { margin-top: 0; }
  .filter-card .form-field:first-child { grid-column: 1 / -1; }
  .history-card { grid-template-columns: minmax(190px, 1fr) .6fr .8fr auto; }
  .history-card > span:nth-of-type(2) { display: none; }
}

@media (max-width: 720px) {
  body { padding-bottom: 67px; }
  .app-shell { display: block; min-height: 0; }
  .sidebar { display: none; }
  .app-main { min-height: 100vh; }
  .mobile-only { display: inline-grid; }
  .topbar { position: sticky; min-height: 60px; padding: 0 14px; }
  .topbar > div:first-child { gap: 10px; }
  .topbar strong { font-size: 12px; }
  .topbar-meta { display: none !important; }
  .screen { min-height: calc(100vh - 127px); padding: 18px 13px 26px; }
  .page-heading { align-items: stretch; flex-direction: column; margin-bottom: 16px; }
  .page-heading h1 { font-size: 22px; }
  .page-actions .button { flex: 1; }
  .hero-banner { grid-template-columns: 1fr; gap: 18px; padding: 22px 20px; }
  .hero-banner .button { justify-self: stretch; }
  .hero-actions { display: grid; grid-template-columns: 1fr; }
  .hero-actions .button { width: 100%; }
  .stats-grid { gap: 8px; margin: 12px 0; }
  .stat-card { min-height: 66px; padding: 12px; }
  .stat-card strong { font-size: 18px; }
  .stat-icon { width: 32px; height: 32px; }
  .two-column { gap: 12px; }
  .card-head { padding: 15px; }
  .card-body { padding: 15px; }
  .project-row { grid-template-columns: 1fr auto; gap: 8px; min-height: 92px; padding: 13px 15px; }
  .project-row > span { display: none; }
  .project-row .badge { grid-column: 1; }
  .project-row-actions { grid-column: 2; grid-row: 1 / 3; align-self: center; flex-direction: column; }
  .project-row-actions .button { width: 100%; }
  .stepper { margin-inline: -5px; }
  .step span { display: none; }
  .step:not(:last-child)::after { left: 61%; width: 78%; }
  .form-grid, .classification-grid, .classification-select-grid, .category-recommendations { grid-template-columns: 1fr; }
  .classification-heading { align-items: stretch; flex-direction: column; }
  .form-field.full { grid-column: auto; }
  .specialty-grid { grid-template-columns: repeat(3, 1fr); }
  .specialty-option span { min-height: 52px; font-size: 10px; }
  .upload-zone { min-height: 190px; padding: 20px; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-group, .search-input { width: 100%; }
  .toolbar-group .button { flex: 1; }
  .match-stats { grid-template-columns: repeat(2, 1fr); }
  .match-stat { min-height: 48px; }
  .match-list-toolbar { align-items: stretch; flex-direction: column; padding: 12px; }
  .match-search { flex-basis: auto; width: 100%; }
  .match-filter-list { width: 100%; }
  .match-list-toolbar > .toolbar-group { width: 100%; }
  .match-table-wrap { max-height: none; }
  .match-list-table { min-width: 1580px; }
  .match-list-table th:nth-child(3), .match-list-table td:nth-child(3) { position: static; box-shadow: none; }
  .match-list-footer { align-items: stretch; flex-direction: column; }
  .modal.wide { max-height: calc(100vh - 20px); padding: 15px; }
  .library-picker-head, .library-picker-summary { align-items: stretch; flex-direction: column; }
  .library-picker-search { grid-template-columns: 1fr; }
  .cost-picker-layout, .cost-suggestion-grid { grid-template-columns: 1fr; }
  .cost-picker-category-panel { padding: 10px; }
  .library-picker-categories { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .library-picker-results { max-height: 52vh; }
  .library-picker-row { grid-template-columns: 1fr; }
  .library-picker-row > div { grid-template-columns: 1fr; }
  .library-picker-row small, .library-picker-row em { grid-column: auto; }
  .material-list { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .material-item { flex: 0 0 210px; }
  .candidate-card { min-height: 118px; }
  .confirmation-panel { display: block; }
  .confirmation-panel > * + * { margin-top: 10px; }
  .confirm-actions { grid-template-columns: 1fr; }
  .sync-panel { grid-template-columns: 1fr; }
  .sync-arrow { transform: rotate(90deg); justify-self: center; }
  .query-layout { gap: 12px; }
  .filter-card { grid-template-columns: 1fr; }
  .filter-card .form-field:first-child { grid-column: auto; }
  .code-result { grid-template-columns: 1fr auto; gap: 7px; }
  .code-result code, .code-result strong, .code-result span { grid-column: 1; }
  .code-result small { grid-column: 2; grid-row: 1; }
  .code-result button { grid-column: 2; grid-row: 2 / 4; }
  .history-toolbar { align-items: stretch; flex-direction: column; }
  .history-card { grid-template-columns: 1fr; gap: 8px; }
  .history-card > span { display: block !important; }
  .history-actions { justify-content: flex-start; flex-wrap: wrap; }
  .library-meta { grid-template-columns: 1fr; }
  .cost-intro, .cost-library-grid, .cost-summary { grid-template-columns: 1fr; }
  .cost-flow { grid-template-columns: 1fr; }
  .cost-flow-arrow { transform: rotate(90deg); justify-self: center; }
  .cost-boq-resource-head { display: block; }
  .cost-resource-actions { margin-top: 10px; }
  .cost-workbench { grid-template-columns: 1fr; }
  .cost-boq-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .cost-boq-tree { max-height: 340px; }
  .cost-resource-selector { grid-template-columns: 1fr; }
  .cost-resource-categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cost-resource-categories .cost-picker-category-title, .cost-resource-categories .button { grid-column: 1 / -1; }
  .cost-category-search, .cost-category-matches { grid-column: 1 / -1; }
  .cost-sheet1-summary { align-items: stretch; flex-wrap: wrap; }
  .cost-sheet1-summary > div { flex: 1 1 140px; }
  .cost-sheet1-summary form { width: 100%; margin-left: 0; }
  .cost-sheet1-actions, .list-pagination { align-items: stretch; flex-direction: column; }
  .list-pagination > div { justify-content: flex-end; }
  .cost-confirm-resource { align-items: stretch; flex-direction: column; }
  .cost-confirm-resource > div:last-child { justify-content: stretch; flex-wrap: wrap; }
  .cost-confirm-resource > div:last-child .button { flex: 1 1 150px; }
  .cost-inline-draft-grid { grid-template-columns: 1fr; }
  .cost-inline-draft-actions { flex-wrap: wrap; }
  .cost-inline-draft-actions .button { flex: 1 1 150px; }
  .cost-workbench-actions { align-items: stretch; flex-direction: column; }
  .cost-workbench-actions .button { width: 100%; }
  .bottom-nav {
    position: fixed;
    z-index: 50;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    min-height: 67px;
    padding: 6px max(5px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
    background: rgba(255,255,255,.97);
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 22px rgba(16,42,67,.06);
    backdrop-filter: blur(12px);
  }
  .bottom-nav button {
    display: grid;
    place-items: center;
    gap: 1px;
    padding: 4px 2px;
    color: #6f8494;
    background: transparent;
    border: 0;
    border-radius: 9px;
    font-size: 7px;
  }
  .bottom-nav button span { font-size: 15px; line-height: 20px; }
  .bottom-nav button.active { color: var(--teal); background: var(--teal-soft); font-weight: 700; }
  .mobile-drawer {
    position: fixed;
    z-index: 95;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: min(290px, 82vw);
    padding: 22px;
    color: white;
    background: var(--navy);
    transform: translateX(-102%);
    transition: .22s ease;
  }
  .mobile-drawer.open { transform: translateX(0); }
  .drawer-backdrop { display: block; z-index: 90; }
  .drawer-close { align-self: flex-end; width: 36px; height: 36px; color: white; background: rgba(255,255,255,.08); border: 0; border-radius: 9px; font-size: 22px; }
  .drawer-brand { display: flex; align-items: center; gap: 10px; margin: 15px 0 22px; }
  .mobile-drawer > button[data-view] { padding: 13px; color: white; text-align: left; background: transparent; border: 0; border-bottom: 1px solid rgba(255,255,255,.08); font-size: 12px; }
  .toast { bottom: 82px; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .toolbar { display: none !important; }
  .app-shell { display: block; }
  .screen { padding: 0; }
}
