/* COSBOO AI Workspace — application styles (M1 click dummy).
   Tokens follow the COSBOO marketing/login design: navy ink, warm paper,
   Sora display type and Nunito Sans body copy. Light only (CAI-221 A3). */

/* ---------- Admin pages (formerly admin.css; scoped to the admin containers) ---------- */
/* Keep the desktop budget overview within the viewport; cards scroll if needed. */
@media (min-width: 1280px) {
  body.dashboard-page {
    height: 100dvh;
  }
  .dashboard-page :is(#main, #pageRoot, #admin, .rui-admin-content) {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  .cai-dashboard {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }
  .cai-dashboard > :not(.c-grid--main-side) {
    flex-shrink: 0;
  }
  .cai-dashboard > .c-grid--main-side {
    flex: 1;
    min-height: 0;
    grid-template-rows: minmax(0, 1fr);
  }
  .cai-dashboard .c-card {
    min-height: 0;
  }
  .cai-dashboard .c-card__body {
    min-height: 0;
    overflow: auto;
  }
}
:where( .rui-admin-content) {
  min-width: 0;
  font-family: var(--ql-font-sans, "Nunito Sans", ui-sans-serif, system-ui, sans-serif);
}

.rui-admin-content :is(.admin-index-header__subtitle, .admin-detail-header__subtitle),
.rui-admin-content :is(.rui-form-label, .rui-form-hint) {
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.rui-admin-content .admin-hero-action,
.rui-admin-content .admin-create-button {
  min-height: var(--ql-control-height, 2.25rem);
  border-radius: var(--ql-radius-control, 0.375rem);
  box-shadow: none;
  backdrop-filter: none;
  transform: none;
}
.rui-admin-content .admin-hero-action:hover,
.rui-admin-content .admin-create-button:hover {
  box-shadow: none;
  transform: none;
}

.rui-admin-content .admin-create-button {
  border-color: var(--ql-action, var(--primary));
  background: var(--ql-action, var(--primary));
  color: var(--ql-action-fg, #fff);
}
.rui-admin-content .rui-form-actions {
  gap: 0.75rem;
  padding-block: 0.75rem;
  border-top: 1px solid var(--ql-line, var(--border-light));
  background: var(--ql-surface, var(--surface));
}
.rui-admin-content .rui-form.is-dirty .rui-form-actions {
  box-shadow: none;
}
.rui-admin-content :is(.rui-table-box, .rui-table-overflow, .rui-form) {
  border-radius: var(--ql-radius-surface, 0.5rem);
  box-shadow: none;
}
@media (pointer: coarse), (max-width: 47.999rem) {
  .rui-admin-content .admin-hero-action,
  .rui-admin-content .admin-create-button {
    min-height: var(--ql-touch-target, 2.75rem);
  }
}


@font-face {
  font-family: Sora;
  src: url("../fonts/Sora-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Sora;
  src: url("../fonts/Sora-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Sora;
  src: url("../fonts/Sora-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Sora;
  src: url("../fonts/Sora-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Sora;
  src: url("../fonts/Sora-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/NunitoSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/NunitoSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #172038;
  --ink-2: #3b4560;
  --muted: #697184;
  --faint: #9aa1b1;
  --navy: #1a2542;
  --navy-2: #273352;
  --accent: #5164a8;
  --accent-soft: rgb(81 100 168 / 10%);
  --accent-line: rgb(81 100 168 / 28%);
  --paper: #f1f0ec;
  --surface: #fafaf8;
  --card: #fff;
  --line: rgb(22 31 52 / 11%);
  --line-strong: rgb(22 31 52 / 20%);
  --green: #3f7a5f;
  --green-soft: rgb(78 132 108 / 13%);
  --amber: #a8691a;
  --amber-soft: rgb(196 132 45 / 14%);
  --orange: #d9822b;
  --red: #b8412f;
  --red-soft: rgb(184 65 47 / 11%);
  --shadow-sm: 0 1px 2px rgb(19 27 45 / 6%);
  --shadow: 0 12px 32px rgb(19 27 45 / 8%);
  --shadow-lg: 0 26px 70px rgb(19 27 45 / 16%);
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --display: Sora, "Nunito Sans", system-ui, sans-serif;
  --body: "Nunito Sans", system-ui, sans-serif;
  --sidebar-w: 284px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--display);
  letter-spacing: -0.025em;
  line-height: 1.2;
}
p {
  margin: 0;
}
a {
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
:is(svg, .asset-icon) {
  flex: 0 0 auto;
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Buttons ---------- */
.c-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.1s,
    box-shadow 0.15s;
}
.c-btn:hover {
  border-color: var(--navy-2);
}
.c-btn:active {
  transform: translateY(1px);
}
.c-btn :is(svg, .asset-icon) {
  width: 17px;
  height: 17px;
}
.c-btn--primary {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
  box-shadow: 0 6px 16px rgb(26 37 66 / 18%);
}
.c-btn--primary:hover {
  background: var(--navy-2);
  color: #fff;
  text-decoration: none;
}
.c-btn--sm {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
  border-radius: 8px;
}
.c-btn[disabled],
.c-btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.c-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.c-link:hover {
  text-decoration: underline;
}

/* ---------- Badges / chips ---------- */
.c-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgb(22 31 52 / 6%);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.c-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}
.c-badge--plain::before {
  display: none;
}
.c-badge--green {
  background: var(--green-soft);
  color: var(--green);
}
.c-badge--amber {
  background: var(--amber-soft);
  color: var(--amber);
}
.c-badge--red {
  background: var(--red-soft);
  color: var(--red);
}
.c-badge--blue {
  background: var(--accent-soft);
  color: var(--accent);
}
.c-badge--navy {
  background: var(--navy);
  color: #fff;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 700;
}
.chip--default {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
}
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.level {
  display: inline-flex;
  gap: 2px;
  vertical-align: middle;
}
.level i {
  width: 5px;
  height: 11px;
  border-radius: 2px;
  background: rgb(22 31 52 / 13%);
}
.level[data-level="1"] i:nth-child(-n + 1),
.level[data-level="2"] i:nth-child(-n + 2),
.level[data-level="3"] i:nth-child(-n + 3) {
  background: var(--navy-2);
}

/* ---------- Sidebar extras (inside the VOROS shell) ---------- */
.budget-mini {
  min-width: 0;
  width: 100%;
  padding: 12px 8px;
}
.budget-mini__row {
  display: flex;
  flex-wrap: wrap;
  row-gap: 4px;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.budget-mini__label {
  color: var(--ink);
  font: 600 12.5px/1.3 var(--display);
  letter-spacing: -0.01em;
}
.budget-mini__pct {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.budget-mini.is-exhausted .budget-mini__pct {
  color: var(--red);
}
.budget-mini .meter {
  height: 6px;
  margin-top: 8px;
  background: rgb(22 31 52 / 8%);
}
.budget-mini__foot {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--navy);
  color: #fff;
  font: 700 13px var(--display);
}
.avatar--lg {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 22px;
}
/* ---------- Pages ---------- */
.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 40px) 64px;
  animation: rise 0.35s ease-out both;
}
.page--narrow {
  max-width: 880px;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .page,
  .toast {
    animation: none !important;
  }
}

.crumbs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--ink);
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 26px;
}
.page-head h1 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
}
.page-head p {
  max-width: 680px;
  margin-top: 6px;
  color: var(--muted);
}
.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.c-card {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.c-card__body {
  padding: 22px 24px;
}
.c-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.c-card__head h2 {
  font-size: 16px;
  font-weight: 700;
}
.c-card__head p {
  color: var(--muted);
  font-size: 13px;
}
.c-card + .c-card {
  margin-top: 16px;
}
.c-grid > .c-card + .c-card {
  margin-top: 0;
}
.c-grid {
  display: grid;
  gap: 16px;
}
.c-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.c-grid--main-side {
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  align-items: start;
}
@media (max-width: 1080px) {
  .c-grid--3 {
    grid-template-columns: 1fr 1fr;
  }
  .c-grid--main-side {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  
  .c-grid--3 {
    grid-template-columns: 1fr;
  }
}

.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r);
  background: var(--accent-soft);
  color: var(--ink-2);
  font-size: 14px;
}
.notice :is(svg, .asset-icon) {
  width: 19px;
  height: 19px;
  margin-top: 1px;
  color: var(--accent);
}
.notice b {
  color: var(--ink);
}
.notice--warn {
  border-color: rgb(196 132 45 / 35%);
  background: var(--amber-soft);
}
.notice--warn :is(svg, .asset-icon) {
  color: var(--amber);
}
.notice--error {
  border-color: rgb(184 65 47 / 30%);
  background: var(--red-soft);
}
.notice--error :is(svg, .asset-icon) {
  color: var(--red);
}
.notice + * {
  margin-top: 18px;
}

/* ---------- KPIs & meters ---------- */
.kpi {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 124px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
}
.kpi > span {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}
.kpi > b {
  font: 700 clamp(24px, 2.6vw, 32px) / 1.1 var(--display);
  letter-spacing: -0.04em;
}
.kpi > b.is-over {
  color: var(--red);
}
.kpi > small {
  color: var(--muted);
  font-size: 12.5px;
}
.kpi--primary {
  border-color: transparent;
  background: var(--navy);
  color: #fff;
}
.kpi--primary > span,
.kpi--primary > small {
  color: #bac4db;
}
.kpi .meter {
  margin-top: 8px;
}

.meter {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e5ea;
}
meter.meter {
  display: block;
  width: 100%;
  appearance: none;
  --meter-fill: var(--navy-2);
}
meter.meter::-webkit-meter-bar {
  border: 0;
  background: transparent;
  height: 100%;
}
meter.meter::-webkit-meter-optimum-value {
  background: var(--meter-fill);
  border-radius: inherit;
}
meter.meter::-moz-meter-bar {
  background: var(--meter-fill);
  border-radius: inherit;
}
meter.meter--accent { --meter-fill: var(--accent); }
meter.meter--warn { --meter-fill: var(--amber); }
meter.meter--full { --meter-fill: var(--red); }
meter.meter--soft-over { --meter-fill: var(--orange); }
.meter--unavailable {
  background: repeating-linear-gradient(135deg, #e3e5ea 0 4px, #f1f2f5 4px 8px);
}
.meter > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--navy-2);
}
.meter--warn > i {
  background: var(--amber);
}
.meter--soft-over > i {
  background: var(--orange);
}
.meter--accent > i {
  background: var(--accent);
}
.meter--full > i {
  background: var(--red);
}
.kpi--primary .meter {
  background: rgb(255 255 255 / 16%);
}
.kpi--primary .meter > i {
  background: #9fb1e6;
}

.c-budget-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(0, 2.4fr) 140px;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.c-budget-row:first-child {
  border-top: 0;
}
.c-budget-row .meter {
  height: 12px;
}
.c-budget-row__name b {
  display: block;
  font-size: 14px;
}
.c-budget-row__name small {
  color: var(--muted);
  font-size: 12px;
}
.c-budget-row__value {
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}
.c-budget-row__value b {
  display: block;
  color: var(--ink);
  font: 700 15px var(--display);
}
.c-budget-row__value b.is-over {
  color: var(--red);
}
.c-budget-row__value b.is-soft-over {
  color: var(--orange);
}
.budget-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}
.budget-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.budget-legend i {
  width: 12px;
  height: 8px;
  border-radius: 3px;
  background: var(--navy-2);
}
.budget-legend i.is-over {
  background: var(--red);
}
.budget-legend i.is-soft-over {
  background: var(--orange);
}
.budget-legend i.is-free {
  background: #e3e5ea;
}
@media (max-width: 720px) {
  .c-budget-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .c-budget-row__value {
    text-align: left;
  }
}

/* Group colours for the usage breakdown (stack segments, swatches, bars) */
.usage-series--blue { --usage-color: #3b5fc4; }
.usage-series--orange { --usage-color: #d06d2a; }
.usage-series--aqua { --usage-color: #1a9e86; }
.usage-series--violet { --usage-color: #7a5bd0; }
.usage-series--green { --usage-color: #5e8f2e; }
.usage-series--magenta { --usage-color: #c2468f; }
.usage-series--other { --usage-color: #a3a9b8; }

.chart {
  width: 100%;
  height: auto;
}
.chart text {
  fill: var(--faint);
  font: 11px var(--body);
}

/* ---------- Tables ---------- */

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

.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty :is(svg, .asset-icon) {
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
  color: var(--faint);
}
.empty b {
  color: var(--ink);
  font-family: var(--display);
}

/* ---------- Forms ---------- */
.form {
  display: grid;
  gap: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 20px;
}
.form-grid .span-2 {
  grid-column: 1 / -1;
}
@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.field > label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
}
.req {
  color: var(--red);
  margin-left: 2px;
}
.c-hint {
  color: var(--muted);
  font-size: 12.5px;
}
.c-hint.is-over {
  color: var(--red);
  font-weight: 700;
}
.c-input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  outline: 0;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.textarea {
  min-height: 96px;
  resize: vertical;
}
.c-input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.c-input[readonly],
.c-input:disabled {
  background: var(--surface);
  color: var(--muted);
}
.field.is-invalid .c-input,
.field.is-invalid .select {
  border-color: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 4px 24px 20px;
}
.c-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}
.c-fieldset legend {
  margin-bottom: 10px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-2);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.choice {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: #fff;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
.choice:hover {
  border-color: var(--navy-2);
}
.choice input {
  margin-top: 3px;
  accent-color: var(--navy);
}
.choice:has(input:checked) {
  border-color: var(--navy);
  background: #f7f8fb;
  box-shadow: inset 0 0 0 1px var(--navy);
}
.choice:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}
.choice b {
  display: block;
  font-size: 14px;
}
.choice small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.choice__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.switch input {
  position: absolute;
  opacity: 0;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.tabs a:hover {
  color: var(--ink);
}
.tabs a[aria-current="page"] {
  border-bottom-color: var(--navy);
  color: var(--ink);
}

/* ---------- Dialog / toast ---------- */
dialog.modal {
  width: min(520px, calc(100vw - 32px));
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}
dialog.modal::backdrop {
  background: rgb(10 14 26 / 45%);
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  padding: 13px 16px;
  border-radius: var(--r);
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: rise 0.25s ease-out both;
}
.toast :is(svg, .asset-icon) {
  width: 18px;
  height: 18px;
  color: #9fd4b9;
}

/* ---------- Chat: COSBOO additions on the VOROS vision/2 chat (chat.css) ---------- */
.chat-page .chat-turn__inner {
  margin-inline: auto;
}
.chat-page .chat-turn--user .chat-turn__inner {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.cai-chat-notice {
  margin-bottom: 10px;
}
.chat-msg-actions .cai-answer-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.chat-msg-actions .cai-answer-meta :is(svg, .asset-icon) {
  width: 14px;
  height: 14px;
}
.chat-msg-actions .cai-answer-meta img {
  width: 15px;
  height: 15px;
  object-fit: contain;
}
.chat-msg-actions .cai-answer-meta.is-retired img {
  opacity: 0.55;
}
.chat-msg-actions {
  gap: 14px;
}
.chat-assistant__body.is-streaming > p:last-child::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 15px;
  margin-left: 2px;
  vertical-align: -2px;
  background: currentColor;
  opacity: 0.6;
  animation: cai-blink 1s steps(2) infinite;
}
@keyframes cai-blink {
  50% {
    opacity: 0;
  }
}
.chat-page .cai-model-panel {
  min-width: min(560px, calc(100vw - 32px));
}
.cai-model-panel__head,
.chat-page .cai-model-option {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 74px 64px 76px;
  align-items: center;
  gap: 8px;
}
.cai-model-panel__head {
  padding: 8px 12px 6px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.chat-page .cai-model-option .model-picker__opt-name small {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 400;
}
.cai-model-option__name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}
.cai-model-option__name > span:last-child {
  min-width: 0;
}
.cai-model-option__region {
  color: var(--muted);
  font-size: 12px;
}
.cai-model-panel__foot {
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.cai-provider-mark {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.cai-provider-mark img,
.cai-model-chip img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
}
.cai-provider-fallback {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 10px var(--display);
}
.cai-model-name {
  display: inline-flex !important;
  min-width: 0;
  align-items: center;
  gap: 8px;
}
.cai-model-detail-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cai-model-detail-title .cai-provider-mark,
.cai-model-detail-title .cai-provider-mark img {
  width: 25px;
  height: 25px;
  flex-basis: 25px;
}
.cai-model-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cai-model-chip img {
  width: 13px;
  height: 13px;
}
.cai .choice .cai-model-name {
  display: flex !important;
}
@media (max-width: 600px) {
  .chat-page.is-empty-chat
    .chat-composer__runtime
    #modelPicker
    .cai-model-panel {
    left: 0;
    width: calc(100vw - 32px);
    min-width: 0;
    max-width: calc(100vw - 32px);
    max-height: min(48dvh, 400px) !important;
  }
  .cai-model-panel__head {
    display: none;
  }
  .chat-page .cai-model-option {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px 8px;
    padding: 9px 10px;
  }
  .cai-model-option__name {
    grid-column: 1 / 4;
  }
  .cai-model-option__name + span {
    grid-column: 1;
  }
  .cai-model-option__level {
    grid-column: 2;
  }
  .cai-model-option__region {
    grid-column: 3;
  }
}
.chat-character-count.is-over {
  color: var(--red);
  font-weight: 700;
}
.tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgb(22 31 52 / 6%);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 700;
}
.tag--low {
  background: var(--green-soft);
  color: var(--green);
}
.tag--mid {
  background: var(--amber-soft);
  color: var(--amber);
}
.tag--high {
  background: var(--red-soft);
  color: var(--red);
}

/* ---------- Login ---------- */
.auth {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, #fff 0, transparent 60%), var(--paper);
}
.auth__nav {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 70%);
}
.auth-brand__link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}
.auth__nav img {
  height: 48px;
}
.auth__nav span {
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.auth__main {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 28px;
  padding: 48px 16px;
}
.auth__intro {
  max-width: 520px;
  text-align: center;
}
.auth__intro h1 {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.045em;
}
.auth__intro p {
  margin-top: 10px;
  color: var(--muted);
}
.auth__card {
  width: min(460px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: #fff;
  box-shadow: var(--shadow);
}
.auth__card h2 {
  font-size: 20px;
}
.auth__card > p {
  margin: 4px 0 20px;
  color: var(--muted);
  font-size: 13px;
}
.auth__foot {
  padding: 20px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

/* ---------- Role matrix ---------- */
.no {
  color: var(--faint);
}

.split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.c-mt-8 {
  margin-top: 8px;
}
.c-mt-16 {
  margin-top: 16px;
}
.c-mb-16 {
  margin-bottom: 16px;
}
.small {
  font-size: 13px;
}
.strong {
  font-weight: 700;
}

/* ---------- VOROS shell integration ---------- */
/* CAI-221 A3: tenant logos mostly sit on light backgrounds, so the rail is white (no dark rail). */
body.cai {
  --app-sidebar-bg: #fff;
  --app-sidebar-panel-bg: #fff;
  --app-sidebar-border: var(--line);
  --app-sidebar-muted-border: rgb(22 31 52 / 7%);
  --app-sidebar-fg: var(--ink);
  --app-sidebar-muted: var(--ink-2);
  --app-sidebar-faint: var(--muted);
  --app-sidebar-hover: rgb(22 31 52 / 5%);
  --app-sidebar-active: var(--accent-soft);
  --app-sidebar-accent: var(--accent);
  --app-sidebar-focus: var(--accent);
  --app-sidebar-danger: var(--red);
}
/* Hard-coded light-on-navy values of the VOROS rail, re-inked for the white rail. */
.cai #primary-aside .sidebar-link {
  color: var(--ink-2);
}
.cai #primary-aside .sidebar-link[data-sidebar-item="new-chat"] {
  background: var(--accent-soft);
  color: var(--ink);
}
.cai #primary-aside .sidebar-shell__scroll,
.cai #primary-aside .sidebar-list--threads {
  scrollbar-color: rgb(22 31 52 / 22%) transparent;
}
/* The rail is pinned in every context (main.html): no collapse control on desktop,
   and the chat history stays scrollable. */
.cai #primary-aside .sidebar-shell__scroll {
  overflow-y: auto;
}
.cai .sidebar-brand__meta {
  display: inline-flex;
  align-items: center;
  padding: 6px 0;
  background: transparent;
}
.cai #primary-aside .cai-sidebar-extras {
  display: block;
  min-width: 0;
  width: 100%;
  margin: 0 0 8px;
  overflow: visible;
}
.cai #primary-aside .budget-mini {
  min-width: 0;
  max-width: 100%;
}
/* The VOROS rail caps .nav-label at 12.5rem; the budget spans the full footer like the nav rows. */
.cai #primary-aside .cai-sidebar-extras.nav-label {
  max-width: none;
}
.cai #primary-aside .sidebar-link:not(.is-collapsed) {
  min-width: 0;
}
.cai-main {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
}
.cai-main h1,
.cai-main h2,
.cai-main h3 {
  font-family: var(--display);
}
.cai .admin-page-stack--details > *,
.cai .admin-details-form-region {
  min-width: 0;
  width: 100%;
}
.cai .rui-data-table .rui-th:last-child:not(.rui-th--actions),
.cai .rui-data-table .rui-td:last-child:not(.rui-td--actions) {
  position: static;
}

/* Let the search and filters use the available admin toolbar width. */
@media (max-width: 600px) {
  body.chat-theme .cai-main {
    height: calc(100dvh - 48px);
    min-height: 0;
  }
  body.chat-theme .cai-main #chat-app {
    height: calc(100dvh - 48px) !important;
  }
  body.chat-theme #chat-app #chatMessages {
    padding-bottom: 160px !important;
  }
  .chat-page .chat-composer__leading {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  .chat-page .chat-composer__runtime {
    min-width: 0;
  }
  .chat-page .chat-disclaimer > span:first-child {
    display: none;
  }
}
.cai .rui-data-table .rui-primary-link {
  color: var(--ink);
  font-weight: 700;
}
.cai .rui-data-table .rui-th {
  color: var(--muted);
}
/* COSBOO shows model + credits per answer permanently (VOROS reveals actions on hover). */
.chat-page .chat-msg-actions:has(.cai-answer-meta) {
  opacity: 1 !important;
  visibility: visible !important;
}
.admin-index-header__create :is(svg, .asset-icon) {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.cai .rui-form-control > input:not(.rui-input):not(.rui-checkbox),
.cai .rui-form-control > select:not(.rui-select) {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: 14px var(--body);
}
.cai .rui-form-control > input:not(.rui-input):not(.rui-checkbox):focus-visible,
.cai .rui-form-control > select:not(.rui-select):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.cai .rui-form-control > input:not(.rui-input):not(.rui-checkbox):disabled,
.cai .rui-form-control > select:not(.rui-select):disabled {
  background: var(--surface);
  color: var(--muted);
}
.cai-toolbar-link {
  align-self: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.cai-cell-sub {
  color: var(--muted);
  font-size: 12.5px;
}
.cai-mobile-status {
  display: none;
}
@media (max-width: 720px) {
  .cai-mobile-status {
    display: inline-flex;
    margin-top: 5px;
  }
}
.cai-row-action {
  padding: 4px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.cai-form-section h2 {
  font-size: 15px;
}
.cai-form-section p {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

/* Group details: member excerpt, highest usage first */
.cai-member-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) 120px;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.c-card__head + .cai-member-row {
  border-top: 0;
}
.cai-member-row__name {
  display: grid;
  min-width: 0;
}
.cai-member-row__name a {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cai-member-row__name a:hover {
  color: var(--accent);
}
.cai-member-row__name small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cai-member-row > .c-badge {
  justify-self: start;
}
.cai-member-row__credits {
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.cai-members__foot {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}
@media (max-width: 640px) {
  .cai-member-row {
    grid-template-columns: auto minmax(0, 1fr) 100px;
  }
  .cai-member-row > .c-badge {
    grid-column: 2;
    grid-row: 2;
  }
  .cai-member-row__credits {
    grid-row: 1 / span 2;
    grid-column: 3;
  }
}

/* Sortable table header (th[data-sort] › button, cosboo-app.js) */
/* Review 09/2026: no white band around the rui save/cancel buttons. */
.cai .rui-form-actions {
  position: static;
  border-top: 0;
  background: transparent;
  box-shadow: none;
}

/* ---------- Nutzung & Budget ---------- */
.cai-dashboard .kpi {
  align-content: start;
}
/* Both group panels share one row height */
.cai-dashboard .c-grid--main-side {
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  align-items: stretch;
}
.cai-dashboard .c-grid--main-side > .c-card {
  display: flex;
  flex-direction: column;
}
.cai-dashboard .c-grid--main-side > .c-card > .c-card__body {
  flex: 1 1 auto;
}
.admin-index-header__aside {
  grid-area: create;
  justify-self: end;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(22 31 52 / 4%);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

/* Usage tile: allocated vs. unallocated budget */
.kpi__split {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.kpi__split b {
  display: block;
  font: 700 15px var(--display);
}
.kpi__split span {
  color: var(--muted);
}

/* Group budget rows: "used / budget" under the bar */
.c-budget-row__caption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11.5px;
}
.c-budget-row__caption b {
  color: var(--ink);
  font-size: 12px;
}

/* Usage by group: total, stacked bar, one row per group */
.cai-usage-total {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}
.cai-usage-total small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.cai-usage-total b {
  font: 700 25px / 1.2 var(--display);
  letter-spacing: -0.02em;
}
.cai-usage-total__share {
  text-align: right;
}
.cai-usage-total__share b {
  font-size: 19px;
}
.cai-usage-stack {
  display: block;
  width: 100%;
  height: 13px;
  border-radius: 999px;
  background: #e3e5ea;
}
.cai-usage-stack rect {
  fill: var(--usage-color);
  stroke: var(--card);
  stroke-width: 2px;
  vector-effect: non-scaling-stroke;
}
.cai-usage-row {
  margin-top: 18px;
}
.cai-usage-row__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}
.cai-usage-row__top small {
  display: inline-block;
  min-width: 56px;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.cai-usage-row__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.cai-usage-row__name i {
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--usage-color);
}
.cai-usage-row meter.meter--series {
  --meter-fill: var(--usage-color);
  height: 6px;
}
.cai-usage-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 11.5px;
}

/* Model metric tabs: radio buttons; the checked one shows its list (no reload, no JS) */
.cai-tabs {
  position: relative;
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  border-radius: 10px;
  background: rgb(22 31 52 / 5%);
}
.cai-tabs__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.cai-tabs__tab {
  cursor: pointer;
  padding: 7px 11px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.cai-tabs__tab:hover {
  color: var(--ink);
}
.cai-tabs__input:focus-visible + .cai-tabs__tab {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.cai-tabs__input:checked + .cai-tabs__tab {
  background: #fff;
  box-shadow: 0 1px 4px rgb(18 32 59 / 11%);
  color: var(--navy);
}

.cai-model-list {
  display: none;
}
.cai-models-card:has(#model-metric-credits:checked) .cai-model-list--credits,
.cai-models-card:has(#model-metric-requests:checked) .cai-model-list--requests,
.cai-models-card:has(#model-metric-average:checked) .cai-model-list--average {
  display: block;
}

/* Model rows: value per metric, bar, requests / average */
.cai-model-row {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.cai-model-row:first-child {
  border-top: 0;
  padding-top: 4px;
}
.cai-model-row__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.cai-model-row__value {
  font: 700 15px var(--display);
  white-space: nowrap;
}
.cai-model-row__detail {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.cai-models-card .notice {
  margin-top: 16px;
}

/* Too narrow for a balanced pair: stack the tiles instead of leaving holes. */
@media (max-width: 1279px) {
  .cai-dashboard .c-grid--main-side {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 720px) {
  .cai-tabs {
    max-width: 100%;
    overflow-x: auto;
  }
  .admin-index-header__aside {
    justify-self: start;
  }
}
/* Mobile/tablet: the rail is an off-canvas drawer, so the top bar spans the full width
   and carries the tenant logo (VOROS reserved room for a collapsed rail here). */
@media (max-width: 1023.98px) {
  html body.cai.with-sidebar > header.workspace-mobile-bar {
    margin-left: 0 !important;
    width: 100%;
  }
}
.cai .workspace-mobile-bar__brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.cai .sidebar-brand__logo {
  max-width: 100%;
  max-height: 40px;
  object-fit: contain;
}
.cai .workspace-mobile-bar__brand img.workspace-mobile-bar__logo {
  width: auto;
  height: 26px;
  max-width: 150px;
  object-fit: contain;
}
/*
 * New chat: greeting + composer sit in the optical centre of the stage (VOROS used a fixed 144px
 * top offset).
 */
.chat-page.is-empty-chat #chatStage {
  justify-content: center;
}
.chat-page.is-empty-chat .chat-composer-zone {
  margin-top: 0 !important;
  padding-top: 0 !important;
  margin-bottom: 8vh;
}

/* ---------- Iteration 2 ---------- */
.chat-page .cai-model-option[aria-pressed="true"] {
  background: rgb(22 31 52 / 6%);
  box-shadow: none;
}
.chat-page .cai-model-option[aria-pressed="true"] .model-picker__opt-name {
  color: inherit;
}

/* Toolbar dropdowns: room around the chevron */

html body.cai .form-grid {
  grid-template-columns: minmax(0, 1fr);
}

/* All selects: chevron with breathing room */
html body.cai .rui-form-control > select:not(.rui-select),
html body.cai select.c-input,
html body.cai .select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%235b6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 14px;
}

/* Every native dropdown gets the same chevron spacing */
html body select:not([multiple]):not([size]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none' stroke='%235b6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 14px;
}
html body .select > select {
  background-image: none;
}

/*
 * Detail/form pages: one left edge (title, subtitle, fields), readable max width, back button
 * hangs outside
 */
html body.cai .admin-detail-header {
  display: block;
  position: relative;
}
html body.cai .admin-detail-header__back {
  margin-bottom: 12px;
}
@media (min-width: 1100px) {
  html body.cai .admin-detail-header__back {
    position: absolute;
    left: -52px;
    top: 2px;
    margin: 0;
  }
}
html body.cai .admin-detail-header,
html body.cai .rui-edit-form {
  max-width: 760px;
  margin-left: 0;
  margin-right: auto;
}

/* User creation and editing share the single-column account form. */
html body.cai.user-detail-page .admin-page-stack--details {
  max-width: 812px;
  gap: 24px;
}
.user-detail-page .admin-detail-header {
  padding-bottom: 0;
}
.user-detail-page .admin-edit-form .rui-form-fields > * + * {
  border-top: 0;
}
.user-detail-page .admin-edit-form .rui-form-field {
  display: block;
  padding: 0 0 20px;
}
.user-detail-page .admin-edit-form .rui-form-label {
  display: block;
  padding: 0;
}
.user-detail-page .admin-edit-form .rui-form-control {
  max-width: none;
  margin-top: 8px;
}
.user-detail-page .admin-edit-form :is(.rui-input, .rui-select) {
  min-height: 42px;
  border-radius: 8px;
  background-color: var(--card);
}
.user-detail-page .admin-edit-form .rui-form-hint {
  margin-top: 8px;
}
html body.cai.user-detail-page .rui-form-actions {
  justify-content: flex-end;
  margin-top: 12px;
  padding: 8px 0 0;
}
.user-detail-page .rui-form-save {
  min-height: 44px;
  border-radius: 6px;
  background: var(--ink);
}
.user-detail-page .rui-form-save:hover:not(:disabled) {
  background: var(--navy-2);
}
.user-account-actions {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}
.user-account-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.user-account-action__copy {
  min-width: 0;
}
.user-account-action__copy h2 {
  margin: 0 0 2px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}
.user-account-action__copy p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}
.user-account-action__button {
  flex-shrink: 0;
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.user-account-action__button--danger {
  color: var(--red);
}
.user-account-action__button:hover {
  text-decoration: underline;
}
.user-account-action__button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}
@media (max-width: 639px) {
  .user-account-action {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }
  .user-account-action__button {
    align-self: flex-end;
  }
}

.chat-request-error {
  padding: 1rem;
  border: 1px solid
    color-mix(in oklab, var(--chat-danger) 22%, var(--chat-line));
  border-radius: 0.625rem;
  background: var(--chat-panel);
  font-size: 0.875rem;
  line-height: 1.5;
}
.chat-request-error [data-error-text] {
  margin: 0;
  color: var(--chat-danger);
  font-weight: 600;
}
.chat-request-error button {
  margin-top: 0.75rem;
}
.chat-composer-shell > #chat-error {
  padding-inline: 0;
}

/* Core workspace integration */
/* Core integration only; all visual components use the original clickdummy CSS. */
#workspace {
  display: contents;
}
.management-fields {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.account-menu {
  position: relative;
}
.account-link {
  list-style: none;
  cursor: pointer;
}
.account-link::-webkit-details-marker {
  display: none;
}
#primary-aside .account-menu:not([open]) .sidebar-account-menu {
  display: none;
}
#primary-aside .account-menu[open] .sidebar-account__chevron {
  transform: rotate(180deg);
}
#notification {
  display: none;
}
#notification.visible {
  display: block;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  padding: 13px 16px;
  border-radius: var(--r);
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow-lg);
}
@media (max-width: 1023.98px) {
  html:not([data-sidebar-state="expanded"]) #primary-aside {
    pointer-events: none;
  }
  html[data-sidebar-state="expanded"] body.menu-open #primary-aside {
    pointer-events: auto;
  }
  body:not(.menu-open) #primary-aside.sidebar-shell {
    transform: translateX(-105%);
  }
  body.menu-open #primary-aside.sidebar-shell {
    transform: translateX(0);
  }
}

#primary-aside .sidebar-account__chevron :is(svg, .asset-icon) {
  width: 1em;
  height: 1em;
}

/* Reserve the original hanging back-button gutter in the live detail frame. */
@media (min-width: 1100px) {
  .admin-page-stack--details {
    padding-left: 52px;
  }
}

/* Empty lists: one card in place of the table, no pagination. */
.rui-table-empty {
  display: grid;
  place-items: center;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}
.rui-table-page .rui-table-empty {
  flex: 0 0 auto;
  min-height: 240px;
}

/* Shared outline icons retain their size without inline style attributes. */
.core-sidebar-icon {
  width: 1em;
  height: 1em;
}

body.rui-table-page .app-shell-main,
.rui-table-page #pageRoot,
.rui-table-page .rui-admin,
.rui-table-page .rui-admin-content,
.rui-table-page .admin-page-stack--index,
.rui-table-page .admin-crud-stack--index,
.rui-table-page .rui-table {
  min-width: 0;
}
.rui-table-page .admin-crud-stack--index {
  gap: 0.75rem;
}
.rui-table-page .rui-table-overflow {
  margin: 0;
  overflow-x: auto;
}
.rui-table-page .rui-table-inner {
  display: block;
  padding-block: 0;
}
.rui-table-page .rui-table-box {
  overflow: visible;
}
.rui-table-page .rui-table-footer {
  margin-top: 0;
  padding-top: 0.75rem;
}

/* RUI index header: back, title and create share one 36px row; the subtitle sits below. */
.rui-table-page .admin-index-header {
  align-items: start;
  column-gap: 14px;
  padding-bottom: 4px;
  border-bottom: 0;
}
.rui-table-page .admin-index-header__title {
  font: 700 24px/36px var(--display);
  letter-spacing: -0.02em;
  color: var(--ink);
}
.rui-table-page .admin-index-header__subtitle {
  max-width: 72ch;
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--muted);
}
.rui-table-page .admin-index-header__create {
  min-height: 36px;
  padding-inline: 14px;
}

/* Filter bar: search grows, selects submit on change, page links sit at the end. */
.rui-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.rui-filterbar__search {
  position: relative;
  flex: 1 1 280px;
  min-width: 0;
}
.rui-filterbar__search > .asset-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}
.rui-table-page .rui-filterbar .rui-input {
  width: 100%;
  min-height: 44px;
  padding-left: 40px;
  border-color: var(--line-strong);
  background: var(--card);
  font-size: 14.5px;
}
.rui-filterbar__select {
  flex: 0 1 180px;
  min-width: 140px;
}
.rui-table-page .rui-filterbar .rui-select {
  width: 100%;
  min-height: 44px;
  background-color: var(--card);
  font-size: 14.5px;
}
.rui-filterbar__reset {
  padding-inline: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.rui-filterbar__reset:hover {
  color: var(--ink);
}
.rui-filterbar .cai-toolbar-link {
  padding-inline: 6px;
  white-space: nowrap;
}
@media (max-width: 767px) {
  .rui-filterbar__search {
    flex-basis: 100%;
  }
  .rui-filterbar__select {
    flex: 1 1 140px;
  }
}

.rui-table-page .rui-data-table .mobile,
.rui-table-page .rui-data-table .cai-mobile-status {
  display: none;
}

/* Long account names must not pin a column wider than the mobile viewport. */
@media (max-width: 639px) {
  .rui-table-page .rui-data-table :is(th, td):first-child {
    position: static;
    box-shadow: none;
  }
}


/* Core account forms */

:where(.auth) button {
  cursor: pointer;
}
:where(.auth) button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
:where(.auth) a {
  text-decoration: none;
}
:where(.auth) a:hover {
  text-decoration: underline;
}
:where(.auth) button,
:where(.auth) input,
:where(.auth) textarea,
:where(.auth) select {
  font: inherit;
}
:where(.auth) button {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--card);
  padding: 9px 14px;
  font-weight: 700;
}
:where(.auth) button:hover {
  border-color: var(--navy-2);
}
:where(.auth) input,
:where(.auth) textarea,
:where(.auth) select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--card);
  padding: 11px 13px;
}
:where(.auth) label {
  display: block;
  margin: 16px 0;
  font-size: 13px;
  font-weight: 700;
}
:where(.auth) label input,
:where(.auth) label select {
  display: block;
  margin-top: 6px;
  font-weight: 400;
}
:where(.auth) label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 10px;
}
:where(.auth) input[type="checkbox"] {
  width: 18px;
  margin: 0;
}
:where(.auth) p {
  line-height: 1.55;
}
:where(.auth) h1 {
  font-size: 30px;
}
:where(.auth) h2 {
  font-size: 20px;
}
:where(.auth) .eyebrow {
  font: 700 11px var(--body);
  letter-spacing: 0.14em;
  color: var(--muted);
}
:where(.auth) .error {
  color: var(--red);
  white-space: pre-line;
  font-size: 13px;
}
:where(.auth) .skip {
  position: fixed;
  top: -80px;
  left: 12px;
  z-index: 100;
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--r-sm);
}
:where(.auth) .skip:focus {
  top: 12px;
}
:where(.auth) .auth-card h2 {
  margin: 0;
}
:where(.auth) .auth-card form > p {
  margin: 4px 0 20px;
  color: var(--muted);
  font-size: 13px;
}
:where(.auth) .auth-card button {
  width: 100%;
  min-height: 48px;
  margin: 4px 0 12px;
}
:where(.auth) .auth-card a {
  display: block;
  text-align: center;
  color: var(--accent);
  font-size: 13px;
}
:where(.auth) .auth-card label {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
:where(.auth) .auth-card form {
  display: grid;
  gap: 16px;
}
:where(.auth) .auth-card form > p {
  margin: -12px 0 4px;
}
:where(.auth) .auth-card input {
  min-height: 44px;
  font-size: 14px;
  padding: 10px 12px;
}
:where(.auth) .auth-card button {
  margin: 4px 0 0;
}
:where(.auth) .auth-card a {
  font-weight: 700;
}
:where(.auth) .auth-card fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
  display: grid;
  gap: 16px;
}
:where(.auth) .auth-card legend {
  padding: 0;
  margin-bottom: 16px;
  font-size: 22px;
  font-weight: 700;
}
:where(.auth) .auth-card .labeled,
:where(.auth) .auth-card #hideWhenMfa {
  display: grid;
  gap: 8px;
}
:where(.auth) .auth-card #hideWhenMfa {
  gap: 16px;
}
:where(.auth) .auth-card .input-row input {
  width: 100%;
}
:where(.auth) .auth-card .btn-primary {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: #273352;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
:where(.auth) .auth-card .warning {
  color: #b42318;
}
:where(.auth) .auth-card #pinInput:empty,
:where(.auth) .auth-card #error:empty {
  display: none;
}

/* The prompt form spans the full content width, like the notices above it. */
.rui-admin-content .rui-edit-form:has(.cai-prompt-input) {
  max-width: none;
}
.cai-prompt-field {
  display: grid;
  gap: 10px;
  padding-top: 8px;
}
.cai-prompt-input {
  min-height: 24rem;
  padding: 16px 18px;
  font-size: 15px;
  line-height: 1.65;
  resize: vertical;
}
.cai-prompt-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.cai-prompt-meta .rui-form-hint {
  margin: 0;
}
.cai-prompt-count {
  flex: none;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.cai-prompt-count.is-full {
  color: var(--red);
}
