/* Brick Main Stylesheet
   Extracted from templates/base.html inline <style>
   Last updated: 2026-06-17
*/

/* ===== Theme Variables ===== */
:root {
    --bg: #f5f5f5;
    --surface: #ffffff;
    --surface-hover: #fafbfc;
    --text: #333333;
    --text-secondary: #666666;
    --text-muted: #888888;
    --border: #eeeeee;
    --border-light: #f0f0f0;
    --primary: #1a1a2e;
    --primary-hover: #2d2d4a;
    --topbar-bg: #ffffff;
    --topbar-border: #eeeeee;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --badge-active-bg: #e6f7e6;
    --badge-active-text: #1a7a1a;
    --badge-dormant-bg: #fff3cd;
    --badge-dormant-text: #856404;
    --badge-closed-bg: #f0f0f0;
    --badge-closed-text: #888888;
    --btn-danger-bg: #fee;
    --btn-danger-text: #c00;
    --btn-danger-hover: #fdd;
    --btn-success-bg: #efe;
    --btn-success-text: #060;
    --btn-success-hover: #dfd;
    --stats-bg: #f8f9fa;
    --stats-color: #666666;
    --table-th-bg: #f8f9fa;
    --table-hover: #fafbfc;
    --agent-border: #eee;
    --modal-overlay: rgba(0,0,0,0.4);
    --avatar-bg: #1a1a2e;
    --avatar-text: #ffffff;
    --dropdown-bg: #ffffff;
    --dropdown-hover: #f5f5f5;
    --dropdown-border: #eee;
    --theme-icon: #888;
    --buy-color: #d32f2f;
    --sell-color: #2e7d32;
    --grid-buy-bg: #fff5f5;
    --grid-sell-bg: #f5fff5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f0f1a;
        --surface: #1a1a2e;
        --surface-hover: #222240;
        --text: #d0d0e0;
        --text-secondary: #9999aa;
        --text-muted: #777788;
        --border: #2a2a44;
        --primary: #4a6fa5;
        --primary-hover: #5a80b5;
        --topbar-bg: #16162a;
        --topbar-border: #2a2a44;
        --shadow: 0 2px 10px rgba(0,0,0,0.3);
        --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
        --badge-active-bg: #1a3a1a;
        --badge-active-text: #6fcf6f;
        --badge-dormant-bg: #3a3a1a;
        --badge-dormant-text: #cfb86f;
        --badge-closed-bg: #2a2a2a;
        --badge-closed-text: #888;
        --btn-danger-bg: #3a1a1a;
        --btn-danger-text: #ff6b6b;
        --btn-danger-hover: #4a2a2a;
        --btn-success-bg: #1a3a1a;
        --btn-success-text: #6fcf6f;
        --btn-success-hover: #2a4a2a;
        --stats-bg: #16162a;
        --stats-color: #9999aa;
        --table-th-bg: #16162a;
        --table-hover: #1e1e3a;
        --agent-border: #2a2a44;
        --modal-overlay: rgba(0,0,0,0.6);
        --avatar-bg: #4a6fa5;
        --avatar-text: #ffffff;
        --dropdown-bg: #1a1a2e;
        --dropdown-hover: #222240;
        --dropdown-border: #2a2a44;
        --theme-icon: #9999aa;
        --buy-color: #ef5350;
        --sell-color: #66bb6a;
        --grid-buy-bg: #2a1a1a;
        --grid-sell-bg: #1a2a1a;
    }
}

[data-theme="light"] {
    --bg: #f5f5f5; --surface: #fff; --text: #333; --text-secondary: #666; --text-muted: #888; --border: #eee;
    --primary: #1a1a2e; --primary-hover: #2d2d4a; --topbar-bg: #fff; --topbar-border: #eee;
    --shadow: 0 2px 10px rgba(0,0,0,0.08); --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --stats-bg: #f8f9fa; --table-th-bg: #f8f9fa; --table-hover: #fafbfc;
    --badge-active-bg: #e6f7e6; --badge-active-text: #1a7a1a; --badge-dormant-bg: #fff3cd; --badge-dormant-text: #856404;
    --avatar-bg: #1a1a2e; --avatar-text: #fff; --dropdown-bg: #fff; --dropdown-hover: #f5f5f5; --dropdown-border: #eee; --theme-icon: #888;
    --grid-buy-bg: #fff5f5; --grid-sell-bg: #f5fff5;
}
[data-theme="dark"] {
    --bg: #0f0f1a; --surface: #1a1a2e; --text: #d0d0e0; --text-secondary: #9999aa; --text-muted: #777788; --border: #2a2a44;
    --primary: #4a6fa5; --primary-hover: #5a80b5; --topbar-bg: #16162a; --topbar-border: #2a2a44;
    --shadow: 0 2px 10px rgba(0,0,0,0.3); --shadow-lg: 0 4px 16px rgba(0,0,0,0.4);
    --stats-bg: #16162a; --table-th-bg: #16162a; --table-hover: #1e1e3a;
    --badge-active-bg: #1a3a1a; --badge-active-text: #6fcf6f; --badge-dormant-bg: #3a3a1a; --badge-dormant-text: #cfb86f;
    --avatar-bg: #4a6fa5; --avatar-text: #fff; --dropdown-bg: #1a1a2e; --dropdown-hover: #222240; --dropdown-border: #2a2a44; --theme-icon: #9999aa;
    --grid-buy-bg: #2a1a1a; --grid-sell-bg: #1a2a1a;
}

/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); transition: background 0.3s, color 0.3s; min-height: 100vh; }

/* ===== Topbar Level 1 ===== */
.topbar { background: var(--topbar-bg); border-bottom: 1px solid var(--topbar-border); padding: 0 20px; height: 44px; display: flex; align-items: center; gap: 4px; position: sticky; top: 0; z-index: 100; transition: background 0.3s, border-color 0.3s; }
.topbar-brand { display: flex; align-items: center; white-space: nowrap; flex-shrink: 0; gap: 6px; height: 44px; }
.topbar-brand a { text-decoration: none; color: var(--text); font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.topbar-brand a:hover { opacity: 0.85; }
.topbar-brand img { width: 18px; height: 18px; border-radius: 3px; object-fit: contain; object-position: center; margin-bottom: -2px; }
.topbar-brand .sep { color: var(--text-muted); font-size: 14px; margin: 0 2px; }
.topbar-brand .page-title { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
.topbar-nav { display: flex; gap: 2px; margin-left: 12px; flex-shrink: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.topbar-tools { display: flex; gap: 2px; position: relative; top: 1px; }

.tool-btn { background: none; border: none; padding: 0 14px; height: 44px; font-size: 14px; cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent; transition: all 0.15s; white-space: nowrap; display: flex; align-items: center; text-decoration: none; font-weight: 500; }
.tool-btn:hover { color: var(--text); }
.tool-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.tool-btn-coming:hover { color: var(--text) !important; }

/* ===== Topbar Level 2 (sub-nav) ===== */
.subbar { background: var(--surface); border-bottom: 1px solid var(--topbar-border); padding: 0 20px; height: 36px; display: flex; align-items: center; gap: 4px; transition: background 0.3s, border-color 0.3s; overflow-x: auto; }
.subbar::-webkit-scrollbar { display: none; }
.subbar { scrollbar-width: none; }
.sub-btn { background: none; border: none; padding: 0 12px; height: 36px; font-size: 12px; cursor: pointer; color: var(--text-muted); border-bottom: 2px solid transparent; transition: all 0.15s; white-space: nowrap; }
.sub-btn:hover { color: var(--text); }
.sub-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.subbar-title { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; padding-right: 12px; }

/* ===== Tab Content Panels ===== */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== Theme Toggle ===== */
.theme-toggle { background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px; border-radius: 4px; color: var(--theme-icon); transition: color 0.2s; line-height: 1; display: flex; align-items: center; justify-content: center; position: relative; text-decoration: none; width: 28px; height: 28px; }
.theme-toggle:hover { color: var(--text); }
.theme-toggle.active { color: var(--primary); }
.theme-toggle svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .icon-hide { display: none; }



/* ===== Settings page layout ===== */
.settings-layout { display: flex; gap: 24px; min-height: calc(100vh - 100px); align-items: flex-start; max-width: 1020px; margin: 0 auto; }
.settings-sidebar { width: 200px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px 0; }
.settings-tab { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 20px; border: none; background: transparent; color: var(--text-secondary); font-size: 14px; cursor: pointer; text-align: left; transition: all 0.15s; border-left: 3px solid transparent; }
.settings-tab:hover { background: var(--surface-hover); color: var(--text); }
.settings-tab.active { background: var(--surface-hover); color: var(--text); font-weight: 600; border-left-color: var(--primary); }
.settings-content { flex: 1; padding: 20px 0; min-width: 0; max-width: 780px; }

/* ===== Settings Gear Button (topbar-right) ===== */
.settings-gear-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px; font-size: 16px; text-decoration: none; color: var(--text-muted); transition: all 0.15s; }
.settings-gear-btn svg { display: block; }
.settings-gear-btn:hover { background: var(--surface-hover); color: var(--text); }
.settings-gear-btn.active { color: var(--primary); background: var(--surface-hover); }

/* ===== Backup page styles ===== */
.backup-stats { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.backup-stats .stat { font-size: 13px; color: var(--text-secondary); }
.backup-stats .stat strong { color: var(--text); font-weight: 600; }

.form-help { font-size: 11px; color: var(--text-muted); margin-top: 3px; line-height: 1.4; }
.settings-actions { margin-bottom: 0; }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--border); border-radius: 24px; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

.files-table .status-cell { white-space: nowrap; font-size: 15px; }
.files-table .status-cell .dot { display: inline-flex; align-items: center; gap: 2px; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.files-table .status-cell .dot.local-only { background: var(--badge-dormant-bg); color: var(--text-secondary); }
.files-table .status-cell .dot.remote-only { background: var(--badge-dormant-bg); color: var(--text-secondary); }
.files-table .status-cell .dot.both { background: #e8f5e9; color: #2e7d32; }
@media (prefers-color-scheme: dark) {
    .files-table .status-cell .dot.both { background: #0d2a0d; color: #81c784; }
}
.files-table .action-cell { text-align: right; }
.files-table .action-cell button { opacity: 0.35; transition: opacity 0.15s; }
.files-table tr:hover .action-cell button { opacity: 1; }

.scope-options { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.scope-options .scope-btn { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 14px; background: var(--surface); color: var(--text); transition: all 0.15s; }
.scope-options .scope-btn:hover { border-color: var(--primary); background: var(--surface-hover); }
.scope-options .scope-btn .radio { width: 16px; height: 16px; border: 2px solid var(--border); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.scope-options .scope-btn .radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.scope-options .scope-btn.selected { border-color: var(--primary); background: var(--surface-hover); }
.scope-options .scope-btn.selected .radio { border-color: var(--primary); }
.scope-options .scope-btn.selected .radio::after { background: var(--primary); }
.scope-options .scope-btn.danger { border-color: var(--buy-color); color: var(--buy-color); }
.scope-options .scope-btn.danger.selected { background: #fce4ec; }
@media (prefers-color-scheme: dark) {
    .scope-options .scope-btn.danger.selected { background: #2a0d0d; }
}

.status-ok { color: #2e7d32; }
.status-err { color: #c62828; }
@media (prefers-color-scheme: dark) {
    .status-ok { color: #81c784; }
    .status-err { color: #ef9a9a; }
}

/* ===== Notifications page styles ===== */
.channel-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.channel-row:last-child { border-bottom: none; }
.channel-name { font-size: 14px; font-weight: 500; }
.channel-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.channel-status { font-size: 12px; }
.channel-status.on { color: #2e7d32; }
.channel-status.off { color: var(--text-muted); }

.feedback { margin-top: 12px; padding: 10px 14px; border-radius: 8px; font-size: 13px; display: none; }
.feedback.show { display: block; }
.feedback.success { background: #e8f5e9; color: #2e7d32; }
.feedback.error { background: #fce4ec; color: #c62828; }
@media (prefers-color-scheme: dark) {
    .feedback.success { background: #0d2a0d; color: #81c784; }
    .feedback.error { background: #2a0d0d; color: #ef9a9a; }
}

/* ===== Scheduler page styles ===== */
.tasks-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.tasks-header .title { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.tasks-header .actions { display: flex; gap: 8px; }

.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.task-card:last-child { margin-bottom: 0; }
.task-main { padding: 16px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; cursor: pointer; transition: background 0.15s; }
.task-main:hover { background: var(--surface-hover); }
.task-icon { font-size: 20px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface-alt, #f5f5f5); flex-shrink: 0; }
@media (prefers-color-scheme: dark) { .task-icon { background: #222; } }
.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 15px; font-weight: 600; color: var(--text); }
.task-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.task-meta .label { color: var(--text-muted); }
.task-status { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.task-status .dot { width: 8px; height: 8px; border-radius: 50%; }
.task-status .dot.running { background: #4caf50; }
.task-status .dot.paused { background: #ff9800; }
.task-status .dot.stopped { background: #ccc; }
.task-status .status-text { font-size: 13px; color: var(--text-secondary); }
.task-actions { display: flex; gap: 6px; flex-shrink: 0; }
.task-actions .btn-icon { width: 32px; height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all 0.15s; color: var(--text); }
.task-actions .btn-icon:hover { border-color: var(--primary); background: var(--surface-hover); }
.task-actions .btn-icon:disabled { opacity: 0.3; cursor: not-allowed; }
.task-detail { border-top: 1px solid var(--border); padding: 16px 20px; display: none; }
.task-detail.open { display: block; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-bottom: 16px; }
.detail-item .dt-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.detail-item .dt-value { font-size: 14px; color: var(--text); margin-top: 2px; }
.detail-item .dt-value.cron { font-family: monospace; font-size: 13px; }
.detail-item .dt-value.mono { font-family: monospace; font-size: 13px; }
.detail-section-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; margin-top: 12px; }
.detail-section-title:first-child { margin-top: 0; }
.notify-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.notify-tag { padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 500; background: var(--surface-alt, #f0f0f0); color: var(--text-secondary); }
.notify-tag.active { background: #e8f5e9; color: #2e7d32; }
@media (prefers-color-scheme: dark) { .notify-tag.active { background: #0d2a0d; color: #81c784; } }
.log-list { max-height: 300px; overflow-y: auto; }
.log-entry { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.log-entry:last-child { border-bottom: none; }
.log-entry .log-status { flex-shrink: 0; width: 16px; text-align: center; }
.log-entry .log-msg { flex: 1; color: var(--text-secondary); }
.log-entry .log-time { flex-shrink: 0; color: var(--text-muted); font-size: 11px; white-space: nowrap; }
.log-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 14px; }
.edit-form { display: flex; flex-direction: column; gap: 14px; }
.edit-form .form-group { margin-bottom: 0; }
.edit-form .checkbox-row { display: flex; gap: 16px; }
.edit-form .checkbox-row label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }

/* ===== IM Integration page styles ===== */
.status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.status-badge.on { background: #e8f5e9; color: #2e7d32; }
.status-badge.off { background: #f5f5f5; color: #999; }
@media (prefers-color-scheme: dark) {
    .status-badge.on { background: #0d2a0d; color: #81c784; }
    .status-badge.off { background: #222; color: #666; }
}

.card table { width: 100%; border-collapse: collapse; font-size: 13px; }
.card th { text-align: left; padding: 10px 8px; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.card td { padding: 10px 8px; border-bottom: 1px solid var(--border); color: var(--text); }

.mapping-delete { cursor: pointer; opacity: 0.5; transition: opacity 0.15s; padding: 4px 8px; border-radius: 4px; }
.mapping-delete:hover { opacity: 1; background: var(--surface-hover); }

.cmd-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cmd-row:last-child { border-bottom: none; }
.cmd-keyword { font-weight: 600; font-family: monospace; background: var(--surface-alt, #f5f5f5); padding: 1px 6px; border-radius: 4px; }
.cmd-desc { color: var(--text-secondary); }
.cmd-module { color: var(--text-muted); font-size: 11px; }

/* ===== Avatar + Dropdown ===== */
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-text); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; transition: background 0.3s, color 0.3s; flex-shrink: 0; }
.user-avatar:hover { opacity: 0.85; }
.user-menu { position: relative; }
.user-menu .dropdown { display: none; position: absolute; top: 38px; right: 0; background: var(--dropdown-bg); border: 1px solid var(--dropdown-border); border-radius: 8px; box-shadow: var(--shadow-lg); min-width: 140px; z-index: 200; overflow: hidden; transition: background 0.3s, border-color 0.3s; }
.user-menu .dropdown.show { display: block; }
.user-menu .dropdown .dropdown-item { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; color: var(--text); cursor: pointer; border: none; background: none; width: 100%; text-align: left; transition: background 0.1s, color 0.3s; text-decoration: none; }
.user-menu .dropdown .dropdown-item:hover { background: var(--dropdown-hover); }
.user-menu .dropdown .dropdown-item.logout-item { color: var(--btn-danger-text); }
.user-menu .dropdown .dropdown-item.logout-item:hover { background: var(--btn-danger-bg); }
.user-menu .dropdown .username-item { font-weight: 600; pointer-events: none; }
.user-menu .dropdown .dropdown-divider { height: 1px; background: var(--dropdown-border); margin: 4px 0; }

.hidden { display: none !important; }

/* ===== Container ===== */
.container { max-width: 1280px; margin: 16px auto; padding: 0 20px; }

/* ===== Cards ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; transition: background 0.3s, border-color 0.3s; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-title { font-size: 15px; font-weight: 600; }

/* ===== Stats ===== */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat-box { background: var(--stats-bg); border-radius: 8px; padding: 12px 20px; flex: 1; min-width: 120px; text-align: center; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 18px; font-weight: 700; }
.stat-value.positive { color: var(--buy-color); }
.stat-value.negative { color: var(--sell-color); }

/* ===== Tables ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { background: var(--table-th-bg); padding: 8px 10px; text-align: left; font-weight: 600; color: var(--text-secondary); border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table tr:hover { background: var(--table-hover); }

/* ===== Badges ===== */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-active { background: var(--badge-active-bg); color: var(--badge-active-text); }
.badge-dormant { background: var(--badge-dormant-bg); color: var(--badge-dormant-text); }
.badge-closed { background: var(--badge-closed-bg); color: var(--badge-closed-text); }
.badge-buy { background: var(--grid-buy-bg); color: var(--buy-color); }
.badge-sell { background: var(--grid-sell-bg); color: var(--sell-color); }
.badge-pending { background: var(--badge-dormant-bg); color: var(--badge-dormant-text); }
.badge-coming { background: var(--badge-dormant-bg); color: var(--text-muted); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; cursor: pointer; background: var(--surface); color: var(--text); transition: all 0.15s; }
.btn:hover { background: var(--surface-hover); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: var(--btn-danger-bg); color: var(--btn-danger-text); border-color: transparent; }
.btn-danger:hover { background: var(--btn-danger-hover); }
.btn-success { background: var(--btn-success-bg); color: var(--btn-success-text); border-color: transparent; }
.btn-success:hover { background: var(--btn-success-hover); }

/* ===== Modal ===== */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--modal-overlay); z-index: 200; justify-content: center; align-items: center; }
.modal-overlay.show { display: flex; }
.modal { background: var(--surface); border-radius: 12px; padding: 24px; width: 90%; max-width: 520px; max-height: 80vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.form-input, .form-select { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--surface); color: var(--text); transition: border-color 0.15s; }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--primary); }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* ===== Alerts ===== */
.alert { padding: 10px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.alert-info { background: #e3f2fd; color: #1565c0; }
.alert-warning { background: #fff3e0; color: #e65100; }
.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-error { background: #fce4ec; color: #c62828; }
@media (prefers-color-scheme: dark) {
    .alert-info { background: #0d2137; color: #64b5f6; }
    .alert-warning { background: #2a1f0d; color: #ffb74d; }
    .alert-success { background: #0d2a0d; color: #81c784; }
    .alert-error { background: #2a0d0d; color: #ef5350; }
}

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 40px; margin-bottom: 8px; }
.empty-state .text { font-size: 14px; }

.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Button active / press feedback ===== */
.btn:active {
    transform: scale(0.94);
    background: var(--border);
}
.btn-primary:active {
    background: var(--primary-hover);
    opacity: 0.85;
}

/* ─── Refresh button spin ─── */
.btn-refresh:active .refresh-icon {
    display: inline-block;
    animation: refreshSpin 0.4s ease-in-out;
}
@keyframes refreshSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ─── Toast notification ─── */
.toast-container {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 20px;
    font-size: 13px;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast.toast-success { border-color: var(--sell-color); }
.toast.toast-error   { border-color: var(--buy-color); }

/* ===== Page loading overlay ===== */
.container {
    position: relative;
}
.page-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg);
    z-index: 50;
    min-height: 240px;
    transition: opacity 0.3s ease;
}
.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}
.page-loader .spinner {
    width: 28px;
    height: 28px;
    border-width: 3px;
}
.page-loader .text {
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== Cron Editor ===== */
.cron-editor { display: flex; flex-direction: column; gap: 12px; }

.cron-presets { display: flex; gap: 4px; background: var(--stats-bg); border-radius: 8px; padding: 3px; }
.cron-preset-radio { flex: 1; }
.cron-preset-radio input { display: none; }
.cron-preset-label { display: block; text-align: center; padding: 6px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; cursor: pointer; color: var(--text-secondary); transition: all 0.15s; }
.cron-preset-radio.active .cron-preset-label { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.cron-preset-radio:hover .cron-preset-label { color: var(--text); }

.cron-preset-panel { display: block; }
.cron-panel-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cron-panel-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; min-width: 60px; }
.cron-time-input { width: 100px !important; }
.cron-tz-badge { font-size: 11px; color: var(--text-muted); background: var(--stats-bg); padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.cron-panel-suffix { font-size: 13px; color: var(--text-secondary); }
.cron-day-select { width: 80px !important; }

.cron-weekdays { display: flex; gap: 3px; flex-wrap: wrap; }
.cron-wd-label { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; transition: all 0.15s; font-size: 12px; font-weight: 500; color: var(--text-secondary); border: 1px solid var(--border); background: var(--surface); }
.cron-wd-label input { display: none; }
.cron-wd-label.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.cron-wd-label:hover { border-color: var(--primary); }

.cron-custom-input { font-family: monospace; flex: 1; }

.cron-preview { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--stats-bg); border-radius: 8px; font-size: 13px; color: var(--text); }
.cron-preview-icon { flex-shrink: 0; }
.cron-preview-text { font-weight: 500; }

.cron-friendly { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* ===== Skeleton / Loading placeholders ===== */
@keyframes skeleton-shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--stats-bg) 25%, var(--border) 50%, var(--stats-bg) 75%);
    background-size: 200px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: 4px;
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}

.skeleton-row {
    display: flex; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border);
    align-items: center;
}
.skeleton-cell { height: 14px; border-radius: 3px; flex: 1; }
.skeleton-cell:last-child { flex: 0.5; }

/* Stats skeleton: matching stat-box layout */
.skeleton-stat { height: 28px; width: 80px; display: inline-block; vertical-align: middle; }

/* Number transition */
.stat-value { transition: color 0.3s; }

/* ===== Responsive helpers ===== */
@media (max-width: 768px) {
    .stats-row { flex-direction: column; }
    .form-row { flex-direction: column; }
    .cron-presets { flex-wrap: wrap; }
    .cron-preset-radio { flex: 1 1 45%; }
}


