/* Chaibot customer app — layered on top of site.css (shares the brand tokens). */

/* small button variant (site.css has lg/block/outline/sky but no sm) */
.btn--sm { padding: 7px 14px; font-size: 0.85rem; }

.app-body { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  border-bottom: 1px solid var(--line-0);
  background: rgba(25, 20, 15, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.app-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0;
}
.app-header__nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.app-header__nav a {
  color: var(--text-1); text-decoration: none; font-weight: 500;
  font-size: 0.92rem; padding: 7px 12px; border-radius: var(--radius-0);
  transition: var(--transition);
}
.app-header__nav a:hover { color: var(--white); background: var(--surface-0); }
.app-header__nav a.is-active { color: var(--sky-bright); }

.app-main { flex: 1; padding: 38px 0 64px; }
.app-main .container { max-width: 980px; }
.app-narrow { max-width: 460px; margin: 0 auto; }

.app-h1 { font-family: var(--font-display); font-size: 1.8rem; color: var(--white); margin: 0 0 4px; }
.app-sub { color: var(--text-2); margin: 0 0 26px; }

/* cards */
.app-card {
  background: var(--surface-0); border: 1px solid var(--line-plat);
  border-radius: var(--radius-1); padding: 22px 24px; margin-bottom: 18px;
}
.app-card h2 { font-family: var(--font-display); font-size: 1.15rem; color: var(--white); margin: 0 0 14px; }

/* flash messages */
.flash { padding: 12px 16px; border-radius: var(--radius-0); margin-bottom: 18px; font-size: 0.92rem; border: 1px solid; }
.flash--ok    { background: rgba(92,194,168,0.12);  border-color: rgba(92,194,168,0.4);  color: var(--steam-bright); }
.flash--error { background: rgba(227,107,85,0.12);  border-color: rgba(227,107,85,0.45); color: #f0a594; }
.flash--info  { background: var(--sky-faint);       border-color: var(--line-plat);      color: var(--sky-bright); }

/* forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; color: var(--text-1); margin-bottom: 6px; font-weight: 500; }
.field input, .field select {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-0);
  background: var(--ink-1); border: 1px solid var(--line-0); color: var(--text-0);
  font-family: var(--font-body); font-size: 0.95rem;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-faint); }
.field .hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }
.form-foot { margin-top: 8px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.muted-link { color: var(--text-2); font-size: 0.88rem; }

/* usage meter */
.meter { margin-top: 6px; }
.meter__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.meter__num { font-family: var(--font-display); font-size: 1.7rem; color: var(--white); }
.meter__num span { font-size: 1rem; color: var(--text-2); font-weight: 500; }
.meter__plan { font-size: 0.85rem; color: var(--text-2); }
.meter__bar { height: 10px; border-radius: 999px; background: var(--ink-1); overflow: hidden; border: 1px solid var(--line-0); }
.meter__fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--sky-deep), var(--sky-bright)); transition: width .5s var(--ease-out); }
.meter__fill.is-warn { background: linear-gradient(90deg, #c9892f, #e6b478); }
.meter__fill.is-over { background: linear-gradient(90deg, #b5503a, #e87d5f); }
.meter__foot { margin-top: 8px; font-size: 0.83rem; color: var(--text-muted); }

/* bot list */
.bot { display: flex; align-items: center; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line-0); }
.bot:first-child { border-top: 0; }
.bot__main { flex: 1; min-width: 0; }
.bot__name { color: var(--white); font-weight: 600; }
.bot__domain { color: var(--text-2); font-size: 0.86rem; word-break: break-all; }
.bot__meta { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.badge { font-size: 0.72rem; padding: 2px 9px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.badge--active   { color: var(--steam-bright); }
.badge--building { color: var(--sky-bright); }
.badge--error    { color: #f0a594; }

/* embed snippet */
.snippet {
  background: var(--black-pure); border: 1px solid var(--line-0); border-radius: var(--radius-0);
  padding: 14px; font-family: var(--font-mono); font-size: 0.82rem; color: var(--steam-bright);
  word-break: break-all; white-space: pre-wrap; line-height: 1.5;
}
.copybtn { margin-top: 10px; }

.empty { text-align: center; padding: 30px 10px; color: var(--text-2); }

.app-foot { border-top: 1px solid var(--line-0); padding: 22px 0; color: var(--text-muted); font-size: 0.84rem; }
.app-foot a { color: var(--text-2); }

/* activity tables (questions / leads) */
.app-stats { display: flex; gap: 30px; flex-wrap: wrap; }
.app-stat__n { font-family: var(--font-display); font-size: 1.7rem; color: var(--white); line-height: 1; }
.app-stat__l { font-size: 0.8rem; color: var(--text-2); margin-top: 4px; }
.tablewrap { overflow-x: auto; }
.app-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.app-table th { text-align: left; color: var(--text-2); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0 14px 8px 0; border-bottom: 1px solid var(--line-0); white-space: nowrap; }
.app-table td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line-0); color: var(--text-1); vertical-align: top; }
.app-table tr:last-child td { border-bottom: 0; }
.app-table .nowrap { white-space: nowrap; }
.app-table .muted { color: var(--text-muted); }
.app-table tr.is-spam td { opacity: 0.55; }
.tag-spam { font-size: 0.7em; border: 1px solid currentColor; border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: middle; color: var(--text-muted); }

.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-plat);
  border-top-color: var(--sky); border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
