/* Contract Register App — eStore Logistics brand (Manrope, yellow accents, charcoal text). */

@font-face { font-family: "Manrope"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/Manrope-Regular.ttf") format("truetype"); }
@font-face { font-family: "Manrope"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/Manrope-Medium.ttf") format("truetype"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/Manrope-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Manrope"; font-weight: 800; font-style: normal; font-display: swap; src: url("../fonts/Manrope-ExtraBold.ttf") format("truetype"); }

:root {
  --yellow: #F3DA00;
  --yellow-dark: #D9C300;
  --charcoal: #4B4B4B;
  --dark: #333333;
  --offwhite: #F8F8F8;
  --white: #FFFFFF;
  --line: #DDDDDD;
  --muted: #7A7A7A;
  --red: #E06666;
  --red-bg: #FBE5E5;
  --amber-bg: #FCF0C3;
  --green: #5A9E4B;
  --green-bg: #E3F0DC;
  --radius-card: 24px;
  --radius-input: 12px;
  --radius-pill: 100px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--charcoal);
  background: var(--offwhite);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--dark); text-decoration: underline; text-decoration-color: var(--yellow); text-underline-offset: 3px; text-decoration-thickness: 2px; }
a:hover { color: #000; }
h1, h2, h3 { color: var(--dark); font-weight: 800; letter-spacing: -0.01em; margin: 0 0 12px; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; margin-top: 18px; }
p { margin: 0 0 12px; }
.lead { font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.text-red { color: #B94A4A; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
ul.plain { list-style: none; padding: 0; margin: 0 0 12px; }
ul.plain li { padding: 4px 0; }

.wrap { width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 24px; }
main.wrap { flex: 1; padding-top: 24px; padding-bottom: 40px; }
.narrow { max-width: 760px; }

/* ---------- header / footer */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { width: 130px; height: auto; display: block; }
.brand-title { font-weight: 800; color: var(--dark); border-left: 2px solid var(--yellow); padding-left: 14px; }
.nav { display: flex; align-items: center; gap: 18px; font-weight: 600; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 3px solid transparent; }
.nav a.active { border-bottom-color: var(--yellow); }
.nav-user { color: var(--muted); font-weight: 500; }
.site-footer { border-top: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 13px; padding: 16px 0; }

/* ---------- cards & grids */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 24px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.page-head { margin-bottom: 8px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-size: 15px; font-weight: 800; line-height: 1;
  padding: 12px 22px; border-radius: var(--radius-pill); border: 2px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--yellow); color: var(--charcoal); border-color: var(--yellow); }
.btn-primary:hover { background: var(--yellow-dark); border-color: var(--yellow-dark); color: var(--dark); }
.btn-secondary { background: var(--white); color: var(--charcoal); border-color: var(--charcoal); }
.btn-secondary:hover { background: var(--offwhite); color: var(--dark); }
.btn-sm { font-size: 13px; padding: 8px 14px; }

/* ---------- forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span:first-child { font-weight: 600; font-size: 13px; color: var(--dark); }
.field > span .muted { font-weight: 500; }
input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font-family: var(--font); font-size: 15px; color: var(--dark); background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius-input); padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--charcoal); box-shadow: 0 0 0 3px rgba(243, 218, 0, .45); }
textarea { resize: vertical; min-height: 64px; }
.hint { font-size: 12px; color: var(--muted); }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.check-inline input { width: auto; margin: 0; accent-color: var(--charcoal); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.field-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .field-grid { grid-template-columns: 1fr; } }

/* confidence colouring */
.field.conf-low { border-left: 4px solid var(--red); padding-left: 10px; }
.field.conf-medium { border-left: 4px solid var(--yellow); padding-left: 10px; }
.field.conf-high { border-left: 4px solid transparent; padding-left: 10px; }
.evidence { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.evidence .quote { font-style: italic; }
.evidence .page { white-space: nowrap; }
.conf-badge { display: inline-block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 1px 8px; border-radius: var(--radius-pill); border: 1px solid var(--line); color: var(--charcoal); background: var(--offwhite); }
.conf-badge.conf-low { background: var(--red-bg); border-color: var(--red); color: #8E2F2F; }
.conf-badge.conf-medium { background: var(--amber-bg); border-color: var(--yellow); }

/* ---------- banners, chips, dots */
.banner { border-radius: 16px; padding: 12px 16px; margin-bottom: 14px; border: 1px solid transparent; }
.banner-amber { background: var(--amber-bg); border-color: var(--yellow); color: var(--dark); }
.banner-red { background: var(--red-bg); border-color: var(--red); color: #6E2626; }
.banner-green { background: var(--green-bg); border-color: #BBD8AE; color: #2F5A24; }
.wrap-banner { border-radius: 0; margin: 0; text-align: center; font-weight: 600; font-size: 13px; }
.flashes { margin-bottom: 8px; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--offwhite); border: 1px solid var(--line); color: var(--charcoal); white-space: nowrap; }
.chip-green, .chip-committed, .chip-action-committed { background: var(--green-bg); border-color: #BBD8AE; color: #2F5A24; }
.chip-red, .chip-failed, .chip-action-failed { background: var(--red-bg); border-color: var(--red); color: #8E2F2F; }
.chip-ready, .chip-action-uploaded, .chip-action-processed { background: var(--amber-bg); border-color: var(--yellow); color: var(--dark); }
.chip-queued, .chip-extracting, .chip-committing, .chip-action-retried { background: #EEF3FA; border-color: #C9D7EA; color: #2F4A6E; }
.chip-discarded, .chip-action-discarded { color: var(--muted); }
.chip-status.status-expiring, .chip-status.status-auto-renew-pending, .chip-status.status-evergreen-review-due { background: var(--amber-bg); border-color: var(--yellow); }
.chip-status.status-expired-action-needed { background: var(--red-bg); border-color: var(--red); color: #8E2F2F; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-green { background: var(--green); }
.dot-red { background: var(--red); }

/* ---------- tables */
.table-card { padding: 16px 24px 8px; }
.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table.small { font-size: 13px; }
pre.json { font-size: 12px; background: var(--offwhite); border: 1px solid var(--line); border-radius: 12px; padding: 10px; max-width: 520px; max-height: 320px; overflow: auto; white-space: pre-wrap; }
details summary { cursor: pointer; font-weight: 600; }

/* ---------- login */
.login-wrap { display: flex; justify-content: center; padding-top: 40px; }
.login-card { width: 100%; max-width: 420px; }

/* ---------- upload page */
.drop-zone {
  position: relative; border: 2px dashed var(--charcoal); border-radius: 20px; padding: 32px 20px; text-align: center;
  background: var(--offwhite); cursor: pointer; margin-bottom: 16px; transition: background .15s, border-color .15s;
}
.drop-zone:focus { outline: none; box-shadow: 0 0 0 3px rgba(243, 218, 0, .45); }
.drop-zone.dragover { background: var(--amber-bg); border-color: var(--yellow-dark); border-style: solid; }
.drop-zone.has-file { border-color: var(--green); border-style: solid; background: var(--green-bg); }
.drop-zone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-zone .link { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 2px; }
.file-meta { margin-top: 8px; font-weight: 600; min-height: 1.4em; }
.file-list { list-style: none; padding: 0; margin: 0; }
.file-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-list li:last-child { border-bottom: 0; }
.file-list form { margin: 0; }
.file-name { word-break: break-word; }

/* ---------- review page */
.review-layout { display: grid; grid-template-columns: 55fr 45fr; gap: 20px; align-items: start; }
.review-pdf { position: sticky; top: 16px; }
.review-pdf iframe { width: 100%; height: calc(100vh - 48px); min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--white); }
.pdf-fallback { margin-top: 6px; text-align: right; }
@media (max-width: 1000px) {
  .review-layout { grid-template-columns: 1fr; }
  .review-pdf { position: static; }
  .review-pdf iframe { height: 70vh; }
}
.meta-card { padding: 16px 24px; }
.meta-grid { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.meta-grid .field { margin-bottom: 0; }
@media (max-width: 700px) { .meta-grid { grid-template-columns: 1fr; } }
.agreement-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.agreement-head h2 { margin: 0; }
.agreement.excluded { opacity: .55; }
.computed { background: var(--offwhite); border: 1px solid var(--line); border-radius: 16px; padding: 12px 16px; margin-top: 8px; }
.computed-head { font-weight: 800; font-size: 13px; color: var(--dark); margin-bottom: 6px; }
.computed-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 16px; margin: 0; }
.computed-grid dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.computed-grid dd { margin: 0; font-weight: 600; color: var(--dark); }
@media (max-width: 700px) { .computed-grid { grid-template-columns: 1fr 1fr; } }
.actions-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; bottom: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.06); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.actions form { margin: 0; }

/* status panel */
.spinner-row { display: flex; align-items: center; gap: 16px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--yellow); animation: spin .9s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.success-panel h2 { display: flex; align-items: center; }

/* ---------- check page */
.check-head { display: flex; align-items: center; gap: 10px; }
.check-head h2 { margin: 0; flex: 1; }
.check-detail { font-size: 13px; white-space: pre-wrap; word-break: break-word; margin: 10px 0 0; color: var(--charcoal); }
.check-bad { border-color: var(--red); }
