/* ── Cards / panels ── */
.card {
  background: var(--card); border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-sub);
  gap: 10px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.card-sub   { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-body  { padding: 14px 16px; }

/* ── Page-level header ── */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 16px; flex-wrap: wrap;
}
.page-header-text {}
.page-title {
  font-size: 18px; font-weight: 700; color: var(--text);
  letter-spacing: -.01em; line-height: 1.2;
}
.page-sub {
  font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4;
}
.page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ── Info banner (notice/warning/error strips) ── */
.info-banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  background: var(--info-lt); border: 1px solid var(--primary-sub);
  border-radius: var(--r-md); font-size: 13px; color: var(--info);
  line-height: 1.5;
}
.info-banner strong { font-weight: 600; }
.info-banner-error {
  background: var(--error-lt); border-color: rgba(222,53,11,.25); color: var(--error);
}
.info-banner-warning {
  background: var(--warning-lt); border-color: rgba(255,139,0,.3); color: var(--warning);
}
.info-banner-success {
  background: var(--success-lt); border-color: rgba(0,135,90,.25); color: var(--success);
}

/* ── Stat tiles ── */
.stat-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 4px;
}
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px)  { .stat-grid { grid-template-columns: 1fr; } }

/* Variants for pages that want a different default column count.
   These reuse the same breakpoints so behaviour is consistent. */
.stat-grid.stat-grid-3  { grid-template-columns: repeat(3, 1fr); }
.stat-grid.stat-grid-4  { grid-template-columns: repeat(4, 1fr); }
.stat-grid.stat-grid-5  { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) {
  .stat-grid.stat-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid.stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .stat-grid.stat-grid-5 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .stat-grid.stat-grid-5 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .stat-grid.stat-grid-3,
  .stat-grid.stat-grid-4,
  .stat-grid.stat-grid-5 { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 16px 18px; position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.sc-blue::before   { background: var(--primary); }
.sc-orange::before { background: var(--warning-med); }
.sc-green::before  { background: var(--success-med); }
.sc-purple::before { background: var(--purple); }
.sc-red::before    { background: var(--error-med); }
.sc-warning::before { background: var(--warning-med); }

.stat-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--text); }
.stat-sub   { font-size: 11px; color: var(--muted); margin-top: 5px; }

/* ── Section row ── */
.section-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; margin-top: 24px;
  gap: 12px;
}
.section-row:first-child { margin-top: 0; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -.005em; }
.section-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }
.section-actions { display: flex; align-items: center; gap: 8px; }

/* ── Filter bar (shared across Budget, FinOps, etc.) ── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.filter-bar-sel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 28px 6px 10px;
  font-size: 12px; color: var(--text); font-family: inherit;
  outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A869A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  transition: border-color .12s; height: 32px;
}
.filter-bar-sel:focus { border-color: var(--primary); outline: none; }
.filter-bar-search {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px;
  font-size: 12px; color: var(--text); font-family: inherit;
  outline: none; flex: 1; min-width: 160px; max-width: 280px;
  transition: border-color .12s; height: 32px;
}
.filter-bar-search:focus { border-color: var(--primary); outline: none; }
.filter-bar-search::placeholder { color: var(--subtle); }
.filter-bar-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}

/* ── Buttons — Option 1 (flat solid, smaller radius) ──────────────────
   Spec, locked in this time:
   • base radius 6px (was 8px)
   • primary  : flat solid var(--primary); WHITE label in both themes;
                no gradient, no depth shadow; darken on hover.
                Dark mode uses --primary-dk so the WHITE-on-blue contrast
                stays WCAG-AA (the lighter dark-mode --primary fails AA
                with white text — ~2.74:1).
   • secondary: blue ghost (transparent fill, blue text, subtle blue
                border) so it matches the primary aesthetic; tints on hover. */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 6px; padding: 8px 14px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s, transform .08s;
  border: 1px solid transparent; white-space: nowrap; line-height: 1;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; pointer-events: none; }

/* Button-only blues, ~10% lower saturation than the global --primary. Applied
   here (not on --primary itself) so other accents — links, charts, focus
   rings, the cost-tracker callouts — keep their existing brand intensity. */
.btn-primary {
  background: #1A5BB8;          /* light theme — was #0052CC */
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover  { background: #2168C9; }
.btn-primary:active { filter: brightness(.96); }
body.dark .btn-primary       { background: #1A5BB8; color: #fff; }
body.dark .btn-primary:hover { background: #2168C9; color: #fff; }

.btn-default {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary-sub);
}
.btn-default:hover  { background: var(--primary-lt); border-color: var(--primary); }
.btn-default:active { filter: brightness(.97); }

/* Subtle — ghost */
.btn-subtle { background: transparent; color: var(--muted); border-color: transparent; }
.btn-subtle:hover { background: var(--bg); color: var(--text); }

/* Small button matches the standard 32px filter-bar control height
   (.al-filter-sel, .al-filter-search). Padding is symmetric so the
   button reads as a peer of the picker/search next to it instead of
   visibly shorter. */
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; gap: 4px; line-height: 1; }

/* Danger — for destructive confirmations */
.btn-danger {
  background: linear-gradient(180deg, var(--error-med) 0%, var(--error) 100%);
  color: #fff;
  border-color: transparent;
  box-shadow:
    0 1px 2px rgba(9,30,66,.15),
    0 2px 4px rgba(222,53,11,.22),
    inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-danger:hover {
  filter: brightness(1.05);
  box-shadow:
    0 2px 6px rgba(222,53,11,.35),
    0 1px 2px rgba(9,30,66,.15),
    inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-danger:active {
  filter: brightness(.96);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.18);
}

/* Right-aligned table header cell */
.data-table th.th-right { text-align: right !important; }

/* ── Chart wrappers ── */
.chart-wrap { position: relative; }
.chart-wrap canvas { max-width: 100%; }
.chart-wrap--empty canvas { filter: blur(4px); opacity: 0.3; pointer-events: none; }
.chart-wrap--empty::after {
  content: 'No data';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: var(--muted);
  pointer-events: none;
}

/* ── Grid helpers ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
@media (max-width: 960px) { .three-col { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .three-col { grid-template-columns: 1fr; } }

/* ── Resource tiles ── */
.res-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (max-width: 960px) { .res-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .res-grid { grid-template-columns: 1fr; } }
.res-tile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 12px 14px; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px;
}
.res-tile-body { flex: 1; min-width: 0; }
/* Box is reserved up front (width/height attrs + here) so the tile never
   reflows when the icon appears. Starts transparent, fades in via .loaded
   (set inline for SVG, by the <img> onload for the PNG fallback). */
.res-tile-icon {
  width: 48px; height: 48px; object-fit: contain; flex-shrink: 0;
  filter: contrast(1.3) brightness(1.1);
  opacity: 0; transition: opacity .25s ease;
}
.res-tile-icon.loaded { opacity: 1; }

/* Inline SVG variant (no network request). Inherits the tile's accent colour
   via `color` so the stroke matches the count + left rail. The PNG fallback
   keeps the contrast filter; the vector doesn't need it. */
.res-tile-icon--svg {
  display: grid; place-items: center; filter: none;
  color: var(--muted); opacity: .92;
}
.res-tile-icon--svg .res-tile-svg { width: 30px; height: 30px; }
.rt-compute    .res-tile-icon--svg { color: var(--warning-med); }
.rt-jobcomp    .res-tile-icon--svg { color: var(--warning); }
.rt-sql        .res-tile-icon--svg { color: var(--primary); }
.rt-jobs       .res-tile-icon--svg { color: var(--success-med); }
.rt-serving    .res-tile-icon--svg { color: var(--purple); }
.rt-models     .res-tile-icon--svg { color: var(--error); }
.rt-pipelines  .res-tile-icon--svg { color: var(--teal); }
.rt-exp        .res-tile-icon--svg { color: var(--muted); }
.rt-vsearch    .res-tile-icon--svg { color: #00B8D9; }
.rt-apps       .res-tile-icon--svg { color: #6554C0; }
.rt-lakebase   .res-tile-icon--svg { color: var(--primary-hov); }
.rt-catalogs   .res-tile-icon--svg { color: #FF8B00; }
.rt-dashboards .res-tile-icon--svg { color: #36B37E; }
.res-tile--filler {
  opacity: 0.45;
}
.res-tile--ghost {
  background: transparent; border-color: transparent;
  box-shadow: none; pointer-events: none;
}
.res-tile::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
}
.rt-compute::before    { background: var(--warning-med); }
.rt-jobcomp::before    { background: var(--warning); }
.rt-sql::before        { background: var(--primary); }
.rt-jobs::before       { background: var(--success-med); }
.rt-serving::before    { background: var(--purple); }
.rt-models::before     { background: var(--error); }
.rt-pipelines::before  { background: var(--teal); }
.rt-exp::before        { background: var(--muted); }
.rt-vsearch::before    { background: #00B8D9; }
.rt-apps::before       { background: #6554C0; }
.rt-lakebase::before   { background: var(--primary-hov); }
.rt-catalogs::before   { background: #FF8B00; }
.rt-dashboards::before { background: #36B37E; }
.rt-dataclass::before  { background: var(--error-med); }
.rt-predopt::before    { background: #36B37E; }

.res-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.res-sublabel {
  font-size: 10px; color: var(--subtle); margin-top: 4px;
}
.res-count { font-size: 28px; font-weight: 700; line-height: 1; color: var(--text); }
.rt-compute    .res-count { color: var(--warning-med); }
.rt-jobcomp    .res-count { color: var(--warning); }
.rt-sql        .res-count { color: var(--primary); }
.rt-jobs       .res-count { color: var(--success-med); }
.rt-serving    .res-count { color: var(--purple); }
.rt-models     .res-count { color: var(--error); }
.rt-pipelines  .res-count { color: var(--teal); }
.rt-exp        .res-count { color: var(--muted); }
.rt-vsearch    .res-count { color: #00B8D9; }
.rt-apps       .res-count { color: #6554C0; }
.rt-lakebase   .res-count { color: var(--primary-hov); }
.rt-catalogs   .res-count { color: #FF8B00; }
.rt-dashboards .res-count { color: #36B37E; }

/* shimmer */
.shimmer {
  background: linear-gradient(90deg, #F4F5F7 25%, #EBECF0 50%, #F4F5F7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 3px; color: transparent !important;
}
body.dark .shimmer {
  background: linear-gradient(90deg, #2A2A35 25%, #32323E 50%, #2A2A35 75%);
  background-size: 200% 100%;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.count-loading { width: 44px; height: 26px; display: block; }

/* Skeleton shapes for progressive loading */
.skel         { background: rgba(95,107,122,.14); border-radius: 4px; animation: skelPulse 1.4s ease-in-out infinite; }
body.dark .skel { background: rgba(255,255,255,.06); }
.skel-line    { height: 10px; width: 100%; margin: 4px 0; }
.skel-value   { height: 26px; width: 80px; margin-top: 4px; }
.skel-chart   { height: 100%; width: 100%; border-radius: var(--r-md); }
/* Skeleton row baseline (div-based lists). For TABLE skeletons we use the
   same class on <tr>, but display:flex would collapse the cells and squash
   every .skel-block to the left edge — producing the "stack of small squares
   in the first column" the Cost Explorer drill-down was showing while the
   data loaded. Override the table case so cells keep their natural column
   widths and the .skel-block inside each <td> renders at its declared width. */
.skel-row     { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border-sub); }
.skel-row:last-child { border-bottom: none; }
tr.skel-row {
  display: table-row;
  gap: 0; padding: 0;
  border-bottom: 1px solid var(--border-sub);
}
tr.skel-row > td { padding: 10px 12px; }
.skel-block   { height: 14px; border-radius: 3px; }
@keyframes skelPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* Wrapper that any shimmer can apply to its outermost element so the
   skeleton stretches the full visible host instead of collapsing to its
   content height. Mirrors the .al-detail-empty fix (full-height fill via
   min-height:100% + flex:1 1 auto) but stays top-aligned because skeleton
   rows are ordered, not centred. Opt-in: helpers that want a content-sized
   shimmer (modal bodies, inline KPI placeholders) just don't apply it. */
.skel-host { display: flex; flex-direction: column; min-height: 100%; flex: 1 1 auto; }

/* Fade-in for values replacing skeletons */
.fade-in { animation: fadeIn 200ms ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }
/* …but NOT on list rows: FinOps/Anomalies render 1000+ rows at once and a
   per-row fade animation is a jank spike on load/filter (and pointless for
   off-screen rows). Rows appear instantly. */
.al-row.fade-in { animation: none; }

/* The Access Control page wraps its master/detail body in #acBody so the
   filter bar can stay above both the Workspace-overview and Principal-lookup
   views. Without this, the .al-layout inside #acBody grows to its content
   height instead of filling the viewport, so the principal list never
   triggers its own scrollbar. Make #acBody a flex column when it contains
   an .al-layout so the layout chain (page -> acBody -> al-layout) all
   pass through flex:1, min-height:0. */
#acBody:has(.al-layout) {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}
/* The KPI strip in #acBody is a sibling above the al-layout. Pin its
   intrinsic height so it doesn't compete with .al-layout's flex:1. */
#acBody:has(.al-layout) > .stat-grid { flex: 0 0 auto; }

/* Workspace-detail tab strip on the Access Control page. Pill buttons that
   switch the principal table (Admins / Users / Groups / Service Principals)
   without rebuilding the rest of the detail pane. Active state echoes the
   .al-row-active treatment used in the list panel for visual consistency. */
.ac-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px;
}
.ac-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--card); color: var(--muted);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.ac-tab:hover { color: var(--text); border-color: var(--muted); }
.ac-tab-active {
  background: var(--primary-lt); color: var(--primary);
  border-color: var(--primary-sub);
}
body.dark .ac-tab-active { background: rgba(87,157,255,.10); }
.ac-tab-count {
  font-size: 11px; font-weight: 700; opacity: .8;
  padding: 0 6px; border-radius: 999px;
  background: var(--bg);
}
.ac-tab-active .ac-tab-count {
  background: var(--card); color: var(--primary);
}
/* Keeps the search input + chip strip glued together as one nowrap flex
   group inside .al-filter-bar (which has flex-wrap:wrap for responsive
   stacking). Without this group the chip strip would wrap to its own row
   below the search on medium viewports because each item is a direct
   .al-filter-bar child. The whole group still wraps as a unit on truly
   narrow screens, so mobile responsiveness is preserved. */
.ac-search-group {
  display: inline-flex; align-items: center; gap: 8px;
  flex-wrap: nowrap; min-width: 0;
}
/* Force every direct child of the search group to align to the centre
   line of the row (the search input is 32px tall, the chip strip is
   shorter). Without this, .ac-tabs (display:flex;flex-wrap:wrap) gets
   align-self:stretch from its parent and floats away from the centre. */
.ac-search-group > * { align-self: center; }
/* Inside the filter-bar group .ac-tabs is a peer of the search input, not a
   stack of two rows - so we strip the 8px margin-bottom that .ac-tabs
   carries for its other (vertical-stack) usage and force inline-flex with
   centred items so the strip's centreline matches the input's. */
.ac-search-group .ac-tabs,
.ac-search-group .ac-tabs-compact {
  display: inline-flex; align-items: center;
  margin: 0;
}

/* ── Catalog & Schema block + lineage tree (Access Control, principal view) ──
   The "Catalog & Schema" KPI tile is a clickable stat-card: it toggles a
   collapsible Unity Catalog access tree below the KPI strip. Visually it's an
   ordinary .stat-card so it lines up in the grid, but it carries a pointer
   cursor + a chevron that flips when the tree is open. */
.ac-cat-kpi { cursor: pointer; transition: border-color .12s, transform .06s; }
.ac-cat-kpi:hover { border-color: var(--purple); }
.ac-cat-kpi:active { transform: translateY(1px); }
.ac-cat-kpi:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.ac-cat-kpi .stat-label { display: inline-flex; align-items: center; gap: 5px; }
.ac-cat-kpi .ac-cat-chev { transition: transform .15s; opacity: .7; }
.ac-cat-kpi-open .ac-cat-chev { transform: rotate(180deg); }

/* The tree itself — one collapsible node per catalog. Each node header is a
   single clickable row (chevron + catalog icon + name + meta + inline
   privilege lozenges); expanding reveals a schema table. */
.ac-cat-tree {
  border: 1px solid var(--border); border-radius: var(--r-md);
  overflow: hidden; background: var(--card);
}
.ac-cat-node + .ac-cat-node { border-top: 1px solid var(--border-sub); }
.ac-cat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; cursor: pointer;
  transition: background .12s;
}
.ac-cat-head:hover { background: var(--bg); }

/* Workspace-level node (top of the tree). Slightly heavier header so the
   workspace > catalog > schema hierarchy reads clearly. The catalog children
   are nested + indented under it. */
.ac-cat-head-ws .ac-cat-name { font-size: 13px; }
.ac-cat-node-ws > .ac-cat-head-ws { background: var(--bg); }
.ac-cat-node-ws > .ac-cat-head-ws:hover { background: var(--border-sub); }
.ac-cat-ws-children {
  border-top: 1px solid var(--border-sub);
  /* Indent the catalog rows so they sit visually under the workspace. */
  padding-left: 14px;
}
/* Catalog rows nested inside a workspace lose their card border (the parent
   .ac-cat-tree already provides the outer frame); a left rule conveys nesting. */
.ac-cat-ws-children .ac-cat-node {
  border-left: 2px solid var(--border);
}
.ac-cat-ws-children .ac-cat-node:first-child { border-top: none; }
.ac-cat-head-catalog { padding-left: 10px; }
.ac-cat-head:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ac-cat-head .ac-cat-chev {
  flex-shrink: 0; opacity: .6; transition: transform .15s;
}
.ac-cat-node-open > .ac-cat-head .ac-cat-chev { transform: rotate(90deg); }
.ac-cat-name {
  font-weight: 600; font-size: 13px; color: var(--text);
  font-family: Consolas, ui-monospace, monospace;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ac-cat-meta {
  font-size: 11px; color: var(--muted); flex-shrink: 0;
  margin-left: 2px;
}
/* Privilege lozenges sit on the right of the catalog row and wrap onto
   their own line gracefully on narrow panes. */
.ac-cat-privs {
  margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px;
  justify-content: flex-end; min-width: 0;
}
.ac-cat-schemas {
  border-top: 1px solid var(--border-sub);
  background: var(--bg);
  padding: 4px 0;
}
.ac-cat-schemas .data-table { background: transparent; }
.ac-cat-schemas .data-table td { vertical-align: top; }

/* Privilege lozenge sizing. Inherited grants carry a small "↑ catalog"
   provenance tag so the lineage is visible at a glance without a tooltip. */
.ac-priv { font-size: 10.5px; font-weight: 600; }
.ac-priv-src { opacity: .7; font-weight: 500; margin-left: 2px; }
.ac-priv-inherited { font-weight: 500; }

/* Stack search + chips on a new line on truly narrow viewports so the
   filter bar doesn't horizontally overflow on phones. The whole group
   still stays together, just vertically. */
@media (max-width: 640px) {
  .ac-search-group { flex-wrap: wrap; }
  .ac-search-group > input.al-filter-search { flex: 1 1 100%; width: 100%; max-width: none; min-width: 0; }
}

/* Tighter variant used in the principal-lookup search header so all four
   chips fit on a single row at the 320px-wide list-panel width. We use
   nowrap to force a single line - if a future label gets long enough to
   not fit, we'd rather see horizontal overflow than a 2-row strip that
   pushes the suggestion list down. */
.ac-tabs-compact { gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ac-tabs-compact::-webkit-scrollbar { display: none; }
.ac-tabs-compact .ac-tab {
  padding: 4px 10px; font-size: 11px;
  white-space: nowrap; flex-shrink: 0;
}
.ac-tabs-compact .ac-tab-count { font-size: 10px; padding: 0 5px; }


/* Page-level cross-fade applied by sidebar.js swapPage().
   Leave: ~120ms (kept short so the user doesn't see a blank pause).
   Enter: ~220ms fade + 4px lift so the new page feels like it "rose" in.
   Keeps each page visually distinct between clicks without obstructing
   data that's still loading below the shell. */
.page.page-leave {
  opacity: 0;
  transition: opacity 120ms ease-in;
}
.page.page-enter {
  animation: pageEnter 220ms ease-out;
}
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Info panel ── */
.info-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 16px;
}
.info-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.info-name { font-size: 18px; font-weight: 700; color: var(--text); }
.info-fqdn {
  font-size: 11px; color: var(--primary);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  margin-top: 2px; word-break: break-all;
}

/* Jira lozenge */
.lozenge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 6px; border-radius: 2em;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; white-space: nowrap; flex-shrink: 0;
}
.lozenge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.lz-success  { background: var(--success-lt);  color: var(--success); }
.lz-success .lozenge-dot  { background: var(--success-med); }
.lz-info     { background: var(--info-lt);     color: var(--info); }
.lz-info .lozenge-dot     { background: var(--primary); }
.lz-error    { background: var(--error-lt);    color: var(--error); }
.lz-error .lozenge-dot    { background: var(--error-med); }
.lz-warning  { background: var(--warning-lt);  color: var(--warning); }
.lz-warning .lozenge-dot  { background: var(--warning-med); }
.lz-default  { background: #DFE1E6; color: var(--muted); }
.lz-default .lozenge-dot  { background: var(--subtle); }

.info-grid {
  display: grid; gap: 10px 14px;
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 1100px) { .info-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 860px)  { .info-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .info-grid { grid-template-columns: repeat(2, 1fr); } }

.info-label {
  font-size: 10px; font-weight: 700; color: var(--subtle);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px;
}
.info-value { font-size: 12px; font-weight: 500; color: var(--text); word-break: break-all; }

/* ── Data table ── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; padding: 11px 16px;
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--border-sub);
  color: var(--text); vertical-align: middle;
  font-size: 13px; line-height: 1.4;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover td { background: var(--bg); }
body.dark .data-table tbody tr:hover td { background: rgba(255,255,255,.025); }
/* Perf: the cost drill-down table can list thousands of resources. Skip the
   per-row fade animation (a jank spike when all rows mount at once). */
.data-table tbody tr.fade-in { animation: none; }
/* Actions column: right-aligned, tight spacing, no wrap */
.data-table td:last-child,
.data-table th:last-child { white-space: nowrap; }
/* Responsive: allow horizontal scroll on narrow viewports */
.table-responsive {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-radius: var(--r-md);
}
.table-responsive::-webkit-scrollbar { height: 6px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
/* Card wrapping a table: clip overflow so the table header bg doesn't
   poke past the card's rounded corners. */
.card:has(> .table-responsive) { overflow: hidden; }

/* ── Rec card ── */
.rec-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 12px 16px; margin-bottom: 8px;
  display: flex; align-items: flex-start; gap: 12px;
}
.rec-icon-wrap {
  width: 32px; height: 32px; border-radius: var(--r-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.rec-icon-high    { background: var(--error-lt); color: var(--error-med); }
.rec-icon-medium  { background: var(--warning-lt); color: var(--warning-med); }
.rec-icon-low     { background: var(--success-lt); color: var(--success-med); }
.rec-title  { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.rec-ws     { font-size: 11px; color: var(--primary); margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }
.rec-detail { font-size: 12px; color: var(--muted); }
.rec-saving { font-size: 11px; color: var(--success); margin-top: 4px; font-weight: 600; display: flex; align-items: center; gap: 4px; }

/* ── Alert row ── */
.alert-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border-sub);
}
.alert-item:last-child { border-bottom: none; }
.alert-sev-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.asd-high   { background: var(--error-med); }
.asd-medium { background: var(--warning-med); }
.asd-low    { background: var(--success-med); }

/* ── Workspace select ── */
.ws-select {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--r); padding: 6px 10px;
  font-size: 13px; color: var(--text);
  outline: none; cursor: pointer; min-width: 220px;
  transition: border-color .1s;
}
.ws-select:focus { border-color: var(--primary); }

/* ── Spinner ── */
.mini-spin {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cache-status button (topbar) ── */
.cache-status-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 170px; min-height: 28px;
  padding: 5px 12px 5px 10px;
  font-size: 11px; font-weight: 600; line-height: 1;
  border-radius: 2em; border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background .12s, border-color .12s, color .12s;
  letter-spacing: .01em; overflow: hidden; position: relative;
}
.cache-status-btn:disabled { cursor: default; }
@media (max-width: 700px) {
  .cache-status-btn { min-width: 0; padding: 5px 10px; }
  .cache-status-btn .cache-status-label { display: none; }
}

/* Skeleton — initial state before any fetch */
.cache-status-btn.cache-skeleton {
  background: var(--bg); border-color: var(--border); color: var(--muted);
}
.cache-status-btn .cache-status-skel {
  height: 10px; width: 120px; border-radius: 4px;
  background: rgba(95,107,122,.14);
  animation: skelPulse 1.4s ease-in-out infinite;
  display: none;
}
body.dark .cache-status-btn .cache-status-skel { background: rgba(255,255,255,.08); }
.cache-status-btn.cache-skeleton .cache-status-skel { display: inline-block; }
.cache-status-btn.cache-skeleton .cache-status-refresh,
.cache-status-btn.cache-skeleton .cache-status-label { display: none !important; }

/* Loading — shimmer sweep, no text, same size as resting state */
.cache-status-btn.cache-loading {
  background: rgba(95,107,122,.14);
  border-color: var(--border);
  color: transparent;
  pointer-events: none;
  min-width: 170px;
}
.cache-status-btn.cache-loading::after {
  content: '';
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.3) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: cacheShimmer 1.1s ease-in-out infinite;
}
body.dark .cache-status-btn.cache-loading {
  background: rgba(255,255,255,.06);
  border-color: var(--border);
}
body.dark .cache-status-btn.cache-loading::after {
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.06) 50%, transparent 100%);
  background-size: 200% 100%;
}
@keyframes cacheShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.cache-status-btn .cache-status-refresh { flex-shrink: 0; }

/* Cached */
.cache-status-btn.cache-cached { background: var(--bg); border-color: var(--border); color: var(--muted); }
.cache-status-btn.cache-cached:hover { background: var(--card); border-color: var(--muted); color: var(--text); }

/* Fresh — just computed */
.cache-status-btn.cache-fresh { background: var(--success-lt); border-color: rgba(0,135,90,.25); color: var(--success); }
.cache-status-btn.cache-fresh:hover { filter: brightness(1.03); border-color: var(--success-med); }

/* Error */
.cache-status-btn.cache-error { background: var(--error-lt); border-color: rgba(222,53,11,.28); color: var(--error); }
.cache-status-btn.cache-error:hover { filter: brightness(1.03); border-color: var(--error-med); }

/* Idle */
.cache-status-btn.cache-idle { background: var(--bg); border-color: var(--border); color: var(--muted); }

/* ── Account-switch transition overlay ── */
.acct-transition {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(9,30,66,.52);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.acct-transition.visible {
  opacity: 1; pointer-events: all;
}
.acct-transition-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px 40px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  min-width: 240px;
  animation: atCardIn 220ms ease;
}
@keyframes atCardIn {
  from { opacity: 0; transform: scale(.94) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.acct-transition-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.acct-transition-title {
  font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3;
}
.acct-transition-sub {
  font-size: 12px; color: var(--muted); margin-top: -8px;
}

/* Initial app-boot loader. Renders inside #pageRoot before any page module
   takes over. Was height:200px which pinned the spinner to the top 200px
   of the page (visible empty space below); now flex-fills the page host
   so the spinner sits in the true viewport centre - same idiom as
   .empty-state / .al-detail-empty below. The .page:has selector turns
   .page itself into a flex-column when this loader is its child, so
   flex:1 1 auto can claim the remaining viewport height. */
.page:has(> .page-loading) {
  display: flex; flex-direction: column;
}
.page-loading {
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px; color: var(--muted);
  min-height: 100%; flex: 1 1 auto;
}

/* ── Empty state ──
   Always vertically AND horizontally centred inside its host. The flex
   column + min-height:100% pulls the icon + text to the middle of any
   panel that's tall enough, instead of pinning them to the top with
   only padding for spacing. The min-height:240px floor keeps the icon
   visible even when the host has no intrinsic height (e.g. a freshly-
   rendered modal or detail panel with no other content). */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 48px 20px;
  color: var(--muted);
  min-height: 240px; flex: 1 1 auto;
}
.empty-state svg { opacity: .35; margin-bottom: 12px; }
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }


/* ── Best-practice card icon ── */
.bp-icon {
  width: 32px; height: 32px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px; flex-shrink: 0;
}
.bp-blue   { background: var(--primary-lt);  color: var(--primary); }
.bp-green  { background: var(--success-lt);  color: var(--success-med); }
.bp-orange { background: var(--warning-lt);  color: var(--warning-med); }
.bp-purple { background: var(--purple-lt);   color: var(--purple); }
.bp-teal   { background: var(--teal-lt);     color: var(--teal); }
.bp-red    { background: var(--error-lt);    color: var(--error-med); }

/* ── Info banner (info-level alert panel) ── */
.info-banner {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  background: var(--info-lt); color: var(--info);
  border: 1px solid var(--primary-sub); border-left: 3px solid var(--primary);
  border-radius: var(--r-md);
  font-size: 13px;
}
.info-banner strong { color: var(--text); font-weight: 600; }
.info-banner code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 11px; padding: 1px 5px;
  background: var(--bg); border-radius: 3px;
  border: 1px solid var(--border-sub); color: var(--text);
}
.info-banner-error {
  background: var(--error-lt); color: var(--error-med);
  border-color: var(--error-med); border-left-color: var(--error);
}
.info-banner-error strong { color: var(--text); }

/* ── Modal close button (large click target) ── */
.modal-close {
  width: 32px; height: 32px; border-radius: var(--r);
  border: none; background: transparent;
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

/* ── Icon action buttons (settings table) ── */
.icon-btn {
  width: 30px; height: 30px; border-radius: var(--r-md);
  background: var(--bg); border: 1px solid var(--border);
  color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  padding: 0; flex-shrink: 0;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover {
  background: var(--primary-lt);
  color: var(--primary);
  border-color: var(--primary-sub);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(87, 157, 255, .25);
}
/* Destructive action: tinted red at rest so it reads as "delete" before hover,
   then a solid red fill on hover for a clear, confident affordance. */
.icon-btn-danger {
  color: var(--error-med);
  border-color: color-mix(in srgb, var(--error-med) 35%, var(--border));
}
.icon-btn-danger:hover {
  background: var(--error-med);
  color: #fff;
  border-color: var(--error-med);
  box-shadow: 0 1px 6px rgba(222, 53, 11, .35);
}
/* Group: tight row of action buttons. Defaults to right-aligned because
   that's where table action columns live. Override with justify-content
   if the group is in a left-aligned context. */
.icon-btn-group {
  display: inline-flex; align-items: center; gap: 6px;
  justify-content: flex-end;
}

/* ── Secrets Manager value cell ──────────────────────────────────────
   The value column has a FIXED width (reserved up front, whether masked or
   revealed) and the value wraps inside it — so revealing a long secret never
   widens the column or shifts the rest of the table. */
.sec-val-cell { width: 320px; max-width: 320px; }
.sec-val {
  display: inline-flex; align-items: flex-start; gap: 6px;
  max-width: 100%;
  font-family: Consolas, monospace; font-size: 12px; color: var(--muted);
}
.sec-val-text {
  min-width: 0;
  overflow-wrap: anywhere; word-break: break-all; white-space: normal;
}
.sec-copy-btn { width: 22px; height: 22px; flex-shrink: 0; }
.sec-copy-btn svg { width: 12px; height: 12px; }

/* Access Control modal: wider + compact, and DON'T clip — so opening the
   principal/permission dropdown doesn't add an overflow scrollbar to the card
   (the popup can spill past the card edge). The content is short (a list + a
   one-row form) so it never needs to scroll itself. */
.sec-acl-card {
  width: 640px; max-width: 92vw;
  overflow: visible; scrollbar-gutter: auto;
}
.sec-acl-card .pc-select-popup { max-height: 220px; }
/* "Who has access" list scrolls on its own so a long ACL list doesn't push the
   grant form off-screen. ~5 rows visible, then scroll. */
#secAclList { max-height: 230px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
#secAclList::-webkit-scrollbar { width: 6px; }
#secAclList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
#secAclList .data-table thead th { position: sticky; top: 0; z-index: 1; }

/* Searchable principal picker (Access Control → Grant). */
.sec-pick { position: relative; }
.sec-pick-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 38px; padding: 8px 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; color: var(--text); cursor: pointer; outline: none;
}
.sec-pick-trigger:focus, .sec-pick-trigger:hover { border-color: var(--primary); }
.sec-pick-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-pick-placeholder { color: var(--subtle); }
.sec-pick-popup {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-lg); padding: 6px;
}
.sec-pick-search { width: 100%; height: 32px; margin-bottom: 6px; }
.sec-pick-list { max-height: 200px; overflow-y: auto; scrollbar-width: thin; }
.sec-pick-head {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px 2px;
}
.sec-pick-item {
  padding: 7px 8px; border-radius: 5px; font-size: 12px; color: var(--text);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sec-pick-item:hover { background: var(--bg); }
.sec-pick-item-active { background: var(--primary-lt); color: var(--primary); font-weight: 600; }

/* Permission radio group (only 3 options → radios read better than a select). */
.sec-radio-group { display: flex; flex-direction: column; gap: 6px; }
/* Compact side-by-side variant (e.g. Create Scope's two MANAGE options). */
.sec-radio-row { flex-direction: row; }
.sec-radio-row .sec-radio { flex: 1; justify-content: flex-start; }
/* Option 5 — big tappable cards with a soft glow when selected. */
.sec-radio {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 12px; color: var(--text);
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.sec-radio:hover { border-color: var(--primary-sub); }
.sec-radio input { accent-color: var(--primary); width: 15px; height: 15px; flex-shrink: 0; }
/* Selected must be unmistakably stronger than hover: 2px primary border (inset
   so layout doesn't shift) + a subtle fill + glow. */
.sec-radio:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-lt);
  box-shadow: inset 0 0 0 1px var(--primary), 0 2px 10px rgba(87,157,255,.25);
}
.sec-radio strong { font-weight: 700; }

/* Inline note/banner used in the Secrets detail (KV explainer, friendly errors). */
.sec-note {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 12px; line-height: 1.5;
  padding: 10px 12px; border-radius: var(--r-md);
  border: 1px solid var(--border);
}
.sec-note strong { font-weight: 600; }
.sec-note-info  { color: var(--text);      background: var(--primary-lt); border-color: var(--primary-sub); }
.sec-note-info svg  { color: var(--primary); }
.sec-note-error { color: var(--error-med); background: var(--error-lt);   border-color: var(--error-med); }

/* ── Settings modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.55);
  align-items: center; justify-content: center;
}
body.dark .modal-overlay { background: rgba(0,0,0,.72); }
.modal-card {
  width: 480px; max-width: 90vw; max-height: 90vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  /* Reserve the scrollbar gutter always, so opening a dropdown inside the modal
     (whose popup can briefly overflow the card) doesn't add/remove a scrollbar
     and shift the content sideways. */
  scrollbar-gutter: stable;
}
.modal-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border-sub);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 14px 16px 16px; }
.modal-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; display: block; margin-bottom: 4px;
}
.modal-input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px; background: var(--bg); color: var(--text);
  outline: none; font-family: inherit;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.modal-input:hover { border-color: var(--muted); }
.modal-input:focus {
  border-color: var(--primary); background: var(--card);
  box-shadow: 0 0 0 3px rgba(87, 157, 255, .18);
}
.modal-input.mono  { font-family: 'SFMono-Regular', Consolas, monospace; }
.modal-input:disabled { opacity: .7; cursor: not-allowed; background: var(--bg); }
.modal-input.input-err { border-color: var(--error-med); }
.modal-input.input-err:focus { box-shadow: 0 0 0 3px rgba(222, 53, 11, .18); }

/* Strip the native number-input spinner everywhere. The default up/down
   arrows render as an unstyled grey box that clashes with the themed inputs
   (and looks broken in dark mode). We hide them app-wide; where step controls
   are genuinely useful (the pricing calculator) we provide themed sliders /
   the .pc-stepper buttons instead. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
select.modal-input { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A869A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; cursor: pointer; }
/* Render the placeholder <option disabled hidden> as muted grey while
   the actual options render in the default text color. Firefox picks
   up this style; Chrome + Safari rely on the .placeholder-selected
   class the page toggles on the <select> element. */
select.modal-input:has(option[value=""]:checked) { color: var(--muted); }
select.modal-input option[disabled] { color: var(--muted); }
select.modal-input option { color: var(--text); }

.field-err {
  display: none;
  font-size: 11px; color: var(--error-med);
  margin-top: 4px;
}

/* Reusable hint line under a modal input. Matches auth.css feel. */
.modal-hint {
  font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.45;
}
.modal-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 10px;
  color: var(--text);
}

/* ── Chip input (multi-email picker) ──────────────────────────────── */
.chip-input {
  width: 100%;
  min-height: 40px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  transition: border-color .12s, box-shadow .12s, background .12s;
  cursor: text;
}
.chip-input:hover { border-color: var(--muted); }
.chip-input:focus-within {
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(87, 157, 255, .18);
  outline: none;
}
.chip-input-chips {
  display: contents;          /* so chips participate in parent's flex row */
}
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 4px 3px 10px;
  background: var(--primary-lt);
  color: var(--primary);
  border: 1px solid var(--primary-sub);
  border-radius: 14px;
  font-size: 12px; font-weight: 500;
  line-height: 1.4;
  max-width: 100%;
}
.chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}
.chip-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border: none; background: transparent; color: var(--primary); cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: background .12s, color .12s;
}
.chip-remove:hover {
  background: var(--primary);
  color: #FFFFFF;
}
.chip-remove:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(87, 157, 255, .4);
}
.chip-input-field {
  flex: 1; min-width: 140px;
  border: none; outline: none; background: transparent;
  color: var(--text); font-size: 13px; font-family: inherit;
  padding: 6px 2px;
}
.chip-input-field::placeholder { color: var(--subtle); }
.form-msg {
  font-size: 12px; padding: 8px 10px; border-radius: var(--r);
}
.form-msg-ok  { background: var(--success-lt); color: var(--success); }
.form-msg-err { background: var(--error-lt);   color: var(--error);   }

/* ── Global toast ── */
.global-toast {
  position: fixed; right: 20px; bottom: 20px;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 14px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  pointer-events: none; z-index: 500; max-width: 320px;
}
.global-toast.show { opacity: 1; transform: translateY(0); }
.global-toast.toast-ok  { border-left: 3px solid var(--success-med); }
.global-toast.toast-err { border-left: 3px solid var(--error-med); }

/* ── Status dot (sidebar list) ── */
.ws-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.ws-dot-RUNNING      { background: var(--success-med); }
.ws-dot-PROVISIONING { background: var(--primary); }
.ws-dot-FAILED       { background: var(--error-med); }
.ws-dot-BANNED       { background: var(--subtle); }
.ws-dot-CANCELLED    { background: var(--warning-med); }

/* ── Admin: users & invitations ────────────────────────────────────── */
.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2em;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.role-badge-admin { background: var(--primary-lt); color: var(--primary); }
.role-badge-user  { background: var(--border-sub); color: var(--muted); }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2em;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-badge-active    { background: var(--success-lt); color: var(--success); }
.status-badge-disabled  { background: var(--error-lt);   color: var(--error-med); }
.status-badge-pending   { background: var(--warning-lt); color: var(--warning); }
.status-badge-expired   { background: var(--border-sub); color: var(--muted); }
.status-badge-consumed  { background: var(--info-lt);    color: var(--info); }

/* Invite-link "copy now, can't be shown again" block */
.invite-link-block {
  margin-top: 12px;
  padding: 14px;
  background: var(--warning-lt);
  border: 1px solid var(--warning-med);
  border-radius: 6px;
}
.invite-link-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--warning);
  font-weight: 600;
  margin-bottom: 12px;
}
.invite-link-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.invite-link-input {
  flex: 1;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-link-copy {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.invite-link-copy:hover { background: var(--primary-hov); }
.invite-link-copy.copied { background: var(--success-med); }

/* ── Topbar user menu ─────────────────────────────────────────────── */
.user-menu-wrap { position: relative; flex-shrink: 0; }
.user-menu-btn {
  width: 32px; height: 32px;
  border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  padding: 0;
  transition: box-shadow .12s;
}
.user-menu-btn:hover { box-shadow: 0 0 0 3px var(--border-sub); }
.user-menu-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(87,157,255,.35); }
.user-menu-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0.02em;
}
.user-menu-avatar-lg { width: 44px; height: 44px; font-size: 18px; }

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden;
  transform: translateY(-4px);
  transition: opacity .14s, transform .14s, visibility .14s;
  z-index: 100;
  overflow: hidden;
}
.user-menu-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0); }

.user-menu-header {
  padding: 14px;
  display: flex; gap: 12px; align-items: center;
  border-bottom: 1px solid var(--border-sub);
}
.user-menu-meta { min-width: 0; flex: 1; }
.user-menu-name  { font-size: 13px; font-weight: 600; color: var(--text); }
.user-menu-email {
  font-size: 11px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-menu-role {
  font-size: 10px; font-weight: 600; color: var(--primary);
  margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em;
}

.user-menu-item {
  width: 100%;
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: none;
  font-size: 13px; color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background .1s;
  font-family: inherit;
}
.user-menu-item:hover { background: var(--bg); }
.user-menu-item svg { color: var(--muted); }

/* ── Settings index (category list) ───────────────────────────────── */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.settings-list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  text-decoration: none;
  transition: background .12s, border-color .12s, transform .06s;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.settings-list-item:hover {
  border-color: var(--primary-sub);
  background: var(--bg);
}
.settings-list-item:active { transform: translateY(1px); }
.settings-list-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(87, 157, 255, .25);
}

.settings-list-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--primary-lt);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-list-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.settings-list-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.settings-list-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.settings-list-chevron {
  color: var(--subtle);
  flex-shrink: 0;
  transition: color .12s, transform .12s;
}
.settings-list-item:hover .settings-list-chevron {
  color: var(--primary);
  transform: translateX(2px);
}

/* ── Settings subsection header (back link + title) ───────────────── */
.settings-subheader {
  margin-bottom: 4px;
}
.settings-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px 4px 6px;
  margin-left: -8px;
  border-radius: 4px;
  transition: background .1s, color .1s;
}
.settings-back:hover {
  background: var(--bg);
  color: var(--text);
}
.settings-back svg { flex-shrink: 0; }

/* ── Anomalies / Alerts – master-detail layout ────────────────────── */
.al-summary-bar {
  display: flex; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 10px 16px; margin-bottom: 10px;
  flex-wrap: wrap; gap: 4px;
}
.al-summ-item { display: flex; align-items: center; gap: 6px; }
.al-summ-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.al-dot-open   { background: var(--error-med); }
.al-dot-ack    { background: var(--warning-med); }
.al-dot-critical { background: #BF2600; }
.al-dot-high     { background: var(--error-med); }
.al-dot-medium   { background: var(--warning-med); }
.al-dot-low      { background: var(--success-med); }
.al-summ-val   { font-size: 13px; font-weight: 700; color: var(--text); }
.al-summ-label { font-size: 12px; color: var(--muted); }
.al-summ-sep   { width: 1px; height: 16px; background: var(--border); margin: 0 12px; flex-shrink: 0; }

/* Anomaly filter bar — alias to the shared filter-bar classes */
.al-filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.al-filter-sel  { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 6px 28px 6px 10px; font-size: 12px; color: var(--text); font-family: inherit; outline: none; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A869A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; transition: border-color .12s; height: 32px; }
.al-filter-sel:focus { border-color: var(--primary); outline: none; }
/* Magnifying-glass icon pinned to the right of every search input.
   Encoded as a data URL so we don't need an extra request. The right
   padding (28px) reserves space so the user's text never collides with
   the icon. Using -webkit-search-decoration:none + appearance:none on the
   input itself keeps the browser's native clear-button from doubling up. */
.al-filter-search {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 28px 6px 10px;
  font-size: 12px; color: var(--text); font-family: inherit;
  outline: none; flex: 1; min-width: 160px; max-width: 280px;
  transition: border-color .12s; height: 32px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A869A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.al-filter-search:focus { border-color: var(--primary); outline: none; }
.al-filter-search::placeholder { color: var(--subtle); }
/* Suppress the native search-input clear button so the magnifying glass
   icon stays the only right-edge affordance. */
.al-filter-search::-webkit-search-cancel-button,
.al-filter-search::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

/* Same icon treatment for the in-modal search inputs used by the budgets
   resource picker and the secrets ACL principal picker, so every search
   field in the app reads consistently. */
.modal-input.sec-pick-search,
input[type="text"][id="bMultiSvcResSearch"] {
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A869A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* Single unified card — left list panel + right detail panel separated
   by a 1px divider. Both panels scroll independently. */
/* When the anomalies page is active, make .page a flex column so
   .al-layout can grow via flex:1 and fill all remaining space exactly —
   no blank gap below the card regardless of how many alerts are shown. */
.page:has(.al-layout) {
  display: flex;
  flex-direction: column;
  padding-bottom: 16px;
}

.al-layout {
  display: flex; gap: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  overflow: hidden;
  flex: 1;      /* grow to fill remaining page height */
  min-height: 0; /* allow shrinking below content size in flex context */
}
.al-list-panel {
  width: 320px; flex-shrink: 0;
  height: 100%; overflow-y: auto;
  border-right: 1px solid var(--border);
  scrollbar-width: auto; scrollbar-color: var(--border) transparent;
}
.al-list-panel::-webkit-scrollbar { width: 8px; }
.al-list-panel::-webkit-scrollbar-track { background: transparent; }
.al-list-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.al-list-panel::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.al-detail-panel {
  flex: 1; min-width: 0;
  height: 100%; overflow-y: auto;
  scrollbar-width: auto; scrollbar-color: var(--border) transparent;
}
.al-detail-panel::-webkit-scrollbar { width: 8px; }
.al-detail-panel::-webkit-scrollbar-track { background: transparent; }
.al-detail-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.al-detail-panel::-webkit-scrollbar-thumb:hover { background: var(--muted); }
@media (max-width: 860px) {
  .al-layout { flex-direction: column; flex: none; }
  .al-list-panel { width: 100%; height: 280px; border-right: none; border-bottom: 1px solid var(--border); }
  .al-detail-panel { height: auto; overflow-y: visible; }
}

.al-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border-sub);
  cursor: pointer; transition: background .1s;
  /* Perf: these lists can hold 1000+ rows (FinOps findings, Anomalies).
     content-visibility lets the browser skip layout+paint for off-screen
     rows, so scrolling stays smooth; contain-intrinsic-size reserves each
     row's height up front so the scrollbar doesn't jump as rows realise. */
  content-visibility: auto;
  contain-intrinsic-size: auto 46px;
}
.al-row:last-child { border-bottom: none; }
.al-row:hover { background: var(--bg); }
.al-row-active { background: var(--primary-lt) !important; }
body.dark .al-row-active { background: rgba(87,157,255,.08) !important; }
.al-row-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.al-row-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}
.al-row-meta {
  font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.al-pill {
  display: inline-block; padding: 2px 7px;
  border-radius: 2em; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0;
}
.al-pill-open { background: var(--error-lt);   color: var(--error-med); }
.al-pill-ack  { background: var(--warning-lt); color: var(--warning); }
.al-pill-res  { background: var(--border-sub); color: var(--muted); }

.al-detail-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center;
  /* Fill the al-detail-panel so the empty-state icon + message sit at
     the visual middle of the right pane instead of the top. The detail
     panel already has overflow:auto + height:100% from .al-layout, so
     min-height:100% is enough to claim the full visible height. */
  min-height: 100%;
  flex: 1 1 auto;
}
.al-detail-body { padding: 16px; }
.al-detail-head { margin-bottom: 14px; }
.al-detail-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  line-height: 1.3; margin-bottom: 6px;
}
.al-detail-scope {
  font-size: 12px; color: var(--muted);
  display: flex; align-items: center; flex-wrap: wrap; gap: 2px;
}
.al-detail-ruleid {
  font-size: 10px; color: var(--muted); font-family: monospace;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px;
}
.al-detail-section { margin-bottom: 14px; }
.al-detail-section-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}
.al-detail-desc { font-size: 13px; color: var(--text); line-height: 1.5; }
.al-action-block {
  border-left: 3px solid var(--primary); padding: 10px 14px;
  background: var(--primary-lt); border-radius: 0 var(--r) var(--r) 0;
}
.al-action-label {
  font-size: 10px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px;
}
.al-action-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.al-detail-actions { display: flex; gap: 8px; padding-top: 4px; flex-wrap: wrap; }
.al-dt-table { width: 100%; border-collapse: collapse; }
.al-dt-key {
  font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 5px 12px 5px 0; white-space: nowrap; width: 1%;
  vertical-align: top;
}
.al-dt-val { font-size: 12px; color: var(--text); padding: 5px 0; word-break: break-word; }
.al-dt-table tr { border-bottom: 1px solid var(--border-sub); }
.al-dt-table tr:last-child { border-bottom: none; }

/* ── Budget cards ─────────────────────────────────────────────────── */
.budget-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.budget-card-head {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}
.budget-card-foot {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}

/* ── FinOps grouped-by-severity layout ────────────────────────────── */
.fo-summary-bar {
  display: flex; align-items: center;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  padding: 10px 16px; margin-bottom: 10px;
  flex-wrap: wrap; gap: 4px;
}
.fo-summ-item { display: flex; align-items: center; gap: 6px; }
.fo-summ-val   { font-size: 13px; font-weight: 700; color: var(--text); }
.fo-summ-label { font-size: 12px; color: var(--muted); }
.fo-summ-sep   { width: 1px; height: 16px; background: var(--border); margin: 0 12px; flex-shrink: 0; }
.fo-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.fo-dot-high   { background: var(--error-med); }
.fo-dot-medium { background: var(--warning-med); }
.fo-dot-low    { background: var(--success-med); }

.fo-group { margin-bottom: 8px; }
.fo-group-hdr {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow);
  cursor: pointer; user-select: none; transition: background .1s;
}
.fo-group-hdr:hover { background: var(--bg); }
.fo-group-open .fo-group-hdr {
  border-radius: var(--r-md) var(--r-md) 0 0; border-bottom-color: transparent;
}
.fo-group-title {
  font-size: 12px; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: .06em;
}
.fo-group-count {
  font-size: 11px; font-weight: 700;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 2em; padding: 1px 8px; color: var(--muted);
}
.fo-group-arrow { margin-left: auto; color: var(--muted); transition: transform .15s; }
.fo-arrow-open { transform: rotate(180deg); }

.fo-group-body {
  border: 1px solid var(--border); border-top: none;
  border-radius: 0 0 var(--r-md) var(--r-md); overflow: hidden;
}
.fo-group-collapsed { display: none; }

.fo-card {
  padding: 10px 14px; border-bottom: 1px solid var(--border-sub);
  background: var(--card); transition: background .1s;
}
.fo-card:last-child { border-bottom: none; }
.fo-card:hover { background: var(--bg); }
.fo-card-head {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; margin-bottom: 3px;
}
.fo-card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.fo-rule-id {
  font-size: 10px; color: var(--muted); font-family: monospace;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px; flex-shrink: 0;
}
.fo-card-scope {
  font-size: 11px; color: var(--primary); margin-bottom: 3px;
  display: flex; align-items: center; gap: 4px;
}
.fo-card-desc { font-size: 12px; color: var(--muted); margin-bottom: 4px; line-height: 1.4; }
.fo-details { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.fo-detail-chip { font-size: 11px; color: var(--text); }
.fo-detail-key { color: var(--muted); }
.fo-card-action {
  font-size: 12px; color: var(--success); margin-top: 5px;
  font-weight: 600; display: flex; align-items: center; gap: 4px;
}

/* ── Budgets: resource-group workspace picker ───────────────────────── */
.pc-ws-picker {
  max-height: 180px; overflow-y: auto; border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 4px; background: var(--bg);
}
/* .pc-ws-row layout/checkbox styles consolidated below with .pc-checkbox-row */

/* ── Pricing calculator ──────────────────────────────────────────────── */

/* Top bar right-hand group */
.pc-topbar-right { display:flex; align-items:center; gap:8px; margin-left:auto; flex-wrap:wrap; }

/* Estimate name input */
.pc-name-input {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--text);
  font-family: inherit; outline: none; height: 32px; min-width: 200px; max-width: 340px;
  flex: 1 1 200px; transition: border-color .12s;
}
.pc-name-input:focus { border-color: var(--primary); }
.pc-name-input::placeholder { color: var(--subtle); font-weight: 400; }

/* ── Two-column layout: sidebar left, scrollable cards right ─────────── */
.pc-layout {
  display: flex; flex: 1; min-height: 0;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-md); box-shadow: var(--shadow); overflow: hidden;
}

/* Left sidebar — service catalog */
.pc-sidebar {
  width: 320px; flex-shrink: 0;   /* match the al-list-panel sidebar on Budgets/Anomalies */
  border-right: 1px solid var(--border);
  overflow-y: auto; height: 100%;
  /* themed thin scrollbar */
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.pc-sidebar::-webkit-scrollbar { width: 6px; }
.pc-sidebar::-webkit-scrollbar-track { background: transparent; }
.pc-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.pc-sidebar::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Right main — stacked cards */
.pc-main {
  flex: 1; min-width: 0; overflow-y: auto; height: 100%;
  display: flex; flex-direction: column;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.pc-main::-webkit-scrollbar { width: 6px; }
.pc-main::-webkit-scrollbar-track { background: transparent; }
.pc-main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.pc-main::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* Mobile: stack sidebar above cards */
@media (max-width: 860px) {
  .pc-layout { flex-direction: column; }
  .pc-sidebar { width: 100%; height: 260px; border-right: none; border-bottom: 1px solid var(--border); }
  .pc-main   { height: auto; }
}
@media (max-width: 600px) {
  /* Pricing: cloud/region selects + export go full-width and stack tidily. */
  .pc-topbar-right { width: 100%; }
  .pc-topbar-right .al-filter-sel,
  .pc-topbar-right #pcExportBtn { flex: 1 1 100%; width: 100%; }
  .pc-name-input { max-width: 100%; flex-basis: 100%; }
  /* Totals bar stacks: breakdown chips above the grand total. */
  .pc-cards-total { flex-direction: column; align-items: flex-start; gap: 6px; }
  .pc-cards-total-breakdown { flex-wrap: wrap; gap: 10px; }
  /* Service card header: title + tier/remove wrap instead of squashing. */
  .pc-svc-card-head { align-items: flex-start; }
}
@media (max-width: 480px) {
  .pc-topbar-right { width: 100%; }
  .pc-name-input   { max-width: 100%; }
}

/* ── Secrets Manager responsive ─────────────────────────────────────── */
@media (max-width: 600px) {
  /* Workspace picker + Create Scope row: each control full-width, stacked. The
     picker is enhanced into a .pc-select-wrap, so size that, not the hidden
     native select. */
  .page:has(#secLayout) .al-filter-bar { align-items: stretch; }
  .page:has(#secLayout) .al-filter-bar > *,
  .page:has(#secLayout) .al-filter-bar .pc-select-wrap { width: 100%; min-width: 0; }
  /* The wide value column can shrink on phones. */
  .sec-val-cell { width: auto; max-width: 140px; }
}
/* Permission radios (READ/WRITE/MANAGE) stack on very narrow screens. */
@media (max-width: 460px) {
  .sec-radio-row { flex-direction: column; }
}

/* Sidebar: section header, category labels, add rows */
.pc-list-section {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 12px 14px 6px; display: flex; align-items: center; gap: 6px;
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.pc-cat-label {
  font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase;
  letter-spacing: .03em; padding: 10px 14px 3px;
}
/* Catalog row: "+ Add service" buttons.
   Plus badge stays neutral until row hover, then becomes a filled primary
   circle. The whole row is the click target. */
.pc-add-row {
  cursor: pointer;
  position: relative;
  transition: background .12s, padding .12s;
}
.pc-add-row .al-row-title { font-weight: 500; }
.pc-add-row:hover { background: var(--bg); }

.pc-add-plus {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center;        /* perfectly centres the icon */
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--border);
  transition: background .12s, color .12s, border-color .12s;
}
.pc-add-plus svg { display: block; width: 14px; height: 14px; }
.pc-add-row:hover .pc-add-plus {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Remove button (×) inside card header */
.pc-row-x {
  background: transparent; border: none; cursor: pointer; color: var(--muted);
  padding: 3px; border-radius: 4px; flex-shrink: 0; display: flex;
  transition: color .12s, background .12s;
}
.pc-row-x:hover { color: var(--error-med); background: var(--error-lt); }

/* ── Service cards (stacked in .pc-main) ───────────────────────────── */
/* Cards list — each service card is a self-contained bordered box with a
   gap between cards so the separation is unmistakable. */
.pc-cards-list { display: flex; flex-direction: column; gap: 12px; padding: 12px; }

.pc-svc-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pc-svc-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px; background: var(--bg); gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-sub);
}
.pc-svc-card-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.pc-svc-dot   { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.pc-svc-name  { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-svc-cat   { font-size: 10px; color: var(--muted); background: var(--card); border: 1px solid var(--border); border-radius: 3px; padding: 1px 6px; flex-shrink: 0; white-space: nowrap; }
.pc-svc-card-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* Fixed-width tier slot: the select and the lozenge variants render at the
   same footprint so the header controls line up in a column across cards. */
.pc-tier-slot { display: inline-flex; align-items: center; justify-content: flex-end; width: 96px; flex-shrink: 0; }
.pc-tier-slot .pc-tier-sel { width: 100%; }
.pc-tier-sel  { height: 28px; font-size: 11px; font-weight: 600; }

/* Card body: config left, cost summary right */
/* Config gets the bulk of the width; the cost summary is a compact side rail. */
.pc-svc-card-body  { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(220px, 0.9fr); }
/* Compact 2-column grid for short fields (sliders/checkboxes), full-width
   for selects and wide inputs (declared via .pc-field-full). */
.pc-svc-config {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  border-right: 1px solid var(--border-sub);
  align-content: start;
  align-items: center;   /* a checkbox + a slider in the same row line up centred */
}
.pc-svc-config > .pc-field-full { grid-column: 1 / -1; }
@media (max-width: 540px) { .pc-svc-config { grid-template-columns: 1fr; } }
.pc-svc-cost       { padding: 14px 16px; display: flex; flex-direction: column; }
@media (max-width: 680px) {
  .pc-svc-card-body { grid-template-columns: 1fr; }
  .pc-svc-config    { border-right: none; border-bottom: 1px solid var(--border-sub); }
}

.pc-svc-total { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text); }
.pc-svc-total-label { color: var(--muted); font-weight: 500; }
.pc-svc-total-amt   { font-size: 14px; font-weight: 700; color: var(--text); }

/* Sticky grand-total bar pinned to bottom of .pc-main */
.pc-cards-total {
  margin-top: auto;     /* push to bottom when cards are few */
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; gap: 12px; flex-wrap: wrap;
  background: var(--card); border-top: 2px solid var(--border);
  box-shadow: 0 -2px 8px rgba(9,30,66,.07);
}
.pc-cards-total-breakdown { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.pc-cards-total-breakdown b { color: var(--text); }
.pc-cards-total-amount { display: flex; align-items: center; }
.pc-total-num { font-size: 16px; font-weight: 700; color: var(--text); }

/* ── Shared form controls (sliders, checkboxes, fields) ────────────── */
.pc-field       { display: flex; flex-direction: column; gap: 6px; }
.pc-field-row   { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pc-field-label {
  font-size: 12px; font-weight: 600; color: var(--text);
  /* Allow wrap so longer labels don't get clipped in narrow grid columns. */
  line-height: 1.3; min-width: 0; flex: 1;
}
.pc-field-hint  { font-weight: 400; color: var(--subtle); font-size: 11px; }

.pc-num {
  width: 72px; text-align: center; background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; font-size: 12px; color: var(--text);
  font-family: inherit; outline: none; transition: border-color .12s, box-shadow .12s;
}
.pc-num:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
/* Wide number box (no companion slider). */
.pc-num-wide { width: 100%; max-width: 140px; }

/* Stepper: number input on the LEFT, vertically-stacked up/down arrows on
   the RIGHT, wrapped in a single bordered unit (browser-native idiom).
   The wrapper owns the border + focus ring; the inner pc-num drops its
   own border so we get one cohesive control. The button stack uses the
   page-bg colour (the deeper black) so it visually separates from the
   card-coloured number cell. */
.pc-stepper {
  display: inline-flex; align-items: stretch;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
  height: 32px;
}
.pc-stepper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.pc-stepper .pc-num {
  border: none; border-radius: 0; height: 100%;
  background: transparent; padding: 4px 8px; box-shadow: none;
}
.pc-stepper .pc-num:focus { box-shadow: none; }

.pc-step-stack {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border); flex-shrink: 0;
  background: var(--bg);
}
.pc-step-btn {
  width: 22px; flex: 1 1 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted);
  border: none; padding: 0; cursor: pointer;
  font-family: inherit; line-height: 1;
  transition: background .12s, color .12s;
  user-select: none;
}
.pc-step-btn:hover  { background: var(--primary-lt); color: var(--primary); }
.pc-step-btn:active { background: var(--primary-sub); color: var(--primary); }
.pc-step-btn:focus-visible {
  outline: 2px solid var(--primary); outline-offset: -2px;
}
.pc-step-up   { border-bottom: 1px solid var(--border); }

.pc-range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  background: var(--border); border-radius: 4px; outline: none;
  cursor: pointer; margin: 6px 0 2px;
}
body.dark .pc-range { background: rgba(255,255,255,.08); }
.pc-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(180deg, var(--primary-hov) 0%, var(--primary) 100%);
  cursor: pointer; border: 2px solid var(--card);
  box-shadow: 0 1px 3px rgba(0,82,204,.30), 0 0 0 1px var(--border);
  transition: transform .12s, box-shadow .12s;
}
.pc-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: linear-gradient(180deg, var(--primary-hov) 0%, var(--primary) 100%);
  cursor: pointer; border: 2px solid var(--card);
  box-shadow: 0 1px 3px rgba(0,82,204,.30), 0 0 0 1px var(--border);
}
.pc-range:hover::-webkit-slider-thumb { transform: scale(1.10); }
.pc-range:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--primary-lt); }

/* ── Checkbox rows ───────────────────────────────────────────────────
   Two affordances on purpose:
   • .pc-checkbox-row  = a single on/off boolean  → toggle SWITCH (Option 4)
     (Photon toggle, "selected only").
   • .pc-ws-row        = an item in a multi-select LIST → checkbox SQUARE
     (budget service/resource pickers). A column of switches reads as N
     independent settings; a checkbox correctly means "pick items for a set". */
.pc-checkbox-row,
.pc-ws-row {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 8px 10px; border-radius: 6px;
  user-select: none;
  transition: background .12s;
}
.pc-checkbox-row:hover,
.pc-ws-row:hover { background: var(--bg); }
body.dark .pc-checkbox-row:hover,
body.dark .pc-ws-row:hover { background: rgba(255,255,255,.04); }

/* ─ .pc-checkbox-row → toggle SWITCH ─ */
.pc-checkbox-row input[type="checkbox"] {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  position: relative; flex: 0 0 auto;
  width: 34px; height: 19px; margin: 0; padding: 0;
  background: var(--border); border: none; border-radius: 999px;
  cursor: pointer; transition: background .15s;
}
.pc-checkbox-row input[type="checkbox"]:focus-visible { outline: 2px solid var(--primary-sub); outline-offset: 2px; }
.pc-checkbox-row input[type="checkbox"]:checked { background: var(--primary); }
.pc-checkbox-row input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: left .15s; pointer-events: none;
}
.pc-checkbox-row input[type="checkbox"]:checked::after { left: 17px; }

/* ─ .pc-ws-row → checkbox SQUARE (multi-select list) ─ */
.pc-ws-row input[type="checkbox"] {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  position: relative; flex: 0 0 auto;
  width: 16px; height: 16px; margin: 0; padding: 0;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 4px;
  cursor: pointer; transition: background .14s, border-color .14s;
}
.pc-ws-row:hover input[type="checkbox"] { border-color: var(--primary); }
.pc-ws-row input[type="checkbox"]:focus-visible { outline: 2px solid var(--primary-sub); outline-offset: 1px; }
.pc-ws-row input[type="checkbox"]:checked { background: var(--primary); border-color: transparent; }
.pc-ws-row input[type="checkbox"]::after {
  content: ''; position: absolute; left: 50%; top: 47%;
  width: 8px; height: 4.5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: translate(-50%, -60%) rotate(-45deg) scale(0); transform-origin: center;
  opacity: 0; transition: transform .18s cubic-bezier(.4,1.4,.6,1), opacity .12s; pointer-events: none;
}
.pc-ws-row input[type="checkbox"]:checked::after { transform: translate(-50%, -60%) rotate(-45deg) scale(1); opacity: 1; }

.pc-checkbox-label { font-size: 12px; color: var(--text); line-height: 1.4; }

/* Resource picker row: [check]  name …………  $cost  — name takes the slack,
   cost pinned right. The label span content sits to the right of the box. */
.pc-ws-row > span:not(.pc-res-cost) { font-size: 12px; color: var(--text); }
.pc-res-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pc-res-cost { flex: 0 0 auto; color: var(--muted); font-size: 12px; }

.pc-dim { color: var(--muted); font-size: 11px; }

/* Make .page flex when it contains pc-layout (same pattern as al-layout) */
.page:has(.pc-layout) { display: flex; flex-direction: column; padding-bottom: 16px; }

/* ── Themed scrollbars across all scrolling containers ──────────────── */
/* Covers the budget modal, al-layout panels, chip-input, ws-picker. */
.modal-card,
.modal-body,
.al-list-panel,
.al-detail-panel,
.pc-ws-picker {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.modal-card::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.al-list-panel::-webkit-scrollbar,
.al-detail-panel::-webkit-scrollbar,
.pc-ws-picker::-webkit-scrollbar { width: 6px; }
.modal-card::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.al-list-panel::-webkit-scrollbar-track,
.al-detail-panel::-webkit-scrollbar-track,
.pc-ws-picker::-webkit-scrollbar-track { background: transparent; }
.modal-card::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.al-list-panel::-webkit-scrollbar-thumb,
.al-detail-panel::-webkit-scrollbar-thumb,
.pc-ws-picker::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.modal-card::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.al-list-panel::-webkit-scrollbar-thumb:hover,
.al-detail-panel::-webkit-scrollbar-thumb:hover,
.pc-ws-picker::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Custom themed select (used for long dropdowns like Instance type) ── */
.pc-select {
  position: relative; width: 100%;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 6px; outline: none;
  font-size: 12px; color: var(--text);
  cursor: pointer; user-select: none;
  transition: border-color .12s, box-shadow .12s;
}
.pc-select:focus, .pc-select.pc-select-open {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-lt);
}
.pc-select-display {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; min-height: 32px;
}
.pc-select-label {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: left;
}
.pc-select-chev { color: var(--muted); flex-shrink: 0; transition: transform .14s; }
.pc-select.pc-select-open .pc-select-chev { transform: rotate(180deg); }

.pc-select-popup {
  display: none;
  position: absolute; left: 0; right: 0; top: calc(100% + 4px);
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 240px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
  padding: 4px;
}
/* When the trigger is near the bottom of its scrolling ancestor (e.g. the
   Pricing Calculator card panel which has overflow-y:auto), opening the
   popup downward gets clipped at the panel edge. JS adds .pc-select-up
   to flip the popup above the trigger so the full option list is visible
   regardless of where the trigger sits in the panel. */
.pc-select.pc-select-up .pc-select-popup {
  top: auto; bottom: calc(100% + 4px);
}
.pc-select-popup::-webkit-scrollbar { width: 6px; }
.pc-select-popup::-webkit-scrollbar-track { background: transparent; }
.pc-select-popup::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.pc-select-popup::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.pc-select.pc-select-open .pc-select-popup { display: block; }

.pc-select-option {
  padding: 7px 10px; border-radius: 5px;
  font-size: 12px; color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .1s;
}
.pc-select-option:hover { background: var(--bg); }
.pc-select-option-active {
  background: var(--primary-lt);
  color: var(--primary);
  font-weight: 600;
}
body.dark .pc-select-option-active { background: rgba(87,157,255,.15); }

/* ── Enhanced native <select> (class "pc-enhance") ───────────────────
   js/core/ui.js wraps each tagged <select> in a .pc-select-wrap so the
   themed popup is shown while the (hidden) native select stays the source
   of truth. The native element keeps a11y + keyboard semantics; we just
   remove it from the visual flow. */
.pc-select-native {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
  pointer-events: none;
}
/* Default: size to content so wrapped filter-bar selects stay inline (the
   base .pc-select is width:100%, which would otherwise make every enhanced
   filter dropdown span the whole row and wrap). */
.pc-select-wrap { display: inline-flex; width: auto; min-width: 150px; vertical-align: middle; }
/* In a form/modal context the field should span full width like the other
   inputs around it. */
.modal-body .pc-select-wrap { display: flex; width: 100%; }
/* The display box (.pc-select-display) is the only in-flow flex child of the
   wrapper, so it must grow to fill it — otherwise it shrinks to its label width
   and the chevron floats in mid-control instead of pinning to the right edge.
   flex:1 puts the chevron at the far right for EVERY enhanced dropdown. */
.pc-select-wrap > .pc-select-display { flex: 1 1 auto; min-width: 0; }

/* ── Text alignment polish across the pricing card ────────────────── */
.pc-num { text-align: center; }
.pc-num-wide { text-align: left; }
.pc-svc-cost .al-dt-key { text-align: left; vertical-align: top; }
.pc-svc-cost .al-dt-val { text-align: left; }
.pc-field-row { gap: 12px; }
.pc-field-row .pc-field-label { text-align: left; }
.pc-checkbox-label { vertical-align: middle; }

/* ── Budget multiService resource picker — service groups ──────────── */
.pc-res-group { margin-bottom: 4px; }
.pc-res-group:not(:last-child) { border-bottom: 1px solid var(--border-sub); padding-bottom: 4px; }
.pc-res-group-title {
  font-size: 10px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .03em;
  padding: 6px 8px 2px;
}

/* Disabled custom-select (workspace immutable on edit) */
.pc-select-disabled { opacity: .6; pointer-events: none; }

/* Resource searchable dropdown: the trigger reads like a value field, the
   popup carries the search box + selected-only toggle + scrollable list. */
.pc-res-popup { padding: 0; }            /* controls + list manage their own padding */
.pc-res-popup-controls {
  display: flex; gap: 8px; align-items: center;
  padding: 8px; border-bottom: 1px solid var(--border-sub);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.pc-res-popup-controls .modal-input { height: 30px; font-size: 12px; }
.pc-res-popup-count {
  font-size: 11px; color: var(--muted);
  padding: 6px 10px 2px;
}
.pc-res-popup-list { padding: 2px 4px 6px; }
/* The resources popup is taller than a normal select popup. */
#bMultiSvcResSelect .pc-select-popup { max-height: 340px; }
