/* Bot Access (/bot-access) and Users → Bots (/bot-usage), admin only — tiles,
   bot cards, "what bots ask for", and the form / key / activity dialogs. The
   daily chart is css/usage.css. Phone first; the
   page lives in the app's 600px column. Everything is ba- prefixed. */

.ba-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.ba-intro { font-size: 13px; color: var(--text-muted); }
.ba-head .btn { flex-shrink: 0; }

.ba-muted { font-size: 12px; color: var(--text-dim); }
.ba-sub { display: block; margin-top: 2px; }
.ba-refused { color: #ef4444; }
.ba-foot { margin: 4px 4px 0; line-height: 1.5; }
.ba-intro a, .ba-foot a { color: var(--accent); }

.ba-usage-intro { margin-bottom: 12px; }
.ba-hint { margin-top: 6px; line-height: 1.4; }

/* KPI tiles — two across on a phone, four when there is room */
.ba-tiles {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
@media (min-width: 560px) {
    .ba-tiles { grid-template-columns: repeat(4, 1fr); }
}
.ba-tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    min-width: 0;
}
.ba-tile-value { font-size: 22px; font-weight: 700; color: var(--text); }
.ba-tile-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ba-tile-foot { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* Bots */
.ba-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 16px 4px 8px;
}
.ba-bot-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.ba-name { font-size: 16px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.ba-bot-head .fb-badge { flex-shrink: 0; }
.ba-keys { margin-top: 10px; }
.ba-key {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 4px 0;
}
.ba-key code, .ba-call code, .ba-code, .ba-keybox {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.ba-key code {
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--bg-input);
    border-radius: 4px;
    padding: 2px 6px;
}
.ba-link {
    background: none;
    border: none;
    padding: 6px 0;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    color: var(--text-muted);
}
.ba-link-danger { color: #ef4444; }
.ba-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: 8px;
}
@media (min-width: 560px) {
    .ba-stats { grid-template-columns: repeat(4, 1fr); }
}
.ba-stat-val { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.ba-stat-val.ba-refused { color: #ef4444; }
.ba-stat-label { display: block; font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.ba-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ba-actions .btn { flex: 1 1 auto; }

/* What bots ask for */
.ba-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ba-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-dim);
    padding: 0 0 6px;
}
.ba-table td {
    padding: 8px 0;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: top;
}
.ba-table .ba-num { text-align: right; padding-left: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ba-table td.ba-refused { color: #ef4444; }
.ba-inline-bar {
    display: block;
    height: 4px;
    margin-top: 5px;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0.6;
}
.ba-empty { text-align: center; color: var(--text-dim); padding: 16px 0; }

/* Dialogs */
.form-group label.ba-check {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 0;
    cursor: pointer;
}
.ba-check input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); }
.ba-checks { margin: 2px 0 0 26px; }
.ba-error { color: #ef4444; font-size: 13px; margin-top: 4px; }
.ba-warn {
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid rgba(245,158,11,0.35);
    border-radius: 10px;
    background: rgba(245,158,11,0.12);
    color: #fcd34d;
    font-size: 13px;
    line-height: 1.45;
}
[data-theme="light"] .ba-warn {
    border-color: rgba(180,83,9,0.4);
    background: rgba(245,158,11,0.18);
    color: #92400e;
}
.ba-keyrow { display: flex; gap: 8px; margin-bottom: 12px; }
.ba-keyrow .ba-keybox { flex: 1; min-width: 0; font-size: 13px; }
.ba-code {
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Activity */
.ba-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ba-chip {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
}
.ba-chip.active {
    background: rgba(16,185,129,0.15);
    color: #34d399;
    border-color: rgba(16,185,129,0.3);
}
[data-theme="light"] .ba-chip.active { color: #047857; }
.ba-activity-total {
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    background: var(--bg-input);
    font-size: 14px;
    color: var(--text);
}
.ba-day {
    margin: 14px 0 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ba-day span { font-weight: 400; color: var(--text-dim); text-transform: none; letter-spacing: 0; margin-left: 6px; }
.ba-feed { list-style: none; }
.ba-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 0;
    border-top: 1px solid var(--border);
}
.ba-feed-time { flex-shrink: 0; width: 82px; font-size: 11px; color: var(--text-dim); padding-top: 2px; font-variant-numeric: tabular-nums; }
.ba-call { flex: 1; min-width: 0; }
.ba-call code { font-size: 12px; color: var(--text-secondary); overflow-wrap: anywhere; }
.ba-feed-item .fb-badge { flex-shrink: 0; }
