/* KYC — brand from the Al Nouf Auto logo (charcoal #231f20, red #ed1c24, grey #898c8f, Inter) */
:root {
  --navy: #231f20;
  --navy-dark: #000000;
  --orange: #ed1c24;
  --orange-dark: #c4161c;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f6fa;
  --card: #ffffff;
  --error: #c2160a;
  --error-bg: #faedec;
  --ok: #329f5d;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--navy); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
[hidden] { display: none !important; }

/* Header / footer */
.site-header { background: #fff; border-bottom: 3px solid var(--orange); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 84px; }
.brand img { display: block; height: 62px; width: auto; }
.header-tag { font-weight: 600; font-size: 13px; color: var(--navy); background: #f1f1f2; padding: 6px 12px; border-radius: 999px; }
.site-footer { background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; padding: 22px 0; margin-top: 40px; }
.admin-bar { background: #fdeeee; border-bottom: 1px solid #f8c9cb; font-size: 13px; padding: 8px 0; }

.main { padding-top: 28px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(35,31,32,.04); }
.card h1 { font-size: 24px; line-height: 1.25; margin: 0 0 10px; color: var(--navy); }
.card h2 { font-size: 18px; margin: 0 0 18px; color: var(--navy); display: flex; align-items: center; gap: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.card-head h2 { margin: 0; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 13px; font-weight: 700; flex: none; }

.intro { border-top: 4px solid var(--orange); }
.company-title { font-size: 20px; font-weight: 700; color: var(--navy); margin: 0 0 10px; line-height: 1.3; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 600; color: var(--orange); margin: 0 0 6px; }
.supplier-line { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 18px 0 8px; padding: 14px 16px; background: #f7f7f8; border-radius: 8px; }
.supplier-line dt { font-size: 12px; color: var(--muted); }
.supplier-line dd { margin: 0; font-weight: 600; }
.deadline { color: var(--orange-dark); }
.legend { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.billto { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 20px; margin: 10px 0 0; }
.billto dt { font-size: 12px; color: var(--muted); }
.billto dd { margin: 0; font-weight: 500; word-break: break-word; }
.doclinks { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.doclinks a { font-weight: 500; text-decoration: none; }

/* Two-column layout (desktop): intro | our details, then sections 1-5 | 6-10 */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 20px; align-items: start; }
.cols.top { align-items: stretch; }
.cols.top > .card { display: flex; flex-direction: column; }
.col { min-width: 0; }
@media (max-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
}

/* Fields */
.field { margin: 0 0 18px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.req { color: var(--orange-dark); }
.help { color: var(--muted); font-size: 13px; margin: -2px 0 8px; }
.muted { color: var(--muted); }
input[type=text], input[type=email], input[type=url], input[type=tel], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: inherit; padding: 10px 12px; border: 1px solid #cfd3dc; border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(35,31,32,.25); border-color: var(--navy); }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23231f20' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
select:invalid, select option[value=""] { color: var(--muted); }
input.filter { margin-bottom: 6px; padding: 8px 12px; font-size: 14px; background: #f9fafb; }
.q.sub { margin-top: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-2 > .span-2 { grid-column: 1 / -1; }
/* In the 2-column groups: help text goes under the box so the boxes in a row line up. */
.grid-2 .field:not(.upload) { display: flex; flex-direction: column; }
.grid-2 .field:not(.upload) > .help { order: 2; margin: 6px 0 0; }
.grid-2 .field:not(.upload) > .error { order: 3; }
.grid-2 .field.upload { display: flex; flex-direction: column; }
.grid-2 .field.upload > input[type=file] { margin-top: auto; }
.authority-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 0 16px; }
.authority-row input.filter { margin-bottom: 0; padding: 10px 12px; font-size: 15px; }

.choices { display: grid; gap: 8px; }
.choices.inline { grid-template-columns: repeat(auto-fit, minmax(120px, max-content)); gap: 8px 10px; }
.choice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid #d9dce4; border-radius: 8px; cursor: pointer; font-weight: 400; background: #fff; }
.choice:has(input:checked) { border-color: var(--navy); background: #f3f3f4; }
.choice input { margin: 3px 0 0; accent-color: var(--navy); flex: none; }
.choice.confirm { background: #f7f7f8; }
/* The confirm box is a direct child of .field, so beat `.field > label` (padding 0, display block). */
.field > label.choice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; margin-bottom: 0; font-weight: 400; line-height: 1.5; }
.field > label.choice input { margin-top: 4px; width: 18px; height: 18px; }

.upload input[type=file] { display: block; width: 100%; padding: 10px; border: 1px dashed #b8bdcc; border-radius: 8px; background: #fafbfd; font: inherit; font-size: 14px; }
.existing { list-style: none; margin: 0 0 8px; padding: 0; font-size: 14px; }
.existing li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.existing .fname { word-break: break-all; }
.existing .remove { color: var(--error); font-size: 13px; cursor: pointer; margin-left: auto; }

.error { color: var(--error); font-size: 13px; margin: 6px 0 0; }
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #f0c6c2; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }

/* Buttons */
.btn { display: inline-block; font: inherit; font-weight: 600; border-radius: 8px; padding: 12px 22px; cursor: pointer; text-decoration: none; border: 1px solid transparent; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-primary:disabled { opacity: .7; cursor: wait; }
.btn-draft { background: var(--navy); color: #fff; }
.btn-draft:hover { background: #000000; }
.btn-draft:disabled { opacity: .7; cursor: wait; }
.alert-success { background: #ecfdf3; color: #05603a; border: 1px solid #abefc6; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; }
.btn-outline { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn-outline:hover { background: #f3f3f4; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; margin: 4px 0 0; padding: 18px 24px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }

.message-card { text-align: center; padding: 48px 24px; }
.message-card p { max-width: 560px; margin-left: auto; margin-right: auto; }
.done-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; font-size: 28px; }

@media (max-width: 640px) {
  .card { padding: 18px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .authority-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .header-inner { height: 60px; }
  .brand img { height: 36px; }
  .actions .btn { width: 100%; }
  .card h1 { font-size: 21px; }
}

/* Client-side required check */
.field.has-error input:not([type=checkbox]):not([type=radio]), .field.has-error select, .field.has-error textarea { border-color: var(--error); background: #fffafa; }
.field.has-error input[type=file] { border-color: var(--error); background: #fffafa; }
.field.has-error label.choice { border-color: var(--error); }

/* Date picker (flatpickr) in brand colours */
input.date-input { padding-right: 40px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23231f20' stroke-width='1.6' viewBox='0 0 24 24'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") no-repeat right 12px center; }
.flatpickr-calendar { font-family: Inter, system-ui, sans-serif; }
.flatpickr-day.selected, .flatpickr-day.selected:hover, .flatpickr-day.selected:focus { background: var(--navy); border-color: var(--navy); }
.flatpickr-day.today { border-color: var(--orange); }
.flatpickr-day.today:hover { background: var(--orange); border-color: var(--orange); color: #fff; }
.flatpickr-months .flatpickr-month, .flatpickr-current-month { color: var(--navy); fill: var(--navy); }
