.topbar { position: sticky; top: 0; z-index: 30; }

.auth-wrap {
  min-height: calc(100vh - 62px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.auth-card { width: 100%; max-width: 420px; padding: 22px; }
.auth-card h3 { margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tab {
  border: none;
  background: none;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.row { display: flex; gap: 8px; }
.row .btn { flex: 0 0 auto; height: 38px; }
.block { width: 100%; height: 38px; }
.auth-error {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--rose-soft);
  color: var(--rose);
  font-size: 12.8px;
}

.dash {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 22px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.claim-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: #f6dc9a;
  background: #fffbeb;
}
.claim-bar b { font-size: 14px; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.kpi .label { font-size: 12.5px; color: var(--text-3); }
.kpi .value { font-size: 25px; font-weight: 680; letter-spacing: -.02em; margin-top: 2px; }
.kpi .sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card h3 { font-size: 13.5px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input { width: 250px; height: 32px; padding: 0 10px; }
.filters select { width: 130px; height: 32px; padding: 0 8px; }

.bar-chart { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 74px 1fr 34px; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-track { height: 9px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6366f1, #4f46e5); }
.bar-fill.teal { background: linear-gradient(90deg, #14b8a6, #0d9488); }
.bar-fill.amber { background: linear-gradient(90deg, #f59e0b, #d97706); }
.bar-value { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

.trend { display: flex; align-items: flex-end; gap: 8px; height: 148px; padding-top: 6px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; }
.trend-bar {
  width: 100%;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, #818cf8, #4f46e5);
  min-height: 3px;
  transition: height .3s ease;
}
.trend-label { font-size: 11px; color: var(--text-3); }
.trend-num { font-size: 11.5px; font-weight: 600; color: var(--text-2); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 11px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table th { background: #fafbff; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.table tbody tr:hover { background: #fbfcff; }
.table tbody tr:last-child td { border-bottom: none; }
.cell-clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--text-2); }

.faq-form { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.faq-form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.faq-form-row input { flex: 1 1 240px; }
.faq-form-row select { width: 140px; }

.drawer-mask { position: fixed; inset: 0; z-index: 40; background: rgba(16, 24, 40, .32); }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 50;
  width: min(520px, 100vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -12px 0 48px rgba(16, 24, 40, .18);
  animation: drawer-in .22s ease;
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #fbfbfe; }
.agent-form { border-top: 1px solid var(--line); padding: 12px 16px; background: #fff; }
.agent-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.dmsg { display: flex; gap: 8px; align-items: flex-start; }
.dmsg-user { flex-direction: row-reverse; }
.dmsg .avatar { width: 26px; height: 26px; flex: 0 0 26px; font-size: 10px; border-radius: 8px; }
.dmsg .bubble {
  max-width: 84%;
  padding: 8px 11px;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line-soft);
  background: #fff;
}
.dmsg-user .bubble { background: linear-gradient(135deg, #4f46e5, #6d28d9); color: #fff; border-color: transparent; }
.dmsg-agent .bubble { background: var(--teal-soft); border-color: #cdeee7; }
.dmsg-system { justify-content: center; }
.dmsg-system span {
  padding: 5px 11px; border-radius: 999px;
  background: var(--bg-soft); border: 1px dashed var(--line);
  font-size: 12px; color: var(--text-2);
}
.dmsg-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; font-size: 11px; color: var(--text-3); }
.dmsg-user .dmsg-meta { justify-content: flex-end; }

.rate-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px solid #dfe2ff;
  font-size: 12.8px;
  color: var(--primary-dark);
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .dash { padding: 14px; }
  .filters input { width: 100%; }
}
