:root {
  --navy: #0f172a;
  --slate-800: #1e293b;
  --slate-600: #475569;
  --slate-500: #64748b;
  --border: #cbd5e1;
  --bg: #f1f5f9;
  --card: #ffffff;
  --orange: #ea580c;
  --orange-hover: #c2410c;
  --blue: #0284c7;
  --blue-hover: #0369a1;
  --green: #059669;
  --red: #dc2626;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--navy);
  line-height: 1.45;
  font-size: 13px;
}

/* Utilities */
.hidden { display: none !important; }
.bold { font-weight: 700; }
.block { display: block; }
.uppercase { text-transform: uppercase; }
.text-center { text-align: center; }
.text-left { text-align: left !important; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--slate-500); }
.error-msg { color: var(--red); }
.pointer { cursor: pointer; }
.fit-content { width: fit-content; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.p-0 { padding: 0 !important; }
.pt-4 { padding-top: 16px; }
.pb-4 { padding-bottom: 16px; }
.bt-0 { border-top: none !important; }
.border-t { border-top: 1px solid #e2e8f0; }
.border-b { border-bottom: 1px solid #e2e8f0; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.align-center { align-items: center; }
.align-start { align-items: start; }
.align-end { align-items: end; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-20 { gap: 20px; }

/* Global Header */
.app-header {
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
  border-bottom: 4px solid var(--orange);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.logo-wrap { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px; border-radius: 8px; background: var(--orange);
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 900;
}
.logo-text { font-size: 16px; letter-spacing: -0.2px; }
.header-sub { font-size: 11px; color: #94a3b8; }

.container { max-width: 1240px; margin: 24px auto; padding: 0 16px 48px; }

/* Public Home Landing Cards */
.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  max-width: 920px;
  margin: 32px auto;
}

.landing-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.landing-card h2 { font-size: 18px; margin-bottom: 8px; }
.landing-card p { color: var(--slate-600); margin-bottom: 18px; font-size: 13px; }
.card-badge {
  display: inline-block; font-size: 10px; font-weight: 800; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; margin-bottom: 10px;
}

/* Buttons */
.btn-orange, .btn-dark, .btn-blue, .btn-outline, .btn-danger {
  border: none;
  border-radius: 7px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-full { width: 100%; }
.btn-lg { padding: 14px; font-size: 15px; }
.btn-small { padding: 6px 11px; font-size: 11.5px; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-orange:hover:not(:disabled) { background: var(--orange-hover); }
.btn-dark { background: var(--slate-800); color: #fff; }
.btn-dark:hover:not(:disabled) { background: #0f172a; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover:not(:disabled) { background: var(--blue-hover); }
.btn-outline { background: #fff; color: var(--slate-800); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { background: #f8fafc; }
.btn-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* Top Form Banner */
.sap-top-banner {
  background: var(--navy);
  color: #fff;
  border-radius: 12px;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  border-left: 6px solid var(--orange);
}
.banner-left { display: flex; align-items: center; gap: 14px; }
.m-icon {
  width: 44px; height: 44px; border-radius: 50%; background: var(--orange);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 900; font-style: italic; flex-shrink: 0;
}
.sap-top-banner h2 { font-size: 17px; }
.sap-top-banner p { font-size: 11px; color: #cbd5e1; margin-top: 2px; }
.banner-right { display: flex; gap: 12px; flex-wrap: wrap; }
.banner-right label { display: block; font-size: 10px; font-weight: 700; color: #94a3b8; margin-bottom: 3px; }
.banner-right input {
  background: #1e293b; color: #f8fafc; border: 1px solid #334155;
  border-radius: 6px; padding: 6px 10px; font-size: 12px; font-family: monospace; width: 175px;
}

/* Sections */
.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}
.section-header {
  background: var(--slate-800);
  color: #fff;
  padding: 11px 18px;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.section-header-blue { background: #0369a1; }
.section-header .sub-tag { font-size: 11px; color: #fdba74; font-weight: 500; }
.section-body { padding: 18px; }

/* Grids & Form Inputs */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

@media (max-width: 860px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.input-group label {
  display: block; font-size: 12px; font-weight: 700; color: var(--slate-800); margin-bottom: 5px;
}
.req { color: var(--red); }

input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  font-family: inherit;
  background: #fff;
  color: var(--navy);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.16);
}
input[readonly] { background: #f1f5f9; color: var(--slate-600); cursor: not-allowed; }

.duration-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.duration-box label { font-size: 10px; font-weight: 700; color: var(--slate-500); margin-bottom: 2px; }
.duration-box strong { font-size: 15px; color: var(--navy); }

/* Alerts & Badges */
.alert-box { padding: 12px 14px; border-radius: 8px; font-size: 12px; margin: 12px 0; }
.alert-green { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-orange { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }
.alert-red { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.2px;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-blue { background: #dbeafe; color: #1e40af; }

/* Zone Reference Cards */
.zone-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) { .zone-cards { grid-template-columns: 1fr; } }
.zone-card { border-radius: 8px; padding: 12px; border: 1.5px solid var(--border); }
.zone-card strong { display: block; margin: 6px 0 3px; font-size: 13px; }
.zone-card p { font-size: 11.5px; color: var(--slate-600); }
.cat-a { background: #f0fdf4; border-color: #86efac; }
.cat-b { background: #fffbeb; border-color: #fcd34d; }
.cat-c { background: #fef2f2; border-color: #fca5a5; }

.radio-card {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  font-size: 12px; cursor: pointer; background: #fff;
}
.radio-card:hover { background: #f8fafc; }

.gray-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px; }

/* Tables */
.table-scroll { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.modern-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 1120px; }
.modern-table th {
  background: #f1f5f9; color: var(--slate-800); font-weight: 700; text-align: left;
  padding: 8px 9px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.modern-table td { padding: 7px 8px; border-bottom: 1px solid #e2e8f0; vertical-align: middle; }
.modern-table input, .modern-table select { padding: 6px 7px; font-size: 12px; }

/* Side-by-side compact tables in Section IV & V */
.modern-table.fixed-table { min-width: 0; width: 100%; }
.modern-table.fixed-table th, .modern-table.fixed-table td { padding: 6px; }

.col-num { width: 55px; }
.col-del { width: 48px; }
.col-sm { min-width: 120px; }
.col-med { min-width: 140px; }
.col-wide { min-width: 165px; }

.pic-pill {
  display: inline-block; font-size: 9.5px; font-weight: 800; background: #dbeafe;
  color: #1e40af; padding: 2px 6px; border-radius: 4px; margin-top: 3px; white-space: nowrap;
}

/* PPE & Photo Checklist */
.ppe-qty-table { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; align-items: center; font-size: 12px; }
.ppe-header { font-weight: 700; font-size: 11px; color: var(--slate-600); border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.photo-checklist { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; font-size: 11.5px; max-height: 115px; overflow-y: auto; }
.photo-cb-label { display: flex; align-items: center; gap: 6px; cursor: pointer; }

/* Safety Video */
.safety-video { width: 100%; background: #000; border-radius: 8px; max-height: 360px; }

/* Review, Receipt & Status Bars */
.review-confirm-box {
  background: #fff;
  border: 2px solid var(--orange);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.review-confirm-blue { border-color: var(--blue); }
.review-title { color: var(--orange); font-size: 18px; }
.status-title { font-size: 18px; }
.turnstile-action-col { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

.receipt-banner {
  background: #ecfdf5; border: 2px solid #10b981; border-radius: 10px;
  padding: 18px 22px; margin-bottom: 20px;
}
.success-title { color: #065f46; font-size: 18px; }
.success-sub { color: #065f46; }
.receipt-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-top: 12px; background: #fff; padding: 12px; border-radius: 8px;
  border: 1px solid #a7f3d0;
}
.receipt-val { font-size: 16px; font-weight: 800; font-family: monospace; color: var(--navy); }

/* Official Printable Document Paper (MGENRE-SEC-FRM-001) */
.doc-paper {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px;
  margin-bottom: 24px;
  color: #000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}
.doc-top-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; border-bottom: 3px solid var(--orange); padding-bottom: 12px;
}
.doc-top-header-blue { border-bottom-color: var(--blue); }
.doc-brand { display: flex; align-items: center; gap: 10px; }
.doc-m-circle {
  width: 44px; height: 44px; background: var(--orange); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 24px; font-weight: 900; font-style: italic;
}
.doc-brand-text { line-height: 1.1; }
.doc-brand-text strong { font-size: 22px; color: #334155; }
.doc-brand-text span { font-size: 11px; font-weight: 700; color: #475569; }
.doc-pill {
  border: 2px solid #475569; border-radius: 26px; padding: 8px 26px;
  font-size: 16px; font-weight: 800; color: #334155;
}
.doc-pill-blue { border-color: var(--blue); color: #075985; }
.doc-ref-bar { text-align: right; font-size: 12px; margin-bottom: 12px; }
.doc-ref-underline { border-bottom: 1px solid #000; padding: 0 14px; }

.doc-section-title {
  background: var(--navy); color: #fff; font-weight: 700; font-size: 11.5px;
  padding: 5px 10px; margin: 14px 0 6px; letter-spacing: 0.4px;
}
.doc-form-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-bottom: 8px; }
.doc-form-table th, .doc-form-table td { border: 1px solid #334155; padding: 6px 8px; vertical-align: top; }
.doc-form-table th { background: #f1f5f9; font-weight: 700; }
.cell-gray { background: #f8fafc; }
.doc-form-inner-table { width: 100%; border-collapse: collapse; }
.doc-form-inner-table td { border: none; padding: 4px 6px; }
.inner-b { border-bottom: 1px solid #334155 !important; }
.inner-bl { border-bottom: 1px solid #334155 !important; border-left: 1px solid #334155 !important; }
.inner-l { border-left: 1px solid #334155 !important; }
.sig-cell { padding-top: 34px !important; }
.sig-line { border-top: 1px solid #000; width: 75%; margin: 4px auto; padding-top: 3px; font-size: 10px; font-weight: 700; }

/* Approved Digital ID Cards */
.id-grid { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; margin-top: 16px; }
.id-card {
  width: 295px; border: 2px solid var(--navy); border-radius: 10px; overflow: hidden;
  background: #fff; font-size: 12px; page-break-inside: avoid;
}
.id-card-top { color: #fff; padding: 10px 12px; font-weight: 800; display: flex; justify-content: space-between; }
.id-bg-a { background: #059669; }
.id-bg-b { background: #d97706; }
.id-bg-c { background: #be123c; }
.id-card-body { padding: 12px; line-height: 1.55; }
.id-card-name { font-size: 15px; font-weight: 800; }
.id-card-footer {
  background: var(--navy); color: #fff; text-align: center;
  padding: 6px; font-size: 9.5px; font-weight: 700;
}

/* Print Layout */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .container { max-width: 100%; margin: 0; padding: 0; }
  .doc-paper { border: none; box-shadow: none; padding: 0; page-break-after: always; }
}