/* DSU Marketplace - Dark Theme Dashboard */

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #1a1d27;
    --bg-card: #222533;
    --bg-hover: #2a2e3f;
    --bg-input: #181b24;
    --border: #2e3348;
    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa3;
    --text-muted: #5c6078;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-dim: rgba(99, 102, 241, 0.15);
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, 0.15);
    --yellow: #eab308;
    --yellow-dim: rgba(234, 179, 8, 0.15);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.15);
    --blue: #3b82f6;
    --blue-dim: rgba(59, 130, 246, 0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --bg-elev: #1e2130;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f1117;
    background: var(--bg-primary);
    color: #e8eaf0;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.hidden { display: none !important; }

/* Nav */
nav {
    background: #1a1d27;
    background: var(--bg-secondary);
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 18px;
    font-weight: 700;
    color: #6366f1;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.logo { font-size: 22px; }

.nav-subtitle {
    font-size: 11px;
    font-weight: 400;
    color: #5c6078;
    color: var(--text-muted);
    margin-left: 4px;
}

.nav-links {
    display: flex;
    gap: 4px;
    flex: 1;
}

.nav-link {
    padding: 6px 14px;
    border-radius: 8px;
    border-radius: var(--radius);
    color: #8b8fa3;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
}

.nav-link:hover { background: #2a2e3f; color: #e8eaf0; }
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.active { background: rgba(99, 102, 241, 0.15); color: #6366f1; }
.nav-link.active { background: var(--accent-dim); color: var(--accent); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.nav-user-name {
    font-size: 13px;
    color: #8b8fa3;
    color: var(--text-secondary);
}

.nav-user-role {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.role-consumer { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.role-consumer { background: var(--blue-dim); color: var(--blue); }
.role-contributor { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.role-contributor { background: var(--green-dim); color: var(--green); }
.role-admin { background: rgba(99, 102, 241, 0.15); color: #6366f1; }
.role-admin { background: var(--accent-dim); color: var(--accent); }

/* Alerts bell */
.nav-alerts {
    position: relative;
    flex-shrink: 0;
}
.alert-bell {
    background: none;
    border: none;
    color: #8b8fa3;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    position: relative;
    display: flex;
    align-items: center;
}
.alert-bell:hover { background: #2a2e3f; color: #e8eaf0; }
.alert-bell:hover { background: var(--bg-hover); color: var(--text-primary); }
.alert-badge {
    position: absolute;
    top: 0;
    right: -2px;
    background: #ef4444;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
}
.alert-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 340px;
    max-height: 400px;
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    box-shadow: var(--shadow);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.alert-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
    color: #e8eaf0;
    color: var(--text-primary);
}
.alert-dropdown-header a {
    font-size: 11px;
    font-weight: 400;
    color: #6366f1;
    color: var(--accent);
    cursor: pointer;
}
.alert-dropdown-header a:hover { text-decoration: underline; }
.alert-dropdown-list {
    overflow-y: auto;
    max-height: 340px;
}
.alert-item {
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}
.alert-item:last-child { border-bottom: none; }
.alert-unread { background: rgba(99, 102, 241, 0.06); }
.alert-icon { font-size: 14px; flex-shrink: 0; padding-top: 1px; }
.alert-content { flex: 1; min-width: 0; }
.alert-msg { color: #e8eaf0; line-height: 1.4; }
.alert-msg { color: var(--text-primary); line-height: 1.4; }
.alert-time { color: #5c6078; font-size: 11px; margin-top: 2px; }
.alert-time { color: var(--text-muted); font-size: 11px; margin-top: 2px; }

/* Landing */
.landing-hero {
    text-align: center;
    padding: 80px 24px 60px;
    max-width: 700px;
    margin: 0 auto;
}

.hero-icon {
    font-size: 64px;
    color: #6366f1;
    color: var(--accent);
    margin-bottom: 16px;
}

.landing-hero h1 {
    font-size: 42px;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 16px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-bottom: 32px;
    line-height: 1.7;
}

.hero-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.tier-preview {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

.tier-preview h2 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 32px;
    color: #e8eaf0;
    color: var(--text-primary);
}

.tier-cards {
    letter-spacing: -4px;
}
.tier-cards > * {
    display: inline-block;
    vertical-align: top;
    width: 200px;
    margin: 8px;
    letter-spacing: normal;
}
.tier-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.tier-card {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all 0.2s;
}

.tier-card:hover {
    border-color: #6366f1;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    box-shadow: var(--shadow);
}

.tier-level {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6366f1;
    color: var(--accent);
    margin-bottom: 8px;
}

.tier-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.tier-card .tier-desc {
    font-size: 13px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-bottom: 16px;
    min-height: 60px;
}

.tier-card .tier-price {
    font-size: 22px;
    font-weight: 700;
    color: #6366f1;
    color: var(--accent);
}

.tier-card .tier-price span {
    font-size: 13px;
    font-weight: 400;
    color: #5c6078;
    color: var(--text-muted);
}

.tier-meta {
    margin-top: 12px;
    font-size: 12px;
    color: #5c6078;
    color: var(--text-muted);
}

.tier-meta div { margin-bottom: 4px; }

/* Onboarding (role-specific landing) */
.onboard {
    max-width: 960px;
    margin: 0 auto;
    padding: 60px 24px 80px;
}

.onboard-hero {
    text-align: center;
    margin-bottom: 48px;
}

.onboard-hero h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.onboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-bottom: 48px;
}

.onboard-col {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 28px;
}

.onboard-col h3 {
    font-size: 15px;
    color: #6366f1;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    margin-top: 20px;
}

.onboard-col h3:first-child { margin-top: 0; }

.onboard-col p {
    font-size: 14px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.65;
}

.onboard-col ul {
    font-size: 14px;
    color: #8b8fa3;
    color: var(--text-secondary);
    padding-left: 20px;
    margin-bottom: 12px;
    line-height: 1.65;
}

.onboard-col ul li { margin-bottom: 6px; }

.onboard-col strong { color: #e8eaf0; }
.onboard-col strong { color: var(--text-primary); }

@media (max-width: 800px) {
    .onboard-grid { grid-template-columns: 1fr; }
}

/* Auth */
.auth-card {
    max-width: 420px;
    margin: 80px auto;
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 36px;
}

.onboard .auth-card { margin: 0 auto; }

.auth-card h2 {
    margin-bottom: 24px;
    font-size: 22px;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #8b8fa3;
    color: var(--text-secondary);
}

.auth-switch a {
    color: #6366f1;
    color: var(--accent);
    text-decoration: none;
}

.demo-accounts {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #2e3348;
    border-top: 1px solid var(--border);
    text-align: center;
}

.demo-accounts p {
    font-size: 13px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.demo-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    color: #e8eaf0;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #6366f1;
    border-color: var(--accent);
}

.form-error {
    background: rgba(239, 68, 68, 0.15);
    background: var(--red-dim);
    color: #ef4444;
    color: var(--red);
    padding: 10px 12px;
    border-radius: 8px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
}

.form-success {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    color: var(--green);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 12px;
}

.form-warning {
    background: var(--yellow-dim, #3a2f10);
    color: var(--yellow, #f5c842);
    border-left: 3px solid var(--yellow, #f5c842);
    padding: 10px 12px;
    border-radius: 8px;
    border-radius: var(--radius);
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 12px;
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #5c6078;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Expert mode (create-drive modal) */
.expert-toggle {
    background: transparent;
    border: 1px dashed #2e3348;
    border: 1px dashed var(--border);
    color: #8b8fa3;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 12px;
    width: 100%;
    text-align: left;
    transition: border-color 0.15s, color 0.15s;
}
.expert-toggle:hover {
    border-color: #6366f1;
    border-color: var(--accent);
    color: #6366f1;
    color: var(--accent);
}
.expert-caret {
    display: inline-block;
    margin-right: 4px;
    font-family: monospace;
}

.expert-panel {
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.expert-hint {
    font-size: 12px;
    color: #5c6078;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
}
.expert-hint em {
    color: #8b8fa3;
    color: var(--text-secondary);
    font-style: italic;
}

.expert-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #8b8fa3;
    color: var(--text-secondary);
    cursor: pointer;
}
.expert-check-row input[type="checkbox"] {
    margin: 0;
}

.form-hint-warn {
    color: #ef4444;
    color: var(--red);
}

.ip-input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.ip-input-row input {
    flex: 1;
    min-width: 0;
}
.ip-input-row .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.expert-preview {
    margin-bottom: 14px;
}
.expert-preview-empty {
    font-size: 12px;
    color: #5c6078;
    color: var(--text-muted);
    text-align: center;
    padding: 8px;
}
.expert-preview-error {
    background: rgba(239, 68, 68, 0.15);
    background: var(--red-dim);
    color: #ef4444;
    color: var(--red);
    padding: 10px 12px;
    border-radius: 8px;
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.5;
}
.expert-preview-error strong {
    display: block;
    margin-bottom: 4px;
}
.dsu-fleet-offer {
    margin-top: 10px;
    padding: 8px 10px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 6px;
    color: #a5b4fc;
    font-size: 12px;
}
.dsu-fleet-offer label { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.dsu-fleet-offer input[type="checkbox"] { accent-color: #6366f1; }

.preview-grid {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 4px 12px;
    margin: 0 0 12px 0;
    font-size: 12px;
}
.preview-grid dt {
    color: #5c6078;
    color: var(--text-muted);
}
.preview-grid dd {
    margin: 0;
    color: #e8eaf0;
    color: var(--text-primary);
}
.preview-pin-tag {
    display: inline-block;
    background: #6366f1;
    background: var(--accent);
    color: white;
    font-size: 9px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.preview-slices-header {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5c6078;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.preview-slices {
    display: grid;
    gap: 3px;
    max-height: 140px;
    overflow-y: auto;
    padding-right: 4px;
}
.preview-slice {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 4px 8px;
    background: #222533;
    background: var(--bg-card);
    border-radius: 4px;
}
.preview-slice-name {
    color: #8b8fa3;
    color: var(--text-secondary);
    font-family: monospace;
}
.preview-slice-gb {
    color: #e8eaf0;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.expert-pins .form-group {
    margin-bottom: 10px;
}
.expert-pins .form-group:last-child {
    margin-bottom: 0;
}

.expert-pin-state {
    font-size: 10px;
    font-weight: 500;
    color: #5c6078;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 6px;
    font-family: monospace;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 8px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    gap: 6px;
}

.btn-primary { background: #6366f1; color: white; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #818cf8; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #222533; color: #e8eaf0; border: 1px solid #2e3348; }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: #2a2e3f; }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.btn-danger { background: var(--red-dim); color: var(--red); }
.btn-danger:hover { background: #ef4444; color: white; }
.btn-danger:hover { background: var(--red); color: white; }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 1px solid #2e3348; color: #8b8fa3; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: #6366f1; color: #6366f1; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-icon { padding: 6px 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Dashboard */
.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.dash-header h1 { font-size: 24px; }

/* Stats Bar */
.stats-bar {
    letter-spacing: -4px;
    margin-bottom: 24px;
}
.stats-bar > * {
    display: inline-block;
    vertical-align: top;
    width: 180px;
    margin: 8px;
    letter-spacing: normal;
}
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 20px;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5c6078;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-sub {
    font-size: 12px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Status badges */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-online, .status-active { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.status-online, .status-active { background: var(--green-dim); color: var(--green); }
.status-online::before, .status-active::before { background: #22c55e; }
.status-online::before, .status-active::before { background: var(--green); }
.status-offline, .status-suspended { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.status-offline, .status-suspended { background: var(--red-dim); color: var(--red); }
.status-offline::before, .status-suspended::before { background: #ef4444; }
.status-offline::before, .status-suspended::before { background: var(--red); }
.status-maintenance, .status-provisioning { background: rgba(234, 179, 8, 0.15); color: #eab308; }
.status-maintenance, .status-provisioning, .status-draining, .status-reshaping { background: var(--yellow-dim); color: var(--yellow); }
.status-maintenance::before, .status-provisioning::before { background: #eab308; }
.status-maintenance::before, .status-provisioning::before, .status-draining::before, .status-reshaping::before { background: var(--yellow); }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: #1a1d27;
    background: var(--bg-secondary);
}

.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5c6078;
    color: var(--text-muted);
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    color: #8b8fa3;
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background: #2a2e3f;
    background: var(--bg-hover);
}

.data-table .name-cell {
    color: #e8eaf0;
    color: var(--text-primary);
    font-weight: 500;
}

/* Cards list (for drives/devices) */
.drive-list {
    display: grid;
    gap: 16px;
}

.drive-card {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: start;
    transition: border-color 0.15s;
}

.drive-card:hover {
    border-color: #6366f1;
    border-color: var(--accent);
}

/* Device silhouette column. `currentColor` on the SVG strokes picks up
   whichever color this container defines, so online/offline/maintenance
   recolor the whole glyph uniformly. */
.device-visual {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border-radius: var(--radius);
    background: #181b24;
    background: var(--bg-input);
    color: #5c6078;
    color: var(--text-muted);
}
.device-visual.online {
    color: #6366f1;
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}
.device-visual .led {
    opacity: 0.9;
}
.device-visual svg {
    display: block;
}

/* ============================================================
   Device tiles: compact grid, front/back flip, diagnostic panel
   ============================================================
   Replaces the full-width device-card layout with a grid of small
   flippable tiles so a contributor with a dozen devices sees their
   whole fleet without scrolling. Click flips to a back face with
   user-editable description/location and controller-reported specs. */

.device-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.device-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 10px;
}

.device-tile {
    perspective: 1200px;
    cursor: pointer;
    height: 240px;
}

.device-tile-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.3, 0.1, 0.3, 1);
}

.device-tile.flipped .device-tile-inner {
    transform: rotateY(180deg);
}

.device-tile-face {
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color 0.15s;
}

.device-tile-front {
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: center;
}

.device-tile:hover .device-tile-front {
    border-color: #6366f1;
    border-color: var(--accent);
}
.device-tile.tile-offline .device-tile-front {
    border-color: var(--red);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}
.device-tile.tile-offline:hover .device-tile-front { border-color: var(--red); }
.device-tile.tile-degraded .device-tile-front {
    border-color: var(--yellow);
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.15);
}
.device-tile.tile-degraded:hover .device-tile-front { border-color: var(--yellow); }

.device-tile-front .device-visual {
    width: 72px;
    height: 72px;
    margin-top: 4px;
}

.device-tile-front .device-visual svg {
    width: 56px;
    height: 56px;
}

.device-tile-name {
    font-size: 14px;
    font-weight: 600;
    color: #e8eaf0;
    color: var(--text-primary);
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.device-tile-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #5c6078;
    color: var(--text-muted);
}

.device-tile-type {
    text-transform: capitalize;
}

.device-issue-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ef4444;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.device-relay-badge,
.device-direct-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.device-relay-badge {
    background: var(--blue, #3b82f6);
    color: #fff;
}

.device-direct-badge {
    background: var(--green, #22c55e);
    color: #fff;
}

.conn-mode-toggle {
    display: inline-flex;
    gap: 0;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border, #334155);
}
.conn-mode-btn {
    padding: 1px 7px;
    font-size: .7rem;
    border: none;
    background: var(--bg-card, #1e293b);
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    transition: background .15s, color .15s;
}
.conn-mode-btn:not(:last-child) {
    border-right: 1px solid var(--border, #334155);
}
.conn-mode-btn:hover {
    background: var(--bg-hover, #334155);
    color: #fff;
}
.conn-mode-btn.active {
    background: var(--accent, #6366f1);
    color: #fff;
}

.device-tile-bar {
    width: 100%;
    margin-top: auto;
}

.device-tile-bar-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #5c6078;
    color: var(--text-muted);
    margin-top: 4px;
}

.device-tile-shards {
    font-family: ui-monospace, Menlo, monospace;
    color: #8b8fa3;
    color: var(--text-secondary);
}

.device-tile-hint {
    font-size: 10px;
    color: #5c6078;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 4px;
}

/* Back face — diagnostic/edit panel. */
.device-tile-back {
    transform: rotateY(180deg);
    overflow-y: auto;
    padding: 12px 14px;
    font-size: 12px;
    color: #8b8fa3;
    color: var(--text-secondary);
}

.device-back-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
}

.device-back-head strong {
    font-size: 13px;
    color: #e8eaf0;
    color: var(--text-primary);
}

.device-back-close {
    background: transparent;
    border: none;
    color: #5c6078;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.device-back-close:hover { color: #e8eaf0; }
.device-back-close:hover { color: var(--text-primary); }

.device-back-section {
    margin-bottom: 10px;
}

.device-back-section label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5c6078;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.device-back-section input[type="text"],
.device-back-section textarea {
    width: 100%;
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 5px 7px;
    color: #e8eaf0;
    color: var(--text-primary);
    font-size: 12px;
    font-family: inherit;
    resize: vertical;
}

.device-back-section input[type="text"]:focus,
.device-back-section textarea:focus {
    outline: none;
    border-color: #6366f1;
    border-color: var(--accent);
}

.spec-list {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 2px 8px;
    margin: 0;
    font-size: 11px;
}
.spec-list dt {
    color: #5c6078;
    color: var(--text-muted);
}
.spec-list dd {
    margin: 0;
    color: #e8eaf0;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.spec-list code {
    font-size: 10px;
    font-family: ui-monospace, Menlo, monospace;
}

.spec-na {
    color: #5c6078;
    color: var(--text-muted);
    font-style: italic;
}
.spec-alarm {
    color: #ef4444;
    color: var(--red);
    font-weight: 600;
}
.spec-ok {
    color: #22c55e;
    color: var(--green);
}

.device-back-issues {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border: 1px solid var(--red);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 6px 8px;
    margin-bottom: 10px;
    font-size: 11px;
    color: #ef4444;
    color: var(--red);
}
.device-back-issues-title {
    font-weight: 600;
    margin-bottom: 3px;
}
.device-back-issues ul {
    margin: 0;
    padding-left: 16px;
}

.device-back-community {
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
}
.community-toggle {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #a5b4fc;
}
.community-toggle input[type="checkbox"] { accent-color: #6366f1; }
.community-hint {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
}

.device-back-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #2e3348;
    border-top: 1px solid var(--border);
}
.device-back-actions .btn {
    flex: 1 1 auto;
}

.card-main h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-top: 8px;
}

.card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.card-progress {
    margin-top: 12px;
}

.progress-bar {
    height: 6px;
    background: #181b24;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.progress-fill.green { background: #22c55e; }
.progress-fill.green { background: var(--green); }
.progress-fill.yellow { background: #eab308; }
.progress-fill.yellow { background: var(--yellow); }
.progress-fill.red { background: #ef4444; }
.progress-fill.red { background: var(--red); }
.progress-fill.blue { background: #3b82f6; }
.progress-fill.blue { background: var(--blue); }
.progress-fill.accent { background: #6366f1; }
.progress-fill.accent { background: var(--accent); }

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #5c6078;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Admin hierarchy shell */
.admin-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
}
.admin-toolbar {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
    font-size: 13px;
    color: var(--text-muted);
}
.admin-toolbar a {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}
.admin-toolbar a:hover { text-decoration: underline; }
.admin-toolbar .bc-sep {
    margin: 0 6px;
    color: var(--text-muted);
}
.admin-toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.admin-stat-pill {
    display: flex;
    align-items: baseline;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
}
.admin-stat-pill .pill-label {
    color: var(--text-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.admin-stat-pill .pill-value {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
}
.admin-stat-pill .pill-pct {
    color: var(--text-muted);
    font-size: 10px;
}
.admin-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

/* Horizontal splitter between content and bottom panel */
.admin-hsplitter {
    height: 5px;
    background: #2e3348;
    cursor: row-resize;
    flex-shrink: 0;
    transition: background 0.15s;
}
.admin-hsplitter:hover,
.admin-hsplitter.dragging {
    background: #5b5f80;
}

/* Bottom throughput panel */
.admin-bottom-panel {
    background: #222533;
    background: var(--bg-card);
    flex-shrink: 0;
    overflow: hidden;
}
.admin-bottom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 500;
    color: #8b8fa3;
    color: var(--text-secondary);
}
.admin-bottom-header:hover { color: #e8eaf0; }
.admin-bottom-header:hover { color: var(--text-primary); }
.admin-bottom-toggle {
    font-size: 11px;
    transition: transform 0.2s;
}
.admin-bottom-panel.collapsed .admin-bottom-body { display: none; }
.admin-bottom-panel.collapsed .admin-bottom-toggle { transform: rotate(-90deg); }
.admin-bottom-body {
    padding: 0 16px 12px;
}
.tp-charts {
    display: flex;
    align-items: stretch;
}
.tp-chart-pane {
    flex: 1;
    min-width: 60px;
    overflow: hidden;
}
.tp-chart-pane canvas {
    width: 100%;
    background: var(--bg-elev);
    border-radius: 8px;
    display: block;
}
.tp-vsplitter {
    width: 5px;
    background: #2e3348;
    cursor: col-resize;
    flex-shrink: 0;
    align-self: stretch;
    transition: background 0.15s;
}
.tp-vsplitter:hover,
.tp-vsplitter.dragging {
    background: #5b5f80;
}
#admin-tp-stats {
    gap: 16px;
}
#admin-tp-stats .stat-card {
    padding: 8px 12px;
}
#admin-tp-stats .stat-label { font-size: 10px; }
#admin-tp-stats .stat-value { font-size: 16px; }
#admin-tp-stats .stat-sub { font-size: 10px; }

/* Customer/drive/device cards grid */
.admin-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.admin-card {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.admin-card:hover { border-color: #6366f1; }
.admin-card:hover { border-color: var(--accent); }
.admin-card.card-offline {
    border-color: var(--red);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}
.admin-card.card-offline:hover { border-color: var(--red); }
.admin-card.card-degraded {
    border-color: var(--yellow);
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.15);
}
.admin-card.card-degraded:hover { border-color: var(--yellow); }
.admin-card .card-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-card .card-sub {
    font-size: 11px;
    color: #5c6078;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.admin-card .card-rates {
    font-size: 12px;
    color: #8b8fa3;
    color: var(--text-secondary);
    font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
    line-height: 1.6;
}
.admin-card .card-meta {
    font-size: 10px;
    color: #5c6078;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Tabs (kept for install tabs) */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #8b8fa3;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: -1px;
}

.tab-btn:hover { color: #e8eaf0; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: #6366f1; border-bottom-color: #6366f1; }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Drives tab — device cards grid */
.drive-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.drive-device-card {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.drive-device-card:hover { border-color: #6366f1; }
.drive-device-card:hover { border-color: var(--accent); }

.drive-device-card .device-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drive-device-card .device-rates {
    font-size: 12px;
    color: #8b8fa3;
    color: var(--text-secondary);
    font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
    line-height: 1.6;
}

/* Compact device rows inside the Drives modal */
.drive-modal-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.drive-modal-row:last-child { border-bottom: none; }

.drive-modal-row .device-name {
    flex: 1;
    font-weight: 500;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drive-modal-row .device-rate {
    font-family: ui-monospace, 'Cascadia Code', 'SF Mono', Menlo, monospace;
    font-size: 12px;
    min-width: 80px;
    text-align: right;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 18px; }

.modal-close {
    background: none;
    border: none;
    color: #5c6078;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}

.modal-close:hover { color: #e8eaf0; }
.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 24px;
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar select {
    padding: 6px 12px;
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    color: #e8eaf0;
    color: var(--text-primary);
    font-size: 13px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #5c6078;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 15px;
    margin-bottom: 16px;
}

/* File Browser */
.fb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.fb-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.fb-header-left h2 {
    font-size: 22px;
    margin: 0;
}

.fb-header-right {
    display: flex;
    gap: 8px;
}

.fb-usage {
    margin-bottom: 24px;
}

.fb-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fb-drop-zone {
    border: 2px dashed #2e3348;
    border: 2px dashed var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 13px;
    color: #5c6078;
    color: var(--text-muted);
    text-align: center;
    transition: all 0.15s;
}

.fb-drop-zone.drag-over {
    border-color: #6366f1;
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.15);
    background: var(--accent-dim);
    color: #6366f1;
    color: var(--accent);
}

.file-table .name-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-icon {
    font-size: 16px;
    flex-shrink: 0;
}

/* Chunk Map */
.chunk-map {
    display: grid;
    gap: 12px;
}

.chunk-device {
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 12px;
}

.chunk-device-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

.chunk-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.chunk-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    font-family: monospace;
}

.chunk-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 12px;
    color: #8b8fa3;
    color: var(--text-secondary);
}

.chunk-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Mount Instructions */
.mount-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.mount-tab {
    padding: 8px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #8b8fa3;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: -1px;
    transition: all 0.15s;
}

.mount-tab:hover { color: #e8eaf0; }
.mount-tab:hover { color: var(--text-primary); }
.mount-tab.active { color: #6366f1; border-bottom-color: #6366f1; }
.mount-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.mount-panel h4 {
    font-size: 14px;
    margin: 20px 0 6px 0;
    color: #e8eaf0;
    color: var(--text-primary);
}

.mount-panel h4:first-child { margin-top: 0; }

.mount-desc {
    font-size: 13px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.code-block {
    background: #0f1117;
    background: var(--bg-primary);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.code-block code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.7;
    color: #8b8fa3;
    color: var(--text-secondary);
    white-space: pre;
}

/* Wider modal for mount info */
.modal-wide {
    max-width: 700px;
}

/* Mask text like a password field without type="password", which triggers
   Chrome's credential manager and blanks the page behind the modal. */
.passphrase-mask {
    -webkit-text-security: disc;
}

/* ─── Disk Grid ─── */
.disk-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.disk {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.disk:hover {
    border-color: #6366f1;
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.disk.reshaping {
    border-color: var(--yellow);
    box-shadow: 0 0 12px rgba(234, 179, 8, 0.2);
}

.disk.reshaping:hover {
    border-color: var(--yellow);
}

.disk.critical {
    border-color: var(--red);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
}

.disk.critical:hover {
    border-color: var(--red);
}

.disk-reshaping-label {
    color: var(--yellow);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-top: 4px;
    animation: blink-reshape 1.2s ease-in-out infinite;
}

@keyframes blink-reshape {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.disk-ring {
    position: relative;
    margin-bottom: 12px;
}

.disk-status-dot {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #222533;
    border: 2px solid var(--bg-card);
}

.disk-label {
    font-size: 14px;
    font-weight: 700;
    color: #e8eaf0;
    color: var(--text-primary);
    margin-bottom: 4px;
    word-break: break-all;
}

.disk-info {
    font-size: 12px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
}

.disk-sep {
    color: #5c6078;
    color: var(--text-muted);
}

.disk-tier {
    color: #6366f1;
    color: var(--accent);
    font-weight: 600;
}

.disk-cost {
    font-size: 13px;
    font-weight: 600;
    color: #22c55e;
    color: var(--green);
    margin-top: 6px;
}

.disk-add {
    background: #1a1d27;
    background: var(--bg-secondary);
    border: 2px dashed #2e3348;
    border: 2px dashed var(--border);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 220px;
}

.disk-add:hover {
    border-color: #6366f1;
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.15);
    background: var(--accent-dim);
}

.disk-add-icon {
    font-size: 40px;
    color: #5c6078;
    color: var(--text-muted);
    line-height: 1;
    margin-bottom: 8px;
    transition: color 0.15s;
}

.disk-add:hover .disk-add-icon {
    color: #6366f1;
    color: var(--accent);
}

.disk-add-label {
    font-size: 13px;
    color: #5c6078;
    color: var(--text-muted);
    font-weight: 500;
}

/* ─── File Manager ─── */
.fm-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    flex-wrap: wrap;
}

.fm-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fm-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fm-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.fm-bc-drive {
    color: #8b8fa3;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s;
}

.fm-bc-drive:hover {
    color: #6366f1;
    color: var(--accent);
}

.fm-bc-sep {
    color: #5c6078;
    color: var(--text-muted);
}

.fm-bc-current {
    color: #e8eaf0;
    color: var(--text-primary);
    font-weight: 600;
}

.fm-search input {
    padding: 5px 10px;
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    color: #e8eaf0;
    color: var(--text-primary);
    font-size: 13px;
    width: 180px;
    transition: border-color 0.15s;
}

.fm-search input:focus {
    outline: none;
    border-color: #6366f1;
    border-color: var(--accent);
}

.fm-search input::placeholder {
    color: #5c6078;
    color: var(--text-muted);
}

.fm-lock-btn.fm-unlocked {
    color: var(--green);
    border-color: var(--green);
}

.fm-sort-control {
    display: flex;
    align-items: center;
    gap: 2px;
}

.fm-sort-select {
    background: var(--bg-input);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.fm-sort-select:focus {
    border-color: var(--accent);
}

.fm-sort-dir {
    font-size: 10px;
    padding: 4px 6px;
    min-width: 24px;
}

.fm-view-toggle {
    display: flex;
    gap: 2px;
    background: #181b24;
    background: var(--bg-input);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 2px;
}

.fm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    border-radius: var(--radius);
    color: #8b8fa3;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.fm-btn:hover {
    background: #2a2e3f;
    background: var(--bg-hover);
    color: #e8eaf0;
    color: var(--text-primary);
}

.fm-btn.active {
    background: #222533;
    background: var(--bg-card);
    color: #6366f1;
    color: var(--accent);
    border-color: #2e3348;
    border-color: var(--border);
}

.fm-btn-accent {
    background: rgba(99, 102, 241, 0.15);
    background: var(--accent-dim);
    color: #6366f1;
    color: var(--accent);
    border-color: transparent;
}

.fm-btn-accent:hover {
    background: #6366f1;
    background: var(--accent);
    color: white;
}

/* Drive info bar */
.fm-drive-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.fm-drive-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fm-drive-ring {
    flex-shrink: 0;
}

.fm-drive-detail {
    font-size: 12px;
    color: #8b8fa3;
    color: var(--text-secondary);
}

.fm-drive-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Action bar */
.fm-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    flex-wrap: wrap;
}

.fm-sel-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
}

.fm-btn-danger {
    color: #ef4444;
    color: var(--red);
}
.fm-btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    background: var(--red-dim);
}

.fm-separator {
    width: 1px;
    height: 20px;
    background: #2e3348;
    background: var(--border);
    margin: 0 4px;
}

.fm-file-count {
    font-size: 12px;
    color: #5c6078;
    color: var(--text-muted);
}

#fm-selection-info {
    font-size: 12px;
    color: #6366f1;
    color: var(--accent);
    margin-left: 4px;
}

/* File area */
.fm-file-area {
    min-height: 300px;
    position: relative;
    padding: 8px 0;
    -webkit-touch-callout: none;
}
@media (pointer: coarse) {
    .fm-file-area, .fm-file-area * {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Grid view — float fallback for browsers without CSS Grid */
.fm-grid {
    overflow: hidden;
}
.fm-grid .fm-file-item {
    float: left;
    width: 120px;
    margin: 4px;
}
@supports (display: grid) {
    .fm-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
        overflow: visible;
    }
    .fm-grid .fm-file-item {
        float: none;
        width: auto;
        margin: 0;
    }
}

.fm-file-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px 8px;
    border-radius: 8px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.1s;
    text-align: center;
}

.fm-file-item:hover {
    background: #2a2e3f;
    background: var(--bg-hover);
}

.fm-file-item.selected {
    background: rgba(99, 102, 241, 0.15);
    background: var(--accent-dim);
    outline: 1px solid #6366f1;
    outline: 1px solid var(--accent);
}

.fm-file-icon {
    margin-bottom: 6px;
    line-height: 0;
}

.fm-file-icon svg {
    width: 40px;
    height: 48px;
}

.fm-file-icon-sm {
    line-height: 0;
}

.fm-file-icon-sm svg {
    width: 20px;
    height: 24px;
}

.fm-file-name {
    font-size: 12px;
    color: #e8eaf0;
    color: var(--text-primary);
    word-break: break-all;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-lock { font-size: 11px; opacity: 0.7; }

.fm-file-size {
    font-size: 11px;
    color: #5c6078;
    color: var(--text-muted);
    margin-top: 2px;
}

.fm-file-health {
    font-size: 10px;
    display: flex;
    align-items: center;
    gap: 3px;
    margin-top: 2px;
}

.fm-health-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

/* List view */
.fm-list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.fm-list-table thead {
    background: #1a1d27;
    background: var(--bg-secondary);
}

.fm-list-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5c6078;
    color: var(--text-muted);
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
}

.fm-list-table th.fm-sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.fm-list-table th.fm-sortable:hover {
    color: var(--text-secondary);
}

.fm-list-table th.fm-sorted {
    color: var(--accent);
}

.fm-sort-arrow {
    vertical-align: middle;
    margin-left: 2px;
}

/* Sort bar for card/tile grid views (admin, contributor) */
.sort-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 0;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* device-panel layout defined above with .device-list */

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

.sort-btn:hover {
    color: var(--text-secondary);
    border-color: var(--text-muted);
}

.sort-btn.active {
    color: var(--accent);
    border-color: var(--accent);
}


.fm-list-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    color: #8b8fa3;
    color: var(--text-secondary);
}

.fm-list-row {
    cursor: pointer;
    transition: background 0.1s;
}

.fm-list-row:hover {
    background: #2a2e3f;
    background: var(--bg-hover);
}

.fm-list-row.selected {
    background: rgba(99, 102, 241, 0.15);
    background: var(--accent-dim);
}

.fm-list-row.selected td {
    color: #e8eaf0;
    color: var(--text-primary);
}

.fm-list-name {
    color: #e8eaf0;
    color: var(--text-primary);
    font-weight: 500;
}

/* Empty state inside file area */
.fm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    color: #5c6078;
    color: var(--text-muted);
    font-size: 14px;
}

.fm-empty p {
    margin: 4px 0;
}

/* Status bar */
.fm-statusbar {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    border-top: 1px solid #2e3348;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: #5c6078;
    color: var(--text-muted);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: auto;
}

.toast-enter {
    opacity: 0;
    transform: translateY(10px);
}

.toast-exit {
    opacity: 0;
    transform: translateY(-10px);
}

/* Drop overlay */
.fm-drop-overlay {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(15, 17, 23, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    pointer-events: none;
}

.fm-drop-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #6366f1;
    color: var(--accent);
    border: 3px dashed #6366f1;
    border: 3px dashed var(--accent);
    border-radius: 12px;
    border-radius: var(--radius-lg);
    padding: 60px 80px;
    background: rgba(99, 102, 241, 0.15);
    background: var(--accent-dim);
}

/* Upload progress bar */
.fm-upload-bar {
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-top: 8px;
}

.fm-upload-info {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #8b8fa3;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* Rename input */
.fm-rename-input {
    width: 100%;
    max-width: 110px;
    padding: 2px 4px;
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #6366f1;
    border: 1px solid var(--accent);
    border-radius: 3px;
    color: #e8eaf0;
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
}

/* Preview */
.fm-preview-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: #8b8fa3;
    color: var(--text-secondary);
}

.fm-preview-text {
    background: #0f1117;
    background: var(--bg-primary);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 16px;
    max-height: 400px;
    overflow: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #8b8fa3;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

.fm-preview-img {
    max-width: 100%;
    max-height: 450px;
    border-radius: 8px;
    border-radius: var(--radius);
    display: block;
    margin: 0 auto;
}

/* Properties dialog */
.fm-props {
    display: grid;
    gap: 0;
}

.fm-props-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.fm-props-row > span:first-child {
    color: #5c6078;
    color: var(--text-muted);
    font-weight: 500;
}

.fm-props-row > span:last-child {
    color: #e8eaf0;
    color: var(--text-primary);
    text-align: right;
}

/* Context menu */
.fm-context {
    position: fixed;
    z-index: 300;
    background: #222533;
    background: var(--bg-card);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 180px;
    padding: 4px 0;
    overflow: hidden;
}

.fm-ctx-item {
    padding: 7px 16px;
    font-size: 13px;
    color: #e8eaf0;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
    display: flex;
    align-items: center;
}

.fm-ctx-item:hover {
    background: rgba(99, 102, 241, 0.15);
    background: var(--accent-dim);
    color: #6366f1;
    color: var(--accent);
}

.fm-ctx-sep {
    height: 1px;
    background: #2e3348;
    background: var(--border);
    margin: 4px 0;
}

.fm-ctx-danger {
    color: #ef4444;
    color: var(--red);
}

.fm-ctx-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    background: var(--red-dim);
    color: #ef4444;
    color: var(--red);
}

/* Responsive */
@media (max-width: 768px) {
    .landing-hero h1 { font-size: 28px; }
    .hero-actions { flex-direction: column; }
    .tier-cards { grid-template-columns: 1fr; }
    .stats-bar { grid-template-columns: 1fr 1fr; }
    .drive-card { grid-template-columns: 1fr; }
    .device-panel { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .device-tile { height: 220px; }
    .card-actions { justify-content: flex-start; }
    nav { padding: 0 12px; }
    .nav-subtitle { display: none; }
    .disk-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .fm-toolbar { flex-direction: column; align-items: flex-start; }
    .fm-drive-bar { flex-direction: column; align-items: flex-start; }
    .fm-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .fm-search input { width: 140px; }
}

/* Install / Add-a-device flow */
.install-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid #2e3348;
    border-bottom: 1px solid var(--border);
}

.install-tabs .tab-btn {
    background: transparent;
    color: #8b8fa3;
    color: var(--text-secondary);
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 2px solid transparent;
}

.install-tabs .tab-btn.active {
    color: #6366f1;
    color: var(--accent);
    border-bottom-color: #6366f1;
    border-bottom-color: var(--accent);
}

.install-tab { margin-bottom: 16px; }

.code-block {
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    padding: 14px;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    color: #e8eaf0;
    color: var(--text-primary);
    white-space: pre;
    overflow-x: auto;
    margin-bottom: 8px;
    line-height: 1.5;
}

.waiting-box {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #181b24;
    background: var(--bg-input);
    border: 1px solid #2e3348;
    border: 1px solid var(--border);
    border-radius: 8px;
    border-radius: var(--radius);
    margin-top: 20px;
}

.waiting-box.success {
    border-color: #22c55e;
    border-color: var(--green);
    background: rgba(34, 197, 94, 0.15);
    background: var(--green-dim);
}

.waiting-box .check-mark {
    font-size: 24px;
    color: #22c55e;
    color: var(--green);
    font-weight: 700;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #2e3348;
    border: 2px solid var(--border);
    border-top-color: #6366f1;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

@keyframes screen-glow {
    0%   { box-shadow: inset 0 0 0 0 transparent; }
    15%  { box-shadow: inset 0 0 60px 10px rgba(34, 197, 94, 0.08),
                       0 0 80px 20px rgba(34, 197, 94, 0.04); }
    50%  { box-shadow: inset 0 0 40px 5px rgba(34, 197, 94, 0.05),
                       0 0 60px 10px rgba(34, 197, 94, 0.02); }
    100% { box-shadow: inset 0 0 0 0 transparent; }
}
.screen-glow {
    animation: screen-glow 2.5s ease-out;
    pointer-events: none;
}
