:root {
  --charcoal: #16232b;
  --charcoal-deep: #0e191f;
  --charcoal-soft: #263942;
  --safety-yellow: #f5c518;
  --safety-yellow-dark: #dcae00;
  --paper: #fffdf8;
  --paper-warm: #f3f0e8;
  --paper-shadow: #ded9ce;
  --ink: #172126;
  --muted: #68757a;
  --line: #d9d7cf;
  --line-strong: #b8b9b3;
  --danger: #a6322d;
  --danger-soft: #fff1ef;
  --success: #2f6b52;
  --radius-small: 6px;
  --radius: 12px;
  --shadow: 0 24px 70px rgba(16, 29, 36, .16), 0 3px 12px rgba(16, 29, 36, .08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--charcoal); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(22, 35, 43, .025) 1px, transparent 1px) 0 0 / 38px 38px,
    var(--paper-warm);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  color: #fff;
  background: rgba(22, 35, 43, .97);
  border-bottom: 3px solid var(--safety-yellow);
  box-shadow: 0 8px 26px rgba(7, 16, 21, .16);
  backdrop-filter: blur(12px);
}
.header-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 70px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  letter-spacing: .01em;
}
.brand-mark {
  position: relative;
  width: 28px;
  height: 32px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, .82);
  border-radius: 4px;
}
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  background: var(--safety-yellow);
}
.brand-mark::before { top: 9px; }
.brand-mark::after { top: 17px; }
.brand strong { display: block; font-size: 17px; line-height: 1.05; letter-spacing: .04em; }
.brand small { display: block; margin-top: 4px; color: rgba(255, 255, 255, .64); font-size: 10px; line-height: 1; letter-spacing: .16em; text-transform: uppercase; }
.session-tools { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
.session-label { max-width: 480px; overflow: hidden; color: rgba(255, 255, 255, .7); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.login-stage { display: grid; min-height: calc(100vh - 190px); place-items: center; }
.login-card {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, .88fr);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(22, 35, 43, .18);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.login-form-panel { padding: clamp(36px, 6vw, 76px); }
.eyebrow {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.login-form-panel > .eyebrow::before,
.company-block > .eyebrow::before,
.page-heading .eyebrow::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 3px;
  margin: 0 9px 3px 0;
  background: var(--safety-yellow);
}
h1, h2, p { overflow-wrap: anywhere; }
.login-form-panel h1 {
  max-width: 620px;
  margin: 0;
  color: var(--charcoal);
  font: 760 clamp(34px, 5vw, 58px)/1.03 ui-serif, Georgia, Cambria, serif;
  letter-spacing: -.035em;
}
.login-lead { max-width: 570px; margin: 22px 0 34px; color: var(--muted); font-size: 17px; }
.login-form { max-width: 560px; }
.form-field { margin-bottom: 18px; }
.form-field label { display: block; margin-bottom: 7px; color: var(--charcoal); font-size: 13px; font-weight: 720; letter-spacing: .015em; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.label-row > span { color: var(--success); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
input {
  width: 100%;
  min-height: 50px;
  padding: 11px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  font-size: 16px;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
input:hover { border-color: #899298; }
input:focus { outline: 0; border-color: var(--charcoal); box-shadow: 0 0 0 3px rgba(22, 35, 43, .14); }
input:disabled { color: var(--muted); background: #eeece6; cursor: wait; }
.field-help { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  background: transparent;
  font-size: 14px;
  font-weight: 730;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: .76; }
.button-primary { color: var(--charcoal-deep); background: var(--safety-yellow); border-color: var(--safety-yellow-dark); box-shadow: 0 7px 18px rgba(181, 139, 0, .2); }
.button-primary:hover:not(:disabled) { background: #ffda35; border-color: var(--safety-yellow); }
.button-quiet { color: var(--charcoal); background: var(--paper); border-color: var(--line-strong); }
.site-header .button-quiet { color: #fff; background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .25); }
.site-header .button-quiet:hover { background: rgba(255, 255, 255, .14); }
.button-compact { min-height: 40px; padding: 8px 13px; font-size: 12px; }
.button-full { width: 100%; min-height: 52px; margin-top: 7px; }
.button-busy { display: none; }
.is-busy .button-label { display: none; }
.is-busy .button-busy { display: inline; }
.button:focus-visible,
input:focus-visible,
a:focus-visible,
.report-open:focus-visible {
  outline: 3px solid var(--safety-yellow);
  outline-offset: 3px;
}

.message { padding: 13px 15px; border: 1px solid; border-radius: var(--radius-small); }
.message-error { margin: 0 0 20px; color: #7b211d; background: var(--danger-soft); border-color: #e9aba6; }

.trust-panel {
  position: relative;
  min-width: 0;
  padding: clamp(38px, 5vw, 70px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 100% 34px,
    var(--charcoal);
}
.trust-panel::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -150px;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(245, 197, 24, .16);
  border-radius: 50%;
  box-shadow: 0 0 0 45px rgba(245, 197, 24, .035), 0 0 0 90px rgba(245, 197, 24, .025);
  pointer-events: none;
}
.trust-seal {
  width: 58px;
  height: 58px;
  display: grid;
  margin-bottom: 38px;
  border: 1px solid rgba(245, 197, 24, .72);
  border-radius: 50%;
  place-items: center;
}
.trust-seal span { position: relative; width: 20px; height: 15px; border: 2px solid var(--safety-yellow); border-radius: 3px; }
.trust-seal span::before { content: ""; position: absolute; left: 3px; top: -11px; width: 10px; height: 11px; border: 2px solid var(--safety-yellow); border-bottom: 0; border-radius: 8px 8px 0 0; }
.trust-kicker { margin: 0 0 12px; color: var(--safety-yellow); font-size: 11px; font-weight: 780; letter-spacing: .16em; text-transform: uppercase; }
.trust-panel h2 { max-width: 500px; margin: 0 0 20px; font: 670 clamp(25px, 3vw, 36px)/1.15 ui-serif, Georgia, serif; letter-spacing: -.02em; }
.trust-panel > p:not(.trust-kicker):not(.trust-note) { max-width: 530px; color: rgba(255, 255, 255, .7); }
.trust-facts { position: relative; z-index: 1; margin: 34px 0; border-top: 1px solid rgba(255, 255, 255, .15); }
.trust-facts div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid rgba(255, 255, 255, .15); }
.trust-facts dt { color: rgba(255, 255, 255, .58); }
.trust-facts dd { margin: 0; font-weight: 680; text-align: right; }
.trust-note { position: relative; z-index: 1; margin: 0; padding-left: 14px; color: rgba(255, 255, 255, .72); border-left: 3px solid var(--safety-yellow); font-size: 12px; }

.status-panel {
  width: min(760px, 100%);
  min-height: 180px;
  margin: clamp(50px, 10vh, 120px) auto;
  display: flex;
  align-items: flex-start;
  gap: 22px;
  padding: 34px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 46px rgba(22, 35, 43, .09);
}
.status-panel h1, .status-panel h2 { margin: 0 0 7px; color: var(--charcoal); font: 700 24px/1.2 ui-serif, Georgia, serif; }
.status-panel p { margin: 0; color: var(--muted); }
.status-mark { width: 14px; height: 46px; flex: 0 0 auto; background: var(--charcoal); border-radius: 3px; }
.status-loading .status-mark { background: var(--safety-yellow); animation: pulse 1.2s ease-in-out infinite; }
.status-empty .status-mark { background: var(--line-strong); }
.status-partial { width: 100%; min-height: 0; margin: 0 0 20px; padding: 18px 20px; box-shadow: none; }
.status-partial .status-mark { height: 36px; background: var(--safety-yellow); }
.status-partial h2 { font: 720 16px/1.2 ui-sans-serif, system-ui, sans-serif; }
.status-partial p { font-size: 13px; }
@keyframes pulse { 50% { opacity: .38; transform: scaleY(.72); } }

.vault-view { width: 100%; }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin: 10px 0 28px;
}
.page-heading h1 { margin: 0; color: var(--charcoal); font: 760 clamp(34px, 5vw, 54px)/1 ui-serif, Georgia, serif; letter-spacing: -.035em; }
.page-heading p:last-child { margin: 11px 0 0; color: var(--muted); font-size: 16px; }
.document-count { min-width: 112px; padding: 14px 16px; color: #fff; background: var(--charcoal); border-bottom: 3px solid var(--safety-yellow); text-align: right; }
.document-count strong { display: block; font: 700 27px/1 ui-serif, Georgia, serif; }
.document-count span { color: rgba(255, 255, 255, .62); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

.report-list { margin: 0; padding: 0; display: grid; gap: 10px; list-style: none; }
.report-item { min-width: 0; }
.report-open {
  width: 100%;
  min-height: 94px;
  display: grid;
  grid-template-columns: 108px minmax(140px, 1.2fr) minmax(140px, 1fr) minmax(120px, .8fr) minmax(120px, .72fr) 28px;
  align-items: center;
  gap: 18px;
  padding: 17px 20px;
  overflow: hidden;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 4px solid var(--charcoal);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(22, 35, 43, .045);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.report-open:hover { border-color: #9da29f; border-left-color: var(--safety-yellow-dark); box-shadow: 0 11px 28px rgba(22, 35, 43, .1); transform: translateY(-1px); }
.report-open > span { min-width: 0; }
.report-type { width: fit-content; display: inline-flex; align-items: center; min-height: 27px; padding: 4px 9px; border: 1px solid currentColor; border-radius: 999px; font-size: 10px; font-weight: 780; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.type-measure { color: #715800; background: #fff7d4; }
.type-regie { color: var(--charcoal); background: #e7ecee; }
.type-diary { color: #315d4b; background: #e7f3ed; }
.report-identity strong, .report-site strong, .report-author strong, .report-date strong { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.report-identity > strong { color: var(--charcoal); font: 720 18px/1.2 ui-serif, Georgia, serif; }
.report-identity small, .report-site small, .report-author small, .report-date small { display: block; margin-bottom: 4px; overflow: hidden; color: var(--muted); font-size: 10px; letter-spacing: .075em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.report-identity small { margin-top: 5px; margin-bottom: 0; font-size: 12px; letter-spacing: 0; text-transform: none; }
.report-date { text-align: right; }
.report-arrow { color: var(--charcoal); font-size: 21px; text-align: right; transition: transform .15s ease; }
.report-open:hover .report-arrow { transform: translateX(3px); }

.detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; color: var(--success); font-size: 12px; font-weight: 680; }
.report-sheet {
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.report-masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, auto);
  gap: 34px;
  padding: clamp(30px, 5vw, 58px);
  color: #fff;
  background: var(--charcoal);
  border-bottom: 5px solid var(--safety-yellow);
}
.company-block h1 { margin: 0; font: 720 clamp(28px, 4vw, 43px)/1.08 ui-serif, Georgia, serif; letter-spacing: -.025em; }
.company-block p:last-child, .document-block p { margin: 9px 0 0; color: rgba(255, 255, 255, .64); }
.document-block { min-width: 0; text-align: right; }
.document-block .report-type { margin-left: auto; color: var(--charcoal); background: var(--safety-yellow); border-color: var(--safety-yellow); }
.document-block h2 { margin: 15px 0 0; font: 700 22px/1.2 ui-serif, Georgia, serif; }

.report-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 0 clamp(24px, 5vw, 58px);
  padding: 27px 0;
  border-bottom: 1px solid var(--line-strong);
}
.report-meta > div { min-width: 0; padding: 10px 24px 10px 0; }
.report-meta span, .report-meta small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.report-meta strong { display: block; margin: 4px 0; overflow-wrap: anywhere; font-size: 14px; }
.report-meta small { letter-spacing: 0; text-transform: none; }
.report-section { margin: 0 clamp(24px, 5vw, 58px); padding: 30px 0; border-bottom: 1px solid var(--line); }
.report-section h2 { margin: 0 0 18px; color: var(--charcoal); font: 720 21px/1.2 ui-serif, Georgia, serif; }
.report-section h2::before { content: ""; display: inline-block; width: 8px; height: 18px; margin: 0 10px -2px 0; background: var(--safety-yellow); }
.report-text { max-width: 850px; white-space: pre-wrap; overflow-wrap: anywhere; }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); }
.data-table { width: 100%; min-width: 560px; border-collapse: collapse; }
.data-table th { padding: 11px 14px; color: var(--muted); background: #f0eee8; border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.number { font-variant-numeric: tabular-nums; text-align: right !important; white-space: nowrap; }
.line-list { border-top: 1px solid var(--line); }
.line-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.line-item span { min-width: 0; overflow-wrap: anywhere; }
.line-item small { display: block; color: var(--muted); }
.line-item strong { flex: 0 0 auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.photos figure { min-width: 0; margin: 0; }
.secure-image-slot { display: block; min-width: 0; }
.report-photo { width: 100%; height: auto; display: block; border: 1px solid var(--line); }
.photos figcaption { padding: 9px 2px 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.signatures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 54px; margin: 0 clamp(24px, 5vw, 58px); padding: 46px 0; }
.signature { min-width: 0; padding-top: 62px; }
.signature-image { width: auto; max-width: 100%; max-height: 68px; display: block; margin-top: -68px; object-fit: contain; object-position: left bottom; }
.signature-line { min-height: 52px; padding-top: 8px; border-top: 1px solid var(--charcoal); }
.signature-line strong, .signature-line span { display: block; overflow-wrap: anywhere; }
.signature-line strong { min-height: 22px; }
.signature-line span { color: var(--muted); font-size: 11px; }
.report-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 20px clamp(24px, 5vw, 58px); background: #efede6; border-top: 1px solid var(--line); }

@media (max-width: 920px) {
  .app-shell { padding-top: 28px; }
  .login-card { grid-template-columns: 1fr; }
  .trust-panel { min-height: 420px; }
  .report-open { grid-template-columns: 98px minmax(150px, 1fr) minmax(140px, 1fr) minmax(110px, .7fr) 24px; }
  .report-author { display: none; }
  .report-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .header-inner, .app-shell { width: min(100% - 24px, 1180px); }
  .header-inner { min-height: 64px; }
  .brand small, .session-label { display: none; }
  .app-shell { padding-bottom: 34px; }
  .login-stage { min-height: auto; }
  .login-card { border-radius: 10px; }
  .login-form-panel, .trust-panel { padding: 30px 24px; }
  .login-form-panel h1 { font-size: clamp(32px, 11vw, 46px); }
  .trust-panel { min-height: 0; }
  .trust-seal { margin-bottom: 25px; }
  .page-heading { align-items: flex-start; }
  .document-count { min-width: 88px; }
  .report-open { min-height: 0; grid-template-columns: auto minmax(0, 1fr) 22px; gap: 11px 13px; padding: 16px; }
  .report-type { grid-row: 1; grid-column: 1; }
  .report-identity { grid-row: 1; grid-column: 2; }
  .report-site { grid-row: 2; grid-column: 1 / 3; padding-top: 10px; border-top: 1px solid var(--line); }
  .report-date { grid-row: 3; grid-column: 1 / 3; display: flex; justify-content: space-between; gap: 14px; text-align: left; }
  .report-date small, .report-date strong { margin: 0; }
  .report-arrow { grid-row: 1; grid-column: 3; }
  .report-author { display: none; }
  .detail-toolbar > span { display: none; }
  .report-masthead { grid-template-columns: 1fr; gap: 25px; }
  .document-block { padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .2); text-align: left; }
  .document-block .report-type { margin-left: 0; }
  .report-meta { grid-template-columns: 1fr; }
  .report-meta > div { padding-right: 0; border-bottom: 1px solid var(--line); }
  .report-meta > div:last-child { border-bottom: 0; }
  .photos { grid-template-columns: 1fr; }
  .signatures { grid-template-columns: 1fr; gap: 38px; }
  .report-actions .button { width: 100%; }
  .status-panel { margin-top: 38px; padding: 25px 22px; }
  .line-item { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  html, body { min-width: 0; background: #fff; }
  body { color: #000; font-size: 10pt; }
  .np, .site-header { display: none !important; }
  .app-shell { width: 100%; margin: 0; padding: 0; }
  .report-sheet { overflow: visible; border: 0; box-shadow: none; }
  .report-masthead { padding: 0 0 7mm; color: #000; background: #fff; border-bottom: 2pt solid #000; }
  .company-block p:last-child, .document-block p { color: #333; }
  .document-block .report-type { color: #000; background: #fff; border-color: #000; }
  .report-meta, .report-section, .signatures { margin-right: 0; margin-left: 0; }
  .report-meta { padding: 5mm 0; }
  .report-section { padding: 5mm 0; break-inside: avoid; }
  .report-section h2::before { background: #000; }
  .table-scroll { overflow: visible; }
  .data-table { min-width: 0; }
  .photos { gap: 5mm; }
  .photos figure, .signature, .line-item, tr { break-inside: avoid; }
  .report-photo { max-height: 90mm; object-fit: contain; }
  .signatures { padding: 12mm 0 0; break-inside: avoid; }
}
