/* Reddit Helper Admin Panel — Dark Theme v2.4.0 */

:root {
    --bg: #1a1a1b;
    --bg-2: #1f1f20;
    --bg-3: #272729;
    --bg-head: #1f1f20;
    --border: #343536;
    --border-2: #2c2c2e;
    --text: #d7dadc;
    --text-2: #c9ccce;
    --text-muted: #818384;
    --accent: #d93a00;
    --accent-hover: #b32f00;
    --ok: #46d160;
    --err: #ff6b6b;
    --blue: #4a90d9;
    --purple: #9b59b6;
    --teal: #1abc9c;
    --amber: #f39c12;
}

[data-theme="light"] {
    --bg: #ffffff;
    --bg-2: #f7f8f9;
    --bg-3: #eef0f2;
    --bg-head: #f7f8f9;
    --border: #d6d8db;
    --border-2: #e2e4e7;
    --text: #1a1a1b;
    --text-2: #2b2c2d;
    --text-muted: #66686a;
    --accent: #d93a00;
    --accent-hover: #b32f00;
    --ok: #1a8917;
    --err: #c0271e;
    --blue: #2a6cb5;
    --purple: #7d3c98;
    --teal: #148f77;
    --amber: #d68910;
}

[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="datetime-local"] {
    color-scheme: light;
}

[data-theme="light"] select,
[data-theme="light"] .rha-filter-select,
[data-theme="light"] .rha-perpage-select {
    color-scheme: light;
    background: #fff;
    color: #1a1a1b;
    border-color: #d6d8db;
}
[data-theme="light"] select option {
    background: #fff;
    color: #1a1a1b;
}

[data-theme="light"] .rha-logo-text {
    color: var(--accent);
}

[data-theme="light"] .rha-nav-link:hover,
[data-theme="light"] .rha-nav-more-btn:hover,
[data-theme="light"] .rha-nav-more.is-open > .rha-nav-more-btn {
    color: #1a1a1b;
}

[data-theme="light"] .rha-nav-active {
    color: #1a1a1b;
}

[data-theme="light"] .rha-flash-error {
    background: rgba(192, 39, 30, 0.1);
    border: 1px solid rgba(192, 39, 30, 0.3);
}

[data-theme="light"] .rha-flash-success {
    background: rgba(26, 137, 23, 0.1);
    border: 1px solid rgba(26, 137, 23, 0.3);
}

[data-theme="light"] .rha-role-admin {
    background: rgba(217, 58, 0, 0.12);
}

[data-theme="light"] .rha-role-farmer {
    background: rgba(26, 137, 23, 0.12);
}

[data-theme="light"] .rha-role-client {
    background: rgba(74, 144, 217, 0.12);
}

[data-theme="light"] .rha-btn-danger {
    background: rgba(192, 39, 30, 0.1);
    border-color: rgba(192, 39, 30, 0.3);
    color: #c0271e;
}

[data-theme="light"] .rha-btn-danger:hover {
    background: rgba(192, 39, 30, 0.2);
}

[data-theme="light"] .rha-header {
    border-bottom-color: var(--border);
}

[data-theme="light"] .rha-profile-dropdown {
    background: var(--bg-2);
    border-color: var(--border);
}

/* ── Theme Toggle ── */

.rha-theme-toggle {
    font-size: 14px;
    line-height: 1;
    padding: 3px 6px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.rha-theme-toggle:hover {
    opacity: 1;
}

/* ── Language Toggle ── */

.rha-lang-toggle {
    font-size: 11px;
    padding: 3px 8px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.rha-lang-toggle:hover {
    opacity: 1;
}

/* ── Reset & Base ── */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a {
    color: var(--accent);
}

/* ── Header ── */

.rha-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-head);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 52px;
    gap: 16px;
}

.rha-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.rha-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    text-decoration: none;
    flex-shrink: 0;
}

.rha-logo-text {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}

.rha-role-label {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 2px;
}

.rha-header-info {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 12px;
    white-space: nowrap;
}

.rha-header-info-ver {
    opacity: 0.8;
}

.rha-header-info-sep {
    margin: 0 4px;
    opacity: 0.5;
}

/* Keep .rha-logo for backward compat */
.rha-logo {
    color: var(--accent);
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
}

.rha-version {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 8px;
}

/* ── Header Navigation (center) ── */

.rha-header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: visible;
}

.rha-header-right {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

/* ── Nav Links ── */

.rha-nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 14px 10px;
    transition: color 0.15s;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.rha-nav-link:hover {
    color: #fff;
}

.rha-nav-active {
    color: #fff;
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
}

/* ── More Dropdown ── */

.rha-nav-more {
    position: relative;
}

.rha-nav-more-btn {
    color: var(--text-muted);
    font-size: 13px;
    padding: 14px 10px;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    white-space: nowrap;
    transition: color 0.15s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.rha-nav-more-btn:hover {
    color: #fff;
}

.rha-nav-more-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 200;
}

.rha-nav-more:hover .rha-nav-more-menu,
.rha-nav-more.is-open .rha-nav-more-menu {
    display: block;
}

.rha-nav-more-menu .rha-nav-link {
    display: block;
    padding: 8px 16px;
    border-bottom: none;
    margin-bottom: 0;
}

.rha-nav-more-menu .rha-nav-link:hover {
    background: var(--bg-3);
}

.rha-nav-more-menu .rha-nav-active {
    border-bottom: none;
    color: var(--accent);
}

/* ── Profile Dropdown ── */

.rha-profile-area {
    position: relative;
}

.rha-profile-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.rha-profile-toggle:hover {
    background: var(--bg-3);
}

.rha-profile-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 0;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 200;
}

.rha-profile-area:hover .rha-profile-dropdown {
    display: block;
}

.rha-profile-dropdown a,
.rha-profile-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.rha-profile-dropdown a:hover,
.rha-profile-dropdown button:hover {
    background: var(--bg-3);
    color: var(--text);
}

.rha-profile-dropdown .rha-logout-btn {
    color: var(--err);
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 10px;
}

.rha-username {
    color: var(--text-muted);
    font-size: 13px;
}

.rha-logout-form {
    display: inline;
}

/* ── Main ── */

.rha-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 20px;
}

/* ── Footer ── */

.rha-footer {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.rha-footer .rha-server-clock,
.rha-footer .rha-page-load {
    color: var(--text-muted);
}

/* ── Flash Messages ── */

.rha-flash {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
}

.rha-flash-error {
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: var(--err);
}

.rha-flash-success {
    background: rgba(70, 209, 96, 0.15);
    border: 1px solid rgba(70, 209, 96, 0.4);
    color: var(--ok);
}

/* ── Auth Card ── */

.rha-auth-card {
    max-width: 380px;
    margin: 60px auto;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 32px;
}

.rha-auth-title {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    margin: 0 0 24px;
}

.rha-auth-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Form ── */

.rha-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rha-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rha-field span {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rha-field input,
.rha-field select {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.rha-field input:focus,
.rha-field select:focus {
    outline: none;
    border-color: var(--accent);
}

.rha-code-input {
    text-align: center;
    font-size: 24px;
    letter-spacing: 0.3em;
    font-weight: 700;
}

/* ── 2FA Digit Boxes ── */

.rha-2fa-digits {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 8px 0;
}

.rha-2fa-digit {
    width: 44px;
    height: 52px;
    background: var(--bg-3);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    font-family: inherit;
    transition: border-color 0.15s;
    caret-color: var(--accent);
}

.rha-2fa-digit:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Select Dropdowns (dark theme) ── */

select {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
    color-scheme: dark;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23818384' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

select option {
    background: var(--bg-2);
    color: var(--text);
}

[data-theme="light"] select {
    color-scheme: light;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2366686a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

/* ── Buttons ── */

.rha-btn {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.rha-btn:hover {
    background: var(--border);
}

.rha-btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.rha-btn-primary:hover {
    background: var(--accent-hover);
}

.rha-btn-full {
    width: 100%;
}

.rha-btn-sm {
    padding: 4px 10px;
    font-size: 11px;
}

.rha-btn-danger {
    background: rgba(255, 107, 107, 0.15);
    border-color: rgba(255, 107, 107, 0.4);
    color: #ff6b6b;
}
.rha-btn-danger:hover {
    background: rgba(255, 107, 107, 0.3);
}

/* ── Filters ── */

.rha-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-end;
}

.rha-filter {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rha-filter span {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.rha-filter input,
.rha-filter select {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.rha-filter input:focus,
.rha-filter select:focus {
    outline: none;
    border-color: var(--accent);
}

.rha-filter-wide {
    flex: 1;
    min-width: 200px;
}

.rha-filter input[type="date"],
.rha-filter input[type="datetime-local"] {
    color-scheme: dark;
}

[data-theme="light"] .rha-filter input[type="date"],
[data-theme="light"] .rha-filter input[type="datetime-local"] {
    color-scheme: light;
}

/* ── Mode Tabs ── */

.rha-mode-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
    width: fit-content;
}

.rha-mode-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}

.rha-mode-tab:hover {
    color: var(--text);
    background: var(--bg-2);
}

.rha-mode-tab.active {
    background: var(--accent);
    color: #fff;
}

/* ── Client Cards ── */

.rha-client-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.rha-client-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.rha-client-name {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.rha-client-stats {
    display: flex;
    gap: 16px;
}

.rha-stat {
    font-size: 13px;
    color: var(--text-muted);
}

.rha-stat strong {
    color: var(--text);
}

.rha-client-card .rha-table-wrap {
    border-radius: 6px;
}

/* ── Table ── */

.rha-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.rha-table {
    width: 100%;
    border-collapse: collapse;
}

.rha-table th {
    background: var(--bg-head);
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.rha-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-2);
    font-size: 13px;
}

.rha-table tr:last-child td {
    border-bottom: none;
}

.rha-table tbody tr {
    transition: background 0.1s;
}

.rha-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}

.rha-clickable {
    cursor: pointer;
}

.rha-clickable:hover td {
    background: var(--bg-3);
}

.rha-truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rha-nowrap {
    white-space: nowrap;
}

.rha-empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
}

/* ── Pagination ── */

.rha-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.rha-page-info {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Page Title ── */

.rha-page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 24px;
}

/* ── Detail Card ── */

.rha-detail-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rha-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.rha-detail-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rha-detail-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rha-detail-full {
    width: 100%;
}

.rha-detail-text {
    background: var(--bg-3);
    border: 1px solid var(--border-2);
    border-radius: 8px;
    padding: 14px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    margin: 0;
    color: var(--text);
}

/* ── Role Badges ── */

.rha-role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.rha-role-admin {
    background: rgba(217, 58, 0, 0.2);
    color: var(--accent);
}

.rha-role-farmer {
    background: rgba(70, 209, 96, 0.2);
    color: var(--ok);
}

.rha-role-client {
    background: rgba(74, 144, 217, 0.2);
    color: var(--blue);
}

.rha-user-locked-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(217, 58, 0, 0.18);
    color: var(--accent);
    cursor: help;
}

.rha-btn-unlock {
    background: var(--ok) !important;
    color: #fff !important;
    border-color: var(--ok) !important;
}

.rha-btn-unlock:hover {
    background: #3aa850 !important;
    border-color: #3aa850 !important;
}

/* ── Style Badges ── */

.rha-style-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.rha-style-badge.casual {
    background: rgba(217, 58, 0, 0.2);
    color: var(--accent);
}

.rha-style-badge.professional {
    background: rgba(74, 144, 217, 0.2);
    color: var(--blue);
}

.rha-style-badge.analytical {
    background: rgba(155, 89, 182, 0.2);
    color: var(--purple);
}

.rha-style-badge.technical {
    background: rgba(26, 188, 156, 0.2);
    color: var(--teal);
}

.rha-style-badge.storyteller {
    background: rgba(243, 156, 18, 0.2);
    color: var(--amber);
}

/* ── Subreddit Link ── */

.rha-sub-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.rha-sub-link:hover {
    text-decoration: underline;
}

/* ── Stat Change Indicators ── */

.rha-stat-change {
    font-size: 12px;
    font-weight: 600;
    color: var(--ok);
}

.rha-stat-change.negative {
    color: var(--err);
}

/* ── Heatmap Legend ── */

.rha-heat-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.rha-heat-legend-bar {
    display: flex;
    gap: 2px;
    align-items: center;
}

.rha-heat-legend-bar span {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* ── Dashboard ── */

.rha-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.rha-stat-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rha-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rha-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.rha-stat-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.rha-dashboard-section {
    margin-bottom: 28px;
}

.rha-dashboard-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text);
}

/* ── Charts ── */

.rha-chart-container {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
}

.rha-chart-container canvas {
    width: 100% !important;
    max-height: 300px;
}

/* ── Heatmap ── */

.rha-heatmap-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
}

.rha-heatmap {
    border-collapse: collapse;
    width: 100%;
}

.rha-heatmap th {
    padding: 8px 10px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.rha-heatmap td {
    padding: 6px 10px;
    font-size: 13px;
    text-align: center;
    border-bottom: 1px solid var(--border-2);
    font-variant-numeric: tabular-nums;
}

.rha-heatmap td:first-child {
    text-align: left;
    font-weight: 500;
    color: var(--text);
}

.rha-heat-0 { background: transparent; color: var(--text-muted); }
.rha-heat-1 { background: rgba(217, 58, 0, 0.1); color: var(--text); }
.rha-heat-2 { background: rgba(217, 58, 0, 0.2); color: var(--text); }
.rha-heat-3 { background: rgba(217, 58, 0, 0.35); color: #fff; }
.rha-heat-4 { background: rgba(217, 58, 0, 0.55); color: #fff; }
.rha-heat-5 { background: rgba(217, 58, 0, 0.75); color: #fff; }

/* ── Export buttons ── */

.rha-export-btns {
    display: inline-flex;
    gap: 6px;
    margin-left: 8px;
}

/* ── Audit Log ── */

.rha-audit-event {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.rha-audit-login_ok { background: rgba(70, 209, 96, 0.15); color: var(--ok); }
.rha-audit-login_failed { background: rgba(255, 107, 107, 0.15); color: var(--err); }
.rha-audit-2fa_ok { background: rgba(70, 209, 96, 0.15); color: var(--ok); }
.rha-audit-2fa_failed { background: rgba(255, 107, 107, 0.15); color: var(--err); }
.rha-audit-logout { background: rgba(129, 131, 132, 0.15); color: var(--text-muted); }
.rha-audit-session_revoked { background: rgba(255, 176, 136, 0.15); color: var(--accent); }
.rha-audit-user_created { background: rgba(70, 209, 96, 0.15); color: var(--ok); }
.rha-audit-password_reset { background: rgba(255, 176, 136, 0.15); color: var(--accent); }
.rha-audit-totp_reset { background: rgba(255, 176, 136, 0.15); color: var(--accent); }
.rha-audit-user_deleted { background: rgba(255, 107, 107, 0.15); color: var(--err); }
.rha-audit-cross_client { background: rgba(255, 107, 107, 0.3); color: var(--err); }

/* ── User Management ── */

.rha-user-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.rha-user-actions form {
    margin: 0;
}

.rha-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.rha-modal-overlay[hidden] {
    display: none !important;
}

.rha-modal {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.rha-modal h2 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 16px 0;
}

.rha-modal-result {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
    word-break: break-all;
}

.rha-modal-close {
    margin-top: 12px;
}

/* ── Validation Stats ── */

.rha-val-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.rha-score-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-3);
    overflow: hidden;
    margin-top: 6px;
}

.rha-score-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--accent);
    transition: width 0.3s ease;
}

/* ── Published Badge ── */

.rha-badge-published {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.rha-badge-published[data-status="yes"] {
    background: rgba(70, 209, 96, 0.15);
    color: var(--ok);
}

.rha-badge-published[data-status="no"] {
    background: rgba(129, 131, 132, 0.1);
    color: var(--text-muted);
}

/* ── Top subreddits list ── */

.rha-top-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rha-top-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-2);
    font-size: 13px;
}

.rha-top-item:last-child {
    border-bottom: none;
}

.rha-top-name {
    color: var(--text);
}

.rha-top-count {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ── Hours bar chart (CSS only) ── */

.rha-hours-grid {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 60px;
    padding: 0;
}

.rha-hour-bar {
    flex: 1;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    min-width: 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
    position: relative;
}

.rha-hour-bar:hover {
    opacity: 1;
}

.rha-hours-labels {
    display: flex;
    gap: 2px;
    font-size: 9px;
    color: var(--text-muted);
}

.rha-hours-labels span {
    flex: 1;
    text-align: center;
}

/* ── Calendar ── */
.rha-calendar-wrap { overflow-x: auto; margin-bottom: 24px; }
.rha-calendar { display: flex; gap: 3px; }
.rha-cal-week { display: flex; flex-direction: column; gap: 3px; }
.rha-cal-day {
    width: 14px; height: 14px; border-radius: 3px;
    display: block; text-decoration: none;
}
.rha-cal-0 { background: var(--bg-3); }
.rha-cal-1 { background: rgba(217,58,0,0.25); }
.rha-cal-2 { background: rgba(217,58,0,0.45); }
.rha-cal-3 { background: rgba(217,58,0,0.65); }
.rha-cal-4 { background: rgba(217,58,0,0.85); }
.rha-cal-future { opacity: 0.2; pointer-events: none; }

/* ── Collapsible filters ── */
.rha-collapsed { display: none !important; }
.rha-toggle-filters { margin-bottom: 12px; }

/* ── Copy button ── */
.rha-copy-btn { margin-top: 8px; }

/* ── Breadcrumbs ── */
.rha-breadcrumbs {
    font-size: 12px; color: var(--text-muted); margin-bottom: 16px;
    display: flex; align-items: center; gap: 6px;
}
.rha-breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.rha-breadcrumbs a:hover { color: var(--text); }

/* ── Sortable headers ── */
.rha-table th[data-sort="asc"]::after { content: " \2191"; }
.rha-table th[data-sort="desc"]::after { content: " \2193"; }

/* ── Tags ── */
.rha-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600;
    background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
}
.rha-tag-del {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 14px; padding: 0; line-height: 1;
}
.rha-tag-del:hover { color: var(--err); }

/* ── Notes ── */
.rha-note {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 10px; background: var(--bg-3); border-radius: 6px;
    margin-bottom: 6px; font-size: 13px;
}
.rha-note-text { flex: 1; color: var(--text); }
.rha-note-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── New generations banner ── */
.rha-new-banner {
    display: block;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: rgba(70,209,96,0.15);
    border: 1px solid rgba(70,209,96,0.4);
    color: var(--ok);
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.rha-new-banner[hidden] { display: none !important; }
.rha-new-banner:hover { background: rgba(70,209,96,0.25); }

/* ── Search highlight ── */
.rha-highlight {
    background: rgba(245,200,66,0.35);
    color: inherit;
    padding: 1px 2px;
    border-radius: 2px;
}

/* ── Bulk operations ── */
.rha-bulk-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: var(--bg-2);
    border: 1px solid var(--accent);
    border-radius: 8px;
    font-size: 13px;
}
.rha-bulk-bar[hidden] { display: none !important; }

/* ── Responsive ── */

@media (max-width: 1024px) {
    .rha-header-nav {
        gap: 2px;
    }
    .rha-nav-link {
        padding: 14px 6px;
        font-size: 12px;
    }
    .rha-nav-more-btn {
        padding: 14px 6px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .rha-header {
        height: auto;
        min-height: 52px;
        flex-wrap: wrap;
        padding: 8px 12px;
        gap: 8px;
    }

    .rha-header-left {
        order: 1;
    }

    .rha-header-right {
        order: 2;
    }

    .rha-header-nav {
        order: 3;
        width: 100%;
        overflow: visible;
        padding-bottom: 4px;
        border-top: 1px solid var(--border);
        padding-top: 8px;
    }

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

    .rha-filter-wide {
        min-width: 0;
    }

    .rha-main {
        padding: 16px 12px;
    }

    .rha-detail-card {
        padding: 16px;
    }

    .rha-auth-card {
        margin: 30px auto;
        padding: 24px;
    }

    .rha-dashboard {
        grid-template-columns: 1fr 1fr;
    }

    .rha-val-grid {
        grid-template-columns: 1fr;
    }

    .rha-logo-text {
        font-size: 13px;
    }

    .rha-role-label,
    .rha-header-info {
        display: none;
    }
}

@media (max-width: 480px) {
    .rha-dashboard {
        grid-template-columns: 1fr;
    }
}

/* ══════════════════════════════════════════════════
   Mockup design classes (added post-redesign)
   ══════════════════════════════════════════════════ */

/* ── Auth Brand (Login / 2FA) ── */

.rha-auth-brand {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    color: var(--text);
    margin-bottom: 4px;
}

.rha-auth-version {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 20px;
}

/* ── 2FA Digit Boxes ── */

.rha-digit-boxes {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 8px 0 16px;
}

.rha-digit {
    width: 44px;
    height: 52px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    font-family: inherit;
    transition: border-color 0.15s;
}

.rha-digit:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Dashboard: Chart Card ── */

.rha-chart-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 28px;
}

.rha-chart-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.rha-chart-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--text);
}

.rha-chart-legend {
    display: flex;
    gap: 16px;
    align-items: center;
}

.rha-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.rha-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* ── Dashboard: Two-column Row ── */

.rha-dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.rha-dashboard-panel {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.rha-dashboard-panel h2 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px 0;
    color: var(--text);
}

@media (max-width: 768px) {
    .rha-dashboard-row {
        grid-template-columns: 1fr;
    }
}

/* ── Dashboard: Top Badge ── */

.rha-top-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(217, 58, 0, 0.2);
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

[data-theme="light"] .rha-top-badge {
    background: rgba(217, 58, 0, 0.12);
}

/* ── Dashboard: Secondary Stats ── */

.rha-secondary-stats {
    opacity: 0.85;
}

.rha-stat-card-sm {
    padding: 14px 16px;
}

.rha-stat-card-sm .rha-stat-value {
    font-size: 22px;
}

/* ── Generations: Filter Row ── */

.rha-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.rha-filter-select {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    min-width: 100px;
}

.rha-filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

.rha-filter-input {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.rha-filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

.rha-filter-date {
    width: 130px;
    color-scheme: dark;
}

[data-theme="light"] .rha-filter-date {
    color-scheme: light;
}

.rha-filter-search {
    flex: 1;
    min-width: 140px;
}

.rha-btn-filter {
    padding: 7px 18px;
}

/* ── Generations: Export Buttons ── */

.rha-btn-export {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.rha-btn-export:hover {
    background: var(--border);
    color: var(--text);
}

.rha-btn-export svg {
    flex-shrink: 0;
}

/* ── Generations: Style Pills ── */

.rha-style-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.rha-style-casual {
    background: rgba(217, 58, 0, 0.2);
    color: var(--accent);
}

.rha-style-professional {
    background: rgba(74, 144, 217, 0.2);
    color: var(--blue);
}

.rha-style-analytical {
    background: rgba(155, 89, 182, 0.2);
    color: var(--purple);
}

.rha-style-technical {
    background: rgba(26, 188, 156, 0.2);
    color: var(--teal);
}

.rha-style-storyteller {
    background: rgba(243, 156, 18, 0.2);
    color: var(--amber);
}

/* Light theme style pills */
[data-theme="light"] .rha-style-casual { background: rgba(217,58,0,0.12); }
[data-theme="light"] .rha-style-professional { background: rgba(74,144,217,0.12); }
[data-theme="light"] .rha-style-analytical { background: rgba(155,89,182,0.12); }
[data-theme="light"] .rha-style-technical { background: rgba(26,188,156,0.12); }
[data-theme="light"] .rha-style-storyteller { background: rgba(243,156,18,0.12); }

/* ── Generations: Time Cell ── */

.rha-time-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.rha-time-date {
    font-size: 11px;
    color: var(--text-muted);
}

.rha-time-clock {
    font-weight: 600;
    font-size: 13px;
}

.rha-id-cell {
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* ── Generations: Bulk Bar Updates ── */

.rha-bulk-count {
    color: var(--accent);
    font-weight: 600;
}

.rha-bulk-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.rha-btn-publish {
    background: rgba(70, 209, 96, 0.15);
    border: 1px solid rgba(70, 209, 96, 0.4);
    color: var(--ok);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
}

.rha-btn-publish:hover {
    background: rgba(70, 209, 96, 0.25);
}

.rha-btn-delete {
    background: rgba(255, 107, 107, 0.15);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: var(--err);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
}

.rha-btn-delete:hover {
    background: rgba(255, 107, 107, 0.25);
}

/* ── Generations: Row Selected ── */

.rha-row-selected td {
    background: rgba(217, 58, 0, 0.06) !important;
}

/* ── Generations: Pagination ── */

.rha-page-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}

.rha-page-btn:hover {
    background: var(--border);
}

.rha-page-btn-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.rha-perpage-form {
    display: inline-flex;
    margin-left: 12px;
}

.rha-perpage-select {
    font-size: 12px;
    padding: 4px 8px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 4px;
    font-family: inherit;
}

/* ── Heatmap Legend ── */

.rha-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.rha-heatmap-legend-label {
    margin: 0 4px;
}

.rha-heatmap-legend-sq {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

/* ── Wider main for tables ── */

.rha-main {
    max-width: 1200px;
}

/* ══════════════════════════════════════════════════
   Feature 65: Sticky First Column
   ══════════════════════════════════════════════════ */

.rha-table-sticky td:first-child,
.rha-table-sticky th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--bg-2);
}

.rha-table-sticky th:first-child {
    background: var(--bg-head);
    z-index: 2;
}

/* ══════════════════════════════════════════════════
   Feature 68: Transitions
   ══════════════════════════════════════════════════ */

.rha-main {
    animation: rhaFadeIn 0.2s ease;
}

@keyframes rhaFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.rha-stat-card,
.rha-dashboard-panel,
.rha-chart-card,
.rha-detail-card,
.rha-client-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rha-stat-card:hover,
.rha-dashboard-panel:hover,
.rha-chart-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.rha-table tbody tr {
    transition: background 0.15s ease;
}

.rha-btn {
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.rha-btn:active {
    transform: scale(0.97);
}

/* ══════════════════════════════════════════════════
   Feature 69: Toast Notifications
   ══════════════════════════════════════════════════ */

.rha-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

.rha-toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 420px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    background: var(--bg-2);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    position: relative;
    overflow: hidden;
    animation: rhaToastIn 0.25s ease;
}

.rha-toast.rha-toast-out {
    animation: rhaToastOut 0.2s ease forwards;
}

@keyframes rhaToastIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: none; }
}

@keyframes rhaToastOut {
    from { opacity: 1; transform: none; }
    to   { opacity: 0; transform: translateX(40px); }
}

.rha-toast-success {
    border-left: 4px solid var(--ok);
}

.rha-toast-error {
    border-left: 4px solid var(--err);
}

.rha-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    animation: rhaToastProgress 5s linear forwards;
}

@keyframes rhaToastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

.rha-toast-close {
    position: absolute;
    top: 6px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px;
}

.rha-toast-close:hover {
    color: var(--text);
}

/* ══════════════════════════════════════════════════
   Feature 61: Command Palette
   ══════════════════════════════════════════════════ */

.rha-cmd-palette {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
}

.rha-cmd-palette[hidden] {
    display: none !important;
}

.rha-cmd-palette-inner {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 480px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    overflow: hidden;
    animation: rhaFadeIn 0.15s ease;
}

.rha-cmd-input {
    width: 100%;
    padding: 14px 18px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}

.rha-cmd-input::placeholder {
    color: var(--text-muted);
}

.rha-cmd-results {
    max-height: 300px;
    overflow-y: auto;
    padding: 6px 0;
}

.rha-cmd-item {
    padding: 10px 18px;
    font-size: 14px;
    color: var(--text-2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.1s;
}

.rha-cmd-item:hover,
.rha-cmd-item.rha-cmd-active {
    background: var(--bg-3);
    color: var(--text);
}

.rha-cmd-item-hint {
    font-size: 11px;
    color: var(--text-muted);
}

.rha-cmd-footer {
    padding: 8px 18px;
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

.rha-cmd-footer kbd {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: inherit;
    font-size: 10px;
}

/* ══════════════════════════════════════════════════
   Feature 63: Keyboard Shortcuts Help Modal
   ══════════════════════════════════════════════════ */

.rha-shortcuts-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rha-shortcuts-modal[hidden] {
    display: none !important;
}

.rha-shortcuts-inner {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 28px;
    max-width: 420px;
    width: 90vw;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
    animation: rhaFadeIn 0.15s ease;
}

.rha-shortcuts-inner h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
}

.rha-shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-2);
    border-bottom: 1px solid var(--border-2);
}

.rha-shortcut-row:last-child {
    border-bottom: none;
}

.rha-shortcut-row kbd {
    background: var(--bg-3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: inherit;
    font-size: 12px;
    color: var(--text);
    min-width: 28px;
    text-align: center;
}

/* ══════════════════════════════════════════════════
   Feature 67: Context Menu
   ══════════════════════════════════════════════════ */

.rha-context-menu {
    position: fixed;
    z-index: 200;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 0;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.rha-context-menu[hidden] {
    display: none !important;
}

.rha-context-menu-item {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-2);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}

.rha-context-menu-item:hover {
    background: var(--bg-3);
    color: var(--text);
}

/* ══════════════════════════════════════════════════
   Feature 64: Infinite Scroll Toggle
   ══════════════════════════════════════════════════ */

.rha-scroll-toggle {
    display: inline-flex;
    gap: 0;
    margin-left: 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.rha-scroll-toggle-btn {
    padding: 4px 12px;
    font-size: 11px;
    background: var(--bg-3);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s;
}

.rha-scroll-toggle-btn.active {
    background: var(--accent);
    color: #fff;
}

.rha-scroll-loading {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

.rha-scroll-loading[hidden] {
    display: none !important;
}

/* ══════════════════════════════════════════════════
   Feature 66: Mini Sparklines
   ══════════════════════════════════════════════════ */

.rha-sparkline {
    display: inline-block;
    vertical-align: middle;
}

.rha-sparkline svg {
    display: block;
}

/* ══════════════════════════════════════════════════
   Feature 70: Responsive Tables (Card Layout)
   ══════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .rha-table-responsive thead {
        display: none;
    }

    .rha-table-responsive tbody tr {
        display: block;
        margin-bottom: 12px;
        background: var(--bg-2);
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 12px 16px;
    }

    .rha-table-responsive tbody tr:hover {
        background: var(--bg-3);
    }

    .rha-table-responsive td {
        display: block;
        padding: 4px 0;
        border-bottom: none;
        font-size: 13px;
        text-align: left;
    }

    .rha-table-responsive td::before {
        content: attr(data-label);
        display: inline-block;
        font-size: 11px;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        margin-right: 8px;
        min-width: 80px;
        font-weight: 600;
    }

    .rha-table-responsive td:empty::before {
        display: none;
    }

    .rha-table-wrap {
        border: none;
        border-radius: 0;
    }

    .rha-truncate {
        max-width: none;
        white-space: normal;
    }
}

/* ══════════════════════════════════════════════════
   Features 71–80
   ══════════════════════════════════════════════════ */

/* ── 71. Column Visibility Toggle ── */

.rha-col-toggle {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.rha-col-toggle-btn {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.rha-col-toggle-btn:hover {
    background: var(--border);
}

.rha-col-toggle-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 0;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 50;
}

.rha-col-toggle-menu.rha-col-open {
    display: block;
}

.rha-col-toggle-menu label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.1s;
}

.rha-col-toggle-menu label:hover {
    background: var(--bg-3);
}

/* ── 72. Group by Date ── */

.rha-date-separator td {
    background: var(--bg-3) !important;
    padding: 8px 14px !important;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
}

.rha-date-separator:hover td {
    background: var(--bg-3) !important;
}

/* ── 73. Scroll to Top ── */

.rha-scroll-top {
    position: fixed;
    bottom: 60px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s, background 0.15s;
    z-index: 90;
}

.rha-scroll-top.rha-scroll-visible {
    opacity: 1;
    visibility: visible;
}

.rha-scroll-top:hover {
    background: var(--accent-hover);
}

/* ── 74. Hover Preview ── */

.rha-hover-preview {
    position: fixed;
    max-width: 400px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 150;
    pointer-events: none;
    white-space: pre-wrap;
    word-wrap: break-word;
    display: none;
}

.rha-hover-preview.rha-preview-visible {
    display: block;
}

/* ── 75. Bookmarks/Saved Filters ── */

.rha-bookmark-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.rha-bookmark-save-btn {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: background 0.15s;
}

.rha-bookmark-save-btn:hover {
    background: var(--border);
}

.rha-bookmark-select {
    font-size: 12px;
    padding: 5px 10px;
    min-width: 140px;
}

.rha-bookmark-del-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--err);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    transition: background 0.15s;
}

.rha-bookmark-del-btn:hover {
    background: rgba(255,107,107,0.15);
}

/* ── 76. Server Time Widget ── */

.rha-server-time {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-left: 12px;
}

.rha-server-time-clock {
    font-variant-numeric: tabular-nums;
}

/* ── 77. Compact Mode ── */

/* ── 78. Fullscreen Mode ── */

.rha-fullscreen-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    z-index: 10;
}

.rha-fullscreen-btn:hover {
    background: var(--border);
    color: var(--text);
}

.rha-chart-container,
.rha-chart-card {
    position: relative;
}

.rha-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    z-index: 200 !important;
    border-radius: 0 !important;
    margin: 0 !important;
    max-height: 100vh;
    overflow-y: auto;
}

.rha-fullscreen canvas {
    max-height: 80vh !important;
}

.rha-fullscreen .rha-fullscreen-btn {
    top: 12px;
    right: 12px;
}

/* ── 79. Print Styles ── */

.rha-print-btn {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.rha-print-btn:hover {
    background: var(--border);
}

@media print {
    .rha-header,
    .rha-footer,
    .rha-filter-row,
    .rha-mode-tabs,
    .rha-pagination,
    .rha-bulk-bar,
    .rha-btn-export,
    .rha-btn-filter,
    .rha-scroll-top,
    .rha-print-btn,
    .rha-col-toggle,
    .rha-bookmark-bar,
    .rha-new-banner,
    .rha-fullscreen-btn,
    #inactivityBanner,
    #autoLogoutForm,
    nav,
    footer {
        display: none !important;
    }

    body {
        background: #fff !important;
        color: #000 !important;
    }

    .rha-main {
        max-width: none;
        padding: 10px;
    }

    .rha-table-wrap {
        border: 1px solid #ccc;
    }

    .rha-table th {
        background: #f0f0f0 !important;
        color: #333 !important;
        border-bottom: 1px solid #ccc;
    }

    .rha-table td {
        border-bottom: 1px solid #eee;
        color: #000;
    }

    .rha-stat-card {
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    .rha-chart-container,
    .rha-chart-card {
        break-inside: avoid;
        border: 1px solid #ccc;
    }

    .rha-page-title {
        font-size: 18px;
    }
}

/* ── 80. Skeleton Loading ── */

@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.rha-skeleton {
    background: linear-gradient(90deg, var(--bg-3) 25%, var(--border) 50%, var(--bg-3) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 6px;
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}

.rha-skeleton * {
    visibility: hidden;
}

.rha-skeleton-line {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-3) 25%, var(--border) 50%, var(--bg-3) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
}

.rha-skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, var(--bg-3) 25%, var(--border) 50%, var(--bg-3) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
}

.rha-skeleton-card {
    height: 80px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--bg-3) 25%, var(--border) 50%, var(--bg-3) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
}

/* ══════════════════════════════════════════════════
   Mobile Responsiveness Fixes
   ══════════════════════════════════════════════════ */

/* Fix 4: Profile dropdown click support */
.rha-profile-area.is-open .rha-profile-dropdown {
    display: block;
}

@media (hover: none) {
    .rha-profile-area:hover .rha-profile-dropdown {
        display: none;
    }
    .rha-profile-area.is-open .rha-profile-dropdown {
        display: block;
    }
}

/* Fix 5: Filter row stacking on mobile */
@media (max-width: 768px) {
    .rha-filter-row {
        flex-direction: column;
        gap: 8px;
    }
    .rha-filter-row > input,
    .rha-filter-row > select,
    .rha-filter-row > .rha-filter-select,
    .rha-filter-row > .rha-filter-input {
        width: 100% !important;
        min-width: 0 !important;
    }
    .rha-filter-date {
        width: 100% !important;
    }
}

/* Fix 8: More dropdown hover issue on touch */
@media (hover: none) {
    .rha-nav-more:hover .rha-nav-more-menu {
        display: none;
    }
    .rha-nav-more.is-open .rha-nav-more-menu {
        display: block;
    }
}

/* ── Dashboard responsive grid fixes ── */
.rha-dashboard-4col { grid-template-columns: repeat(4, 1fr); }
.rha-dashboard-3col { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 768px) {
    .rha-dashboard-4col { grid-template-columns: 1fr 1fr; }
    .rha-dashboard-3col { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
    .rha-dashboard-4col { grid-template-columns: 1fr; }
    .rha-dashboard-3col { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .rha-funnel { flex-direction: column; }
    .rha-funnel-arrow { display: none; }
}

/* ── Navigation scroll indicator ── */
@media (max-width: 768px) {
    .rha-header-nav {
        -webkit-mask-image: linear-gradient(to right, black calc(100% - 30px), transparent);
        mask-image: linear-gradient(to right, black calc(100% - 30px), transparent);
        padding-right: 30px;
    }
}

/* ══════════════════════════════════════════════════
   Mobile Responsiveness Fixes (Audit 2026-05-23)
   ══════════════════════════════════════════════════ */

/* Fix 9: Toast too wide on small screens */
@media (max-width: 480px) {
    .rha-toast-container {
        right: 10px;
        left: 10px;
    }
    .rha-toast {
        min-width: auto;
        max-width: 100%;
    }
}

/* Fix 10: Nav touch targets too small */
@media (max-width: 768px) {
    .rha-header-nav .rha-nav-link {
        padding: 16px 10px;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Fix 11: Inline fixed widths in forms (settings, subreddits) */
@media (max-width: 768px) {
    .rha-settings-inline input,
    .rha-settings-inline select {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* Fix 14: Theme/lang buttons touch target */
@media (max-width: 768px) {
    .rha-theme-toggle,
    .rha-lang-toggle {
        min-width: 36px;
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Fix 15: Action buttons too small */
@media (max-width: 768px) {
    .rha-btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }
    .rha-user-actions {
        flex-direction: column;
        gap: 6px;
    }
    .rha-user-actions .rha-btn-sm {
        width: 100%;
    }
}

/* Fix 16: Scroll-to-top button size */
@media (max-width: 768px) {
    .rha-scroll-top {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

/* Fix 17: Hide shortcuts trigger on touch */
@media (hover: none) {
    .rha-shortcuts-trigger {
        display: none;
    }
}

@media (max-width: 480px) {
}

/* Fix 19: Responsive improvements for various detail pages */
@media (max-width: 768px) {
    .rha-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .rha-client-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .rha-client-stats {
        flex-direction: column;
        gap: 8px;
    }
}

/* ══════════════════════════════════════════════════
   Additional UI Classes (2026-05-23)
   ══════════════════════════════════════════════════ */

/* ── 1. rha-tabs — tab bar container ── */
.rha-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

/* ── 2. rha-tab — tab button ── */
.rha-tab {
    display: inline-block;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s, border-color 0.15s;
}

.rha-tab:hover {
    color: var(--text);
}

/* ── 3. rha-tab-active — active tab state ── */
.rha-tab-active {
    color: var(--text);
    font-weight: 600;
    border-bottom-color: var(--accent);
}

/* ── 4. rha-tab-pane — tab content pane ── */
.rha-tab-pane {
    display: none;
}

.rha-tab-pane.active {
    display: block;
}

/* ── 5. rha-input — text input field ── */
.rha-input {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.rha-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── 6. rha-select — select dropdown ── */
.rha-select {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
    color-scheme: dark;
}

.rha-select:focus {
    outline: none;
    border-color: var(--accent);
}

[data-theme="light"] .rha-select {
    color-scheme: light;
}

/* ── 7. rha-textarea — textarea ── */
.rha-textarea {
    background: var(--bg-3);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.15s;
}

.rha-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── 8. rha-card — content card ── */
.rha-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

/* ── 9. rha-form-group — form field group ── */
.rha-form-group {
    margin-bottom: 14px;
}

.rha-form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

/* ── 10. rha-badge — small badge/label ── */
.rha-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-3);
    color: var(--text);
}

/* ── 11. rha-chart-wrap — chart container ── */
.rha-chart-wrap {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    overflow: hidden;
}

.rha-chart-wrap h3 {
    margin: 0 0 12px;
    font-size: 15px;
}

.rha-chart-wrap canvas {
    max-height: 300px;
}

/* ── 12. rha-settings-section — settings section wrapper ── */
.rha-settings-section {
    margin-bottom: 20px;
}

/* ── 13. rha-settings-tabs — settings tab bar ── */
.rha-settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ── 14. rha-detail-section — detail page section ── */
.rha-detail-section {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.rha-detail-section:last-child {
    border-bottom: none;
}

/* ── 15. rha-gen-table — generations table ── */
.rha-gen-table {
    width: 100%;
}

/* ── 16. rha-bulk-check — bulk checkbox ── */
.rha-bulk-check {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

/* ── 17. rha-filter-bar — filter bar ── */
.rha-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* ── 18. rha-stats-grid — stats grid ── */
.rha-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ── 19. rha-budget-bar — budget progress bar container ── */
.rha-budget-bar {
    background: var(--bg-3);
    border-radius: 4px;
    height: 24px;
    margin: 8px 0;
    overflow: hidden;
}

/* ── 20. rha-budget-fill — budget bar fill ── */
.rha-budget-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--ok);
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.rha-budget-ok { background: var(--ok); }
.rha-budget-warn { background: var(--err); }

/* ── 21. rha-report-grid — report layout grid ── */
.rha-report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ── 22. rha-period-tabs — period selector tabs ── */
.rha-period-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.rha-period-tabs a {
    padding: 6px 16px;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text-muted);
    background: var(--bg-3);
    font-size: 13px;
    transition: background 0.15s, color 0.15s;
}

.rha-period-tabs a:hover {
    color: var(--text);
}

.rha-period-tabs a.active {
    background: var(--accent);
    color: #fff;
}

/* ── 23. rha-section — generic section wrapper ── */
.rha-section {
    margin-bottom: 24px;
}

.rha-section h3 {
    margin: 0 0 12px;
    font-size: 16px;
}

/* ── 24. rha-client-actions — client action buttons area ── */
.rha-client-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.rha-client-actions a {
    padding: 6px 14px;
    background: var(--bg-3);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.15s;
}

.rha-client-actions a:hover {
    background: var(--border);
}

/* ── 25. rha-key-badge — API key badge ── */
.rha-key-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.rha-key-active { background: var(--ok); color: #fff; }
.rha-key-revoked { background: var(--err); color: #fff; }

/* ── 26. rha-key-item — API key list item ── */
.rha-key-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--bg-3);
    border-radius: 6px;
    margin-bottom: 6px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
}

/* ── 27. rha-lang-flag — language flag badge ── */
.rha-lang-flag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--bg-3);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text);
}

/* ── 28. rha-lang-flags — language flags container ── */
.rha-lang-flags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── 29. rha-no-print — hide from print ── */
@media print {
    .rha-no-print {
        display: none !important;
    }
}

/* ── 30. rha-note-item — note list item ── */
.rha-note-item {
    background: var(--bg-3);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-2);
}

.rha-note-item:last-child {
    border-bottom: none;
}

/* === Кнопка "Инструкции по функционалу" в шапке справа ============= */
.rha-guide-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    background: #1a1a1b;
    color: #ffffff;
    border: 1px solid #2c2e36;
    transition: background 0.15s, color 0.15s, transform 0.05s;
}
.rha-guide-btn:hover {
    background: #2c2e36;
    color: #ffffff;
}
.rha-guide-btn:active {
    transform: translateY(1px);
}
[data-theme="light"] .rha-guide-btn {
    background: #ffffff;
    color: #1a1a1b;
    border: 1px solid #d6d8db;
}
[data-theme="light"] .rha-guide-btn:hover {
    background: #f0f0f0;
    color: #1a1a1b;
}

/* === Кнопка "Настройки" в шапке справа от admin =================== */
.rha-settings-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.05s;
}
.rha-settings-btn:hover {
    background: var(--bg-3);
    border-color: var(--accent);
    color: var(--accent);
}
.rha-settings-btn.rha-nav-active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}
.rha-settings-btn:active { transform: translateY(1px); }
[data-theme="light"] .rha-settings-btn {
    background: #ffffff;
    color: #1a1a1b;
    border: 1px solid #d6d8db;
}
[data-theme="light"] .rha-settings-btn:hover {
    background: #f0f0f0;
    border-color: var(--accent);
    color: var(--accent);
}
[data-theme="light"] .rha-settings-btn.rha-nav-active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

/* ── Feature 58: Animated Tab Transitions for Settings ── */
.rha-settings-section {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.rha-settings-section.rha-settings-section-active {
    opacity: 1;
    transform: translateY(0);
}

/* ── Feature 59: Print-friendly Styles ── */
@media print {
    .rha-header,
    .rha-footer,
    .rha-scroll-top,
    .rha-cmd-palette,
    .rha-toast-container,
    .rha-shortcuts-modal,
    .rha-bulk-bar,
    .rha-context-menu {
        display: none !important;
    }
    .rha-main {
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .rha-table,
    .rha-table th,
    .rha-table td {
        border: 1px solid #333 !important;
        color: #000 !important;
        background: #fff !important;
    }
    .rha-btn,
    form button[type="submit"],
    .rha-filter-row button,
    .rha-btn-export,
    .rha-col-toggle,
    .rha-bookmark-bar,
    .rha-scroll-toggle {
        display: none !important;
    }
    .rha-detail-card,
    .rha-page-title,
    .rha-truncate {
        color: #000 !important;
    }
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
}

/* ── Features 11-15: Score Trend, Provider Compare, Persona Leaderboard, Style Stats, Export PDF ── */

/* Leaderboard medals */
.rha-leaderboard-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 13px;
    color: #fff;
}
.rha-medal-gold { background: #d4a017; }
.rha-medal-silver { background: #818384; }
.rha-medal-bronze { background: #a0522d; }

/* Score badges */
.rha-score-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}
.rha-score-good { background: rgba(70,209,96,0.15); color: #46d160; }
.rha-score-mid { background: rgba(212,160,23,0.15); color: #d4a017; }
.rha-score-bad { background: rgba(217,58,0,0.15); color: #d93a00; }

/* Empty state */
.rha-empty-state {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
}

/* Feature 57: Contextual Tooltips */
.rha-tooltip {
    position: relative;
}
.rha-tooltip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-3);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 400;
    white-space: nowrap;
    max-width: 280px;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    line-height: 1.4;
}
.rha-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Feature 54: Drag-and-drop zone */
.rha-dropzone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    margin-bottom: 12px;
}
.rha-dropzone.rha-dropzone-active {
    border-color: var(--accent);
    background: rgba(217, 58, 0, 0.05);
    color: var(--text);
}
.rha-dropzone-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

/* Feature 53: Inline style edit */
.rha-inline-select {
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 12px;
    cursor: pointer;
}

/* Feature 84: Prompt library cards */
.rha-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.rha-library-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}
.rha-library-card h3 {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--accent);
}
.rha-library-card p {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Feature 88: Suggestion tips */
.rha-suggestion-tip {
    background: rgba(243, 156, 18, 0.1);
    border-left: 3px solid var(--amber);
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 0 6px 6px 0;
    font-size: 13px;
    color: var(--text-muted);
}

/* Feature 86: A/B test section */
.rha-ab-section {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

/* ── Feature 9: Word-level diff (ins/del) ── */
.rha-diff-block ins {
    background: rgba(70, 209, 96, 0.2);
    color: #46d160;
    text-decoration: none;
    padding: 1px 3px;
    border-radius: 3px;
}
.rha-diff-block del {
    background: rgba(217, 58, 0, 0.2);
    color: #d93a00;
    text-decoration: line-through;
    padding: 1px 3px;
    border-radius: 3px;
}
[data-theme="light"] .rha-diff-block ins {
    background: rgba(26, 137, 23, 0.15);
    color: #1a8917;
}
[data-theme="light"] .rha-diff-block del {
    background: rgba(192, 39, 30, 0.15);
    color: #c0271e;
}

/* ── Feature 2: Reddit-style Live Preview Modal ── */
.rha-reddit-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.rha-reddit-modal {
    background: #1a1a1b;
    border: 1px solid #343536;
    border-radius: 8px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    padding: 0;
}
.rha-reddit-modal-close {
    position: absolute;
    top: 8px; right: 12px;
    background: none;
    border: none;
    color: #818384;
    font-size: 24px;
    cursor: pointer;
    z-index: 1;
    line-height: 1;
}
.rha-reddit-modal-close:hover { color: #d7dadc; }
.rha-reddit-preview {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #d7dadc;
    padding: 16px;
}
.rha-reddit-post-header {
    display: flex;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid #343536;
    margin-bottom: 12px;
}
.rha-reddit-votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 32px;
    padding-top: 4px;
}
.rha-reddit-arrow-up { color: #818384; cursor: pointer; font-size: 14px; }
.rha-reddit-arrow-up:hover { color: #ff4500; }
.rha-reddit-arrow-down { color: #818384; cursor: pointer; font-size: 14px; }
.rha-reddit-arrow-down:hover { color: #7193ff; }
.rha-reddit-vote-count { font-size: 12px; font-weight: 700; color: #d7dadc; }
.rha-reddit-post-content { flex: 1; }
.rha-reddit-post-meta { font-size: 12px; color: #818384; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.rha-reddit-subreddit-badge {
    font-weight: 700;
    color: #d7dadc;
    background: #272729;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}
.rha-reddit-meta-text { color: #818384; font-size: 11px; }
.rha-reddit-post-title {
    font-size: 18px;
    font-weight: 500;
    color: #d7dadc;
    margin: 4px 0 8px;
    line-height: 1.3;
}
.rha-reddit-post-body {
    font-size: 14px;
    color: #d7dadc;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
}
.rha-reddit-comment {
    display: flex;
    gap: 0;
    padding-left: 8px;
}
.rha-reddit-comment-thread-line {
    width: 2px;
    min-height: 100%;
    background: #343536;
    margin-right: 12px;
    flex-shrink: 0;
    border-radius: 1px;
}
.rha-reddit-comment-body { flex: 1; padding: 4px 0; }
.rha-reddit-comment-meta {
    font-size: 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.rha-reddit-comment-author { font-weight: 600; color: #4fbcff; font-size: 12px; }
.rha-reddit-comment-text {
    font-size: 14px;
    color: #d7dadc;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 6px;
}
.rha-reddit-comment-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #818384;
}
.rha-reddit-action-btn {
    font-weight: 700;
    font-size: 11px;
    color: #818384;
    cursor: pointer;
    padding: 2px 4px;
}
.rha-reddit-action-btn:hover { color: #d7dadc; }

/* Light theme overrides for Reddit preview */
[data-theme="light"] .rha-reddit-modal { background: #ffffff; border-color: #d6d8db; }
[data-theme="light"] .rha-reddit-modal-close { color: #66686a; }
[data-theme="light"] .rha-reddit-modal-close:hover { color: #1a1a1b; }
[data-theme="light"] .rha-reddit-preview { color: #1a1a1b; }
[data-theme="light"] .rha-reddit-post-header { border-bottom-color: #edeff1; }
[data-theme="light"] .rha-reddit-vote-count { color: #1a1a1b; }
[data-theme="light"] .rha-reddit-subreddit-badge { color: #1a1a1b; background: #f0f2f5; }
[data-theme="light"] .rha-reddit-post-title { color: #1a1a1b; }
[data-theme="light"] .rha-reddit-post-body { color: #1c1c1c; }
[data-theme="light"] .rha-reddit-comment-thread-line { background: #edeff1; }
[data-theme="light"] .rha-reddit-comment-text { color: #1c1c1c; }
[data-theme="light"] .rha-reddit-comment-author { color: #0079d3; }

/* === "Доверять этому устройству" чекбокс на login ============== */
.rha-trust-device {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 4px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.rha-trust-device input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}
.rha-trust-device:hover { color: var(--text); }

/* === Inline ошибка внутри auth-card (login/2fa) ================= */
.rha-auth-error {
    background: rgba(255, 87, 34, 0.12);
    border: 1px solid rgba(255, 87, 34, 0.4);
    color: var(--accent);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin: 8px 0 16px;
    text-align: center;
    line-height: 1.4;
    animation: rha-auth-error-pulse 0.4s ease-out;
}
@keyframes rha-auth-error-pulse {
    0% { transform: scale(0.98); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
[data-theme="light"] .rha-auth-error {
    background: rgba(217, 58, 0, 0.08);
    border: 1px solid rgba(217, 58, 0, 0.4);
    color: #b32f00;
}

.rha-auth-success {
    background: rgba(70, 209, 96, 0.12);
    border: 1px solid rgba(70, 209, 96, 0.4);
    color: #46d160;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin: 8px 0 16px;
    text-align: center;
    line-height: 1.4;
    animation: rha-auth-error-pulse 0.4s ease-out;
}
[data-theme="light"] .rha-auth-success {
    background: rgba(46, 160, 67, 0.10);
    border: 1px solid rgba(46, 160, 67, 0.45);
    color: #1f7a36;
}

/* === Flash info + link utility ========================================== */
.rha-flash-info { background: rgba(33,150,243,0.1); border-left: 3px solid #2196f3; color: #90caf9; }
.rha-link { color: var(--accent); text-decoration: none; }
.rha-link:hover { text-decoration: underline; }
