/* ─────────────────────────────────────────────────────────────────────────────
   THEME  :  Charcoal & Teal
   Navbar : #2d3748   (charcoal)
   Accent : #38b2ac   (teal)
   Hover  : #38b2ac   (teal tab highlight)
   ───────────────────────────────────────────────────────────────────────────── */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Arial, Helvetica, sans-serif; background: #f7fafc; color: #2d3748; font-size: 14px; }
a { color: inherit; text-decoration: none; }

/* ===== Navbar ===== */
.navbar {
  background-color: #2d3748;
  display: flex;
  align-items: stretch;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.navbar-brand {
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: #38b2ac;
  font-weight: bold;
  font-size: 15px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.1);
  gap: 8px;
  letter-spacing: .3px;
}
.navbar-brand svg { flex-shrink: 0; color: #38b2ac; }
.navbar-nav { display: flex; align-items: stretch; flex: 1; }
.nav-item { position: relative; display: flex; align-items: stretch; }
.nav-link {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: #cbd5e0;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  gap: 5px;
  height: 48px;
  transition: background .15s, color .15s;
  border-bottom: 3px solid transparent;
}
.nav-link:hover { background: rgba(56,178,172,.15); color: #38b2ac; border-bottom-color: #38b2ac; }
.nav-link.active { background: rgba(56,178,172,.2); color: #38b2ac; border-bottom-color: #38b2ac; font-weight: 600; }
.nav-link svg { transition: transform .2s; }
.nav-item:hover > .nav-link svg { transform: rotate(180deg); }

/* Dropdown */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  min-width: 210px;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
  border-radius: 0 0 8px 8px;
  border-top: 3px solid #38b2ac;
  z-index: 999;
}
.nav-item:hover .dropdown-menu { display: block; }
.dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: #4a5568;
  font-size: 13px;
  transition: background .1s, color .1s;
}
.dropdown-menu a:hover  { background: #e6fffa; color: #2c9e99; }
.dropdown-menu a.active { background: #e6fffa; font-weight: bold; color: #2c9e99; }

/* Navbar right */
.navbar-right { display: flex; align-items: center; padding: 0 16px; gap: 10px; margin-left: auto; }
.user-badge {
  background: rgba(56,178,172,.2);
  color: #81e6d9;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.role-badge {
  font-size: 10px;
  background: rgba(0,0,0,.25);
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  color: #a0aec0;
}
.btn-logout {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.2);
  color: #a0aec0;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.18); color: #fff; border-color: rgba(255,255,255,.35); }

/* ===== Page Container ===== */
.page-container { max-width: 1600px; margin: 0 auto; padding: 24px 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 20px; font-weight: bold; color: #2d3748; }
.page-subtitle { color: #718096; font-size: 13px; margin-top: 2px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: #38b2ac; color: #fff; }
.btn-primary:hover { background: #2c9e99; }
.btn-success { background: #38a169; color: #fff; }
.btn-success:hover { background: #2f855a; }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-danger:hover { background: #c53030; }
.btn-outline { background: #fff; color: #38b2ac; border: 1px solid #38b2ac; }
.btn-outline:hover { background: #e6fffa; }
.btn-secondary { background: #718096; color: #fff; }
.btn-secondary:hover { background: #4a5568; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 5px 8px; }

/* ===== Toolbar (search + filter) ===== */
.toolbar {
  background: #fff;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  border: 1px solid #e2e8f0;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 360px; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #a0aec0; }
.search-input {
  width: 100%;
  padding: 7px 10px 7px 34px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  background: #f7fafc;
}
.search-input:focus { border-color: #38b2ac; background: #fff; box-shadow: 0 0 0 3px rgba(56,178,172,.15); }
.filter-select {
  padding: 7px 28px 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #f7fafc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23718096'/%3E%3C/svg%3E") no-repeat right 8px center;
  -webkit-appearance: none;
  cursor: pointer;
  min-width: 140px;
  transition: border-color .15s;
}
.filter-select:focus { border-color: #38b2ac; outline: none; }

/* Searchable filter — the combobox main.js builds over <select data-searchable>.
   The input keeps .filter-select for its look; the list borrows the Templates
   menu's card and the navbar dropdown's highlight colours. */
.combo { position: relative; display: inline-block; }
.combo-input { cursor: text; }
.combo-input::placeholder { color: #a0aec0; }
.combo-list { position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  min-width: 100%; width: max-content; max-width: min(520px, 90vw); max-height: 300px; overflow-y: auto;
  margin: 0; padding: 6px 0; list-style: none; background: #fff; border: 1px solid #e2e8f0;
  border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.combo-option { padding: 7px 14px; font-size: 13px; color: #2d3748; cursor: pointer; white-space: nowrap; }
.combo-option.active { background: #e6fffa; color: #2c9e99; }
.combo-option[aria-selected="true"] { font-weight: 600; }
.combo-note { padding: 7px 14px; font-size: 12px; color: #a0aec0; cursor: default; }
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.record-count { color: #718096; font-size: 13px; white-space: nowrap; }

/* ===== Table ===== */
.table-wrap {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.07);
  /* Wide registers (Key Quantity, Drawing) exceed the container — scroll
     horizontally instead of clipping the right-hand columns out of reach. */
  overflow-x: auto;
  border: 1px solid #e2e8f0;
}
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead th {
  background: #2d3748;
  color: #e2e8f0;
  padding: 11px 12px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  user-select: none;
  border-bottom: 2px solid #38b2ac;
}
.data-table thead th:first-child { width: 38px; }
.data-table tbody tr { border-bottom: 1px solid #edf2f7; transition: background .1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f0fff4; }
.data-table td { padding: 9px 12px; font-size: 13px; vertical-align: middle; }
.data-table td.td-link a { color: #2c9e99; text-decoration: underline; }
.data-table td.td-actions { white-space: nowrap; width: 80px; }

/* ===== Wide registers (Key Quantity) =====
   With 15+ data columns the nowrap headers alone blow past the container
   ("Fixed Remaining Construction Price" is ~250px on one line). Let headers
   wrap, pin the short code/number columns, and give the long RU/EN text
   columns a bounded width so they wrap instead of stretching the table. */
.data-table-wide thead th { white-space: normal; padding: 9px 8px; line-height: 1.25;
                            text-align: center; vertical-align: middle; }
.data-table-wide td { padding: 8px; font-size: 12.5px; }

.data-table-wide .td-code-1,
.data-table-wide .td-code-2     { white-space: nowrap; min-width: 90px; }

.data-table-wide .td-code-discipline,
.data-table-wide .td-code-etap,
.data-table-wide .td-working-code,
.data-table-wide .td-unit-ru,
.data-table-wide .td-unit-en    { white-space: nowrap; }

.data-table-wide .td-FRC-price,
.data-table-wide .td-key-quantity,
.data-table-wide .td-weight-ratio { white-space: nowrap; text-align: right; }

.data-table-wide .td-discipline-name-ru,
.data-table-wide .td-discipline-name-en { min-width: 150px; max-width: 260px; }

/* Etap names carry the longest free text — give them double the width. */
.data-table-wide .td-etap-name-ru,
.data-table-wide .td-etap-name-en { min-width: 300px; max-width: 520px; }

.data-table-wide .td-amendment-no { white-space: nowrap; }
.row-cb { cursor: pointer; }
.bulk-bar {
  display: none;
  background: #fffaf0;
  border: 1px solid #f6ad55;
  border-radius: 6px;
  padding: 8px 14px;
  margin-bottom: 10px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.bulk-bar.show { display: flex; }

/* ===== Pagination ===== */
.pagination-wrap { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: #fff; border-top: 1px solid #edf2f7; flex-wrap: wrap; gap: 8px; }
.pagination { display: flex; gap: 4px; align-items: center; }
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  cursor: pointer;
  background: #fff;
  color: #4a5568;
  font-family: inherit;
  text-decoration: none;
  transition: all .1s;
}
.page-btn:hover { background: #e6fffa; border-color: #38b2ac; color: #38b2ac; }
.page-btn.current { background: #38b2ac; color: #fff; border-color: #38b2ac; font-weight: 600; }
.page-btn:disabled, .page-btn.disabled { opacity: .4; pointer-events: none; }
.page-info { font-size: 13px; color: #718096; }

/* ===== Modal ===== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 10px;
  width: 500px;
  max-width: 95vw;
  box-shadow: 0 20px 50px rgba(0,0,0,.3);
  overflow: hidden;
  animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateY(-24px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 16px 20px;
  background: #2d3748;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px solid #38b2ac;
}
.modal-header h3 { font-size: 16px; color: #fff; }
.modal-close { background: none; border: none; color: #a0aec0; font-size: 22px; cursor: pointer; line-height: 1; padding: 0 4px; transition: color .1s; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #edf2f7; display: flex; gap: 8px; justify-content: flex-end; }

/* Drop Zone */
.drop-zone {
  border: 2px dashed #38b2ac;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  background: #f0fff4;
  position: relative;
}
.drop-zone.dragover { background: #e6fffa; border-color: #2c9e99; border-style: solid; }
.drop-zone svg { color: #38b2ac; margin-bottom: 10px; }
.drop-zone p { color: #718096; margin-bottom: 6px; font-size: 14px; }
.drop-zone .file-name { font-size: 13px; color: #38b2ac; font-weight: 500; margin-top: 8px; }
.hidden-file-input { display: none; }

/* Upload status */
.upload-status { margin-top: 12px; padding: 10px 14px; border-radius: 6px; font-size: 13px; display: none; }
.upload-status.success { background: #c6f6d5; color: #276749; display: block; }
.upload-status.error   { background: #fed7d7; color: #9b2c2c; display: block; white-space: pre-wrap; }
.upload-status.loading { background: #bee3f8; color: #2a69ac; display: block; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Delete confirm modal */
.confirm-text { font-size: 14px; color: #4a5568; line-height: 1.6; }

/* Edit modal form layout */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-edit .modal { width: 580px; }
.edit-status { margin-top: 10px; padding: 8px 12px; border-radius: 5px; font-size: 13px; display: none; }
.edit-status.success { background: #c6f6d5; color: #276749; display: block; }
.edit-status.error   { background: #fed7d7; color: #9b2c2c; display: block; white-space: pre-wrap; }

/* Action badges */
.action-add    { background: #c6f6d5; color: #276749; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.action-update { background: #bee3f8; color: #2a4365; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.action-delete { background: #fed7d7; color: #9b2c2c; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }

/* ===== Forms ===== */
.form-card { background: #fff; border-radius: 8px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,.07); max-width: 560px; border: 1px solid #e2e8f0; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #4a5568; margin-bottom: 5px; }
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #f7fafc;
  transition: border-color .15s, box-shadow .15s;
  color: #2d3748;
}
.form-input:focus { border-color: #38b2ac; background: #fff; box-shadow: 0 0 0 3px rgba(56,178,172,.15); }

/* Hide the up/down spinner on number inputs that should be typed, not stepped.
   Keeps type="number" validation and the numeric keypad on mobile. */
.form-input.no-spinner { -moz-appearance: textfield; appearance: textfield; }
.form-input.no-spinner::-webkit-outer-spin-button,
.form-input.no-spinner::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.form-error { color: #e53e3e; font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }
.errorlist { list-style: none; color: #e53e3e; font-size: 12px; margin: 4px 0 0; }

/* ===== Messages ===== */
.messages-wrap { padding: 0 0 12px; }
.alert {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success { background: #c6f6d5; color: #276749; border: 1px solid #9ae6b4; }
.alert-error   { background: #fed7d7; color: #9b2c2c; border: 1px solid #fc8181; }
.alert-info    { background: #bee3f8; color: #2a4365; border: 1px solid #90cdf4; }
.alert-warning { background: #fefcbf; color: #744210; border: 1px solid #f6e05e; }

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 50%, #1a365d 100%);
}
.login-card { background: #fff; border-radius: 12px; padding: 36px 32px; width: 380px; max-width: 95vw; box-shadow: 0 20px 50px rgba(0,0,0,.4); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo h1 { font-size: 22px; color: #2d3748; font-weight: bold; }
.login-logo h1 span { color: #38b2ac; }
.login-logo p { color: #a0aec0; font-size: 12px; margin-top: 4px; }
.login-card .form-group { margin-bottom: 14px; }
.login-btn { width: 100%; padding: 10px; margin-top: 8px; font-size: 15px; }

/* ===== User Table ===== */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th { background: #f7fafc; padding: 10px 12px; text-align: left; font-size: 13px; color: #4a5568; border-bottom: 2px solid #2d3748; font-weight: 600; }
.users-table td { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid #edf2f7; }
.users-table tr:hover td { background: #f0fff4; }

/* ===== Home / Placeholder ===== */
.placeholder-page { text-align: center; padding: 80px 20px; color: #718096; }
.placeholder-page h2 { font-size: 26px; color: #2d3748; margin-bottom: 10px; }

/* ===== Pending approval badge ===== */
.nav-badge {
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}
.nav-badge-inline { margin-left: 4px; }

/* Approval status badges */
.status-pending  { background: #fefcbf; color: #744210; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.status-approved { background: #c6f6d5; color: #276749; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.status-rejected { background: #fed7d7; color: #9b2c2c; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 600; }

/* Diff highlighting in batch detail */
.diff-changed { background: #fffbeb; }
.diff-old { color: #9b2c2c; text-decoration: line-through; font-size: 11px; display: block; }
.diff-new { color: #276749; font-size: 11px; }

/* Approval action buttons bar */
.approval-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.approval-bar .approval-notes {
  flex: 1;
  min-width: 200px;
  padding: 7px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.approval-bar .approval-notes:focus { border-color: #38b2ac; }
.approval-result { margin-top: 12px; padding: 10px 14px; border-radius: 6px; font-size: 13px; display: none; }
.approval-result.success { background: #c6f6d5; color: #276749; display: block; }
.approval-result.error   { background: #fed7d7; color: #9b2c2c; display: block; white-space: pre-wrap; }

/* Batch summary chips */
.batch-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.chip-add    { background: #c6f6d5; color: #276749; }
.chip-update { background: #bee3f8; color: #2a4365; }
.chip-delete { background: #fed7d7; color: #9b2c2c; }
.chip-upsert { background: #e9d8fd; color: #553c9a; }

/* ===== Role tags ===== */
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.tag-admin   { background: #fed7d7; color: #9b2c2c; }
.tag-moderator { background: #e9d8fd; color: #553c9a; }
.tag-editor  { background: #bee3f8; color: #2a4365; }
.tag-viewer  { background: #c6f6d5; color: #276749; }
.empty-state { text-align: center; padding: 60px 20px; color: #a0aec0; }
.empty-state p { font-size: 15px; }

/* ===== Revision badge ===== */
.rev-badge { background: #e6fffa; color: #2c7a7b; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }

@media (max-width: 700px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .combo, .combo-input { width: 100%; }
  .toolbar-actions { margin-left: 0; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   Steel Structure  (main register · Approved Quantities · statistics panel)

   Every rule is scoped to .steel-page, the wrapper those three templates put
   around their content. That is not decoration: ug_manhole and todo have their
   own .kpi-card / .panel / .mini-table / .pct-chip / .stat-card, defined in
   their templates' inline <style> blocks, and those blocks do not set every
   property used here. Unscoped, `.kpi-card { border-top: ... }` below would
   give the Manhole and To-Do statistics pages a lavender top border they never
   had, and `.pct-chip`'s background would tint Manhole's chips.

   Pastel palette matches the Excel export (steel_structure/utils.py PASTELS) —
   change a colour here and change it there too:
     engineering #bdd7ee · inspection #c6e0b4 · as-built #ffdfba · approved #ccc0da
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tab strip (templates/steel_structure/_tabs.html) ─────────────────────── */
.steel-page .part-tabs {
  display: flex; gap: 4px; border-bottom: 2px solid #e2e8f0;
  margin-bottom: 14px; flex-wrap: wrap;
}
.steel-page .part-tab {
  display: flex; align-items: center; gap: 6px; padding: 8px 14px;
  font-size: 13px; color: #4a5568; text-decoration: none;
  border-radius: 6px 6px 0 0; border: 1px solid transparent;
  border-bottom: none; margin-bottom: -2px;
}
.steel-page .part-tab:hover { background: #f7fafc; }
.steel-page .part-tab.active {
  background: #fff; border-color: #e2e8f0; font-weight: 700; color: #2d3748;
}
.steel-page .part-tab.active.tab-main     { box-shadow: inset 0 3px 0 #bdd7ee; }
.steel-page .part-tab.active.tab-approved { box-shadow: inset 0 3px 0 #ccc0da; }
.steel-page .part-tab.active.tab-statistics { box-shadow: inset 0 3px 0 #38b2ac; }
.steel-page .part-tab.active .part-tab-count { background: #2d3748; color: #fff; }

/* ── Source-group tints, main register table ──────────────────────────────── */
.steel-page .grp-eng      { background: #f3f8fd; }
.steel-page .grp-insp     { background: #f2f9ee; }
.steel-page .grp-asbuilt  { background: #fdf4ec; }
.steel-page .grp-approved { background: #f5f2f8; }

.steel-page .data-table thead th.grp-hdr-eng      { background: #bdd7ee; color: #333f50; }
.steel-page .data-table thead th.grp-hdr-insp     { background: #c6e0b4; color: #333f50; }
.steel-page .data-table thead th.grp-hdr-asbuilt  { background: #ffdfba; color: #333f50; }
.steel-page .data-table thead th.grp-hdr-approved { background: #ccc0da; color: #333f50; }

/* ── Templates dropdown, main register ────────────────────────────────────── */
.steel-page .tpl-dropdown { position: relative; display: inline-block; }
.steel-page .tpl-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 50;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
  min-width: 250px; box-shadow: 0 6px 18px rgba(0, 0, 0, .12); padding: 6px 0;
}
.steel-page .tpl-dropdown.open .tpl-menu { display: block; }
.steel-page .tpl-menu a {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  font-size: 13px; color: #333; text-decoration: none;
}
.steel-page .tpl-menu a:hover { background: #f7fafc; }
.steel-page .tpl-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ── Register table, main register ────────────────────────────────────────── */
.steel-page .steel-table td,
.steel-page .steel-table th { white-space: nowrap; }
.steel-page .steel-table td.wrap { white-space: normal; min-width: 220px; }

/* ── Stat / KPI cards (main · Approved · statistics) ──────────────────────────
   One system for all three pages so a card is the same size wherever it
   appears. .stat-* is the main register's alias for .kpi-*; grid-auto-rows:1fr
   keeps wrapped rows as tall as the tallest one. Lavender is the base because
   the Approved page uses .kpi-card bare — a card added to the statistics panel
   without a modifier will come out lavender. */
.steel-page .kpi-grid,
.steel-page .stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-auto-rows: 1fr; gap: 14px; margin-bottom: 20px;
}
.steel-page .kpi-card,
.steel-page .stat-card {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 16px 18px; border-top: 4px solid #ccc0da;
}
.steel-page .kpi-label,
.steel-page .stat-label {
  font-size: 11px; color: #718096; text-transform: uppercase; letter-spacing: .5px;
}
.steel-page .kpi-value,
.steel-page .stat-value {
  font-size: 24px; font-weight: 700; color: #2d3748; margin-top: 4px;
}
.steel-page .kpi-sub,
.steel-page .stat-sub {
  font-size: 12px; color: #a0aec0; margin-top: auto; padding-top: 2px;
}
.steel-page .kpi-eng,      .steel-page .sc-eng      { border-top-color: #bdd7ee; }
.steel-page .kpi-insp,     .steel-page .sc-insp     { border-top-color: #c6e0b4; }
.steel-page .kpi-asbuilt,  .steel-page .sc-asbuilt  { border-top-color: #ffdfba; }
.steel-page .kpi-approved, .steel-page .sc-approved { border-top-color: #ccc0da; }

/* ── Panels and mini-tables (Approved + statistics) ───────────────────────── */
.steel-page .panel {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 16px 18px; margin-bottom: 20px; overflow-x: auto;
}
.steel-page .panel-title {
  font-size: 15px; font-weight: 700; color: #2d3748; margin: 0 0 12px;
}
.steel-page .mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.steel-page .mini-table th {
  text-align: left; color: #718096; font-size: 13px; font-weight: 600;
  padding: 6px 8px; border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}
.steel-page .mini-table td {
  padding: 6px 8px; border-bottom: 1px solid #f0f4f8; white-space: nowrap;
}
.steel-page .mini-table td.num,
.steel-page .mini-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.steel-page .mini-table tfoot td {
  font-weight: 700; border-top: 2px solid #e2e8f0; border-bottom: none;
}
/* .empty-state is sized for a full-page register; inside a breakdown card its
   60px of padding leaves a hole taller than the card's own content. */
.steel-page .mini-table .empty-state { padding: 18px 8px; }
.steel-page .mini-table .empty-state p { font-size: 13px; }

/* ── Chips ───────────────────────────────────────────────────────────────────
   Lavender is the base: the Approved page and every accepted-% chip use these
   bare. The statistics panel's inspection and as-built chips override it with
   the modifiers below rather than an inline style. */
.steel-page .pct-chip {
  display: inline-block; min-width: 46px; text-align: center; border-radius: 10px;
  padding: 1px 8px; font-size: 11px; font-weight: 600;
  background: #e4dfec; color: #5b4a73;
}
.steel-page .pct-chip.c-insp    { background: #e2efda; color: #4a6b3a; }
.steel-page .pct-chip.c-asbuilt { background: #fce4d6; color: #8a5a34; }
.steel-page .pp-chip {
  display: inline-block; border-radius: 5px; padding: 1px 8px;
  font-size: 11px; font-weight: 600; background: #e4dfec; color: #5b4a73;
}

/* ── Progress bars, statistics panel ──────────────────────────────────────── */
/* Two panels side by side, stacking below ~760px of content width. */
.steel-page .progress-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.steel-page .progress-panel {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 18px; margin-bottom: 20px;
}
.steel-page .progress-grid .progress-panel { margin-bottom: 0; }
.steel-page .progress-row {
  /* Label capped rather than fixed and the figure sized to its text, so the
     track keeps whatever is left — at half width, 220px + 130px of fixed
     columns left almost nothing for the bar itself. */
  display: grid; grid-template-columns: minmax(96px, 150px) 1fr auto;
  gap: 12px; align-items: center; margin-bottom: 14px;
}
.steel-page .progress-row:last-child { margin-bottom: 0; }
.steel-page .progress-track { background: #edf2f7; border-radius: 8px; height: 16px; overflow: hidden; }
.steel-page .progress-fill  { height: 100%; border-radius: 8px; }
/* One colour per part, shared by both panels. Inspection used to be #8fbc74 in
   one and #c6e0b4 in the other, which read as two different measures. */
.steel-page .progress-fill.f-insp     { background: #8fbc74; }
.steel-page .progress-fill.f-asbuilt  { background: #e8a76d; }
.steel-page .progress-fill.f-approved { background: #9d87b8; }
.steel-page .progress-label { font-size: 13px; font-weight: 600; color: #4a5568; }
.steel-page .progress-num   { font-size: 12px; color: #718096; text-align: right;
                              white-space: nowrap; }

/* ── Progress payment chart, statistics panel ─────────────────────────────── */
/* Column chart + cumulative strip + table, all in one panel. No chart library:
   the geometry is a grid and two percentages, and the view already computes
   both, so a dependency would only buy tooltips we get from title= anyway. */
.steel-page .pp-panel { padding: 18px 20px 8px; }
.steel-page .pp-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.steel-page .pp-head .panel-title { margin-bottom: 4px; }
.steel-page .pp-note { font-size: 12px; color: #718096; }
/* Headline figure — the one number people copy onto the payment cover sheet. */
.steel-page .pp-figure { text-align: right; }
.steel-page .pp-figure-value {
  font-size: 26px; font-weight: 700; color: #5b4a73; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.steel-page .pp-figure-unit { font-size: 11px; color: #718096; margin-top: 2px; }

/* Bars run horizontally so the weight has a full column to itself. Fixed
   label and figure columns keep every number on the same x — a ragged right
   edge is what makes a list of weights hard to scan. */
.steel-page .pp-rows { display: flex; flex-direction: column; gap: 10px; }
.steel-page .pp-row {
  display: grid; grid-template-columns: minmax(64px, 88px) 1fr auto 52px;
  gap: 12px; align-items: center;
}
.steel-page .pp-track {
  background: #edf2f7; border-radius: 8px; height: 18px; overflow: hidden;
}
.steel-page .pp-fill {
  height: 100%; min-width: 2px; border-radius: 8px;
  background: linear-gradient(90deg, #b3a0c9 0%, #9d87b8 100%);
}
.steel-page .pp-weight {
  font-size: 14px; font-weight: 700; color: #2d3748; text-align: right;
  white-space: nowrap; font-variant-numeric: tabular-nums;
  /* Widest realistic weight is '9,999,999' — reserving it stops the bars
     changing length as the figures grow. */
  min-width: 86px;
}
.steel-page .pp-share {
  font-size: 11px; color: #a0aec0; text-align: right;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* Cumulative strip — same payments, but measured against the whole job. */
.steel-page .pp-cum-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 18px 0 6px;
}
.steel-page .pp-cum {
  display: flex; height: 16px; border-radius: 8px; overflow: hidden;
  background: #edf2f7;
}
.steel-page .pp-seg { background: #9d87b8; box-shadow: inset -1px 0 0 rgba(255,255,255,.65); }
/* Alternating tone so adjacent payments stay distinguishable without a legend
   entry per payment. */
.steel-page .pp-seg:nth-child(even) { background: #b3a0c9; }

.steel-page .pp-table { margin-top: 18px; }
.steel-page .pp-table tfoot td { color: #718096; font-style: italic; }
/* The weight column is the one being checked against paperwork; the rest of
   the row is context for it. */
.steel-page .pp-table .strong-num { font-size: 13px; font-weight: 700; color: #2d3748; }

/* ── Breakdown grid, statistics panel ─────────────────────────────────────── */
.steel-page .breakdown-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.steel-page .breakdown-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 16px 18px; overflow-x: auto;
}
