/* RLN Centerline Engineering - Geodetic Suite
   Shared styles. To match the main site exactly, adjust the colour variables below. */
:root {
  --blue-900: #0a2f5c;
  --blue-800: #0c3b73;
  --blue-700: #0f4c9a;
  --blue-600: #1860b8;
  --blue-200: #bcd3ef;
  --blue-100: #e6effa;
  --blue-50: #f3f7fc;
  --orange-700: #c25a00;
  --orange-600: #e56f00;
  --orange-500: #f58220;
  --orange-100: #fff0e0;
  --ink: #13243a;
  --muted: #566a82;
  --line: #d3dfee;
  --ok: #1e7b4b;
  --ok-bg: #e5f4ec;
  --bad: #b3261e;
  --bad-bg: #fdecea;
  --white: #ffffff;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Times New Roman", Times, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--blue-50);
  line-height: 1.5;
  font-size: 16px;
}
a { color: var(--blue-600); }
h1, h2, h3 { line-height: 1.2; margin: 0; color: var(--blue-900); }
h1 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 0.75rem; }

/* ---------- top bar ---------- */
.topbar { background: var(--blue-900); color: var(--white); border-bottom: 3px solid var(--orange-500); }
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 0.7rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 0.65rem; color: var(--white); text-decoration: none; font-weight: 700; font-size: 1.05rem; }
.brand small { font-weight: 400; opacity: 0.8; margin-left: 0.25rem; }
.topnav { display: flex; gap: 1.25rem; font-size: 0.95rem; }
.topnav a { color: var(--blue-200); text-decoration: none; padding: 0.15rem 0; border-bottom: 2px solid transparent; }
.topnav a:hover { color: var(--white); }
.topnav a.active { color: var(--white); border-bottom-color: var(--orange-500); }

.subbar { background: var(--white); border-bottom: 1px solid var(--line); }
.subbar-in { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; display: flex; gap: 0.25rem; overflow-x: auto; }
.subbar a { display: block; padding: 0.7rem 0.9rem; color: var(--muted); text-decoration: none; font-size: 0.92rem; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.subbar a:hover { color: var(--blue-700); }
.subbar a.active { color: var(--blue-900); font-weight: 600; border-bottom-color: var(--orange-500); }

/* ---------- layout ---------- */
.wrap { max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.page-head { margin-bottom: 1.5rem; max-width: 760px; }
.lede { color: var(--muted); margin-top: 0.5rem; font-size: 1.02rem; }
.layout { display: grid; grid-template-columns: minmax(320px, 440px) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.layout.wide-left { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.layout > * { min-width: 0; }
@media (max-width: 960px) { .layout, .layout.wide-left { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 1.15rem 1.25rem; margin-bottom: 1.25rem; }
.card > h2 { margin-bottom: 0.85rem; }
.card.accent { border-left: 4px solid var(--orange-500); }
.card.blue { border-left: 4px solid var(--blue-600); }
.sub { color: var(--muted); font-size: 0.9rem; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 0.85rem; margin-bottom: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
label, .flabel { display: block; font-size: 0.85rem; font-weight: 600; color: var(--blue-900); }
label .opt, .flabel .opt { font-weight: 400; color: var(--muted); }
input[type="text"], input[type="date"], input[type="number"], select, textarea {
  display: block; width: 100%; margin-top: 0.25rem; padding: 0.5rem 0.6rem; font: inherit; font-size: 0.95rem; color: var(--ink);
  background: var(--white); border: 1px solid #b7c7dc; border-radius: 4px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--orange-500); outline-offset: 1px; border-color: var(--blue-600);
}
input.err, select.err { border-color: var(--bad); background: var(--bad-bg); }
.hint { color: var(--muted); font-size: 0.8rem; font-weight: 400; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0 0.25rem; }
.btn { font: inherit; font-size: 0.92rem; font-weight: 600; padding: 0.5rem 0.95rem; border-radius: 4px; border: 1px solid transparent; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.3; }
.btn.primary { background: var(--orange-500); color: #1b1000; border-color: var(--orange-600); }
.btn.primary:hover { background: var(--orange-600); color: var(--white); }
.btn.secondary { background: var(--white); color: var(--blue-700); border-color: var(--blue-600); }
.btn.secondary:hover { background: var(--blue-100); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn.ghost:hover { background: var(--blue-100); color: var(--blue-900); }
.btn.small { padding: 0.3rem 0.6rem; font-size: 0.82rem; }
.btn.icon { padding: 0.25rem 0.55rem; }

/* ---------- tables ---------- */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
table.data th { background: var(--blue-100); color: var(--blue-900); text-align: right; font-weight: 600; padding: 0.45rem 0.6rem; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td { padding: 0.4rem 0.6rem; border-bottom: 1px solid #e6edf6; text-align: right; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tfoot td { font-weight: 700; background: var(--blue-50); border-top: 2px solid var(--blue-200); }
table.data td.left, table.data th.left { text-align: left; }
table.input-table td { padding: 0.25rem 0.3rem; }
table.input-table input, table.input-table select { margin-top: 0; padding: 0.4rem 0.45rem; }
table.input-table td:first-child { width: 3.6rem; color: var(--muted); font-weight: 600; padding-left: 0.6rem; }
table.input-table th { text-align: left; }
table.input-table td { text-align: left; white-space: normal; }

/* ---------- results ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 0.7rem 0.9rem; }
.stat .k { font-size: 0.78rem; color: var(--muted); }
.stat .v { font-size: 1.3rem; font-weight: 700; color: var(--blue-900); font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat .n { font-size: 0.8rem; color: var(--muted); }
.stat.big { border-left: 4px solid var(--orange-500); }
.chip { display: inline-block; font-size: 0.8rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 99px; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--blue-100); color: var(--blue-700); }
.notice { border-left: 4px solid var(--orange-500); background: var(--orange-100); padding: 0.65rem 0.9rem; border-radius: 0 4px 4px 0; font-size: 0.9rem; margin-bottom: 1rem; }
.notice.bad { border-left-color: var(--bad); background: var(--bad-bg); }
.empty { color: var(--muted); border: 1px dashed var(--blue-200); border-radius: 6px; padding: 2rem 1.25rem; text-align: center; background: var(--white); }
.plot { width: 100%; height: auto; display: block; background: var(--white); border: 1px solid var(--line); border-radius: 4px; }

/* ---------- output text ---------- */
.output { width: 100%; min-height: 260px; font-family: var(--serif); font-size: 1.02rem; line-height: 1.6; padding: 0.9rem 1rem; }
.paper { background: var(--white); border: 1px solid var(--line); border-radius: 2px; padding: 2.2rem 2.4rem; font-family: var(--serif); font-size: 12pt; line-height: 1.5; color: #000; box-shadow: 0 1px 0 var(--line); }
.paper p { margin: 0 0 0.9em; }
.paper table { border-collapse: collapse; width: 100%; margin: 0.6em 0 0.9em; font-size: 11pt; }
.paper th, .paper td { border: 1px solid #444; padding: 0.3em 0.55em; text-align: left; vertical-align: top; }
.paper td.num, .paper th.num { text-align: right; }
.paper .sig { margin-top: 2.2em; }
.paper .recv { margin-top: 2em; border-top: 1px dashed #666; padding-top: 0.8em; font-size: 11pt; }

/* ---------- hub ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 2rem; align-items: center; margin-bottom: 2rem; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }
.hero-art { background: var(--white); border: 1px solid var(--line); border-radius: 6px; padding: 0.75rem; }
.tool-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
@media (max-width: 760px) { .tool-list { grid-template-columns: 1fr; } }
.tool { display: flex; flex-direction: column; gap: 0.5rem; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--blue-600); border-radius: 0 0 6px 6px; padding: 1.1rem 1.25rem 1.15rem; text-decoration: none; color: inherit; }
.tool.paperwork { border-top-color: var(--orange-500); }
.tool:hover { background: var(--blue-50); }
.tool h2 { font-size: 1.15rem; }
.tool p { color: var(--muted); margin: 0; font-size: 0.94rem; }
.tool .go { margin-top: auto; font-weight: 700; color: var(--blue-700); font-size: 0.92rem; }
.tool ul { margin: 0.2rem 0 0.4rem; padding-left: 1.1rem; color: var(--ink); font-size: 0.88rem; }

/* ---------- progress ---------- */
.progress { height: 10px; background: var(--blue-100); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--orange-500); width: 0; transition: width 0.25s; }
.check-group { margin-bottom: 1.1rem; }
.check-group h3 { margin-bottom: 0.4rem; padding-bottom: 0.3rem; border-bottom: 2px solid var(--blue-100); }
.check { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.35rem 0.25rem; font-weight: 400; font-size: 0.95rem; color: var(--ink); cursor: pointer; border-radius: 4px; }
.check:hover { background: var(--blue-50); }
.check input { margin-top: 0.3rem; width: 1.05rem; height: 1.05rem; accent-color: var(--orange-600); flex: none; }
.check.done span { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--blue-200); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line); background: var(--white); }
.foot-in { max-width: 1200px; margin: 0 auto; padding: 1.1rem 1.25rem 1.6rem; color: var(--muted); font-size: 0.85rem; }
.foot-in p { margin: 0 0 0.35rem; max-width: 900px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- print ---------- */
@media print {
  body { background: #fff; font-size: 11pt; }
  .topbar, .subbar, .foot, .no-print, .btn-row { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .layout, .layout.wide-left { display: block; }
  .card, .stat { border-color: #999; break-inside: avoid; }
  .paper { border: 0; box-shadow: none; padding: 0; }
  .print-only { display: block !important; }
  .table-wrap { overflow: visible; }
  table.data { font-size: 9pt; }
}
.print-only { display: none; }

/* ---------- bearing picker ---------- */
.bpick { display: inline-flex; align-items: center; gap: 1px; flex-wrap: nowrap; white-space: nowrap; }
.bpick select { width: auto; min-width: 0; margin-top: 0; padding: 0.38rem 0.1rem 0.38rem 0.25rem; font-size: 0.9rem; }
.bpick .bp-ns, .bpick .bp-ew { min-width: 2.9rem; }
.bpick .bp-d { min-width: 3.5rem; }
.bpick .u { color: var(--muted); font-size: 0.9rem; margin: 0 4px 0 1px; }
.bpick.err select { border-color: var(--bad); background: var(--bad-bg); }
table.input-table td.bc { white-space: nowrap; }

/* ---------- stage toggle ---------- */
.seg { display: inline-flex; border: 1px solid var(--blue-600); border-radius: 4px; overflow: hidden; background: var(--white); }
.seg button { font: inherit; font-size: 0.92rem; font-weight: 600; padding: 0.5rem 1rem; border: 0; background: transparent; color: var(--blue-700); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--blue-600); }
.seg button[aria-pressed="true"] { background: var(--blue-700); color: var(--white); }
.seg button:not([aria-pressed="true"]):hover { background: var(--blue-100); }
.stage-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.check-inline { display: inline-flex; gap: 0.4rem; align-items: center; font-weight: 400; font-size: 0.9rem; color: var(--ink); }
.check-inline input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--orange-600); }

/* ---------- saved-work backup ---------- */
.banner { max-width: 1200px; margin: 0 auto; padding: 0.6rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; flex-wrap: wrap; font-size: 0.92rem; }
#geo-banner { background: var(--orange-100); border-bottom: 1px solid var(--orange-500); }
#geo-banner:has(.banner.bad) { background: var(--bad-bg); border-bottom-color: var(--bad); }
.banner .btn-row { margin: 0; }
.data-panel { border: 1px solid var(--line); border-left: 4px solid var(--blue-600); border-radius: 6px; background: var(--blue-50); padding: 0.9rem 1.1rem; margin-bottom: 1.1rem; max-width: 900px; }
.data-panel h2 { font-size: 1rem; margin-bottom: 0.35rem; }
.data-panel p { margin: 0 0 0.4rem; }
.data-panel .btn-row { margin: 0.5rem 0 0.4rem; }
.data-panel .notice { margin: 0.5rem 0 0; }

/* ---------- tooltips and help ---------- */
.tipsw { display: inline-flex; align-items: center; gap: 0.5rem; font: inherit; font-size: 0.88rem; color: var(--blue-200); background: transparent; border: 1px solid rgba(188, 211, 239, 0.4); border-radius: 99px; padding: 0.2rem 0.7rem 0.2rem 0.35rem; cursor: pointer; }
.tipsw:hover { color: var(--white); border-color: var(--white); }
.tipsw-track { width: 2rem; height: 1.1rem; border-radius: 99px; background: var(--orange-500); position: relative; transition: background 0.15s; flex: none; }
.tipsw-dot { position: absolute; top: 2px; left: calc(100% - 1rem + 2px); width: calc(1.1rem - 4px); height: calc(1.1rem - 4px); border-radius: 50%; background: var(--white); transition: left 0.15s; }
.tipsw[aria-checked="false"] .tipsw-track { background: #6b7f98; }
.tipsw[aria-checked="false"] .tipsw-dot { left: 2px; }
.tipsw-state { font-weight: 700; min-width: 1.7rem; text-align: left; }
.tip-i { display: inline-flex; align-items: center; justify-content: center; width: 1.1rem; height: 1.1rem; margin: 0 0 0 0.35rem; padding: 0; vertical-align: middle; font: inherit; font-size: 0.72rem; font-weight: 700; line-height: 1; color: var(--blue-700); background: var(--blue-100); border: 1px solid var(--blue-200); border-radius: 50%; cursor: help; }
.tip-i:hover, .tip-i:focus-visible { background: var(--blue-700); color: var(--white); border-color: var(--blue-700); }
.tips-off .tip-i { display: none; }
#geo-tip { position: absolute; z-index: 1000; max-width: min(20rem, calc(100vw - 16px)); padding: 0.55rem 0.7rem; background: var(--blue-900); color: var(--white); font-size: 0.85rem; font-weight: 400; line-height: 1.4; border-radius: 6px; border-left: 3px solid var(--orange-500); box-shadow: 0 4px 14px rgba(10, 47, 92, 0.3); pointer-events: none; }
@media print { .tipsw, .tip-i, #geo-tip { display: none !important; } }

.help-search { max-width: 520px; margin: 0 0 1.25rem; }
.help-toc { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; margin: 0 0 1.5rem; padding: 0; list-style: none; }
.help-toc a { display: inline-block; padding: 0.3rem 0.75rem; border: 1px solid var(--blue-200); border-radius: 99px; background: var(--white); color: var(--blue-700); text-decoration: none; font-size: 0.9rem; }
.help-toc a:hover { background: var(--blue-100); }
.help-sec { scroll-margin-top: 1rem; }
.help-sec h2 { font-size: 1.25rem; margin-bottom: 0.6rem; }
.help-sec h3 { margin: 1rem 0 0.3rem; }
.help-sec ul, .help-sec ol { margin: 0 0 0.75rem; padding-left: 1.3rem; }
.help-sec li { margin-bottom: 0.3rem; }
.help-sec dl { margin: 0; }
.help-sec dt { font-weight: 700; color: var(--blue-900); margin-top: 0.7rem; }
.help-sec dd { margin: 0.1rem 0 0; color: var(--ink); }
.help-sec kbd { font-family: inherit; font-size: 0.85em; padding: 0.05rem 0.35rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--blue-50); }
