@import url("./site.css");

body.app {
  background: #eef1f5;
  min-height: 100vh;
}
body.laterus-embed .sidebar { display: none; }
body.laterus-embed .app-shell { grid-template-columns: 1fr; }
body.laterus-embed .org-box { display: none; }
.rca-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
.rca-path h3 { font-family: var(--display); font-size: 1rem; color: var(--navy-deep); }

.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--navy-deep);
  color: #d7e2ef;
  padding: 1.1rem .9rem;
  display: flex; flex-direction: column; gap: .75rem;
  /* Seventy-nine rows do not fit a screen. Pin the rail and let the nav
     scroll inside it, so the org picker stays reachable at the bottom
     instead of being pushed a page and a half down. */
  position: sticky; top: 0; height: 100vh;
}
/* After the base rule, not before it: both selectors are (0,1,0), so the
   narrow-screen overrides only win on source order. */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  /* One column: the sidebar sits above the content, so pinning it to the full
     viewport height would bury the page. Let it size to its content, capped. */
  .sidebar { z-index: 5; height: auto; max-height: 100vh; }
}
.sidebar .brand { color: #fff; }
.sidebar nav { display: flex; flex-direction: column; gap: .25rem; margin-top: .5rem; }
.sidebar a {
  color: #b7c7d9; text-decoration: none; padding: .55rem .7rem; border-radius: 8px; font-size: .92rem;
}
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }

/* Administration nav ------------------------------------------------------
   The sidebar is one nav rendered from the server taxonomy: eleven groups,
   seventy-nine rows. It only stays usable because each group is a native
   <details>, so the list is scrollable and the sections keyboard-operable
   without a line of toggle JS. */
#admin-nav { gap: .1rem; overflow-y: auto; min-height: 0; }
#admin-nav ul { list-style: none; margin: 0; padding: 0; }
#admin-nav .nav-group { border-radius: 8px; }
#admin-nav summary {
  list-style: none;                 /* the UA marker, replaced below */
  cursor: pointer;
  display: flex; align-items: center; gap: .45rem;
  padding: .45rem .55rem;
  border-radius: 8px;
  font-size: .74rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: #8ea4bd;
}
#admin-nav summary::-webkit-details-marker { display: none; }
/* A drawn marker rather than the UA triangle, to match the gold-on-navy
   language the rest of the shell uses. It rotates with the open state, which
   is the element's own attribute — no JS keeps it in sync. */
#admin-nav summary::before {
  content: "";
  width: 0; height: 0; flex: none;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .12s ease;
}
#admin-nav .nav-group[open] > summary::before { transform: rotate(90deg); }
#admin-nav summary:hover { color: #fff; background: rgba(255,255,255,.06); }
#admin-nav summary:focus-visible {
  outline: 2px solid var(--gold-soft); outline-offset: 1px;
}
#admin-nav li a { display: block; padding: .38rem .55rem .38rem 1.35rem; font-size: .86rem; }

/* Row state, set by app.js from ADMIN_LEAF_VIEWS. Quiet on purpose: the
   point is to tell a working screen from a signpost from an empty room at a
   glance, not to shout about how much of the taxonomy is unbuilt. Nothing
   here hides a row — every granted destination stays visible and clickable.

   These state selectors are (1,1,1) and so out-specify `.sidebar a:hover`
   (0,2,1); each state therefore restates its own hover colour, and .active
   is written with the attribute too — (1,2,1) — so the current row reads as
   current whatever state it is in. */
#admin-nav a[data-state="elsewhere"] { color: #9db2c8; }
#admin-nav a[data-state="elsewhere"]::after {
  content: "→"; margin-left: .35rem; font-size: .8em; opacity: .65;
}
#admin-nav a[data-state="elsewhere"]:hover { color: #fff; }
#admin-nav a[data-state="unbuilt"] { color: #6b8099; }
#admin-nav a[data-state="unbuilt"]:hover { color: #b7c7d9; }
#admin-nav a.active[data-state] { background: rgba(255,255,255,.10); color: #fff; }

.sidebar .org-box {
  margin-top: auto; background: rgba(255,255,255,.06); border-radius: 10px; padding: .75rem;
}
.sidebar select, .topbar select, .form select, .form input, .form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .65rem;
  font: inherit; background: #fff; color: var(--ink);
}
.sidebar select { background: #0f1f33; color: #e8eef6; border-color: #2a4160; }

.raci-pill {
  display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 700; text-align: center;
}
.raci-pill.R { background: #dde8f5; color: #1f5d8c; }
.raci-pill.A { background: #fff7df; color: #9b6a17; }
.raci-pill.C { background: #e0f3e0; color: #2d5a3d; }
.raci-pill.I { background: #ece8d9; color: #5a5a5a; }
.raci-table { min-width: 640px; }
.raci-table th.raci-role { text-align: center; font-size: 11px; line-height: 1.3; white-space: nowrap; }
.raci-table td.raci-cell { text-align: center; padding: 2px; }
.raci-cell button {
  border: 0; background: none; cursor: pointer; padding: 2px 4px; border-radius: 10px;
  font: inherit; line-height: 1;
}
.raci-cell button:hover { background: #e8edf3; }
.raci-cell button:focus-visible { outline: 2px solid var(--navy-deep); outline-offset: 1px; }
.raci-cell button[disabled] { cursor: progress; opacity: .5; }
.raci-table tr.raci-group td {
  background: #e8edf3; color: var(--navy-deep); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 1.15rem; font-family: var(--display); color: var(--navy-deep); }
.content { padding: 1.25rem; }

.admin-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 800px) {
  .admin-layout { grid-template-columns: 1fr; }
}
.admin-cats {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .5rem;
  display: flex;
  flex-direction: column;
}
.admin-cats a {
  color: var(--ink);
  text-decoration: none;
  padding: .5rem .7rem;
  border-radius: 8px;
  font-size: .9rem;
}
.admin-cats a.active, .admin-cats a:hover {
  background: var(--paper-2);
  color: var(--navy-deep);
}
.admin-body { min-width: 0; }
@media print {
  .sidebar, .topbar, .toolbar, .form, nav { display: none !important; }
  .app-shell { display: block; }
}

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1rem; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1rem;
  display: block; color: inherit;
}
.kpi .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.kpi .value { font-size: 1.6rem; font-weight: 700; color: var(--navy-deep); margin-top: .2rem; }

.toolbar {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem;
}
.toolbar .field { display: flex; flex-direction: column; gap: .25rem; min-width: 140px; }
.toolbar label, .form label { font-size: .78rem; color: var(--ink-soft); font-weight: 600; }

.table-wrap {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: auto;
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .7rem .85rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #faf8f4; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); }
tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--paper-2); color: var(--ink-soft);
}
.badge.open { background: #e7f0ff; color: #1e4a8c; }
.badge.in_progress { background: #fff4d6; color: #7a5a00; }
.badge.blocked { background: #fde8e8; color: var(--danger); }
.badge.done { background: #e5f5ec; color: var(--ok); }
.badge.draft, .badge.cancelled { background: #eee; color: #555; }
.badge.urgent, .badge.high { background: #fde8e8; color: var(--danger); }
.badge.breached { background: #fde8e8; color: var(--danger); }
.badge.at_risk { background: #fff4d6; color: #7a5a00; }
.badge.on_track { background: #e5f5ec; color: var(--ok); }
.badge.closed { background: #eee; color: #555; }

.form {
  display: grid; gap: .75rem; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 1rem; margin-bottom: 1rem;
}
.form.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .form.grid-2 { grid-template-columns: 1fr; } }
.form .full { grid-column: 1 / -1; }
.form textarea { min-height: 80px; resize: vertical; }
a.kpi:hover, a.card:hover { box-shadow: var(--shadow); }

.muted { color: var(--ink-soft); font-size: .9rem; }
.error { color: var(--danger); }
.ok { color: var(--ok); }

.login-card {
  max-width: 420px; margin: 4rem auto; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: 1.5rem; box-shadow: var(--shadow);
}
.login-card h1 { font-family: var(--display); margin: 0 0 .5rem; color: var(--navy-deep); }
.login-fallback { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .75rem; }
.login-fallback summary { color: var(--ink-soft); cursor: pointer; font-size: .82rem; }
.login-fallback p { margin: .65rem 0; }
.hidden { display: none !important; }

.reach-checks { display: flex; flex-wrap: wrap; gap: 0.45rem 1rem; }
.reach-check { display: flex; align-items: center; gap: 0.35rem; font-size: 0.9rem; }
.reach-list { margin: 0; padding-left: 1.1rem; font-size: 0.85rem; }

/* Rendered role description, as a candidate would read it.
   Constrained to a reading measure rather than the table's full width: a
   posting is prose, and prose set to 1600px is not what anyone approving it
   will actually be looking at on the public page. */
.jd-preview {
  max-width: 68ch;
  padding: 4px 2px 10px;
  line-height: 1.55;
}
.jd-preview h2 {
  font-size: 1rem;
  margin: 16px 0 6px;
  color: var(--ink);
}
.jd-preview h2:first-child { margin-top: 4px; }
.jd-preview h3 {
  font-size: .9rem;
  margin: 12px 0 4px;
  color: var(--ink-soft);
}
.jd-preview p { margin: 0 0 8px; }
.jd-preview ul { margin: 0 0 10px; padding-left: 20px; }
.jd-preview li { margin: 2px 0; }
.jd-preview strong { font-weight: 600; }
tr.jd-body > td { background: var(--surface-2, #fafafa); }

.gantt { overflow-x: auto; margin: 0.75rem 0 1.25rem; }
.gantt-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--ink-soft, #5b6570); margin: 0 0 0.35rem 180px; }
.gantt-row { display: grid; grid-template-columns: 180px 1fr; gap: 8px; align-items: center; margin-bottom: 8px; }
.gantt-label { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gantt-track { position: relative; height: 22px; background: #e6ebf1; border-radius: 4px; }
.gantt-bar {
  position: absolute; top: 2px; height: 18px; background: var(--navy, #1d3557);
  border-radius: 3px; color: #fff; font-size: 11px; line-height: 18px;
  padding: 0 6px; overflow: hidden; white-space: nowrap; box-sizing: border-box;
}
.gantt-bar.complete { background: #2f6f4e; }
.gantt-bar.active { background: #c45c26; }
.gantt-mark {
  position: absolute; top: -3px; width: 0; height: 0; margin-left: -6px;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-bottom: 10px solid #1d3557;
}
.gantt-today { position: absolute; top: 0; bottom: 0; width: 2px; background: #c45c26; pointer-events: none; }
.gantt-dep { position: absolute; height: 2px; background: #1d3557; opacity: 0.35; }
.gantt-mark-label {
  position: absolute; left: 8px; top: 10px; font-size: 0.7rem; color: #1d3557;
  white-space: nowrap; font-weight: 500; pointer-events: none;
}
.drawing-stage {
  position: relative; background: repeating-linear-gradient(0deg, #edf0f4, #edf0f4 24px, #e3e8ee 25px),
    repeating-linear-gradient(90deg, #edf0f4, #edf0f4 24px, #e3e8ee 25px);
  min-height: 360px; border: 1px solid #c5cdd6; border-radius: 4px; cursor: crosshair;
}
.drawing-stage img { width: 100%; display: block; pointer-events: none; }
.drawing-pin, .drawing-box, .drawing-note { pointer-events: none; }
.drawing-marks { list-style: none; padding: 0; margin: .5rem 0 0; }
.drawing-marks li { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-size: .85rem; margin: .25rem 0; }
.drawing-pin {
  position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: #c45c26; border: 2px solid #fff; box-shadow: 0 0 0 1px #1d3557;
}
.drawing-box {
  position: absolute; border: 2px solid #c45c26; background: rgba(196, 92, 38, 0.12); box-sizing: border-box;
}
.drawing-note {
  position: absolute; transform: translate(-50%, -110%);
  background: #1d3557; color: #fff; font-size: 11px; padding: 2px 6px; border-radius: 3px; white-space: nowrap;
}
.bim-storeys { display: flex; gap: 0.25rem; flex-wrap: wrap; margin: 0.5rem 0; }
.bim-storey {
  font: inherit; font-size: 0.8rem; padding: 0.2rem 0.6rem;
  border: 1px solid #c5cdd6; background: #fff; color: #1d3557;
  border-radius: 4px; cursor: pointer;
}
.bim-storey.is-active { background: #1d3557; color: #fff; border-color: #1d3557; }
.bim-plan {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}
.bim-plan svg { width: 100%; height: auto; display: block; background: #f7f5f0; border: 1px solid #c5cdd6; border-radius: 4px; }
.bim-plan.has-floorplan svg { background: transparent; }
.bim-plan g[data-asset-id] { cursor: pointer; }
.iot-spark { display: inline-block; vertical-align: middle; color: #1d3557; }
.iot-spark polyline { fill: none; }
.aia-math { font-variant-numeric: tabular-nums; max-width: 36rem; }
.aia-math td:last-child { text-align: right; font-weight: 600; }
