/* ===========================================
   Admin Panel — Dark Minimal
   =========================================== */

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

body {
    background: #0a0a0a;
    color: #e5e5e5;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    opacity: 0;
    transition: opacity 0.35s ease;
}

body.loaded { opacity: 1; }

html[lang="ja"] body,
html[lang="zh"] body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans CJK SC', 'Noto Sans CJK JP',
        'Hiragino Sans', 'Microsoft YaHei', 'Yu Gothic', sans-serif;
}

/* === LAYOUT === */
.admin-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(201,162,78,0.12);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.admin-header.revealed {
    opacity: 1;
    transform: translateY(0);
}

.admin-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ADMIN badge */
.admin-badge {
    display: inline-block;
    background: rgba(239,68,68,0.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.3);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Breadcrumb */
.admin-breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
}

.admin-breadcrumb a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
    transition: color 0.2s ease;
}

.admin-breadcrumb a:hover {
    color: rgba(255,255,255,0.6);
}

.bc-sep {
    color: rgba(255,255,255,0.2);
}

.bc-current {
    color: rgba(201,162,78,0.7);
}

/* Ghost nav button */
.btn-nav {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-nav:hover {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
}

/* === LOGIN FORM === */
.login-container {
    max-width: 360px;
    margin: 120px auto;
}

.login-container h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    color: rgba(255,255,255,0.8);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    border-color: rgba(255,255,255,0.2);
}

/* === PASSWORD TOGGLE === */
.password-wrap {
    position: relative;
}
.password-wrap .form-input {
    padding-right: 44px;
}
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    padding: 4px;
    font-size: 0;
    line-height: 1;
    transition: color 0.2s ease;
}
.password-toggle:hover {
    color: rgba(255,255,255,0.5);
}
.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: #fff;
    color: #0a0a0a;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease;
    margin-top: 8px;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.admin-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* btn-nav defined above in admin-header section */

.btn-logout {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
}

/* === MESSAGES === */
.msg {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
    text-align: center;
}

.msg.error {
    display: block;
    background: rgba(239,68,68,0.1);
    color: #f87171;
    border: 1px solid rgba(239,68,68,0.2);
}

.msg.success {
    display: block;
    background: rgba(16,185,129,0.1);
    color: #34d399;
    border: 1px solid rgba(16,185,129,0.2);
}

/* === TAB NAVIGATION === */
.tab-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease 0.08s, transform 0.35s ease 0.08s;
}

.tab-nav.revealed {
    opacity: 1;
    transform: translateY(0);
}

.tab-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    padding: 10px 14px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: rgba(255,255,255,0.6);
}

.tab-btn.active {
    color: #a78bfa;
    border-bottom-color: #a78bfa;
}

/* === TAB PANELS === */
.tab-panel { display: none; }

.tab-panel.active {
    display: block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease 0.16s, transform 0.35s ease 0.16s;
}

.tab-panel.active.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* === TABLE (shared) === */
.users-table,
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table th,
.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.35);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.users-table td,
.data-table td {
    padding: 12px 14px;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.75);
}

.users-table tr:hover td,
.data-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

.users-table .email-col {
    color: #fff;
    font-weight: 500;
}

/* Clickable row */
.users-table tbody tr {
    cursor: pointer;
}

/* === BANNED ROW === */
tr.banned td {
    opacity: 0.4;
}

/* === ROLE BADGE === */
.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.role-badge.admin {
    background: rgba(239,68,68,0.12);
    color: #f87171;
}

.role-badge.user {
    background: rgba(99,102,241,0.12);
    color: #818cf8;
}

.role-badge.manager {
    background: rgba(245,158,11,0.12);
    color: #fbbf24;
}

.role-badge.staff {
    background: rgba(16,185,129,0.12);
    color: #34d399;
}

.role-badge.guest {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.45);
}

/* === SUBSCRIPTION BADGE === */
.sub-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sub-none {
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.25);
}

.sub-free {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.45);
}

.sub-basic {
    background: rgba(99,102,241,0.12);
    color: #818cf8;
}

.sub-pro {
    background: rgba(167,139,250,0.12);
    color: #a78bfa;
}

.sub-enterprise {
    background: rgba(245,158,11,0.12);
    color: #fbbf24;
}

/* === TOGGLE SWITCH === */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
    display: inline-block;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.08);
    border-radius: 11px;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s ease, background 0.3s ease;
}

.toggle input:checked + .toggle-slider {
    background: rgba(139,92,246,0.3);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #a78bfa;
}

.toggle.loading .toggle-slider {
    opacity: 0.4;
}

/* === STATUS INDICATORS === */
.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.status-dot.verified { background: #34d399; }
.status-dot.unverified { background: rgba(255,255,255,0.15); }
.status-dot.active { background: #34d399; }
.status-dot.inactive { background: #f87171; }

/* === STATUS BADGES (pool tables) === */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge.pending {
    background: rgba(245,158,11,0.12);
    color: #fbbf24;
}

.status-badge.accepted,
.status-badge.paid,
.status-badge.confirmed {
    background: rgba(16,185,129,0.12);
    color: #34d399;
}

.status-badge.rejected,
.status-badge.cancelled {
    background: rgba(239,68,68,0.12);
    color: #f87171;
}

.status-badge.expired {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.35);
}

/* === ACTION BUTTONS === */
.btn-icon {
    background: none;
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.5);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.btn-icon:hover {
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
}

.btn-delete:hover {
    border-color: rgba(239,68,68,0.3);
    color: #f87171;
    background: rgba(239,68,68,0.08);
}

.btn-ban:hover {
    border-color: rgba(245,158,11,0.3);
    color: #fbbf24;
    background: rgba(245,158,11,0.08);
}

.btn-unban:hover {
    border-color: rgba(16,185,129,0.3);
    color: #34d399;
    background: rgba(16,185,129,0.08);
}

.actions-col {
    white-space: nowrap;
}

/* === INLINE SELECT (status change) === */
.form-select-sm {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #e5e5e5;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.form-select-sm:focus {
    border-color: rgba(255,255,255,0.2);
}

.form-select-sm option {
    background: #1a1a1a;
    color: #e5e5e5;
}

/* === STATS ROW === */
.stats-row {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.stat-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 16px 20px;
    flex: 1;
}

.stat-card .num {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.stat-card .label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* === MODAL === */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: #141414;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.modal-content h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: #fff;
}

.modal .form-group {
    margin-bottom: 14px;
}

.modal .form-input,
.modal .form-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.modal .form-input:focus,
.modal .form-select:focus {
    border-color: rgba(255,255,255,0.2);
}

.modal .form-select option {
    background: #1a1a1a;
    color: #e5e5e5;
}

.form-static {
    padding: 10px 0;
    color: rgba(255,255,255,0.5);
    font-size: 0.88rem;
}

.form-row {
    display: flex;
    gap: 24px;
    margin-bottom: 14px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn-primary {
    width: auto;
    flex: 1;
    margin-top: 0;
    padding: 10px 20px;
}

.modal-actions .btn-cancel {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-actions .btn-cancel:hover {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.7);
}

/* === LOGIN HISTORY === */
.login-history {
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.login-history::-webkit-scrollbar { width: 4px; }
.login-history::-webkit-scrollbar-track { background: transparent; }
.login-history::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.login-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.82rem;
    gap: 12px;
}

.login-entry:last-child { border-bottom: none; }

.login-ip {
    color: #a78bfa;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.login-ua {
    color: rgba(255,255,255,0.4);
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.login-date {
    color: rgba(255,255,255,0.35);
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.login-history-empty {
    color: rgba(255,255,255,0.25);
    font-size: 0.82rem;
    padding: 8px 0;
}

.label-count {
    color: rgba(255,255,255,0.35);
    font-weight: 400;
    font-size: 0.85em;
}

/* === USER DEVICES LIST === */
.user-devices-list {
    max-height: 240px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.user-devices-list::-webkit-scrollbar { width: 4px; }
.user-devices-list::-webkit-scrollbar-track { background: transparent; }
.user-devices-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.device-card {
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 10px 12px;
    border: 1px solid rgba(255,255,255,0.06);
}
.device-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.device-card-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.device-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}
.device-badge-active { background: rgba(74,222,128,0.15); color: #4ade80; }
.device-badge-offline { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.4); }
.device-badge-revoked { background: rgba(248,113,113,0.15); color: #f87171; }
.device-badge-base { background: rgba(167,139,250,0.15); color: #a78bfa; }

.device-tier-ultra { background: rgba(251,191,36,0.15); color: #fbbf24; }
.device-tier-high { background: rgba(74,222,128,0.15); color: #4ade80; }
.device-tier-medium { background: rgba(96,165,250,0.15); color: #60a5fa; }
.device-tier-low { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.4); }

.device-card-details, .device-card-bench {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.device-detail {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}
.device-bench-score {
    font-weight: 700;
    font-size: 0.85rem;
}
.device-card-seen {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.25);
    margin-top: 4px;
}

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255,255,255,0.25);
    font-size: 0.9rem;
}

/* === LOADING === */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(10,10,10,0.2);
    border-top-color: #0a0a0a;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

.table-loading {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255,255,255,0.3);
    font-size: 0.9rem;
}

.hidden { display: none !important; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .admin-wrap { padding: 20px 16px; }

    .stats-row {
        flex-direction: column;
        gap: 12px;
    }

    .users-table,
    .data-table { font-size: 0.82rem; }

    .users-table th,
    .users-table td,
    .data-table th,
    .data-table td { padding: 10px 8px; }

    .admin-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .modal-content {
        margin: 16px;
        padding: 24px;
    }
}

/* ─── METRICS ────────────────────────────────────────── */
.metric-trend {
    font-weight: 600;
    font-size: 0.85rem;
}

.metric-trend.up {
    color: #4caf50;
}

.metric-trend.down {
    color: #f44336;
}

/* === CHANNELS TAB === */
.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.channel-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 24px;
}

.channel-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    color: #fff;
}

.channel-card-header svg {
    opacity: 0.6;
    flex-shrink: 0;
}

.channel-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.channel-desc {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.35);
    margin-bottom: 20px;
    line-height: 1.4;
}

.channel-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.state-label {
    font-size: 0.8rem;
    font-weight: 500;
}

.state-label.on {
    color: #34d399;
}

.state-label.off {
    color: rgba(255,255,255,0.3);
}

@media (max-width: 600px) {
    .users-table .hide-mobile,
    .data-table .hide-mobile { display: none; }

    .tab-btn {
        padding: 6px 10px;
        font-size: 0.72rem;
    }

    .channels-grid {
        grid-template-columns: 1fr;
    }

    .feedback-filters {
        flex-direction: column;
    }
}

/* ===========================================
   Feedback Tab Styles
   =========================================== */

.feedback-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.subtab-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.subtab-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
}

.subtab-btn.active {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
    color: #fff;
}

.subtab-panel {
    display: none;
}

.subtab-panel.active {
    display: block;
}

.cleanup-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: rgba(248,113,113,0.04);
    border: 1px solid rgba(248,113,113,0.12);
    border-radius: 8px;
}

.cleanup-label {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
}

.form-input-sm {
    padding: 7px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    width: 140px;
}

.form-input-sm:focus {
    border-color: rgba(255,255,255,0.2);
}

.feedback-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.form-select-sm {
    padding: 8px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.form-select-sm:focus {
    border-color: rgba(255,255,255,0.2);
}

.form-select-sm option {
    background: #1a1a1a;
    color: #fff;
}

/* Feedback badges */
.fb-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-new {
    background: rgba(255,170,0,0.15);
    color: #ffaa00;
}

.badge-progress {
    background: rgba(66,133,244,0.15);
    color: #4285f4;
}

.badge-resolved {
    background: rgba(0,200,83,0.15);
    color: #00c853;
}

.badge-closed {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.4);
}

.badge-low {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.5);
}

.badge-medium {
    background: rgba(255,170,0,0.15);
    color: #ffaa00;
}

.badge-high {
    background: rgba(255,152,0,0.18);
    color: #ff9800;
}

.badge-critical {
    background: rgba(244,67,54,0.18);
    color: #f44336;
}

.fb-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.fb-row:hover {
    background: rgba(255,255,255,0.03);
}

.fb-title {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-sm {
    padding: 4px 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sm:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.btn-danger {
    padding: 10px 16px;
    background: rgba(255,68,68,0.15);
    border: 1px solid rgba(255,68,68,0.3);
    border-radius: 10px;
    color: #ff4444;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover {
    background: rgba(255,68,68,0.25);
}

.modal-wide {
    max-width: 960px;
}

/* Device Tier Badges */
.tier-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.tier-ultra { background: rgba(167,139,250,0.2); color: #a78bfa; }
.tier-high { background: rgba(52,211,153,0.2); color: #34d399; }
.tier-medium { background: rgba(251,191,36,0.2); color: #fbbf24; }
.tier-low { background: rgba(248,113,113,0.2); color: #f87171; }

/* Feedback Detail */
.feedback-detail-body {
    max-height: 60vh;
    overflow-y: auto;
    margin: 16px 0;
}

.fb-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
}

.fb-meta strong {
    color: rgba(255,255,255,0.8);
}

.fb-section {
    margin-bottom: 16px;
}

.fb-section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.4);
    margin-bottom: 8px;
}

.fb-section p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.8);
}

.fb-device-info {
    font-size: 0.8rem;
    line-height: 1.6;
    color: rgba(255,255,255,0.6);
}

.fb-error {
    color: #ff4444 !important;
    font-family: monospace;
    font-size: 0.85rem !important;
}

.fb-logs {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(255,255,255,0.6);
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.fb-screenshot {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    transition: opacity 0.15s;
}
.fb-screenshot:hover {
    opacity: 0.8;
}

/* Screenshot lightbox */
.screenshot-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.screenshot-lightbox.open {
    display: flex;
}
.screenshot-lightbox img {
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

.fb-edit-section {
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* ===========================================
   Analytics Tab Styles (scoped to #tabAnalytics)
   =========================================== */

#tabAnalytics .date-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

#tabAnalytics .analytics-preset-btns {
    display: flex;
    gap: 4px;
}

#tabAnalytics .analytics-preset-btn {
    padding: 6px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

#tabAnalytics .analytics-preset-btn:hover {
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
}

#tabAnalytics .analytics-preset-btn.active {
    background: rgba(167,139,250,0.15);
    border-color: rgba(167,139,250,0.3);
    color: #a78bfa;
}

#tabAnalytics .date-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

#tabAnalytics .date-inputs label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
}

#tabAnalytics .date-input {
    padding: 5px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: #e5e5e5;
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    color-scheme: dark;
}

#tabAnalytics .date-input:focus {
    border-color: rgba(167,139,250,0.4);
}

#tabAnalytics .yoy-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

#tabAnalytics .yoy-toggle label {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
}

#tabAnalytics .yoy-toggle input[type="checkbox"] {
    accent-color: #a78bfa;
}

/* KPI Cards */
#tabAnalytics .kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

#tabAnalytics .kpi-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 16px;
    transition: border-color 0.2s;
}

#tabAnalytics .kpi-card:hover {
    border-color: rgba(255,255,255,0.1);
}

#tabAnalytics .kpi-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

#tabAnalytics .kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #fff;
}

#tabAnalytics .kpi-change {
    font-size: 0.75rem;
    margin-top: 4px;
    font-weight: 500;
}

#tabAnalytics .kpi-change.up { color: #34d399; }
#tabAnalytics .kpi-change.down { color: #f87171; }

/* Section Title */
#tabAnalytics .analytics-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    margin-bottom: 16px;
    margin-top: 8px;
    letter-spacing: -0.01em;
}

/* Chart Cards */
#tabAnalytics .chart-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

#tabAnalytics .chart-card h3 {
    font-size: 0.82rem;
    font-weight: 500;
    color: rgba(255,255,255,0.45);
    margin-bottom: 12px;
}

#tabAnalytics .chart-card canvas {
    max-height: 260px;
}

/* Grid Layouts */
#tabAnalytics .charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

#tabAnalytics .charts-halves {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

#tabAnalytics .charts-thirds {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

/* Properties Table */
#tabAnalytics .properties-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
}

#tabAnalytics .properties-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

#tabAnalytics .properties-table th {
    text-align: left;
    padding: 10px 12px;
    color: rgba(255,255,255,0.35);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

#tabAnalytics .properties-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.7);
}

#tabAnalytics .properties-table tr:hover td {
    background: rgba(255,255,255,0.02);
}

#tabAnalytics .trend-up { color: #34d399; }
#tabAnalytics .trend-down { color: #f87171; }

/* Responsive */
@media (max-width: 900px) {
    #tabAnalytics .charts-row {
        grid-template-columns: 1fr;
    }
    #tabAnalytics .charts-halves {
        grid-template-columns: 1fr;
    }
    #tabAnalytics .charts-thirds {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    #tabAnalytics .kpi-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    #tabAnalytics .date-controls {
        flex-direction: column;
        align-items: flex-start;
    }
    #tabAnalytics .yoy-toggle {
        margin-left: 0;
    }
}

/* ═══════════════════════════════════════════════════════
   AI CACHE TAB
   ═══════════════════════════════════════════════════════ */

.aicache-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.aicache-table-wrap {
    overflow-x: auto;
}

.sql-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255,255,255,0.6);
}

.curated-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.curated-yes {
    background: rgba(0,200,83,0.15);
    color: #00c853;
}

.curated-no {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.35);
}

.aicache-pagination {
    display: flex;
    gap: 6px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.page-btn {
    padding: 6px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.page-btn.active {
    background: rgba(255,170,0,0.15);
    border-color: rgba(255,170,0,0.3);
    color: #ffaa00;
}

/* ═══════════════════════════════════════════════════════
   TABLE SEARCH, SORT & LAZY LOAD
   ═══════════════════════════════════════════════════════ */

/* Table Search */
.table-search-wrap { display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.search-input-wrap { position:relative; flex:1; max-width:400px; }
.search-icon { position:absolute; left:12px; top:50%; transform:translateY(-50%);
    color:rgba(255,255,255,0.25); pointer-events:none; font-size:0.85rem; }
.table-search { width:100%; padding:10px 14px 10px 36px;
    background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.08);
    border-radius:10px; color:#fff; font-size:0.88rem; font-family:inherit; outline:none;
    transition:border-color 0.3s ease; }
.table-search:focus { border-color:rgba(255,255,255,0.2); }
.table-search::placeholder { color:rgba(255,255,255,0.25); }
.search-count { font-size:0.8rem; color:rgba(255,255,255,0.35); white-space:nowrap; }

/* Sort indicators on th */
th[data-sort] { cursor:pointer; user-select:none; position:relative; padding-right:20px !important; }
th[data-sort]:hover { color:rgba(255,255,255,0.6); }
th[data-sort]::after { content:'\21C5'; position:absolute; right:4px; top:50%; transform:translateY(-50%);
    font-size:0.6rem; opacity:0.3; }
th.sort-asc::after { content:'\2191'; opacity:0.8; color:#a78bfa; }
th.sort-desc::after { content:'\2193'; opacity:0.8; color:#a78bfa; }

/* Lazy sentinel */
.lazy-sentinel td { text-align:center; padding:16px; border-bottom:none; }
.table-spinner { display:inline-block; width:16px; height:16px;
    border:2px solid rgba(255,255,255,0.1); border-top-color:rgba(255,255,255,0.4);
    border-radius:50%; animation:spin 0.6s linear infinite; }

@media (max-width: 600px) {
    .table-search-wrap { flex-direction:column; align-items:stretch; }
    .search-input-wrap { max-width:none; }
}

/* === POOLS TAB === */
.invite-code {
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    color: #a78bfa;
    font-weight: 600;
    font-size: 0.85rem;
}

.pool-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.pool-type-public { background: rgba(52,211,153,0.15); color: #34d399; }
.pool-type-private { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.5); }
.pool-type-invite { background: rgba(167,139,250,0.15); color: #a78bfa; }

.rating-stars { white-space: nowrap; }
.rating-star { color: rgba(255,255,255,0.15); font-size: 0.9rem; }
.rating-star.active { color: #fbbf24; }

.btn-danger-sm {
    background: rgba(248,113,113,0.12);
    color: #f87171;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-danger-sm:hover { background: rgba(248,113,113,0.25); }

.toggle-sm { transform: scale(0.8); }

#poolDetailModal .form-row { display: flex; gap: 16px; margin-bottom: 12px; }
#poolDetailModal .form-row .form-group { flex: 1; }
#poolDetailModal .form-static { padding: 8px 0; color: rgba(255,255,255,0.7); }
