/* shell.css - the top bar core adds to every page, and the pieces any
   page may use: (i) tips and icons (shell.js). Loaded after a module's
   own styles; everything is under .dash- so it cannot collide with them.
   Colours and fonts come from the theme (/core/theme.css). The look
   follows bi.abslimited.uk (priority-bi): a dark bar with a thin brand
   rule; the mark, a fine divider and the product name at the left; at
   the right the dashboard and Admin menus (the current one underlined),
   then icons for display options and the account. Menus and tips are
   white cards with a soft shadow; menu entries carry an icon, a title
   and a note. Sizes as priority-bi's: a 68px bar (plus the rule), the
   product name at 20px, menus at 16px. */
.dash-bar {
  --dash-ink: var(--brand-bar-ink, #fff);
  --dash-h: 68px;
  display: flex; align-items: center; gap: 0 8px; flex-wrap: wrap;
  min-height: var(--dash-h); padding: 0 28px; position: relative; z-index: 1000;
  background: var(--brand-bar-bg, #16202b); color: var(--dash-ink);
  border-bottom: 3px solid var(--brand-bar-accent, #3987e5);
  font: 500 16px/1.5 var(--brand-font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
}
.dash-bar a, .dash-bar button { color: inherit; font: inherit; text-decoration: none; }
.dash-bar :focus-visible { outline: 2px solid var(--brand-bar-accent, #3987e5); outline-offset: 2px; }
.dash-bar .dash-brand { display: flex; align-items: center; height: var(--dash-h); margin-right: 12px; color: var(--dash-ink);
  font: 700 20px/1.2 var(--brand-font-heading, var(--brand-font-body, system-ui, -apple-system, "Segoe UI", sans-serif)); letter-spacing: -0.01em; }
.dash-brand img { height: 30px; width: auto; display: block; margin-right: 16px; }
/* A thin rule between the mark and the names. */
.dash-brand img + span { padding-left: 14px; border-left: 1px solid color-mix(in srgb, var(--dash-ink) 25%, transparent); }
.dash-brand small { font: 500 12px/1.2 var(--brand-font-body, system-ui, -apple-system, "Segoe UI", sans-serif); opacity: .65; margin-left: 10px; letter-spacing: .04em; text-transform: uppercase; }
.dash-spacer { flex: 1; }
/* With apps (e.g. the CRM), the product name is the switch between them. */
.dash-switch > button.dash-brand { padding: 0; gap: 8px; box-shadow: none; }
.dash-switch > button.dash-brand > .dash-icon { width: 12px; height: 12px; opacity: .7; }
.dash-pop.dash-pop-left { left: 0; right: auto; }

/* Menu buttons: quiet until hovered or open; the one holding the current
   page in full ink with the brand rule under it. */
.dash-links, .dash-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.dash-tools { margin-left: 6px; gap: 4px; }
.dash-menu { position: relative; }
.dash-menu > button {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px;
  border: 0; border-radius: 0; background: none; cursor: pointer; white-space: nowrap;
  color: color-mix(in srgb, var(--dash-ink) 80%, transparent);
  box-shadow: inset 0 -2px 0 transparent; transition: color .15s ease, box-shadow .15s ease;
}
.dash-menu > button:hover, .dash-menu > button[aria-expanded="true"] { color: var(--dash-ink); }
.dash-menu > button[data-current] { color: var(--dash-ink); box-shadow: inset 0 -2px 0 var(--brand-bar-accent, #3987e5); }
.dash-menu > button .dash-icon { width: 11px; height: 11px; opacity: .75; transition: transform .15s ease; }
.dash-menu > button[aria-expanded="true"] .dash-icon { transform: rotate(180deg); }
/* Icon-only buttons (display options, account): no caret, a larger icon. */
.dash-tools .dash-menu > button { padding: 0 8px; }
.dash-tools .dash-menu > button .dash-icon { width: 19px; height: 19px; opacity: 1; transform: none; }
.dash-account > button .dash-icon { width: 21px; height: 21px; }
/* Administration: set off from the dashboards' menus by a fine rule. */
.dash-admin { margin-right: 4px; padding-right: 8px; border-right: 1px solid color-mix(in srgb, var(--dash-ink) 22%, transparent); }
.dash-links:empty + .dash-tools { margin-left: 0; }

/* An open menu: a card in the page's own colours (white in the light
   scheme) against the right edge of its button. */
.dash-pop {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 280px; max-width: 340px; padding: 6px; z-index: 1001;
  background: var(--surface, #fff); color: var(--text, #2a2a2a);
  border: 1px solid var(--line, #e6e1da); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(42, 42, 42, .16), 0 2px 6px rgba(42, 42, 42, .06);
  font: 400 14px/1.4 var(--brand-font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
  text-align: left; animation: dash-pop 120ms ease-out;
  max-height: calc(100vh - 90px); overflow-y: auto; overscroll-behavior: contain;
}
.dash-display .dash-pop { min-width: 220px; }
.dash-account .dash-pop { min-width: 220px; }
.dash-pop-head { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px 8px; font-weight: 600; font-size: 12px;
  color: var(--text-2, #6b7073); }
.dash-item + .dash-pop-head { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line, #e6e1da); }
.dash-account .dash-pop-head { border-bottom: 1px solid var(--line, #e6e1da); margin-bottom: 4px; font-size: inherit; }
/* One entry: icon, then title over a short note. */
.dash-pop .dash-item { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px;
  background: none; color: var(--text, #2a2a2a); text-align: left; cursor: pointer; text-decoration: none; }
.dash-pop .dash-item:hover, .dash-pop .dash-item:focus-visible { background: var(--surface-2, #f3f7f1); outline: none; }
.dash-pop .dash-item[aria-current="page"], .dash-pop .dash-item[aria-checked="true"] {
  background: color-mix(in srgb, var(--accent, #3e6a2f) 16%, var(--surface, #fff)); }
.dash-item-icon { flex: none; width: 20px; display: flex; justify-content: center; padding-top: 1px; color: var(--text-2, #6b7073); }
.dash-item-icon .dash-icon { width: 17px; height: 17px; }
.dash-item[aria-current="page"] .dash-item-icon, .dash-item[aria-checked="true"] .dash-item-icon { color: var(--accent, #3e6a2f); }
.dash-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.dash-item-label { font-weight: 600; font-size: 14px; line-height: 1.3; color: var(--text, #2a2a2a); }
/* Notes are a dashboard's description: two lines at most here; the
   whole of it is the entry's title (shown on hover). */
.dash-item-note { font-size: 12px; line-height: 1.35; color: var(--text-2, #6b7073); font-weight: 400;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* A group in the Dashboards menu, opening downwards to its dashboards. */
/* The arrow leads the entry, before the group's icon: pointing right,
   then down once the group is open. */
.dash-item-more { flex: none; order: -1; margin-right: -6px; color: var(--text-3, #9fa5a8); padding-top: 2px; }
.dash-item-more .dash-icon { width: 13px; height: 13px; transition: transform .15s ease; }
.dash-sub > .dash-item[aria-expanded="true"] .dash-item-more .dash-icon { transform: rotate(90deg); }
.dash-pop .dash-sub > .dash-item[data-current] { background: color-mix(in srgb, var(--accent, #3e6a2f) 10%, var(--surface, #fff)); }
.dash-sub > .dash-item[aria-expanded="true"] .dash-item-more, .dash-sub > .dash-item[data-current] .dash-item-icon { color: var(--accent, #3e6a2f); }
/* An open group's dashboards: indented under it, on a fine rule. */
.dash-sub-list { margin: 2px 0 6px 22px; padding-left: 4px; border-left: 1px solid var(--line, #e6e1da); }
/* Its entries a size down and closer in, so names and notes fit. */
.dash-pop .dash-sub-list .dash-item { gap: 8px; padding: 6px 8px; }
.dash-sub-list .dash-item-icon { width: 16px; }
.dash-sub-list .dash-item-icon .dash-icon { width: 15px; height: 15px; }
.dash-sub-list .dash-item-label { font-size: 13px; }
.dash-sub-list .dash-item-note { font-size: 11.5px; -webkit-line-clamp: unset; display: block; }
/* A menu of groups is a little wider. */
.dash-pop:has(.dash-sub) { width: 360px; max-width: calc(100vw - 16px); }
.dash-sub-list[hidden] { display: none; }
.dash-item-tick { flex: none; color: var(--accent, #3e6a2f); visibility: hidden; padding-top: 1px; }
.dash-item[aria-checked="true"] .dash-item-tick { visibility: visible; }
@keyframes dash-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dash-pop, .dash-tip { animation: none; } }

@media (max-width: 700px) {
  .dash-bar { padding: 0 16px; }
  .dash-brand small { display: none; }
  .dash-pop { position: fixed; left: 12px; right: 12px; top: auto; max-width: none; margin-top: 10px; }
}
.dash-env { padding: 3px 28px; font: 600 12px/1.4 var(--brand-font-body, system-ui, -apple-system, "Segoe UI", sans-serif); letter-spacing: .04em; text-transform: uppercase; }
.dash-env[data-env="local"] { background: #dbe7f7; color: #14365f; }
.dash-env[data-env="staging"] { background: #fab219; color: #2b1d00; }

/* Refresh (reading Priority on demand) is granted per person on the Users
   page: a dashboard's Refresh button shows only for those who have it. */
:root:not([data-refresh="yes"]) :is(#refresh, #refreshBtn, [data-refresh]) { display: none !important; }

/* Icons (shell.js dashIcon): line drawings in the text colour. */
.dash-icon { width: 1em; height: 1em; flex: none; vertical-align: -0.125em; }

/* (i) tips. A page writes <span class="dash-info" data-tip="..."
   data-tip-title="..."></span> after a label; shell.js draws the (i) and
   shows the tip on hover or keyboard focus. Any element with data-tip
   gets the same tip. */
.dash-info { display: inline-flex; align-items: center; margin-left: 5px; vertical-align: middle;
  color: var(--text-3, #9fa5a8); cursor: help; line-height: 1; font-size: 0.85em; }
.dash-info:hover, .dash-info:focus-visible { color: var(--accent, #3e6a2f); outline: none; }
.dash-tip {
  position: fixed; z-index: 2000; max-width: 320px; padding: 10px 14px; pointer-events: none;
  background: var(--surface, #fff); color: var(--text-2, #3d3d3d);
  border: 1px solid var(--line, #e6e1da); border-left: 3px solid var(--accent, #3e6a2f); border-radius: 10px;
  font: 400 0.82rem/1.5 var(--brand-font-body, system-ui, -apple-system, "Segoe UI", sans-serif); text-align: left;
  filter: drop-shadow(0 8px 20px rgba(42, 42, 42, .14)) drop-shadow(0 1px 2px rgba(42, 42, 42, .10));
  animation: dash-pop 120ms ease-out;
}
.dash-tip[hidden] { display: none; }
.dash-tip-title { font: 700 0.82rem/1.4 var(--brand-font-heading, var(--brand-font-body, system-ui, sans-serif));
  color: var(--text, #2a2a2a); margin-bottom: 3px; }
/* The arrow: a square in the tip's colours, half under the card. */
.dash-tip::after { content: ""; position: absolute; left: var(--dash-tip-x, 50%); width: 10px; height: 10px; margin-left: -5px;
  background: var(--surface, #fff); transform: rotate(45deg); }
.dash-tip[data-side="top"]::after { bottom: -6px; border-right: 1px solid var(--line, #e6e1da); border-bottom: 1px solid var(--line, #e6e1da); }
.dash-tip[data-side="bottom"]::after { top: -6px; border-left: 1px solid var(--line, #e6e1da); border-top: 1px solid var(--line, #e6e1da); }
