/* R3 slice 3/14 (10-shell.css) — extracted VERBATIM from styles.css lines 1438-2311.
   .role-dashboard grid + active-alert banner, sidebar/nav, topbar, avatar, primary/ghost buttons, page header, .view.
   Link order in index.html is load-bearing: cascade tie-breaks depend on it. Do not reorder. */

.role-dashboard {
  padding: 16px 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

/* ── Critical alert banner ── */
.active-alert-card {
  padding: 26px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  /* Accent tracks the highest-priority active alert (set via .alert-tone-* below). */
  border-left: 3px solid var(--alert-accent, var(--danger));
  transition: border-left-color .25s;
}

/* Severity tone tokens — drive the banner accent and per-row colours. */
.alert-tone-critical {
  --alert-accent: var(--danger);
  --alert-soft: var(--danger-soft);
  --alert-border: var(--danger-border);
}
.alert-tone-warning {
  --alert-accent: var(--amber);
  --alert-soft: rgba(235, 164, 51, .12);
  --alert-border: rgba(235, 164, 51, .28);
}
.alert-tone-medium {
  --alert-accent: var(--violet);
  --alert-soft: rgba(110, 98, 214, .12);
  --alert-border: rgba(110, 98, 214, .28);
}
.alert-tone-positive {
  --alert-accent: var(--green);
  --alert-soft: var(--accent-soft);
  --alert-border: rgba(0, 162, 75, .22);
}
body.dark .alert-tone-warning { --alert-soft: rgba(235, 164, 51, .16); }
body.dark .alert-tone-medium { --alert-soft: rgba(110, 98, 214, .18); }

/* Scoped header overrides — panel-title/panel-sub are shared, scope to banner */
.active-alert-card .panel-title {
  font-family: var(--font-display-new);
  font-weight: 800;
  font-size: 16px;
  color: var(--ink);
  line-height: 1.2;
}

.active-alert-card .panel-sub {
  font-family: ui-monospace, "SF Mono", "Geist Mono", monospace;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
  margin-top: 4px;
}

.active-alert-list {
  display: grid;
  gap: 10px;
}

.active-alert-item {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 13px;
  background: var(--alert-soft, var(--danger-soft));
  border: 1px solid var(--alert-border, var(--danger-border));
  transition: background .25s, border-color .25s;
}

.active-alert-item strong,
.active-alert-item span {
  display: block;
}

.active-alert-item strong {
  font-family: var(--font-display-new);
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.25;
}

.active-alert-item span:not(.badge) {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.4;
  margin-top: 2px;
}

/* Resolve button — solid fill in the row's priority colour */
.active-alert-item [data-dashboard-alert-action="resolve"] {
  background: var(--alert-accent, var(--danger));
  color: #FBFAF6;
  border-color: var(--alert-accent, var(--danger));
}

.active-alert-item [data-dashboard-alert-action="resolve"]:hover {
  opacity: .88;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-ink);
  border-right: 1px solid var(--sidebar-border);
  border-radius: 0;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: none;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
  transition: width .35s cubic-bezier(.2,.7,.2,1);
}

.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
  align-items: center;
  padding: 16px 10px;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 16px;
}

.sidebar.collapsed .logo-row {
  width: 44px;
  height: 44px;
  justify-content: center;
  gap: 0;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

.logo-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--accent);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  object-fit: contain;
}

img.logo-mark {
  background: transparent !important;
  box-shadow: none !important;
  object-fit: contain;
}

.sidebar.collapsed .logo-mark {
  margin: 0 auto;
}

.logo-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar.collapsed .logo-text-wrap {
  width: 0;
  opacity: 0;
}

.logo-text {
  font-family: var(--font-display-new);
  font-weight: 900;
  font-size: 14px;
  letter-spacing: 0;
  color: var(--sidebar-ink);
  line-height: 1.1;
}

.logo-sub {
  font-family: var(--font-display-new);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sidebar-dim);
  line-height: 1;
}

.hr {
  height: 1px;
  background: var(--sidebar-border);
  margin: 6px 0 14px;
  border: 0;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 0;
  flex: 1;
}

.nav::before {
  content: "MENU";
  display: block;
  font-family: var(--font-display-new);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: .16em;
  color: var(--sidebar-dim);
  padding: 0 12px 8px;
}

.sidebar.collapsed .nav::before {
  display: none;
}

.sidebar.collapsed .nav {
  align-items: center;
  width: 52px;
  gap: 10px;
}

.nav-bottom {
  flex: 0 0 auto;
}

.nav-section,
.nav-label {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  padding: 10px 8px 4px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .2s;
}

.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-label {
  display: none;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--sidebar-dim);
  font-family: var(--font-display-new);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: 0;
  transition: background .2s, color .2s;
  margin: 2px 0;
  text-align: left; /* <button> defaults to center, which centered the labels */
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-ink);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--accent-ink);
  font-weight: 800;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-item.disabled {
  opacity: .35;
  pointer-events: none;
}

.nav-ico {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.ico {
  width: 24px;
  height: 24px;
  min-width: 24px;
  display: grid;
  place-items: center;
  opacity: .65;
  color: currentColor;
  transition: opacity .15s;
}

.nav-ico svg,
.ico svg,
.collapse-icon svg,
.avatar svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover .nav-ico,
.nav-item.active .nav-ico {
  opacity: 1;
  color: var(--green);
}

.nav-text,
.nav-item span:not(.nav-ico):not(.nav-badge):not(.badge) {
  overflow: hidden;
  transition: opacity .18s, max-width .28s cubic-bezier(.4, 0, .2, 1), margin .28s, padding .28s;
  max-width: 150px;
  min-width: 0;
  flex-grow: 1;
}

.nav-item .nav-badge,
.nav-item .badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  background: var(--danger);
  color: #FBFAF6;
  font-family: var(--font-display-new);
  font-weight: 800;
  font-size: 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar.collapsed .nav-item {
  width: 44px;
  height: 44px;
  flex-shrink: 0;            /* hold the 44px — the flex column would otherwise squash icon-only items */
  padding: 0;
  justify-content: center;
  gap: 0;
  border: 0;                 /* no permanent box */
  border-radius: 12px;
}

/* show a fill only on hover/active, no outline */
.sidebar.collapsed .nav-item:hover {
  background: var(--sidebar-hover);
}
.sidebar.collapsed .nav-item.active {
  background: var(--sidebar-active-bg);
}

.sidebar.collapsed .nav-ico {
  margin: 0;
  flex-shrink: 0;
}

.sidebar.collapsed .nav-item span:not(.nav-ico):not(.nav-badge):not(.badge),
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .phase-tag {
  max-width: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  border: none;
  overflow: hidden;
  pointer-events: none;
}

.sidebar-spacer {
  flex: 1;
  min-height: 8px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar.collapsed .sidebar-footer {
  align-items: center;
}

.phase-tag {
  font-size: 9px;
  background: var(--hover-bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 7px 8px;
  color: var(--muted);
  font-family: "Geist Mono", monospace;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity .18s, max-width .28s cubic-bezier(.4, 0, .2, 1), padding .28s, margin .28s, border .28s;
  max-width: 120px;
}

.collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--sidebar-border);
  border-radius: 11px;
  color: var(--sidebar-dim);
  font-family: var(--font-display-new);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s, background .2s, border-color .2s;
}

.sidebar.collapsed .collapse-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  column-gap: 0;
  border-radius: 14px;
}

.collapse-btn:hover {
  color: var(--sidebar-ink);
  background: var(--sidebar-hover);
  border-color: var(--sidebar-border);
}

.collapse-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.collapse-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
}

.sidebar.collapsed .collapse-icon {
  width: 44px;
  height: 44px;
}

.sidebar.collapsed .collapse-icon {
  transform: rotate(180deg);
}

.collapse-label {
  overflow: hidden;
  transition: opacity .18s, max-width .28s cubic-bezier(.4, 0, .2, 1);
  max-width: 100px;
}

.sidebar.collapsed .collapse-label {
  max-width: 0;
  opacity: 0;
}

.sidebar.collapsed .phase-tag {
  max-width: 0;
  opacity: 0;
  padding: 0;
  margin: 0;
  border: none;
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.topbar {
  height: 72px;
  /* The topbar lives in a fixed-height flex column (.main). Without this it had
     flex-shrink:1 and got squashed by tall page content — by a different amount on
     every page/role, so the bar looked tight and inconsistent. Lock its height. */
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 40px;
  background: var(--topbar-bg);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: saturate(1.1) blur(14px);
  -webkit-backdrop-filter: saturate(1.1) blur(14px);
}

/* Push the refresh + theme controls to the right, next to the user chip + logout */
.topbar #refresh-button { margin-left: auto; }

.topbar .topbar-divider {
  width: 1px;
  height: 36px;
  background: var(--border-strong);
  align-self: center;
  flex-shrink: 0;
  margin: 0 4px;
}

.topbar .nav-toggle { margin-right: auto; }

@media (min-width: 901px) {
  .topbar .nav-toggle { display: none; }
}

.theme-btn,
.ibtn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, background .2s, border-color .2s, transform .25s;
  padding: 0;
}

.theme-btn svg,
.ibtn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-btn:hover,
.ibtn:hover {
  color: var(--accent);
  border-color: var(--border-strong);
}

.ibtn#refresh-button:active svg {
  transform: rotate(-180deg);
  transition: transform .4s cubic-bezier(.2,.7,.2,1);
}

@media (prefers-reduced-motion: reduce) {
  .ibtn#refresh-button:active svg { transform: none; transition: none; }
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6E62D6, #4B3FB0);
  color: #FBFAF6;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display-new);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .02em;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 6px 14px -8px rgba(75, 63, 176, .6);
}

/* Optically centre initials in the circle: line-height:1 above removes the
   line-box leading that left text high; the translateY corrects the residual
   all-caps baseline offset (caps sit above the font's geometric centre). */
.avatar-initials {
  display: block;
  transform: translateY(0.05em);
}

.avatar svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.btn-primary,
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  min-height: 44px;
  /* AA-compliant emerald gradient (4.59-6.12:1 with #FBFAF6); the brand
     #00A24B/#0cbf63 only reached ~3.2:1 for white button text. */
  background: linear-gradient(120deg, #018442 0%, #017d3f 50%, #016e37 100%);
  background-size: 200% 100%;
  background-position: 0% 50%;
  color: #FBFAF6;
  border: 0;
  border-radius: 12px;
  font-family: var(--font-display-new);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 14px 30px -10px rgba(0, 162, 75, .55);
  transition: background-position .35s cubic-bezier(.2,.7,.2,1), transform .25s, box-shadow .25s;
}

.btn-primary:hover,
.primary-btn:hover {
  background-position: 100% 50%;
  transform: translateY(-2px);
  box-shadow: 0 18px 36px -10px rgba(0, 162, 75, .6);
}

.btn-primary:active,
.primary-btn:active {
  transform: translateY(0) scale(.98);
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary, .primary-btn,
  .btn-primary:hover, .primary-btn:hover,
  .btn-primary:active, .primary-btn:active {
    transition: none;
    transform: none;
  }
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  min-height: 44px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  font-family: var(--font-display-new);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .01em;
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s, transform .25s;
}

.ghost-btn:hover {
  background: var(--chip);
  border-color: var(--border-strong);
}

.ghost-btn:active {
  transform: scale(.98);
}

.topbar .logout-btn {
  min-height: 44px;
  border-radius: 12px;
  font-weight: 700;
}
/* Logout turns red on hover and a darker red while pressed/clicked. */
.topbar .logout-btn:hover {
  background: var(--danger);
  color: #FBFAF6;
  border-color: var(--danger);
}
.topbar .logout-btn:active {
  background: #A5251C;
  border-color: #A5251C;
  color: #FBFAF6;
  transform: scale(.98);
}

.page-header {
  padding: 32px 40px 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-header > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-title {
  font-family: var(--font-display-new);
  font-weight: 900;
  font-size: clamp(28px, 3.4vw, 40px);
  font-stretch: 120%;
  letter-spacing: -.025em;
  color: var(--ink);
  line-height: 1.05;
  display: inline;
  margin-right: 12px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid rgba(0, 162, 75, .22);
  border-radius: 999px;
  font-family: var(--font-display-new);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  vertical-align: middle;
  position: relative;
  top: -4px;
}

.live-pill .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  /* Perf: the breathing halo lives on ::after (transform/opacity only, GPU
     compositor) instead of animating box-shadow spread, which repaints every
     frame. z-index:0 gives the dot its own stacking context so the halo can
     sit under the dot's own paint; the overlap is invisible because the halo
     is the same green as the dot. Geometry: 21px disc (7px dot + 7px max
     spread each side); scale .714286 = the old 4px spread, scale 1 = 7px. */
  position: relative;
  z-index: 0;
}

.live-pill .live-dot::after {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: rgba(0, 162, 75, .14);
  z-index: -1;
  transform: scale(.714286);
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { transform: scale(.714286); opacity: 1; }      /* = 4px spread @ .14 */
  50%      { transform: scale(1); opacity: .285714; }      /* = 7px spread @ .04 */
}

@media (prefers-reduced-motion: reduce) {
  /* animation:none leaves the ::after at its static state — the same 4px halo
     reduced-motion users saw before (the old static box-shadow). */
  .live-pill .live-dot::after { animation: none; }
}

.page-sub {
  font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  text-transform: none;
  margin-top: 2px;
}

.status-line {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-family: "Geist Mono", monospace;
}

.status-line.error {
  color: #b84432;
}

.view {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 0 40px 20px; /* content gutter (shell padding removed so sidebar is flush) */
}

.view > .card,
.view > section {
  flex-shrink: 0;
}

.view::-webkit-scrollbar,
.feed-body::-webkit-scrollbar,
.table-scroll::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}

.view::-webkit-scrollbar-thumb,
.feed-body::-webkit-scrollbar-thumb,
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--hairline);
  border-radius: 2px;
}

