/* MatPat 16.11.6.13 — visual/accessibility polish only.
   Intentionally avoids PDF coordinates, report rendering, and data logic. */
:root { color-scheme: light; font-synthesis: none; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-wrap: break-word; }
button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }
button:not(:disabled) { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:where(button, input, select, textarea, a, summary):focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}
:where(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  max-width: 100%;
}
:where(input, select, textarea):not(:disabled):focus-visible {
  border-color: #2563eb;
}
@media (max-width: 700px) {
  :where(.toolbar, .actions-bar, .preset-row) { flex-wrap: wrap; }
  :where(.toolbar, .actions-bar) > button { min-height: 42px; }
  :where(.field-grid, .inspection-grid) { grid-template-columns: minmax(0, 1fr); }
  :where(.panel, .inspection-card, .inspection-subsection) { min-width: 0; }
  :where(table) { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
/* Preserve the original paper-form PDF layout and exact dimensions. */
@media print { :where(button, input, select, textarea):focus-visible { outline: none; } }

/* MatPat 16.11.6.14 — shared visual language, UI only. */
.matpat-unified .matpat-page-header {
  position: relative; isolation: isolate; min-height: 138px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 26px 72px;
  background: linear-gradient(115deg, rgba(145,184,224,.62), rgba(64,72,90,.82));
  border: 1px solid rgba(255,255,255,.34); border-radius: 22px;
  box-shadow: 0 8px 24px rgba(10,20,40,.10);
  text-align: center; color: #fff;
}
.matpat-unified .matpat-page-header h1 {
  margin: 0; padding: 0; font-family: Arial, sans-serif;
  font-size: clamp(26px, 3.8vw, 32px); line-height: 1.25;
  font-weight: 700; text-align: center; color: #fff;
}
.matpat-unified .matpat-page-header .matpat-back-circle {
  position: absolute !important; top: 18px !important; left: 18px !important;
  right: auto !important; bottom: auto !important; transform: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px !important; height: 42px !important; min-width: 42px;
  margin: 0 !important; padding: 0 !important; border: 1px solid rgba(255,255,255,.15);
  border-radius: 50% !important; background: rgba(255,255,255,.20) !important;
  color: #fff !important; font: 700 27px/1 Arial,sans-serif !important;
  text-decoration: none; cursor: pointer; z-index: 2;
}
.matpat-unified .matpat-page-header .matpat-back-circle:hover {background: rgba(255,255,255,.32) !important; transform: none;}
.matpat-unified .matpat-page-header .matpat-back-circle:focus-visible {outline: 3px solid #93c5fd; outline-offset: 3px;}
/* Seals subtitle remains within its header, below the centered title. */
.matpat-unified .matpat-page-header p {margin: 0; color: #eef5ff;}
/* Preserve original PAT/MAT mode selector layout and button handlers. */
.matpat-unified #phangletest, .matpat-unified #mataccuracytest {min-height: 155px;}
/* Builder form sections: bright, legible paper cards on the existing dark page. */
.matpat-unified.summary-shell .panel, .matpat-unified .summary-shell .panel {
  background: #fff; color: #1d2b43; border: 1px solid #d9e1ec;
  box-shadow: 0 10px 26px rgba(0,0,0,.14);
}
.matpat-unified .summary-shell .panel h2 {color: #1c416e;}
.matpat-unified .summary-shell .inspection-card,
.matpat-unified .summary-shell .dor-header-editor,
.matpat-unified .summary-shell .dor-crew-row {
  background: #f7faff; border-color: #d4dfeb; color: #1d2b43;
}
/* Report Builder has a different existing layout; use white for its input area. */
.matpat-unified .entryPanel {background: #fff; border-radius: 14px; margin: 12px 16px; border: 1px solid #dce4ee;}
@media (max-width: 650px) {
  .matpat-unified .matpat-page-header {padding: 72px 18px 22px; min-height: 142px;}
  .matpat-unified .matpat-page-header .matpat-back-circle {top: 14px !important; left: 14px !important;}
  .matpat-unified .matpat-page-header h1 {font-size: clamp(24px,6vw,30px);}
}

/* Align the lower dashboard icon buttons to the same centerline. */
.dashboard-sections .history-section, .dashboard-sections .records-section {display:flex;flex-direction:column;align-items:center;}
.dashboard-sections .history-section .dashboard-entry, .dashboard-sections .records-section .dashboard-entry {
  position: static !important; margin: auto 0 !important; flex: 0 0 auto;
  display: inline-flex; justify-content:center; align-items:center;
}
.dashboard-sections .history-section .dashboard-entry img, .dashboard-sections .records-section .dashboard-entry img {display:block;object-fit:contain;}

.matpat-unified #metacctest {min-height:155px;}
.matpat-unified .matpat-page-header > div {text-align:center;}

/* MatPat 16.11.6.15 — targeted corrective styles. */
/* History: do not let its three-column toolbar be squeezed to a single narrow column. */
.matpat-unified #historyHeader.matpat-page-header { box-sizing:border-box; width:100%; max-width:1100px; }
.matpat-unified #historyHeader #historyActions {
  display:grid; width:100%; min-width:0; box-sizing:border-box;
  grid-template-columns:44px minmax(0,1fr) 44px; align-items:center; gap:12px;
}
.matpat-unified #historyHeader #historyActions h1 {
  min-width:0; width:auto; max-width:none; overflow-wrap:normal; word-break:normal;
  white-space:normal; text-align:center; font-size:clamp(24px,3.8vw,32px);
}
.matpat-unified #historyHeader #historyTools {
  box-sizing:border-box; width:100%; min-width:0; justify-content:center;
}
.matpat-unified #historyHeader #historySearch { flex:1 1 290px; min-width:0; }
/* Keep back control anchored independently of the centered heading. */
.matpat-unified #historyHeader #historyActions .matpat-back-circle { position:absolute !important; top:18px !important; left:18px !important; }
/* Consistent type throughout calculator forms, outputs, and headings. */
.matpat-unified:is(#Patbody,#Matbody) { font-family:Arial,Helvetica,sans-serif; }
.matpat-unified:is(#Patbody,#Matbody) :is(table,th,td,label,button,input,select,textarea,p,span,h1,h2,h3) {
  font-family:inherit;
}
/* Use the same background as PAT/MAT/History for Seals Management. */
.matpat-unified:has(#sealForm) {
  background:radial-gradient(circle at 20% 20%,#8EC5FC,transparent 40%),
             radial-gradient(circle at 80% 80%,#E0C3FC,transparent 40%),#111827;
  background-attachment:fixed; min-height:100vh;
}
@media(max-width:650px) {
 .matpat-unified #historyHeader #historyActions {grid-template-columns:40px minmax(0,1fr) 40px;gap:8px;}
 .matpat-unified #historyHeader #historyActions h1 {font-size:clamp(21px,5vw,28px);}
 .matpat-unified #historyHeader #historyActions .matpat-back-circle {top:14px !important;left:14px !important;}
 .matpat-unified #historyHeader #historyTools {flex-direction:column;align-items:stretch;}
 .matpat-unified #historyHeader #historySearch {flex:none;width:100%;}
}

/* 16.11.6.16 — Report Builder header, preserving all existing action IDs. */
.matpat-unified .matpat-page-header.toolbar {display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:66px 24px 22px;min-height:160px;box-sizing:border-box;}
.matpat-unified .matpat-page-header.toolbar h1 {width:100%;max-width:none;flex:none;white-space:normal;text-align:center;}
.matpat-unified .fieldsuite-report-actions {display:flex;justify-content:center;flex-wrap:wrap;gap:10px;width:100%;}
.matpat-unified .fieldsuite-report-actions button {width:auto;max-width:100%;min-height:38px;}
/* History: title remains a full-width center grid cell rather than inheriting narrow flex sizing. */
.matpat-unified #historyHeader #historyActions {width:100%;min-width:0;box-sizing:border-box;}
.matpat-unified #historyHeader #historyActions h1 {min-width:0;max-width:none;width:100%;white-space:nowrap;overflow-wrap:normal;word-break:normal;}
@media(max-width:450px){.matpat-unified #historyHeader #historyActions h1{font-size:clamp(18px,5vw,24px);}.matpat-unified .matpat-page-header.toolbar{padding:70px 14px 20px;}}

/* 16.11.6.17 — consistent PAT/MAT glass headers and responsive dashboard. */
.matpat-unified {
  background: radial-gradient(circle at 20% 20%,#8EC5FC,transparent 40%),
              radial-gradient(circle at 80% 80%,#E0C3FC,transparent 40%),#111827 !important;
  background-attachment: fixed !important;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
}
.matpat-unified .matpat-page-header {
  box-sizing:border-box;
  background:rgba(255,255,255,.18) !important;
  -webkit-backdrop-filter:blur(20px); backdrop-filter:blur(20px);
  border:1px solid rgba(255,255,255,.30);
  border-radius:24px;
  box-shadow:0 8px 32px rgba(0,0,0,.15),inset 0 1px 1px rgba(255,255,255,.3);
  width:calc(100% - 20px); max-width:none; margin:10px auto 20px;
  padding:28px 74px; min-height:130px;
  display:flex;flex-direction:column;justify-content:center;align-items:center;
  text-align:center; color:white;
}
.matpat-unified .matpat-page-header > h1 {
  display:block; flex:none; width:100%; min-width:0; max-width:none;
  margin:0; text-align:center; white-space:normal;
  font:700 clamp(24px,3.5vw,32px)/1.25 Arial,Helvetica,sans-serif;
}
.matpat-unified #historyHeader.matpat-page-header {
  width:calc(100% - 20px);max-width:1100px;
  position:relative; display:flex; flex-direction:column; align-items:center;
}
.matpat-unified #historyHeader > h1 {width:100%;text-align:center;}
.matpat-unified #historyHeader #deleteSelected {position:absolute;right:18px;top:18px;margin:0;}
.matpat-unified .matpat-page-header.toolbar {
  display:flex;flex-direction:column;justify-content:center;align-items:center;
  width:calc(100% - 20px);padding:28px 74px;min-height:150px;
}
.matpat-unified .fieldsuite-report-actions {display:flex;flex-wrap:wrap;gap:12px;justify-content:center;width:100%;margin-top:12px;}
.matpat-unified .fieldsuite-report-actions button {
  background:rgba(255,255,255,.19); color:#fff;
  border:1px solid rgba(255,255,255,.42);border-radius:14px;
  padding:11px 18px;font:600 14px Arial,sans-serif;
  box-shadow:0 4px 12px rgba(0,0,0,.13);transition:background .15s,transform .15s;
}
.matpat-unified .fieldsuite-report-actions button:hover {background:rgba(255,255,255,.31);transform:translateY(-1px);}
.matpat-unified .entryPanel {background:#fff;color:#1d2b43;border-radius:16px;margin:14px 16px;padding:20px;border:1px solid #dce4ee;box-shadow:0 10px 24px rgba(0,0,0,.13);}
@media(max-width:650px){
 .matpat-unified .matpat-page-header,.matpat-unified .matpat-page-header.toolbar {padding:70px 18px 24px;min-height:130px;}
 .matpat-unified .matpat-page-header > h1 {font-size:clamp(23px,5vw,30px);}
 .matpat-unified #historyHeader #deleteSelected {right:12px;top:14px;}
 .matpat-unified .entryPanel {margin:10px;padding:14px;}
}

/* 16.11.6.19: PAT/MAT backgrounds use the EXACT dashboard gradient.
   Override earlier .matpat-unified and page-specific !important declarations. */
body#Patbody.matpat-unified,
body#Matbody.matpat-unified {
  background: radial-gradient(ellipse at 24% 20%,rgba(142,197,252,.75),transparent 62%),
              radial-gradient(ellipse at 76% 82%,rgba(190,151,223,.65),transparent 62%),#111827 !important;
  background-attachment: fixed !important;
  background-repeat: no-repeat !important;
}

/* 16.11.6.20 — One viewport-anchored background for dashboard and calculators.
   The gradient is painted on the root element, not on pages with different
   document heights. This prevents long PAT/MAT forms from stretching the
   gradients and producing the diagonal/black corner appearance. */
html:has(body:is(#bodycolor, #Patbody, #Matbody)) {
  min-height: 100%;
  background-color: #111827;
  background-image:
    radial-gradient(ellipse at 24% 20%, rgba(142,197,252,.75), transparent 62%),
    radial-gradient(ellipse at 76% 82%, rgba(190,151,223,.65), transparent 62%);
  background-attachment: fixed, fixed;
  background-position: center center, center center;
  background-repeat: no-repeat, no-repeat;
  background-size: 100% 100%, 100% 100%;
}
body#bodycolor, body#Patbody, body#Matbody,
body#bodycolor.matpat-unified, body#Patbody.matpat-unified, body#Matbody.matpat-unified {
  background: transparent !important;
  background-image: none !important;
  background-color: transparent !important;
  min-height: 100vh;
}
