:root {
    --bg-primary: #050505;
    --bg-secondary: #0c0c0c;
    --bg-tertiary: #141414;
    --bg-hover: #1c1c1c;
    --border: #222222;
    --border-hover: #333333;
    --text-primary: #ffffff;
    --text-secondary: #999999;
    --text-muted: #555555;
    --accent: #ffffff;
    --accent-inverse: #000000;
    --error: #ff3333;
    --success: #00dd77;
    --warning: #ffaa00;
    --code-bg: #0a0a0a;
    --toast-bg: rgba(0, 0, 0, 0.85);
    --toast-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
    --title-start: #ffffff;
    --title-end: #777777;
}
body[data-theme="light"] {
    --bg-primary: #f4f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f5;
    --bg-hover: #e7eaf0;
    --border: #d8dde6;
    --border-hover: #b9c2d0;
    --text-primary: #121417;
    --text-secondary: #5e6673;
    --text-muted: #8a94a3;
    --accent: #121417;
    --accent-inverse: #ffffff;
    --code-bg: #eef1f5;
    --toast-bg: rgba(255, 255, 255, 0.96);
    --toast-shadow: 0 18px 50px rgba(31, 41, 55, 0.18);
    --title-start: #111318;
    --title-end: #4d5663;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: clamp(24px, 4vw, 40px);
    width: 100%;
}
.logo { text-align: center; margin-bottom: 24px; }
.logo h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.7rem;
    background: linear-gradient(135deg, var(--title-start), var(--title-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo p { font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; }
.container {
    width: min(100% - 32px, 480px);
    margin: 0 auto;
    padding: clamp(24px, 5vw, 48px) 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.container.wide { max-width: 640px; }
.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}
.stat-value {
    font-family: 'Space Grotesk', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 4px;
}
.stat-value.online { color: var(--success); }
.stat-value.offline { color: var(--error); }
.stat-value.warn { color: var(--warning); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
#viewContent {
    padding: 72px 16px 24px;
    flex: 1;
}
.section-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-secondary); }
.info-value {
    color: var(--text-primary);
    font-weight: 500;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.8rem;
    word-break: break-all;
    text-align: right;
    max-width: 60%;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.danger-btn {
    width: 100%;
    background: transparent;
    color: var(--error);
    border: 1px solid rgba(255,51,51,0.25);
    border-radius: 10px;
    padding: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.danger-btn:hover { background: rgba(255,51,51,0.06); border-color: rgba(255,51,51,0.4); }
.danger-btn .spinner {
    width: 14px; height: 14px;
    border: 2px solid var(--error);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.danger-btn.loading .spinner { display: block; }
.danger-btn.loading .btn-text { display: none; }
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.badge.online { background: rgba(0,221,119,0.08); border: 1px solid rgba(0,221,119,0.2); color: var(--success); }
.badge.online .dot { background: var(--success); }
.badge.offline { background: rgba(255,51,51,0.08); border: 1px solid rgba(255,51,51,0.2); color: var(--error); }
.badge.offline .dot { background: var(--error); }
.badge.waiting { background: rgba(255,170,0,0.08); border: 1px solid rgba(255,170,0,0.2); color: var(--warning); }
.badge.waiting .dot { background: var(--warning); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    flex-direction: column;
    gap: 16px;
}
.loading-screen .loader {
    width: 28px; height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.loading-screen p { color: var(--text-muted); font-size: 0.82rem; }
.footer { text-align: center; padding: 16px; color: var(--text-muted); font-size: 0.72rem; }
@media (max-width: 640px) {
    .container { width: min(100% - 24px, 480px); padding-top: 24px; }
    .logo h1 { font-size: 1.5rem; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}
.screen { display: none; }
.screen.active { display: block; }
.country-search {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}
.country-search::placeholder { color: var(--text-muted); }
.country-search:focus { border-color: #444; background: var(--bg-hover); }
.country-list {
    max-height: 280px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    margin-bottom: 14px;
}
.country-list::-webkit-scrollbar { width: 4px; }
.country-list::-webkit-scrollbar-track { background: transparent; }
.country-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.country-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    font-size: 0.85rem;
}
.country-item:hover { background: var(--bg-hover); }
.country-item.selected { background: rgba(255,255,255,0.06); border-left: 3px solid var(--accent); }
body[data-theme="light"] .country-item.selected { background: rgba(0,0,0,0.04); }
.country-item .country-name { color: var(--text-primary); }
.country-item .country-code { color: var(--text-muted); font-family: 'Space Grotesk', monospace; font-size: 0.8rem; }
.selected-country-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.88rem;
}
.selected-country-badge .code { font-weight: 600; }
.selected-country-badge .change-link {
    margin-left: auto;
    font-size: 0.72rem;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.selected-country-badge .change-link:hover { color: var(--text-primary); }
.phone-prefix-wrapper {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-tertiary);
    transition: border-color 0.2s ease;
}
.phone-prefix-wrapper:focus-within { border-color: #444; background: var(--bg-hover); }
.phone-prefix {
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-family: 'Space Grotesk', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-hover);
    border-right: 1px solid var(--border);
    white-space: nowrap;
}
.phone-prefix-wrapper .input-field { border: none; border-radius: 0; background: transparent; }
.phone-prefix-wrapper .input-field:focus { background: transparent; border-color: transparent; }
.no-results { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 0.82rem; }
.ctrl-btn {
          display: inline-flex;
          align-items: center;
          justify-content: center;
          gap: 6px;
          padding: 10px 16px;
          border-radius: 10px;
          border: 1px solid var(--border);
          font-family: inherit;
          font-size: 13px;
          font-weight: 500;
          cursor: pointer;
          transition: all 0.2s;
          background: var(--bg-tertiary);
          color: var(--text-primary);
        }
        .ctrl-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); }
        .ctrl-btn:active { transform: scale(0.96); }
        .ctrl-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
        .ctrl-btn-primary { background: var(--text-primary); color: var(--accent-inverse); border-color: var(--text-primary); }
        .ctrl-btn-primary:hover, .ctrl-btn-primary:active { background: var(--text-primary); color: var(--accent-inverse); opacity: 0.8; }
        .ctrl-btn-warning { background: var(--warning); color: #000; border-color: var(--warning); }
        .ctrl-btn-warning:hover, .ctrl-btn-warning:active { background: var(--warning); color: #000; opacity: 0.8; }
        .ctrl-btn-secondary { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border); }
        .ctrl-btn-secondary:hover, .ctrl-btn-secondary:active { background: var(--bg-hover); color: var(--text-primary); }
        .ctrl-btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
        .ctrl-btn-danger:hover, .ctrl-btn-danger:active { background: var(--error); color: #fff; opacity: 0.8; }
        .ctrl-btn-success { background: var(--success); color: #000; border-color: var(--success); }
        .ctrl-btn-success:hover, .ctrl-btn-success:active { background: var(--success); color: #000; opacity: 0.8; }
        .ctrl-btn-gold { background: #b8860b; color: #fff; border-color: #b8860b; }
        .ctrl-btn-gold:hover, .ctrl-btn-gold:active { background: #b8860b; color: #fff; opacity: 0.8; }
.btn {
    width: 100%;
    background: var(--accent);
    color: var(--accent-inverse);
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,255,255,0.12); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .spinner {
    width: 16px; height: 16px;
    border: 2px solid var(--accent-inverse);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.btn.loading .spinner { display: block; }
.btn.loading .btn-text { display: none; }
.result-box {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: none;
    animation: fadeUp 0.35s ease;
    text-align: center;
}
.result-box.show { display: block; }
.result-box .code {
    font-family: 'Space Grotesk', monospace;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    background: var(--code-bg);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    margin: 12px 0;
    user-select: all;
}
.result-box .result-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.result-box .code-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.result-box .result-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.2rem; cursor: pointer; padding: 0 4px; line-height: 1;
}
.result-box .result-close:hover { color: var(--text-primary); }
.result-box .sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 8px; }
.copy-btn {
    width: 100%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
}
.copy-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); }
.copy-btn.copied { background: rgba(0,221,119,0.08); border-color: var(--success); color: var(--success); }
.wheel-wrap {
    margin-top: 20px;
    padding: 24px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: none;
    text-align: center;
    animation: fadeUp 0.35s ease;
}
.wheel-wrap.active { display: block; }
.wheel-spinner {
    display: inline-block;
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.wheel-text { margin-top: 12px; font-size: 13px; color: var(--text-secondary); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.82rem;
    display: none;
    animation: fadeUp 0.25s ease;
}
.alert.show { display: block; }
.alert-error { background: rgba(255,51,51,0.06); border: 1px solid rgba(255,51,51,0.15); color: var(--error); }
.alert-success { background: rgba(0,221,119,0.06); border: 1px solid rgba(0,221,119,0.15); color: var(--success); }
.toast {
    position: fixed;
    left: 50%;
    bottom: 20vh;
    transform: translate(-50%, 16px);
    z-index: 999;
    width: min(400px, calc(100% - 32px));
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--toast-bg);
    color: var(--text-primary);
    box-shadow: var(--toast-shadow);
    font-size: 0.84rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    backdrop-filter: blur(12px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.login-form { display: block; }
.login-form.hidden { display: none; }
.hidden { display: none !important; }
.input-group { margin-bottom: 16px; }
.input-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
}
.input-field {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.88rem;
    outline: none;
    transition: all 0.2s ease;
}
.input-field::placeholder { color: var(--text-muted); }
.input-field:focus { border-color: #444; background: var(--bg-hover); }
.input-group.focused .input-label { color: var(--accent); }
.setting-row.focused { background: var(--bg-hover); border-radius: 6px; }
.hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; }
.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}
.theme-toggle:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text-primary); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun-icon { display: none; }
body[data-theme="light"] .theme-toggle .moon-icon { display: none; }
body[data-theme="light"] .theme-toggle .sun-icon { display: block; }

/* ===== NAV + VIEW STYLES ===== */
.app {
    display: none;
    flex-direction: column;
    min-height: 100vh;
}
.app.show { display: flex; }

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 8px;
    z-index: 100;
}
.nav-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    margin-right: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}
.nav-scroll-wrap {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
}
.nav-scroll-arrow {
    flex-shrink: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 11px;
    width: 26px;
    height: 26px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 2;
    transition: all .15s;
}
.nav-scroll-arrow:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-scroll-arrow.show { display: flex; }
.nav-links {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 0 4px;
    flex: 1;
    position: relative;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--accent);
    transition: left .25s cubic-bezier(.4,0,.2,1), width .25s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
    z-index: 1;
}
.nav-item {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 8px 14px;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    position: relative;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.nav-item:hover { color: var(--text-primary); }
.nav-item.active { color: var(--text-primary); font-weight: 600; border-bottom-color: var(--accent); }
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}
.nav-right .theme-toggle {
    position: static;
    width: 34px;
    height: 34px;
}

.view { display: none; padding: 72px 16px 24px; }
.view.active { display: block; }

.controls-bar {
    display: flex;
    gap: 8px;
    padding: 12px 0;
    flex-wrap: wrap;
}
.controls-bar .ctrl-btn { flex: 1; min-width: 80px; }

/* Console */
.console-wrap {
    display: flex;
    flex-direction: column;
    height: calc(50vh - 16px);
}
#logContainer {
    flex: 1;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    overflow-y: auto;
    overflow-x: auto;
    font-family: monospace;
    font-size: 8px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-all;
}
#logContainer::-webkit-scrollbar { width: 4px; }
#logContainer::-webkit-scrollbar-track { background: transparent; }
#logContainer::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
#logContent { color: var(--text-secondary); }

/* Status post */
.status-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    outline: none;
}
.status-input:focus { border-color: #444; background: var(--bg-hover); }
.file-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.file-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.file-btn input { display: none; }
#statusPreview { max-width: 160px; max-height: 160px; border-radius: 8px; margin-top: 8px; display: none; }
#statusPreview.show { display: block; }
#audioFileName { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.status-attach { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.audio-recorder {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 8px;
    flex-wrap: wrap;
}
.audio-recorder .hidden { display: none !important; }

/* Console toolbar */
.console-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}
.auto-scroll-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.auto-scroll-label input[type="checkbox"] {
    accent-color: var(--text-primary);
}
.scroll-bottom-btn {
    display: none;
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all .15s;
    z-index: 1001;
}
.scroll-bottom-btn.show { display: inline-flex; }
.scroll-bottom-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); }

/* File Manager */
.fm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.fm-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}
.fm-breadcrumbs span { color: var(--text-primary); }
.fm-breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
}
.fm-breadcrumbs a:hover { color: var(--text-primary); text-decoration: underline; }
.fm-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.fm-actions .ctrl-btn { flex: 0; min-width: auto; padding: 6px 14px; font-size: 13px; }
.fm-upload-area {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all .15s;
    cursor: pointer;
    margin-bottom: 10px;
}
.fm-upload-area:hover { border-color: var(--text-secondary); }
.fm-dragover { border-color: var(--text-primary); background: var(--bg-hover); }
.fm-table-header {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
}
.fm-table-header .fm-chk-col { width: 36px; flex: none; }
.fm-table-header .fm-icon-col { width: 28px; flex: none; }
.fm-table-header .fm-name-col { flex: 1; }
.fm-table-header .fm-size-col { width: 80px; text-align: right; }
.fm-table-header .fm-date-col { width: 100px; text-align: right; }
.fm-table-header .fm-actions-col { width: 40px; }
.fm-file-list { position: relative; min-height: 120px; }
.fm-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}
.fm-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .1s;
    font-size: 13px;
}
.fm-row:hover { background: var(--bg-hover); }
.fm-row.fm-selected { background: var(--bg-tertiary); }
.fm-chk-label {
    width: 36px;
    flex: none;
    display: flex;
    align-items: center;
    cursor: pointer;
}
.fm-chk-label input { accent-color: var(--text-primary); }
.fm-row-icon {
    width: 28px;
    flex: none;
    font-size: 16px;
    text-align: center;
}
.fm-row-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}
.fm-row-size {
    width: 80px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 12px;
}
.fm-row-date {
    width: 100px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 12px;
}
.fm-row-actions {
    width: 40px;
    text-align: center;
}
.fm-dot-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}
.fm-dot-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.hl-comment { color: #6a9955; font-style: italic; }
.hl-string { color: #ce9178; }
.hl-number { color: #b5cea8; }
.hl-keyword { color: #569cd6; font-weight: 500; }
.hl-builtin { color: #dcdcaa; }

.editor-hl {
    position: absolute; top: 0; left: 52px; right: 0; bottom: 0;
    pointer-events: none; overflow: hidden;
    font-family: monospace; font-size: 13px; line-height: 1.5;
    padding: 10px; white-space: pre-wrap; word-break: break-all;
    color: #d4d4d4; background: transparent; z-index: 1;
}
.editor-textarea {
    position: relative; z-index: 2;
    color: transparent; caret-color: #fff;
    background: transparent;
}
.editor-textarea::selection { background: #264f78; }

.fm-ctx-menu {
    display: none;
    position: fixed;
    z-index: 1000;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
.fm-ctx-menu.show { display: block; }
.fm-ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.fm-ctx-item:hover { background: var(--bg-hover); }
.fm-ctx-item.danger { color: var(--error); }
.fm-ctx-item.danger:hover { background: var(--error); color: #fff; }
.fm-ctx-sep { height: 1px; background: var(--border); margin: 4px 8px; }
.fm-mass-bar {
    display: none;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 12px 20px;
    align-items: center;
    gap: 12px;
}
.fm-mass-bar.show { display: flex; }
.fm-mass-bar .fm-sel-count { color: #fff; font-size: 13px; }
.fm-mass-bar .ctrl-btn { flex: 0; min-width: auto; padding: 6px 16px; font-size: 13px; }

/* ===== MODAL DIALOG ===== */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.55);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 9999;
}
.loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 16px; color: #fff; font-size: 16px; font-weight: 500; }

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 14px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.4);
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
    padding: 20px 20px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.modal-body {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.modal-body input[type="text"],
.modal-body input[type="password"] {
    width: 100%;
    margin-top: 10px;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
}
.modal-body input:focus { border-color: #444; }
.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 0 20px 20px;
}
.modal-footer .ctrl-btn { min-width: 80px; }

/* Fullscreen editor */
.modal-overlay.editor-fullscreen {
    padding: 0;
    align-items: stretch;
}
.modal-overlay.editor-fullscreen .modal-box {
    max-width: none;
    width: 100%;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    height: 100vh;
    animation: none;
}
.modal-overlay.editor-fullscreen .modal-header {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}
.modal-overlay.editor-fullscreen .modal-body {
    flex: 1;
    padding: 0;
    display: flex;
    min-height: 0;
}
.modal-overlay.editor-fullscreen .modal-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}
.editor-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1e1e1e;
}
.editor-gutter {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 50px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border);
    padding: 10px 0;
    overflow: hidden;
    text-align: right;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
    user-select: none;
    z-index: 3;
}
.editor-gutter span {
    display: block;
    padding: 0 10px;
}
.editor-textarea {
    position: absolute;
    top: 0; left: 52px; right: 0; bottom: 0;
    padding: 10px;
    border: none;
    color: transparent;
    caret-color: #fff;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    outline: none;
    overflow-y: auto;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    tab-size: 4;
    z-index: 2;
    background: transparent;
}
@media (max-width: 640px) {
    .editor-gutter { width: 36px; font-size: 11px; }
    .editor-gutter span { padding: 0 6px; }
    .editor-textarea { font-size: 11px; padding: 10px 10px; }
}

/* ===== STATUS TAB ===== */
.status-page { max-width: 600px; margin: 0 auto; }
.status-page .section-title { margin: 20px 0 10px; font-size: 13px; }
.status-page .section-title:first-child { margin-top: 0; }
.status-page .card { border-radius: 12px; }
#recordingTimer { font-family: monospace; font-size: 18px; font-weight: 600; color: var(--text-primary); min-width: 90px; }
#recordBtn.recording { background: var(--error); color: #fff; border-color: var(--error); animation: pulse 1s ease infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }

@media (min-width: 768px) {
    #logContainer { font-size: 12px; }
}
@media (min-width: 1024px) {
    .console-wrap { height: calc(68vh - 16px); }
}
@media (max-width: 640px) {
    .nav-brand { font-size: 14px; margin-right: 8px; }
    .nav-links { padding: 0; }
    .nav-item { padding: 8px 10px; font-size: 12px; }
    .nav-scroll-arrow { width: 22px; height: 22px; font-size: 9px; }
    .controls-bar .ctrl-btn { min-width: 0; }
    .fm-actions { width: 100%; }
    .fm-actions .ctrl-btn { flex: 1 1 auto; min-width: 0; }
}