/* Agent CRM — Telegram Mini App Theme */

:root {
    --bg: var(--tg-theme-bg-color, #1a1a2e);
    --bg-secondary: var(--tg-theme-secondary-bg-color, #16213e);
    --text: var(--tg-theme-text-color, #eee);
    --text-hint: var(--tg-theme-hint-color, #888);
    --link: var(--tg-theme-link-color, #6c63ff);
    --btn-bg: var(--tg-theme-button-color, #6c63ff);
    --btn-text: var(--tg-theme-button-text-color, #fff);
    --card-bg: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
    --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    touch-action: pan-x pan-y;
    position: fixed;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
    padding-bottom: 70px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Header */
header {
    padding: 16px 20px 8px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 10;
}
header h1 { font-size: 22px; font-weight: 700; }

/* Content wrapper (desktop sidebar layout) */
.app-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

main { flex: 1; padding: 8px 12px 16px; }

/* Bottom Nav */
#bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: flex;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    z-index: 100;
}
.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-hint);
    font-size: 10px;
    padding: 4px;
    cursor: pointer;
    transition: color 0.2s;
}
.nav-btn.active { color: var(--btn-bg); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 10px; font-weight: 500; }

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.summary-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    border: 1px solid var(--border);
    text-align: center;
}
.summary-value { font-size: 28px; font-weight: 700; color: var(--btn-bg); }
.summary-label {
    font-size: 11px;
    color: var(--text-hint);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    transition: transform 0.15s;
}
.card:active { transform: scale(0.98); }

/* Agent Cards */
.agent-card { display: flex; align-items: center; gap: 12px; }
.agent-emoji { font-size: 32px; }
.agent-info { flex: 1; }
.agent-name { font-weight: 600; font-size: 16px; }
.agent-meta { font-size: 12px; color: var(--text-hint); margin-top: 2px; }

/* Status Badges — colored pill */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-active {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success);
}
.status-active .status-dot { background: var(--success); }
.status-idle {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-hint);
}
.status-idle .status-dot { background: var(--text-hint); }
.status-error {
    background: rgba(244, 67, 54, 0.15);
    color: var(--error);
}
.status-error .status-dot { background: var(--error); }

/* ============================================
   KANBAN BOARD
   ============================================ */

/* Period filter — subtle text links */
.period-filter {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    padding: 4px 0;
}
.period-chip {
    padding: 4px 2px;
    border: none;
    background: transparent;
    color: var(--text-hint);
    font-size: 12px;
    font-weight: 500;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    border-bottom: 2px solid transparent;
}
.period-chip.active {
    color: var(--text);
    border-bottom-color: var(--btn-bg);
    font-weight: 600;
}

.kanban-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 4px;
}

.filter-chip {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-hint);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}
.filter-chip.active {
    background: var(--btn-bg);
    color: var(--btn-text);
    border-color: var(--btn-bg);
}

.kanban-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    min-height: calc(100vh - 200px);
}

.kanban-column {
    min-width: 85vw;
    max-width: 85vw;
    scroll-snap-align: start;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

/* Wider screens (tablet+) */
@media (min-width: 600px) {
    .kanban-column {
        min-width: 260px;
        max-width: 320px;
    }
}

.column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-hint);
    border-bottom: 2px solid var(--border);
    margin-bottom: 8px;
}

.column-header .col-count {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
    font-weight: 600;
}

.column-header.col-todo { border-color: var(--link); }
.column-header.col-in_progress { border-color: var(--warning); }
.column-header.col-done { border-color: var(--success); }

.column-body {
    flex: 1;
    min-height: 100px;
    padding: 4px;
    border-radius: var(--radius);
    transition: background 0.2s;
}

/* SortableJS drag highlight */
.column-body.sortable-drag-over {
    background: rgba(108, 99, 255, 0.08);
}

/* Kanban cards */
.kanban-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    cursor: grab;
    touch-action: manipulation;
    transition: transform 0.1s, box-shadow 0.1s;
    -webkit-user-select: none;
    user-select: none;
}

.kanban-card:active {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* SortableJS ghost/chosen styles */
.kanban-card.sortable-ghost {
    opacity: 0.3;
}
.kanban-card.sortable-chosen {
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.3);
    transform: scale(1.02);
}

.kanban-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    line-height: 1.3;
}

.kanban-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-hint);
}

.kanban-agent {
    display: flex;
    align-items: center;
    gap: 3px;
}

.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.priority-high .priority-dot { background: var(--error); }
.priority-medium .priority-dot { background: var(--warning); }
.priority-low .priority-dot { background: var(--text-hint); }

/* Column scroll indicators */
.kanban-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 4px;
}

.kanban-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
}
.kanban-dot.active { background: var(--btn-bg); }

@media (min-width: 600px) {
    .kanban-dots { display: none; }
}

/* Alert Cards */
.alert-card { display: flex; gap: 10px; align-items: flex-start; }
.alert-icon { font-size: 20px; flex-shrink: 0; }
.alert-body { flex: 1; }
.alert-message { font-size: 14px; line-height: 1.4; }
.alert-time { font-size: 11px; color: var(--text-hint); margin-top: 4px; }
.alert-unread { border-left: 3px solid var(--btn-bg); }
.alert-error { border-left: 3px solid var(--error); background: rgba(244, 67, 54, 0.05); }
.alert-warning { border-left: 3px solid var(--warning); background: rgba(255, 152, 0, 0.05); }
.alert-info { border-left: 3px solid var(--link); background: rgba(108, 99, 255, 0.05); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius);
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.btn:active { opacity: 0.7; }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); flex: 1; }
.btn-danger { background: var(--error); color: #fff; padding: 10px 16px; }

.btn-fab {
    position: fixed;
    bottom: 80px; right: 16px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-size: 24px;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: var(--bg-secondary);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
    animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.modal-header h2 { font-size: 18px; }
.modal-close {
    background: none;
    border: none;
    color: var(--text-hint);
    font-size: 24px;
    cursor: pointer;
}
.modal-body .field { margin-bottom: 14px; }
.modal-body label {
    display: block;
    font-size: 12px;
    color: var(--text-hint);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.modal-body input,
.modal-body textarea,
.modal-body select {
    width: 100%;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.modal-body input::placeholder,
.modal-body textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}
.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    border-color: var(--btn-bg);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    position: sticky;
    bottom: 0;
    background: var(--bg-secondary);
    padding: 16px 0 4px;
    z-index: 5;
}
.modal-actions .btn-primary {
    font-size: 16px;
    font-weight: 700;
    padding: 14px 20px;
    min-height: 48px;
}

/* Misc */
.loading { text-align: center; padding: 40px; color: var(--text-hint); }
.section-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-hint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 20px 0 10px;
}
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-hint); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* Deadline badges */
.deadline-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
}
.deadline-ok { background: rgba(76, 175, 80, 0.1); color: var(--success); }
.deadline-soon {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning);
    animation: pulse 1.5s ease-in-out infinite;
}
.deadline-overdue {
    background: rgba(244, 67, 54, 0.2);
    color: var(--error);
    animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Kanban card with overdue border */
.kanban-card.deadline-overdue-card {
    border-left: 3px solid var(--error);
}
.kanban-card.deadline-soon-card {
    border-left: 3px solid var(--warning);
}

/* ============================================
   SYSTEM BAR
   ============================================ */
.system-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.sys-status { font-weight: 600; font-size: 14px; }
.sys-actions { display: flex; gap: 6px; }
.btn-sm {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    min-height: 36px;
    letter-spacing: 0.3px;
}
.btn-danger-sm { background: #e53935; color: #fff; }
.btn-success-sm { background: #43a047; color: #fff; }
.btn-fix-sm { background: var(--warning); color: #000; }

/* Budget bar */
.budget-bar {
    padding: 10px 14px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.budget-label { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.budget-meta {
    font-size: 12px;
    color: var(--text);
    margin-top: 8px;
    display: flex;
    gap: 8px;
}
.budget-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    font-weight: 600;
    font-size: 12px;
}
.progress-track {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.3s;
}
.progress-warn { background: var(--warning); }
.progress-danger { background: var(--error); }

/* ============================================
   AGENT CARDS (full)
   ============================================ */
.agent-card-full {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
}
.agent-header { display: flex; align-items: center; gap: 12px; }
.agent-role { font-size: 12px; color: var(--link); font-weight: 600; margin-top: 2px; }
.agent-bio { font-size: 11px; color: var(--text-hint); margin-top: 2px; }
.agent-details { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.agent-detail { margin-bottom: 8px; }
.agent-detail label { font-size: 11px; color: var(--text-hint); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 4px; }
.agent-model-select {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
}
.agent-meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-hint);
}

/* ============================================
   KANBAN description
   ============================================ */
.kanban-desc {
    font-size: 11px;
    color: var(--text-hint);
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}
.kanban-card.expanded .kanban-desc {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}
.kanban-expand-btn {
    font-size: 11px;
    color: var(--link, #007aff);
    margin-top: 4px;
    cursor: pointer;
}

/* ============================================
   CRON CARDS
   ============================================ */
.cron-card { padding: 14px; }
.cron-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cron-info { flex: 1; }
.cron-name { font-weight: 600; font-size: 14px; }
.cron-schedule { font-size: 12px; color: var(--text-hint); margin-top: 2px; }
.cron-meta { font-size: 11px; color: var(--text-hint); margin-top: 2px; }
.cron-card { cursor: pointer; }
.cron-desc { font-size: 12px; color: var(--text-hint); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: all 0.3s ease; }
.cron-card.expanded .cron-desc { -webkit-line-clamp: unset; display: block; overflow: visible; }

/* Toggle switch */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 24px;
    transition: 0.3s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================
   FILE CARDS
   ============================================ */
.file-card { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.file-card.file-missing { opacity: 0.4; cursor: default; }
.file-icon { font-size: 24px; }
.file-name { font-weight: 600; font-size: 14px; }
.file-size { font-size: 11px; color: var(--text-hint); }

/* Markdown body */
.markdown-body {
    font-size: 14px;
    line-height: 1.6;
    max-height: 70vh;
    overflow-y: auto;
    padding: 10px 0;
}
.markdown-body h1 { font-size: 20px; margin: 16px 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.markdown-body h2 { font-size: 17px; margin: 14px 0 6px; }
.markdown-body h3 { font-size: 15px; margin: 12px 0 4px; }
.markdown-body code {
    background: rgba(255,255,255,0.1);
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 12px;
}
.markdown-body pre {
    background: rgba(0,0,0,0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
}
.markdown-body pre code { background: none; padding: 0; }
.markdown-body ul, .markdown-body ol { padding-left: 20px; margin: 8px 0; }
.markdown-body li { margin: 4px 0; }
.markdown-body blockquote { border-left: 3px solid var(--link); padding-left: 12px; margin: 8px 0; color: var(--text-hint); }
.markdown-body strong { color: var(--btn-bg); }

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 420px;
    pointer-events: none;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    pointer-events: auto;
    animation: toastIn 0.3s ease-out;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}
.toast:active {
    transform: scale(0.98);
}
.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}
.toast-body {
    flex: 1;
    min-width: 0;
}
.toast-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 2px;
}
.toast-message {
    font-size: 13px;
    opacity: 0.9;
    word-break: break-word;
}
.toast-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.5;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    flex-shrink: 0;
}
.toast-close:hover { opacity: 1; }
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 12px 12px;
    animation: toastProgress linear forwards;
}

/* Toast types */
.toast-error {
    background: rgba(244, 67, 54, 0.92);
    color: #fff;
}
.toast-error .toast-progress { background: rgba(255, 255, 255, 0.3); }

.toast-warning {
    background: rgba(255, 152, 0, 0.92);
    color: #000;
}
.toast-warning .toast-progress { background: rgba(0, 0, 0, 0.2); }

.toast-success {
    background: rgba(76, 175, 80, 0.92);
    color: #fff;
}
.toast-success .toast-progress { background: rgba(255, 255, 255, 0.3); }

.toast-info {
    background: rgba(108, 99, 255, 0.92);
    color: #fff;
}
.toast-info .toast-progress { background: rgba(255, 255, 255, 0.3); }

.toast-exit {
    animation: toastOut 0.25s ease-in forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-20px) scale(0.95); }
}
@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ============================================
   OFFLINE / ERROR BANNER
   ============================================ */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--error);
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: slideDown 0.3s ease-out;
}
.offline-banner.hidden { display: none; }
.offline-banner .retry-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.offline-banner .retry-btn:active { opacity: 0.7; }

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* Empty state error variant */
.empty-state-error .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state-error p { color: var(--text-hint); font-size: 14px; margin-bottom: 12px; }
.empty-state-error .btn-retry {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.empty-state-error .btn-retry:active { opacity: 0.7; }

/* Session Cards */
.session-card {
    padding: 12px 14px;
}
.session-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.session-agent {
    font-weight: 600;
    font-size: 15px;
}
.session-cost {
    font-weight: 700;
    font-size: 16px;
    color: var(--text);
}
.session-bar-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}
.session-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}
.session-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.session-msgs {
    font-size: 12px;
    color: var(--text-hint);
}
.session-time {
    font-size: 11px;
    color: var(--text-hint);
}

/* Chart */
.chart-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 12px;
    margin-bottom: 12px;
    height: 200px;
}

/* Nav scrollable for 7 tabs */
#bottom-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#bottom-nav::-webkit-scrollbar { display: none; }
.nav-btn { min-width: 48px; flex-shrink: 0; }

/* Mobile-first nav: hide labels on very small screens */
@media (max-width: 380px) {
    .nav-label { display: none; }
    .nav-icon { font-size: 22px; }
    .nav-btn { min-width: 40px; padding: 6px 2px; }
}

/* ============================================
   ONBOARDING WIZARD
   ============================================ */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}
.onboarding-overlay.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.onboarding-content {
    width: 100%;
    max-width: 440px;
    padding: 32px 20px;
    text-align: center;
    max-height: 100vh;
    overflow-y: auto;
}
.onboarding-step { animation: slideUp 0.25s ease-out; }
.onboarding-emoji { font-size: 64px; margin-bottom: 16px; }
.onboarding-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}
.onboarding-subtitle {
    font-size: 14px;
    color: var(--text-hint);
    margin-bottom: 28px;
    line-height: 1.5;
}
.onboarding-btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius);
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    background: var(--btn-bg);
    color: var(--btn-text);
    transition: opacity 0.15s;
    margin-top: 12px;
}
.onboarding-btn:active { opacity: 0.7; }
.onboarding-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.onboarding-btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-hint);
}
.onboarding-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    text-align: left;
}
.onboarding-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.onboarding-card:hover,
.onboarding-card.active {
    border-color: var(--btn-bg);
}
.onboarding-card-icon { font-size: 24px; margin-bottom: 6px; }
.onboarding-card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.onboarding-card-desc { font-size: 12px; color: var(--text-hint); }
.onboarding-form {
    text-align: left;
    margin-top: 12px;
}
.onboarding-form .field { margin-bottom: 12px; }
.onboarding-form label {
    display: block;
    font-size: 12px;
    color: var(--text-hint);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.onboarding-form input,
.onboarding-form select {
    width: 100%;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}
.onboarding-form input:focus,
.onboarding-form select:focus {
    border-color: var(--btn-bg);
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}
.onboarding-agents-list {
    margin: 16px 0;
    text-align: left;
}
.onboarding-agent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--card-bg);
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
}
.onboarding-agent-item .agent-emoji { font-size: 24px; }
.onboarding-agent-item .agent-info { flex: 1; }
.onboarding-agent-item .agent-name { font-weight: 600; font-size: 14px; }
.onboarding-agent-item .agent-meta { font-size: 11px; color: var(--text-hint); }
.onboarding-summary {
    text-align: left;
    margin: 20px 0;
}
.onboarding-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.onboarding-summary-item:last-child { border-bottom: none; }
.onboarding-summary-value { font-weight: 600; color: var(--btn-bg); }
.onboarding-steps-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s, transform 0.2s;
}
.step-dot.active {
    background: var(--btn-bg);
    transform: scale(1.3);
}
.step-dot.done { background: var(--success); }

/* Tier badge in header */
.tier-badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
    vertical-align: middle;
}
.tier-hobby { background: rgba(108, 99, 255, 0.15); color: var(--link); }
.tier-builder { background: rgba(255, 152, 0, 0.15); color: var(--warning); }
.tier-pro { background: rgba(76, 175, 80, 0.15); color: var(--success); }

/* Agent count limit */
.agent-limit-info {
    font-size: 12px;
    color: var(--text-hint);
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Category badge */
.cat-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    font-weight: 500;
}

/* Category filter */
.category-filter { margin-top: 4px; }
.cat-chip.active { border-color: var(--link); background: var(--link); color: #fff; }

/* Journal */
.journal-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.journal-day { margin-bottom: 12px; }
.journal-day-header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px;
}
.journal-date { font-weight: 600; font-size: 14px; }
.journal-cost { font-size: 12px; color: var(--text-hint); }
.journal-entry { padding: 8px 0; border-bottom: 1px solid var(--border); }
.journal-entry:last-child { border-bottom: none; }
.journal-entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.journal-agent { font-size: 12px; font-weight: 500; }
.journal-source {
    font-size: 10px; padding: 2px 6px; border-radius: 4px;
    background: var(--border); color: var(--text-hint);
}
.journal-source.memory { background: #4CAF5020; color: #4CAF50; }
.journal-source.manual { background: #2196F320; color: #2196F3; }
.journal-source.auto { background: #FF980020; color: #FF9800; }
.journal-content { font-size: 13px; line-height: 1.5; }
.journal-content p { margin: 4px 0; }

/* Restart banner */
.restart-banner {
    background: #ff9800;
    color: #000;
    text-align: center;
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    border: none;
    animation: pulse-banner 2s ease-in-out infinite;
}
.restart-banner:active { opacity: 0.8; }
@keyframes pulse-banner {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* Budget header */
.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.budget-plan {
    font-weight: 700;
    font-size: 14px;
    color: var(--tg-theme-text-color, #fff);
}

/* Limit sections (weekly + session) */
.limit-section { margin-bottom: 8px; }
.limit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.limit-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #fff);
}
.limit-reset {
    font-size: 11px;
    color: var(--tg-theme-hint-color, #888);
}
.progress-session { background: #3B82F6 !important; }

/* Model breakdown */
.model-breakdown { margin-top: 12px; }
.model-row { margin-bottom: 10px; }
.model-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--tg-theme-text-color, #fff);
}
.model-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.model-name { font-weight: 600; flex: 1; }
.model-pct { color: var(--tg-theme-text-color, #fff); font-size: 12px; font-weight: 500; }
.model-meta {
    font-size: 11px;
    color: var(--tg-theme-hint-color, #888);
    margin-top: 3px;
}
.model-track { height: 6px !important; border-radius: 3px; }
.section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--tg-theme-hint-color, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 10px 0 6px;
}

/* --- Connect Remote Agent --- */
.connect-section { margin-bottom: 12px; }
.connect-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.connect-title { font-weight: 600; font-size: 15px; }
.btn-sm {
    padding: 5px 12px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    cursor: pointer;
    background: var(--tg-theme-secondary-bg-color, #2a2a2a);
    color: var(--tg-theme-text-color, #fff);
}
.btn-sm:active { opacity: 0.7; }
.btn-accent {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
}
.btn-copy { background: transparent; padding: 5px 8px; }
.connect-result { margin-bottom: 10px; }
.connect-result.hidden { display: none; }
.connect-loading { color: var(--tg-theme-hint-color, #888); font-size: 13px; }
.connect-error { color: #ff5555; font-size: 13px; }
.connect-new-link { display: flex; flex-direction: column; gap: 8px; }
.connect-label { font-size: 13px; color: var(--tg-theme-hint-color, #888); }
.connect-url-row { display: flex; gap: 6px; align-items: center; }
.connect-url-input {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--tg-theme-hint-color, #444);
    background: var(--tg-theme-secondary-bg-color, #1a1a1a);
    color: var(--tg-theme-text-color, #fff);
    font-size: 12px;
    font-family: monospace;
}
.connect-meta { font-size: 12px; color: var(--tg-theme-hint-color, #888); }
.connect-pending { display: flex; flex-direction: column; gap: 6px; }
.connect-token-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid var(--tg-theme-hint-color, #333);
}
.connect-token-info { display: flex; flex-direction: column; gap: 2px; }
.connect-token-preview { font-size: 12px; color: var(--tg-theme-text-color, #fff); }
.connect-token-expiry { font-size: 11px; color: var(--tg-theme-hint-color, #888); }
.connect-empty { font-size: 13px; color: var(--tg-theme-hint-color, #666); text-align: center; padding: 8px 0; }

/* ============================================
   MOBILE RESPONSIVE FIXES
   ============================================ */

/* Dashboard summary: stack on very narrow */
@media (max-width: 320px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
}

/* Field rows: stack on mobile */
@media (max-width: 400px) {
    .field-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Modal: full width on mobile, better touch targets */
@media (max-width: 500px) {
    .modal {
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        padding: 16px;
    }
    .modal-body input,
    .modal-body textarea,
    .modal-body select {
        font-size: 16px; /* prevent iOS zoom on focus */
        padding: 12px;
        min-height: 44px;
    }
    .modal-actions .btn-primary {
        min-height: 52px;
    }
}

/* Agent cards: tighter on mobile */
@media (max-width: 400px) {
    .agent-emoji { font-size: 28px; }
    .agent-name { font-size: 14px; }
}

/* Budget bar: wrap meta tags */
@media (max-width: 400px) {
    .budget-meta {
        flex-wrap: wrap;
    }
    .connect-url-row {
        flex-direction: column;
    }
    .connect-url-input {
        width: 100%;
    }
}

/* Header: smaller on mobile */
@media (max-width: 400px) {
    header { padding: 12px 14px 6px; }
    header h1 { font-size: 18px; }
    main { padding: 6px 8px 12px; }
}

/* FAB: safe area for bottom nav */
@media (max-width: 500px) {
    .btn-fab {
        bottom: 76px;
        right: 12px;
        width: 50px;
        height: 50px;
        font-size: 22px;
    }
}

/* Kanban: better mobile touch */
@media (max-width: 500px) {
    .kanban-column {
        min-width: 82vw;
        max-width: 82vw;
    }
    .kanban-card {
        padding: 10px;
    }
}

/* Prevent content from being hidden behind fixed elements */
main {
    padding-bottom: 16px;
}

/* System bar: wrap actions on narrow */
@media (max-width: 380px) {
    .system-bar {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
}

/* Journal: responsive */
@media (max-width: 400px) {
    .journal-actions {
        flex-wrap: wrap;
    }
}

/* ============================================
   DESKTOP LAYOUT (768px+)
   ============================================ */
@media (min-width: 768px) {
    /* Reset mobile fixed body */
    body {
        position: static;
        overflow-y: auto;
    }

    #app {
        flex-direction: row;
        height: 100vh;
        padding-bottom: 0;
        overflow: hidden;
    }

    /* Bottom nav → Sidebar */
    #bottom-nav {
        position: static;
        flex-direction: column;
        width: 220px;
        min-width: 220px;
        border-top: none;
        border-right: 1px solid var(--border);
        padding: 16px 8px;
        gap: 4px;
        overflow-x: visible;
        overflow-y: auto;
    }

    .nav-btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        padding: 10px 14px;
        border-radius: 10px;
        font-size: 14px;
        min-width: unset;
        transition: background 0.15s;
    }
    .nav-btn:hover {
        background: var(--card-bg);
    }
    .nav-btn.active {
        background: rgba(108, 99, 255, 0.12);
    }
    .nav-icon { font-size: 18px; }
    .nav-label {
        font-size: 14px;
        font-weight: 500;
        display: inline !important;
    }

    /* Header */
    header {
        position: static;
        padding: 20px 28px 12px;
    }
    header h1 { font-size: 24px; }

    /* Main content */
    main {
        flex: 1;
        overflow-y: auto;
        padding: 12px 28px 24px;
        max-width: 1200px;
    }

    /* Dashboard: wider grid */
    .summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Cards: hover effect */
    .card:hover {
        border-color: var(--btn-bg);
        transform: none;
    }
    .card:active { transform: none; }

    /* Kanban: all columns visible */
    .kanban-container {
        overflow-x: visible;
        scroll-snap-type: none;
    }
    .kanban-column {
        min-width: 240px;
        max-width: 340px;
        flex: 1;
    }

    /* Kanban dots hidden */
    .kanban-dots { display: none; }

    /* Modal: centered, not bottom-sheet */
    .modal-overlay {
        align-items: center;
    }
    .modal {
        border-radius: var(--radius);
        max-width: 520px;
        max-height: 80vh;
        animation: modalFadeIn 0.2s ease-out;
    }
    @keyframes modalFadeIn {
        from { opacity: 0; transform: scale(0.95); }
        to { opacity: 1; transform: scale(1); }
    }

    /* FAB position */
    .btn-fab {
        bottom: 24px;
        right: 24px;
    }

    /* Agent cards: grid layout */
    .agents-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
        gap: 12px;
    }
    .agents-grid .agent-card-full {
        margin-bottom: 0;
    }

    /* Budget bars side by side */
    .budget-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .budget-row .budget-bar {
        margin-bottom: 0;
    }

    /* Charts side by side */
    .charts-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    .chart-container {
        height: 280px;
    }

    /* Sessions grid */
    .sessions-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 10px;
    }
    .sessions-list .card {
        margin-bottom: 0;
    }

    /* Cron cards: 2-column */
    .crons-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
        gap: 12px;
    }
    .crons-grid .cron-card {
        margin-bottom: 0;
    }

    /* Alert cards: narrower */
    .alerts-list {
        max-width: 700px;
    }

    /* Connect section wider */
    .connect-url-row {
        flex-direction: row;
    }

    /* Onboarding: centered nicely */
    .onboarding-content {
        max-width: 500px;
    }
}

/* ============================================
   WIDE DESKTOP (1200px+)
   ============================================ */
@media (min-width: 1200px) {
    #bottom-nav {
        width: 260px;
        min-width: 260px;
        padding: 20px 12px;
    }
    .nav-btn {
        padding: 12px 18px;
    }
    main {
        padding: 16px 40px 32px;
    }
    header {
        padding: 24px 40px 16px;
    }
    header h1 { font-size: 26px; }
}

/* ============================================
   ORDER FIX: sidebar before content on desktop
   ============================================ */
@media (min-width: 768px) {
    #bottom-nav { order: -1; }
    .app-content-wrapper {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow-y: auto;
    }
}

/* ============================================
   DEMO BANNER
   ============================================ */
#demo-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 10px 16px;
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.15), rgba(147, 51, 234, 0.15));
    border-bottom: 1px solid rgba(108, 99, 255, 0.3);
    font-size: 13px;
    color: var(--text);
    flex-shrink: 0;
    z-index: 50;
}
#demo-banner button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
#demo-banner button:hover { background: rgba(255, 255, 255, 0.2); }

.demo-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.admin-stat-card {
    text-align: center;
    padding: 16px 8px !important;
}
.admin-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--link);
}
.admin-stat-label {
    font-size: 11px;
    color: var(--text-hint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.admin-invite-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.admin-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.admin-tag-green { background: rgba(76, 175, 80, 0.15); color: #4caf50; }
.admin-tag-dim { background: rgba(255, 255, 255, 0.05); color: var(--text-hint); }

.admin-badge { font-size: 12px; }

.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    white-space: nowrap;
}
.admin-table th {
    text-align: left;
    padding: 8px 10px;
    color: var(--text-hint);
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text);
}
.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}
.admin-table .mono {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 12px;
}

.btn-xs {
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 4px;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 6px;
}
.btn-primary {
    background: var(--btn-bg);
    color: var(--btn-text);
    border: none;
    cursor: pointer;
    font-weight: 500;
}
.btn-primary:hover { opacity: 0.9; }
.btn-danger {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
    cursor: pointer;
}
.btn-danger:hover { background: rgba(244, 67, 54, 0.25); }

.tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.tier-hobby { background: rgba(107, 114, 128, 0.2); color: #9ca3af; }
.tier-builder { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.tier-pro { background: rgba(147, 51, 234, 0.15); color: #a78bfa; }

@media (max-width: 480px) {
    .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-stat-value { font-size: 22px; }
}

/* Pending command badge */
.pending-badge {
    font-size: 12px;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
    font-weight: 600;
}

/* ============================================
   CONFIRM MODAL (model change)
   ============================================ */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}
.confirm-overlay.hidden { display: none; }
.confirm-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 20px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    animation: modalFadeIn 0.2s ease-out;
}
.confirm-card .confirm-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    margin-bottom: 20px;
}
.confirm-card .confirm-actions {
    display: flex;
    gap: 10px;
}
.confirm-card .confirm-btn {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
    min-height: 44px;
}
.confirm-card .confirm-btn:active { opacity: 0.7; }
.confirm-card .confirm-btn-primary {
    background: var(--btn-bg);
    color: var(--btn-text);
}
.confirm-card .confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-hint);
    border: 1px solid var(--border);
}

/* Command status badges */
.cmd-badge-applied {
    font-size: 12px;
    color: #4caf50;
    background: rgba(76, 175, 80, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
    font-weight: 600;
}
.cmd-badge-failed {
    font-size: 12px;
    color: #f44336;
    background: rgba(244, 67, 54, 0.12);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
    font-weight: 600;
}

.pending-commands-info {
    text-align: center;
    font-size: 13px;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 10px;
    padding: 8px 14px;
    margin-bottom: 12px;
}
