/* ===== Reset & Base ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #202124;
    height: 100vh;
    overflow: hidden;
}

/* ===== Login Overlay ===== */
.login-overlay {
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
}
.login-card {
    background: #fff; border-radius: 12px; padding: 48px 40px;
    text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    max-width: 400px; width: 90%;
}
.login-logo {
    width: 64px; height: 64px; border-radius: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; font-size: 32px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.login-card p { color: #5f6368; margin-bottom: 24px; font-size: 14px; }
.login-error {
    margin-top: 16px; padding: 10px; border-radius: 6px;
    background: #fce8e6; color: #c5221f; font-size: 13px;
}
#googleSignInBtn { display: flex; justify-content: center; }

/* ===== App Shell Layout ===== */
.app-shell { display: flex; height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: 240px; min-width: 240px;
    background: #1a1a2e; color: #e0e0e0;
    display: flex; flex-direction: column;
    transition: width 0.2s, min-width 0.2s;
    overflow: hidden;
}
.sidebar.collapsed { width: 60px; min-width: 60px; }
.sidebar.collapsed .sidebar-label,
.sidebar.collapsed .sidebar-title { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-item { justify-content: center; padding: 12px 0; }
.sidebar.collapsed .sidebar-icon { margin: 0; }
.sidebar.collapsed .sidebar-user { justify-content: center; }
.sidebar.collapsed .user-avatar { margin: 0; }

.sidebar-header {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 16px; border-bottom: 1px solid #2a2a4a;
}
.sidebar-logo {
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff; font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-title { font-size: 18px; font-weight: 600; white-space: nowrap; }

.sidebar-menu { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; cursor: pointer; color: #b0b0c0;
    text-decoration: none; transition: background 0.15s, color 0.15s;
    font-size: 14px; white-space: nowrap;
}
.sidebar-item:hover { background: #2a2a4a; color: #fff; }
.sidebar-item.active { background: #3a3a5c; color: #fff; border-left: 3px solid #667eea; padding-left: 17px; }
.sidebar-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    border-top: 1px solid #2a2a4a; padding: 12px 0;
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 20px; font-size: 13px; color: #b0b0c0;
    white-space: nowrap; overflow: hidden;
}
.user-avatar {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: #3a3a5c;
}

/* ===== Main Content ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.top-bar {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 24px; background: #fff;
    border-bottom: 1px solid #e0e0e0; flex-shrink: 0;
}
.top-bar h2 { flex: 1; font-size: 18px; font-weight: 600; }
.sidebar-toggle {
    background: none; border: 1px solid #ddd; border-radius: 4px;
    padding: 4px 8px; cursor: pointer; font-size: 16px; color: #5f6368;
}
.sidebar-toggle:hover { background: #f0f0f0; }
.top-bar-actions { display: flex; align-items: center; gap: 12px; }
.auto-refresh-toggle {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: #5f6368; cursor: pointer;
}
.refresh-btn {
    padding: 6px 14px; font-size: 13px; border: 1px solid #ddd;
    border-radius: 4px; background: #fff; cursor: pointer; color: #333;
}
.refresh-btn:hover { background: #f0f0f0; }

.content-area { flex: 1; overflow-y: auto; padding: 24px; }
.section { animation: fadeIn 0.15s ease-in; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== Dashboard ===== */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.dash-card {
    background: #fff; border-radius: 8px; padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08); cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
    border: 1px solid #e8e8e8;
}
.dash-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.12); transform: translateY(-2px); }
.dash-card-header { font-size: 13px; font-weight: 600; color: #5f6368; text-transform: uppercase; margin-bottom: 12px; }
.dash-stat { font-size: 36px; font-weight: 700; color: #202124; margin-bottom: 8px; }
.dash-detail { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-badge {
    font-size: 12px; padding: 2px 8px; border-radius: 12px; font-weight: 600;
}
.badge-error { background: #fce8e6; color: #c5221f; }
.badge-warning { background: #fef7e0; color: #e37400; }
.badge-ok { background: #e6f4ea; color: #137333; }

/* ===== Daily Summary ===== */
.summary-panel { display: flex; gap: 16px; align-items: flex-start; }
.summary-history {
    width: 260px; min-width: 260px; background: #fff;
    border-radius: 8px; border: 1px solid #e8e8e8; padding: 12px;
}
.summary-history h4 {
    font-size: 12px; text-transform: uppercase; color: #5f6368;
    margin-bottom: 10px; font-weight: 600;
}
.summary-history-item.active { background: #e8f0fe; border-color: #c6dafc; }
/* No inner scroll: a summary is read top to bottom, and a nested scrollbar hides the
   topic distribution at the end of it behind a scroll gesture nobody makes. */
.summary-report {
    flex: 1; background: #fff; border-radius: 8px;
    border: 1px solid #e8e8e8; padding: 20px;
}
.summary-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; padding-bottom: 12px; border-bottom: 1px solid #eee; margin-bottom: 4px;
}
.summary-head h3 { font-size: 17px; color: #202124; }
.summary-sub { font-size: 12px; color: #6c757d; margin-top: 4px; }
.summary-block { padding: 16px 0; border-bottom: 1px solid #f1f1f1; }
.summary-block:last-child { border-bottom: none; }
.summary-block h4 { font-size: 13px; font-weight: 600; color: #202124; margin-bottom: 10px; }
.summary-issues { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.summary-issues li {
    padding: 10px 12px; border: 1px solid #f0f0f0; border-radius: 6px; background: #fafbfc;
}
.summary-issue-title { display: block; font-weight: 600; font-size: 13px; color: #202124; margin-bottom: 3px; }
.summary-issue-desc { font-size: 13px; color: #3c4043; line-height: 1.6; }
.summary-empty { font-size: 13px; color: #6c757d; font-style: italic; }
.summary-imported {
    margin-top: 12px; padding: 10px 12px; border-radius: 6px;
    background: #fef7e0; color: #7a4f01; font-size: 12px; line-height: 1.6;
}
.summary-actions { margin-bottom: 10px; }
.summary-actions h5 { font-size: 12px; color: #5f6368; font-weight: 600; margin-bottom: 4px; }
.summary-actions ul { padding-left: 20px; font-size: 13px; color: #3c4043; line-height: 1.7; }
.summary-tid { color: #007bff; text-decoration: none; font-family: 'Courier New', monospace; }
.summary-tid:hover { text-decoration: underline; }
.summary-topics { display: flex; flex-direction: column; gap: 6px; }
.summary-topic { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.summary-topic-tag { width: 190px; min-width: 190px; color: #3c4043; }
.summary-topic-bar { flex: 1; height: 8px; background: #f1f3f4; border-radius: 4px; overflow: hidden; }
.summary-topic-bar i { display: block; height: 100%; background: #4285f4; }
.summary-topic-count { width: 36px; text-align: right; font-weight: 600; color: #202124; }
@media (max-width: 900px) {
    .summary-panel { flex-direction: column; }
    .summary-history { width: 100%; min-width: 0; }
}

/* ===== Section Controls (Logs) ===== */
.section-controls {
    display: flex; gap: 15px; flex-wrap: wrap; align-items: flex-start;
    padding: 16px 20px; background: #fff; border-radius: 8px;
    margin-bottom: 16px; border: 1px solid #e8e8e8;
}
.control-group { display: flex; flex-direction: column; gap: 5px; }
.control-group label {
    font-weight: 600; font-size: 11px; color: #5f6368; text-transform: uppercase;
}
.section-controls input,
.section-controls select {
    padding: 7px 10px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px;
}

.log-level-checkboxes {
    display: flex; flex-direction: column; gap: 4px;
    padding: 6px 8px; background: #fff; border: 1px solid #ddd;
    border-radius: 4px; min-width: 110px;
}
.checkbox-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #495057; cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 14px; height: 14px; }

/* ===== Logs Table ===== */
.log-stats {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; background: #fff; border-radius: 8px 8px 0 0;
    border: 1px solid #e8e8e8; border-bottom: none; font-size: 13px; color: #5f6368;
}
.logs-container {
    max-height: 500px; overflow-y: auto;
    font-family: 'Courier New', monospace; font-size: 12px;
    background: #fff; border: 1px solid #e8e8e8;
}
.logs-header {
    display: flex; gap: 10px; padding: 10px 16px;
    background: #495057; color: #fff; font-weight: 600; font-size: 11px;
    position: sticky; top: 0; z-index: 10;
}
.logs-header .header-timestamp { min-width: 130px; }
.logs-header .header-level { min-width: 60px; text-align: center; }
.logs-header .header-service { min-width: 80px; }
.logs-header .header-ticket { min-width: 80px; }
.logs-header .header-message { flex: 1; }

.log-entry {
    display: flex; gap: 10px; padding: 6px 16px;
    border-bottom: 1px solid #f0f0f0; align-items: flex-start;
}
.log-entry:hover { background: #f8f9fa; }
.log-timestamp { color: #6c757d; min-width: 130px; font-size: 11px; }
.log-level {
    padding: 1px 6px; border-radius: 3px; font-weight: 700;
    font-size: 10px; min-width: 60px; text-align: center;
}
.level-INFO { background: #d4edda; color: #155724; }
.level-ERROR { background: #f8d7da; color: #721c24; }
.level-WARNING { background: #fff3cd; color: #856404; }
.level-DEBUG { background: #e2e3e5; color: #383d41; }
.level-CRITICAL { background: #d1ecf1; color: #0c5460; }
.log-service { color: #495057; min-width: 80px; font-weight: 600; }
.log-ticket { color: #007bff; min-width: 80px; font-weight: 600; }
.log-message { flex: 1; word-break: break-word; }
.search-highlight { background: yellow; font-weight: bold; }

.log-pagination {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; background: #fff; border: 1px solid #e8e8e8;
    border-top: none; border-radius: 0 0 8px 8px; font-size: 13px;
    flex-wrap: wrap; gap: 10px;
}
.pagination-controls { display: flex; gap: 8px; }
.pagination-controls button {
    padding: 5px 12px; font-size: 12px; border: 1px solid #ddd;
    border-radius: 4px; background: #fff; cursor: pointer; color: #333;
}
.pagination-controls button:hover { background: #f0f0f0; }
.pagination-controls button:disabled { opacity: 0.4; cursor: not-allowed; }
.page-size-selector { display: flex; align-items: center; gap: 6px; }
.page-size-selector select { padding: 4px 6px; font-size: 12px; border: 1px solid #ddd; border-radius: 4px; }
.sorting-controls { display: flex; align-items: center; gap: 6px; }
.sorting-controls select { padding: 4px 6px; font-size: 12px; border: 1px solid #ddd; border-radius: 4px; }
.sort-dir-btn {
    padding: 3px 8px; border: 1px solid #ddd; border-radius: 3px;
    background: #fff; cursor: pointer; font-size: 13px; color: #333;
}
.sort-dir-btn:hover { background: #f0f0f0; }
.sort-dir-btn.active { background: #007bff; color: #fff; border-color: #007bff; }

.clear-btn { background: #dc3545 !important; color: #fff !important; border: none !important; }
.clear-btn:hover { background: #c82333 !important; }
.loading { text-align: center; padding: 40px; color: #6c757d; }
.no-logs { text-align: center; padding: 40px; color: #6c757d; font-style: italic; }

/* ===== Tickets / Alerts Panels ===== */
.tickets-panel {
    display: flex; gap: 20px; flex-wrap: wrap;
}
.tickets-panel.single { flex-direction: column; }
.tickets-section {
    flex: 1; min-width: 300px; background: #fff; border-radius: 8px;
    border: 1px solid #e8e8e8; overflow: hidden;
}
.tickets-section.full-width { flex: none; width: 100%; }
.tickets-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 16px; background: #495057; color: #fff;
}
.tickets-header h3 { font-size: 14px; margin: 0; }
.tickets-actions { display: flex; gap: 6px; }
.small-btn {
    padding: 4px 10px; font-size: 11px; border-radius: 3px;
    border: none; cursor: pointer; background: #6c757d; color: #fff;
}
.small-btn:hover { background: #5a6268; }
.small-btn.clear-btn { background: #dc3545; }
.small-btn.clear-btn:hover { background: #c82333; }
.small-btn.remove-btn { background: #fd7e14; padding: 2px 8px; font-size: 10px; }
.small-btn.remove-btn:hover { background: #e8590c; }
.flagged-save-btn { background: #28a745 !important; }
.flagged-save-btn:hover { background: #218838 !important; }
.payments-status { font-size: 11px; color: #5f6368; max-width: 480px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tickets-table-container { max-height: 300px; overflow-y: auto; }
.tickets-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.tickets-table thead th {
    background: #e9ecef; padding: 6px 10px; text-align: left;
    font-weight: 600; color: #495057; position: sticky; top: 0; font-size: 11px;
}
.tickets-table tbody td {
    padding: 5px 10px; border-bottom: 1px solid #f0f0f0;
    font-family: 'Courier New', monospace; font-size: 11px;
}
.tickets-table tbody tr:hover { background: #f8f9fa; }
.empty-row {
    text-align: center; color: #6c757d; font-style: italic;
    font-family: 'Segoe UI', sans-serif !important; padding: 15px !important;
}
.status-pending { color: #fd7e14; font-weight: 600; }
.status-processing { color: #007bff; font-weight: 600; }
.pending-duration { font-weight: 600; }
.pending-duration.warning { color: #fd7e14; }
.pending-duration.danger { color: #dc3545; }

.type-spike {
    background: #fff3cd; color: #856404; padding: 2px 8px;
    border-radius: 10px; font-size: 10px; font-weight: 600;
}
.type-low {
    background: #d1ecf1; color: #0c5460; padding: 2px 8px;
    border-radius: 10px; font-size: 10px; font-weight: 600;
}
.alert-ok { color: #28a745; font-weight: 600; }
.alert-triggered { color: #dc3545; font-weight: 600; }

/* ===== Flagged Players ===== */
.flagged-players-content { padding: 16px; }
.flagged-players-input-row { display: flex; gap: 8px; margin-bottom: 12px; }
.flagged-players-input-row input { flex: 1; padding: 7px 10px; font-size: 13px; border: 1px solid #ddd; border-radius: 4px; }
.flagged-players-list { display: flex; flex-wrap: wrap; gap: 8px; min-height: 30px; align-items: center; }
.flagged-player-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: #fff3cd; color: #856404; border: 1px solid #ffc107;
    border-radius: 16px; padding: 4px 10px;
    font-size: 12px; font-family: 'Courier New', monospace; font-weight: 600;
}
.flagged-remove-btn {
    background: none !important; border: none !important;
    color: #856404; font-size: 16px; cursor: pointer;
    padding: 0 2px; line-height: 1; font-weight: bold;
}
.flagged-remove-btn:hover { color: #dc3545; background: none !important; }

/* ===== Investigate / Timeline ===== */
.investigate-panel { display: flex; flex-direction: column; gap: 16px; }
.investigate-search {
    display: flex; gap: 10px; padding: 16px 20px;
    background: #fff; border-radius: 8px; border: 1px solid #e8e8e8;
}
.investigate-search input {
    flex: 1; padding: 8px 12px; font-size: 14px;
    border: 1px solid #ddd; border-radius: 4px;
    font-family: 'Courier New', monospace;
}
.investigate-btn { background: #007bff !important; padding: 8px 20px !important; font-size: 13px !important; }
.investigate-btn:hover { background: #0069d9 !important; }
.zd-ticket-link {
    display: flex; align-items: center; white-space: nowrap;
    padding: 8px 14px; font-size: 13px; font-weight: 600;
    color: #007bff; text-decoration: none;
    border: 1px solid #cfe2ff; border-radius: 4px; background: #f4f9ff;
    transition: background 0.1s, border-color 0.1s;
}
.zd-ticket-link:hover { background: #e6f1ff; border-color: #9ec5fe; }

.investigate-body { display: flex; gap: 16px; }
.investigate-recent {
    width: 260px; min-width: 260px; background: #fff;
    border-radius: 8px; border: 1px solid #e8e8e8; padding: 12px;
}
.investigate-recent h4 {
    font-size: 12px; text-transform: uppercase; color: #5f6368;
    margin-bottom: 10px; font-weight: 600;
}
.recent-list { display: flex; flex-direction: column; gap: 4px; max-height: 600px; overflow-y: auto; }
.recent-ticket {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 10px; border-radius: 4px; cursor: pointer;
    border: 1px solid #f0f0f0; transition: background 0.1s;
}
.recent-ticket:hover { background: #f0f2f5; }
.recent-id { font-family: 'Courier New', monospace; font-weight: 600; color: #007bff; font-size: 13px; }
.recent-count { font-size: 11px; color: #5f6368; }
.recent-time { font-size: 11px; color: #6c757d; }

.investigate-timeline {
    flex: 1; background: #fff; border-radius: 8px;
    border: 1px solid #e8e8e8; padding: 16px; overflow-y: auto; max-height: 650px;
}

/* Timeline */
.tl-timeline { position: relative; padding-left: 28px; }
.tl-timeline::before {
    content: ''; position: absolute; left: 14px; top: 0; bottom: 0;
    width: 2px; background: #e0e0e0;
}
.tl-event {
    position: relative; display: flex; gap: 12px;
    padding: 10px 12px; margin-bottom: 4px; border-radius: 6px;
    transition: background 0.1s;
}
.tl-event:hover { background: #f8f9fa; }
.tl-node {
    position: absolute; left: -28px; top: 12px;
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: #fff; flex-shrink: 0; z-index: 1;
}
.tl-content { flex: 1; min-width: 0; }
.tl-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tl-badge {
    font-size: 10px; font-weight: 600; padding: 2px 8px;
    border-radius: 10px; white-space: nowrap;
}
.tl-time { font-size: 11px; color: #6c757d; margin-left: auto; white-space: nowrap; }
.tl-desc { font-size: 13px; color: #202124; line-height: 1.4; }

.tl-meta {
    margin-top: 8px; background: #f8f9fa; border-radius: 4px;
    border: 1px solid #e8e8e8; overflow: hidden;
}
.tl-meta table { width: 100%; border-collapse: collapse; font-size: 11px; }
.tl-meta td { padding: 4px 8px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.tl-meta-key {
    font-weight: 600; color: #5f6368; white-space: nowrap; width: 120px;
    font-family: 'Courier New', monospace;
}
.tl-meta-val {
    color: #202124; word-break: break-word;
    font-family: 'Courier New', monospace;
}

/* clickable hint for events with metadata */
.tl-event[onclick] { cursor: pointer; }
.tl-event[onclick] .tl-desc::after {
    content: ' \u25B6'; font-size: 9px; color: #6c757d;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { width: 60px; min-width: 60px; }
    .sidebar .sidebar-label, .sidebar .sidebar-title { display: none; }
    .sidebar .sidebar-item { justify-content: center; padding: 12px 0; }
    .sidebar .sidebar-icon { margin: 0; }
    .sidebar .sidebar-header { justify-content: center; }
    .sidebar .sidebar-user { justify-content: center; }
    .sidebar .user-avatar { margin: 0; }
    .content-area { padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* Phlipper Chat */
.chat-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    overflow: hidden;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fb;
}
.chat-empty {
    color: #8a8f99;
    font-size: 13px;
    text-align: center;
    margin: auto 0;
    padding: 24px;
}
.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.chat-msg-user {
    align-self: flex-end;
    background: #667eea;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg-assistant {
    align-self: flex-start;
    background: #fff;
    color: #202124;
    border: 1px solid #e6e8eb;
    border-bottom-left-radius: 4px;
}
.chat-msg-error {
    align-self: stretch;
    background: #fce8e6;
    color: #c5221f;
    border: 1px solid #f5c2c0;
    font-size: 13px;
}
.chat-msg-assistant a { color: #4054b2; text-decoration: underline; }
.chat-msg-assistant a:hover { color: #2a3a8c; }
.chat-msg-user a { color: #fff; text-decoration: underline; }
.chat-status {
    padding: 6px 20px;
    font-size: 12px;
    color: #5f6368;
    min-height: 22px;
    border-top: 1px solid #eef0f3;
    background: #fafbfc;
}
.chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #eef0f3;
    background: #fff;
    align-items: stretch;
}
.chat-input {
    flex: 1;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid #d0d4d9;
    border-radius: 6px;
    outline: none;
}
.chat-input:focus { border-color: #667eea; }
.chat-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-send-btn { background: #667eea; }
.chat-send-btn:hover { background: #5468c6; }


/* ===== Public Replies (danger zone) =====
   This section is the only place in the console where one click changes what thousands
   of players receive, so it is styled to look like what it is: hazard stripes, a red
   frame, and a live-state banner that reads differently for each of the three positions.
   A section that looks like every other settings page invites the click this one should
   never get by accident. */
.danger-zone {
    border: 2px solid #dc3545; border-radius: 8px;
    background: #fff; overflow: hidden; margin-bottom: 20px;
}
.danger-zone-banner {
    background: repeating-linear-gradient(45deg, #dc3545, #dc3545 14px, #a71d2a 14px, #a71d2a 28px);
    color: #fff; padding: 10px 16px; font-weight: 700; font-size: 13px;
    letter-spacing: 0.5px; text-transform: uppercase;
    display: flex; align-items: center; gap: 10px;
}
.danger-zone-note {
    padding: 12px 16px; background: #fff5f5; border-bottom: 1px solid #f3c9cd;
    font-size: 12px; color: #7a1c26; line-height: 1.55;
}
.pr-grid { display: flex; flex-wrap: wrap; gap: 16px; padding: 16px; }
.pr-card {
    flex: 1 1 420px; min-width: 340px; border: 1px solid #e0e0e0;
    border-radius: 6px; overflow: hidden; background: #fff;
}
.pr-card-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; background: #495057; color: #fff;
}
.pr-card-header h4 { font-size: 14px; margin: 0; }
.pr-card-games { font-size: 11px; opacity: 0.85; text-align: right; margin-left: 12px; }
.pr-state {
    padding: 14px 16px; font-size: 15px; font-weight: 700;
    display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #eee;
}
.pr-state small { display: block; font-size: 11px; font-weight: 500; opacity: 0.9; margin-top: 3px; }
.pr-state.scope-all { background: #fdecea; color: #a71d2a; border-left: 6px solid #dc3545; }
.pr-state.scope-named { background: #fff8e1; color: #8a6100; border-left: 6px solid #ffc107; }
.pr-state.scope-off { background: #eef1f4; color: #495057; border-left: 6px solid #6c757d; }
.pr-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.pr-state.scope-all .pr-dot { background: #dc3545; box-shadow: 0 0 0 4px rgba(220,53,69,0.18); }
.pr-state.scope-named .pr-dot { background: #ffc107; box-shadow: 0 0 0 4px rgba(255,193,7,0.18); }
.pr-state.scope-off .pr-dot { background: #6c757d; box-shadow: 0 0 0 4px rgba(108,117,125,0.15); }

.pr-body { padding: 14px 16px; }
.pr-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.pr-option {
    display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
    border: 1px solid #e0e0e0; border-radius: 5px; cursor: pointer; font-size: 13px;
}
.pr-option:hover { background: #f8f9fa; }
.pr-option input { margin-top: 2px; }
.pr-option strong { display: block; }
.pr-option span { font-size: 11px; color: #5f6368; }
.pr-option.selected { border-color: #495057; background: #f4f6f8; }
.pr-option.selected.opt-all { border-color: #dc3545; background: #fdecea; }
.pr-option.selected.opt-named { border-color: #ffc107; background: #fff8e1; }

.pr-legacy-note {
    font-size: 11px; color: #8a6100; background: #fff8e1; border: 1px solid #ffe082;
    border-radius: 4px; padding: 6px 8px; margin-bottom: 10px; line-height: 1.5;
}
.pr-legacy-note code { background: #fff; padding: 0 3px; border-radius: 3px; }
.pr-players-label { font-size: 11px; font-weight: 600; color: #495057; margin-bottom: 6px; }
.pr-player-row { display: flex; gap: 8px; margin-bottom: 10px; }
.pr-player-row input { flex: 1; padding: 6px 10px; font-size: 12px; border: 1px solid #ddd; border-radius: 4px; }
.pr-players { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; align-items: center; }
.pr-player-tag {
    display: inline-flex; align-items: center; gap: 6px;
    background: #e8f0fe; color: #174ea6; border: 1px solid #aecbfa;
    border-radius: 16px; padding: 3px 9px;
    font-size: 11px; font-family: 'Courier New', monospace; font-weight: 600;
}
.pr-player-tag button {
    background: none; border: none; color: #174ea6; cursor: pointer;
    font-size: 14px; line-height: 1; padding: 0 1px; font-weight: bold;
}
.pr-player-tag button:hover { color: #dc3545; }
.pr-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.pr-apply {
    padding: 8px 16px; font-size: 13px; font-weight: 600; border: none;
    border-radius: 4px; cursor: pointer; background: #6c757d; color: #fff;
}
.pr-apply:disabled { opacity: 0.45; cursor: default; }
.pr-apply.arm-all { background: #dc3545; }
.pr-apply.arm-off { background: #343a40; }
.pr-dirty { font-size: 11px; color: #a71d2a; font-weight: 600; }
.pr-footnote { font-size: 11px; color: #5f6368; line-height: 1.5; padding: 0 16px 16px; }
.pr-history { padding: 0 16px 16px; }
.pr-history table { width: 100%; border-collapse: collapse; font-size: 11px; }
.pr-history th { text-align: left; padding: 5px 8px; background: #e9ecef; color: #495057; font-size: 10px; }
.pr-history td { padding: 5px 8px; border-bottom: 1px solid #f0f0f0; }

/* Confirmation gate. Typing the phrase is the point: an "Are you sure?" dialog is
   dismissed by reflex, a phrase has to be read. */
.pr-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.55);
    display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.pr-modal {
    background: #fff; border-radius: 8px; width: 90%; max-width: 480px;
    overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    border: 2px solid #dc3545;
}
.pr-modal-header {
    background: repeating-linear-gradient(45deg, #dc3545, #dc3545 14px, #a71d2a 14px, #a71d2a 28px);
    color: #fff; padding: 12px 16px; font-weight: 700; font-size: 14px; text-transform: uppercase;
}
.pr-modal-body { padding: 16px; font-size: 13px; line-height: 1.6; color: #202124; }
.pr-modal-body ul { margin: 8px 0 12px 18px; }
.pr-modal-body code { background: #f1f3f4; padding: 1px 5px; border-radius: 3px; font-weight: 700; }
.pr-modal-body input {
    width: 100%; padding: 8px 10px; font-size: 13px; margin-top: 8px;
    border: 1px solid #ddd; border-radius: 4px; font-family: 'Courier New', monospace;
}
.pr-modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 16px 16px; }
.pr-modal-actions button { padding: 8px 16px; font-size: 13px; border-radius: 4px; border: none; cursor: pointer; }
.pr-cancel { background: #e9ecef; color: #202124; }
.pr-confirm { background: #dc3545; color: #fff; font-weight: 600; }
.pr-confirm:disabled { opacity: 0.45; cursor: default; }
