:root {
  --ink: #142033;
  --navy: #0c1628;
  --navy-2: #15233a;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-50: #eff6ff;
  --slate: #60708a;
  --line: #e7ebf1;
  --canvas: #f5f7fa;
  --card: #fff;
  --red: #c2410c;
  --amber: #b7791f;
  --green: #16815a;
  --radius: 18px;
  --shadow: 0 12px 32px rgba(27, 41, 71, 0.055);
  --shadow-sm: 0 2px 8px rgba(27, 41, 71, 0.06);
  --shadow-md: 0 8px 24px rgba(27, 41, 71, 0.08);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 180ms;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--canvas);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 252px;
  background: var(--navy);
  padding: 26px 16px 20px;
  color: #d8e2f2;
  display: flex;
  flex-direction: column;
}
.brand {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -0.04em;
  padding: 0 8px;
}
.brand-mark,
.brand-logo {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  background: #16815a;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0;
  flex-shrink: 0;
}
.brand-logo {
  display: block;
  object-fit: cover;
  background: transparent;
}
.brand-accent {
  color: #78a9ff;
}
.workspace-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #8293ae;
  margin: 27px 10px 15px;
}
nav {
  display: grid;
  gap: 5px;
}
.nav {
  border: 0;
  background: transparent;
  color: #9dacc4;
  text-align: left;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: 0.18s;
}
.nav:hover {
  background: #14243e;
  color: #fff;
}
.nav.active {
  background: #1a3154;
  color: #fff;
  box-shadow: inset 0 0 0 1px #29476f;
}
.nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 16px;
  font-weight: 600;
  color: #a5c8ff;
}
.system-state {
  margin-top: auto;
  border: 1px solid #223550;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: #101d31;
}
.system-state small,
.profile small {
  display: block;
  color: #8da0b9;
  font-size: 10px;
  letter-spacing: 0.07em;
  font-weight: 700;
}
.system-state strong {
  font-size: 11px;
  font-weight: 600;
  color: #e3edfa;
  display: block;
  margin-top: 4px;
}
.pulse {
  margin-top: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px #34d39919;
}
main {
  width: calc(100% - 252px);
  margin-left: 252px;
  padding: 31px 42px 42px;
  max-width: 1720px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto 28px;
  max-width: 1360px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 0.13em;
  color: var(--blue);
  font-weight: 850;
  margin: 0 0 7px;
}
h1 {
  margin: 0;
  font-size: 29px;
  letter-spacing: -0.045em;
  line-height: 1.08;
}
.header-subtitle {
  margin: 7px 0 0;
  color: var(--slate);
  font-size: 13px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 17px;
}
.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 11px;
  color: #44536b;
  font-size: 20px;
  cursor: pointer;
}
.icon-button:hover {
  border-color: #b8cae6;
  color: var(--blue);
}
.profile {
  display: flex;
  align-items: center;
  gap: 9px;
}
.profile strong {
  display: block;
  font-size: 12px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #dbeafe;
  color: #2851ae;
  font-size: 10px;
  font-weight: 850;
}
.page {
  display: none;
  max-width: 1360px;
  margin: auto;
}
.page.active {
  display: block;
}
.bento {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}
.bento-card,
.card,
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.bento-card {
  padding: 20px;
}
.command-card {
  grid-column: span 7;
  min-height: 196px;
  background: linear-gradient(125deg, #14274b, #203b6a);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.command-card:after {
  content: "";
  width: 250px;
  height: 250px;
  border-radius: 50%;
  border: 40px solid #6ea3ff18;
  position: absolute;
  right: -95px;
  top: -105px;
}
.command-card h2 {
  font-size: 22px;
  letter-spacing: -0.04em;
  margin: 16px 0 7px;
  max-width: 410px;
}
.command-card p {
  margin: 0;
  color: #c4d5ed;
  line-height: 1.55;
  max-width: 440px;
  font-size: 13px;
}
.command-meta {
  display: flex;
  gap: 18px;
  margin-top: 22px;
  position: relative;
  z-index: 1;
}
.command-meta span {
  font-size: 11px;
  color: #cddcf3;
}
.command-meta strong {
  display: block;
  font-size: 17px;
  color: #fff;
  margin-top: 2px;
}
.command-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid #ffffff26;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  color: #e5efff;
}
.command-chip i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #58e0b2;
}
.readiness-card {
  grid-column: span 5;
  min-height: 196px;
}
.section-kicker {
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.1em;
  color: #7989a0;
  margin: 0;
  text-transform: uppercase;
}
.readiness-main {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 13px 0 16px;
}
.readiness-main strong {
  font-size: 40px;
  letter-spacing: -0.06em;
  line-height: 1;
}
.readiness-main span {
  font-size: 12px;
  color: var(--slate);
  margin-left: 6px;
}
.readiness-badge {
  font-size: 11px;
  font-weight: 750;
  color: #107457;
  background: #e7f8f0;
  padding: 6px 9px;
  border-radius: 8px;
}
.progress-track {
  height: 8px;
  background: #eef2f6;
  border-radius: 8px;
  overflow: hidden;
}
.progress-value {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #5c9aff);
  border-radius: inherit;
}
.readiness-foot {
  display: flex;
  justify-content: space-between;
  color: var(--slate);
  font-size: 11px;
  margin-top: 9px;
}
.metric-card {
  grid-column: span 3;
  min-height: 120px;
  padding: 17px 19px;
}
.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.metric-label {
  font-size: 11px;
  color: var(--slate);
  font-weight: 650;
}
.metric-icon {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 9px;
  font-size: 15px;
  background: #f2f5f9;
  color: #54657d;
}
.metric-card.critical .metric-icon {
  background: #fff3ed;
  color: var(--red);
}
.metric-card.warning .metric-icon {
  background: #fff8e8;
  color: var(--amber);
}
.metric-card.success .metric-icon {
  background: #eaf9f1;
  color: var(--green);
}
.metric-card strong {
  font-size: 27px;
  letter-spacing: -0.05em;
  display: block;
  margin-top: 14px;
}
.metric-card small {
  color: var(--slate);
  font-size: 10px;
}
.workload-card {
  grid-column: span 7;
  min-height: 300px;
}
.attention-card {
  grid-column: span 5;
  min-height: 300px;
}
.card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 17px;
}
.card-heading h2 {
  font-size: 15px;
  letter-spacing: -0.02em;
  margin: 0;
}
.card-heading a {
  color: var(--blue);
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.workload-row {
  display: grid;
  grid-template-columns: 145px 1fr 38px;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}
.workload-row span {
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workload-row em {
  font-style: normal;
  color: #66758b;
  font-size: 11px;
  text-align: right;
}
.bar-track {
  height: 7px;
  background: #f0f3f7;
  border-radius: 7px;
  overflow: hidden;
}
.bar-value {
  height: 100%;
  border-radius: inherit;
  background: #5b8df6;
}
.attention-list {
  display: grid;
  gap: 3px;
}
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #eff1f4;
  font-size: 12px;
  line-height: 1.35;
}
.alert:last-child {
  border: 0;
}
.badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 4px 7px;
  border-radius: 7px;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.04em;
  background: #fff2ec;
  color: #bd4a1a;
}
.badge.ONBOARDING {
  background: #edf5ff;
  color: #2660bd;
}
.task-card {
  grid-column: span 12;
  padding: 0;
  overflow: hidden;
}
.task-card .card-heading {
  padding: 19px 20px 11px;
  margin: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
th {
  text-align: left;
  color: #8a98aa;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 11px 20px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 13px 20px;
  border-bottom: 1px solid #eef0f3;
}
tr:last-child td {
  border-bottom: 0;
}
.task-subject {
  font-weight: 700;
  color: #26364e;
}
.task-number {
  display: block;
  color: #8a98aa;
  font-size: 10px;
  margin-top: 3px;
}
.status {
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.03em;
  border-radius: 7px;
  padding: 5px 7px;
  background: #eef2f7;
  color: #44546b;
  white-space: nowrap;
}
.status.WORKING,
.status.ACCEPTED {
  background: #eaf2ff;
  color: #2962bd;
}
.status.REPORT_SUBMITTED {
  background: #fff7e8;
  color: #a36d17;
}
.status.VERIFIED,
.status.CLOSED {
  background: #e8f8ef;
  color: #167452;
}
.overdue {
  color: var(--red);
  font-weight: 750;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.card {
  padding: 18px;
}
.card span {
  display: block;
  color: var(--slate);
  font-size: 11px;
}
.card strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
  letter-spacing: -0.04em;
}
.panel {
  padding: 20px;
  margin-bottom: 18px;
}
.panel h2 {
  font-size: 16px;
  margin: 0 0 14px;
}
.grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  align-items: center;
}
.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select,
.form-grid textarea,
.audience-grid input,
.audience-grid select,
.audience-grid textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.form-grid label,
.audience-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--slate);
}
.form-grid label.checkbox-row,
.audience-grid label.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
select[multiple] {
  min-height: 7.5rem;
  max-height: 12rem;
  overflow: auto;
}
fieldset {
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}
.audience-fieldset {
  margin: 14px 0 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
  min-width: 0;
}
.audience-fieldset legend {
  padding: 0 6px;
  font-size: 12px;
  font-weight: 750;
  color: var(--ink);
}
.audience-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.audience-projected { margin: 10px 0 0; }
.audience-hint { margin: 0 0 12px; font-size: 13px; }
.audience-grid-pickers label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.audience-grid-pickers .token-picker-wrap {
  min-height: 92px;
}
.scroll-panel {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.65);
}
.scroll-panel-dashed {
  border-style: dashed;
  min-height: 48px;
}
.panel-details {
  margin-top: 14px;
}
.panel-details summary {
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.panel-foot {
  margin: 0;
  font-size: 13px;
}

/* Token picker (chip multi-select) */
.token-picker-wrap {
  min-width: 0;
}
.token-picker-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 8px;
}
.token-picker-empty {
  font-size: 13px;
  align-self: center;
}
.token-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px 6px 10px;
  border-radius: 999px;
  background: #e8f0ff;
  border: 1px solid #c5d7f7;
  color: #1e3a5f;
}
.token-chip-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.token-chip-text strong {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.token-chip-text small {
  font-size: 10px;
  line-height: 1.2;
}
.token-chip-remove {
  flex-shrink: 0;
  border: 0;
  background: rgba(30, 58, 95, 0.12);
  color: #1e3a5f;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  font-weight: 700;
}
.token-chip-remove:hover {
  background: rgba(180, 40, 40, 0.15);
  color: #9b1c1c;
}
.token-picker-add {
  position: relative;
}
.token-picker-search {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
.token-picker-dropdown {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.token-picker-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: transparent;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
}
.token-picker-option:last-child { border-bottom: 0; }
.token-picker-option:hover:not(.disabled) { background: #f0f6ff; }
.token-picker-option.disabled { cursor: default; padding: 12px; }

.role-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.role-toggle-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  transition: border-color 0.15s, background 0.15s;
}
.role-toggle-chip input { accent-color: var(--blue); }
.role-toggle-chip.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  color: #1e40af;
}
.visibility-mode-row {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 16px;
  align-items: start;
}
.visibility-mode-select select {
  width: 100%;
  margin-top: 6px;
}
.visibility-mode-hint {
  margin: 0;
  padding-top: 22px;
  font-size: 13px;
  line-height: 1.45;
}
.tira-visibility-panel .form-panel {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
}
.tira-visibility-panel .audience-fieldset + .audience-fieldset {
  margin-top: 12px;
}
.visibility-deny-section {
  border-color: #f5d0d0;
  background: #fffafa;
}
.compact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.compact-table th,
.compact-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.compact-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f8fafc;
}
.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.compose-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.compose-span-2 { grid-column: 1 / -1; }
.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  white-space: nowrap;
}
.os-metrics.cards {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.os-secondary.bento {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.os-bento {
  grid-column: span 1 !important;
}
.legacy-nav-wrap.collapsed .legacy-nav-item { display: none; }
.legacy-toggle {
  border: 0;
  background: transparent;
  color: #6d7f9c;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 14px 10px 6px;
  padding: 0;
  cursor: pointer;
  text-align: left;
}
.empty-state {
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
}
.agent-skills-fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0 14px;
  min-width: 0;
}
.agent-skills-fieldset legend {
  font-size: 12px;
  font-weight: 700;
  padding: 0 6px;
}
.skill-category { margin-top: 10px; }
.skill-cat-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #6d7f9c);
  margin-bottom: 6px;
}
.skill-grid {
  display: grid;
  gap: 8px;
}
.skill-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2, rgba(0,0,0,0.02));
  cursor: pointer;
}
.skill-chip input { margin-top: 3px; }
.skill-chip small { display: block; margin-top: 2px; line-height: 1.35; }
.skill-chip strong { font-size: 13px; }
@media (max-width: 900px) {
  .audience-grid,
  .compose-grid,
  .os-secondary.bento,
  .visibility-mode-row {
    grid-template-columns: 1fr;
  }
  .visibility-mode-hint { padding-top: 0; }
}
.toolbar input {
  width: 280px;
}
.toolbar h2 {
  margin: 0;
}
.primary {
  background: var(--blue);
  border: 0;
  color: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
}
.secondary {
  border: 1px solid #d6dfe9;
  background: white;
  color: #334b68;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}
.tiny {
  padding: 6px 9px;
  font-size: 11px;
}
.form-panel {
  background: #f8fbff;
  border: 1px solid #d8e7fb;
  border-radius: 13px;
  padding: 16px;
  margin-bottom: 16px;
}
.form-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.form-grid textarea {
  grid-column: span 3;
  min-height: 70px;
}
.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.status-control {
  display: flex;
  gap: 5px;
  align-items: center;
}
.status-control select {
  max-width: 155px;
  padding: 6px;
}
.muted {
  color: var(--slate);
  font-size: 12px;
}
#toast.toast { display: block; }
@media (max-width: 1080px) {
  .bento {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .command-card,
  .workload-card {
    grid-column: span 6;
  }
  .readiness-card,
  .attention-card {
    grid-column: span 6;
  }
  .metric-card {
    grid-column: span 3;
  }
  .sidebar {
    width: 78px;
    padding: 23px 9px;
  }
  .brand {
    padding: 0;
    justify-content: center;
  }
  .brand > span:last-child,
  .workspace-label,
  .nav span:last-child,
  .system-state > div {
    display: none;
  }
  .nav {
    justify-content: center;
    padding: 12px;
  }
  .nav-icon {
    font-size: 18px;
  }
  .system-state {
    justify-content: center;
    padding: 12px 6px;
  }
  main {
    margin-left: 78px;
    width: calc(100% - 78px);
    padding: 28px 24px;
  }
}
@media (max-width: 680px) {
  body {
    display: block;
  }
  .sidebar {
    position: fixed;
    z-index: 5;
    inset: auto 0 0;
    width: 100%;
    height: 72px;
    padding: 6px 8px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .brand, .workspace-label, .nav-group, .legacy-nav-wrap, .system-state {
    display: none !important;
  }
  nav.sidebar-nav {
    display: flex;
    flex: 1;
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;
    max-width: 100%;
  }
  .nav {
    flex: 0 0 auto;
    min-width: 64px;
    padding: 8px 10px;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
  }
  .nav span:last-child {
    display: block !important;
    font-size: 10px;
    line-height: 1.1;
    max-width: 64px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .system-state {
    display: none;
  }
  main {
    margin-left: 0;
    width: 100%;
    padding: 16px 12px 88px;
  }
  .pulse.ok { background: #22c55e; }
  .pulse.warn { background: #f59e0b; }
  main {
    margin: 0;
    width: 100%;
    padding: 22px 15px 84px;
  }
  .topbar {
    align-items: flex-start;
    gap: 14px;
  }
  .profile {
    display: none;
  }
  .header-subtitle {
    max-width: 250px;
  }
  .bento {
    grid-template-columns: 1fr;
  }
  .command-card,
  .readiness-card,
  .metric-card,
  .workload-card,
  .attention-card,
  .task-card {
    grid-column: span 1;
  }
  .command-card {
    min-height: 180px;
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid textarea {
    grid-column: span 1;
  }
  .toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .toolbar input {
    width: 100%;
  }
  .panel {
    overflow: auto;
  }
  .workload-row {
    grid-template-columns: 110px 1fr 28px;
  }
  table {
    min-width: 680px;
  }
}

.login-shell {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #0c1628, #152e50);
}

.login-shell[hidden] { display: none; }

.login-card {
  display: grid;
  width: min(100%, 420px);
  gap: 14px;
  padding: 34px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
}

.login-card h1 { margin: 4px 0; font-size: 24px; }
.login-card p { margin: 0; color: var(--slate); line-height: 1.5; }
.login-card input { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 11px; font: inherit; }
.login-error { min-height: 20px; color: #b42318 !important; font-size: 13px; }
.login-card .brand-mark,
.login-card .brand-logo { width: 48px; height: 48px; border-radius: 14px; }
.login-links { display: grid; gap: 6px; margin-top: 4px; }
.login-card .text-link {
  border: 0;
  background: none;
  padding: 2px 0;
  text-align: left;
  color: #1d4ed8;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.login-card .text-link:hover { text-decoration: underline; }

/* QR + backup secret inside the narrow login card (do not reuse .profile-grid). */
.totp-setup {
  display: grid;
  gap: 12px;
  justify-items: center;
  width: 100%;
  min-width: 0;
}
.totp-setup img {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  background: #fff;
}
.totp-setup .totp-secret {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  text-align: center;
}
.totp-setup .totp-secret span {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.totp-setup .totp-secret code {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f3f6fb;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  word-break: break-all;
  text-align: left;
}

.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 1fr); gap: 24px; align-items: start; }
.profile-grid .cards { margin-top: 18px; }
.profile-grid .card strong { overflow-wrap: anywhere; font-size: 14px; }
button.linkish {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
button.linkish:hover { color: var(--blue); }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }

/* Control Tower OS — enterprise primitives */
.nav-group {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6d7f9c;
  margin: 14px 10px 6px;
}
.nav-group.muted-group { opacity: 0.55; margin-top: 18px; }
.sidebar-nav { overflow-y: auto; flex: 1; padding-bottom: 12px; gap: 3px; }
.sidebar { width: 268px; }
main { margin-left: 268px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-badge.ok { background: #e8f7ef; color: var(--green); }
.status-badge.warn { background: #fff6e5; color: var(--amber); }
.status-badge.down { background: #fdece7; color: var(--red); }
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.service-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.service-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.os-hero-top, .os-hero-actions, .quick-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.os-hero-top { justify-content: space-between; }
.filter-bar { gap: 8px; flex-wrap: wrap; }
.filter-bar input { max-width: 220px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.log-pre {
  max-height: 420px;
  overflow: auto;
  background: var(--navy);
  color: #d8e2f2;
  padding: 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.tab-bar { display: flex; gap: 6px; margin-bottom: 14px; }
.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--slate);
}
.tab.active { background: var(--blue-50); border-color: #bfdbfe; color: var(--blue); }
.table-scroll { overflow-x: auto; }
.palette-overlay, .drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(12, 22, 40, 0.45);
  place-items: start center;
  padding: 12vh 16px 16px;
}
.palette-overlay:not([hidden]),
.drawer-overlay:not([hidden]) {
  display: grid;
}
.palette-overlay[hidden],
.drawer-overlay[hidden] {
  display: none !important;
}
.drawer-overlay { place-items: stretch end; padding: 0; }
.palette-card {
  width: min(560px, 100%);
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,.25);
  overflow: hidden;
}
.palette-card input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  font: inherit;
  font-size: 16px;
}
.palette-card ul { list-style: none; margin: 0; padding: 8px; max-height: 360px; overflow: auto; }
.palette-card li {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}
.palette-card li:hover { background: var(--blue-50); color: var(--blue); }
.drawer-panel {
  width: min(520px, 100%);
  background: var(--card);
  padding: 20px;
  overflow: auto;
  box-shadow: -12px 0 40px rgba(0,0,0,.12);
}
html[data-theme="dark"] {
  --ink: #e8eef8;
  --canvas: #0b1220;
  --card: #121c2e;
  --line: #243249;
  --slate: #9db0c9;
  --blue-50: #15233a;
  --shadow: 0 12px 32px rgba(0,0,0,.25);
}
html[data-theme="dark"] body { background: var(--canvas); color: var(--ink); }
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .service-card,
html[data-theme="dark"] .bento-card,
html[data-theme="dark"] .tab { background: var(--card); color: var(--ink); }
html[data-theme="dark"] table th { color: var(--slate); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0f1828;
  color: var(--ink);
  border-color: var(--line);
}
@media (max-width: 960px) {
  .sidebar { width: 220px; }
  main { margin-left: 220px; }
}
@media (max-width: 720px) {
  body { flex-direction: column; }
  .sidebar {
    position: relative;
    width: 100%;
    inset: auto;
    max-height: none;
  }
  main { margin-left: 0; }
}

/* ── Control Tower UI polish (2026-09) ── */
.page.page-enter {
  animation: page-enter 420ms var(--ease) both;
}
@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  position: relative;
  overflow: hidden;
  padding: 18px 20px;
  border: 1px solid var(--line);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  animation: stat-in 480ms var(--ease) both;
  animation-delay: calc(var(--stat-i, 0) * 45ms);
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue);
  border-radius: 4px 0 0 4px;
  opacity: 0.85;
}
.stat-card.tone-warn::before { background: var(--amber); }
.stat-card.tone-success::before { background: var(--green); }
.stat-card.tone-neutral::before { background: #94a3b8; }
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d4deea;
}
.stat-label {
  display: block;
  color: var(--slate);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
}
.stat-value {
  display: block;
  font-size: 32px;
  margin-top: 8px;
  letter-spacing: -0.05em;
  line-height: 1;
}
@keyframes stat-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eef1f5;
}
.panel-header-main h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.03em;
}
.panel-meta {
  margin: 5px 0 0;
  color: var(--slate);
  font-size: 12px;
}
.panel-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.panel-foot {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.panel-table { padding-top: 22px; }
.panel-compose .form-panel.compose-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.panel-compose .form-panel.compose-card:focus-within {
  border-color: #bfd4f6;
  box-shadow: 0 0 0 3px #2563eb18;
}
.subsection { margin-top: 22px; }
.subsection-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: -0.01em;
  color: #334155;
}

.data-table {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.data-table table {
  margin: 0;
  min-width: 640px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.data-table tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  transition: background var(--dur) var(--ease);
}
.data-table tbody tr:hover td {
  background: #f8fbff;
}
.data-table tbody tr:last-child td {
  border-bottom: 0;
}
.cell-sub { color: var(--slate); }
.cell-code {
  font-size: 11px;
  background: #f1f5f9;
  padding: 3px 7px;
  border-radius: 6px;
  word-break: break-all;
}
.empty-cell {
  text-align: center;
  padding: 28px 16px !important;
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 220px;
  max-width: 420px;
}
.search-field::before {
  content: "⌕";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 14px;
  pointer-events: none;
}
.search-field input {
  width: 100%;
  padding: 10px 12px 10px 34px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.search-field input:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px #2563eb20;
}
.toolbar-filter {
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar-filter select {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  font: inherit;
}
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
  padding: 0 4px;
}
.table-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding: 4px 4px 0;
  color: var(--slate);
  font-size: 13px;
}
.table-pager .pager-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.table-pager select,
.table-toolbar select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { color: #1d4ed8; }
th.sortable[data-dir="asc"]::after { content: " ↑"; color: #1d4ed8; }
th.sortable[data-dir="desc"]::after { content: " ↓"; color: #1d4ed8; }
.col-sno {
  width: 3.25rem;
  min-width: 3.25rem;
  text-align: right;
  color: var(--slate, #64748b);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
th.col-sno {
  text-align: right;
  color: var(--slate, #64748b);
  font-weight: 600;
}
.people-subtab { padding-top: 8px; }
.panel-section + .panel-section { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.tab-bar .tab-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e8eef8;
  color: #334155;
  font-size: 11px;
  font-weight: 750;
}
.tab-bar .tab.active .tab-count { background: #dbeafe; color: #1d4ed8; }
.people-subtab .card-heading { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.people-subtab .card-heading h2 { margin: 0; font-size: 17px; }
.people-subtab .card-heading span { color: var(--slate); font-size: 13px; }

.primary,
.secondary,
.danger,
.icon-button {
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.primary {
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}
.primary:hover:not(:disabled) {
  background: var(--blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.28);
}
.primary:active:not(:disabled),
.secondary:active:not(:disabled),
.btn-pressed {
  transform: translateY(0) scale(0.98);
}
.secondary:hover:not(:disabled) {
  border-color: #b8cae6;
  background: #f8fbff;
  color: var(--blue);
}
.danger {
  background: #fff1ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}
.danger:hover:not(:disabled) {
  background: #ffe8e0 !important;
}
button.is-loading {
  pointer-events: none;
  opacity: 0.82;
  position: relative;
}
button.is-loading .btn-label::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 650ms linear infinite;
}
.icon-button.is-spinning {
  animation: spin 900ms linear;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.status-select {
  max-width: 170px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  background: #fff;
}

.tab-bar-lg {
  padding: 4px;
  background: #f1f5f9;
  border-radius: 999px;
  width: fit-content;
  margin-bottom: 20px;
}
.tab-bar-lg .tab {
  border: 0;
  background: transparent;
  padding: 9px 18px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tab-bar-lg .tab.active {
  background: #fff;
  color: var(--blue);
  box-shadow: var(--shadow-sm);
}
.tab:hover:not(.active) {
  color: var(--ink);
  background: #ffffff88;
}

.nav {
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.nav.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #60a5fa;
}
.nav:active {
  transform: scale(0.98);
}

.cards.create-menu {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.create-kind {
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.create-kind:hover {
  transform: translateY(-3px);
  border-color: #bfd4f6;
  box-shadow: var(--shadow-md);
}
.create-kind strong { font-size: 18px; }
.create-kind small {
  display: block;
  margin-top: 6px;
  color: var(--slate);
  font-size: 11px;
  line-height: 1.4;
}

.bool {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.bool.yes { background: #e8f7ef; color: var(--green); }
.bool.no { background: #f1f5f9; color: #64748b; }

.text-link {
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.text-link:hover { text-decoration: underline; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 48px));
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transition: opacity 280ms var(--ease), transform 280ms var(--ease);
}
.toast.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.toast-success {
  background: #0f5132;
  color: #ecfdf5;
}
.toast-error {
  background: #7f1d1d;
  color: #fef2f2;
}

.loading-line {
  color: var(--slate);
  font-size: 13px;
  animation: pulse-text 1.2s ease-in-out infinite;
}
@keyframes pulse-text {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.pulse {
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px #34d39919; }
  50% { box-shadow: 0 0 0 7px #34d39930; }
}

.toolbar input,
.form-grid input,
.form-grid select,
.form-grid textarea,
.audience-grid input,
.audience-grid select {
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.toolbar input:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus,
.audience-grid input:focus,
.audience-grid select:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px #2563eb18;
}

@media (prefers-reduced-motion: reduce) {
  .page.page-enter,
  .stat-card,
  .toast,
  .pulse,
  .loading-line,
  button.is-loading .btn-label::after {
    animation: none !important;
    transition: none !important;
  }
  .stat-card:hover,
  .primary:hover,
  .create-kind:hover {
    transform: none;
  }
}

html[data-theme="dark"] .panel-header { border-bottom-color: var(--line); }
html[data-theme="dark"] .data-table,
html[data-theme="dark"] .data-table thead th { background: #0f1828; }
html[data-theme="dark"] .data-table tbody tr:hover td { background: #15233a; }
html[data-theme="dark"] .search-field input,
html[data-theme="dark"] .tab-bar-lg { background: #0f1828; }
html[data-theme="dark"] .tab-bar-lg .tab.active { background: var(--card); }
html[data-theme="dark"] .cell-code { background: #15233a; }
html[data-theme="dark"] .panel-compose .form-panel.compose-card { background: var(--card); }

/* ——— TIRA Configuration catalog & access polish ——— */
.tira-form-card {
  border: 1px solid var(--line, #d8e0ec);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.tira-form-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.tira-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-weight: 600;
}
.tira-check input { width: 16px; height: 16px; accent-color: var(--blue, #2563eb); }
.tira-model-id-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.tira-model-id-row input { flex: 1; min-width: 0; }
.tira-model-id-row .pick-model-btn { white-space: nowrap; }
.tira-access-counters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}
.tira-counter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line, #d8e0ec);
  background: #f8fafc;
  font-size: 12px;
  color: var(--muted, #64748b);
}
.tira-counter-chip strong { color: var(--ink, #0f172a); font-size: 13px; }
.tira-counter-chip.is-primary {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.tira-counter-chip.is-primary strong { color: #1e40af; }
.tira-assigned-models { margin: 14px 0; }
.tira-assigned-models .cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.tira-assigned-models .card {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, #d8e0ec);
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.tira-master-toggle.is-on { background: #ecfdf5; border-color: #6ee7b7 !important; }
.tira-master-toggle.is-off { background: #fef2f2; border-color: #fecaca !important; }

.model-browse-panel { margin-top: 4px; }
.model-catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.model-catalog-toolbar .search-field { flex: 1; min-width: 180px; }
.model-catalog-toolbar select {
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line, #d8e0ec);
  padding: 0 10px;
  background: #fff;
}
.model-catalog-scroll,
.model-browse-scroll {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line, #d8e0ec);
  border-radius: 12px;
  background: #fbfcfe;
}
.model-catalog-row {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line, #e8eef6);
  border-radius: 0;
  background: transparent;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.model-catalog-row:hover { background: #f0f6ff; }
.model-catalog-row.is-static { cursor: default; }
.model-catalog-row.is-static:hover { background: transparent; }
.model-catalog-row-main {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
}
.model-catalog-row-main strong { font-size: 13px; word-break: break-all; }
.model-catalog-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted, #64748b);
}
.model-catalog-caps { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.model-cap-chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
}
.model-catalog-desc {
  margin: 6px 0 0;
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.model-catalog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.model-catalog-overlay[hidden] { display: none !important; }
.model-catalog-dialog {
  width: min(720px, 100%);
  max-height: min(84vh, 760px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}
.model-catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 8px;
  border-bottom: 1px solid var(--line, #e8eef6);
}
.model-catalog-header h2 { margin: 0; font-size: 18px; }
.model-catalog-dialog .model-catalog-toolbar { padding: 12px 18px; }
.model-catalog-dialog .model-catalog-scroll {
  flex: 1;
  max-height: none;
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--line, #e8eef6);
}

#tira-config .form-panel input[type="text"],
#tira-config .form-panel input[type="password"],
#tira-config .form-panel input[type="number"],
#tira-config .form-panel input[type="search"],
#tira-config .form-panel textarea,
#tira-config .form-panel select {
  border-radius: 10px;
  border: 1px solid var(--line, #d8e0ec);
  padding: 9px 12px;
  min-height: 40px;
  background: #fff;
}
#tira-config .form-panel textarea { min-height: 96px; line-height: 1.45; }
#tira-config .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
#tira-config .primary,
#tira-config .secondary {
  border-radius: 10px;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 650;
}
#tira-config .primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border: 1px solid #1d4ed8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}
#tira-config .primary:hover { filter: brightness(1.04); }
#tira-config .secondary {
  background: #fff;
  border: 1px solid var(--line, #d8e0ec);
}
#tira-config .secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
#tira-config .tiny { min-height: 32px; padding: 0 10px; font-size: 12px; border-radius: 8px; }

html[data-theme="dark"] .tira-form-card,
html[data-theme="dark"] .model-catalog-dialog,
html[data-theme="dark"] .model-catalog-scroll,
html[data-theme="dark"] .tira-assigned-models .card,
html[data-theme="dark"] .tira-counter-chip {
  background: #0f1828;
  border-color: var(--line);
}
html[data-theme="dark"] .model-catalog-row:hover { background: #15233a; }
html[data-theme="dark"] .model-cap-chip { background: #1e293b; color: #a5b4fc; }
.model-price-legend{margin:0 0 10px;font-size:12px;line-height:1.4}

/* ——— TIRA model role cards ——— */
.tira-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: stretch;
}
.tira-role-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 14px;
  min-height: 100%;
}
.tira-role-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.tira-role-title-row h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.tira-role-badge {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
}
.tira-role-badge.is-on { background: #ecfdf5; color: #047857; }
.tira-role-badge.is-off { background: #f1f5f9; color: #64748b; }
.tira-role-blurb { margin: 0; font-size: 13px; line-height: 1.4; }
.tira-role-work {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink, #0f172a);
}
.tira-role-work span {
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}
.tira-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink, #0f172a);
}
.tira-field small { font-weight: 500; line-height: 1.35; }
.tira-input,
#tira-config .tira-input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line, #d8e0ec);
  padding: 10px 12px;
  min-height: 42px;
  font: inherit;
  font-weight: 500;
  background: #fff;
  box-sizing: border-box;
}
.tira-textarea,
#tira-config .tira-textarea {
  min-height: 110px;
  line-height: 1.45;
  resize: vertical;
  font-weight: 500;
}
.tira-input:focus,
.tira-textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px #2563eb18;
}
.tira-param-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}
@media (max-width: 720px) {
  .tira-param-grid { grid-template-columns: 1fr; }
}
.tira-token-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.tira-token-row .tira-input { flex: 1; min-width: 0; }
.tira-token-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted, #64748b);
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px dashed var(--line, #d8e0ec);
}
.tira-role-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}
.tira-role-actions {
  margin: 0 !important;
}
.tira-test-result {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}
.tira-test-result.is-pending {
  background: #f8fafc;
  border: 1px solid var(--line, #d8e0ec);
  color: var(--muted, #64748b);
}
.tira-test-result.is-ok {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.tira-test-result.is-fail {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}
html[data-theme="dark"] .tira-input,
html[data-theme="dark"] .tira-textarea {
  background: #0f1828;
  border-color: var(--line);
  color: var(--ink);
}
html[data-theme="dark"] .tira-token-hint,
html[data-theme="dark"] .tira-test-result.is-pending {
  background: #15233a;
}
html[data-theme="dark"] .tira-role-badge { background: #1e293b; color: #a5b4fc; }

/* Work Management — task case + bulk select */
.col-check { width: 36px; text-align: center; }
.col-check input { width: 16px; height: 16px; cursor: pointer; }
.task-bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px solid #fecaca;
  background: #fff7ed;
  border-radius: 12px;
}
.task-bulk-bar[hidden] { display: none !important; }
.task-case-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(12, 22, 40, 0.52);
  display: grid;
  place-items: stretch;
  padding: 18px 18px 18px 270px;
}
.task-case-overlay[hidden] { display: none !important; }
.task-case-shell {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  overflow: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.task-case-sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #fff 70%, rgba(255, 255, 255, 0.92));
  border-bottom: 1px solid var(--line);
  padding: 18px 20px 14px;
  backdrop-filter: blur(8px);
}
.task-case-title h2 {
  margin: 4px 0 6px;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.task-case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}
.task-snapshot-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.task-snap {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 0;
}
.task-snap span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--slate);
  text-transform: uppercase;
}
.task-snap strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-case-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
  padding: 16px 20px 24px;
  align-items: start;
}
.task-case-timeline-pane,
.task-side-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.task-timeline {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding-left: 8px;
}
.task-timeline::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, #93c5fd, var(--line));
}
.task-timeline-item {
  appearance: none;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  padding: 0;
  animation: task-fade-up 0.35s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 0.04s);
}
.task-timeline-dot {
  width: 14px;
  height: 14px;
  margin: 8px 5px 0;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #93c5fd;
  box-shadow: 0 0 0 3px #eff6ff;
  z-index: 1;
}
.task-timeline-item.is-active .task-timeline-dot {
  border-color: var(--blue);
  background: var(--blue);
}
.task-timeline-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fafc;
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.task-timeline-item:hover .task-timeline-card,
.task-timeline-item.is-active .task-timeline-card {
  border-color: #bfdbfe;
  background: #eff6ff;
  transform: translateY(-1px);
}
.task-timeline-card strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.task-timeline-card small { color: var(--slate); }
.task-timeline-card p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink);
}
.task-timeline-focus {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff, #f8fafc);
  border: 1px solid #dbeafe;
}
.task-case-side { display: grid; gap: 12px; }
.task-side-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
}
.task-side-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.task-side-list.checklist li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.task-side-list.checklist li.done { color: var(--green); }
.task-assign-overlay { z-index: 150; }
.task-assign-card {
  width: min(860px, 100%);
  max-height: 90vh;
  overflow: auto;
}
.task-assign-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 8px;
  border-bottom: 1px solid var(--line);
}
.task-assign-body {
  padding: 14px 18px 18px;
  display: grid;
  gap: 16px;
}
.task-assign-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.task-assign-section-head h4 {
  margin: 0 0 4px;
  font-size: 14px;
}
.task-assign-section-head p {
  margin: 0;
  font-size: 12px;
}
.task-assign-pickers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.task-assign-picker-field,
.task-assign-note {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.task-assign-picker-field .field-label,
.task-assign-note .field-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  letter-spacing: 0.02em;
}
.task-assign-section .token-picker-wrap {
  background: #fff;
  border-radius: 12px;
}
.task-assign-section .token-picker-selected {
  background: #fff;
  min-height: 48px;
}
.task-assign-section .token-picker-dropdown {
  max-height: 220px;
  z-index: 30;
}
.task-assign-note textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  resize: vertical;
  background: #fff;
}
.task-assign-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}
.task-assign-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--blue);
  flex-shrink: 0;
}
.task-assign-toggle strong {
  display: block;
  font-size: 13px;
}
.task-assign-toggle small {
  display: block;
  margin-top: 2px;
  line-height: 1.35;
}
.tiny-hint {
  margin: 0;
  font-size: 12px;
}

.token-picker-check-option {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}
.token-picker-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-align: left;
}
.token-check-box {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 2px solid #94a3b8;
  border-radius: 5px;
  background: #fff;
  position: relative;
}
.token-picker-check-option.is-checked {
  background: #eff6ff;
}
.token-picker-check-option.is-checked .token-check-box {
  border-color: var(--blue);
  background: var(--blue);
}
.token-picker-check-option.is-checked .token-check-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.token-picker-wrap.is-single .token-check-box {
  border-radius: 50%;
}
.token-picker-wrap.is-single .token-picker-check-option.is-checked .token-check-box::after {
  left: 5px;
  top: 5px;
  width: 4px;
  height: 4px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  transform: none;
}

@media (max-width: 900px) {
  .task-assign-pickers { grid-template-columns: 1fr; }
}
@keyframes task-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@media (max-width: 1100px) {
  .task-case-overlay { padding: 12px; }
  .task-snapshot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .task-case-body { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .task-snapshot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Message Monitoring */
.msgmon-chart-wrap { position: relative; height: 280px; margin-top: 8px; }
.msgmon-chart-wrap.sm { height: 160px; }
.msgmon-empty { padding: 28px 12px; text-align: center; }
.msgmon-empty strong { display: block; margin-bottom: 6px; }
.msgmon-callouts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.msgmon-callout { background: var(--blue-50); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.msgmon-callout small { display: block; color: var(--slate); margin-bottom: 4px; }
.msgmon-heat { display: grid; grid-template-columns: 36px repeat(24, minmax(0, 1fr)); gap: 2px; font-size: 10px; }
.msgmon-heat .lab { color: var(--slate); align-self: center; }
.msgmon-heat .cell { aspect-ratio: 1; border-radius: 3px; background: #e8eef7; min-height: 10px; }
.msgmon-heat-legend { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--slate); font-size: 12px; }
.msgmon-heat-swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
@media (max-width: 900px) {
  .msgmon-callouts { grid-template-columns: 1fr; }
}