/* Agent-panel visual overrides. Load after agents.css.
 * Source: work/reference-agents/main.40913837.chunk.css, specifically
 * .sidebar, .list-item, .subheader, .input, .button, .users-filter-block-desktop,
 * .tabs, .users-table and .create-agent. The source scales desktop rem units
 * at each viewport breakpoint; using fixed pixel text missed that behavior.
 * Existing semantic HTML and control behavior remain unchanged.
 */
:root {
  --sidebar: #320548;
  --panel: #320548;
  --bg: #130227;
  --line: #682984;
  --muted: #9583a0;
  --agent-rail-width: 216px;
  font-size: 16px;
}
@media (min-width: 1921px) and (max-width: 2300px) { :root { font-size: 17px; } }
@media (min-width: 2301px) and (max-width: 2600px) { :root { font-size: 18px; } }
@media (max-width: 1750px) { :root { font-size: 15px; } }
@media (max-width: 1600px) { :root { font-size: 14px; } }
@media (max-width: 1500px) { :root { font-size: 13px; } }
@media (max-width: 1400px) { :root { font-size: 12px; } }
@media (max-width: 1300px) { :root { font-size: 11px; } }
@media (max-width: 1200px) { :root { font-size: 10px; } }

body { font-family: Roboto, Arial, sans-serif; }
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid #ffffff4d;
  padding: 1.25rem;
  overflow: hidden;
}
.brand { min-height: 0; margin-bottom: .625rem; }
.brand img { width: 12.5625rem; }
.brand small { font-size: .625rem; letter-spacing: .08em; }
.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: .625rem;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #8b00c9 transparent;
  overscroll-behavior: contain;
}
.sidebar nav::-webkit-scrollbar { width: 4px; }
.sidebar nav::-webkit-scrollbar-thumb { background: #8b00c9; border-radius: 4px; }
.sidebar .nav-link {
  min-height: 2.5rem;
  padding: .625rem;
  border: 0;
  border-radius: .625rem;
  background: transparent;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.2;
  gap: .625rem;
  transition: background-color .15s ease, color .15s ease;
}
.sidebar .nav-link:hover { background: #68298470; }
.sidebar .nav-link.active {
  color: #fff;
  background: #8b00c9;
  padding-left: .625rem;
  box-shadow: 0 .3125rem .9375rem #8b00c980;
}
.sidebar .nav-link svg { width: 1.5rem; height: 1.5rem; }
.agent-nav-group { border: 0; padding: 0; }
.agent-nav-group summary {
  color: #fff;
  min-height: 2.5rem;
  padding: .625rem;
  gap: .625rem;
  align-items: center;
  border-radius: .625rem;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.2;
}
.agent-nav-group summary::-webkit-details-marker { display: none; }
.agent-nav-group summary:hover { background: #68298470; }
.agent-nav-group summary::after { font-size: 1.25rem; line-height: 1; }
.agent-nav-group .nav-link { color: #ffffff66; padding-left: 1.25rem; }
.agent-nav-group .nav-link.active { padding-left: 1.25rem; }
.side-bottom { flex: 0 0 auto; padding-top: .625rem; }
.side-bottom .nav-link { margin-top: .3125rem; }
.nav-label { font-size: .625rem; }
.topbar { border-bottom-color: #ffffff4d; }
.account .avatar { background: transparent; }
.account > div:not(.avatar) {
  padding: .3125rem .625rem;
  border-radius: .625rem;
  background: #130227;
}
.account strong { font-size: 1rem; }
.account small { font-size: .75rem; }
.account .role-name { font-size: .75rem; }
.main { padding: 1.25rem; }
.workspace-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  align-items: start;
}
.workspace-content > .main { width: 100%; min-width: 0; }
.agent-directory {
  position: sticky;
  top: 5rem;
  margin: 1.25rem 1.25rem 1.25rem 0;
  min-width: 0;
  max-height: calc(100dvh - 6.25rem);
  overflow: auto;
  padding: .9375rem;
  background: #320548;
  border-radius: .625rem;
  scrollbar-width: thin;
  scrollbar-color: #8b00c9 transparent;
}
.agent-directory > summary, .agent-directory-title {
  list-style: none;
  padding: .3125rem 0 .625rem .625rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.1875;
  font-weight: 700;
  text-transform: uppercase;
}
.agent-directory > summary { cursor: pointer; }
.agent-directory > summary::-webkit-details-marker { display: none; }
.agent-directory > summary::after { content: '⌄'; float: right; }
.agent-directory:not([open]) > summary::after { content: '›'; }
.agent-directory label { display: block; font-size: .75rem; font-weight: 600; margin: .5rem 0 .75rem; }
.agent-directory input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 2.5rem;
  margin-top: .125rem;
  padding: .5rem .625rem;
  font-size: .875rem;
  color: #fff;
  border: 1px solid #682984;
  border-radius: .625rem;
  background: #130227;
}
.agent-directory-tree, .agent-directory-tree ul { list-style: none; padding: 0; margin: 0; }
.agent-directory-tree ul { margin-left: .625rem; padding-left: .625rem; border-left: 1px solid #682984; }
.agent-directory-tree li { min-width: 0; margin: .125rem 0; }
.agent-directory-tree button, .agent-directory button[data-agent-id],
.agent-directory-tree a {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  min-height: 2.5rem;
  min-width: 0;
  padding: .3125rem .625rem;
  border: 0;
  border-radius: .625rem;
  background: #130227;
  color: #fff;
  font: 700 .875rem Roboto, Arial, sans-serif;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-directory-tree button > span { overflow: hidden; text-overflow: ellipsis; }
.agent-directory-tree button:hover, .agent-directory-tree a:hover,
.agent-directory-tree .active, .agent-directory button[data-agent-id]:hover { background: #8b00c9; }
.agent-directory .empty { padding: .75rem 0; font-size: .75rem; }
.page-title { margin-bottom: 1.25rem; }
.page-title h1 { font-size: 1.875rem; font-weight: 500; line-height: 1.2; }
.page-title p { font-size: .875rem; }
.page-title .eyebrow { font-size: .625rem; }
.btn {
  min-height: 2.5rem;
  border-radius: .625rem;
  font-size: .875rem;
  padding: .5rem .75rem;
  font-weight: 700;
  line-height: 1.2;
}
.btn.primary { box-shadow: 0 .3125rem .9375rem #8b00c980; }
.btn.small { min-height: 1.875rem; font-size: .75rem; padding: .3125rem .5rem; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:disabled { cursor: not-allowed; }
.filter-bar { gap: .625rem; margin-bottom: 1.25rem; align-items: flex-end; }
.filter-bar label { font-size: .75rem; font-weight: 500; }
.filter-bar input, .filter-bar select,
.reference-user-filters input, .user-page-size select {
  min-width: 0;
  min-height: 2.5rem;
  height: 2.5rem;
  background: #130227;
  border: 1px solid #682984;
  border-radius: .625rem;
  padding: .5rem .625rem;
  font-size: .875rem;
  font-weight: 400;
}
.reference-user-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 15rem)) max-content max-content max-content;
  gap: .625rem;
  align-items: start;
  margin: 1.25rem 0 .625rem;
}
.reference-user-filters label { min-width: 0; gap: .125rem; font-size: .75rem; font-weight: 500; }
.reference-user-filters input { width: 100%; }
.reference-user-filters small {
  font-size: .75rem;
  font-weight: 600;
  color: #76657e;
  text-align: center;
  line-height: 1.25;
}
.reference-user-filters .direct-filter {
  padding: 0 .625rem;
  height: 2.5rem;
  margin-top: 1rem;
  gap: .563rem;
  white-space: nowrap;
}
.reference-user-filters .direct-filter input { width: 1.125rem; height: 1.125rem; min-height: 0; padding: 0; }
.reference-user-filters > .btn { margin-top: 1rem; }
.user-table-controls { display: flex; justify-content: space-between; align-items: center; gap: .625rem; }
.user-tabs {
  flex: 1 1 auto;
  display: flex;
  width: auto;
  min-width: 0;
  margin: .625rem 0 0;
  gap: 0;
  border: 0;
  overflow-x: auto;
  scrollbar-width: thin;
  overscroll-behavior-x: contain;
}
.user-tab {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 2.5rem 0 1.875rem;
  min-height: 3.75rem;
  border: 0;
  border-radius: 1.25rem 1.25rem 0 0;
  color: #fff;
  background: transparent;
  font-size: .875rem;
  font-weight: 700;
}
.user-tab.active { background: #320548; }
.user-page-size { margin: .625rem 0; font-size: .875rem; font-weight: 700; white-space: nowrap; }
.user-page-size select { width: 5.3125rem; margin-left: .625rem; }
.panel { border-radius: .625rem; }
.user-table-controls + .panel { border-top-left-radius: 0; }
.table-wrap { padding: .625rem 1.25rem; max-width: 100%; overscroll-behavior-x: contain; }
table { border-spacing: 0 .3125rem; font-size: .875rem; }
th { font-size: .875rem; font-weight: 700; padding: .625rem; }
td { padding: .625rem; }
td:first-child { border-radius: .625rem 0 0 .625rem; }
td:last-child { border-radius: 0 .625rem .625rem 0; }
td small { font-size: .75rem; }
.badge { font-size: .625rem; }
.table-bottom { padding: .9375rem 1.25rem; font-size: .875rem; }
.row-actions { gap: .3125rem; }
.table-wrap .empty { padding: 1.25rem; color: #ffffff66; font-size: .875rem; font-weight: 700; }
.field { gap: .125rem; margin: .9375rem 0; min-width: 0; }
.field label, .settings-fields > label { font-size: .75rem; font-weight: 500; }
.field input, .field select, .field textarea, .settings-fields > label > input {
  min-height: 2.5rem;
  padding: .625rem 1rem;
  border-radius: .625rem;
  font-size: .875rem;
  font-weight: 400;
  line-height: 1.3;
}
.field textarea { resize: vertical; min-height: 6.25rem; }
.field small { font-size: .75rem; }
.form-grid { gap: .9375rem 1.875rem; }
.form-grid .field { margin: 0; }
.form-actions { margin-top: 1.875rem; }
dialog { border-radius: 1.25rem; max-height: calc(100dvh - 2rem); overscroll-behavior: contain; }
dialog h2 { font-size: 1.875rem; font-weight: 500; }
dialog > p { font-size: .875rem; }
.user-permissions { padding: .9375rem; border-radius: .625rem; }
.user-permissions label { font-size: .875rem; gap: .625rem; }
.user-permissions input { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.metric, .panel-head, .panel-body { border-radius: .625rem; }
.metric-top, .panel-head h2 { font-size: .875rem; }
.metric-value { font-size: 1.875rem; }
.summary-row, .activity-row p { font-size: .875rem; }
.metric small, .panel-head small, .activity-row small { font-size: .75rem; }

/* The reference desktop filter has a compact six-column layout. Reflow it
 * before long translated labels collide, without scrolling the entire page. */
@media (min-width: 801px) and (max-width: 1050px) {
  .reference-user-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reference-user-filters .direct-filter,
  .reference-user-filters > .btn { margin-top: 0; }
  .user-table-controls { align-items: flex-end; flex-wrap: wrap; }
}

/* Mobile uses the established drawer and native inputs. Keep touch targets
 * and input text readable instead of inheriting the desktop 10px root. */
@media (max-width: 800px) {
  :root { font-size: 16px; }
  .sidebar { width: min(300px, calc(100vw - 44px)); max-height: 100dvh; padding: 18px 14px; }
  .brand { margin: 12px 0 24px; }
  .brand img { width: 206px; }
  .sidebar .nav-link, .agent-nav-group summary { min-height: 44px; padding: 10px; font-size: 14px; }
  .agent-nav-group .nav-link, .agent-nav-group .nav-link.active { padding-left: 24px; }
  .sidebar nav { gap: 5px; }
  .side-bottom { padding-top: 10px; }
  .main { padding: 18px 12px; }
  .workspace-content { display: flex; flex-direction: column; }
  .workspace-content > .main { order: 1; }
  .agent-directory {
    order: 0;
    position: static;
    width: calc(100% - 24px);
    margin: 12px 12px 0;
    padding: 12px;
    max-height: 45dvh;
  }
  .agent-directory > summary, .agent-directory-title { font-size: 14px; min-height: 32px; padding: 6px; }
  .agent-directory label { font-size: 12px; }
  .agent-directory input { min-height: 44px; font-size: 16px; }
  .agent-directory-tree button, .agent-directory-tree a,
  .agent-directory button[data-agent-id] { min-height: 42px; font-size: 13px; }
  .agent-directory .empty { font-size: 12px; }
  .page-title h1 { font-size: 24px; }
  .page-title p { font-size: 12px; }
  .page-title .eyebrow { font-size: 10px; }
  .account { gap: 5px; }
  .account strong { font-size: 12px; }
  .account small, .account .role-name { font-size: 9px; }
  .account > div:not(.avatar) { padding: 4px 6px; }
  .btn { min-height: 42px; font-size: 13px; padding: 9px 12px; }
  .btn.small { min-height: 36px; font-size: 12px; padding: 7px 9px; }
  .reference-user-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 18px 0 12px; gap: 12px; }
  .reference-user-filters label:first-child { grid-column: 1 / -1; }
  .reference-user-filters label, .filter-bar label { font-size: 12px; }
  .reference-user-filters small { font-size: 11px; }
  .reference-user-filters .direct-filter { grid-column: 1 / -1; height: 36px; margin: 0; padding: 0; }
  .reference-user-filters .direct-filter input { width: 18px; height: 18px; }
  .reference-user-filters > .btn { margin-top: 0; white-space: normal; }
  .filter-bar input, .filter-bar select, .reference-user-filters input,
  .user-page-size select { height: 42px; min-height: 42px; }
  .user-table-controls { align-items: stretch; flex-direction: column; gap: 0; }
  .user-table-controls .user-page-size { order: -1; }
  .user-tabs { margin: 10px 0 0; width: 100%; }
  .user-tab { min-height: 48px; padding: 0 16px; font-size: 13px; border-radius: 14px 14px 0 0; }
  .user-page-size { font-size: 12px; margin: 8px 0; }
  .user-page-size select { width: 80px; }
  .panel, .table-wrap, .workspace { min-width: 0; }
  .table-wrap { padding: 8px; }
  table { font-size: 12px; }
  th { font-size: 11px; padding: 10px; }
  td { padding: 10px; }
  td small { font-size: 10px; }
  .table-bottom { font-size: 12px; padding: 12px; }
  .table-wrap .empty { font-size: 12px; }
  .row-actions { max-width: 310px; }
  .badge { font-size: 10px; }
  .form-grid { gap: 12px; }
  .field { margin: 12px 0; }
  .field label, .settings-fields > label { font-size: 13px; }
  .field small { font-size: 11px; }
  .field input, .field select, .field textarea, .settings-fields > label > input {
    min-height: 44px;
    font-size: 16px;
    padding: 10px 12px;
  }
  dialog { padding: 20px; width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  dialog h2 { font-size: 23px; }
  dialog > p, .user-permissions label { font-size: 12px; }
  .user-settings-info { grid-template-columns: minmax(0, 1fr); }
  .metric { padding: 12px; }
  .metric-top { font-size: 11px; }
  .metric-value { font-size: 22px; }
  .panel-head h2 { font-size: 14px; }
  .metric small, .panel-head small, .activity-row small { font-size: 10px; }
  .summary-row, .activity-row p { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar .nav-link { transition: none; }
}

@media(min-width:801px){.workspace-content.with-directory{grid-template-columns:minmax(0,1fr) minmax(160px,16.875rem)}}
[hidden]{display:none!important}.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.cash-report-metrics{grid-template-columns:repeat(3,minmax(0,1fr))}.cash-report-metrics .metric-value{overflow-wrap:anywhere;font-size:clamp(20px,2vw,29px)}
#cash-filters label{min-width:0}#cash-filters input:not([type=checkbox]),#cash-filters select{max-width:100%}#cash-filters>small{flex-basis:100%}
.cash-report-results .panel-head small{display:block;margin-top:5px}
@media(max-width:800px){#cash-filters{display:flex;flex-wrap:wrap}#cash-filters>label:has(input:not([type=checkbox])),#cash-filters>label:has(select){flex:0 0 100%}}
@media(max-width:800px){.cash-report-metrics{grid-template-columns:1fr}#cash-filters>label:has(input:not([type=checkbox])),#cash-filters>label:has(select){display:flex;flex-direction:column;align-items:stretch;width:100%}#cash-filters input[type=search]{min-width:0}#cash-filters>label input:not([type=checkbox]),#cash-filters select{width:100%;font-size:16px}#cash-filters .actions{width:100%}#cash-load{white-space:normal}.cash-report-metrics .metric{min-height:0}.cash-report-metrics .metric-value{font-size:24px}}
