/* ===== Dashboard layout ===== */
.dashboard {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.dashboard__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.dashboard__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Period switch */
.period-switch {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
}
.period-switch__btn {
  padding: 0.45rem 0.85rem;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s;
}
.period-switch__btn:hover { color: var(--primary); }
.period-switch__btn.is-active {
  background: var(--primary);
  color: #fff;
}

/* ===== KPI grid ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
  padding: 1.4rem 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.kpi-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 19px;
}
.kpi-card__icon--blue { background: var(--primary-50); }
.kpi-card__icon--sky { background: rgba(159, 212, 239, 0.25); }
.kpi-card__icon--green { background: rgba(16, 185, 129, 0.12); }
.kpi-card__icon--amber { background: rgba(245, 158, 11, 0.12); }
.kpi-card__value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.1;
}
.kpi-card__label {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text-muted);
}
#mainChart {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== Agents section ===== */
.agents-section {
  margin-bottom: 2rem;
}
.agents-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.section-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.badge {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary);
}

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.agent-tile {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-md);
  border-radius: 18px;
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.agent-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-sky);
}
.agent-tile__head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
}
.agent-tile__avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(48, 116, 243, 0.2);
}
.agent-tile__name-wrap {
  flex: 1;
  min-width: 0;
}
.agent-tile__name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-tile__llm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  padding: 2px 7px;
  background: var(--bg-base);
  border-radius: 999px;
}
.agent-tile__status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  margin-top: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.agent-tile__status--paused { background: var(--neutral); box-shadow: 0 0 0 3px rgba(160, 164, 173, 0.25); }

.agent-tile__stats {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.agent-tile__calls {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.agent-tile__calls-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.agent-tile__calls-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.agent-tile__trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  margin-top: 4px;
  width: fit-content;
}
.agent-tile__trend--up { color: #047857; background: rgba(16, 185, 129, 0.12); }
.agent-tile__trend--down { color: #b91c1c; background: rgba(239, 68, 68, 0.1); }

.agent-tile__spark {
  width: 120px;
  height: 44px;
}
.agent-tile__spark svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* ===== Secondary stats grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.stat-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-md);
  border-radius: 18px;
  padding: 1.4rem 1.5rem;
}
.stat-card__title {
  margin: 0 0 0.15rem;
  font-size: 15px;
  font-weight: 600;
}
.stat-card__subtitle {
  margin: 0 0 1.1rem;
  font-size: 12.5px;
  color: var(--text-muted);
}
.stat-card__note {
  margin: 0.85rem 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Token bar */
.token-bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.85rem;
  background: var(--bg-base);
}
.token-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
  font-size: 13px;
}
.token-legend strong { font-weight: 600; font-size: 14px; }
.token-legend small { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.token-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.token-footer .label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.token-footer strong { font-size: 15px; font-weight: 600; }

/* Top list */
.top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  counter-reset: top;
}
.top-list li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  counter-increment: top;
}
.top-list li::before {
  content: counter(top);
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-50);
  color: var(--primary);
}
.top-list__name { flex: 1; font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-list__value { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.top-list__pct {
  flex-basis: 100%;
  height: 3px;
  background: var(--bg-base);
  border-radius: 2px;
  margin-top: 4px;
  order: 99;
  overflow: hidden;
}
.top-list__pct span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-sky));
  border-radius: 2px;
}
.top-list li {
  flex-wrap: wrap;
  row-gap: 0;
}

/* Activity list */
.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.activity-list li {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
.activity-list li:last-child { border-bottom: none; padding-bottom: 0; }
.activity-list__icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: var(--primary-50);
  flex-shrink: 0;
}
.activity-list__text {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
  min-width: 0;
}
.activity-list__text strong { font-weight: 600; }
.activity-list__time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .dashboard { padding: 1.75rem 1.25rem 3rem; }
  .chart-card__body { height: 220px; }
}
@media (max-width: 640px) {
  .dashboard { padding: 1.25rem 0.75rem 2.5rem; }
  .dashboard__header { flex-direction: column; align-items: flex-start; }
  .kpi-card__value { font-size: 24px; }
  .agent-tile__spark { width: 90px; }
}

.form-label.required::after,
label.required::after {
  content: " *";
  color: var(--tblr-danger, #d63939);
}

.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}
.detail-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.detail-chip i {
  color: var(--primary);
  font-size: 14px;
}

.detail-alert {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 14px;
  flex-wrap: wrap;
}
.detail-alert__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  font-size: 18px;
  flex-shrink: 0;
}
.detail-alert__text {
  flex: 1;
  min-width: 200px;
  font-size: 13.5px;
  color: var(--text);
}
.detail-alert__text strong {
  display: block;
  font-size: 14px;
}
.detail-alert--info {
  background: rgba(48, 116, 243, 0.08);
  border-color: rgba(48, 116, 243, 0.25);
}
.detail-alert--info .detail-alert__icon {
  background: rgba(48, 116, 243, 0.12);
  color: var(--primary);
}
.detail-alert--danger {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
}
.detail-alert--danger .detail-alert__icon {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}
.detail-alert--success {
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.3);
}
.detail-alert--success .detail-alert__icon {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}
.detail-alert__close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
  cursor: pointer;
}
.detail-alert__close:hover {
  color: var(--text);
}

.billing-details {
  position: relative;
}

.billing-details__loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(108, 117, 125, 0.35);
}

.billing-details:has(.billing-details__business input:not(:checked)) .billing-details__tax-id {
  display: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 1.25rem;
  align-items: start;
}
.detail-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}
.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.detail-head .stat-card__subtitle { margin-bottom: 1rem; }
.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.detail-link:hover { text-decoration: underline; }

.source-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.source-list li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}
.source-list li:first-child { padding-top: 0; }
.source-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.source-list__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.source-list__icon--document { background: rgba(239, 68, 68, 0.1); color: #b91c1c; }
.source-list__icon--webpage { background: var(--primary-50); color: var(--primary); }
.source-list__icon--product_feed { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.source-list__icon--integration { background: rgba(16, 185, 129, 0.12); color: #047857; }
.source-list__body {
  flex: 1;
  min-width: 0;
}
.source-list__name {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-list__meta {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.source-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.source-status--draft { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.source-status--pending { background: rgba(160, 164, 173, 0.15); color: var(--text-muted); }
.source-status--processing { background: var(--primary-50); color: var(--primary); }
.source-status--synced { background: rgba(16, 185, 129, 0.12); color: #047857; }
.source-status--failed { background: rgba(239, 68, 68, 0.1); color: #b91c1c; }

.detail-empty {
  text-align: center;
  padding: 1.75rem 1rem;
}
.detail-empty__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  margin: 0 auto 0.85rem;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 24px;
}
.detail-empty p {
  margin: 0 0 1rem;
  font-size: 13.5px;
  color: var(--text-muted);
}

.instructions-text {
  margin: 0;
  padding: 1rem 1.1rem;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.embed-box { position: relative; }
.embed-box pre {
  margin: 0;
  padding: 1rem 2.75rem 1rem 1rem;
  background: #0f1e36;
  color: #cfe0ff;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}
.embed-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: #cfe0ff;
  cursor: pointer;
  transition: background 0.2s;
}
.embed-copy:hover { background: rgba(255, 255, 255, 0.24); }

.detail-kv {
  list-style: none;
  margin: 0;
  padding: 0;
}
.detail-kv li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.detail-kv li:first-child { padding-top: 0; }
.detail-kv li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.detail-kv__label {
  color: var(--text-muted);
  white-space: nowrap;
}
.detail-kv__value {
  font-weight: 500;
  text-align: right;
  min-width: 0;
  overflow-wrap: anywhere;
}

.quick-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
.quick-links li { border-bottom: 1px solid var(--border); }
.quick-links li:last-child { border-bottom: none; }
.quick-links a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.25rem;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.quick-links a:hover {
  background: var(--bg-base);
  color: var(--primary);
}
.quick-links a > i:first-child {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 15px;
  flex-shrink: 0;
}
.quick-links a .ti-chevron-right {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 14px;
}

.detail-danger {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem;
  border: 1px dashed rgba(239, 68, 68, 0.35);
  border-radius: 14px;
}
.detail-danger__text {
  font-size: 13px;
  color: var(--text-muted);
}
.detail-danger__text strong {
  display: block;
  font-size: 13.5px;
  color: var(--text);
}
.wiz-btn--danger {
  background: #fff;
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}
.wiz-btn--danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.08);
  border-color: var(--danger);
}

@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 960px) {
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .detail-danger {
    flex-direction: column;
    align-items: flex-start;
  }
}

.agl-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.agl-head h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.agl-limit { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 6px 0 0; font-size: 14px; color: var(--text-muted); }
.agl-limit a { color: var(--primary); font-weight: 600; text-decoration: none; }
.agl-dots { display: inline-flex; gap: 3px; }
.agl-dots i { width: 18px; height: 6px; border-radius: 3px; background: #dfe3ea; }
.agl-dots i.on { background: var(--primary); }
.cu { --cu: var(--primary); display: flex; align-items: center; gap: 0.7rem 1rem; flex-wrap: wrap; margin: 0 0 1rem; padding: 8px 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; font-size: 13px; }
.cu--warn { --cu: #f59e0b; background: #fffaf0; }
.cu--danger { --cu: #dc2626; background: #fff5f5; }
.cu__ic { font-size: 18px; line-height: 1; color: var(--cu); }
.cu__body { display: flex; align-items: center; gap: 0.7rem; flex: 0 1 auto; min-width: 0; }
.cu__k { color: var(--text-muted); }
.cu__num { display: flex; align-items: baseline; gap: 0.25rem; white-space: nowrap; }
.cu__num b { font-size: 15px; }
.cu__num span { color: var(--text-muted); }
.cu__bar { width: 110px; height: 6px; border-radius: 3px; background: #e8ecf2; overflow: hidden; }
.cu__bar i { display: block; height: 100%; border-radius: 3px; background: var(--cu); }
.cu__msg { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; font-weight: 600; color: var(--cu); }
.cu__msg .wiz-btn { padding: 3px 10px; font-size: 12px; }
.agl-head > .wiz-btn { margin-left: auto; }
.agl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.agl-card { position: relative; display: flex; flex-direction: column; background: #fff; border-radius: 20px; box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05), 0 10px 30px rgba(20, 30, 60, 0.04); transition: transform 0.15s, box-shadow 0.15s; }
.agl-card:hover { transform: translateY(-3px); box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05), 0 18px 40px rgba(20, 30, 60, 0.08); }
.agl-card__link { position: absolute; inset: 0; z-index: 1; border-radius: 20px; }
.agl-card.is-paused .agl-hero { filter: grayscale(1); opacity: 0.55; }
.agl-hero { position: relative; height: 118px; overflow: hidden; border-radius: 20px 20px 0 0; border-bottom: 1px solid rgba(22, 24, 29, 0.12); background: color-mix(in srgb, var(--c) 12%, #fff); transition: filter 0.2s, opacity 0.2s; }
.agl-hero::before { content: ""; position: absolute; right: -30px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: color-mix(in srgb, var(--c) 14%, transparent); }
.agl-mini { position: absolute; left: 20px; right: 20px; bottom: -1px; overflow: hidden; border-radius: 14px 14px 0 0; background: #fff; box-shadow: 0 -4px 16px color-mix(in srgb, var(--c) 14%, transparent); }
.agl-mini__bar { display: flex; align-items: center; gap: 7px; padding: 8px 10px; background: var(--c); color: #fff; font-size: 12px; font-weight: 600; }
.agl-mini__bar > span:not(.agl-mini__logo) { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.agl-mini__bar > i { opacity: 0.7; }
.agl-mini__logo { display: flex; flex: none; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); font-size: 12px; }
.agl-mini__msg { display: inline-block; max-width: 85%; margin: 9px 10px 10px; padding: 6px 9px; overflow: hidden; border-radius: 3px 11px 11px 11px; background: #f2f3f6; color: var(--text-muted); font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
.agl-body { flex: 1; padding: 16px 20px 4px; min-width: 0; }
.agl-name { display: block; overflow: hidden; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; text-overflow: ellipsis; }
.agl-domain { display: flex; align-items: center; gap: 4px; margin-top: 2px; overflow: hidden; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.agl-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.agl-stats small { display: block; color: var(--text-muted); font-size: 12px; }
.agl-stats b { font-size: 18px; letter-spacing: -0.02em; }
.agl-stats em { margin-left: 4px; color: #1d9e75; font-size: 12px; font-style: normal; font-weight: 600; }
.agl-stats em.is-down { color: var(--text-muted); }
.agl-foot { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.agl-foot__delete { margin-left: auto; }
.agl-switch { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; border: none; background: none; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.agl-switch__track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 999px; background: #d3d6de; transition: background 0.2s; }
.agl-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.agl-switch.is-on { color: #1d9e75; }
.agl-switch.is-on .agl-switch__track { background: #1d9e75; }
.agl-switch.is-on .agl-switch__track::after { transform: translateX(14px); }
.agl-trash { border: none; background: none; padding: 4px 6px; border-radius: 8px; color: var(--text-muted); cursor: pointer; }
.agl-trash:hover { background: #fdecec; color: #d93a3a; }
.agl-new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 300px; padding: 20px; border: 2px dashed #c9d3e3; border-radius: 20px; background: rgba(255, 255, 255, 0.45); color: var(--text-muted); text-align: center; text-decoration: none; transition: border-color 0.15s, background 0.15s; }
.agl-new:hover { border-color: var(--primary); background: rgba(255, 255, 255, 0.8); color: var(--primary); }
.agl-new b { font-size: 15px; color: var(--text); }
.agl-new span { font-size: 13px; }
.agl-new__plus { display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 16px; background: #eaf2fd; color: var(--primary); font-size: 26px; }
.agl-new--locked { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; min-height: 0; gap: 14px; padding: 16px 20px; text-align: left; }
.agl-new--locked:hover { border-color: #c9d3e3; background: rgba(255, 255, 255, 0.45); color: var(--text-muted); }
.agl-new--locked > div { flex: 1; }
.agl-new--locked b { display: block; }
.agl-new--locked .agl-new__plus { background: #f5f7fb; color: var(--text-muted); }
@media (max-width: 1000px) { .agl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .agl-grid { grid-template-columns: minmax(0, 1fr); }
  .agl-head h1 { font-size: 24px; }
  .agl-head > .wiz-btn { width: 100%; margin-left: 0; }
  .agl-new { min-height: 160px; }
}

.kb-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.kb-head h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.kb-head p { margin: 6px 0 0; color: var(--text-muted); font-size: 14px; }
.kb-head__actions { display: flex; gap: 0.5rem; margin-left: auto; }
.kb-card { background: #fff; border-radius: 20px; box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05), 0 10px 30px rgba(20, 30, 60, 0.04); }
.kb-card--empty { padding: 40px 20px; text-align: center; }
.kb-card--empty h3 { margin: 0 0 6px; font-size: 17px; }
.kb-card--empty p { margin: 0 0 20px; color: var(--text-muted); font-size: 14px; }
.kb-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.kb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.kb-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: #fff; color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.kb-chip b { color: #959bab; font-size: 12px; font-weight: 600; }
.kb-chip.is-on { border-color: var(--text); background: var(--text); color: #fff; }
.kb-chip.is-on b { color: rgba(255, 255, 255, 0.6); }
.kb-search { position: relative; width: 260px; margin-left: auto; }
.kb-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #959bab; }
.kb-input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font: inherit; font-size: 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.kb-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px #e3edfb; }
.kb-search .kb-input { padding-left: 36px; }
.kb-row { display: grid; grid-template-columns: minmax(0, 1fr) 130px 170px 170px 92px; gap: 16px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); }
.kb-row[hidden] { display: none; }
.kb-row--head { border-top: none; padding-top: 10px; padding-bottom: 10px; background: #f5f7fb; color: #959bab; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.kb-row:not(.kb-row--head):hover { background: #fafbfd; }
.kb-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.kb-name__text { min-width: 0; }
.kb-name__text b { display: block; overflow: hidden; font-size: 14px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.kb-name__text > span { display: block; overflow: hidden; color: #959bab; font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.kb-ico { display: flex; flex: none; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; font-size: 19px; }
.kb-ico--doc { background: #fdf0e7; color: #c25a1f; }
.kb-ico--web { background: #eaf2fd; color: #2f6fd0; }
.kb-ico--feed { background: #e6f6ef; color: #14855f; }
.kb-ico--int { background: #f1ebfa; color: #7f54b3; }
.kb-status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.kb-status--ok { background: #e6f6ef; color: #14855f; }
.kb-status--busy { background: #eaf2fd; color: var(--primary); }
.kb-status--err { background: #fdecec; color: #d93a3a; }
.kb-status--draft { background: #fff6e0; color: #9a6b00; }
.kb-spin { width: 11px; height: 11px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: kb-spin 0.7s linear infinite; }
@keyframes kb-spin { to { transform: rotate(360deg); } }
.kb-agents { display: flex; gap: 4px; flex-wrap: wrap; }
.kb-agents span { padding: 2px 7px; border: 1px solid var(--border); border-radius: 7px; background: #f5f7fb; color: var(--text-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.kb-muted { color: #959bab; font-size: 13px; }
.kb-sync { color: var(--text-muted); font-size: 13px; }
.kb-sync small { display: block; color: #959bab; font-size: 12px; }
.kb-sync__err { color: #d93a3a; }
.kb-acts { display: flex; justify-content: flex-end; gap: 2px; }
.kb-acts form { margin: 0; }
.kb-ib { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; border-radius: 9px; background: none; color: #959bab; font-size: 17px; cursor: pointer; text-decoration: none; }
.kb-ib:hover { background: #f5f7fb; color: var(--text); }
.kb-ib--del:hover { background: #fdecec; color: #d93a3a; }
.kb-meta { display: none; }
.kb-empty { padding: 30px 20px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 14px; text-align: center; }
.kb-empty[hidden] { display: none; }
.kb-foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; padding: 12px 18px; border-top: 1px solid var(--border); color: #959bab; font-size: 13px; }
.kb-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 760px; margin: 0 auto; }
.kb-tile { display: flex; flex-direction: column; gap: 12px; padding: 18px 16px; border: 1px solid var(--border); border-radius: 16px; background: #fff; font: inherit; text-align: left; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.kb-tile:hover { border-color: var(--primary); box-shadow: 0 6px 20px rgba(31, 111, 214, 0.1); transform: translateY(-2px); }
.kb-tile b { display: block; margin-bottom: 3px; font-size: 14.5px; }
.kb-tile span > span { color: #959bab; font-size: 12.5px; line-height: 1.4; }
.kb-modal { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 20, 35, 0.45); }
.kb-modal[hidden] { display: none; }
.kb-dlg { width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; border-radius: 20px; background: #fff; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25); }
.kb-dlg header { display: flex; align-items: flex-start; gap: 10px; padding: 20px 22px 4px; }
.kb-dlg header h3 { margin: 0; font-size: 19px; }
.kb-back, .kb-x { flex: none; width: 32px; height: 32px; border: none; border-radius: 9px; background: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.kb-back { background: #f5f7fb; }
.kb-back[hidden] { display: none; }
.kb-x { margin-left: auto; }
.kb-x:hover { background: #f5f7fb; }
.kb-dlg__body { padding: 16px 22px 22px; }
.kb-dlg .kb-pick { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.kb-dlg .kb-tile { flex-direction: row; align-items: center; gap: 14px; padding: 14px; }
.kb-drop { position: relative; display: block; padding: 30px 16px; border: 1.5px dashed #c9d3e3; border-radius: 14px; background: #f5f7fb; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.kb-drop:hover, .kb-drop.is-over { border-color: var(--primary); background: #f2f7fe; }
.kb-drop i { color: var(--primary); font-size: 28px; }
.kb-drop b { display: block; margin: 8px 0 3px; font-size: 14px; }
.kb-drop span { display: block; color: #959bab; font-size: 12.5px; line-height: 1.45; }
.kb-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.kb-field { margin-bottom: 14px; }
.kb-field label { display: block; margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.kb-hint { margin: 6px 0 0; color: #959bab; font-size: 12.5px; line-height: 1.45; }
.kb-check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; }
.kb-check small { display: block; color: #959bab; font-size: 12.5px; font-weight: 400; }
.kb-dlg footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
@media (max-width: 900px) {
  .kb-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kb-row--head { display: none; }
  .kb-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name acts" "meta meta"; gap: 8px 12px; padding: 14px 16px; }
  .kb-row > .kb-name { grid-area: name; }
  .kb-row > .kb-acts { grid-area: acts; }
  .kb-row > .kb-col { display: none; }
  .kb-row > .kb-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-left: 50px; }
  .kb-search { order: -1; width: 100%; margin-left: 0; }
}
@media (max-width: 600px) {
  .kb-head__actions { width: 100%; margin-left: 0; }
  .kb-head__actions .wiz-btn { flex: 1; }
  .kb-pick { grid-template-columns: minmax(0, 1fr); }
  .kb-row > .kb-meta { padding-left: 0; }
}

.dsh { --accent: #1f6fd6; --ink: #16181d; --ink2: #5b6170; --ink3: #959bab; --line: #e6e8ee; --grid: #eef0f4; --ok: #1d9e75; --danger: #d93a3a; color: var(--ink); }
.dsh [hidden] { display: none !important; }
.dsh-head { margin-bottom: 18px; }
.dsh-head h1 { margin: 0; font-size: 30px; letter-spacing: -0.02em; }
.dsh-head p { margin: 6px 0 0; color: var(--ink2); font-size: 14px; }
.dsh-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.dsh-seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.dsh-seg button { padding: 7px 12px; border: none; border-radius: 9px; background: none; color: var(--ink2); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.dsh-seg button.on { background: var(--ink); color: #fff; }
.dsh-sel { padding: 8px 32px 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b6170' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center; font: inherit; font-size: 13px; font-weight: 600; appearance: none; cursor: pointer; }
[data-dashboard-target='scope'] { transition: opacity 0.2s; }
.dsh-sec { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.dsh-sec h2 { margin: 0; font-size: 17px; }
.dsh-sec .more { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.dsh-car-nav { display: flex; gap: 6px; order: 3; }
.dsh-car-nav button { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink2); cursor: pointer; }
.dsh-car-nav button:disabled { opacity: 0.4; cursor: default; }
.dsh-car { display: flex; gap: 14px; margin: 0 -4px 2px; padding: 4px 4px 18px; overflow-x: auto; scroll-behavior: smooth; scroll-padding-inline: 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.dsh-car::-webkit-scrollbar { display: none; }
.dsh-car .agl-card { flex: 0 0 calc((100% - 28px) / 3); scroll-snap-align: start; }
.dsh-car .agl-foot { margin-top: 0; }
.agl-status { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.agl-status.is-on { color: #1d9e75; }
.dsh-card { padding: 20px 22px; border-radius: 20px; background: #fff; box-shadow: 0 1px 3px rgba(20, 30, 60, 0.05), 0 10px 30px rgba(20, 30, 60, 0.04); }
.dsh-card h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; }
.dsh-card .sub { margin: 3px 0 14px; color: var(--ink3); font-size: 12.5px; }
.dsh-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.dsh-tile { padding: 16px 18px; }
.dsh-tile small { display: flex; align-items: center; gap: 6px; color: var(--ink2); font-size: 12.5px; font-weight: 500; }
.dsh-tile small i { color: var(--ink3); font-size: 16px; }
.dsh-tile .v { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.dsh-tile b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.dsh-tile .d { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 700; }
.dsh-tile .d.up { color: var(--ok); }
.dsh-tile .d.down { color: var(--danger); }
.dsh-tile .d.flat { color: var(--ink3); }
.dsh-tile .vs { margin-top: 2px; color: var(--ink3); font-size: 11.5px; }
.dsh-tile svg { display: block; width: 100%; height: 30px; margin-top: 8px; }
.dsh-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.dsh-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: -4px 0 8px; color: var(--ink2); font-size: 12.5px; }
.dsh-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dsh-legend i { display: inline-block; width: 14px; height: 2px; border-radius: 2px; }
.dsh-chart { position: relative; }
.dsh-chart svg { display: block; width: 100%; overflow: visible; }
.dsh-chart .ax { fill: var(--ink3); font-size: 11px; font-variant-numeric: tabular-nums; }
.dsh-tip { position: absolute; z-index: 3; min-width: 150px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 8px 24px rgba(20, 30, 60, 0.12); font-size: 12.5px; opacity: 0; transition: opacity 0.1s; pointer-events: none; }
.dsh-tip.on { opacity: 1; }
.dsh-tip .t { margin-bottom: 5px; color: var(--ink3); font-size: 11.5px; }
.dsh-tip .l { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.dsh-tip .l i { flex: none; width: 12px; height: 2px; border-radius: 2px; }
.dsh-tip .l b { min-width: 32px; font-variant-numeric: tabular-nums; }
.dsh-tip .l span { color: var(--ink2); }
.dsh-tview { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 0; border: none; background: none; color: var(--ink3); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.dsh-tview:hover { color: var(--ink); }
.dsh-tblwrap { max-height: 220px; overflow: auto; }
.dsh-dt { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dsh-dt th, .dsh-dt td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: right; }
.dsh-dt th:first-child, .dsh-dt td:first-child { text-align: left; }
.dsh-dt th { border-top: none; color: var(--ink3); font-weight: 600; }
.dsh-heat { display: grid; grid-template-columns: 28px repeat(24, minmax(0, 1fr)); gap: 2px; color: var(--ink3); font-size: 10.5px; }
.dsh-heat .c { position: relative; aspect-ratio: 1; border-radius: 3px; }
.dsh-heat .c:hover { outline: 2px solid var(--ink); outline-offset: -1px; }
.dsh-heat .dl { display: flex; align-items: center; }
.dsh-heat .hl { padding-top: 4px; text-align: center; }
.dsh-scale { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 10px; color: var(--ink3); font-size: 11.5px; }
.dsh-scale i { display: inline-block; width: 16px; height: 10px; border-radius: 2px; }
@media (max-width: 980px) {
  .dsh-row { grid-template-columns: minmax(0, 1fr); }
  .dsh-car .agl-card { flex-basis: calc((100% - 14px) / 2); }
}
@media (max-width: 600px) {
  .dsh-head h1 { font-size: 24px; }
  .dsh-car .agl-card { flex-basis: 86%; }
  .dsh-card { padding: 16px; }
  .dsh-tile { padding: 14px; }
  .dsh-tile b { font-size: 22px; }
  .dsh-seg { flex: 1; }
  .dsh-seg button { flex: 1; padding: 7px 6px; }
  .dsh-sel { flex: 1; }
  .dsh-heat { grid-template-columns: 22px repeat(24, minmax(0, 1fr)); gap: 1px; font-size: 9.5px; }
}
