:root {
  --navy: #0b1f3a;
  --navy-2: #1a365d;
  --teal: #0f766e;
  --teal-ink: #115e59;
  --ink: #0f172a;
  --muted: #5a6570;
  --line: #d7dee7;
  --paper: #f3f6f9;
  --card: #ffffff;
  --wash: #e8f1f4;
  --danger: #9b2c2c;
  --ok: #0f766e;
  --shadow: 0 12px 36px rgba(11, 31, 58, 0.08);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 "Segoe UI", Calibri, "Helvetica Neue", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--navy-2); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.top {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 420px) 1fr;
  align-items: center;
  gap: 28px;
  min-height: 64px;
  padding: 12px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--navy);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-self: start;
}
.brand img { height: 36px; width: auto; }
.brand-name {
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--navy);
  font-size: 15px;
}
.brand-sub {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
}
.top-mid {
  flex: 1;
  min-width: 0;
  color: var(--navy-2);
  font-weight: 700;
}
.util-box {
  justify-self: center;
  width: 100%;
  min-width: 220px;
  max-width: 420px;
}
.util-box select {
  width: 100%;
  font-weight: 700;
  color: var(--navy);
}
.who {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.ghost, .linkish {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--navy);
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 650;
}
.ghost:hover, .linkish:hover { background: var(--wash); }
.linkish { border: 0; padding: 6px 8px; }
.primary {
  background: var(--teal);
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
}
.primary:hover { filter: brightness(.97); }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 38%) 1fr;
}
.login-brand {
  background: var(--navy);
  color: #e8eef5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 40px;
}
.login-brand img {
  display: block;
  align-self: flex-start;
  width: auto;
  height: auto;
  max-width: 220px;
  max-height: 56px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 22px;
}
.login-brand h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: .04em;
}
.login-brand p { margin: 0; color: #b7c5d4; max-width: 36ch; }
.login-panel {
  display: grid;
  place-items: center;
  padding: 40px 24px;
  background: var(--card);
}
.login-card { width: min(380px, 100%); }
.login-card h2 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 22px;
}
.sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }
label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 12px 0 6px;
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--teal);
  border-color: var(--teal);
}
.row-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  font-size: 14px;
  color: var(--ink);
}
.row-check input { width: auto; }
.err { color: var(--danger); min-height: 1.2em; font-size: 12px; font-weight: 600; text-align: center; }
.hint { color: var(--muted); font-size: 13px; }

.shell { min-height: calc(100vh - 58px); }
.main { padding: 22px 28px 48px; max-width: 1180px; margin: 0 auto; }
.page-head { text-align: center; }
.page-head h1 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 22px;
  font-weight: 800;
}
.meta { color: var(--muted); font-size: 13px; margin: 0 0 16px; text-align: center; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
}
.toolbar input, .toolbar select {
  flex: 1;
  min-width: 160px;
  max-width: none;
}

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
}
.table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font-weight: 700;
  white-space: nowrap;
}
.table th.sort { cursor: pointer; user-select: none; }
.table th.sort:hover { color: var(--navy); }
.table th .caret { color: var(--teal); margin-left: 4px; }
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--wash); }
.table td.loc { font-weight: 700; color: var(--navy); }
.table td.num { font-variant-numeric: tabular-nums; }
.table td.muted { color: var(--muted); }
.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}

.visit {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}
.rail {
  background: var(--navy);
  color: #d5e0ea;
  padding: 18px 10px 24px;
}
.rail .sec {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8aa0b5;
  padding: 4px 12px 10px;
}
.rail button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #d5e0ea;
  border: 0;
  border-left: 3px solid transparent;
  padding: 10px 12px;
  border-radius: 0 6px 6px 0;
  font-weight: 650;
  margin-bottom: 2px;
}
.rail button:hover { background: rgba(255,255,255,.06); color: #fff; }
.rail button.on {
  background: rgba(15, 118, 110, .28);
  color: #fff;
  border-left-color: var(--teal);
}
.rail button.off { opacity: .45; cursor: default; }
.rail-paper { margin: 0 0 8px; }
.rail-branches {
  display: flex;
  gap: 6px;
  padding: 0 10px 6px 22px;
}
.rail-branch {
  flex: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #d5e0ea;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 4px;
  padding: 5px 6px;
  text-decoration: none;
}
.rail-branch:hover { background: rgba(255,255,255,.1); color: #fff; }
.rail-branch.dim { opacity: .35; cursor: default; }
.visit-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
}
.visit-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 16px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.visit-head h1 {
  margin: 0;
  font-size: 20px;
  color: var(--navy);
}
.visit-head .meta { margin: 6px 0 0; }
.pane {
  flex: 1;
  min-height: 0;
  position: relative;
}
.pane-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.pane-empty, .pane-photos {
  padding: 24px;
}
.pane-scroll {
  overflow: auto;
  padding: 0;
}
.overview {
  padding: 22px 28px 40px;
  max-width: 980px;
}
.overview h2 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 22px;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 20px;
  margin: 12px 0 22px;
}
.facts div { border-bottom: 1px solid var(--line); padding: 8px 0; }
.facts dt { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); text-align: center; }
.facts dd { margin: 2px 0 0; font-weight: 700; color: var(--navy); text-align: center; }
.overview { text-align: center; margin: 0 auto; }
.note-card { text-align: center; }
.note-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 12px;
}
.note-card h3 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.note-card p { margin: 0; white-space: pre-wrap; }
.note-card.hi { border-left: 4px solid var(--teal); }
.pics-head { margin: 22px 0 10px; color: var(--navy); font-size: 15px; }
.pane-summary {
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.pane-summary .pane-frame {
  position: relative;
  min-height: 58vh;
  flex: 1;
}
.pics-wrap { padding: 8px 24px 32px; text-align: center; }
.light-close {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 60;
  background: #fff;
  color: var(--navy);
  border: 0;
  border-radius: 6px;
  padding: 8px 16px;
  font-weight: 700;
}
.fmt-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.fmt-toggle button, .fmt-toggle a {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--navy);
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 650;
  text-decoration: none;
}
.fmt-toggle button.on {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}
.gallery button {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  background: #111;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: 4px;
}
.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(11, 31, 58, .88);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 24px;
}
.lightbox img {
  max-width: min(1100px, 96vw);
  max-height: 92vh;
  box-shadow: var(--shadow);
}
.flash { color: var(--teal); font-weight: 700; margin: 8px 0; }
.editbox {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  max-width: 440px;
}
.site-footer {
  background: var(--navy);
  color: #c5d0dc;
  text-align: center;
  padding: 22px 16px 26px;
  font-size: 13px;
}
.site-footer p { margin: 4px 0; }
.site-footer a { color: #9fd4ce; text-decoration: underline; }
.site-footer a:hover { color: #fff; }
.site-footer .foot-brand { color: #fff; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 22px; }
  .visit { grid-template-columns: 1fr; }
  .rail {
    display: flex;
    gap: 4px;
    overflow: auto;
    padding: 8px;
  }
  .rail .sec { display: none; }
  .rail button { width: auto; white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; border-radius: 6px; }
  .rail button.on { border-bottom-color: var(--teal); }
  .main { padding: 16px 12px 40px; }
  .pane { min-height: 70vh; }
  .who .who-name { display: none; }
}

@media print {
  .top, .rail, .who, .site-footer, .visit-head { display: none !important; }
  .visit, .shell { display: block; }
  .pane-frame { position: static; height: auto; }
}
