:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2937;
  background: #f4f6f9;
  --blue: #0277f8;
  --blue-dark: #005fca;
  --border: #d6dde7;
  --muted: #64748b;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f4f6f9; }
button, input, select { font: inherit; }
.hidden { display: none !important; }

.app-nav {
  min-height: 52px;
  padding: 0 18px;
  background: #1f2b5b;
  display: flex;
  align-items: center;
  gap: 28px;
  color: #fff;
}
.brand { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; white-space: nowrap; }
.nav-links { display: flex; min-height: 52px; overflow-x: auto; }
.nav-link { border: 0; background: transparent; color: #d7def5; padding: 0 14px; font-size: 12px; font-weight: 650; border-bottom: 3px solid transparent; cursor: default; }
.nav-link.active { color: #fff; border-bottom-color: #38a7ff; background: rgba(255,255,255,.06); cursor: pointer; }
.nav-link.pending { opacity: .72; }

.page-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.breadcrumbs { display: flex; gap: 7px; align-items: center; color: #64748b; font-size: 11px; margin-bottom: 5px; }
.breadcrumbs span:nth-child(2), .breadcrumbs span:nth-child(4) { color: var(--blue); font-weight: 700; cursor: pointer; }
h1 { margin: 0; color: #075aa8; font-size: 24px; font-weight: 750; }
.customer-meta { margin-top: 4px; color: #64748b; font-size: 12px; }
.header-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.page-shell { padding: 18px 24px 42px; }
.staging-banner {
  background: #edf6ff;
  border: 1px solid #b9d9ff;
  color: #164c84;
  padding: 10px 13px;
  border-radius: 7px;
  font-size: 12px;
  margin-bottom: 14px;
}
.staging-banner code { background: rgba(255,255,255,.65); padding: 1px 4px; border-radius: 3px; }

.upload-card,
.documents-panel,
.empty-state {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.upload-card { padding: 16px; margin-bottom: 15px; }
.section-head, .panel-title-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.kicker { display: block; color: var(--blue); text-transform: uppercase; letter-spacing: .06em; font-size: 10px; font-weight: 800; }
.section-head h2, .panel-title-row h2, .empty-state h2 { margin: 2px 0 0; font-size: 17px; color: #172033; }
.storage-note { font-size: 11px; color: #64748b; }

.upload-grid { display: grid; grid-template-columns: 1.1fr 1.5fr 1fr auto; gap: 12px; align-items: end; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; color: #3b4657; font-size: 11px; font-weight: 700; }
.field span { color: #d32f2f; }
input, select {
  width: 100%;
  min-height: 35px;
  border: 1px solid #c7d0dd;
  border-radius: 5px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  font-weight: 400;
  padding: 7px 9px;
}
input:focus, select:focus { outline: 2px solid rgba(2,119,248,.13); border-color: var(--blue); }
input[type="file"] { font-size: 12px; padding: 5px 7px; }
.upload-action { display: flex; align-items: end; }
.upload-status { min-height: 18px; margin-top: 9px; font-size: 11px; color: #64748b; }
.upload-status.error { color: #b91c1c; }

.documents-panel { overflow: hidden; }
.panel-title-row { padding: 13px 15px; border-bottom: 1px solid #e2e8f0; }
.record-card { min-width: 150px; padding: 7px 10px; background: #f8fafc; border-left: 3px solid var(--blue); }
.record-card span { display: block; color: #64748b; text-transform: uppercase; font-size: 10px; font-weight: 800; }
.record-card strong { display: block; color: #0f172a; font-size: 22px; margin-top: 2px; }
.table-scroll { overflow-x: auto; }
.documents-table { width: 100%; min-width: 1150px; border-collapse: collapse; font-size: 11px; }
.documents-table th { background: #f1f4f8; color: #005da8; font-weight: 750; padding: 8px 9px; border: 1px solid #d4dae2; text-align: left; white-space: nowrap; }
.documents-table td { background: #fff; padding: 8px 9px; border: 1px solid #d4dae2; color: #334155; vertical-align: middle; }
.documents-table tbody tr:hover td { background: #f8fbff; }
.select-col { width: 34px; text-align: center !important; }
.select-col input, .row-select { width: auto; min-height: 0; }
.actions-head { width: 145px; text-align: right !important; }
.action-cell { text-align: right; }
.action-wrap { display: flex; justify-content: flex-end; gap: 5px; }
.preview-badge { width: 34px; height: 34px; border-radius: 5px; display: grid; place-items: center; background: #edf6ff; color: #075ea8; font-size: 10px; font-weight: 800; border: 1px solid #cfe5ff; }
.doc-link { color: #086bc6; font-weight: 700; text-decoration: none; }
.doc-link:hover { text-decoration: underline; }
.empty-cell { padding: 32px !important; text-align: center; color: #94a3b8 !important; }

.btn {
  border-radius: 5px;
  border: 1px solid transparent;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.success { background: #20a755; color: #fff; }
.btn.success:hover { background: #168c46; }
.btn.secondary { background: #fff; color: #26384c; border-color: #b9d2ef; }
.btn.secondary:hover { background: #f7fbff; }
.btn.danger { background: #fff; color: #c62828; border-color: #f2aaaa; }
.btn.danger:hover { background: #fff5f5; }
.btn.small { min-height: 28px; padding: 5px 8px; font-size: 10px; }
button:disabled { opacity: .55; cursor: not-allowed; }

.empty-state { padding: 34px; text-align: center; }
.empty-state p { color: #64748b; font-size: 13px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 2000; max-width: 380px; background: #172033; color: #fff; border-radius: 7px; padding: 10px 13px; font-size: 12px; box-shadow: 0 10px 30px rgba(15,23,42,.22); }
.toast.hidden { display: none; }
.toast.error { background: #9f1d1d; }

@media (max-width: 900px) {
  .app-nav { align-items: flex-start; flex-direction: column; gap: 0; padding-top: 12px; }
  .nav-links { width: 100%; }
  .upload-grid { grid-template-columns: 1fr 1fr; }
  .upload-action { align-items: stretch; }
}
@media (max-width: 650px) {
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-shell, .page-header { padding-left: 14px; padding-right: 14px; }
  .upload-grid { grid-template-columns: 1fr; }
  .panel-title-row { align-items: flex-start; flex-direction: column; }
}
