html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Stitch parity: Login - FPT UniRAG */
:root {
  --auth-background: #f0f3ff;
  --auth-surface: #ffffff;
  --auth-surface-muted: #e7eeff;
  --auth-text: #111c2d;
  --auth-text-muted: #414754;
  --auth-border: #c1c6d6;
  --auth-primary: #1a73e8;
  --auth-primary-hover: #155fc7;
  --auth-danger: #ba1a1a;
  --auth-danger-soft: #fff1f0;
  --auth-ring: rgba(26, 115, 232, 0.22);
  --auth-shadow: 0 18px 45px rgba(17, 28, 45, 0.08), 0 2px 8px rgba(17, 28, 45, 0.04);
}

.auth-page,
.auth-page * {
  box-sizing: border-box;
}

body.auth-page {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  padding: 12px;
  background: var(--auth-background);
  color: var(--auth-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-layout {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: auth-enter 700ms ease both;
}

.auth-header {
  text-align: center;
}

.auth-brand-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  background: var(--auth-surface);
  box-shadow: 0 1px 2px rgba(17, 28, 45, 0.05);
}

.auth-brand-mark .material-symbols-outlined {
  color: var(--auth-primary);
  font-size: 34px;
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 34;
}

.auth-brand-copy h1 {
  margin: 0;
  color: var(--auth-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0;
}

.auth-brand-copy p {
  margin: 6px 0 0;
  color: var(--auth-text-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-card {
  border: 1px solid var(--auth-border);
  border-radius: 12px;
  background: var(--auth-surface);
  box-shadow: var(--auth-shadow);
  overflow: hidden;
}

.ui-card-header {
  padding: 22px 24px 12px;
}

.ui-card-title {
  margin: 0;
  color: var(--auth-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

.ui-card-description {
  margin: 4px 0 0;
  color: var(--auth-text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.ui-card-content {
  padding: 0 24px 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field-group,
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-field-group {
  gap: 14px;
}

.auth-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.ui-label,
.auth-field-row a,
.auth-check,
.ui-button {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 500;
}

.ui-label {
  color: var(--auth-text);
}

.auth-field-row a {
  color: var(--auth-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  text-underline-offset: 4px;
}

.auth-field-row a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.auth-input-group {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  border: 1px solid var(--auth-border);
  border-radius: 8px;
  background: var(--auth-surface);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.auth-input-group:focus-within {
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px var(--auth-ring);
}

.auth-field[data-invalid] .auth-input-group {
  border-color: var(--auth-danger);
  background: var(--auth-surface);
}

.auth-field[data-invalid] .auth-input-group:focus-within {
  box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.16);
}

.auth-input-addon,
.auth-password-toggle {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--auth-text-muted);
}

.auth-input-addon .material-symbols-outlined,
.auth-password-toggle .material-symbols-outlined,
.ui-button .material-symbols-outlined,
.auth-alert .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

.ui-input {
  display: block;
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding: 7px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--auth-text);
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
}

.ui-input::placeholder {
  color: var(--auth-text-muted);
}

.auth-password-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}

.auth-password-toggle:hover {
  color: var(--auth-text);
  background: rgba(17, 28, 45, 0.04);
}

.auth-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--auth-text);
  width: fit-content;
  cursor: pointer;
}

.auth-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--auth-border);
  border-radius: 4px;
  accent-color: var(--auth-primary);
  cursor: pointer;
}

.ui-button {
  width: 100%;
  height: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.ui-button-primary {
  border: 1px solid var(--auth-primary);
  background: var(--auth-primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(26, 115, 232, 0.2);
}

.ui-button-primary:hover {
  background: var(--auth-primary-hover);
  border-color: var(--auth-primary-hover);
  box-shadow: 0 10px 22px rgba(26, 115, 232, 0.24);
}

.ui-button-primary:active {
  transform: scale(0.98);
}

.auth-footer {
  text-align: center;
}

.auth-footer p {
  margin: 0 0 10px;
  color: var(--auth-text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-footer nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.auth-footer a {
  color: var(--auth-text-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.auth-footer a:hover {
  color: var(--auth-text);
}

.auth-validation-summary ul {
  margin: 0;
  padding-left: 18px;
}

.auth-validation-summary,
.auth-field-message,
.auth-alert {
  color: var(--auth-danger);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.auth-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(186, 26, 26, 0.24);
  border-radius: 8px;
  background: var(--auth-danger-soft);
}

.field-validation-valid,
.validation-summary-valid {
  display: none;
}

.input-validation-error {
  border-color: var(--auth-danger);
}

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

@keyframes auth-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 768px) {
  body.auth-page {
    padding: 20px;
  }
}

@media (max-width: 420px) {
  .auth-card {
    padding: 20px;
  }

  .auth-brand-copy h1 {
    font-size: 26px;
  }
}

/* Stitch exactness pass: Login - FPT UniRAG */
body.auth-page {
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: #f0f3ff;
}

.auth-layout {
  max-width: 440px;
  gap: 32px;
}

.auth-brand-mark {
  width: 66px;
  height: 66px;
  margin-bottom: 8px;
  padding: 12px;
  border-radius: 12px;
  background: #ffffff;
  border-color: #c1c6d6;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.auth-brand-mark .material-symbols-outlined {
  color: #f26f21;
  font-size: 40px;
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 40;
}

.auth-brand-copy h1 {
  font-size: 32px;
  font-weight: 600;
  line-height: 1.25;
}

.auth-brand-copy p {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: 0.12em;
}

.auth-card {
  padding: 32px;
  border-color: #c1c6d6;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.auth-card .ui-card-header {
  display: none;
}

.auth-card .ui-card-content {
  padding: 0;
}

.auth-role-list {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.auth-role-list span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border: 1px solid #c1c6d6;
  border-radius: 9999px;
  background: #e7eeff;
  color: #414754;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.auth-form {
  gap: 24px;
}

.auth-field-group {
  gap: 24px;
}

.auth-field,
.auth-field-group {
  display: flex;
  flex-direction: column;
}

.auth-field {
  gap: 8px;
}

.auth-field-row {
  gap: 16px;
}

.auth-field-row a {
  color: #f26f21;
}

.auth-input-group {
  display: block;
  position: relative;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.auth-input-group:focus-within {
  border-color: transparent;
  box-shadow: none;
}

.auth-field[data-invalid] .auth-input-group,
.auth-field[data-invalid] .auth-input-group:focus-within {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.ui-input {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #c1c6d6;
  border-radius: 6px;
  background: #ffffff;
  color: #111c2d;
  font-size: 16px;
  line-height: 1.5;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.auth-input-group .ui-input[type="password"],
.auth-input-group .ui-input[type="text"] {
  padding-right: 44px;
}

.ui-input:focus {
  border-color: #f26f21;
  box-shadow: 0 0 0 2px rgba(242, 111, 33, 0.22);
}

.auth-field[data-invalid] .ui-input {
  border-color: #ba1a1a;
  background: #ffffff;
}

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: #414754;
  transform: translateY(-50%);
}

.auth-password-toggle:hover {
  color: #111c2d;
  background: transparent;
}

.auth-check input {
  accent-color: #f26f21;
}

.ui-button {
  height: 40px;
  min-height: 40px;
  border-radius: 6px;
  font-weight: 500;
}

.ui-button-primary {
  border-color: #f26f21;
  background: #f26f21;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.ui-button-primary:hover {
  border-color: #df5f16;
  background: #df5f16;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.auth-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 24px 0;
}

.auth-divider span {
  position: absolute;
  inset-inline: 0;
  border-top: 1px solid #c1c6d6;
}

.auth-divider strong {
  position: relative;
  z-index: 1;
  padding: 0 8px;
  background: #ffffff;
  color: #414754;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.auth-sso-button {
  width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid #c1c6d6;
  border-radius: 6px;
  background: #ffffff;
  color: #111c2d;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 160ms ease;
}

.auth-sso-button:hover {
  background: #e7eeff;
}

.auth-footer p {
  margin-bottom: 16px;
  font-size: 14px;
}

@media (min-width: 768px) {
  body.auth-page {
    padding: 32px;
  }
}

@media (max-width: 420px) {
  .auth-card {
    padding: 24px;
  }

  .auth-brand-copy h1 {
    font-size: 28px;
  }
}

/* Screenshot match: Login - FPT UniRAG */
body.auth-page {
  padding: 52px 20px 36px;
  background: #f7f8fd;
}

.auth-layout {
  max-width: 440px;
  gap: 30px;
}

.auth-header {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-brand-mark {
  width: 60px;
  height: 60px;
  margin-bottom: 18px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: #dce9ff;
  box-shadow: none;
}

.auth-brand-mark .material-symbols-outlined {
  color: #035fca;
  font-size: 34px;
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 24;
}

.auth-brand-copy h1 {
  color: #0062d6;
  font-family: Inter, system-ui, sans-serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}

.auth-brand-copy p {
  margin-top: 10px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.auth-card {
  width: 100%;
  padding: 44px 44px 48px;
  border: 1px solid #d7dce8;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.auth-form {
  gap: 22px;
}

.auth-field-group {
  gap: 18px;
}

.auth-field {
  gap: 8px;
}

.ui-label,
.auth-field-row a,
.auth-check,
.ui-button,
.auth-sso-button {
  font-size: 14px;
  line-height: 1.3;
}

.ui-label {
  color: #0f172a;
  font-weight: 500;
}

.auth-field-row {
  align-items: center;
}

.auth-field-row a {
  color: #0062d6;
  font-weight: 700;
}

.auth-input-group {
  position: relative;
  display: block;
}

.auth-input-leading-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  z-index: 1;
  color: #94a3b8;
  font-size: 18px;
  transform: translateY(-50%);
  pointer-events: none;
}

.ui-input {
  height: 46px;
  min-height: 46px;
  padding: 10px 42px 10px 42px;
  border-color: #c9d2df;
  border-radius: 8px;
  color: #0f172a;
  font-size: 15px;
  line-height: 1.4;
}

.ui-input::placeholder {
  color: #a8b3c3;
}

.ui-input:focus {
  border-color: #0062d6;
  box-shadow: 0 0 0 2px rgba(0, 98, 214, 0.14);
}

.auth-password-toggle {
  right: 12px;
  width: 24px;
  height: 24px;
  color: #94a3b8;
}

.auth-password-toggle .material-symbols-outlined {
  font-size: 18px;
}

.auth-check {
  gap: 7px;
  color: #334155;
  font-weight: 400;
}

.auth-check input {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  accent-color: #0062d6;
}

.ui-button {
  height: 50px;
  min-height: 50px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
}

.ui-button .material-symbols-outlined {
  font-size: 18px;
}

.ui-button-primary {
  border-color: #0667d8;
  background: #0667d8;
  box-shadow: none;
}

.ui-button-primary:hover {
  border-color: #005bbf;
  background: #005bbf;
  box-shadow: none;
}

.auth-divider {
  margin: 28px 0 0;
}

.auth-divider span {
  border-top-color: #edf1f7;
}

.auth-divider strong {
  padding: 0 14px;
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.auth-footer {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 10px;
  text-align: left;
}

.auth-footer p {
  margin: 0;
  color: #475569;
  font-size: 10px;
  font-weight: 600;
}

.auth-footer nav {
  gap: 18px;
}

.auth-footer a {
  color: #1e3a8a;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

@media (min-width: 768px) {
  body.auth-page {
    padding: 64px 32px 40px;
  }
}

@media (max-width: 420px) {
  .auth-layout {
    max-width: 100%;
  }

  .auth-card {
    padding: 28px 24px 32px;
  }

  .auth-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* Stitch parity: Admin Dashboard - FPT UniRAG */
:root {
  --admin-bg: #f9f9ff;
  --admin-surface: #ffffff;
  --admin-surface-soft: #f8fafc;
  --admin-surface-blue: #e7eeff;
  --admin-text: #111c2d;
  --admin-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-border-strong: #c1c6d6;
  --admin-primary: #1a73e8;
  --admin-primary-hover: #155fc7;
  --admin-primary-soft: #e3f2fd;
  --admin-primary-text: #155fc7;
  --admin-success: #166534;
  --admin-success-soft: #dcfce7;
  --admin-warning: #92400e;
  --admin-warning-soft: #fef3c7;
  --admin-info: #075985;
  --admin-info-soft: #e0f2fe;
  --admin-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
}

body.admin-dashboard-page,
.admin-dashboard-page * {
  box-sizing: border-box;
}

body.admin-dashboard-page {
  margin: 0;
  min-height: 100vh;
  background: var(--admin-bg);
  color: var(--admin-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  background: var(--admin-bg);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  border-right: 1px solid var(--admin-border);
  background: var(--admin-surface);
}

.admin-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--admin-text);
  text-decoration: none;
}

.admin-logo-mark {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--admin-primary);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(26, 115, 232, 0.24);
}

.admin-logo-mark .material-symbols-outlined {
  font-size: 26px;
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 28;
}

.admin-logo strong {
  display: block;
  font-family: Manrope, Inter, sans-serif;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
}

.admin-logo small {
  display: block;
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 600;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--admin-muted);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.admin-nav-item:hover {
  background: var(--admin-surface-soft);
  color: var(--admin-text);
}

.admin-nav-item.active {
  background: var(--admin-primary-soft);
  color: var(--admin-primary-text);
}

.admin-nav-item .material-symbols-outlined {
  font-size: 20px;
}

.admin-nav-group {
  display: flex;
  flex-direction: column;
}

.admin-nav-group summary {
  list-style: none;
  cursor: pointer;
}

.admin-nav-group summary::-webkit-details-marker {
  display: none;
}

.admin-nav-chevron {
  margin-left: auto;
  transition: transform 160ms ease;
}

.admin-nav-group[open] .admin-nav-chevron {
  transform: rotate(180deg);
}

.admin-subnav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 6px 0 2px 32px;
  padding-left: 12px;
  border-left: 1px solid var(--admin-border);
}

.admin-subnav a {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 12px;
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.admin-subnav a:hover {
  background: var(--admin-surface-soft);
  color: var(--admin-text);
}

.admin-subnav a.active {
  background: var(--admin-primary-soft);
  color: var(--admin-primary-text);
}

.admin-sidebar-footer {
  margin-top: auto;
  padding: 12px 0 0;
  border-top: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-sidebar-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--admin-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.admin-sidebar-footer-link .material-symbols-outlined {
  font-size: 18px;
  color: var(--admin-primary);
}

.admin-sidebar-footer-link:hover {
  background: var(--admin-surface-soft);
  color: var(--admin-text);
}

.admin-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--admin-border);
  background: rgba(249, 249, 255, 0.82);
  backdrop-filter: blur(14px);
}

.admin-search {
  width: min(520px, 100%);
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: var(--admin-surface);
  color: var(--admin-muted);
}

.admin-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--admin-text);
  font: inherit;
  font-size: 14px;
}

.admin-search input::placeholder {
  color: var(--admin-muted);
}

.admin-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-icon-button,
.admin-row-actions button,
.admin-row-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-muted);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.admin-icon-button {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.admin-icon-button:hover,
.admin-row-actions button:hover,
.admin-row-actions a:hover {
  border-color: var(--admin-border-strong);
  background: var(--admin-surface-soft);
  color: var(--admin-primary-text);
}

.admin-nav-item:focus-visible,
.admin-subnav a:focus-visible,
.admin-sidebar-footer-link:focus-visible,
.admin-primary-button:focus-visible,
.admin-secondary-button:focus-visible,
.admin-ghost-button:focus-visible,
.admin-icon-button:focus-visible,
.admin-row-actions button:focus-visible,
.admin-row-actions a:focus-visible {
  outline: 2px solid var(--admin-primary-text);
  outline-offset: 2px;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--admin-border);
  border-radius: 999px;
  background: var(--admin-surface);
}

.admin-user > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-weight: 800;
}

.admin-user > span {
  width: 34px;
  height: 34px;
  background: var(--admin-primary);
  color: #ffffff;
  font-size: 12px;
}

.admin-user strong,
.admin-user small {
  display: block;
}

.admin-user strong {
  color: var(--admin-text);
  font-size: 13px;
  line-height: 1.2;
}

.admin-user small {
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-content {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-hero,
.admin-panel,
.admin-stat-card {
  border: 1px solid var(--admin-border);
  border-radius: 24px;
  background: var(--admin-surface);
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  box-shadow: var(--admin-shadow);
}

.admin-hero p {
  margin: 0 0 8px;
  color: var(--admin-primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-hero h1 {
  margin: 0;
  color: var(--admin-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: 0;
}

.admin-hero span {
  display: block;
  max-width: 680px;
  margin-top: 10px;
  color: var(--admin-muted);
  font-size: 15px;
  line-height: 1.6;
}

.admin-primary-button,
.admin-secondary-button,
.admin-ghost-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.admin-primary-button {
  border: 1px solid var(--admin-primary);
  background: var(--admin-primary);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(26, 115, 232, 0.18);
}

.admin-primary-button:hover {
  border-color: var(--admin-primary-hover);
  background: var(--admin-primary-hover);
}

.admin-primary-button.full {
  width: 100%;
}

.admin-secondary-button,
.admin-ghost-button {
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-primary-text);
}

.admin-secondary-button:hover,
.admin-ghost-button:hover {
  background: var(--admin-primary-soft);
  border-color: #adc7ff;
}

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

.admin-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.admin-stat-icon {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
}

.admin-stat-icon.blue {
  background: var(--admin-primary-soft);
  color: var(--admin-primary);
}

.admin-stat-icon.indigo {
  background: #eef2ff;
  color: #4f46e5;
}

.admin-stat-icon.cyan {
  background: #ecfeff;
  color: #0891b2;
}

.admin-stat-card p,
.admin-stat-card small {
  margin: 0;
}

.admin-stat-card p {
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-stat-card strong {
  display: block;
  margin-top: 4px;
  color: var(--admin-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}

.admin-stat-card small {
  display: block;
  margin-top: 6px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.admin-left-stack {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 10px;
}

.admin-panel {
  min-width: 0;
  padding: 24px;
}

.admin-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-panel-header.compact {
  margin-bottom: 16px;
}

.admin-panel-header h2 {
  margin: 0;
  color: var(--admin-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.25;
}

.admin-panel-header p {
  margin: 5px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  padding: 0 16px 12px;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
}

.admin-table td {
  padding: 16px;
  border-top: 1px solid var(--admin-border);
  color: var(--admin-muted);
  font-size: 14px;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: var(--admin-surface-soft);
}

.admin-table td strong,
.admin-table td span {
  display: block;
}

.admin-table td strong {
  color: var(--admin-text);
  font-size: 14px;
}

.admin-table td span:not(.admin-badge):not(.material-symbols-outlined) {
  margin-top: 3px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
}

.admin-badge.success {
  background: var(--admin-success-soft);
  color: var(--admin-success);
}

.admin-badge.pending {
  background: var(--admin-warning-soft);
  color: var(--admin-warning);
}

.admin-badge.draft {
  background: #f1f5f9;
  color: #475569;
}

.admin-badge.info {
  background: var(--admin-info-soft);
  color: var(--admin-info);
}

.admin-badge.cyan {
  background: #ecfeff;
  color: #0891b2;
}

.admin-row-actions {
  display: flex;
  gap: 6px;
}

.admin-row-actions button,
.admin-row-actions a {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  text-decoration: none;
}

.admin-row-actions .material-symbols-outlined {
  font-size: 20px;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-danger-button,
.admin-success-button {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.admin-danger-button {
  border: 1px solid rgba(186, 26, 26, 0.24);
  background: #fff1f0;
  color: #ba1a1a;
}

.admin-danger-button:hover {
  border-color: #ba1a1a;
  background: #ffe2de;
}

.admin-success-button {
  border: 1px solid rgba(22, 101, 52, 0.24);
  background: var(--admin-success-soft);
  color: var(--admin-success);
}

.admin-success-button:hover {
  border-color: var(--admin-success);
  background: #bbf7d0;
}

/* Stitch parity: Create New Subject - FPT UniRAG */
.subject-create-main {
  min-height: 100vh;
  padding: 56px 32px;
  background: var(--admin-bg);
}

.subject-create-canvas {
  width: min(800px, 100%);
  margin: 0 auto;
}

.subject-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
}

.subject-breadcrumbs a {
  color: var(--admin-muted);
  text-decoration: none;
  transition: color 160ms ease;
}

.subject-breadcrumbs a:hover,
.subject-breadcrumbs strong {
  color: var(--admin-primary);
}

.subject-breadcrumbs .material-symbols-outlined {
  font-size: 16px;
}

.subject-create-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.subject-create-header h1 {
  margin: 0;
  color: var(--admin-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
}

.subject-create-header p {
  margin: 4px 0 0;
  color: var(--admin-muted);
  font-size: 16px;
  line-height: 1.5;
}

.subject-close-button {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--admin-muted);
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.subject-close-button:hover {
  background: #dee8ff;
  color: var(--admin-primary);
}

.subject-form-card {
  border: 1px solid rgba(193, 198, 214, 0.3);
  border-radius: 12px;
  overflow: hidden;
  background: var(--admin-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.subject-progress {
  height: 4px;
  background: #e7eeff;
}

.subject-progress span {
  display: block;
  width: 33.333%;
  height: 100%;
  background: var(--admin-primary);
}

.subject-form-content {
  padding: 40px;
}

.subject-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.subject-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subject-field > span {
  color: var(--admin-muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.subject-field input,
.subject-field textarea,
.subject-input-with-icon {
  width: 100%;
  border: 1px solid var(--admin-border-strong);
  border-radius: 12px;
  background: #f0f3ff;
  color: var(--admin-text);
  font: inherit;
  font-size: 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.subject-field input,
.subject-field textarea {
  outline: 0;
}

.subject-field input {
  min-height: 42px;
  padding: 8px 12px;
}

.subject-field textarea {
  min-height: 120px;
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.5;
}

.subject-field input::placeholder,
.subject-field textarea::placeholder {
  color: var(--admin-muted);
}

.subject-field input:focus,
.subject-field textarea:focus,
.subject-input-with-icon:focus-within {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.18);
}

.subject-input-with-icon {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 8px;
}

.subject-input-with-icon .material-symbols-outlined {
  color: var(--admin-muted);
  font-size: 20px;
}

.subject-input-with-icon input {
  min-height: 40px;
  padding-left: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--admin-primary);
  font-weight: 700;
  box-shadow: none;
}

.subject-input-with-icon input:focus {
  box-shadow: none;
}

.subject-field small {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
}

.subject-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(193, 198, 214, 0.35);
}

.subject-cancel-button,
.subject-submit-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.subject-cancel-button {
  padding: 8px 24px;
  border: 0;
  background: transparent;
  color: var(--admin-muted);
}

.subject-cancel-button:hover {
  background: #dee8ff;
  color: var(--admin-text);
}

.subject-submit-button {
  padding: 8px 40px;
  border: 1px solid var(--admin-primary);
  background: var(--admin-primary);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(26, 115, 232, 0.22);
}

.subject-submit-button:hover {
  background: var(--admin-primary-hover);
  box-shadow: 0 14px 24px rgba(26, 115, 232, 0.26);
}

.subject-submit-button:active {
  transform: scale(0.98);
}

.subject-submit-button .material-symbols-outlined {
  font-size: 18px;
}

.subject-help-card {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-top: 24px;
  padding: 24px;
  border: 1px solid #d0e1fb;
  border-radius: 12px;
  background: rgba(208, 225, 251, 0.3);
}

.subject-help-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ffffff;
  color: var(--admin-primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.subject-help-icon .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}

.subject-help-card h3 {
  margin: 0 0 4px;
  color: #54647a;
  font-size: 14px;
  font-weight: 700;
}

.subject-help-card p {
  margin: 0;
  color: rgba(84, 100, 122, 0.82);
  font-size: 16px;
  line-height: 1.55;
}

/* Stitch parity: Accounts - FPT UniRAG */
.accounts-main {
  min-height: 100vh;
  padding: 56px 32px;
  background: var(--admin-bg);
}

.accounts-canvas {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.accounts-header {
  margin-bottom: 28px;
}

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

.accounts-card {
  border: 1px solid rgba(193, 198, 214, 0.3);
  border-radius: 12px;
  background: var(--admin-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  padding: 28px;
}

.accounts-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.embedding-settings-current {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: -4px;
}

.embedding-settings-current > div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #d7e3ff;
  border-radius: 12px;
  background: #f7faff;
}

.embedding-settings-current span {
  display: block;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.embedding-settings-current strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: var(--admin-text);
  font-size: 14px;
  line-height: 1.45;
}

.accounts-eyebrow {
  margin: 0 0 6px;
  color: var(--admin-primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.accounts-card-header h2 {
  margin: 0;
  color: var(--admin-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.accounts-card-icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #e7eeff;
  color: var(--admin-primary);
}

.accounts-template-card {
  margin-bottom: 24px;
  border: 1px solid #d7e3ff;
  border-radius: 12px;
  background: #f7faff;
  overflow: hidden;
}

.accounts-template-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #d7e3ff;
}

.accounts-template-header strong {
  color: var(--admin-text);
  font-size: 14px;
}

.accounts-template-header span {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 600;
}

.accounts-template-table-wrap {
  overflow-x: auto;
}

.accounts-template-table {
  width: 100%;
  border-collapse: collapse;
}

.accounts-template-table th,
.accounts-template-table td {
  padding: 12px 18px;
  text-align: left;
  font-size: 13px;
}

.accounts-template-table th {
  color: var(--admin-muted);
  font-weight: 700;
}

.accounts-template-table td {
  border-top: 1px solid #e4ecff;
  color: var(--admin-text);
}

.accounts-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.accounts-upload-box {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px dashed var(--admin-border-strong);
  border-radius: 12px;
  background: #f0f3ff;
}

.accounts-upload-box.has-file {
  border-style: solid;
  border-color: rgba(25, 135, 84, 0.45);
  background: #edfdf4;
}

.accounts-upload-box.has-file .material-symbols-outlined {
  color: #198754;
}

.accounts-upload-box .material-symbols-outlined {
  color: var(--admin-primary);
  font-size: 24px;
}

.accounts-upload-box strong {
  display: block;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
  color: var(--admin-text);
  font-size: 14px;
}

.accounts-upload-box small {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 600;
}

.accounts-upload-box input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.accounts-select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--admin-border-strong);
  border-radius: 12px;
  background: #f0f3ff;
  color: var(--admin-text);
  font: inherit;
  font-size: 15px;
  outline: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.accounts-select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.18);
}

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

.accounts-feedback {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
}

.accounts-feedback-success {
  border: 1px solid rgba(25, 135, 84, 0.24);
  background: #edfdf4;
  color: #166534;
}

.accounts-feedback-error {
  border: 1px solid rgba(186, 26, 26, 0.24);
  background: #fff1f0;
  color: #ba1a1a;
}

.accounts-field-error {
  color: #ba1a1a;
  font-size: 12px;
  font-weight: 700;
}

.accounts-import-summary {
  margin-top: 24px;
}

.accounts-summary-badges {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.accounts-table-card {
  margin-top: 24px;
}

.accounts-action-disabled {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
}

.accounts-progress-box {
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(26, 115, 232, 0.24);
  background: var(--admin-primary-soft);
}

.accounts-progress-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.accounts-progress-stage {
  font-size: 14px;
  font-weight: 700;
  color: var(--admin-primary-hover);
}

.accounts-progress-message {
  margin-top: 2px;
  font-size: 12px;
  color: var(--admin-muted);
}

.accounts-progress-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--admin-primary-hover);
  white-space: nowrap;
}

.accounts-progress-track {
  margin-top: 10px;
  height: 8px;
  border-radius: 999px;
  background: rgba(26, 115, 232, 0.14);
  overflow: hidden;
  position: relative;
}

.accounts-progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--admin-primary);
  transition: width 400ms ease;
}

.accounts-progress-bar.is-failed {
  background: #ba1a1a;
}

.accounts-progress-bar.is-indeterminate {
  width: 40% !important;
  position: absolute;
  top: 0;
  left: 0;
  animation: accounts-progress-indeterminate 1.1s ease-in-out infinite;
}

@keyframes accounts-progress-indeterminate {
  0% {
    left: -40%;
  }
  100% {
    left: 100%;
  }
}

.accounts-form.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

/* Stitch parity: Delete Subjects - FPT UniRAG */
.delete-subject-main {
  min-height: 100vh;
  padding: 56px 32px;
  background: var(--admin-bg);
}

.delete-subject-canvas {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.delete-subject-header {
  margin-bottom: 28px;
}

.delete-subject-panel {
  border: 1px solid rgba(193, 198, 214, 0.3);
  border-radius: 12px;
  background: var(--admin-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  padding: 28px;
}

.delete-subject-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.delete-subject-panel-header h2 {
  margin: 0;
  color: var(--admin-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.delete-subject-panel-header p {
  margin: 6px 0 0;
  color: var(--admin-muted);
  font-size: 14px;
  line-height: 1.55;
}

.delete-subject-count {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: #e7eeff;
  color: var(--admin-primary);
  font-size: 13px;
  font-weight: 700;
}

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

.delete-subject-card {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: #fbfcff;
}

.delete-subject-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.delete-subject-card-top strong {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--admin-primary);
  font-size: 13px;
  font-weight: 800;
}

.delete-subject-card-top h3 {
  margin: 0;
  color: var(--admin-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

.delete-subject-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.delete-subject-meta dt {
  margin: 0 0 6px;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
}

.delete-subject-meta dd {
  margin: 0;
  color: var(--admin-text);
  font-size: 14px;
  line-height: 1.45;
}

.delete-subject-actions {
    display: flex;
    justify-content: flex-end;
  }

.delete-subject-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

.subject-table-card {
  overflow: hidden;
}

.subject-empty-state {
  text-align: center;
  color: var(--admin-muted);
  font-weight: 700;
}

.subject-description-cell {
  max-width: 420px;
  line-height: 1.6;
}

.subject-table-actions {
  white-space: nowrap;
}

.subject-delete-summary {
  margin-top: 24px;
}

.subject-delete-summary dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}

.subject-delete-summary dt {
  margin: 0 0 6px;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
}

.subject-delete-summary dd {
  margin: 0;
  color: var(--admin-text);
  font-size: 20px;
  font-weight: 800;
}

.subject-delete-warning {
  margin-top: 24px;
}

.subject-header-grid {
  align-items: start;
}

@media (max-width: 1120px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    padding: 16px;
  }

  .admin-nav {
    flex: 1;
    min-width: 0;
    flex-direction: row;
    overflow-x: auto;
  }

  .admin-sidebar-footer {
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    margin-top: 0;
    padding: 0 0 0 12px;
    border-top: 0;
    border-left: 1px solid var(--admin-border);
  }

  .admin-sidebar-footer-link {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
    padding: 10px;
  }

  .admin-sidebar-footer-link span:last-child {
    display: none;
  }

  .admin-sidebar-card {
    margin-top: 0;
    min-width: 220px;
  }

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

  .subject-create-main {
    padding: 32px 20px;
  }

  .accounts-main {
    padding: 32px 20px;
  }

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

  .embedding-settings-current {
    grid-template-columns: 1fr;
  }

  .delete-subject-main {
    padding: 32px 20px;
  }

  .delete-subject-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .admin-topbar,
  .admin-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-top-actions {
    flex-wrap: wrap;
  }

  .admin-content {
    padding: 20px;
  }

  .admin-stat-grid {
    grid-template-columns: 1fr;
  }

  .subject-form-grid {
    grid-template-columns: 1fr;
  }

  .subject-create-header,
  .subject-form-actions,
  .subject-help-card {
    align-items: stretch;
    flex-direction: column;
  }

  .accounts-card-header,
  .accounts-template-header,
  .delete-subject-panel-header,
  .delete-subject-card-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .subject-close-button {
    align-self: flex-end;
  }

  .subject-submit-button,
  .subject-cancel-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .admin-sidebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-nav {
    width: 100%;
  }

  .admin-topbar {
    padding: 16px;
  }

  .admin-user {
    width: 100%;
  }

  .admin-panel,
  .admin-hero {
    padding: 18px;
  }

  .subject-form-content,
  .subject-help-card {
    padding: 20px;
  }

  .accounts-card {
    padding: 20px;
  }

  .delete-subject-panel {
    padding: 20px;
  }

  .delete-subject-meta {
      grid-template-columns: 1fr;
    }

  .subject-delete-summary dl {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

  .subject-create-header h1 {
      font-size: 26px;
    }

  .accounts-upload-box {
    grid-template-columns: 1fr;
  }
}

/* Chat benchmark run controls */
.benchmark-setup-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Readiness chip in the card header: turns green once the set has prompts. */
.benchmark-step-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--admin-surface-soft);
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.benchmark-step-status.is-done {
  background: var(--admin-success-soft);
  color: var(--admin-success);
}

.benchmark-step-status .material-symbols-outlined {
  font-size: 16px;
}

.benchmark-prompt-table td:first-child {
  max-width: 520px;
  color: var(--admin-text);
}

.benchmark-empty-inline {
  padding: 20px 16px;
  border: 1px dashed var(--admin-border-strong);
  border-radius: 10px;
  background: var(--admin-surface-soft);
}

.benchmark-empty-inline .material-symbols-outlined {
  font-size: 30px;
}

.benchmark-cost-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(180, 83, 9, 0.28);
  border-radius: 10px;
  background: var(--admin-warning-soft);
  color: #7c3d0a;
  font-size: 13px;
  line-height: 1.5;
}

.benchmark-cost-callout .material-symbols-outlined {
  font-size: 20px;
}

.benchmark-cost-callout strong {
  font-variant-numeric: tabular-nums;
}

.benchmark-run-blocked {
  margin: 0 auto 0 0;
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 600;
}

.subject-submit-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.subject-submit-button.is-busy {
  cursor: progress;
}

.benchmark-subject-field > span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.benchmark-subject-field > span:first-child em {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--admin-surface-blue);
  color: var(--admin-primary);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.benchmark-subject-select {
  min-height: 50px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 11px;
  padding: 0 15px;
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  background: var(--admin-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.benchmark-subject-select:focus-within {
  border-color: var(--admin-primary);
  background: #fbfdff;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12), 0 6px 18px rgba(15, 23, 42, 0.06);
}

.benchmark-subject-select > .material-symbols-outlined {
  color: var(--admin-primary);
  font-size: 21px;
}

.benchmark-subject-select select {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0;
  border: 0;
  outline: 0;
  appearance: none;
  background: transparent;
  color: var(--admin-text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.benchmark-subject-select .benchmark-select-chevron {
  color: var(--admin-muted);
  pointer-events: none;
}

.benchmark-prompt-actions {
  padding-top: 18px;
}

.benchmark-add-prompt-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 20px 9px 14px;
  border: 1px solid var(--admin-primary);
  border-radius: 12px;
  background: var(--admin-primary);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(26, 115, 232, 0.2);
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.benchmark-add-prompt-button .material-symbols-outlined {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 18px;
}

.benchmark-add-prompt-button:hover {
  border-color: var(--admin-primary-hover);
  background: var(--admin-primary-hover);
  box-shadow: 0 9px 20px rgba(26, 115, 232, 0.24);
  transform: translateY(-1px);
}

.benchmark-add-prompt-button:focus-visible {
  outline: 3px solid rgba(26, 115, 232, 0.22);
  outline-offset: 3px;
}

.benchmark-add-prompt-button:active {
  box-shadow: 0 3px 8px rgba(26, 115, 232, 0.2);
  transform: translateY(0);
}

.benchmark-model-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin-top: 8px;
}

.benchmark-model-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--admin-text);
}

/* Chat benchmark: dense dashboard surface
   Density scale 8-32px, numeric columns use tabular figures so latency and token
   values line up digit-for-digit when models are compared row against row. */
.benchmark-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.benchmark-stat {
  padding: 14px 16px;
  border: 1px solid var(--admin-border);
  border-left: 3px solid var(--admin-primary);
  border-radius: 10px;
  background: var(--admin-surface);
  box-shadow: var(--admin-shadow);
}

.benchmark-stat.is-warning {
  border-left-color: #b45309;
}

.benchmark-stat-label {
  margin: 0;
  color: var(--admin-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.benchmark-stat-value {
  margin: 6px 0 2px;
  color: var(--admin-text);
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.benchmark-stat-meta {
  margin: 0;
  color: var(--admin-muted);
  font-size: 12px;
}

.benchmark-table-wrap {
  overflow-x: auto;
}

.benchmark-compare-table {
  min-width: 940px;
}

.benchmark-compare-table th {
  padding: 10px 12px;
  background: var(--admin-surface);
}

.benchmark-compare-table td {
  padding: 10px 12px;
  transition: background-color 160ms ease;
}

.benchmark-compare-table tbody tr:hover td {
  background: var(--admin-surface-soft);
}

.benchmark-compare-table tbody tr.is-best td {
  background: rgba(26, 115, 232, 0.05);
}

.benchmark-compare-table .is-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.benchmark-compare-table td.is-numeric {
  color: var(--admin-text);
  font-weight: 600;
}

.benchmark-compare-table td.is-numeric.is-alert {
  color: #b3261e;
}

.benchmark-model-name {
  display: flex !important;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.benchmark-tag {
  display: inline-block !important;
  margin-top: 0 !important;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--admin-primary-soft);
  color: #0b4a9c;
  font-size: 11px !important;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.benchmark-status {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin-top: 0 !important;
  color: var(--admin-text) !important;
  font-size: 12px !important;
  font-weight: 700;
  text-transform: capitalize;
}

.benchmark-status-dot {
  width: 8px;
  height: 8px;
  margin-top: 0 !important;
  border-radius: 50%;
  background: var(--admin-muted);
}

.benchmark-status-completed .benchmark-status-dot { background: #198754; }
.benchmark-status-failed .benchmark-status-dot { background: #b3261e; }
.benchmark-status-running .benchmark-status-dot { background: var(--admin-primary); animation: benchmark-pulse 1.4s ease-in-out infinite; }
.benchmark-status-queued .benchmark-status-dot { background: #b45309; }

@keyframes benchmark-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.benchmark-progress {
  display: block;
  width: 100%;
  max-width: 140px;
  height: 6px;
  margin-top: 6px !important;
  border-radius: 999px;
  background: var(--admin-border);
  overflow: hidden;
}

.benchmark-progress-fill {
  display: block;
  height: 100%;
  margin-top: 0 !important;
  border-radius: 999px;
  background: var(--admin-primary);
  transition: width 240ms ease;
}

.benchmark-progress-label {
  font-variant-numeric: tabular-nums;
}

.benchmark-link-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--admin-border-strong);
  border-radius: 8px;
  color: var(--admin-primary);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.benchmark-link-button:hover {
  border-color: var(--admin-primary);
  background: var(--admin-primary-soft);
}

.benchmark-link-button:focus-visible {
  outline: 3px solid var(--auth-ring);
  outline-offset: 2px;
}

.benchmark-link-button .material-symbols-outlined {
  font-size: 16px;
}

.benchmark-error-row td {
  padding-top: 0;
  border-top: 0;
}

.benchmark-error-row td .material-symbols-outlined {
  margin-right: 6px;
  color: #b3261e;
  font-size: 16px;
  vertical-align: middle;
}

.benchmark-error-row td span:not(.material-symbols-outlined) {
  display: inline !important;
  color: #b3261e !important;
  font-size: 12px !important;
}

.benchmark-empty {
  padding: 28px 16px;
  text-align: center;
}

.benchmark-empty .material-symbols-outlined {
  color: var(--admin-border-strong);
  font-size: 40px;
}

.benchmark-empty p {
  margin: 4px 0 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.benchmark-empty p strong {
  color: var(--admin-text);
  font-size: 14px;
}

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

@media (prefers-reduced-motion: reduce) {
  .benchmark-status-running .benchmark-status-dot {
    animation: none;
  }

  .benchmark-progress-fill,
  .benchmark-compare-table td,
  .benchmark-link-button {
    transition: none;
  }
}

.benchmark-history {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.benchmark-history .subject-field {
  flex: 1 1 320px;
  margin: 0;
}

/* Answers render side by side so two models can be compared without scrolling apart. */
.benchmark-answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.benchmark-answer-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: var(--admin-surface-soft);
}

.benchmark-answer-card.is-failed {
  border-color: rgba(179, 38, 30, 0.28);
  background: #fdeced;
}

.benchmark-answer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.benchmark-answer-head strong {
  color: var(--admin-text);
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.benchmark-answer-prompt {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.benchmark-answer-prompt .material-symbols-outlined {
  font-size: 18px;
}

.benchmark-answer-card .benchmark-answer {
  max-height: 320px;
  overflow-y: auto;
  padding: 12px;
  border-radius: 8px;
  background: var(--admin-surface);
}

.benchmark-answer.is-error {
  color: #b3261e;
}

.benchmark-answer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.benchmark-answer {
  max-width: 640px;
  margin-top: 8px;
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.5;
  color: var(--admin-text);
}

.admin-badge.danger {
  border: 1px solid rgba(220, 53, 69, 0.24);
  background: #fdeced;
  color: #b02a37;
}

/* Chat benchmark charts */
.benchmark-health-header {
  margin-top: 32px;
}

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

.benchmark-health-card {
  min-width: 0;
}

.benchmark-health-value {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--admin-success-soft);
  color: var(--admin-success);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.benchmark-svg-scroll {
  margin-top: 16px;
  overflow-x: auto;
}

.benchmark-line-chart {
  width: 100%;
  min-width: 520px;
  height: 220px;
  overflow: visible;
}

.benchmark-chart-gridline {
  stroke: var(--admin-border);
  stroke-width: 1;
}

.benchmark-chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.benchmark-chart-line-success,
.benchmark-chart-point-success {
  stroke: #198754;
}

.benchmark-chart-line-p50,
.benchmark-chart-point-p50 {
  stroke: var(--admin-primary);
}

.benchmark-chart-line-p95,
.benchmark-chart-point-p95 {
  stroke: #b45309;
}

.benchmark-chart-point {
  fill: var(--admin-surface);
  stroke-width: 3;
  cursor: pointer;
  transition: r 120ms ease, fill 120ms ease;
}

.benchmark-chart-point:hover,
.benchmark-chart-point:focus {
  r: 7px;
  fill: var(--admin-primary-soft);
  outline: none;
}

.benchmark-chart-labels {
  display: grid;
  min-width: 520px;
  padding: 2px 10px 0 42px;
  color: var(--admin-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.benchmark-chart-labels span:only-child {
  grid-column: 1 / -1;
}

.benchmark-swatch-p50 { background: var(--admin-primary); }
.benchmark-swatch-p95 { background: #b45309; }
.benchmark-swatch-input { background: #2a78d6; }
.benchmark-swatch-output { background: #008300; }

.benchmark-token-card,
.benchmark-health-table-card {
  margin-top: 20px;
}

.benchmark-token-chart {
  min-height: 224px;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  padding: 12px 10px 0;
  border-bottom: 1px solid var(--admin-border-strong);
  overflow-x: auto;
}

.benchmark-token-column {
  width: 38px;
  flex: 0 0 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--admin-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.benchmark-token-stack {
  width: 28px;
  height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
}

.benchmark-token-stack span {
  width: 100%;
  display: block;
  min-height: 1px;
  margin: 0 !important;
}

.benchmark-token-input {
  border-radius: 0 0 4px 4px;
  background: #2a78d6;
}

.benchmark-token-output {
  border-radius: 4px 4px 0 0;
  background: #008300;
}

.benchmark-token-stack:hover,
.benchmark-token-stack:focus-visible {
  filter: brightness(1.08);
  outline: 3px solid rgba(26, 115, 232, 0.2);
  outline-offset: 3px;
}

.benchmark-health-table {
  min-width: 980px;
}

.benchmark-health-table .is-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.benchmark-health-table td.is-numeric {
  color: var(--admin-text);
  font-weight: 600;
}

.benchmark-health-table td.is-alert {
  color: #b3261e;
}

.benchmark-health-empty {
  padding: 52px 24px;
  text-align: center;
}

.benchmark-health-empty .material-symbols-outlined {
  color: var(--admin-primary);
  font-size: 42px;
}

.benchmark-health-empty h3 {
  margin: 10px 0 4px;
  color: var(--admin-text);
  font-size: 16px;
}

.benchmark-health-empty p {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.chatviz-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chatviz-title {
  font-size: 15px;
  font-weight: 800;
  color: #111c2d;
}

.chatviz-subtitle {
  font-size: 12px;
  color: var(--admin-muted);
  margin-top: 2px;
}

.chatviz-legend {
  display: flex;
  gap: 16px;
  margin: 4px 0 18px;
  font-size: 12px;
  font-weight: 700;
  color: var(--admin-muted);
}

.chatviz-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chatviz-legend-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}


.chatviz-tooltip {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  background: #111c2d;
  color: #ffffff;
  font-size: 12px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translate(-50%, calc(-100% - 10px));
  transition: opacity 120ms ease;
  white-space: nowrap;
}

.chatviz-tooltip.is-visible {
  opacity: 1;
}

.chatviz-tooltip strong {
  font-weight: 800;
}

@media (max-width: 640px) {
  .benchmark-health-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .benchmark-chart-point {
    transition: none;
  }
}

/* Admin student chat report */
.student-chat-report-main {
  padding-top: 42px;
}

.student-chat-report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.student-chat-report-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) minmax(210px, 1.2fr) minmax(145px, 0.7fr) minmax(145px, 0.7fr) auto;
  align-items: end;
  gap: 14px;
  margin-bottom: 20px;
  padding: 18px;
}

.student-chat-report-filter-actions {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-chat-report-filter-button,
.student-chat-report-reset-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.student-chat-report-filter-button {
  border: 1px solid var(--admin-primary);
  background: var(--admin-primary);
  color: #fff;
}

.student-chat-report-filter-button:hover {
  border-color: var(--admin-primary-hover);
  background: var(--admin-primary-hover);
}

.student-chat-report-filter-button .material-symbols-outlined {
  font-size: 18px;
}

.student-chat-report-reset-button {
  border: 1px solid var(--admin-border);
  background: var(--admin-surface);
  color: var(--admin-muted);
}

.student-chat-report-reset-button:hover {
  border-color: var(--admin-border-strong);
  color: var(--admin-text);
}

.student-chat-report-stats {
  margin-top: 0;
}

.student-chat-report-token-value {
  font-size: 21px;
}

.student-chat-report-token-value span {
  color: var(--admin-border-strong);
}

.student-chat-report-session-card {
  margin-top: 20px;
}

.student-chat-report-session-table {
  min-width: 1020px;
}

.student-chat-report-session-table .is-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.student-chat-report-session-table td.is-numeric {
  color: var(--admin-text);
  font-weight: 600;
}

.student-chat-report-session-table tr.is-selected td {
  background: rgba(26, 115, 232, 0.07);
}

.student-chat-report-session-table tr.is-selected td:first-child {
  box-shadow: inset 3px 0 var(--admin-primary);
}

.student-chat-report-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 18px 4px 0;
  border-top: 1px solid var(--admin-border);
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 700;
}

.student-chat-report-pagination a {
  padding: 7px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  color: var(--admin-primary);
  text-decoration: none;
}

.student-chat-report-pagination a:hover {
  border-color: var(--admin-primary);
  background: var(--admin-primary-soft);
}

.student-chat-analysis-header {
  margin-top: 34px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--admin-border);
}

.student-chat-analysis-header h2 {
  margin: 2px 0 4px;
  color: var(--admin-text);
  font-family: Manrope, Inter, sans-serif;
  font-size: 24px;
}

.student-chat-analysis-header p:last-child {
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
}

.student-chat-report-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.student-chat-report-chart-card {
  min-width: 0;
  overflow: hidden;
}

.student-chat-turn-chart {
  min-height: 220px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 14px 8px 0;
  border-bottom: 1px solid var(--admin-border-strong);
  overflow-x: auto;
}

.student-chat-turn-chart-column {
  width: 40px;
  flex: 0 0 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--admin-muted);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.student-chat-token-bars {
  height: 184px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  cursor: pointer;
}

.student-chat-token-bars > span {
  width: 16px;
  min-height: 2px;
  display: block;
  margin: 0 !important;
  border-radius: 4px 4px 0 0;
}

.student-chat-input-bar,
.student-chat-input-swatch {
  background: #2a78d6;
}

.student-chat-output-bar,
.student-chat-output-swatch {
  background: #008300;
}

.student-chat-latency-bar {
  width: 25px;
  min-height: 2px;
  max-height: 184px;
  border-radius: 5px 5px 0 0;
  background: #b45309;
  cursor: pointer;
}

.student-chat-token-bars:hover,
.student-chat-token-bars:focus-visible,
.student-chat-latency-bar:hover,
.student-chat-latency-bar:focus-visible {
  filter: brightness(1.08);
  outline: 3px solid rgba(26, 115, 232, 0.2);
  outline-offset: 3px;
}

.student-chat-report-chart-empty {
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--admin-muted);
  font-size: 13px;
  text-align: center;
}

.student-chat-report-turns {
  margin-top: 28px;
}

.student-chat-report-turns-header {
  margin-bottom: 14px;
}

.student-chat-turn-card {
  padding: 0;
  overflow: hidden;
}

.student-chat-turn-card + .student-chat-turn-card {
  margin-top: 12px;
}

.student-chat-turn-card > summary {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto 22px;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  list-style: none;
  cursor: pointer;
}

.student-chat-turn-card > summary::-webkit-details-marker {
  display: none;
}

.student-chat-turn-card > summary:hover {
  background: var(--admin-surface-soft);
}

.student-chat-turn-number {
  width: 30px;
  height: 30px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  border-radius: 9px;
  background: var(--admin-primary-soft);
  color: var(--admin-primary) !important;
  font-size: 12px !important;
  font-weight: 800;
}

.student-chat-turn-summary-text {
  min-width: 0;
  display: block !important;
  margin: 0 !important;
}

.student-chat-turn-summary-text strong,
.student-chat-turn-summary-text small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-chat-turn-summary-text strong {
  color: var(--admin-text);
  font-size: 14px;
}

.student-chat-turn-summary-text small {
  margin-top: 3px;
  color: var(--admin-muted);
  font-size: 11px;
}

.student-chat-turn-status {
  display: inline-flex !important;
  align-items: center;
  min-height: 24px;
  margin: 0 !important;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--admin-success-soft);
  color: var(--admin-success) !important;
  font-size: 11px !important;
  font-weight: 800;
  white-space: nowrap;
}

.student-chat-turn-status-no-saved-response,
.student-chat-turn-status-unpaired-response {
  background: #fdeced;
  color: #b3261e !important;
}

.student-chat-turn-status-usage-unavailable {
  background: var(--admin-warning-soft);
  color: var(--admin-warning) !important;
}

.student-chat-turn-chevron {
  margin: 0 !important;
  color: var(--admin-muted);
  font-size: 20px;
  transition: transform 160ms ease;
}

.student-chat-turn-card[open] .student-chat-turn-chevron {
  transform: rotate(180deg);
}

.student-chat-turn-content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border-top: 1px solid var(--admin-border);
  background: var(--admin-surface-soft);
}

.student-chat-message-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  background: var(--admin-surface);
}

.student-chat-message-panel > header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}

.student-chat-message-panel > header .material-symbols-outlined {
  color: var(--admin-primary);
  font-size: 19px;
}

.student-chat-message-panel > header strong {
  color: var(--admin-text);
  font-size: 13px;
}

.student-chat-message-panel > header time {
  margin-left: auto;
  color: var(--admin-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.student-chat-message-panel > p,
.student-chat-report-markdown {
  margin: 0;
  color: var(--admin-text);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.student-chat-report-markdown {
  white-space: normal;
}

.student-chat-report-markdown > :first-child { margin-top: 0; }
.student-chat-report-markdown > :last-child { margin-bottom: 0; }
.student-chat-report-markdown p,
.student-chat-report-markdown ul,
.student-chat-report-markdown ol,
.student-chat-report-markdown pre,
.student-chat-report-markdown blockquote,
.student-chat-report-markdown table { margin: 10px 0; }
.student-chat-report-markdown ul,
.student-chat-report-markdown ol { padding-left: 22px; }
.student-chat-report-markdown pre { max-width: 100%; overflow-x: auto; padding: 12px; border-radius: 8px; background: #111c2d; color: #fff; }
.student-chat-report-markdown code { padding: 2px 4px; border-radius: 4px; background: var(--admin-primary-soft); }
.student-chat-report-markdown pre code { padding: 0; background: transparent; }
.student-chat-report-markdown table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.student-chat-report-markdown th,
.student-chat-report-markdown td { padding: 7px 9px; border: 1px solid var(--admin-border); }
.student-chat-report-markdown a { color: var(--admin-primary); }

.student-chat-report-missing {
  color: #b3261e !important;
  font-style: italic;
}

.student-chat-turn-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--admin-border);
}

.student-chat-turn-metrics > div {
  min-width: 0;
  padding: 10px 12px;
  background: var(--admin-surface);
}

.student-chat-turn-metrics dt {
  color: var(--admin-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.student-chat-turn-metrics dd {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--admin-text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-chat-citations {
  grid-column: 1 / -1;
  padding: 14px;
  border: 1px solid #d0e1fb;
  border-radius: 10px;
  background: rgba(208, 225, 251, 0.25);
}

.student-chat-citations h4 {
  margin: 0 0 8px;
  color: var(--admin-text);
  font-size: 12px;
}

.student-chat-citations ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 22px;
}

.student-chat-citations li {
  color: var(--admin-text);
  font-size: 12px;
}

.student-chat-citations li span {
  display: block;
  margin-top: 2px;
  color: var(--admin-muted);
  font-size: 11px;
}

@media (max-width: 1120px) {
  .student-chat-report-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-chat-report-filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .student-chat-report-filters,
  .student-chat-report-chart-grid,
  .student-chat-turn-content {
    grid-template-columns: 1fr;
  }

  .student-chat-report-filter-actions {
    grid-column: auto;
  }

  .student-chat-turn-card > summary {
    grid-template-columns: 32px minmax(0, 1fr) 22px;
  }

  .student-chat-turn-status {
    grid-column: 2;
    width: fit-content;
  }

  .student-chat-turn-chevron {
    grid-column: 3;
    grid-row: 1;
  }

  .student-chat-turn-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .student-chat-turn-chevron {
    transition: none;
  }
}
