:root {
  --ink: #0F172A;
  --ink-soft: #1E293B;
  --ink-softer: #334155;
  --paper: #F8FAFC;
  --card: #F8FAFC;
  --paper-dim: #F1F5F9;
  --paper-line: #E2E8F0;
  --line: rgba(15, 23, 42, 0.07);
  --line-strong: rgba(15, 23, 42, 0.14);
  --teal: #4F46E5;
  --teal-deep: #4338CA;
  --teal-tint: #EDE9FE;
  --amber: #B45309;
  --amber-tint: #FEF3C7;
  --red: #EF4444;
  --red-tint: #FEE2E2;
  --seal: #6D28D9;
  --slate: #475569;
  --slate-light: #94A3B8;
  --white: #FFFFFF;
  --green: #10B981;
  --green-deep: #047857;
  --green-tint: #D1FAE5;
  --grad: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  --radius: 14px;
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, .05);
  --shadow-md: 0 10px 30px -5px rgba(15, 23, 42, .07), 0 4px 12px -2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, .1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

::selection {
  background: var(--teal);
  color: white;
}

h1,
h2,
h3,
h4 {
  font-family: 'Inter', sans-serif;
  margin: 0;
  letter-spacing: -0.01em;
}

.mono {
  font-family: 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
}

a {
  color: inherit;
}

/* ===== Focus ===== */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ===== App shell ===== */
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  transition: grid-template-columns .22s cubic-bezier(.4, 0, .2, 1);
}

.app.collapsed {
  grid-template-columns: 76px 1fr;
}

/* ===== Sidebar ===== */
.sidebar {
  background: var(--paper);
  color: var(--slate);
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);

}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .6);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-name {
  font-family: 'Inter';
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}

.brand-tag {
  font-size: 10.5px;
  color: var(--slate-light);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-top: 2px;
}

.client-switch {
  margin-bottom: 18px;
  padding: 10px 10px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.client-switch label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--slate-light);
  margin-bottom: 6px;
}

.client-switch select {
  width: 100%;
  background: transparent;
  color: var(--ink);
  border: none;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 0;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394a3b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
}

.client-switch select option {
  color: var(--ink);
}

nav.navlist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.navlink {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9999px;
  color: var(--slate);
  background: none;
  border: none;
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  width: 100%;
  text-decoration: none;
  transition: background .18s cubic-bezier(.4, 0, .2, 1), color .18s cubic-bezier(.4, 0, .2, 1);
}

.navlink svg {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: .85;
}

.navlink:hover {
  background: var(--paper-dim);
  color: var(--ink);
}

.navlink.active {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 20px -6px rgba(79, 70, 229, .55);
}

.navlink.active svg {
  opacity: 1;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--slate-light);
  padding: 14px 10px 6px;
}

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.avatar-ring {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--grad);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(79, 70, 229, .3);
}

.sidebar-foot .who {
  line-height: 1.2;
}

.sidebar-foot .who .name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.sidebar-foot .who .role {
  font-size: 11px;
  color: var(--slate-light);
}

/* ===== Sidebar collapse ===== */
.sidebar-collapse-btn {
  position: absolute;
  top: 26px;
  right: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--slate);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  z-index: 5;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--paper-dim);
  color: var(--ink);
}

.sidebar-collapse-btn svg {
  width: 13px;
  height: 13px;
  transition: transform .22s ease;
}

.app.collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}

.app.collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
  overflow: visible;
}

.app.collapsed .brand {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.app.collapsed .brand-text {
  display: none;
}

.app.collapsed .client-switch {
  display: none;
}

.app.collapsed .nav-section-label {
  height: 1px;
  padding: 0;
  margin: 10px 6px;
  background: var(--line);
  font-size: 0;
  line-height: 0;
  color: transparent;
  overflow: hidden;
}

.app.collapsed .navlink {
  justify-content: center;
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0 auto;
}

.app.collapsed .navlink-label {
  display: none;
}

.app.collapsed .navlink:hover::after,
.app.collapsed .sidebar-foot:hover::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  animation: tipin .12s ease;
}

@keyframes tipin {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

.app.collapsed .sidebar-foot {
  justify-content: center;
  position: relative;
}

.app.collapsed .sidebar-foot .who {
  display: none;
}

/* ===== Global topbar ===== */
.global-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: -26px -34px 24px;
  padding: 14px 34px;
  background-color:#f8fafc;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.gt-org {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 7px 13px 7px 10px;
  border-radius: 9999px;
  background: #fff;
  border: 1px solid var(--line-strong);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.gt-org .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}

.gt-search {
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  border-radius: 9999px;
  padding: 8px 14px;
  color: var(--slate-light);
  cursor: text;
}

.gt-search:focus-within {
  border-color: var(--line-strong);
  background: #fff;
}

.gt-search svg {
  flex: none;
  width: 15px;
  height: 15px;
}

.gt-search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--ink);
  width: 100%;
  font-family: inherit;
}

.gt-search input::placeholder {
  color: var(--slate-light);
}

.gt-search kbd {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--slate-light);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 1.5px 5px;
  flex: none;
}

.gt-spacer {
  flex: 1;
}

.gt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.gt-iconbtn {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-soft);
  position: relative;
  transition: all .2s ease;
  flex: none;
}

.gt-iconbtn:hover {
  background: var(--paper-dim);
  border-color: var(--slate-light);
}

.gt-iconbtn svg {
  width: 17px;
  height: 17px;
}

.gt-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  border: 1.5px solid #fff;
}

@media (max-width:860px) {
  .global-topbar {
    margin: -20px -20px 20px;
    padding: 12px 16px;
  }

  .gt-search {
    display: none;
  }
}

/* ===== Main ===== */
.main {
  padding: 26px 34px 60px;
}

/* Every tab gets a wider, centered reading width — except live monitoring, which goes edge-to-edge. */
.view:not(#view-monitor) {
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 26px;
  gap: 20px;
  flex-wrap: wrap;
  background-color: #f8fafc;;
}

.topbar h1 {
  font-size: 23px;
  font-weight: 600;
}

.topbar .sub {
  color: var(--slate);
  font-size: 13px;
  margin-top: 5px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  transition: all .2s ease;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--paper-dim);
}

.btn svg {
  width: 14px;
  height: 14px;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .6);
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.btn-teal {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

.btn-teal:hover {
  background: var(--teal-deep);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--paper-dim);
}

.btn-danger {
  background: #fff;
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--red-tint);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

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

/* Each tab now lives on its own page, so there is no .view/.active toggling to do here. */
.view {
  display: block;
}

/* ===== Live monitor (embedded ProctorView) ===== */
#view-monitor {
  margin: 0 -34px -60px;
}

#monitorFrameWrap {
  position: relative;
  height: calc(100vh - 64px);
  min-height: 600px;
  background: #0A0E14;
}

#monitorFrame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

#monitorLoading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #0A0E14;
  color: #8B95A5;
  font-size: 13px;
  transition: opacity .25s ease;
}

#monitorLoading.hide {
  opacity: 0;
  pointer-events: none;
}

.monitor-loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4C8DFF;
  animation: monitorPulse 1s infinite ease-in-out;
}

@keyframes monitorPulse {

  0%,
  100% {
    opacity: .3;
    transform: scale(.8);
  }

  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

@media (max-width:860px) {
  #view-monitor {
    margin: 0 -20px -60px;
  }
}

/* ===== Cards / stat grid ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

@media (max-width:1080px) {
  .stat-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 15px 16px;
}

.stat-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--slate);
  margin-bottom: 8px;
  font-weight: 600;
}

.stat-card .value {
  font-family: 'Inter';
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.stat-card .value.teal {
  color: var(--green-deep);
}

.stat-card .value.amber {
  color: var(--amber);
}

.stat-card .delta {
  font-size: 11.5px;
  color: var(--slate-light);
  margin-top: 4px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-wrap: wrap;
}

.panel-head h3 {
  font-size: 15.5px;
  font-weight: 600;
}

.panel-head .hint {
  font-size: 12px;
  color: var(--slate);
}

.panel-body {
  padding: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
  align-items: start;
}

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

/* ===== Activity list ===== */
.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.activity-row:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.activity-dot.ok {
  background: var(--green);
}

.activity-dot.warn {
  background: var(--amber);
}

.activity-dot.bad {
  background: var(--red);
}

.activity-text {
  flex: 1;
  font-size: 13px;
}

.activity-text b {
  font-weight: 600;
}

.activity-time {
  font-size: 11.5px;
  color: var(--slate-light);
  font-family: 'Inter';
}

/* ===== Table ===== */
.table-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--paper);
  min-width: 220px;
}

.search-box svg {
  width: 14px;
  height: 14px;
  color: var(--slate-light);
  flex: none;
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  width: 100%;
  color: var(--ink);
}

select.filter-select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  background: var(--paper);
  color: var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--slate);
  font-weight: 600;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

thead th:hover {
  color: var(--ink);
}

thead th .arrow {
  font-size: 9px;
  margin-left: 3px;
  opacity: .5;
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

tbody tr {
  transition: background .12s ease;
}

tbody tr.clickable {
  cursor: pointer;
}

tbody tr.clickable:hover {
  background: var(--paper-dim);
}

.cand-name {
  font-weight: 600;
}

.cand-sub {
  font-size: 11.5px;
  color: var(--slate-light);
  margin-top: 1px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge.completed {
  background: var(--green-tint);
  color: var(--green-deep);
}

.badge.pending {
  background: var(--paper-dim);
  color: var(--slate);
}

.badge.expired {
  background: var(--red-tint);
  color: var(--red);
}

.badge.shortlisted {
  background: #DBEAFE;
  color: #1D4ED8;
}

.badge.rejected {
  background: var(--paper-dim);
  color: var(--slate-light);
  text-decoration: line-through;
}

.score-pill {
  font-family: 'Inter';
  font-weight: 600;
}

.integrity-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter';
  font-weight: 600;
  font-size: 12.5px;
  padding: 3px 8px;
  border-radius: 6px;
}

.integrity-chip.high {
  background: var(--green-tint);
  color: var(--green-deep);
}

.integrity-chip.mid {
  background: var(--amber-tint);
  color: var(--amber);
}

.integrity-chip.low {
  background: var(--red-tint);
  color: var(--red);
}

.integrity-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

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

/* ===== Seal / gauge ===== */
.seal {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto;
}

.seal svg {
  width: 100%;
  height: 100%;
  display: block;
}

.seal-value {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.seal-value .num {
  font-family: 'Inter';
  font-size: 27px;
  font-weight: 700;
}

.seal-value .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--slate);
  margin-top: 1px;
}

.tabbar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.tabbtn {
  padding: 9px 4px;
  margin-right: 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabbtn.active {
  color: var(--ink);
  border-bottom-color: var(--teal);
}

.tabpane {
  display: none;
}

.tabpane.active {
  display: block;
}

.qa-item {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--card);
}

.qa-item .qhead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.qa-item .q {
  font-weight: 600;
  font-size: 13.5px;
}

.qa-item .score {
  font-family: 'Inter';
  font-weight: 700;
  color: var(--teal-deep);
  font-size: 13px;
  white-space: nowrap;
}

.qa-item .transcript {
  font-size: 12.5px;
  color: var(--slate);
  line-height: 1.55;
  margin: 6px 0 8px;
  padding: 10px 12px;
  background: var(--paper);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.qa-item .feedback {
  font-size: 12px;
  color: var(--teal-deep);
  background: var(--teal-tint);
  display: inline-block;
  padding: 4px 9px;
  border-radius: 6px;
}

.fraud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}

.fraud-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.fraud-row .k {
  color: var(--slate);
}

.fraud-row .v {
  font-weight: 600;
  font-family: 'Inter';
  font-size: 12.5px;
}

.fraud-row .v.good {
  color: var(--green-deep);
}

.fraud-row .v.warn {
  color: var(--amber);
}

/* ===== Forms ===== */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.field .desc {
  font-size: 11.5px;
  color: var(--slate-light);
  margin-top: 4px;
}

.field input[type=text],
.field input[type=email],
.field input[type=number],
.field input[type=date],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal);
}

.field textarea {
  min-height: 74px;
  resize: vertical;
  font-family: 'Inter';
}

.seg {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
}

.seg button {
  flex: 1;
  padding: 9px 10px;
  border: none;
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate);
  border-right: 1px solid var(--line-strong);
}

.seg button:last-child {
  border-right: none;
}

.seg button.active {
  background: var(--ink);
  color: #fff;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--paper);
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: var(--line-strong);
  flex: none;
  transition: .15s;
}

.switch::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: .15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.switch.on {
  background: var(--teal);
}

.switch.on::after {
  left: 19px;
}

/* ===== Question library ===== */
.lib-group {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--card);
}

.lib-group-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 16px;
  cursor: pointer;
}

.lib-group-head:hover {
  background: var(--paper-dim);
}

.lib-group-head .t {
  font-weight: 600;
  font-size: 13.5px;
}

.lib-group-head .count {
  color: var(--slate);
  font-size: 12px;
}

.lib-group-body {
  display: none;
  border-top: 1px solid var(--line);
}

.lib-group.open .lib-group-body {
  display: block;
}

.lib-group.open .chev {
  transform: rotate(180deg);
}

.lib-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}

.lib-q:last-child {
  border-bottom: none;
}

/* ===== Team ===== */
.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}

.team-row:last-child {
  border-bottom: none;
}

.team-who {
  display: flex;
  align-items: center;
  gap: 11px;
}

.t-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6D28D9, #4F46E5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.team-who .nm {
  font-weight: 600;
  font-size: 13.5px;
}

.team-who .em {
  font-size: 11.5px;
  color: var(--slate-light);
}

.role-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--paper-dim);
  color: var(--slate);
}

.role-pill.admin {
  background: #DBEAFE;
  color: #1D4ED8;
}

/* ===== API ===== */
.keybox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--ink);
  border-radius: 9px;
  color: #fff;
}

.keybox .key {
  flex: 1;
  font-family: 'Inter';
  font-size: 13px;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keybox button {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.keybox button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ===== Billing ===== */
.progress-track {
  height: 9px;
  background: var(--paper-dim);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--teal-deep));
  border-radius: 99px;
  transition: width .6s cubic-bezier(.2, .8, .3, 1);
}

.plan-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.plan-row:last-child {
  border-bottom: none;
}

.plan-row .k {
  color: var(--slate);
}

.plan-row .v {
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--slate-light);
}

.empty-state svg {
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  opacity: .5;
}

.flag-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 15px;
  border-radius: 9px;
  background: var(--red-tint);
  color: var(--red);
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 16px;
}

.kbd {
  font-family: 'Inter';
  font-size: 11px;
  background: var(--paper-dim);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line-strong);
}

@media (max-width:860px) {
  .app {
    grid-template-columns: 1fr;
  }

  .app.collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .sidebar-collapse-btn {
    display: none;
  }

  .main {
    padding: 20px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-2,
  .two-col {
    grid-template-columns: 1fr;
  }
}

/* ===== API reference docs ===== */
.panel.doc-panel {
  overflow: visible;
}

.doc-jump {
  position: sticky;
  top: 64px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 0;
  margin-bottom: 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.doc-jump a {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate);
  background: var(--paper-dim);
  border: 1px solid var(--line);
  text-decoration: none;
}

.doc-jump a:hover {
  background: var(--line-strong);
  color: var(--ink);
}

.doc-section {
  margin-bottom: 40px;
  scroll-margin-top: 90px;
}

.doc-section-title {
  font-size: 16px;
  font-weight: 600;
  padding-top: 10px;
  border-top: 2px solid var(--line);
  margin-bottom: 4px;
}

.doc-section-desc {
  font-size: 13px;
  color: var(--slate);
  margin: 6px 0 16px;
}

.api-endpoint-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
  align-items: start;
}

.api-endpoint-grid .api-endpoint {
  margin-bottom: 0;
}

.api-endpoint {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.api-endpoint-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-dim);
  flex-wrap: wrap;
}

.api-method {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 5px;
  font-family: 'IBM Plex Mono', monospace;
  flex: none;
}

.api-method.get {
  background: var(--green-tint);
  color: var(--green-deep);
}

.api-method.post {
  background: #DBEAFE;
  color: #1D4ED8;
}

.api-endpoint-url {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.api-endpoint-desc {
  font-size: 12px;
  color: var(--slate);
  margin-left: auto;
}

.api-endpoint-body {
  padding: 18px;
}

.api-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--slate-light);
  margin-bottom: 8px;
}

.api-code {
  background: var(--ink);
  border-radius: 8px;
  padding: 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: #E2E8F0;
  line-height: 1.7;
  overflow-x: auto;
  margin-bottom: 12px;
}

.api-code .k {
  color: #93C5FD;
}

.api-code .s {
  color: #86EFAC;
}

.api-code .n {
  color: #FCA5A5;
}

.api-code .c {
  color: #64748B;
}

.api-code .u {
  color: #FDE68A;
}

.api-field-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  margin-bottom: 12px;
}

.api-field-table th {
  text-align: left;
  padding: 7px 12px;
  background: var(--paper-dim);
  border: 1px solid var(--line);
  font-weight: 600;
  color: var(--slate);
  font-size: 11px;
}

.api-field-table td {
  padding: 8px 12px;
  border: 1px solid var(--line);
  vertical-align: top;
}

.api-field-table tr:nth-child(even) td {
  background: var(--paper-dim);
}

.api-required {
  font-size: 10px;
  font-weight: 600;
  color: var(--red);
  background: var(--red-tint);
  padding: 1px 5px;
  border-radius: 3px;
}

.api-optional {
  font-size: 10px;
  font-weight: 600;
  color: var(--slate);
  background: var(--paper-dim);
  padding: 1px 5px;
  border-radius: 3px;
}

.api-type {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--seal);
}

.api-auth-box {
  background: var(--amber-tint);
  border: 1px solid #FDE68A;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 24px;
  font-size: 13px;
  color: #78350F;
}

.api-auth-box code {
  font-family: 'IBM Plex Mono', monospace;
  background: #FEF3C7;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

.api-auth-box strong {
  display: block;
  margin-bottom: 6px;
}

.api-auth-note {
  margin-top: 8px;
  font-size: 12px;
  color: #92400E;
}

.api-response-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: flex-start;
}

.api-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
}

.api-status.s200 {
  background: var(--green-tint);
  color: var(--green-deep);
}

.api-status.s400 {
  background: var(--red-tint);
  color: #991B1B;
}

.api-status.s401 {
  background: var(--amber-tint);
  color: #78350F;
}

.api-status-desc {
  font-size: 12px;
  color: var(--slate);
}

.api-webhook-box {
  background: var(--teal-tint);
  border: 1px solid #C7D2FE;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #3730A3;
}

.api-webhook-box strong {
  display: block;
  margin-bottom: 4px;
}

.api-inline-code {
  font-family: 'IBM Plex Mono', monospace;
  background: var(--paper-dim);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--ink);
}

.api-note {
  font-size: 12px;
  color: var(--slate);
  margin-top: 8px;
}

@media (max-width:980px) {
  .api-endpoint-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Pricing cards / billing reference ===== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.pricing-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 18px 16px;
}

.pricing-card .tier-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

.pricing-card .tier-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.pricing-card .tier-price small {
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-light);
}

.pricing-card .tier-sub {
  font-size: 12px;
  color: var(--slate-light);
  margin: 2px 0 14px;
}

.pricing-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pricing-card li {
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.pricing-card li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pricing-card li .k {
  color: var(--slate);
}

.pricing-card li .v {
  font-weight: 600;
  text-align: right;
}

.callout-info {
  background: var(--teal-tint);
  border: 1px solid #C7D2FE;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #3730A3;
}

.callout-info strong {
  display: block;
  margin-bottom: 4px;
}