:root {
  --console-title-size: 28px;
}
body.console-unified {
  --console-active: var(--accent);
  --console-bar-height: 64px;
  --console-gutter: clamp(24px, 2vw, 40px);
}
.dark body.console-unified { --console-active: rgb(var(--color-accent-secondary)); }
.console-unified .app-shell { min-height: 100dvh; }
.console-unified .sidebar {
  width: 240px;
  flex-basis: 240px;
  padding: 26px 14px 15px;
  background: rgb(var(--color-bg-surface) / .52);
}
.console-unified .brand {
  flex-shrink: 0;
  padding-inline: 10px;
  margin-bottom: 16px;
}
.console-unified .brand-logo { width: 132px; height: auto; }
.console-unified .brand-product {
  margin-top: 8px;
  color: var(--muted);
  font: 500 12px/1.5 var(--heading);
  letter-spacing: .015em;
}
.console-unified .sidebar-user { flex-shrink: 0; padding: 14px 4px 2px; }
.console-unified .user-avatar { background: var(--paper); }
.console-navigation {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 16px 14px 1px;
  scrollbar-gutter: stable;
  scroll-padding-block: 12px;
  overscroll-behavior-y: contain;
}
.console-navigation-empty { padding: 10px; color: var(--muted); font-size: 12px; }
.console-leaf-link {
  display: flex;
  align-items: center;
  border-radius: 6px;
  text-decoration: none;
  line-height: 1.5;
  transition: background-color .16s, color .16s;
}
.console-nav-heading { margin: 0; }
.console-nav-title {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}
.console-nav-title .nav-icon { color: var(--muted); }
.console-nav-title.is-current, .console-nav-title:hover { background: rgb(var(--color-border) / .045); }
.console-group-chevron {
  flex: 0 0 6px;
  height: 6px;
  margin-left: auto;
  margin-right: 3px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  color: var(--muted);
  transform: rotate(-45deg);
}
.console-nav-title[aria-expanded="true"] .console-group-chevron { transform: rotate(45deg); }
.console-leaf-link:hover {
  background: rgb(var(--color-border) / .045);
  color: var(--ink);
}
.console-directory {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 8px 0 12px 20px;
  padding: 0 0 0 8px;
  border-left: 1px solid var(--line);
  list-style: none;
}
.console-leaf-group-start { margin-top: 6px; }
.console-directory:has(.console-category) { gap: 12px; padding-left: 6px; }
.console-category-heading { margin: 0; }
.console-category-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 550;
  text-align: left;
}
.console-category-toggle:hover { background: rgb(var(--color-border) / .045); }
.console-category-toggle[aria-expanded="true"] .console-group-chevron { transform: rotate(45deg); }
.console-category-items { display: flex; flex-direction: column; gap: 3px; margin: 3px 0 0; padding: 0; list-style: none; }
.console-category-items .console-leaf-link { min-height: 36px; padding-block: 8px; font-size: 12px; }
.console-leaf-link {
  position: relative;
  min-height: 40px;
  padding: 10px 12px 10px 28px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.console-leaf-link[aria-current] {
  background: var(--accent-soft);
  color: var(--console-active);
  font-weight: 550;
}
.console-leaf-link[aria-current]::before {
  content: "";
  position: absolute;
  top: calc(50% - 2px);
  left: 14px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}
.console-navigation a:focus-visible, .console-navigation button:focus-visible { outline-offset: -2px; }
.project-heading-group { min-width: 0; flex: 1; }
.project-heading-group .back-link { margin-bottom: 12px; }
.project-header-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; max-width: 100%; }
.project-header-tools > div { max-width: 100%; }
.custom-select.project-selector {
  width: 220px;
  max-width: 100%;
  min-width: 0;
}
.project-selector .custom-select-trigger {
  height: 38px;
  font: 12px/1.6 var(--mono);
}
.project-selector .custom-select-option { font: 12px/1.6 var(--mono); overflow-wrap: anywhere; }
.project-selector .custom-select-menu { max-height: min(320px, 50dvh); overflow-y: auto; }
.project-tabs { display: flex; flex-wrap: wrap; gap: 24px; margin: 0 0 24px; border-bottom: 1px solid var(--line); }
.project-tab {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-bottom: -1px;
  padding: 8px 0 12px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.project-tab:hover { color: var(--ink); }
.project-tab[aria-current] { border-bottom-color: var(--accent); color: var(--accent); }

.console-unified .main-content { margin-inline: 0; padding-inline: var(--console-gutter); }
.console-unified .workspace-bar {
  flex-shrink: 0;
  width: 100%;
  max-width: none;
  height: var(--console-bar-height);
  margin-inline: auto;
}
.console-unified .workspace-label span { white-space: nowrap; }
.console-unified .main-content.console-view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: none;
  padding-bottom: 24px;
}
.console-view .workspace-bar { flex-shrink: 0; }
#console-content {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: none;
  margin-inline: auto;
  padding-top: 24px;
}
.console-frame {
  display: block;
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
}
.console-frame-pending { position: absolute; inset: 0; height: 100%; visibility: hidden; pointer-events: none; }
.console-frame[inert] { pointer-events: none; }
.console-content-document .sidebar { display: none; }
html.console-content-document { scrollbar-gutter: stable; }
.console-content-document .main-content { width: 100%; max-width: none; margin: 0; padding: 0 12px 24px 0; }
.console-content-document .topbar { padding-top: 8px; padding-bottom: 22px; gap: 16px; }
.console-content-document .topbar { flex-wrap: wrap; }
.console-content-document .topbar > * { min-width: 0; max-width: 100%; }
.console-content-document .topbar h1 { overflow-wrap: anywhere; }
.console-content-document .topbar h1 { font-size: var(--console-title-size); }
.console-content-document .project-header { padding-top: 8px; }
.console-content-document .page-section { margin-bottom: 24px; }
.console-content-document .toolbar { margin-bottom: 16px; }
.console-content-document .keys-table th { padding: 12px 14px; }
.console-content-document .keys-table td { padding: 12px 14px; }
.console-content-document body[data-page="keys"] .table-scroll { max-height: none; }
.console-content-document .virtual-keys-table { min-width: 1420px; }
.console-content-document .virtual-keys-table th:first-child,
.console-content-document .virtual-keys-table td:first-child { min-width: 148px; }
.console-content-document .virtual-keys-table th:last-child,
.console-content-document .virtual-keys-table td:last-child { min-width: 150px; width: 150px; }
.console-content-document .virtual-keys-table .key-name { max-width: 180px; overflow-wrap: anywhere; }
.console-content-document .virtual-keys-table .owner-cell { max-width: 160px; white-space: normal; overflow-wrap: anywhere; }
.console-content-document .virtual-keys-table .budget-meter { width: 196px; }
.console-content-document .virtual-keys-table .budget-meter-track { margin-block: 6px; }
.console-content-document .virtual-keys-table .key-timestamp { line-height: 1.6; }
.console-content-document .metric-grid { padding-block: 22px; }
.console-content-document .metric-value { font-size: clamp(22px, 1.9vw, 28px); }
.console-content-document .table-scroll { padding-bottom: 8px; overscroll-behavior-x: contain; }

.project-header, #project-content { max-width: none; }
.project-header { align-items: flex-end; flex-wrap: wrap; gap: 24px; padding: 29px 0 24px; }
.project-header h1 {
  font-size: var(--console-title-size);
  font-weight: 400;
  overflow-wrap: anywhere;
}
#project-count { flex-shrink: 0; white-space: nowrap; }
.console-state, .console-load-message {
  display: grid;
  align-content: center;
  min-height: 126px;
  padding: 22px;
  color: var(--muted);
}
.project-table { min-width: 480px; }
.project-table th { padding: 13px 20px; font-size: 12px; }
.project-table td { padding: 12px 20px; }
.project-table td:first-child { color: var(--ink); overflow-wrap: anywhere; }
.project-list-table th:first-child { width: 54%; }
.project-table th.project-numeric, .project-table td.project-numeric { text-align: right; white-space: nowrap; }
.project-table td.project-numeric { color: var(--ink); font: 12px/1.6 var(--mono); }
.project-table td.empty-table { height: 126px; color: var(--muted); }
.project-table-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  color: var(--ink);
  font-weight: 550;
  text-decoration: none;
}
.project-table-link::after {
  content: "";
  flex: 0 0 6px;
  height: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  opacity: .4;
  transform: rotate(-45deg);
}
.project-table-link:hover, .project-table-link:focus-visible { color: var(--console-active); }
.project-id { font: 500 12px/1.6 var(--mono); }
.project-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }

@media (max-width: 900px) {
  body.console-unified { --console-gutter: 24px; }
}
@media (max-width: 760px) {
  body.console-unified { --console-bar-height: 65px; --console-gutter: 18px; }
  .console-unified.nav-open .sidebar { width: min(244px, 88vw); padding-top: 18px; background: var(--paper); }
  .console-unified .brand { margin-bottom: 16px; }
  .console-nav-title, .console-leaf-link { min-height: 44px; }
  .project-header { gap: 10px; padding: 24px 0 18px; }
  .project-header:has(#project-switch:not([hidden])) .project-heading-group { flex-basis: 100%; }
  .project-header-tools:has(#project-switch:not([hidden])), #project-switch:not([hidden]), .custom-select.project-selector { width: 100%; }
  .project-tabs { gap: 20px; margin-bottom: 20px; }
  .project-table th, .project-table td { padding-inline: 14px; }
  .project-list-table { min-width: 0; table-layout: fixed; }
  .project-list-table th, .project-list-table td { padding-inline: 10px; }
  .project-list-table th:first-child { width: 44%; }
  .project-list-table th.project-numeric, .project-list-table td.project-numeric { white-space: normal; }
  .project-list-table td.project-numeric { overflow-wrap: anywhere; }
  .project-list-table .project-id { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .console-leaf-link { transition: none; }
}
@media (max-width: 600px) {
  /* Keep the key name visible without a second fixed column covering the data. */
  .console-content-document .virtual-keys-table th:last-child,
  .console-content-document .virtual-keys-table td:last-child { position: static; }
}
