:root {
  --bg: #0e1315;
  --bg-deep: #090d0f;
  --rail: #141b1e;
  --panel: #192226;
  --panel-raised: #202b2f;
  --panel-soft: #172024;
  --line: #344247;
  --line-soft: #29363b;
  --text: #ece9df;
  --text-soft: #c7cdc9;
  --muted: #91a0a5;
  --muted-dark: #697a80;
  --orange: #f2a23a;
  --orange-hot: #ffb451;
  --orange-wash: rgba(242, 162, 58, .12);
  --green: #47c783;
  --green-wash: rgba(71, 199, 131, .12);
  --blue: #62a9d1;
  --blue-wash: rgba(98, 169, 209, .12);
  --yellow: #e3b341;
  --yellow-wash: rgba(227, 179, 65, .12);
  --red: #e0645a;
  --red-wash: rgba(224, 100, 90, .12);
  --mono: "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --display: Bahnschrift, "DIN Alternate", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --body: "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --radius: 4px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .34);
  --ease: 160ms cubic-bezier(.2, .75, .25, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(255, 255, 255, .014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .014) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body.is-scroll-locked {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

::selection {
  color: var(--bg-deep);
  background: var(--orange);
}

[hidden] {
  display: none !important;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.65;
}

.noscript {
  padding: 16px;
  color: var(--text);
  background: var(--red);
  text-align: center;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
  font-size: .93em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.beacon {
  display: inline-block;
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--muted);
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(145, 160, 165, .08);
}

.beacon--ok {
  color: var(--green);
  box-shadow: 0 0 0 3px var(--green-wash), 0 0 10px rgba(71, 199, 131, .28);
}

.beacon--warning {
  color: var(--yellow);
  box-shadow: 0 0 0 3px var(--yellow-wash);
}

.beacon--danger {
  color: var(--red);
  box-shadow: 0 0 0 3px var(--red-wash);
}

.beacon--idle {
  color: var(--muted-dark);
}

/* Login */
.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(360px, 1.2fr) minmax(440px, .8fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(242, 162, 58, .07), transparent 24rem),
    linear-gradient(120deg, #0c1113 0%, #12191c 62%, #0d1214 100%);
}

.login-view::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, transparent 49.9%, rgba(242, 162, 58, .26) 50%, transparent 50.1%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(255, 255, 255, .022) 40px);
  content: "";
  pointer-events: none;
}

.login-grid {
  position: absolute;
  top: -15vw;
  left: -10vw;
  width: 65vw;
  height: 65vw;
  border: 1px solid rgba(242, 162, 58, .13);
  background:
    linear-gradient(rgba(242, 162, 58, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 162, 58, .07) 1px, transparent 1px);
  background-size: 42px 42px;
  opacity: .55;
  transform: rotate(18deg);
  mask-image: linear-gradient(135deg, #000, transparent 70%);
}

.login-identity {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 600px;
  padding: 7vw;
  flex-direction: column;
  justify-content: center;
}

.login-identity h1 {
  max-width: 760px;
  margin: 10px 0 24px;
  color: var(--text);
  font-family: var(--display);
  font-size: clamp(68px, 8vw, 132px);
  font-stretch: condensed;
  font-weight: 740;
  letter-spacing: -.055em;
  line-height: .75;
  text-transform: uppercase;
}

.login-identity h1 span {
  color: transparent;
  -webkit-text-stroke: 1px rgba(236, 233, 223, .5);
}

.login-intro {
  max-width: 470px;
  margin: 0;
  color: var(--text-soft);
  font-size: 16px;
}

.system-rail {
  display: flex;
  width: min(100%, 520px);
  margin-top: 64px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
}

.rail-line {
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, var(--line), transparent);
}

.login-panel {
  position: relative;
  z-index: 2;
  width: min(440px, calc(100% - 48px));
  margin: auto;
  padding: 44px 42px 32px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--orange);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .025), transparent 50%),
    var(--panel);
  box-shadow: var(--shadow);
  animation: panel-in 480ms cubic-bezier(.18, .82, .22, 1) both;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-index,
.modal-index {
  position: absolute;
  top: 13px;
  right: 14px;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
}

.login-panel h2,
.drawer-header h2,
.modal h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 680;
  letter-spacing: -.025em;
}

.login-panel h2 {
  font-size: 32px;
}

.login-panel > .muted {
  margin: 7px 0 28px;
  font-size: 12px;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.field > span:first-child,
.field-label {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.search-box input,
.inline-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--text);
  background: #10171a;
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.search-box input:hover,
.inline-input:hover {
  border-color: #4d5d63;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-box input:focus,
.inline-input:focus {
  border-color: var(--orange);
  background: #121a1d;
  box-shadow: inset 3px 0 0 var(--orange-wash);
  outline: 0;
}

.field input::placeholder,
.field textarea::placeholder,
.search-box input::placeholder {
  color: #59696f;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 17px,
    calc(100% - 11px) 17px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 58px;
}

.field-action {
  position: absolute;
  top: 5px;
  right: 5px;
  height: 30px;
  padding: 0 9px;
  border: 0;
  color: var(--orange);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  border-left: 2px solid var(--red);
  color: #f3b0aa;
  background: var(--red-wash);
  font-size: 12px;
}

.login-foot {
  display: flex;
  margin-top: 28px;
  padding-top: 17px;
  border-top: 1px solid var(--line-soft);
  justify-content: space-between;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}

/* Application shell */
.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  padding: 20px 13px 14px;
  border-right: 1px solid var(--line);
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 20%),
    var(--rail);
}

.sidebar::after {
  position: absolute;
  right: -1px;
  bottom: 0;
  width: 1px;
  height: 34%;
  background: linear-gradient(transparent, var(--orange));
  content: "";
  opacity: .5;
}

.brand {
  display: flex;
  padding: 0 8px 19px;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  border: 1px solid var(--orange);
  place-items: center;
  color: var(--bg-deep);
  background:
    linear-gradient(135deg, var(--orange) 0 49%, transparent 50%),
    var(--panel-raised);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 800;
}

.brand-mark span {
  transform: translate(-2px, -2px);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: .05em;
}

.brand small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .12em;
}

.environment-stamp {
  display: flex;
  height: 34px;
  margin: 0 6px 22px;
  padding: 0 10px;
  border: 1px solid var(--line-soft);
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, .012);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}

.environment-stamp b {
  margin-left: auto;
  color: var(--text-soft);
  font-weight: 500;
}

.main-nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  position: relative;
  display: grid;
  width: 100%;
  height: 45px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color var(--ease), border-color var(--ease), background var(--ease), transform var(--ease);
}

.nav-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .025);
  transform: translateX(2px);
}

.nav-item.is-active {
  border-color: var(--line);
  color: var(--text);
  background:
    linear-gradient(90deg, var(--orange-wash), transparent 58%),
    var(--panel-soft);
}

.nav-item.is-active::before {
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: -1px;
  width: 2px;
  background: var(--orange);
  content: "";
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.nav-item span {
  font-size: 12px;
  font-weight: 650;
}

.nav-item small {
  display: none;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 8px;
}

.sidebar-foot {
  display: grid;
  margin-top: auto;
  padding: 14px 7px 0;
  border-top: 1px solid var(--line-soft);
  gap: 12px;
}

.service-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .06em;
}

.service-mini strong {
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
}

.service-mini .beacon {
  width: 5px;
  height: 5px;
  margin-right: 5px;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  height: 74px;
  padding: 0 26px 0 31px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  background: rgba(14, 19, 21, .92);
  backdrop-filter: blur(14px);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 13px;
}

.topbar-title h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 21px;
  font-weight: 660;
  letter-spacing: -.02em;
}

.topbar-title .eyebrow {
  margin-bottom: 0;
}

.topbar-actions {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 8px;
}

.live-state,
.admin-chip {
  display: flex;
  height: 38px;
  padding: 0 12px;
  border-left: 1px solid var(--line-soft);
  align-items: center;
  gap: 9px;
}

.live-state small,
.live-state strong,
.admin-chip small,
.admin-chip strong {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.4;
  letter-spacing: .08em;
}

.live-state small,
.admin-chip small {
  color: var(--muted-dark);
}

.live-state strong {
  color: var(--green);
}

.live-state strong.is-offline {
  color: var(--red);
}

.admin-chip strong {
  max-width: 120px;
  overflow: hidden;
  color: var(--text-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signal {
  display: flex;
  height: 16px;
  align-items: flex-end;
  gap: 2px;
}

.signal i {
  display: block;
  width: 3px;
  background: var(--green);
  animation: signal 1.6s ease-in-out infinite alternate;
}

.signal i:nth-child(1) {
  height: 6px;
}

.signal i:nth-child(2) {
  height: 10px;
  animation-delay: 180ms;
}

.signal i:nth-child(3) {
  height: 15px;
  animation-delay: 360ms;
}

@keyframes signal {
  to { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

.admin-avatar {
  display: grid;
  width: 27px;
  height: 27px;
  border: 1px solid var(--line);
  place-items: center;
  color: var(--orange);
  background: var(--panel);
  font-family: var(--display);
  font-size: 11px;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}

.icon-button:hover {
  border-color: var(--line);
  color: var(--text);
  background: var(--panel);
}

.icon-button svg {
  width: 17px;
  height: 17px;
}

.menu-button {
  display: none;
}

.connection-banner {
  position: relative;
  display: flex;
  min-height: 42px;
  padding: 8px 30px;
  border-bottom: 1px solid rgba(224, 100, 90, .4);
  align-items: center;
  gap: 9px;
  color: #f2bbb6;
  background: var(--red-wash);
  font-size: 12px;
}

.connection-banner svg {
  width: 16px;
  height: 16px;
}

.connection-banner button {
  margin-left: auto;
  border: 0;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-decoration: underline;
}

.page-content {
  width: min(1500px, 100%);
  min-height: calc(100vh - 74px);
  margin: 0 auto;
  padding: 31px;
}

.page-enter {
  animation: page-enter 320ms ease-out both;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Common controls */
.page-heading {
  display: flex;
  margin-bottom: 22px;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.page-heading h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(28px, 3vw, 42px);
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: 1.05;
}

.page-heading p:not(.eyebrow) {
  max-width: 660px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.heading-actions,
.button-row,
.table-actions,
.drawer-actions,
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.button {
  display: inline-flex;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 3px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-soft);
  background: var(--panel);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-decoration: none;
  transition: border-color var(--ease), color var(--ease), background var(--ease), transform var(--ease);
}

.button:hover:not(:disabled) {
  border-color: #59686e;
  color: var(--text);
  background: var(--panel-raised);
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.button svg {
  width: 15px;
  height: 15px;
}

.button--primary {
  border-color: var(--orange);
  color: #17130e;
  background: var(--orange);
}

.button--primary:hover:not(:disabled) {
  border-color: var(--orange-hot);
  color: #17130e;
  background: var(--orange-hot);
}

.button--danger {
  border-color: rgba(224, 100, 90, .52);
  color: #ef9a93;
  background: var(--red-wash);
}

.button--danger:hover:not(:disabled) {
  border-color: var(--red);
  color: #ffd9d5;
  background: rgba(224, 100, 90, .2);
}

.button--ghost {
  background: transparent;
}

.button--small {
  min-height: 29px;
  padding: 5px 9px;
  font-size: 10px;
}

.button--wide {
  width: 100%;
}

.action-link {
  padding: 3px 1px;
  border: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.action-link:hover {
  color: #94c9e7;
  text-decoration: underline;
}

.action-link--danger {
  color: #ec8d85;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .018), transparent 54%),
    var(--panel);
}

.panel::before {
  position: absolute;
  top: -1px;
  left: 18px;
  width: 36px;
  height: 1px;
  background: var(--orange);
  content: "";
  opacity: .7;
}

.panel-header {
  display: flex;
  min-height: 54px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.panel-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.panel-body {
  padding: 17px;
}

.panel-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.status-chip {
  display: inline-flex;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, .018);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .04em;
  line-height: 1;
  white-space: nowrap;
}

.status-chip::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status--active,
.status--enabled,
.status--ready,
.status--success {
  border-color: rgba(71, 199, 131, .3);
  color: var(--green);
  background: var(--green-wash);
}

.status--draft,
.status--pending,
.status--applying {
  border-color: rgba(227, 179, 65, .3);
  color: var(--yellow);
  background: var(--yellow-wash);
}

.status--disabled,
.status--suspended,
.status--expired {
  border-color: rgba(145, 160, 165, .24);
  color: var(--muted);
  background: rgba(145, 160, 165, .07);
}

.status--revoked,
.status--failed,
.status--error {
  border-color: rgba(224, 100, 90, .35);
  color: var(--red);
  background: var(--red-wash);
}

.status--info,
.status--historical {
  border-color: rgba(98, 169, 209, .3);
  color: var(--blue);
  background: var(--blue-wash);
}

.toolbar {
  display: flex;
  min-height: 56px;
  margin-bottom: 12px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  align-items: center;
  gap: 8px;
  background: var(--panel-soft);
}

.search-box {
  position: relative;
  width: min(360px, 100%);
}

.search-box svg {
  position: absolute;
  top: 10px;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--muted-dark);
}

.search-box input {
  min-height: 36px;
  padding-left: 35px;
}

.toolbar-spacer {
  flex: 1;
}

.segmented {
  display: inline-flex;
  min-height: 36px;
  padding: 3px;
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  background: #10171a;
}

.segmented button {
  padding: 4px 10px;
  border: 0;
  border-radius: 2px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.segmented button.is-active {
  color: var(--text);
  background: var(--panel-raised);
}

/* Overview */
.readout-strip {
  display: grid;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-top: 2px solid #4b5a5f;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--panel);
}

.readout {
  position: relative;
  min-height: 112px;
  padding: 18px 18px 15px;
  border-right: 1px solid var(--line-soft);
  overflow: hidden;
}

.readout:last-child {
  border-right: 0;
}

.readout::after {
  position: absolute;
  right: -20px;
  bottom: -25px;
  width: 75px;
  height: 75px;
  border: 1px solid rgba(255, 255, 255, .035);
  border-radius: 50%;
  content: "";
}

.readout-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
}

.readout strong {
  display: block;
  margin-top: 8px;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.readout strong.word-value {
  color: var(--green);
  font-size: 24px;
  letter-spacing: -.02em;
}

.readout small {
  display: block;
  margin-top: 9px;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 8px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 16px;
}

.overview-stack {
  display: grid;
  align-content: start;
  gap: 16px;
}

.service-list,
.event-list,
.version-list,
.grant-list {
  display: grid;
}

.service-row,
.event-row,
.version-row {
  display: grid;
  min-height: 57px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
}

.service-row:last-child,
.event-row:last-child,
.version-row:last-child {
  border-bottom: 0;
}

.service-row {
  grid-template-columns: 15px minmax(0, 1fr) auto;
  gap: 11px;
}

.service-row strong,
.event-row strong {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
}

.service-row small,
.event-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.service-value {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-align: right;
}

.revision-block {
  padding: 21px 18px;
}

.revision-values {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 13px;
}

.revision-values > div:last-child {
  text-align: right;
}

.revision-values small {
  display: block;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 8px;
}

.revision-values strong {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
}

.revision-arrow {
  color: var(--orange);
}

.revision-track {
  position: relative;
  height: 4px;
  margin-top: 18px;
  background: #0f1517;
}

.revision-track span {
  display: block;
  width: var(--revision-progress, 100%);
  height: 100%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(71, 199, 131, .22);
}

.revision-track--ready span {
  width: 100%;
}

.revision-track--pending span {
  width: 54%;
}

.field--audit-filter {
  min-width: 210px;
}

.expiry-item {
  display: grid;
  min-height: 59px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.expiry-item:last-child {
  border-bottom: 0;
}

.expiry-item strong {
  display: block;
  font-size: 11px;
}

.expiry-item small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.expiry-time {
  color: var(--yellow);
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
}

/* Data tables */
.table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}

.data-table th,
.data-table td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  height: 40px;
  color: var(--muted-dark);
  background: #131b1e;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--ease);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, .019);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table td {
  color: var(--text-soft);
  font-size: 11px;
}

.data-table td strong {
  display: block;
  color: var(--text);
  font-size: 11px;
  font-weight: 650;
}

.data-table td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.table-empty {
  padding: 54px 20px !important;
  color: var(--muted) !important;
  text-align: center !important;
}

.tool-id {
  display: inline-flex;
  padding: 3px 6px;
  border-left: 2px solid var(--blue);
  color: #a6cde4;
  background: var(--blue-wash);
  font-family: var(--mono);
  font-size: 9px;
}

.skill-cell {
  display: flex;
  min-width: 170px;
  align-items: center;
  gap: 10px;
}

.skill-glyph {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  place-items: center;
  color: var(--orange);
  background: #11181b;
  font-family: var(--display);
  font-size: 10px;
  font-weight: 800;
}

.switch {
  position: relative;
  display: inline-flex;
  min-width: 40px;
  height: 22px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 2px;
  align-items: center;
  background: #0f1517;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  width: 16px;
  height: 16px;
  background: var(--muted-dark);
  transition: transform var(--ease), background var(--ease);
}

.switch input:checked + span {
  background: var(--green);
  transform: translateX(17px);
}

.pagination-foot {
  display: flex;
  min-height: 42px;
  padding: 8px 12px;
  border-top: 1px solid var(--line-soft);
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

/* Empty, loading and errors */
.empty-state,
.error-state {
  display: grid;
  min-height: 280px;
  padding: 36px;
  border: 1px dashed var(--line);
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-mark,
.error-mark {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 15px;
  border: 1px solid var(--line);
  place-items: center;
  color: var(--muted);
  background: var(--panel);
}

.empty-state h2,
.error-state h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
}

.empty-state p,
.error-state p {
  max-width: 480px;
  margin: 6px 0 17px;
  color: var(--muted);
  font-size: 11px;
}

.loading-frame {
  display: grid;
  gap: 12px;
}

.skeleton {
  position: relative;
  min-height: 86px;
  border: 1px solid var(--line-soft);
  overflow: hidden;
  background: var(--panel);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .04), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

/* Drawer and forms */
.drawer-layer,
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.drawer-backdrop,
.modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(3, 6, 7, .72);
  backdrop-filter: blur(2px);
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  width: min(620px, calc(100% - 30px));
  height: 100%;
  border-left: 1px solid var(--line);
  grid-template-rows: auto minmax(0, 1fr);
  background:
    linear-gradient(rgba(255, 255, 255, .015) 1px, transparent 1px),
    var(--rail);
  background-size: 100% 40px;
  box-shadow: -18px 0 60px rgba(0, 0, 0, .45);
  animation: drawer-in 220ms var(--ease) both;
}

@keyframes drawer-in {
  from { transform: translateX(30px); opacity: 0; }
}

.drawer-header {
  display: flex;
  min-height: 75px;
  padding: 16px 18px 14px 22px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  background: rgba(25, 34, 38, .96);
}

.drawer-header h2 {
  font-size: 21px;
}

.drawer-body {
  overflow-y: auto;
  padding: 21px 22px 96px;
}

.drawer-section {
  margin-bottom: 25px;
}

.drawer-section-title {
  display: flex;
  margin-bottom: 11px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  justify-content: space-between;
}

.drawer-section-title h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 14px;
}

.drawer-section-title small {
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.field--full {
  grid-column: 1 / -1;
}

.code-input {
  min-height: 170px !important;
  font-family: var(--mono) !important;
  font-size: 11px !important;
  line-height: 1.6;
  tab-size: 2;
}

.checkbox-row {
  display: flex;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  background: #11181b;
  cursor: pointer;
  font-size: 11px;
}

.checkbox-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--orange);
}

.drawer-actions {
  position: sticky;
  bottom: -96px;
  z-index: 2;
  margin: 27px -22px -96px;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
  background: rgba(20, 27, 30, .97);
  backdrop-filter: blur(12px);
}

.version-list {
  border: 1px solid var(--line-soft);
  background: #11181b;
}

.version-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.version-meta {
  display: flex;
  margin-top: 5px;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.version-row h4 {
  display: flex;
  margin: 0;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

.version-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.text-button--download {
  color: var(--blue) !important;
}

.detail-pairs {
  display: grid;
  border: 1px solid var(--line-soft);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: #11181b;
}

.detail-pair {
  min-height: 64px;
  padding: 11px 12px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.detail-pair:nth-child(2n) {
  border-right: 0;
}

.detail-pair small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .05em;
}

.detail-pair strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.grant-list {
  gap: 8px;
}

.grant-row {
  display: grid;
  min-height: 69px;
  padding: 11px;
  border: 1px solid var(--line-soft);
  grid-template-columns: auto minmax(0, 1fr) minmax(150px, .55fr);
  align-items: center;
  gap: 11px;
  background: #11181b;
}

.grant-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--orange);
}

.grant-row strong,
.grant-row small {
  display: block;
}

.grant-row strong {
  font-size: 11px;
}

.grant-row small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.grant-row select {
  width: 100%;
  min-height: 34px;
  padding: 6px 26px 6px 8px;
  border: 1px solid var(--line);
  color: var(--text-soft);
  background: var(--panel);
  font-size: 10px;
}

.permission-preview {
  margin-top: 11px;
  padding: 10px 12px;
  border-left: 2px solid var(--blue);
  color: var(--muted);
  background: var(--blue-wash);
  font-size: 10px;
}

.danger-zone {
  padding: 13px;
  border: 1px solid rgba(224, 100, 90, .35);
  background: var(--red-wash);
}

.danger-zone h3 {
  margin: 0 0 4px;
  color: #f0b0aa;
  font-size: 12px;
}

.danger-zone p {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 10px;
}

/* Modal */
.modal-layer {
  display: grid;
  padding: 22px;
  place-items: center;
}

.modal {
  position: relative;
  z-index: 1;
  width: min(540px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--orange);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .025), transparent 54%),
    var(--panel);
  box-shadow: var(--shadow);
  animation: panel-in 220ms var(--ease) both;
}

.modal-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  border: 1px solid var(--orange);
  place-items: center;
  color: var(--orange);
  background: var(--orange-wash);
}

.modal h2 {
  font-size: 24px;
}

.modal-body-copy,
.modal p {
  color: var(--muted);
  font-size: 11px;
}

.token-secret {
  display: grid;
  margin: 17px 0;
  padding: 13px;
  border: 1px solid var(--orange);
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--text);
  background: #0d1315;
  font-family: var(--mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.modal-note {
  padding: 9px 11px;
  border-left: 2px solid var(--yellow);
  color: #d4c392;
  background: var(--yellow-wash);
  font-size: 10px;
}

.modal-actions {
  margin-top: 20px;
  justify-content: flex-end;
}

/* Audit */
.audit-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.audit-action::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.audit-action--danger::before {
  background: var(--red);
}

.audit-action--success::before {
  background: var(--green);
}

.json-view {
  max-height: 360px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  color: #b7ccd5;
  background: #0c1113;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
}

/* Toasts */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
}

.toast {
  display: grid;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  color: var(--text-soft);
  background: rgba(25, 34, 38, .98);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  font-size: 11px;
  animation: toast-in 200ms var(--ease) both;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.toast--leaving {
  opacity: 0;
  transform: translateX(12px);
}

.clipboard-proxy {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.toast--success {
  border-left-color: var(--green);
}

.toast--error {
  border-left-color: var(--red);
}

.toast svg {
  width: 15px;
  height: 15px;
}

.toast button {
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(18px); }
}

/* Responsive */
@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 9px;
  }

  .brand {
    padding-inline: 10px;
    justify-content: center;
  }

  .brand > div:last-child,
  .environment-stamp span:not(.beacon),
  .environment-stamp b,
  .nav-item span,
  .nav-item small,
  .sidebar-foot {
    display: none;
  }

  .environment-stamp {
    justify-content: center;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .nav-item svg {
    width: 19px;
    height: 19px;
  }

  .readout-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .readout:nth-child(3) {
    border-right: 0;
  }

  .readout:nth-child(n+4) {
    border-top: 1px solid var(--line-soft);
  }

  .overview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .login-view {
    display: block;
    padding: 74px 0 40px;
  }

  .login-view::before {
    background: repeating-linear-gradient(0deg, transparent 0 39px, rgba(255, 255, 255, .018) 40px);
  }

  .login-identity {
    min-height: auto;
    padding: 0 24px 40px;
  }

  .login-identity h1 {
    margin: 8px 0 17px;
    font-size: clamp(52px, 18vw, 80px);
  }

  .system-rail {
    margin-top: 30px;
  }

  .login-panel {
    width: calc(100% - 32px);
    padding: 35px 24px 26px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 55;
    width: min(270px, calc(100vw - 44px));
    height: 100%;
    padding: 20px 13px 14px;
    transform: translateX(-102%);
    transition: transform 220ms var(--ease);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar .brand {
    padding-inline: 8px;
    justify-content: flex-start;
  }

  .sidebar .brand > div:last-child,
  .sidebar .environment-stamp span:not(.beacon),
  .sidebar .environment-stamp b,
  .sidebar .nav-item span,
  .sidebar .nav-item small,
  .sidebar .sidebar-foot {
    display: initial;
  }

  .sidebar .environment-stamp {
    justify-content: flex-start;
  }

  .sidebar .environment-stamp b {
    margin-left: auto;
  }

  .sidebar .nav-item {
    grid-template-columns: 20px 1fr auto;
    justify-items: initial;
  }

  .sidebar .sidebar-foot {
    display: grid;
  }

  .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 50;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(4, 7, 8, .72);
  }

  .topbar {
    height: 64px;
    padding: 0 14px;
  }

  .menu-button {
    display: inline-grid;
  }

  .topbar-title h2 {
    font-size: 18px;
  }

  .topbar-title .eyebrow,
  .live-state,
  .admin-chip {
    display: none;
  }

  .page-content {
    min-height: calc(100vh - 64px);
    padding: 20px 14px 80px;
  }

  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading h1 {
    font-size: 28px;
  }

  .heading-actions .button {
    flex: 1;
  }

  .readout-strip {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .readout {
    min-width: 160px;
    min-height: 100px;
    border-top: 0 !important;
    border-right: 1px solid var(--line-soft) !important;
    scroll-snap-align: start;
  }

  .readout strong {
    font-size: 29px;
  }

  .toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .search-box {
    width: 100%;
  }

  .toolbar-spacer {
    display: none;
  }

  .segmented {
    flex: 1;
  }

  .segmented button {
    flex: 1;
  }

  .table-scroll {
    overflow: visible;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-table tbody tr {
    padding: 7px 12px;
    border-bottom: 1px solid var(--line);
  }

  .data-table tbody tr:last-child {
    border-bottom: 0;
  }

  .data-table td {
    display: grid;
    min-height: 37px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line-soft);
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    text-align: right;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    color: var(--muted-dark);
    content: attr(data-label);
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: .06em;
    text-align: left;
  }

  .data-table td > * {
    justify-self: end;
  }

  .data-table .skill-cell {
    min-width: 0;
    text-align: left;
  }

  .data-table .table-actions {
    justify-content: flex-end;
  }

  .drawer {
    width: 100%;
  }

  .drawer-body {
    padding-inline: 15px;
  }

  .drawer-actions {
    margin-inline: -15px;
    padding-inline: 15px;
  }

  .form-grid,
  .detail-pairs {
    grid-template-columns: 1fr;
  }

  .detail-pair {
    border-right: 0;
  }

  .grant-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .grant-row select {
    grid-column: 1 / -1;
  }

  .modal {
    padding: 29px 20px 22px;
  }
}

/* Destructive token cleanup confirmation */
.button--danger {
  border-color: #f1b8bd !important;
  color: #c62836 !important;
  background: #fff5f5 !important;
}

.button--danger:hover:not(:disabled) {
  border-color: #d94a57 !important;
  color: #a61f2c !important;
  background: #ffe8ea !important;
}

.delete-token-summary {
  display: flex;
  margin: 12px 0 14px;
  padding: 11px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  background: #fafafd;
  font-size: 12px;
}

.delete-token-summary .mono {
  color: var(--text-soft);
}

.delete-warning {
  margin: 0 0 16px;
}

.delete-warning + .modal-note {
  margin-top: 12px;
}

@media (max-width: 430px) {
  .login-view {
    padding-top: 48px;
  }

  .login-identity {
    padding-inline: 18px;
  }

  .login-intro {
    font-size: 14px;
  }

  .login-panel {
    width: calc(100% - 24px);
  }

  .page-heading h1 {
    font-size: 25px;
  }

  .heading-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    min-height: 44px;
  }

  .button--small {
    min-height: 34px;
  }

  .panel-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .version-row {
    grid-template-columns: 1fr;
  }

  .version-actions {
    justify-content: flex-end;
  }

  .token-secret {
    grid-template-columns: 1fr;
  }
}

/* Keep the application state machine authoritative over responsive display
   rules.  Equal-specificity media overrides must never reveal a hidden view. */
#loginView[hidden],
#appView[hidden],
#drawerLayer[hidden],
#modalLayer[hidden],
#mobileScrim[hidden] {
  display: none !important;
}

/* ========================================================================
   V2 — Apple light surfaces + Oracle-style resource console
   ======================================================================== */

:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-deep: #ffffff;
  --rail: #fbfbfd;
  --panel: #ffffff;
  --panel-raised: #ffffff;
  --panel-soft: #f2f2f7;
  --line: #d2d2d7;
  --line-soft: #e5e5ea;
  --text: #1d1d1f;
  --text-soft: #424245;
  --muted: #6e6e73;
  --muted-dark: #86868b;
  --orange: #ff9500;
  --orange-hot: #ff9f0a;
  --orange-wash: #fff4e5;
  --green: #248a3d;
  --green-wash: #e7f6eb;
  --blue: #0071e3;
  --blue-wash: #e8f2ff;
  --yellow: #9a6700;
  --yellow-wash: #fff5d6;
  --red: #d70015;
  --red-wash: #ffeaed;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-soft: 0 2px 10px rgba(0, 0, 0, .045);
  --ease: 180ms cubic-bezier(.2, .7, .2, 1);
}

html,
body {
  min-width: 320px;
  background: var(--bg) !important;
  color: var(--text) !important;
}

body {
  overflow-x: hidden;
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
}

body::before,
body::after,
.login-view::before,
.sidebar::after,
.login-grid {
  display: none !important;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue) !important;
  outline-offset: 2px;
}

::selection {
  color: #fff;
  background: var(--blue);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.eyebrow {
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 700;
  letter-spacing: .08em !important;
  text-transform: none !important;
}

.muted {
  color: var(--muted) !important;
}

.mono {
  font-family: var(--mono) !important;
  font-size: .9em;
}

/* Login */
.login-view {
  grid-template-columns: minmax(0, 1fr) minmax(390px, 520px) !important;
  gap: clamp(24px, 7vw, 120px);
  padding: clamp(24px, 5vw, 80px) clamp(24px, 7vw, 120px) !important;
  background:
    radial-gradient(circle at 18% 20%, rgba(0, 113, 227, .10), transparent 28rem),
    var(--bg) !important;
}

.login-identity {
  min-height: 0 !important;
  padding: 0 !important;
  justify-content: center;
}

.login-identity h1 {
  max-width: 650px;
  margin: 16px 0 22px !important;
  color: var(--text) !important;
  font-size: clamp(64px, 8vw, 124px) !important;
  font-weight: 750;
  letter-spacing: -.075em;
  line-height: .86 !important;
  text-transform: none !important;
}

.login-identity h1 span {
  color: var(--blue) !important;
  -webkit-text-stroke: 0 !important;
}

.login-intro {
  max-width: 520px;
  color: var(--text-soft) !important;
  font-size: 17px !important;
  line-height: 1.65;
}

.system-rail {
  width: min(100%, 500px);
  margin-top: 44px !important;
  color: var(--muted) !important;
  font-size: 11px !important;
  letter-spacing: .06em;
}

.rail-line {
  background: var(--line) !important;
}

.login-panel {
  align-self: center;
  width: 100%;
  padding: 38px !important;
  border: 1px solid var(--line) !important;
  border-radius: 20px !important;
  color: var(--text) !important;
  background: rgba(255, 255, 255, .92) !important;
  box-shadow: 0 18px 55px rgba(31, 35, 41, .10) !important;
  backdrop-filter: blur(18px);
}

.panel-index,
.modal-index {
  color: var(--blue) !important;
  font-family: var(--mono) !important;
  font-size: 10px !important;
  letter-spacing: .08em;
}

.login-panel h2 {
  color: var(--text) !important;
  font-size: 30px !important;
  letter-spacing: -.035em;
}

.login-foot {
  border-top-color: var(--line-soft) !important;
  color: var(--muted-dark) !important;
}

/* Shell / navigation */
.app-shell {
  grid-template-columns: 244px minmax(0, 1fr) !important;
  background: var(--bg) !important;
}

.sidebar {
  padding: 22px 14px 16px !important;
  border-right: 1px solid var(--line) !important;
  background: rgba(251, 251, 253, .96) !important;
  box-shadow: 3px 0 18px rgba(0, 0, 0, .025);
  backdrop-filter: blur(16px);
}

.brand {
  padding: 0 10px 22px !important;
  gap: 12px;
}

.brand-mark {
  width: 38px !important;
  height: 38px !important;
  border: 0 !important;
  border-radius: 11px !important;
  color: #fff !important;
  background: linear-gradient(145deg, #0071e3, #34a8ff) !important;
  box-shadow: 0 5px 12px rgba(0, 113, 227, .22);
}

.brand strong {
  color: var(--text) !important;
  font-size: 15px !important;
  letter-spacing: -.02em !important;
  text-transform: none;
}

.brand small {
  color: var(--muted) !important;
  font-family: var(--body) !important;
  font-size: 10px !important;
  letter-spacing: 0 !important;
}

.environment-stamp {
  height: 42px !important;
  margin: 0 5px 22px !important;
  padding: 0 12px !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  color: var(--text-soft) !important;
  background: #fff !important;
  font-family: var(--body) !important;
  font-size: 12px !important;
  letter-spacing: 0 !important;
}

.environment-stamp b {
  color: var(--muted) !important;
  font-weight: 600;
}

.nav-group-label {
  margin: 18px 11px 6px;
  color: var(--muted-dark);
  font-size: 11px;
  font-weight: 650;
}

.nav-group-label:first-child {
  margin-top: 0;
}

.nav-item {
  grid-template-columns: 20px minmax(0, 1fr) !important;
  height: 44px !important;
  padding: 0 12px !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  color: var(--muted) !important;
  background: transparent !important;
  transition: color var(--ease), background var(--ease), border-color var(--ease), transform var(--ease);
}

.nav-item:hover {
  color: var(--text) !important;
  background: #f0f1f5 !important;
  transform: none !important;
}

.nav-item.is-active {
  border-color: #cfe3ff !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.nav-item.is-active::before {
  top: 9px;
  bottom: 9px;
  left: -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue) !important;
}

.nav-item span {
  font-size: 13px !important;
  font-weight: 650;
}

.nav-item small {
  display: none !important;
  color: var(--muted-dark) !important;
  font-family: var(--mono) !important;
  font-size: 10px !important;
}

.sidebar-foot {
  padding: 15px 8px 0 !important;
  border-top-color: var(--line-soft) !important;
}

.service-mini {
  color: var(--muted) !important;
  font-family: var(--body) !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
}

.service-mini strong {
  color: var(--text-soft) !important;
  font-family: var(--mono) !important;
  font-size: 10px !important;
}

/* Make the two service indicators self-explanatory without opening a page.
 * The first line names the service and the second line states its boundary;
 * this prevents the admin API and the public MCP transport being conflated. */
.service-mini {
  align-items: flex-start !important;
  gap: 12px;
}

.service-mini-copy {
  display: grid !important;
  min-width: 0;
  gap: 2px;
}

.service-mini-copy b {
  color: var(--muted) !important;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.service-mini-copy small {
  display: block !important;
  overflow-wrap: anywhere;
  color: var(--muted-dark) !important;
  font-family: var(--body) !important;
  font-size: 10px !important;
  letter-spacing: 0 !important;
  line-height: 1.25;
}

.service-mini > strong {
  flex: 0 0 auto;
  margin-top: 1px;
  white-space: nowrap;
}

.topbar {
  height: 68px !important;
  padding: 0 32px !important;
  border-bottom: 1px solid var(--line) !important;
  background: rgba(255, 255, 255, .88) !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .035);
  backdrop-filter: blur(18px);
}

.topbar-title h2 {
  color: var(--text) !important;
  font-size: 20px !important;
  font-weight: 700;
  letter-spacing: -.035em;
}

.topbar-title .eyebrow {
  color: var(--muted) !important;
}

.topbar-actions {
  gap: 10px !important;
}

.context-chip {
  display: flex;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  align-items: center;
  gap: 8px;
  background: #fff;
}

.context-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-wash);
}

.context-chip small,
.context-chip strong {
  display: block;
  line-height: 1.25;
}

.context-chip small {
  color: var(--muted-dark);
  font-size: 10px;
}

.context-chip strong {
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

.live-state,
.admin-chip {
  height: 40px !important;
  padding: 0 12px !important;
  border-left-color: var(--line-soft) !important;
}

.live-state small,
.admin-chip small {
  color: var(--muted-dark) !important;
  font-family: var(--body) !important;
  font-size: 10px !important;
  letter-spacing: 0 !important;
}

.live-state strong,
.admin-chip strong {
  color: var(--text-soft) !important;
  font-family: var(--body) !important;
  font-size: 12px !important;
  letter-spacing: 0 !important;
}

.live-state strong {
  color: var(--green) !important;
}

.live-state strong.is-offline {
  color: var(--red) !important;
}

.admin-avatar {
  width: 30px !important;
  height: 30px !important;
  border: 0 !important;
  border-radius: 50% !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
  font-size: 12px !important;
}

.icon-button {
  width: 40px !important;
  height: 40px !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  color: var(--text-soft) !important;
  background: #fff !important;
}

.icon-button:hover {
  border-color: #b9c9da !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.connection-banner {
  margin: 16px 36px 0 !important;
  border: 1px solid #f2c7cc !important;
  border-radius: 10px !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

.page-content {
  max-width: 1540px;
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: 30px 36px 64px !important;
  background: transparent !important;
}

.page-heading {
  margin-bottom: 22px !important;
  align-items: flex-end !important;
}

.page-heading h1 {
  margin: 0 !important;
  color: var(--text) !important;
  font-size: clamp(30px, 3vw, 42px) !important;
  font-weight: 750 !important;
  letter-spacing: -.055em !important;
  line-height: 1.08 !important;
}

.page-heading p:not(.eyebrow) {
  max-width: 780px;
  margin-top: 8px !important;
  color: var(--muted) !important;
  font-size: 14px !important;
}

.heading-actions {
  gap: 8px !important;
}

.button {
  min-height: 40px !important;
  padding: 0 16px !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 650 !important;
}

.button--primary {
  border-color: var(--blue) !important;
  color: #fff !important;
  background: var(--blue) !important;
  box-shadow: 0 4px 10px rgba(0, 113, 227, .16);
}

.button--primary:hover {
  border-color: #0068d1 !important;
  background: #0068d1 !important;
}

.button--ghost {
  border-color: var(--line) !important;
  color: var(--text-soft) !important;
  background: #fff !important;
}

.button--ghost:hover {
  border-color: #b8c9dc !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.button--danger,
.text-button--danger {
  color: var(--red) !important;
}

.text-button {
  padding: 4px 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.text-button:hover {
  color: #005bb5;
  text-decoration: underline;
}

.text-button--small {
  font-size: 12px;
}

/* Shared cards and metrics */
.panel,
.table-shell {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  color: var(--text) !important;
  background: var(--panel) !important;
  box-shadow: var(--shadow-soft) !important;
}

.panel-header--v2 {
  min-height: 70px;
  padding: 16px 20px !important;
  border-bottom: 1px solid var(--line-soft) !important;
  align-items: center;
}

.panel-header--v2 h2 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 18px;
  font-weight: 720;
  letter-spacing: -.025em;
}

.panel-header--v2 .eyebrow {
  margin: 0;
}

.panel-count {
  display: inline-flex;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 99px;
  align-items: center;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 11px;
  white-space: nowrap;
}

.panel-header--v2 .text-button {
  margin-left: auto;
}

.metric-grid,
.mini-summary-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.mini-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  min-height: 108px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.mini-summary-grid .metric-card {
  min-height: 82px;
  padding: 13px 15px;
}

.metric-card--success {
  border-color: #c9e7d0;
  background: linear-gradient(180deg, #fff, #f8fffa);
}

.metric-card--blue {
  border-color: #cfe3ff;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.metric-card--warning {
  border-color: #f2dfab;
  background: linear-gradient(180deg, #fff, #fffaf0);
}

.metric-card--danger {
  border-color: #f2c7cc;
  background: linear-gradient(180deg, #fff, #fff8f8);
}

.metric-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.metric-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-dark);
}

.metric-card--success .metric-dot { background: var(--green); }
.metric-card--blue .metric-dot { background: var(--blue); }
.metric-card--warning .metric-dot { background: var(--orange); }
.metric-card--danger .metric-dot { background: var(--red); }

.metric-value {
  display: block;
  margin-top: 10px;
  color: var(--text);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: -.055em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.mini-summary-grid .metric-value {
  margin-top: 7px;
  font-size: 21px;
}

.metric-note {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

/* Overview */
.overview-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr);
  align-items: start;
  gap: 16px;
  margin-bottom: 16px;
}

/* Master panels should hug their content.  Stretching the resource matrix to
   the height of the health stack created a large empty rectangle and pushed
   access control below the fold. */
.overview-panel--resources {
  align-self: start;
}

.overview-panel--compact .overview-token-list {
  max-height: 252px;
  overflow-y: auto;
}

.overview-panel--compact .overview-token-head {
  grid-template-columns: minmax(0, 1fr) auto;
}

.overview-panel--compact .overview-token-head span:nth-child(2),
.overview-panel--compact .overview-token-head span:nth-child(4) {
  display: none;
}

.overview-panel--compact .overview-token-head span:nth-child(3) {
  text-align: right;
}

.overview-panel--compact .overview-token-row {
  padding-block: 11px;
  grid-template-columns: minmax(0, 1fr) auto 12px;
  grid-template-rows: auto auto;
  gap: 7px 10px;
}

.overview-panel--compact .overview-token-name {
  grid-column: 1;
  grid-row: 1;
}

.overview-panel--compact .overview-token-scopes {
  grid-column: 1 / 3;
  grid-row: 2;
}

.overview-panel--compact .overview-token-expiry {
  grid-column: 2;
  grid-row: 1;
  white-space: nowrap;
}

.overview-panel--compact .row-chevron {
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
}

.overview-panel--sync {
  margin-top: 16px;
}

.overview-side-stack {
  display: grid;
  align-content: start;
  gap: 16px;
}

.overview-panel {
  overflow: hidden;
}

.overview-column-head,
.overview-token-head {
  display: grid;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted-dark);
  font-size: 11px;
  font-weight: 650;
}

.overview-column-head {
  grid-template-columns: 86px minmax(180px, 1.4fr) minmax(150px, .9fr) minmax(120px, .75fr) 20px;
  gap: 12px;
}

.overview-token-head {
  grid-template-columns: minmax(190px, 1.1fr) minmax(220px, 1.3fr) minmax(130px, .7fr) 20px;
  gap: 12px;
}

.overview-resource-row,
.overview-token-row {
  display: grid;
  width: 100%;
  padding: 13px 20px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  align-items: center;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background var(--ease);
}

.overview-resource-row:last-child,
.overview-token-row:last-child {
  border-bottom: 0;
}

.overview-resource-row:hover,
.overview-token-row:hover {
  background: #f8fbff;
}

.overview-resource-row {
  grid-template-columns: 86px minmax(180px, 1.4fr) minmax(150px, .9fr) minmax(120px, .75fr) 20px;
  gap: 12px;
}

.overview-token-row {
  grid-template-columns: minmax(190px, 1.1fr) minmax(220px, 1.3fr) minmax(130px, .7fr) 20px;
  gap: 12px;
}

.resource-status,
.overview-token-expiry,
.overview-resource-tool,
.overview-resource-version,
.overview-token-name,
.overview-token-scopes {
  min-width: 0;
}

.resource-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.overview-resource-main strong,
.overview-resource-tool strong,
.overview-resource-version strong,
.overview-token-name strong,
.overview-token-expiry strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.overview-resource-main small,
.overview-resource-tool small,
.overview-resource-version small,
.overview-token-name small,
.overview-token-expiry small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-resource-main small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.overview-token-expiry {
  text-align: right;
}

.row-chevron {
  color: var(--muted-dark);
  font-size: 22px;
  line-height: 1;
  text-align: right;
}

.service-list--v2 .service-row--v2 {
  min-height: 58px;
  padding: 11px 18px;
  border-bottom-color: var(--line-soft) !important;
}

.service-row--v2 strong,
.service-row--v2 small {
  color: var(--text-soft) !important;
  font-size: 13px !important;
}

.service-row--v2 small {
  color: var(--muted) !important;
  font-size: 11px !important;
}

.revision-mini {
  display: grid;
  padding: 18px 20px 0;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.revision-mini > div:last-child {
  text-align: right;
}

.revision-mini small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.revision-mini strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
}

.revision-mini > span {
  color: var(--blue);
  font-size: 20px;
}

.revision-context-note {
  margin: 9px 20px 0;
  color: var(--muted-dark);
  font-size: 10px;
  line-height: 1.45;
}

.revision-track {
  height: 5px !important;
  margin: 17px 20px 0 !important;
  border-radius: 99px;
  background: #e8e8ed !important;
}

.revision-track span {
  border-radius: inherit;
  background: var(--blue) !important;
  box-shadow: none !important;
}

.revision-track--ready span { width: 100%; }
.revision-track--pending span { width: 54%; background: var(--orange) !important; }

.panel-footnote {
  margin: 13px 20px 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.inline-empty {
  display: grid;
  min-height: 92px;
  padding: 20px;
  align-content: center;
  gap: 4px;
  color: var(--muted);
}

.inline-empty strong {
  color: var(--text-soft);
  font-size: 13px;
}

.inline-empty span {
  font-size: 12px;
}

.text-button + .scope-more,
.scope-more {
  display: inline-flex;
  min-height: 23px;
  padding: 0 7px;
  border-radius: 99px;
  align-items: center;
  color: var(--blue);
  background: var(--blue-wash);
  font-size: 11px;
  font-weight: 650;
}

/* Resource pages / tables */
.resource-layout {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, .72fr);
  align-items: start;
  gap: 16px;
}

.master-pane {
  min-width: 0;
}

.toolbar--v2 {
  min-height: 64px;
  margin-bottom: 14px !important;
  /* Keep the controls visually separated from the rounded frame.  The
     previous zero padding made the input and segmented filter sit directly
     on the toolbar border (especially noticeable on Skill/Token/Audit pages). */
  padding: 10px 12px !important;
  align-items: center;
  gap: 14px;
  background: #fafafd !important;
}

.toolbar--v2 .search-box {
  min-width: 0;
  width: min(440px, 100%);
}

.toolbar--v2 .segmented {
  flex: 0 0 auto;
  max-width: 100%;
}

.search-box input,
.field input,
.field select,
.field textarea,
.inline-input {
  min-height: 40px !important;
  border: 1px solid var(--line) !important;
  border-radius: 9px !important;
  color: var(--text) !important;
  background: #fff !important;
  box-shadow: none !important;
}

.search-box input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-dark);
}

.search-box svg {
  color: var(--muted) !important;
}

.segmented {
  min-height: 40px !important;
  padding: 3px !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  background: #fff !important;
}

.segmented button {
  min-height: 32px;
  padding: 0 12px !important;
  border-radius: 7px !important;
  color: var(--muted) !important;
  font-size: 12px !important;
}

.segmented button.is-active {
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.table-shell {
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.data-table--v2 {
  min-width: 720px;
  table-layout: fixed;
}

.data-table--v2 th:nth-child(1),
.data-table--v2 td:nth-child(1) { width: 84px; }
.data-table--v2 th:nth-child(2),
.data-table--v2 td:nth-child(2) { width: 25%; }
.data-table--v2 th:nth-child(3),
.data-table--v2 td:nth-child(3) { width: 21%; }
.data-table--v2 th:nth-child(4),
.data-table--v2 td:nth-child(4) { width: 20%; }
.data-table--v2 th:nth-child(5),
.data-table--v2 td:nth-child(5) { width: 95px; }
.data-table--v2 th:nth-child(6),
.data-table--v2 td:nth-child(6) { width: 58px; }
.data-table--v2 th:nth-child(7),
.data-table--v2 td:nth-child(7) { width: 96px; }

.data-table--v2 th,
.data-table--v2 td {
  border-bottom-color: var(--line-soft) !important;
}

.data-table--v2 th {
  height: 44px !important;
  padding: 11px 13px !important;
  color: var(--muted) !important;
  background: #f7f7f9 !important;
  font-family: var(--body) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.data-table--v2 td {
  min-height: 64px;
  padding: 12px 13px !important;
  color: var(--text-soft) !important;
  font-size: 13px !important;
}

.data-table--v2 tbody tr {
  cursor: pointer;
  transition: background var(--ease), box-shadow var(--ease);
}

.data-table--v2 tbody tr:hover {
  background: #f8fbff !important;
}

.data-table--v2 tbody tr.is-selected {
  background: #f0f7ff !important;
  box-shadow: inset 3px 0 0 var(--blue);
}

.data-table--v2 td strong {
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

.data-table--v2 td small {
  color: var(--muted) !important;
  font-size: 11px !important;
}

.skill-cell--v2 {
  display: grid;
  min-width: 190px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.skill-cell--v2 p {
  display: -webkit-box;
  max-width: 280px;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted) !important;
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.skill-glyph {
  width: 34px !important;
  height: 34px !important;
  border: 1px solid #cfe3ff !important;
  border-radius: 9px !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
  font-size: 11px !important;
}

.tool-cell-v2,
.version-cell-v2,
.date-cell-v2,
.token-cell-v2 {
  min-width: 0;
}

.tool-cell-v2 small,
.version-cell-v2 small {
  display: block;
  margin-top: 4px;
}

.scope-inline {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-inline {
  display: block;
  margin-top: 5px;
  max-width: 180px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-cell-v2 p {
  max-width: 190px;
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-cell-v2 {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.table-actions--v2 {
  gap: 10px !important;
  align-items: center;
  white-space: nowrap;
}

/* Token lifecycle actions intentionally remain explicit buttons rather than
   an inline switch.  Pausing/resuming is an auditable command, so the
   bordered control makes the action and its current intent unmistakable in
   both the dense registry row and the Apple-light visual language. */
.table-actions--v2 .token-state-button {
  display: inline-flex;
  min-height: 32px !important;
  padding: 0 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  align-items: center;
  justify-content: center;
  color: var(--text-soft) !important;
  background: #fff !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 650 !important;
  line-height: 1;
  text-decoration: none !important;
  white-space: nowrap;
}

.table-actions--v2 .token-state-button--pause {
  border-color: #f1c7cc !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

.table-actions--v2 .token-state-button--resume {
  border-color: #cfe3ff !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.table-actions--v2 .token-state-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.table-actions--v2 .token-state-button--pause:hover:not(:disabled) {
  border-color: #e5aeb5 !important;
  background: #fff0f1 !important;
}

.table-actions--v2 .token-state-button--resume:hover:not(:disabled) {
  border-color: #a9ccfa !important;
  background: #edf5ff !important;
}

.table-actions--v2 .token-state-button:focus-visible {
  outline: 2px solid rgba(0, 113, 227, .32);
  outline-offset: 2px;
}

.table-actions--v2 .token-state-button:disabled {
  cursor: wait;
  opacity: .55;
}

/* Expired/revoked credentials are intentionally not given an actionable
   resume button.  Keep the replacement hint compact so it fits the same
   operation column at desktop and narrow widths. */
.token-state-note {
  display: inline-flex;
  min-height: 32px;
  max-width: 150px;
  padding: 0 8px;
  border: 1px solid #e6e8ed;
  border-radius: 8px;
  align-items: center;
  color: var(--muted-dark) !important;
  background: #fafafd;
  font-size: 11px;
  line-height: 1.3;
  white-space: normal;
}

.inspector .token-state-note {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  color: #8a6500 !important;
  border-color: #f0dfad;
  background: #fffaf0;
}

.inspector .token-state-button--pause {
  border-color: #f1c7cc !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

.inspector .token-state-button--resume {
  border-color: #cfe3ff !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.pagination-foot {
  min-height: 42px !important;
  padding: 0 16px !important;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-dark) !important;
  background: #fafafd !important;
  font-family: var(--body) !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
}

.table-empty {
  min-height: 160px;
  padding: 28px 20px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  text-align: center;
}

.table-empty strong {
  color: var(--text-soft);
  font-size: 16px;
}

/* Status and scope semantics */
.status-chip {
  min-height: 25px !important;
  padding: 0 8px !important;
  border: 1px solid transparent;
  border-radius: 99px !important;
  gap: 5px;
  font-size: 11px !important;
  font-weight: 650 !important;
}

.status--ready,
.status--active,
.status--success {
  border-color: #bfe4c8 !important;
  color: var(--green) !important;
  background: var(--green-wash) !important;
}

.status--blue,
.status--info,
.status--enabled {
  border-color: #cfe3ff !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.status--pending,
.status--draft,
.status--warning {
  border-color: #f0d99a !important;
  color: var(--yellow) !important;
  background: var(--yellow-wash) !important;
}

.status--disabled,
.status--muted,
.status--suspended,
.status--historical {
  border-color: var(--line) !important;
  color: var(--muted) !important;
  background: #f1f1f4 !important;
}

.status--danger,
.status--error,
.status--failed,
.status--expired,
.status--revoked {
  border-color: #f2c7cc !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-dark);
}

.status-dot--ready,
.status-dot--success { background: var(--green); }
.status-dot--blue { background: var(--blue); }
.status-dot--pending,
.status-dot--warning { background: var(--orange); }
.status-dot--danger { background: var(--red); }
.status-dot--muted,
.status-dot--disabled { background: var(--muted-dark); }

.scope-list {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.scope-list--row {
  max-width: 330px;
}

.scope-list--large {
  gap: 7px;
}

.scope-chip {
  display: inline-flex;
  min-height: 23px;
  max-width: 100%;
  padding: 0 7px;
  border: 1px solid #cfe3ff;
  border-radius: 6px;
  align-items: center;
  color: #005bb5;
  background: var(--blue-wash);
  font-family: var(--mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.scope-empty {
  color: var(--muted);
  font-size: 11px;
}

.tone--success { color: var(--green) !important; }
.tone--warning { color: var(--yellow) !important; }
.tone--danger { color: var(--red) !important; }
.tone--muted { color: var(--muted) !important; }

.token-days {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  font-weight: 650;
}

/* Persistent inspector */
.inspector {
  position: sticky;
  top: 84px;
  min-width: 0;
  max-height: calc(100vh - 104px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

.inspector--empty {
  display: grid;
  min-height: 280px;
  align-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.inspector-empty-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 15px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-wash);
  font-size: 26px;
}

.inspector--empty h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}

.inspector--empty p {
  max-width: 250px;
  margin: 8px 0 0;
  font-size: 12px;
}

.inspector-heading {
  display: flex;
  margin-bottom: 12px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.inspector-heading h2 {
  margin: 3px 0 2px;
  color: var(--text);
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -.04em;
}

.inspector-subtitle {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.inspector-summary {
  margin: 0 0 16px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
}

.inspector-section {
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
}

.inspector-section h3,
.section-title-row h3 {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 720;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-title-row > span {
  color: var(--muted);
  font-size: 11px;
}

.property-grid {
  display: grid;
  margin-top: 11px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  overflow: hidden;
}

.property-grid .detail-pair {
  min-height: 58px;
  padding: 9px 11px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: #fbfbfd;
}

.property-grid .detail-pair:nth-child(2n) {
  border-right: 0;
}

.property-grid .detail-pair:nth-last-child(-n+2) {
  border-bottom: 0;
}

.detail-pair small {
  color: var(--muted) !important;
  font-family: var(--body) !important;
  font-size: 10px !important;
  letter-spacing: 0 !important;
}

.detail-pair strong {
  display: block;
  margin-top: 4px;
  color: var(--text-soft) !important;
  font-size: 12px !important;
  overflow-wrap: anywhere;
}

.inspector-description {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.inspector-versions {
  display: grid;
  margin-top: 10px;
  gap: 8px;
}

.inspector-version {
  display: grid;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  gap: 8px;
  background: #fbfbfd;
}

.inspector-version.is-current {
  border-color: #bcdcff;
  background: #f5faff;
}

.inspector-version-main strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.inspector-version-main small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.inspector-version-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted-dark);
  font-size: 10px;
}

.mini-badge {
  display: inline-flex;
  min-height: 19px;
  margin-left: 7px;
  padding: 0 6px;
  border-radius: 99px;
  align-items: center;
  color: var(--blue);
  background: var(--blue-wash);
  font-family: var(--body);
  font-size: 10px;
  font-weight: 650;
}

.inspector-actions {
  padding-top: 15px;
  border-top: 1px solid var(--line-soft);
}

.inspector-section--danger {
  padding-bottom: 0;
}

.inspector-danger-zone {
  display: grid;
  gap: 10px;
}

.inspector-danger-zone h3 {
  margin-bottom: 0;
  color: var(--red) !important;
}

.inspector-danger-zone p {
  margin-bottom: 0;
  line-height: 1.5;
}

.inspector-danger-zone .button {
  justify-self: start;
}

.inspector-actions--stack {
  display: grid;
  gap: 12px;
}

.inspector-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-extend {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.token-life-card {
  display: flex;
  margin-top: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  background: #fbfbfd;
}

.token-life-card strong {
  font-size: 18px;
  letter-spacing: -.03em;
}

.token-life-card span {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.token-life-card--success strong { color: var(--green); }
.token-life-card--warning strong { color: var(--yellow); }
.token-life-card--danger strong { color: var(--red); }
.token-life-card--muted strong { color: var(--muted); }

.tool-grant-list {
  display: grid;
  margin-top: 10px;
  gap: 6px;
}

.tool-grant {
  display: grid;
  padding: 8px 10px;
  border-radius: 8px;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  background: #f7f7f9;
}

.tool-grant strong,
.tool-grant small {
  display: block;
}

.tool-grant strong {
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.tool-grant small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

/* Audit inline disclosure */
.audit-details summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.audit-details summary:hover {
  text-decoration: underline;
}

.audit-details .json-view {
  max-width: 330px;
  max-height: 220px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--text-soft) !important;
  background: #f7f7f9 !important;
  font-size: 10px;
}

/* Forms / drawer / modal remain light and are used only for writes */
.drawer-layer,
.modal-layer {
  z-index: 80;
}

.drawer-backdrop,
.modal-backdrop,
.mobile-scrim {
  background: rgba(29, 29, 31, .22) !important;
  backdrop-filter: blur(3px);
}

.drawer,
.modal {
  border: 1px solid var(--line) !important;
  border-radius: 16px !important;
  color: var(--text) !important;
  background: rgba(255, 255, 255, .98) !important;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .18) !important;
}

.drawer-header {
  min-height: 78px;
  padding: 20px 24px !important;
  border-bottom-color: var(--line-soft) !important;
}

.drawer-header h2,
.modal h2 {
  color: var(--text) !important;
}

.drawer-body {
  padding: 22px 24px !important;
}

.drawer-section {
  border-bottom-color: var(--line-soft) !important;
}

.drawer-section-title h3,
.field > span:first-child,
.field-label {
  color: var(--text-soft) !important;
  font-size: 13px !important;
}

.field-hint,
.permission-preview,
.modal-note {
  color: var(--muted) !important;
}

.model-test-note,
.version-download-note {
  margin: 10px 0 0;
  color: var(--muted) !important;
  font-size: 11px;
  line-height: 1.5;
}

.version-download-note code {
  color: var(--text-soft);
  font-family: var(--mono);
}

.danger-zone {
  border-color: #f2c7cc !important;
  border-radius: 10px !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

.modal-icon {
  border-color: #cfe3ff !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.token-secret {
  border-color: #cfe3ff !important;
  border-radius: 10px !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

.switch span {
  border-color: #b8bdc7 !important;
  background: #d8dbe1 !important;
}

.switch input:checked + span {
  border-color: var(--green) !important;
  background: var(--green) !important;
}

/* Responsive: keep the full information order, remove horizontal KPI/table
   scrolling, and move the inspector below the master list when space narrows. */
@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 216px minmax(0, 1fr) !important;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-main-grid,
  .resource-layout {
    grid-template-columns: minmax(0, 1fr) minmax(310px, .7fr);
  }

  .page-content {
    padding-inline: 24px !important;
  }
}

@media (max-width: 980px) {
  .app-shell {
    display: block !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    width: min(280px, calc(100vw - 40px));
    transform: translateX(-105%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .topbar {
    padding-inline: 20px !important;
  }

  .menu-button {
    display: inline-grid !important;
  }

  .topbar-title .eyebrow {
    display: block !important;
  }

  .overview-main-grid,
  .resource-layout {
    grid-template-columns: 1fr;
  }

  .inspector {
    position: relative;
    top: auto;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .login-view {
    display: block !important;
    padding: 30px 16px 36px !important;
  }

  .login-identity {
    padding: 12px 8px 28px !important;
  }

  .login-identity h1 {
    font-size: clamp(56px, 18vw, 82px) !important;
  }

  .login-intro {
    font-size: 15px !important;
  }

  .login-panel {
    padding: 28px 22px !important;
  }

  .topbar {
    height: 64px !important;
    padding-inline: 14px !important;
  }

  .topbar-title h2 {
    font-size: 18px !important;
  }

  .topbar-title .eyebrow,
  .live-state,
  .admin-chip {
    display: none !important;
  }

  .context-chip {
    min-height: 36px;
    padding-inline: 9px;
  }

  .context-chip small {
    display: none;
  }

  .context-chip strong {
    font-size: 11px;
  }

  .page-content {
    min-height: calc(100vh - 64px);
    padding: 20px 14px 48px !important;
  }

  .page-heading {
    display: grid !important;
    margin-bottom: 17px !important;
    align-items: start !important;
    gap: 13px;
  }

  .page-heading h1 {
    font-size: 30px !important;
  }

  .heading-actions {
    display: flex !important;
    width: 100%;
  }

  .heading-actions .button {
    flex: 1;
  }

  .metric-grid,
  .mini-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric-card,
  .mini-summary-grid .metric-card {
    min-height: 88px;
    padding: 12px 13px;
  }

  .metric-value,
  .mini-summary-grid .metric-value {
    margin-top: 8px;
    font-size: 23px;
  }

  .metric-note {
    margin-top: 5px;
    font-size: 10px;
  }

  .overview-column-head,
  .overview-token-head {
    display: none;
  }

  .overview-resource-row,
  .overview-token-row {
    display: grid;
    padding: 13px 14px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
  }

  .overview-resource-row .resource-status,
  .overview-resource-row .overview-resource-main,
  .overview-resource-row .overview-resource-tool,
  .overview-resource-row .overview-resource-version,
  .overview-token-row .overview-token-name,
  .overview-token-row .overview-token-scopes,
  .overview-token-row .overview-token-expiry {
    grid-column: 1;
  }

  .overview-resource-row .resource-status {
    grid-row: 1;
  }

  .overview-resource-row .overview-resource-main {
    grid-row: 2;
  }

  .overview-resource-row .overview-resource-tool,
  .overview-resource-row .overview-resource-version {
    grid-row: 3;
  }

  .overview-resource-row .overview-resource-version {
    margin-top: -34px;
    text-align: right;
  }

  .overview-resource-row .row-chevron,
  .overview-token-row .row-chevron {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .overview-token-row .overview-token-name {
    grid-row: 1;
  }

  .overview-token-row .overview-token-scopes {
    grid-row: 2;
  }

  .overview-token-row .overview-token-expiry {
    grid-row: 3;
    text-align: left;
  }

  .overview-token-row .row-chevron {
    grid-row: 1;
  }

  .panel-header--v2 {
    min-height: 62px;
    padding: 13px 14px !important;
  }

  .panel-header--v2 h2 {
    font-size: 16px;
  }

  .toolbar--v2 {
    display: grid !important;
    gap: 8px;
  }

  .toolbar--v2 .search-box {
    width: 100%;
  }

  .toolbar--v2 .segmented {
    width: 100%;
  }

  .data-table--v2 {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
  }

  .data-table--v2,
  .data-table--v2 tbody,
  .data-table--v2 tr {
    display: block !important;
    width: 100% !important;
  }

  .data-table--v2 thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .data-table--v2 tbody tr {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-soft);
  }

  .data-table--v2 tbody tr.is-selected {
    box-shadow: inset 3px 0 0 var(--blue);
  }

  .data-table--v2 td {
    display: grid !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 38px;
    padding: 8px 0 !important;
    border-bottom: 1px solid var(--line-soft) !important;
    grid-template-columns: 88px minmax(0, 1fr) !important;
    align-items: center;
    gap: 10px;
    text-align: left;
  }

  .data-table--v2 td:last-child {
    border-bottom: 0 !important;
  }

  .data-table--v2 td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    text-align: left;
  }

  .data-table--v2 td > * {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    justify-self: stretch !important;
    text-align: left;
  }

  .data-table--v2 td > .switch,
  .data-table--v2 td > .table-actions--v2 {
    width: auto;
    justify-self: end !important;
  }

  .skill-cell--v2 {
    width: 100%;
    min-width: 0;
    grid-template-columns: 32px minmax(0, 1fr);
    text-align: left;
  }

  .skill-cell--v2 p {
    max-width: none;
    text-align: left;
  }

  .scope-list--row {
    max-width: 100%;
    justify-content: flex-start;
  }

  .data-table--v2 .tool-cell-v2,
  .data-table--v2 .version-cell-v2,
  .data-table--v2 .date-cell-v2,
  .data-table--v2 .token-cell-v2 {
    width: 100%;
    max-width: 100%;
  }

  .data-table--v2 .scope-inline,
  .data-table--v2 .model-inline,
  .data-table--v2 .version-cell-v2 p,
  .data-table--v2 .date-cell-v2 {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .inspector {
    padding: 16px;
  }

  .property-grid {
    grid-template-columns: 1fr;
  }

  .property-grid .detail-pair,
  .property-grid .detail-pair:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .property-grid .detail-pair:last-child {
    border-bottom: 0;
  }

  .audit-details .json-view {
    max-width: 100%;
  }
}

@media (max-width: 430px) {
  .context-chip {
    display: none;
  }

  .page-heading h1 {
    font-size: 27px !important;
  }

  .heading-actions {
    display: grid !important;
    grid-template-columns: 1fr;
  }

  .metric-card,
  .mini-summary-grid .metric-card {
    min-height: 82px;
  }

  .metric-label {
    font-size: 11px;
  }

  .metric-value,
  .mini-summary-grid .metric-value {
    font-size: 21px;
  }
}

/* ========================================================================
   V3 — Apple-light edit sheet
   ------------------------------------------------------------------------
   The persistent V2 Inspector is used for read-only inspection.  Editing
   still opens the legacy drawer, so give that write surface the same visual
   language as the rest of the console instead of leaking the original dark
   industrial palette into an otherwise light page.
   ======================================================================== */

.drawer-backdrop,
.modal-backdrop {
  background: rgba(29, 29, 31, .18) !important;
  backdrop-filter: blur(5px) saturate(108%) !important;
}

.drawer {
  overflow: hidden;
  border: 1px solid var(--line) !important;
  border-right: 0 !important;
  border-radius: 18px 0 0 18px !important;
  color: var(--text) !important;
  background: #fff !important;
  box-shadow: -18px 0 54px rgba(0, 0, 0, .16) !important;
}

.drawer-header {
  min-height: 82px !important;
  padding: 20px 24px !important;
  border-bottom: 1px solid var(--line-soft) !important;
  background: #fff !important;
}

.drawer-header .eyebrow {
  color: var(--muted) !important;
}

.drawer-header h2 {
  color: var(--text) !important;
  font-family: var(--display) !important;
  font-size: 22px !important;
  font-weight: 720 !important;
  letter-spacing: -.035em !important;
}

.drawer-body {
  overflow-y: auto;
  background: #fff !important;
}

.drawer-section-title {
  border-bottom-color: var(--line-soft) !important;
}

.drawer-section-title h3 {
  color: var(--text-soft) !important;
}

.drawer-section-title small {
  color: var(--muted-dark) !important;
}

.drawer .detail-pairs {
  border-color: var(--line-soft) !important;
  background: #f7f7f9 !important;
}

.drawer .detail-pair {
  border-right-color: var(--line-soft) !important;
  border-bottom-color: var(--line-soft) !important;
  background: #f7f7f9 !important;
}

.drawer .detail-pair small {
  color: var(--muted) !important;
}

.drawer .detail-pair strong {
  color: var(--text-soft) !important;
}

.drawer .version-list,
.drawer .grant-row,
.drawer .checkbox-row {
  border-color: var(--line-soft) !important;
  color: var(--text-soft) !important;
  background: #f7f7f9 !important;
}

.drawer .version-list {
  overflow: hidden;
}

.drawer .version-row + .version-row {
  border-top-color: var(--line-soft) !important;
}

.drawer .version-row:hover,
.drawer .grant-row:hover,
.drawer .checkbox-row:hover {
  background: #eef5ff !important;
}

.drawer .version-row h4,
.drawer .grant-row strong,
.drawer .checkbox-row strong {
  color: var(--text-soft) !important;
}

.drawer .version-meta,
.drawer .grant-row small,
.drawer .checkbox-row small {
  color: var(--muted) !important;
}

.drawer .grant-row input[type="checkbox"],
.drawer .checkbox-row input[type="checkbox"] {
  accent-color: var(--blue) !important;
}

.drawer .permission-preview {
  border-left-color: var(--blue) !important;
  color: var(--muted) !important;
  background: var(--blue-wash) !important;
}

.drawer .danger-zone {
  border-color: #f2c7cc !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

.drawer .danger-zone h3 {
  color: var(--red) !important;
}

.drawer .danger-zone p {
  color: var(--muted) !important;
}

.drawer-actions {
  border-top-color: var(--line-soft) !important;
  background: rgba(255, 255, 255, .96) !important;
  box-shadow: 0 -5px 18px rgba(0, 0, 0, .035);
  backdrop-filter: blur(14px) !important;
}

.drawer-actions .button--ghost {
  color: var(--text-soft) !important;
  background: #fff !important;
}

@media (max-width: 760px) {
  .drawer {
    width: min(620px, 100%);
    border-right: 0 !important;
    border-radius: 16px 0 0 16px !important;
  }

  .drawer-header {
    padding: 16px 18px !important;
  }

  .drawer-body {
    padding: 18px 18px 96px !important;
  }

  .drawer-actions {
    margin-inline: -18px;
    padding-inline: 18px;
  }
}

/* ========================================================================
   V3b — Sidebar consistency across the tablet boundary
   ------------------------------------------------------------------------
   The legacy <=1120px rule collapses the rail to an icon-only navigation.
   V2 then widens the rail again (216px) and the result is a wide, mostly
   empty sidebar with no labels.  Keep the Oracle-style resource navigation
   readable until it becomes a genuine off-canvas drawer at <=980px.
   ======================================================================== */

@media (min-width: 981px) and (max-width: 1280px) {
  .app-shell {
    display: grid !important;
    grid-template-columns: 232px minmax(0, 1fr) !important;
  }

  .sidebar {
    position: sticky !important;
    top: 0 !important;
    left: auto !important;
    width: auto !important;
    height: 100vh !important;
    padding: 22px 14px 16px !important;
    transform: none !important;
  }

  .brand {
    padding: 0 10px 22px !important;
    justify-content: flex-start !important;
  }

  .brand > div:last-child {
    display: block !important;
  }

  .environment-stamp {
    justify-content: flex-start !important;
  }

  .environment-stamp span:not(.beacon),
  .environment-stamp b,
  .nav-item span {
    display: block !important;
  }

  .nav-item small {
    display: none !important;
  }

  .environment-stamp b {
    margin-left: auto !important;
  }

  .nav-item {
    grid-template-columns: 20px minmax(0, 1fr) !important;
    justify-items: initial !important;
  }

  .sidebar-foot {
    display: grid !important;
  }
}

@media (max-width: 980px) {
  /* The narrow rail is a real drawer, but it must be complete when opened. */
  .mobile-scrim {
    position: fixed !important;
    inset: 0 !important;
    z-index: 50 !important;
    display: block;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: rgba(29, 29, 31, .22) !important;
  }

  .sidebar .brand {
    justify-content: flex-start !important;
  }

  .sidebar .brand > div:last-child,
  .sidebar .environment-stamp span:not(.beacon),
  .sidebar .environment-stamp b,
  .sidebar .nav-item span {
    display: block !important;
  }

  .sidebar .nav-item small {
    display: none !important;
  }

  .sidebar .environment-stamp {
    justify-content: flex-start !important;
  }

  .sidebar .environment-stamp b {
    margin-left: auto !important;
  }

  .sidebar .nav-item {
    grid-template-columns: 20px minmax(0, 1fr) !important;
    justify-items: initial !important;
  }

  .sidebar .sidebar-foot {
    display: grid !important;
  }
}

/* Never let a transition or a media query reveal a state-controlled layer. */
#loginView[hidden],
#appView[hidden],
#drawerLayer[hidden],
#modalLayer[hidden],
#mobileScrim[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.modal-index--danger {
  color: var(--red) !important;
}

.modal-icon--danger {
  border-color: #f2c7cc !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

.upload-guidance {
  display: grid;
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid #d5e6ff;
  border-radius: 10px;
  gap: 4px;
  color: var(--text-soft);
  background: #f5f9ff;
}

.upload-guidance strong {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.upload-guidance p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.upload-guidance code {
  padding: 1px 4px;
  border-radius: 5px;
  color: var(--text-soft);
  background: rgba(0, 113, 227, .08);
  font-family: var(--mono);
  font-size: .92em;
}

/* Apple-style resource toggle
   --------------------------------
   The first release inherited the industrial square switch (40×22 with a
   rectangular thumb).  V2 uses the same rounded, quiet control language as
   the segmented filters and primary actions. */
.switch.switch--v2 {
  position: relative;
  display: inline-flex;
  width: 44px !important;
  min-width: 44px !important;
  height: 26px !important;
  padding: 2px !important;
  border: 0 !important;
  border-radius: 999px !important;
  align-items: center;
  background: #e5e5ea !important;
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, .12), 0 1px 2px rgba(0, 0, 0, .08);
  cursor: pointer;
  transition: background var(--ease), box-shadow var(--ease), opacity var(--ease);
}

.switch.switch--v2.is-on,
.switch.switch--v2:has(input:checked) {
  background: #34c759 !important;
  box-shadow: inset 0 0 0 1px rgba(0, 80, 20, .12), 0 1px 2px rgba(0, 0, 0, .08);
}

.switch.switch--v2:hover {
  box-shadow: inset 0 0 0 1px rgba(60, 60, 67, .2), 0 2px 4px rgba(0, 0, 0, .1);
}

.switch.switch--v2 input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch.switch--v2 span {
  display: block;
  width: 22px !important;
  height: 22px !important;
  flex: 0 0 22px;
  border: 0 !important;
  border-radius: 50% !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .24), 0 1px 1px rgba(0, 0, 0, .08);
  pointer-events: none;
  transform: translateX(0);
  transition: transform var(--ease), box-shadow var(--ease);
}

.switch.switch--v2 input:checked + span {
  border: 0 !important;
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .26), 0 1px 1px rgba(0, 0, 0, .08);
  transform: translateX(18px);
}

.switch.switch--v2 input:focus-visible + span {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.switch.switch--v2:has(input:disabled) {
  cursor: wait;
  opacity: .58;
}

/* ========================================================================
   Model / usage desk
   ------------------------------------------------------------------------
   The model registry keeps the same Apple-light surfaces and Oracle-style
   master/detail rhythm as the Skill and token pages.  Usage cards are dense
   enough for operators, but remain readable at tablet and mobile widths.
   ======================================================================== */

.model-usage-layout {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, .7fr);
  align-items: start;
  gap: 16px;
}

.overview-panel--usage {
  margin-top: 16px;
  overflow: hidden;
}

.overview-usage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.overview-usage-grid > div {
  min-height: 82px;
  padding: 17px 20px;
  border-right: 1px solid var(--line-soft);
  background: #fbfbfd;
}

.overview-usage-grid > div:last-child {
  border-right: 0;
}

.overview-usage-grid strong {
  display: block;
  color: var(--text);
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: -.02em;
}

.overview-usage-grid small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.model-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.model-registry-panel,
.usage-panel,
.usage-events-panel {
  min-width: 0;
  overflow: hidden;
}

.model-toolbar {
  margin: 0 !important;
  padding: 12px 18px !important;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfbfd;
}

.model-table {
  min-width: 0;
}

.model-table th:nth-child(1),
.model-table td:nth-child(1) { width: 11%; }
.model-table th:nth-child(2),
.model-table td:nth-child(2) { width: 23%; }
.model-table th:nth-child(3),
.model-table td:nth-child(3) { width: 19%; }
.model-table th:nth-child(4),
.model-table td:nth-child(4) { width: 12%; }
.model-table th:nth-child(5),
.model-table td:nth-child(5) { width: 10%; }
.model-table th:nth-child(6),
.model-table td:nth-child(6) { width: 8%; }
.model-table th:nth-child(7),
.model-table td:nth-child(7) { width: 17%; }

.model-cell-v2 {
  display: grid;
  min-width: 150px;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

.model-cell-v2 p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.model-glyph {
  display: grid;
  width: 32px;
  height: 32px;
  border: 1px solid #d5e6ff;
  border-radius: 9px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-wash);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .02em;
}

.model-endpoint {
  display: block;
  max-width: 230px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secret-hint {
  display: inline-flex;
  max-width: 112px;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid #d7d7df;
  border-radius: 7px;
  align-items: center;
  overflow: hidden;
  color: var(--muted);
  background: #f7f7f9;
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-table td:nth-child(5) strong,
.model-table td:nth-child(6) strong,
.model-assignment-count {
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}

.model-table td:nth-child(5) small {
  display: block;
  margin-top: 3px;
}

.model-assignment-count {
  display: inline-grid;
  min-width: 27px;
  min-height: 24px;
  padding: 0 6px;
  border-radius: 99px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-wash);
}

.table-note {
  color: var(--muted-dark);
  font-size: 11px;
}

.usage-panels-grid {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.usage-ranking {
  display: grid;
  padding: 13px 18px 15px;
  gap: 15px;
}

.usage-rank-row {
  min-width: 0;
}

.usage-rank-top {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.usage-rank-index {
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 10px;
}

.usage-rank-top strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-rank-count {
  color: var(--text);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

.usage-rank-bar {
  height: 5px;
  margin: 7px 0 5px 32px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf0f5;
}

.usage-rank-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6aaef0, var(--blue));
  transition: width var(--ease);
}

.usage-rank-row > small {
  display: block;
  margin-left: 32px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-events-panel {
  margin-top: 16px;
}

.usage-events-table {
  min-width: 760px;
}

.usage-events-table th:nth-child(1),
.usage-events-table td:nth-child(1) { width: 150px; }
.usage-events-table th:nth-child(2),
.usage-events-table td:nth-child(2) { width: 27%; }
.usage-events-table th:nth-child(3),
.usage-events-table td:nth-child(3) { width: 22%; }
.usage-events-table th:nth-child(4),
.usage-events-table td:nth-child(4) { width: 94px; }
.usage-events-table th:nth-child(5),
.usage-events-table td:nth-child(5) { width: 108px; }
.usage-events-table th:nth-child(6),
.usage-events-table td:nth-child(6) { width: 92px; }

.usage-events-table td small {
  display: block;
  margin-top: 3px;
}

.model-usage-mini {
  display: grid;
  margin-top: 11px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  overflow: hidden;
}

.model-usage-mini > div {
  min-height: 67px;
  padding: 10px 9px;
  border-right: 1px solid var(--line-soft);
  background: #fbfbfd;
  text-align: center;
}

.model-usage-mini > div:last-child {
  border-right: 0;
}

.model-usage-mini strong {
  display: block;
  color: var(--text);
  font-family: var(--mono);
  font-size: 16px;
}

.model-usage-mini small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.model-assignment-list {
  display: grid;
  margin-top: 10px;
  gap: 7px;
}

.model-assignment-row {
  display: flex;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  align-items: center;
  gap: 8px;
  background: #fbfbfd;
}

.model-assignment-row > div {
  min-width: 0;
}

.model-assignment-row strong,
.model-assignment-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-assignment-row strong {
  color: var(--text-soft);
  font-size: 12px;
}

.model-assignment-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.model-select-field {
  display: grid;
  margin-top: 10px;
  gap: 6px;
}

.model-select-field > span {
  color: var(--muted);
  font-size: 11px;
}

.model-select-field select {
  width: 100%;
}

.token-usage {
  display: block;
  margin-top: 4px;
  color: var(--blue) !important;
  font-family: var(--mono);
  font-size: 10px !important;
}

.inspector-note {
  margin-top: 15px;
  padding: 10px 11px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--muted);
  background: #f7f7f9;
  font-size: 11px;
}

@media (max-width: 1280px) {
  .model-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .model-table {
    min-width: 720px;
  }

  .model-usage-layout {
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, .7fr);
  }

  .usage-panels-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .model-usage-layout {
    grid-template-columns: 1fr;
  }

  .usage-panels-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .model-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-usage-grid > div {
    min-height: 70px;
    padding: 13px 14px;
  }

  .overview-usage-grid strong {
    font-size: 17px;
  }

  .model-toolbar {
    padding: 10px 14px !important;
  }

  .model-table,
  .usage-events-table {
    min-width: 0 !important;
  }

  .model-table td:nth-child(2) .model-cell-v2,
  .model-table td:nth-child(3) .model-endpoint,
  .model-table td:nth-child(4) .secret-hint {
    max-width: 100%;
  }

  .model-usage-mini > div {
    min-height: 60px;
    padding-inline: 5px;
  }

  .model-usage-mini strong {
    font-size: 14px;
  }
}

/* ========================================================================
   V4 — Secure reveals, unified file picker and notification surfaces
   ------------------------------------------------------------------------
   Sensitive values are intentionally absent from the initial DOM.  These
   surfaces are populated only after an authenticated POST reveal request and
   are removed again when the modal closes.
   ======================================================================== */

.detail-pair--secret {
  min-width: 0;
}

.detail-pair--endpoint {
  min-width: 0;
}

.endpoint-detail {
  display: flex;
  min-width: 0;
  margin-top: 4px;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.endpoint-detail code {
  min-width: 0;
  flex: 1 1 180px;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.endpoint-detail .text-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.secret-detail {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.secret-detail .secret-hint {
  max-width: min(100%, 170px);
}

.secret-detail-note {
  color: var(--muted-dark);
  font-size: 10px;
}

.secret-unavailable {
  display: inline-flex;
  max-width: 100%;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  align-items: center;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.secret-reveal-trigger {
  white-space: nowrap;
}

.secure-zone {
  margin-top: 12px;
  padding: 13px 14px;
  border: 1px solid #cfe3ff;
  border-radius: 10px;
  color: var(--text-soft);
  background: var(--blue-wash);
}

.secure-zone h3 {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
}

.secure-zone p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

/* Custom file picker.  The real input covers the surface and remains
   keyboard/screen-reader accessible; only its browser-specific chrome is
   visually hidden. */
.file-picker {
  position: relative;
  display: block;
  min-width: 0;
}

.file-picker__input {
  position: absolute !important;
  inset: 0 !important;
  z-index: 2;
  width: 100% !important;
  height: 100% !important;
  min-height: 48px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  cursor: pointer;
}

.file-picker__surface {
  display: flex;
  min-height: 48px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  background: #fff;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

.file-picker__button {
  display: inline-flex;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 8px;
  align-items: center;
  color: var(--blue);
  background: var(--blue-wash);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.file-picker__name {
  min-width: 0;
  overflow: hidden;
  color: var(--muted-dark);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker__name.has-file {
  color: var(--text-soft);
  font-weight: 600;
}

.file-picker:hover .file-picker__surface {
  border-color: #b8c9dc;
  background: #fcfdff;
}

.file-picker:focus-within .file-picker__surface {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .14);
}

.file-picker__input:disabled + .file-picker__surface {
  opacity: .58;
  cursor: wait;
}

/* Toasts use the same light surface language as drawers and Inspectors. */
.toast-stack {
  right: 20px;
  bottom: 20px;
  width: min(390px, calc(100% - 40px));
  gap: 10px;
}

.toast {
  min-height: 56px;
  padding: 11px 13px;
  border: 1px solid var(--line) !important;
  border-left: 4px solid var(--blue) !important;
  border-radius: 12px;
  color: var(--text-soft);
  background: rgba(255, 255, 255, .97) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .12) !important;
  backdrop-filter: blur(14px) saturate(120%);
  font-size: 12px;
}

.toast svg {
  color: var(--blue);
}

.toast--success {
  border-left-color: var(--green) !important;
}

.toast--success svg {
  color: var(--green);
}

.toast--warning {
  border-left-color: var(--orange) !important;
}

.toast--warning svg {
  color: var(--orange);
}

.toast--error {
  border-left-color: var(--red) !important;
}

.toast--error svg {
  color: var(--red);
}

.toast button {
  display: inline-grid;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  place-items: center;
  color: var(--muted) !important;
  background: transparent;
  font-size: 18px;
  line-height: 1;
}

.toast button:hover {
  color: var(--text) !important;
  background: var(--panel-soft);
}

.modal--reveal .modal-icon {
  border-radius: 12px;
}

.secret-reveal {
  display: grid;
  min-width: 0;
  margin: 18px 0 13px;
  padding: 8px;
  border: 1px solid #cfe3ff;
  border-radius: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: var(--text);
  background: var(--blue-wash);
}

.secret-reveal-value {
  display: block;
  min-width: 0;
  max-height: 120px;
  padding: 8px 9px;
  overflow: auto;
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, .78);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  user-select: text;
}

.secret-reveal .button {
  flex: 0 0 auto;
}

.table-actions--v2 .table-note {
  max-width: 136px;
  color: var(--muted-dark);
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Audit filters breathe on wide layouts while remaining a single-column
   stack on phones.  The explicit gap prevents the search field and action
   selector from visually colliding at intermediate widths. */
.audit-toolbar {
  gap: 18px !important;
}

.audit-toolbar .search-box {
  flex: 1 1 420px;
  width: auto;
  max-width: 620px;
}

.audit-toolbar .field--audit-filter {
  flex: 0 0 210px;
  margin-left: auto;
}

.secret-endpoint {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  margin: -2px 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  color: var(--muted);
  background: rgba(255, 255, 255, .62);
  font-size: 11px;
}

.secret-endpoint span {
  color: var(--muted-dark);
  font-weight: 600;
  white-space: nowrap;
}

.secret-endpoint code {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11px;
}

.secret-endpoint--model {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.secret-endpoint--model .text-button {
  white-space: nowrap;
}

/* Model connection probes -------------------------------------------------
   Keep the probe state visually distinct from the enable switch.  The
   registry is intentionally dense, so status metadata wraps rather than
   pushing the operation controls outside the panel. */
.model-status-stack {
  display: grid;
  min-width: 116px;
  gap: 5px;
  align-content: start;
}

.model-connection-state {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 7px;
}

.model-connection-state .status-chip {
  flex: 0 0 auto;
}

.model-connection-state > small {
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-connection-state--compact {
  gap: 3px 5px;
}

.model-connection-state--compact .status-chip {
  min-height: 21px !important;
  padding: 0 6px !important;
  font-size: 10px !important;
}

.model-connection-state--compact > small {
  max-width: 135px;
  font-size: 9px;
}

.model-connection-error {
  display: grid;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid #f2c7cc;
  border-radius: 9px;
  gap: 3px;
  color: var(--red);
  background: var(--red-wash);
}

.model-connection-error strong {
  font-family: var(--mono);
  font-size: 11px;
}

.model-connection-error span {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.model-probe-button {
  color: var(--blue) !important;
}

.model-table .table-actions--v2 {
  flex-wrap: wrap;
  justify-content: flex-start;
  row-gap: 4px;
}

.model-inspector-toggle {
  display: inline-flex;
  min-height: 38px;
  padding: 0 4px 0 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: #fbfbfd;
  font-size: 11px;
  white-space: nowrap;
}

.model-inspector-toggle > .switch {
  flex: 0 0 auto;
}

.model-test-result {
  display: inline-flex;
  min-height: 29px;
  margin: 9px 0 0;
  padding: 5px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  align-items: center;
  color: var(--muted);
  background: #fbfbfd;
  font-family: var(--mono);
  font-size: 10px;
}

.model-test-result.status--ready,
.model-test-result.status--success {
  border-color: #bfe4c8;
  color: var(--green);
  background: var(--green-wash);
}

.model-test-result.status--failed,
.model-test-result.status--danger {
  border-color: #f2c7cc;
  color: var(--red);
  background: var(--red-wash);
}

.model-test-result.status--warning,
.model-test-result.status--pending {
  border-color: #f0d99a;
  color: var(--yellow);
  background: var(--yellow-wash);
}

@media (max-width: 1280px) {
  .model-status-stack {
    min-width: 102px;
  }

  .model-connection-state--compact > small {
    max-width: 110px;
  }

  .model-table .table-actions--v2 {
    flex-wrap: wrap;
    justify-content: flex-start;
    row-gap: 4px;
  }
}

@media (max-width: 520px) {
  .audit-toolbar {
    gap: 10px !important;
  }

  .audit-toolbar .search-box,
  .audit-toolbar .field--audit-filter {
    width: 100%;
    max-width: none;
    margin-left: 0;
    flex: 1 1 auto;
  }

  .secret-reveal {
    grid-template-columns: 1fr;
  }

  .secret-reveal .button {
    width: 100%;
  }

  .secret-endpoint--model {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .secret-endpoint--model .text-button {
    justify-self: start;
  }

  .file-picker__surface {
    min-height: 52px;
  }

  .file-picker__button {
    min-height: 40px;
  }
}

/* ========================================================================
   V3 — Apple light workspace skin
   ------------------------------------------------------------------------
   The production renderer and API remain authoritative.  This final skin
   layer only changes presentation: the same data-test hooks, forms, action
   names and master/detail regions continue to be used by app.js.
   ======================================================================== */

:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --bg-deep: #ffffff;
  --rail: rgba(250, 250, 252, .9);
  --panel: rgba(255, 255, 255, .92);
  --panel-raised: #ffffff;
  --panel-soft: #f7f7fa;
  --line: #e1e1e6;
  --line-soft: #eeeeF2;
  --text: #1d1d1f;
  --text-soft: #424245;
  --muted: #6e6e73;
  --muted-dark: #8e8e93;
  --orange: #a75d00;
  --orange-hot: #bf7000;
  --orange-wash: #fff3df;
  --green: #248a3d;
  --green-wash: #e9f7ed;
  --blue: #0071e3;
  --blue-wash: #e8f2ff;
  --yellow: #9a6700;
  --yellow-wash: #fff5d6;
  --red: #c9342b;
  --red-wash: #fff0ef;
  --mono: "SF Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: "SF Pro Display", "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body: "SF Pro Text", "Avenir Next", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  --sidebar-width: 276px;
  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 10px 30px rgba(31, 37, 51, .07), 0 2px 8px rgba(31, 37, 51, .035);
  --shadow-soft: 0 2px 10px rgba(31, 37, 51, .045);
  --ease: 180ms cubic-bezier(.2, .7, .2, 1);
}

html,
body {
  min-width: 320px;
  background: var(--bg) !important;
  color: var(--text) !important;
}

body {
  overflow-x: hidden;
  font-family: var(--body);
  letter-spacing: -.012em;
  -webkit-font-smoothing: antialiased;
}

body::before,
body::after,
.sidebar::after,
.login-grid {
  display: none !important;
}

svg {
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Shell */
#appView.app-shell {
  display: block !important;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% -10%, rgba(0, 113, 227, .09), transparent 28rem),
    var(--bg) !important;
}

#appView .sidebar {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width) !important;
  height: 100vh;
  padding: 27px 18px 18px !important;
  border-right: 1px solid rgba(216, 216, 222, .9) !important;
  background: rgba(250, 250, 252, .82) !important;
  box-shadow: 2px 0 18px rgba(31, 37, 51, .025);
  backdrop-filter: saturate(180%) blur(28px);
}

#appView .workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width) !important;
  background: transparent !important;
}

#appView .brand {
  padding: 0 9px 23px !important;
  gap: 11px;
}

#appView .brand-mark {
  width: 39px !important;
  height: 39px !important;
  border: 0 !important;
  border-radius: 12px !important;
  color: #fff !important;
  background: linear-gradient(145deg, #1688ef, #0058bd) !important;
  box-shadow: 0 8px 17px rgba(0, 95, 199, .2);
  font-family: var(--display);
  font-size: 13px !important;
  letter-spacing: -.04em;
}

#appView .brand strong {
  color: var(--text) !important;
  font-family: var(--display) !important;
  font-size: 16px !important;
  font-weight: 760 !important;
  letter-spacing: -.025em !important;
}

#appView .brand small {
  margin-top: 2px;
  color: var(--muted-dark) !important;
  font-family: var(--body) !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
}

/* Workspace switcher inserted in index.html. */
#appView .workspace-select {
  display: grid;
  width: 100%;
  min-height: 60px;
  margin: 0 0 25px;
  padding: 11px 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line) !important;
  border-radius: 15px !important;
  color: var(--text-soft) !important;
  background: rgba(255, 255, 255, .8) !important;
  box-shadow: var(--shadow-soft);
  font: inherit;
  text-align: left;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}

#appView .workspace-select:hover,
#appView .workspace-select:focus-visible {
  border-color: #b8d5f5 !important;
  background: #fff !important;
  box-shadow: 0 5px 16px rgba(0, 113, 227, .08);
}

#appView .workspace-dot,
#appView .context-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(36, 138, 61, .11);
}

#appView .workspace-copy {
  min-width: 0;
}

#appView .workspace-copy strong,
#appView .workspace-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appView .workspace-copy strong {
  color: var(--text) !important;
  font-size: 13px;
  font-weight: 720;
}

#appView .workspace-copy small {
  margin-top: 3px;
  color: var(--muted) !important;
  font-size: 10px;
}

#appView .workspace-chevron {
  width: 16px;
  height: 16px;
  color: var(--muted-dark);
}

#appView .main-nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

#appView .nav-group-label {
  margin: 0 10px 7px !important;
  color: #96969c !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: .1em !important;
  line-height: 1.4;
  text-transform: uppercase;
}

#appView .nav-group-label:not(:first-child) {
  margin-top: 19px !important;
}

#appView .nav-item {
  display: grid !important;
  width: 100%;
  min-height: 44px;
  margin: 3px 0;
  padding: 0 11px !important;
  grid-template-columns: 19px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  border: 1px solid transparent !important;
  border-radius: 12px !important;
  color: #6c6c72 !important;
  background: transparent !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  text-align: left;
  transition: color var(--ease), background var(--ease), border-color var(--ease), transform var(--ease);
}

#appView .nav-item svg {
  width: 18px;
  height: 18px;
  color: #909097;
}

#appView .nav-item:hover {
  color: var(--text) !important;
  background: rgba(255, 255, 255, .8) !important;
  transform: translateX(1px);
}

#appView .nav-item.is-active {
  position: relative;
  border-color: rgba(0, 113, 227, .09) !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
  box-shadow: none;
}

#appView .nav-item.is-active::before {
  top: 8px;
  bottom: 8px;
  left: -1px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue) !important;
}

#appView .nav-item.is-active svg {
  color: var(--blue);
}

#appView .sidebar-foot {
  display: grid;
  padding: 15px 2px 0 !important;
  border-top: 1px solid var(--line-soft) !important;
  gap: 0;
}

#appView .service-mini {
  display: flex;
  min-height: 45px;
  padding: 7px 8px;
  align-items: flex-start !important;
  justify-content: space-between;
  gap: 9px;
  border-radius: 10px;
  color: var(--text-soft) !important;
  font-family: var(--body) !important;
  font-size: 11px !important;
  letter-spacing: 0 !important;
}

#appView .service-mini + .service-mini {
  border-top: 1px solid #f0f0f2;
}

#appView .service-mini-copy {
  display: grid !important;
  min-width: 0;
  gap: 2px;
}

#appView .service-mini-copy b {
  color: var(--text-soft) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.2;
}

#appView .service-mini-copy small {
  overflow-wrap: anywhere;
  color: var(--muted) !important;
  font-size: 10px !important;
  line-height: 1.25;
}

#appView .service-mini > strong {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--green) !important;
  font-family: var(--body) !important;
  font-size: 10px !important;
  font-weight: 750;
  white-space: nowrap;
}

#appView .sidebar-user-card {
  display: flex;
  min-height: 48px;
  margin-top: 10px;
  padding: 10px 7px 0;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line-soft);
}

#appView .sidebar-user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #8e79eb, #5c47bd);
  font-size: 12px;
  font-weight: 800;
}

#appView .sidebar-user-copy {
  min-width: 0;
  flex: 1;
}

#appView .sidebar-user-copy strong,
#appView .sidebar-user-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appView .sidebar-user-copy strong {
  color: var(--text-soft);
  font-size: 12px;
}

#appView .sidebar-user-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

#appView .sidebar-user-action {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: var(--muted-dark);
  background: transparent;
}

#appView .sidebar-user-action:hover {
  color: var(--blue);
  background: var(--blue-wash);
}

#appView .sidebar-user-action svg {
  width: 16px;
  height: 16px;
}

/* Top bar */
#appView .topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 80px;
  padding: 17px 40px 15px !important;
  border-bottom: 1px solid rgba(225, 225, 230, .88) !important;
  background: rgba(245, 245, 247, .78) !important;
  box-shadow: 0 2px 14px rgba(31, 37, 51, .035);
  backdrop-filter: saturate(180%) blur(24px);
}

#appView .topbar-title {
  gap: 13px;
}

#appView .topbar-title h2 {
  color: var(--text) !important;
  font-family: var(--display) !important;
  font-size: 22px !important;
  font-weight: 760 !important;
  letter-spacing: -.04em !important;
}

#appView .topbar-title .eyebrow {
  margin-bottom: 4px;
  color: var(--muted) !important;
  font-family: var(--body) !important;
  font-size: 10px !important;
  letter-spacing: .06em !important;
  text-transform: uppercase !important;
}

#appView .topbar-actions {
  gap: 9px !important;
}

#appView .production-badge {
  display: inline-flex;
  min-height: 36px;
  padding: 0 11px;
  align-items: center;
  gap: 8px;
  border: 1px solid #cfe3ff;
  border-radius: 999px;
  color: #1765b4;
  background: rgba(239, 247, 255, .9);
  box-shadow: var(--shadow-soft);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

#appView .production-badge .context-dot {
  width: 7px;
  height: 7px;
  background: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .11);
}

#appView .context-chip {
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, .82) !important;
}

#appView .context-chip small,
#appView .context-chip strong,
#appView .live-state small,
#appView .live-state strong,
#appView .admin-chip small,
#appView .admin-chip strong {
  line-height: 1.2;
}

#appView .context-chip small,
#appView .live-state small,
#appView .admin-chip small {
  color: var(--muted-dark) !important;
  font-family: var(--body) !important;
  font-size: 10px !important;
  letter-spacing: 0 !important;
}

#appView .context-chip strong,
#appView .live-state strong,
#appView .admin-chip strong {
  color: var(--text-soft) !important;
  font-family: var(--body) !important;
  font-size: 12px !important;
  letter-spacing: 0 !important;
}

#appView .live-state strong {
  color: var(--green) !important;
}

#appView .live-state strong.is-offline {
  color: var(--red) !important;
}

#appView .live-state,
#appView .admin-chip {
  min-height: 40px;
  padding: 0 11px !important;
  border-left-color: var(--line) !important;
}

#appView .admin-avatar {
  width: 31px !important;
  height: 31px !important;
  border: 0 !important;
  border-radius: 50% !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
  font-size: 12px !important;
}

#appView .icon-button {
  width: 38px !important;
  height: 38px !important;
  border: 1px solid var(--line) !important;
  border-radius: 11px !important;
  color: var(--muted) !important;
  background: rgba(255, 255, 255, .84) !important;
}

#appView .icon-button:hover {
  border-color: #b8d5f5 !important;
  color: var(--blue) !important;
  background: #fff !important;
}

#appView .topbar-help,
#appView .topbar-refresh {
  border-radius: 50% !important;
}

#appView .menu-button {
  display: none !important;
}

/* Main content and page headings */
#appView .page-content {
  max-width: 1540px;
  min-height: calc(100vh - 80px);
  margin: 0 auto;
  padding: 38px 40px 68px !important;
  background: transparent !important;
}

#appView .page-heading {
  margin-bottom: 24px !important;
  align-items: flex-end !important;
}

#appView .page-heading h1 {
  margin: 0 !important;
  color: var(--text) !important;
  font-family: var(--display) !important;
  font-size: clamp(31px, 3.2vw, 46px) !important;
  font-weight: 780 !important;
  letter-spacing: -.065em !important;
  line-height: 1.04 !important;
}

#appView .page-heading p:not(.eyebrow) {
  max-width: 800px;
  margin-top: 10px !important;
  color: var(--muted) !important;
  font-size: 13px !important;
  line-height: 1.6;
}

#appView .page-heading .eyebrow {
  margin-bottom: 9px;
  color: var(--blue) !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: .12em !important;
}

#appView .heading-actions {
  gap: 9px !important;
}

#appView .button {
  min-height: 39px !important;
  padding: 0 15px !important;
  border-radius: 11px !important;
  font-size: 12px !important;
  font-weight: 720 !important;
  transition: transform var(--ease), box-shadow var(--ease), background var(--ease), border-color var(--ease);
}

#appView .button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

#appView .button--primary {
  border-color: var(--blue) !important;
  color: #fff !important;
  background: var(--blue) !important;
  box-shadow: 0 7px 17px rgba(0, 113, 227, .19);
}

#appView .button--primary:hover:not(:disabled) {
  border-color: #005fc7 !important;
  background: #005fc7 !important;
}

#appView .button--ghost,
#appView .button--secondary {
  border-color: var(--line) !important;
  color: var(--text-soft) !important;
  background: rgba(255, 255, 255, .86) !important;
}

#appView .button--ghost:hover:not(:disabled),
#appView .button--secondary:hover:not(:disabled) {
  border-color: #b8d5f5 !important;
  color: var(--blue) !important;
  background: #fff !important;
}

#appView .button--danger {
  border-color: #f1c8c4 !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

#appView .button--danger:hover:not(:disabled) {
  border-color: #e5aaa4 !important;
  background: #ffe8e6 !important;
}

#appView .text-button {
  color: var(--blue) !important;
  font-size: 12px !important;
  font-weight: 720 !important;
}

#appView .text-button:hover {
  color: #005fc7 !important;
  text-decoration: underline;
}

/* Cards, metric tiles and toolbars */
#appView .panel,
#appView .table-shell {
  border: 1px solid rgba(222, 222, 228, .95) !important;
  border-radius: 20px !important;
  color: var(--text) !important;
  background: rgba(255, 255, 255, .9) !important;
  box-shadow: var(--shadow) !important;
  backdrop-filter: blur(16px);
}

#appView .panel-header--v2 {
  min-height: 70px;
  padding: 18px 22px 15px !important;
  border-bottom: 1px solid #f0f0f2 !important;
}

#appView .panel-header--v2 h2 {
  margin: 4px 0 0;
  color: var(--text) !important;
  font-family: var(--display);
  font-size: 17px !important;
  font-weight: 760 !important;
  letter-spacing: -.035em;
}

#appView .panel-header--v2 .eyebrow {
  margin: 0;
  color: var(--blue) !important;
  font-size: 10px !important;
}

#appView .panel-count {
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--muted) !important;
  background: #f4f4f6 !important;
  font-size: 10px !important;
}

#appView .metric-grid,
#appView .mini-summary-grid {
  gap: 13px;
  margin-bottom: 18px;
}

#appView .metric-card {
  min-height: 112px;
  padding: 18px 19px 16px;
  border: 1px solid rgba(222, 222, 228, .95) !important;
  border-radius: 17px !important;
  background: rgba(255, 255, 255, .9) !important;
  box-shadow: var(--shadow-soft) !important;
}

#appView .mini-summary-grid .metric-card {
  min-height: 94px;
  padding: 16px 18px;
}

#appView .metric-card--success {
  border-color: #d2ecd8 !important;
  background: linear-gradient(180deg, #fff, #f8fffa) !important;
}

#appView .metric-card--blue {
  border-color: #d3e5fb !important;
  background: linear-gradient(180deg, #fff, #f8fbff) !important;
}

#appView .metric-card--warning {
  border-color: #f1dfb5 !important;
  background: linear-gradient(180deg, #fff, #fffaf1) !important;
}

#appView .metric-card--danger {
  border-color: #f2d0cd !important;
  background: linear-gradient(180deg, #fff, #fff8f8) !important;
}

#appView .metric-label {
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 720 !important;
}

#appView .metric-value {
  margin-top: 12px;
  color: var(--text) !important;
  font-family: var(--display);
  font-size: 29px !important;
  font-weight: 780 !important;
  letter-spacing: -.06em;
}

#appView .metric-note {
  margin-top: 7px;
  color: var(--muted-dark) !important;
  font-size: 10px !important;
}

#appView .toolbar--v2 {
  min-height: 66px;
  margin-bottom: 14px !important;
  padding: 11px 14px !important;
  border: 1px solid rgba(222, 222, 228, .95) !important;
  border-radius: 17px !important;
  background: rgba(255, 255, 255, .86) !important;
  box-shadow: var(--shadow-soft);
}

#appView .toolbar--v2 .search-box {
  width: min(460px, 100%);
}

#appView .search-box input,
#appView .field input,
#appView .field select,
#appView .field textarea,
#appView .inline-input {
  min-height: 39px !important;
  border: 1px solid #dedee5 !important;
  border-radius: 10px !important;
  color: var(--text) !important;
  background: #fbfbfd !important;
  box-shadow: none !important;
}

#appView .search-box input:focus,
#appView .field input:focus,
#appView .field select:focus,
#appView .field textarea:focus {
  border-color: #9ac5f4 !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .1) !important;
}

#appView .search-box input::placeholder,
#appView .field input::placeholder,
#appView .field textarea::placeholder {
  color: #98989e !important;
}

#appView .segmented {
  min-height: 39px !important;
  padding: 3px !important;
  border: 1px solid #dedee5 !important;
  border-radius: 11px !important;
  background: #f5f5f7 !important;
}

#appView .segmented button {
  min-height: 31px;
  padding: 0 12px !important;
  border-radius: 8px !important;
  color: var(--muted) !important;
  font-size: 11px !important;
  font-weight: 720;
}

#appView .segmented button.is-active {
  color: var(--blue) !important;
  background: #fff !important;
  box-shadow: 0 1px 5px rgba(31, 37, 51, .09);
}

/* Overview: a calm dashboard rhythm with a single readable column. */
#appView .overview-v2 > .page-heading {
  margin-bottom: 22px !important;
}

#appView .overview-hero {
  position: relative;
  display: grid;
  min-height: 224px;
  margin-bottom: 16px;
  padding: 30px 32px;
  grid-template-columns: minmax(0, 1.25fr) minmax(230px, .75fr);
  align-items: center;
  gap: 24px;
  overflow: hidden;
  border: 1px solid rgba(109, 161, 224, .25);
  border-radius: 25px;
  color: #fff;
  background: linear-gradient(123deg, #0b6fdb 0%, #258be8 58%, #4fa2ef 100%);
  box-shadow: 0 20px 45px rgba(0, 102, 204, .2);
}

#appView .overview-hero::before,
#appView .overview-hero::after {
  position: absolute;
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

#appView .overview-hero::before {
  top: -220px;
  right: -95px;
  width: 410px;
  height: 410px;
  border: 1px solid rgba(255, 255, 255, .2);
  box-shadow: 0 0 0 28px rgba(255, 255, 255, .04), 0 0 0 57px rgba(255, 255, 255, .035);
}

#appView .overview-hero::after {
  right: 115px;
  bottom: -180px;
  width: 270px;
  height: 270px;
  background: rgba(255, 255, 255, .08);
  filter: blur(2px);
}

#appView .hero-copy,
#appView .hero-orbit {
  position: relative;
  z-index: 1;
}

#appView .hero-copy .eyebrow {
  color: rgba(255, 255, 255, .72) !important;
}

#appView .hero-copy h3 {
  max-width: 600px;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(27px, 3vw, 40px);
  font-weight: 780;
  letter-spacing: -.06em;
  line-height: 1.08;
}

#appView .hero-copy p:not(.eyebrow) {
  max-width: 580px;
  margin: 13px 0 22px;
  color: rgba(255, 255, 255, .8) !important;
  font-size: 13px !important;
  line-height: 1.55;
}

#appView .hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#appView .hero-chip {
  display: inline-flex;
  min-height: 29px;
  padding: 0 10px;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 999px;
  color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .12);
  font-size: 10px;
  font-weight: 720;
}

#appView .hero-chip .status-dot {
  width: 6px;
  height: 6px;
  background: #c8f7d2;
  box-shadow: none;
}

#appView .hero-orbit {
  display: grid;
  min-height: 170px;
  place-items: center;
}

#appView .orbit {
  position: relative;
  width: 180px;
  height: 180px;
  border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 50%;
}

#appView .orbit::before,
#appView .orbit::after {
  position: absolute;
  inset: 19px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  content: "";
}

#appView .orbit::after {
  inset: 42px;
  border-color: rgba(255, 255, 255, .32);
}

#appView .orbit-core {
  position: absolute;
  inset: 65px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #0c69ca;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0, 54, 124, .24);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
}

#appView .orbit-node {
  position: absolute;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: #b8f5c2;
  box-shadow: 0 0 0 5px rgba(184, 245, 194, .18);
}

#appView .orbit-node:nth-child(1) { top: 10px; left: 80px; }
#appView .orbit-node:nth-child(2) { top: 78px; right: 7px; background: #fff; }
#appView .orbit-node:nth-child(3) { bottom: 10px; left: 39px; background: #ffe0a4; }
#appView .orbit-node:nth-child(4) { top: 64px; left: 3px; }

#appView .hero-orbit small {
  position: absolute;
  right: 0;
  bottom: 4px;
  color: rgba(255, 255, 255, .72);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

#appView .overview-main-grid {
  display: block !important;
  margin-bottom: 16px;
}

#appView .overview-main-grid > .overview-panel--resources {
  margin-bottom: 16px;
}

#appView .overview-side-stack {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 16px;
}

#appView .overview-side-stack > .panel {
  min-width: 0;
}

#appView .overview-resource-row,
#appView .overview-token-row {
  min-height: 62px;
  padding: 13px 22px;
  background: rgba(255, 255, 255, .92);
}

#appView .overview-resource-row:hover,
#appView .overview-token-row:hover {
  background: #f7fbff;
}

#appView .overview-column-head,
#appView .overview-token-head {
  padding: 11px 22px;
  color: var(--muted-dark) !important;
  font-size: 10px !important;
  letter-spacing: .02em;
}

#appView .overview-resource-main strong,
#appView .overview-resource-tool strong,
#appView .overview-resource-version strong,
#appView .overview-token-name strong,
#appView .overview-token-expiry strong {
  color: var(--text) !important;
  font-size: 12px !important;
}

#appView .overview-resource-main small,
#appView .overview-resource-tool small,
#appView .overview-resource-version small,
#appView .overview-token-name small,
#appView .overview-token-expiry small {
  color: var(--muted) !important;
  font-size: 10px !important;
}

#appView .overview-panel--sync,
#appView .overview-panel--usage {
  margin-top: 16px;
}

#appView .overview-usage-grid {
  min-height: 105px;
  background: rgba(255, 255, 255, .86);
}

#appView .overview-lower-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 17px;
}

#appView .overview-lower-panel {
  min-width: 0;
  overflow: hidden;
}

#appView .overview-watch-list,
#appView .overview-activity-list {
  padding: 4px 22px 15px;
}

#appView .overview-watch-row,
#appView .overview-activity-row {
  display: flex;
  min-height: 54px;
  padding: 11px 0;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #f0f0f2;
}

#appView .overview-watch-row:last-child,
#appView .overview-activity-row:last-child {
  border-bottom: 0;
}

#appView .overview-watch-row > div,
#appView .overview-activity-row > div {
  min-width: 0;
  flex: 1;
}

#appView .overview-watch-row strong,
#appView .overview-watch-row small,
#appView .overview-activity-row strong,
#appView .overview-activity-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appView .overview-watch-row strong,
#appView .overview-activity-row strong {
  color: var(--text-soft) !important;
  font-size: 11px !important;
}

#appView .overview-watch-row small,
#appView .overview-activity-row small {
  margin-top: 3px;
  color: var(--muted) !important;
  font-size: 10px !important;
}

#appView .watch-days {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 8px;
  color: var(--orange) !important;
  background: var(--orange-wash);
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

#appView .watch-days.is-urgent {
  color: var(--red) !important;
  background: var(--red-wash);
}

#appView .activity-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-wash);
}

#appView .overview-activity-row:nth-child(3n+2) .activity-dot {
  background: #6d4bd8;
  box-shadow: 0 0 0 4px #f0ecff;
}

#appView .overview-activity-row:nth-child(3n) .activity-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-wash);
}

#appView .overview-activity-row time {
  flex: 0 0 auto;
  color: var(--muted-dark);
  font-family: var(--mono);
  font-size: 9px;
  white-space: nowrap;
}

#appView .overview-watch-empty {
  display: grid;
  min-height: 86px;
  padding: 18px 0;
  align-content: center;
  gap: 4px;
}

#appView .overview-watch-empty strong {
  color: var(--text-soft) !important;
  font-size: 11px !important;
}

#appView .overview-watch-empty span {
  color: var(--muted) !important;
  font-size: 10px;
}

#appView .overview-usage-grid strong {
  color: var(--text) !important;
  font-family: var(--display);
  font-size: 28px !important;
}

/* Master/detail pages: keep the list and inspector in one information flow,
   as in the reviewed preview.  Nothing is hidden; the inspector remains
   persistent and fully actionable below the registry. */
#appView .resource-layout,
#appView .model-usage-layout {
  display: block !important;
  min-width: 0;
}

#appView .resource-layout > .master-pane,
#appView .model-usage-layout > .model-registry-panel {
  width: 100%;
  margin-bottom: 17px;
}

#appView .resource-layout > .inspector,
#appView .model-usage-layout > .inspector {
  position: static !important;
  width: 100%;
  max-height: none !important;
  margin-top: 0;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#appView .inspector-heading {
  margin: 0 0 13px;
  padding: 0;
  align-items: flex-end;
}

#appView .inspector-heading h2 {
  margin: 5px 0 3px;
  color: var(--text) !important;
  font-family: var(--display);
  font-size: 28px !important;
  font-weight: 780 !important;
  letter-spacing: -.055em;
}

#appView .inspector-subtitle {
  color: var(--text-soft) !important;
  font-size: 13px !important;
}

#appView .inspector-summary {
  margin: 0 0 18px;
  color: var(--text-soft) !important;
  font-size: 14px !important;
}

#appView .inspector-section {
  padding: 17px 0;
  border-top: 0 !important;
}

#appView .inspector-section h3,
#appView .section-title-row h3 {
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 780 !important;
}

#appView .property-grid {
  margin-top: 10px;
  border: 1px solid #dceafa !important;
  border-radius: 13px !important;
  background: #f7fbff !important;
}

#appView .property-grid .detail-pair {
  min-height: 51px;
  padding: 9px 12px;
  border-color: #e2edf9 !important;
  background: transparent !important;
}

#appView .detail-pair small {
  color: var(--muted) !important;
  font-size: 10px !important;
}

#appView .detail-pair strong {
  color: var(--text-soft) !important;
  font-size: 11px !important;
}

#appView .inspector-description,
#appView .field-hint {
  color: var(--muted) !important;
  font-size: 11px !important;
  line-height: 1.55;
}

#appView .inspector-versions {
  margin-top: 10px;
  gap: 0;
  border: 1px solid var(--line) !important;
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
}

#appView .inspector-version {
  display: grid;
  padding: 14px 15px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 13px;
  border: 0 !important;
  border-radius: 0 !important;
  background: #fff !important;
}

#appView .inspector-version + .inspector-version {
  border-top: 1px solid #f0f0f2 !important;
}

#appView .inspector-version.is-current {
  background: #f5faff !important;
}

#appView .inspector-version-main strong {
  color: var(--text) !important;
  font-family: var(--mono);
  font-size: 12px !important;
}

#appView .inspector-version-main small,
#appView .inspector-version-meta {
  color: var(--muted) !important;
  font-size: 10px !important;
}

#appView .inspector-version-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

#appView .inspector-version > .text-button {
  justify-self: end;
  grid-column: 2;
}

#appView .inspector-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 0 0;
}

#appView .inspector-section--danger {
  margin-top: 14px;
}

#appView .inspector-danger-zone,
#appView .danger-zone {
  border-radius: 13px !important;
  border-color: #f2d0cd !important;
  background: #fff9f8 !important;
}

/* Registry tables */
#appView .table-shell {
  overflow: hidden;
}

#appView .table-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
}

#appView .data-table--v2 {
  width: 100%;
  min-width: 820px;
  table-layout: fixed;
  border-collapse: collapse;
}

#appView .data-table--v2 th {
  height: 43px !important;
  padding: 11px 13px !important;
  border-bottom: 1px solid #f0f0f2 !important;
  color: var(--muted-dark) !important;
  background: #fbfbfd !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  letter-spacing: .03em !important;
  white-space: nowrap;
}

#appView .data-table--v2 td {
  min-height: 66px;
  padding: 12px 13px !important;
  border-bottom: 1px solid #f0f0f2 !important;
  color: var(--text-soft) !important;
  font-size: 11px !important;
  vertical-align: middle;
}

#appView .data-table--v2 tbody tr {
  cursor: pointer;
  transition: background var(--ease), box-shadow var(--ease);
}

#appView .data-table--v2 tbody tr:hover {
  background: #fafcff !important;
}

#appView .data-table--v2 tbody tr.is-selected {
  background: #eaf4ff !important;
  box-shadow: inset 3px 0 0 var(--blue);
}

#appView .data-table--v2 tbody tr:last-child td {
  border-bottom: 0 !important;
}

#appView .data-table--v2 td strong {
  color: var(--text) !important;
  font-size: 12px !important;
  font-weight: 750 !important;
}

#appView .data-table--v2 td small {
  color: var(--muted) !important;
  font-size: 10px !important;
}

#appView .skill-cell--v2,
#appView .model-cell-v2,
#appView .token-cell-v2 {
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
}

#appView .skill-cell--v2 p,
#appView .model-cell-v2 p {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted) !important;
  font-size: 10px !important;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#appView .skill-glyph,
#appView .model-glyph {
  display: grid;
  width: 34px !important;
  height: 34px !important;
  place-items: center;
  border: 1px solid #d5e7fb !important;
  border-radius: 10px !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
  font-size: 10px !important;
  font-weight: 800;
}

#appView .model-glyph {
  color: #6d4bd8 !important;
  border-color: #e0d9ff !important;
  background: #f0ecff !important;
}

#appView .tool-cell-v2,
#appView .version-cell-v2,
#appView .date-cell-v2,
#appView .model-status-stack {
  min-width: 0;
}

#appView .tool-cell-v2 small,
#appView .version-cell-v2 small,
#appView .date-cell-v2 small {
  display: block;
  margin-top: 4px;
}

#appView .scope-inline {
  display: block;
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: var(--blue) !important;
  font-family: var(--mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appView .model-inline {
  display: block;
  max-width: 100%;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted) !important;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appView .version-cell-v2 p {
  max-width: 100%;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted) !important;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appView .date-cell-v2 {
  color: var(--muted) !important;
  font-size: 10px;
  white-space: nowrap;
}

#appView .table-actions--v2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px !important;
  white-space: nowrap;
}

#appView .row-chevron {
  color: var(--muted-dark) !important;
  font-size: 19px;
  line-height: 1;
}

#appView .status-chip {
  min-height: 24px !important;
  padding: 0 8px !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  gap: 5px;
  font-size: 10px !important;
  font-weight: 750 !important;
  white-space: nowrap;
}

#appView .status--ready,
#appView .status--active,
#appView .status--success {
  border-color: #c9e9d0 !important;
  color: var(--green) !important;
  background: var(--green-wash) !important;
}

#appView .status--blue,
#appView .status--info,
#appView .status--enabled {
  border-color: #cfe3ff !important;
  color: var(--blue) !important;
  background: var(--blue-wash) !important;
}

#appView .status--pending,
#appView .status--draft,
#appView .status--warning {
  border-color: #f1dfb5 !important;
  color: var(--yellow) !important;
  background: var(--yellow-wash) !important;
}

#appView .status--disabled,
#appView .status--muted,
#appView .status--suspended,
#appView .status--historical {
  border-color: #e0e0e5 !important;
  color: var(--muted) !important;
  background: #f2f2f5 !important;
}

#appView .status--danger,
#appView .status--error,
#appView .status--failed,
#appView .status--expired,
#appView .status--revoked {
  border-color: #f2cbc8 !important;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

#appView .status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-dark);
}

#appView .status-dot--ready,
#appView .status-dot--success { background: var(--green); }
#appView .status-dot--blue,
#appView .status-dot--info { background: var(--blue); }
#appView .status-dot--pending,
#appView .status-dot--warning { background: var(--orange); }
#appView .status-dot--danger,
#appView .status-dot--failed { background: var(--red); }

#appView .scope-list {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

#appView .scope-chip {
  display: inline-flex;
  min-height: 22px;
  max-width: 100%;
  padding: 0 7px;
  align-items: center;
  overflow-wrap: anywhere;
  border: 1px solid #e1e1e7 !important;
  border-radius: 7px !important;
  color: var(--text-soft) !important;
  background: #fafafd !important;
  font-family: var(--mono);
  font-size: 9px;
}

#appView .switch--v2 {
  width: 44px !important;
  height: 26px !important;
  flex: 0 0 44px;
}

#appView .switch--v2 span {
  border: 1px solid #d0d0d6;
  background: #d1d1d6;
}

#appView .switch--v2.is-on span {
  border-color: #34c759;
  background: #34c759;
}

#appView .pagination-foot {
  min-height: 39px !important;
  padding: 0 14px !important;
  border-top: 1px solid #f0f0f2 !important;
  color: var(--muted-dark) !important;
  background: #fbfbfd !important;
  font-size: 10px !important;
  letter-spacing: .04em !important;
}

/* Inspector details and model/usage panels */
#appView .token-life-card {
  display: flex;
  min-height: 72px;
  margin: 10px 0 12px;
  padding: 14px 16px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #dceafa;
  border-radius: 14px;
  background: linear-gradient(110deg, #f3f8ff, #fbfdff);
}

#appView .token-life-card strong {
  color: var(--green) !important;
  font-family: var(--display);
  font-size: 24px !important;
  letter-spacing: -.05em;
}

#appView .token-life-card span {
  color: var(--muted) !important;
  font-size: 11px;
  text-align: right;
}

#appView .token-life-card--warning strong { color: var(--yellow) !important; }
#appView .token-life-card--danger strong { color: var(--red) !important; }
#appView .token-life-card--muted strong { color: var(--muted) !important; }

#appView .token-usage {
  display: block;
  margin-top: 4px;
  color: var(--muted) !important;
  font-size: 9px !important;
}

#appView .model-usage-layout {
  margin-bottom: 18px;
}

#appView .model-registry-panel {
  overflow: hidden;
}

#appView .model-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#appView .usage-panels-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 17px;
}

#appView .usage-panel,
#appView .usage-events-panel {
  overflow: hidden;
}

#appView .usage-ranking {
  padding: 4px 20px 18px;
}

#appView .usage-rank-row {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f2;
}

#appView .usage-rank-row:last-child {
  border-bottom: 0;
}

#appView .usage-rank-top {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

#appView .usage-rank-index {
  color: var(--muted-dark) !important;
  font-family: var(--mono);
  font-size: 9px;
}

#appView .usage-rank-top strong {
  overflow: hidden;
  color: var(--text-soft) !important;
  font-size: 11px !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appView .usage-rank-count {
  color: var(--muted) !important;
  font-family: var(--mono);
  font-size: 9px;
  white-space: nowrap;
}

#appView .usage-rank-bar {
  height: 4px;
  margin: 8px 0 5px 31px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf0f4;
}

#appView .usage-rank-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #258be8, #6eb8f6);
}

#appView .usage-rank-row > small {
  display: block;
  margin-left: 31px;
  color: var(--muted) !important;
  font-size: 9px;
}

#appView .usage-events-panel {
  margin-top: 17px;
}

#appView .usage-events-table {
  width: 100%;
  min-width: 720px;
  table-layout: fixed;
}

#appView .usage-events-table th,
#appView .usage-events-table td {
  padding: 11px 13px !important;
}

#appView .model-connection-state {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 7px;
}

#appView .model-connection-state > small {
  max-width: 230px;
  overflow: hidden;
  color: var(--muted) !important;
  font-size: 9px !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#appView .model-connection-error {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f2c7cc !important;
  border-radius: 11px;
  color: var(--red) !important;
  background: var(--red-wash) !important;
}

#appView .model-connection-error strong {
  color: var(--red) !important;
  font-family: var(--mono);
  font-size: 10px !important;
}

#appView .model-connection-error span {
  color: var(--muted) !important;
  font-size: 10px;
}

#appView .model-usage-mini {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
}

#appView .model-usage-mini > div {
  min-height: 67px;
  padding: 11px 12px;
  background: #fbfbfd;
}

#appView .model-usage-mini > div + div {
  border-left: 1px solid var(--line-soft);
}

#appView .model-usage-mini strong {
  display: block;
  color: var(--text) !important;
  font-family: var(--display);
  font-size: 18px !important;
}

#appView .model-usage-mini small {
  display: block;
  margin-top: 4px;
  color: var(--muted) !important;
  font-size: 10px;
}

#appView .model-assignment-list {
  display: grid;
  margin-top: 10px;
  gap: 7px;
}

#appView .model-assignment-row {
  display: flex;
  min-height: 46px;
  padding: 9px 11px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: #fff;
}

#appView .model-assignment-row strong,
#appView .model-assignment-row small {
  display: block;
}

#appView .model-assignment-row strong {
  color: var(--text-soft) !important;
  font-size: 11px !important;
}

#appView .model-assignment-row small {
  margin-top: 2px;
  color: var(--muted) !important;
  font-size: 9px !important;
}

#appView .model-inspector-toggle {
  display: inline-flex;
  min-height: 39px;
  padding: 0 8px 0 11px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line) !important;
  border-radius: 11px;
  color: var(--muted) !important;
  background: #fff !important;
  font-size: 11px;
}

/* Audit */
#appView .audit-toolbar {
  gap: 18px !important;
}

#appView .audit-toolbar .search-box {
  flex: 1 1 420px;
  max-width: 620px;
}

#appView .audit-toolbar .field--audit-filter {
  flex: 0 0 210px;
  margin-left: auto;
}

#appView .audit-details summary {
  color: var(--blue) !important;
  font-size: 10px;
  font-weight: 720;
  cursor: pointer;
}

#appView .audit-details .json-view {
  max-height: 230px;
  margin-top: 8px;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  color: var(--text-soft) !important;
  background: #fbfbfd;
  font-family: var(--mono);
  font-size: 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Drawers, dialogs and secure reveal surfaces */
#appView ~ .drawer-layer,
#appView ~ .modal-layer {
  color: var(--text);
}

.drawer,
.modal {
  border: 1px solid rgba(222, 222, 228, .95) !important;
  border-radius: 22px !important;
  color: var(--text) !important;
  background: rgba(255, 255, 255, .97) !important;
  box-shadow: 0 28px 80px rgba(31, 37, 51, .18) !important;
  backdrop-filter: blur(20px);
}

.drawer-header,
.modal-header {
  border-bottom-color: #f0f0f2 !important;
}

.drawer-header h2,
.modal h2 {
  color: var(--text) !important;
  font-family: var(--display) !important;
  letter-spacing: -.04em !important;
}

.drawer-body,
.modal-body {
  color: var(--text-soft) !important;
}

.form-label > span,
.form-section-title h4,
.drawer-section-title h3 {
  color: var(--text-soft) !important;
}

.form-label small,
.form-section-title span,
.drawer-section-title small {
  color: var(--muted) !important;
}

.file-picker__surface {
  border: 1px dashed #c9dff7 !important;
  border-radius: 12px !important;
  background: #f7fbff !important;
}

.file-picker__button {
  border: 1px solid #cfe3ff !important;
  border-radius: 9px !important;
  color: var(--blue) !important;
  background: #fff !important;
}

.file-picker__name {
  color: var(--muted) !important;
}

.modal-body-copy,
.modal-note {
  color: var(--text-soft) !important;
}

.secret-reveal {
  border: 1px solid #dceafa !important;
  border-radius: 13px !important;
  background: #f7fbff !important;
}

.secret-reveal code {
  color: var(--text-soft) !important;
  font-family: var(--mono) !important;
}

.config-output {
  border: 1px solid var(--line-soft) !important;
  border-radius: 11px !important;
  color: var(--text-soft) !important;
  background: #fbfbfd !important;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 4px 0 14px;
}

.info-grid > div {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #fbfbfd;
}

.info-grid small,
.info-grid strong {
  display: block;
}

.info-grid small {
  color: var(--muted) !important;
  font-size: 10px;
}

.info-grid strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--text-soft) !important;
  font-family: var(--mono);
  font-size: 11px;
}

.help-list {
  display: grid;
  gap: 0;
  margin: 4px 0 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
}

.help-list > div {
  display: grid;
  padding: 12px 13px;
  gap: 4px;
  background: #fff;
}

.help-list > div + div {
  border-top: 1px solid var(--line-soft);
}

.help-list strong {
  color: var(--text-soft) !important;
  font-size: 12px;
}

.help-list span {
  color: var(--muted) !important;
  font-size: 11px;
  line-height: 1.5;
}

/* Responsive behavior mirrors the preview: the rail becomes an off-canvas
   drawer, while data remains readable as labelled cards on narrow screens. */
@media (max-width: 1100px) {
  :root { --sidebar-width: 238px; }
  #appView .sidebar { width: var(--sidebar-width) !important; }
  #appView .workspace { margin-left: var(--sidebar-width) !important; }
  #appView .page-content { padding-inline: 28px !important; }
  #appView .topbar { padding-inline: 28px !important; }
  #appView .production-badge { display: none; }
  #appView .overview-side-stack { grid-template-columns: 1fr; }
  #appView .model-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  :root { --sidebar-width: 276px; }
  #appView .sidebar {
    transform: translateX(-105%);
    transition: transform .24s cubic-bezier(.2, .7, .2, 1);
    box-shadow: 18px 0 45px rgba(31, 37, 51, .16);
  }
#appView .sidebar.is-open { transform: translateX(0); }
#appView .sidebar { z-index: 90 !important; }
  #appView .workspace { margin-left: 0 !important; }
  #appView .menu-button { display: grid !important; }
  #appView .topbar { padding-inline: 22px !important; }
  #appView .page-content { padding-inline: 22px !important; }
  #appView .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 60 !important;
    display: block;
    border: 0;
    background: rgba(31, 37, 51, .22);
    backdrop-filter: blur(2px);
  }
  #appView .mobile-scrim[hidden] { display: none !important; }
  #appView .topbar-actions .context-chip { display: none; }
  #appView .overview-hero { grid-template-columns: minmax(0, 1fr) 185px; }
  #appView .usage-panels-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  #appView .topbar {
    min-height: 68px;
    padding: 12px 15px !important;
  }
  #appView .topbar-title h2 { font-size: 19px !important; }
  #appView .topbar-actions { gap: 6px !important; }
  #appView .live-state,
  #appView .admin-chip { display: none !important; }
  #appView .topbar-help { display: none; }
  #appView .page-content {
    min-height: calc(100vh - 68px);
    padding: 25px 15px 46px !important;
  }
  #appView .page-heading {
    display: block;
    margin-bottom: 18px !important;
  }
  #appView .page-heading h1 { font-size: 31px !important; }
  #appView .heading-actions {
    margin-top: 14px;
    justify-content: flex-start;
  }
  #appView .heading-actions .button { flex: 0 0 auto; }
  #appView .overview-hero {
    display: block;
    min-height: 0;
    padding: 24px 22px 20px;
  }
  #appView .hero-orbit { display: none; }
  #appView .hero-copy h3 { font-size: 28px; }
  #appView .metric-grid,
  #appView .mini-summary-grid,
  #appView .model-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #appView .overview-side-stack,
  #appView .usage-panels-grid { grid-template-columns: 1fr; }
  #appView .toolbar--v2 {
    display: grid;
    min-height: 0;
    padding: 10px !important;
    gap: 9px;
  }
  #appView .toolbar--v2 .search-box,
  #appView .toolbar--v2 .segmented {
    width: 100%;
    max-width: none;
  }
  #appView .toolbar--v2 .toolbar-spacer { display: none; }
  #appView .data-table--v2 {
    min-width: 0;
    table-layout: auto;
  }
  #appView .data-table--v2 thead { display: none; }
  #appView .data-table--v2,
  #appView .data-table--v2 tbody,
  #appView .data-table--v2 tr,
  #appView .data-table--v2 td {
    display: block;
    width: 100%;
  }
  #appView .data-table--v2 tbody tr {
    padding: 13px 14px;
    border-bottom: 1px solid #f0f0f2;
  }
  #appView .data-table--v2 td {
    display: flex;
    min-height: 0;
    padding: 6px 0 !important;
    align-items: flex-start;
    gap: 12px;
    border: 0 !important;
    overflow: visible;
  }
  #appView .data-table--v2 td::before {
    content: attr(data-label);
    flex: 0 0 76px;
    color: var(--muted-dark);
    font-size: 9px;
    font-weight: 750;
  }
  #appView .data-table--v2 td > * { min-width: 0; flex: 1; }
  #appView .data-table--v2 td[data-label="操作"] { padding-top: 11px !important; }
  #appView .data-table--v2 .table-actions--v2 { align-items: flex-start; }
  #appView .data-table--v2 .switch--v2 { flex: 0 0 44px; max-width: 44px; }
  #appView .inspector-heading { display: block; }
  #appView .inspector-heading > .status-chip { margin-top: 8px; }
  #appView .inspector-heading h2 { font-size: 27px !important; }
  #appView .property-grid { grid-template-columns: 1fr; }
  #appView .property-grid .detail-pair,
  #appView .property-grid .detail-pair:nth-child(2n) { border-right: 0 !important; }
  #appView .property-grid .detail-pair:nth-last-child(-n+2) { border-bottom: 1px solid var(--line-soft) !important; }
  #appView .property-grid .detail-pair:last-child { border-bottom: 0 !important; }
  #appView .inspector-version { grid-template-columns: 1fr; }
  #appView .inspector-version > .text-button { grid-column: 1; justify-self: start; }
  #appView .inspector-version-meta { flex-wrap: wrap; }
  #appView .token-life-card { display: block; }
  #appView .token-life-card span { display: block; margin-top: 5px; text-align: left; }
  #appView .model-usage-mini { grid-template-columns: 1fr; }
  #appView .model-usage-mini > div + div { border-top: 1px solid var(--line-soft); border-left: 0; }
  #appView .audit-toolbar .search-box,
  #appView .audit-toolbar .field--audit-filter { width: 100%; max-width: none; margin-left: 0; flex: 1 1 auto; }
}

@media (max-width: 430px) {
  #appView .metric-grid,
  #appView .mini-summary-grid,
  #appView .model-kpis { grid-template-columns: 1fr; }
  #appView .metric-card,
  #appView .mini-summary-grid .metric-card { min-height: 88px; }
  #appView .heading-actions .button { width: 100%; }
  #appView .heading-actions { display: grid; grid-template-columns: 1fr; }
  #appView .panel-header--v2 { padding-inline: 16px !important; }
  #appView .overview-column-head,
  #appView .overview-token-head,
  #appView .overview-resource-row,
  #appView .overview-token-row { padding-inline: 16px; }
  #appView .overview-resource-row,
  #appView .overview-token-row { grid-template-columns: 1fr auto; }
  #appView .overview-column-head { display: none; }
  #appView .overview-resource-row,
  #appView .overview-token-row {
    display: grid;
    grid-template-rows: auto auto;
    gap: 6px 10px;
  }
  #appView .overview-resource-row > .resource-status,
  #appView .overview-token-row > .overview-token-name { grid-column: 1; }
  #appView .overview-resource-row > .overview-resource-tool,
  #appView .overview-token-row > .overview-token-scopes { grid-column: 1; }
  #appView .overview-resource-row > .overview-resource-version,
  #appView .overview-token-row > .overview-token-expiry { grid-column: 2; grid-row: 1 / 3; align-self: center; text-align: right; }
  #appView .overview-resource-row > .row-chevron,
  #appView .overview-token-row > .row-chevron { grid-column: 2; grid-row: 1 / 3; }
  #appView .sidebar { width: min(276px, 88vw) !important; }
  #appView .page-heading h1 { font-size: 29px !important; }
}

@media (prefers-reduced-motion: reduce) {
  #appView *,
  #appView *::before,
  #appView *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Laptop widths still have enough room for labelled cards, but not for all
   seven registry columns.  Collapse the table before it can hide the action
   column behind a horizontal scroller. */
@media (min-width: 761px) and (max-width: 1100px) {
  #appView .data-table--v2 {
    min-width: 0;
    table-layout: auto;
  }
  #appView .data-table--v2 thead { display: none; }
  #appView .data-table--v2,
  #appView .data-table--v2 tbody,
  #appView .data-table--v2 tr,
  #appView .data-table--v2 td {
    display: block;
    width: 100%;
  }
  #appView .data-table--v2 tbody tr {
    padding: 13px 15px;
    border-bottom: 1px solid #f0f0f2;
  }
  #appView .data-table--v2 td {
    display: flex;
    min-height: 0;
    padding: 6px 0 !important;
    align-items: flex-start;
    gap: 12px;
    border: 0 !important;
    overflow: visible;
  }
  #appView .data-table--v2 td::before {
    content: attr(data-label);
    flex: 0 0 92px;
    color: var(--muted-dark);
    font-size: 9px;
    font-weight: 750;
  }
  #appView .data-table--v2 td > * { min-width: 0; flex: 1; }
  #appView .data-table--v2 td[data-label="操作"] { padding-top: 11px !important; }
  #appView .data-table--v2 .switch--v2 { flex: 0 0 44px; max-width: 44px; }
  #appView .table-scroll { overflow: visible; }
  #appView .usage-events-table { min-width: 0; }
}
