:root {
  /* The Insight tokens (insight-brand.css, loaded first) under the names this stylesheet uses. */
  --bg: var(--background); --line: var(--border); --line-2: var(--surface-2);
  --text: var(--foreground); --muted: var(--text-2); --brand: var(--primary-strong); --brand-2: var(--primary-hover); --brand-ink: var(--primary-foreground);
  --accent: var(--teal-text); --danger: var(--destructive); --warn-bg: var(--warning-light); --warn-ink: var(--warning-text); --ok: var(--success);
  --sel: var(--primary-tint); --hover: var(--surface-2); --shadow: var(--shadow-lg);
  --top: var(--topbar-h); --menu: var(--sidebar-w);
  --font-insight-sans: "Plus Jakarta Sans";
  font-size: 14px; color: var(--text);
}
/* Avenir is used where the device has it; everywhere else this, served from the app itself. */
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 200 800; font-display: swap; src: url(/fonts/plus-jakarta-sans-latin-wght-normal.woff2) format("woff2"); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
a { color: var(--brand); }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .pad { padding: 8px 10px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.error-box { margin: 16px; padding: 12px 14px; border: 1px solid var(--danger); color: var(--danger); border-radius: var(--radius); background: var(--surface); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 8px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 12px; text-align: center; }
.chip { display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0; border-radius: 12px; background: var(--sel); font-size: 12.5px; }

/* controls */
.btn { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover:not(:disabled) { background: var(--brand-2); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--brand); padding: 0; text-decoration: underline; }
.input { font: inherit; padding: 5px 8px; border: 1px solid var(--border-2); border-radius: 4px; background: var(--surface); color: var(--text); max-width: 100%; }
.input:focus, .btn:focus-visible, .tab:focus-visible, .menu-item:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
textarea.input { width: 100%; resize: vertical; }
.menu-wrap { position: relative; display: inline-block; }
.menu-pop { position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 210px; max-width: calc(100vw - 16px); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px; }
.menu-pop.up { top: auto; bottom: calc(100% + 4px); } .menu-pop.right { left: auto; right: 0; }
.menu-pop hr { border: 0; border-top: 1px solid var(--line-2); margin: 4px 0; }
.menu-item { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; border-radius: 4px; padding: 7px 10px; cursor: pointer; }
.menu-item:hover:not(:disabled) { background: var(--hover); } .menu-item:disabled { color: var(--muted); cursor: default; }
.menu-label { padding: 6px 10px; color: var(--muted); font-size: 12.5px; }

/* shell: the navy Insight sidebar runs the full height, the top bar sits beside it */
.topbar { position: fixed; inset: 0 0 auto var(--menu); height: var(--top); z-index: 40; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: var(--surface); color: var(--text); border-bottom: 1px solid var(--line); }
.topbar .btn { background: transparent; border-color: transparent; color: var(--text); padding: 6px 9px; }
.topbar .btn:hover { background: var(--hover); }
.topbar .menu-pop { color: var(--text); }
.product { font-weight: 700; letter-spacing: .01em; white-space: nowrap; }
.product small { font-weight: 400; opacity: .8; margin-left: 6px; }
.screen-title { font-size: 15px; padding-left: 12px; border-left: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.banner { padding: 3px 10px; border-radius: 12px; background: var(--warn-bg); color: var(--warn-ink); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.sidemenu { position: fixed; top: 0; bottom: 0; left: 0; width: var(--menu); z-index: 30; display: flex; flex-direction: column; background: var(--sidebar-bg); color: var(--sidebar-fg); overflow: auto; }
.sidemenu .side-logo { flex: none; display: flex; align-items: center; height: var(--top); padding: 0 16px; border-bottom: 1px solid var(--sidebar-border); }
.sidemenu a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; color: var(--sidebar-fg); text-decoration: none; border-left: 3px solid transparent; }
.sidemenu a:hover { background: var(--sidebar-hover); }
.sidemenu a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); border-left-color: var(--sidebar-accent); font-weight: 600; }
.sidemenu .ico { width: 22px; text-align: center; font-size: 16px; }
.sidemenu .grow { flex: 1; }
.sidemenu .logout { border-top: 1px solid var(--line-2); }
@media (min-width: 1101px) { body.menu-closed .sidemenu { display: none; } body.menu-closed .main { margin-left: 0; } body.menu-closed .topbar { left: 0; } }
.main { margin: var(--top) 0 0 var(--menu); min-height: calc(100vh - var(--top)); display: flex; flex-direction: column; }
.content { flex: 1; padding: 16px 20px; }
.footer { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 20px; border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--muted); }
.footer a { color: var(--muted); }
.resource-btn { position: fixed; right: 16px; bottom: 16px; z-index: 35; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.page-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* A card is as wide as what it holds: at least 720px (or the whole width when narrower), at most the whole width. */
.card { width: fit-content; min-width: min(100%, 720px); max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-actions { display: flex; gap: 8px; margin-top: 14px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 380px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 26px; box-shadow: var(--shadow); }
.login-card h1 { margin-bottom: 12px; } .login-card .field { margin-top: 12px; display: block; } .login-card .input { width: 100%; }
.login-card .demo { margin-top: 16px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line-2); padding-top: 12px; }
.login-card .demo button { margin: 3px 4px 0 0; }
.login-card .btn.wide { flex: 1; text-align: center; text-decoration: none; padding: 9px 12px; }
.login-card .or { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* grid */
.grid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grid-bar { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; flex-wrap: wrap; border-bottom: 1px solid var(--line-2); }
.grid-tools, .grid-right { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.grid-search { width: 190px; }
.grid-wrap { overflow: auto; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; white-space: nowrap; user-select: none; }
.table th.sortable { cursor: pointer; } .table th.sorted { color: var(--brand); }
.table tbody tr:hover { background: var(--hover); } .table tr.selected { background: var(--sel); }
.table td.num { text-align: right; } .table td.ctr { text-align: center; }
.table .sel { width: 30px; text-align: center; }
.table.compact th, .table.compact td { padding: 4px 8px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.grid-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 8px 10px; border-top: 1px solid var(--line-2); font-size: 13px; flex-wrap: wrap; }
.filter { font-size: 13px; white-space: nowrap; }
.flag { border: 0; background: none; cursor: pointer; font-size: 15px; padding: 0 3px; color: var(--muted); }
.flag.on { color: #c77700; } .flag.conf.on { color: var(--danger); }
.cell-link { color: var(--brand); cursor: pointer; text-decoration: underline; background: none; border: 0; font: inherit; padding: 0; }

/* views */
.view-layout { display: flex; gap: 14px; align-items: flex-start; }
.view-panel { width: 220px; flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.view-main { flex: 1; min-width: 0; }
.view-head { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.view-group { margin: 8px 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.view-item { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; border-radius: 4px; padding: 6px 8px; cursor: pointer; }
.view-item:hover { background: var(--hover); } .view-item.active { background: var(--sel); font-weight: 600; }

/* dialogs */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(10, 20, 30, .45); display: grid; place-items: center; padding: 16px; }
.modal { max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal.max { width: calc(100vw - 32px) !important; height: calc(100vh - 32px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px 9px 16px; background: var(--brand-navy); color: var(--sidebar-active-fg); border-radius: 8px 8px 0 0; }
.modal-title { font-weight: 600; }
.modal .tool { background: none; border: 0; color: var(--sidebar-active-fg); font-size: 14px; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.modal .tool:hover { background: rgba(255, 255, 255, .18); }
.modal-body { padding: 16px; overflow: auto; flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.modal-foot .btn.danger:first-child { margin-right: auto; } /* a destructive action sits apart from Save */
.msg-text { margin: 0; white-space: pre-wrap; line-height: 1.45; }
.toasts { position: fixed; top: 58px; right: 16px; z-index: 200; display: grid; gap: 8px; }
.toast { padding: 9px 14px; border-radius: var(--radius); background: var(--ok); color: #fff; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }

/* tabs */
.tabs-head { display: flex; gap: 2px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { font: inherit; padding: 8px 14px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; background: none; color: var(--muted); cursor: pointer; }
.tab.active { background: var(--surface); border-color: var(--line); color: var(--text); font-weight: 600; margin-bottom: -1px; }
.tab-pane { padding: 14px 2px 2px; }

/* sections & fields */
.sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; scroll-margin-top: calc(var(--top) + 10px); }
.sec-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 14px; font: inherit; font-weight: 600; font-size: 15px; color: var(--text); background: var(--surface-2); border: 0; border-radius: var(--radius); cursor: pointer; text-align: left; }
.sec-caret::before { content: "▾"; display: inline-block; width: 12px; } .sec-head[aria-expanded="false"] .sec-caret::before { content: "▸"; }
.sec-body { padding: 14px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; }
.fields.one { grid-template-columns: 1fr; }
.field { min-width: 0; } .field.wide, .fields .wide { grid-column: 1 / -1; }
.field-label { font-weight: 600; margin-bottom: 4px; font-size: 13.5px; }
.field.inline { display: flex; flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; } .field.inline .field-label { margin: 0; font-weight: 400; }
.field-ctl > .input { width: 100%; } .field-ctl > input[type=date].input, .field-ctl > input[type=time].input, .field-ctl > input[type=number].input { width: auto; min-width: 150px; }
.req { color: var(--danger); }
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 6px; border-radius: 50%; background: var(--line); color: var(--text); font-size: 11px; font-style: italic; font-weight: 700; cursor: help; }
.field.invalid .field-label { color: var(--danger); } .field.invalid .input { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.radios { display: flex; gap: 16px; flex-wrap: wrap; } .radio, .check { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.checklist { display: grid; gap: 6px; max-height: 50vh; overflow: auto; margin-top: 8px; }
.multipick { display: flex; gap: 10px; align-items: flex-start; } .mp-values { flex: 1; min-height: 24px; }
.display { padding: 5px 0; }
.locpick { position: relative; } .loc-row { display: flex; gap: 6px; } .loc-row .input { flex: 1; }
.loc-results { position: absolute; z-index: 20; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 260px; overflow: auto; }
.loc-hit { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); background: none; border: 0; padding: 7px 10px; cursor: pointer; } .loc-hit:hover { background: var(--hover); } .loc-hit small { color: var(--muted); }
.loc-parts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.list-tools { display: flex; gap: 6px; margin-bottom: 6px; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); margin-bottom: 8px; } .dropzone.over { border-color: var(--brand); background: var(--sel); }

/* form page */
.form-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.form-side { position: sticky; top: calc(var(--top) + 12px); display: grid; gap: 12px; }
.toc, .file-status { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.toc a { display: block; padding: 4px 0; text-decoration: none; font-size: 13.5px; } .toc a:hover { text-decoration: underline; } .toc h3, .file-status h3 { margin-bottom: 6px; }
.meter { height: 8px; border-radius: 4px; background: var(--line-2); margin-top: 8px; overflow: hidden; } .meter span { display: block; height: 100%; background: var(--accent); }
.form-foot { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 8px; align-items: center; padding: 10px 14px; margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -2px 10px rgba(0, 0, 0, .06); flex-wrap: wrap; }
.form-foot .spacer { flex: 1; } .saved-flag { color: var(--ok); font-weight: 600; }
.org-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; color: var(--muted); }
.org-logo img { display: block; }
.notif-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.header-summary { display: flex; gap: 26px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); } .header-summary b { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.anon-banner { padding: 8px 14px; margin-bottom: 12px; border-radius: var(--radius); background: var(--warn-bg); color: var(--warn-ink); font-weight: 600; }

/* icon wall */
.wall-controls { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.wall-controls .input[type=search] { width: 260px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.tile:hover { border-color: var(--brand); box-shadow: 0 2px 10px rgba(0, 0, 0, .08); }
.tile-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; }
.tile-name { font-weight: 600; font-size: 15px; }
.tile-desc { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-tools { display: flex; gap: 10px; margin-top: auto; font-size: 12.5px; }

/* admin home */
.admin-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.admin-group h2 { margin-bottom: 8px; } .admin-group a { display: block; padding: 4px 0; text-decoration: none; } .admin-group a:hover { text-decoration: underline; }
.modal.window .modal-body { min-height: 300px; }

@media (max-width: 1280px) { .product small { display: none; } .topbar { gap: 4px; } .topbar .btn { padding: 6px 6px; font-size: 13px; } }
/* At 1100px and below the menu is a drawer over the page, opened with the menu button. */
@media (max-width: 1100px) {
  .screen-title { display: none; } .banner { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  :root { --menu: 0px; } .sidemenu { top: var(--top); width: var(--sidebar-w); box-shadow: var(--shadow); } .sidemenu .side-logo { display: none; } body:not(.menu-open) .sidemenu { display: none; }
}
@media (max-width: 900px) {
  .form-layout { grid-template-columns: 1fr; } .form-side { position: static; } .fields { grid-template-columns: 1fr; } .view-layout { flex-direction: column; } .view-panel { width: 100%; }
  .screen-title { display: none; }
}
@media print { .topbar, .sidemenu, .footer, .resource-btn, .form-foot, .form-side, .grid-bar, .grid-foot { display: none !important; } .main { margin: 0; } }
