/* === Reset & Variables === */
:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #263348;
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59, 130, 246, 0.15);
    --border: #334155;
    --success: #22c55e;
    --warning: #eab308;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* === Navbar === */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-icon { font-size: 1.5rem; }

.nav-links { display: flex; gap: 0.25rem; }

.nav-links a {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-links a:hover, .nav-links a.active {
    background: var(--accent-light);
    color: var(--accent);
}

/* === Container === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
}

/* === Hero === */
.hero {
    text-align: center;
    padding: 4rem 1rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.hero-sub {
    font-size: 1.15rem;
    color: var(--text-dim);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.btn-lg { padding: 0.8rem 2rem; font-size: 1.05rem; }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.85rem; }
.btn-block { width: 100%; justify-content: center; }

/* === Features === */
.features { padding: 2rem 0 4rem; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-dim); font-size: 0.95rem; }

/* === How To === */
.how-to { padding: 2rem 0; }
.how-to h2 { text-align: center; margin-bottom: 2rem; }

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.step {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.step-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.step h4 { margin-bottom: 0.5rem; }
.step p { color: var(--text-dim); font-size: 0.9rem; }

/* === Page Header === */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.page-header p { color: var(--text-dim); }

/* === FTP Input Bar === */
.ftp-input-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.ftp-input-bar label { font-weight: 600; white-space: nowrap; }
.ftp-hint { color: var(--text-dim); font-size: 0.85rem; }

/* === Inputs === */
.input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    width: 100%;
    max-width: 300px;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

select.input {
    max-width: 220px;
    cursor: pointer;
}

textarea.input { resize: vertical; max-width: 100%; }

/* === Category Filters === */
.category-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* === Template Cards === */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.template-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all 0.3s;
}

.template-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.difficulty { color: var(--warning); font-size: 1.1rem; }
.duration {
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.category-badge {
    display: inline-block;
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.15rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    width: fit-content;
}

.template-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.template-tips {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

.template-tips strong { display: block; margin-bottom: 0.25rem; }
.template-tips ul { margin: 0; padding-left: 1.2rem; }
.template-tips li { color: var(--text-dim); margin-bottom: 0.15rem; }

/* === Detail Page === */
.back-link {
    display: inline-block;
    margin-bottom: 1rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}
.back-link:hover { color: var(--accent); }

.detail-header { margin-bottom: 2rem; }
.detail-header h1 { font-size: 2rem; margin-bottom: 0.75rem; }

.detail-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    align-items: start;
}

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

.detail-main, .detail-sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

/* === Chart === */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
}

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

.chart-tooltip {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 10;
    box-shadow: var(--shadow);
    max-width: 250px;
}

/* === FTP Control === */
.ftp-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ftp-control .input { max-width: 120px; }
.ftp-control label { font-weight: 600; }

/* === Steps Timeline === */
.workout-steps h3 { margin-bottom: 1rem; }

.steps-timeline {
    display: flex;
    gap: 2px;
    min-height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.step-block {
    display: flex;
    align-items: flex-end;
    padding: 0.4rem 0.3rem;
    min-width: 30px;
    transition: all 0.2s;
    cursor: default;
}

.step-block:hover { filter: brightness(1.2); }

.step-on { background: #ef4444; }
.step-off { background: #3b82f6; }
.step-warmup { background: #3b82f6; }
.step-cooldown { background: #3b82f6; }
.step-ss { background: #22c55e; }

.step-label {
    display: flex;
    flex-direction: column;
    font-size: 0.7rem;
    color: #fff;
    line-height: 1.2;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    max-height: 100px;
    overflow: hidden;
}

.step-label strong { font-weight: 700; }

/* === Info Cards === */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.info-card h3 { margin-bottom: 0.75rem; font-size: 1.1rem; }
.info-card p { color: var(--text-dim); font-size: 0.95rem; }

.tips-list {
    list-style: none;
    padding: 0;
}

.tips-list li {
    padding: 0.4rem 0;
    padding-left: 1.2rem;
    position: relative;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.tips-list li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent);
}

/* === Zones Legend === */
.zones-legend { display: flex; flex-direction: column; gap: 0.4rem; }

.zone-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
}

.zone-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.zone-name { flex: 1; }
.zone-range { color: var(--text-dim); font-family: monospace; font-size: 0.8rem; }

/* === Download === */
.download-section {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.download-hint {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

/* === Builder === */
.builder-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .builder-layout { grid-template-columns: 1fr; }
}

.form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-section h3 { margin-bottom: 1rem; }

.form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.form-row label { min-width: 140px; font-size: 0.9rem; color: var(--text-dim); }

.input-hint { font-size: 0.8rem; color: var(--text-dim); }

.step-editor {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    overflow: hidden;
}

.step-editor-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.step-editor-header .step-num {
    font-weight: 600;
    color: var(--accent);
    margin: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
}

.step-editor-body {
    padding: 1rem;
}

.interval-group {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.interval-group h4 { margin-bottom: 0.5rem; font-size: 0.95rem; }

.form-actions {
    display: flex;
    gap: 1rem;
}

.preview-placeholder {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preview-placeholder-text { color: var(--text-dim); }

#download-area {
    margin-top: 1rem;
}

/* === Education === */
.zones-education {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 3rem;
}

.zone-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.zone-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.zone-badge {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.zone-header h3 { margin-bottom: 0.2rem; }
.zone-watts { color: var(--text-dim); font-family: monospace; font-size: 0.9rem; }

.zone-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 600px) {
    .zone-body { grid-template-columns: 1fr; }
}

.zone-section h4 { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 0.4rem; }
.zone-section p { font-size: 0.95rem; }

.education-section {
    margin-bottom: 3rem;
}

.education-section h2 { margin-bottom: 1.5rem; }

.edu-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    color: var(--text-dim);
    line-height: 1.8;
}

.edu-content h3 { color: var(--text); margin: 1.5rem 0 0.75rem; }
.edu-content p { margin-bottom: 1rem; }
.edu-content ol, .edu-content ul { padding-left: 1.5rem; margin-bottom: 1rem; }
.edu-content li { margin-bottom: 0.5rem; }

.edu-tip {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 1rem;
}

.edu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.edu-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.edu-card h4 { margin-bottom: 0.5rem; }
.edu-card p { color: var(--text-dim); font-size: 0.9rem; }

/* === Footer === */
.footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.85rem;
}

.footer-sub { margin-top: 0.25rem; opacity: 0.6; }

/* === Nav Auth === */
.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    transition: background 0.2s;
}
.nav-user:hover { background: var(--accent-light); }

.nav-user-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

/* === Flash Messages === */
.flash-messages { margin-bottom: 1.5rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.flash-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.flash-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.flash-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #3b82f6;
}

/* === Auth Pages === */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 460px;
}

.auth-card h1 {
    text-align: center;
    margin-bottom: 0.25rem;
}

.auth-sub {
    text-align: center;
    color: var(--text-dim);
    margin-bottom: 2rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label { font-size: 0.9rem; font-weight: 600; }

.form-row-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-dim);
    cursor: pointer;
}

.input-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* === Dashboard === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 0.3rem;
}

.stat-label {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.history-section h2 { margin-bottom: 1rem; }

.history-list { display: flex; flex-direction: column; gap: 0.75rem; }

.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: border-color 0.2s;
}

.history-card:hover { border-color: var(--accent); }
.history-card.completed { border-left: 3px solid var(--success); }

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.history-header h3 { font-size: 1rem; margin-bottom: 0.2rem; }
.history-meta { color: var(--text-dim); font-size: 0.85rem; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.badge-pending {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { background: #16a34a; }

.empty-state {
    text-align: center;
    padding: 3rem;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty-state p {
    color: var(--text-dim);
    margin-bottom: 1rem;
}

/* === Settings === */
.settings-form-wrap {
    max-width: 500px;
}

.settings-form .form-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-form h3 { margin-bottom: 1rem; }

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-dim); }

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* === Verify Banner === */
.verify-banner {
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: var(--radius);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.verify-banner-text {
    color: #eab308;
    font-size: 0.9rem;
}

.verify-banner-text a {
    color: #eab308;
    text-decoration: underline;
}

/* === Field Errors === */
.field-error {
    display: block;
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

/* =============================================
   RESPONSIVE — Mobile First Adjustments
   ============================================= */

/* Tablet: ≤ 768px */
@media (max-width: 768px) {
    .container { padding: 1rem; }

    /* Navbar: wrap into two rows */
    .navbar {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.5rem;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
    }

    .nav-links a {
        padding: 0.4rem 0.7rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .nav-auth { gap: 0.3rem; }
    .nav-auth .btn { padding: 0.3rem 0.7rem; font-size: 0.85rem; }

    /* Hero */
    .hero { padding: 2.5rem 0.5rem; }
    .hero h1 { font-size: 1.7rem; }
    .hero-sub { font-size: 1rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .hero-actions .btn { width: 100%; max-width: 300px; justify-content: center; }

    /* Feature & Steps grids → 2 cols */
    .feature-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
    .feature-card { padding: 1.25rem; }
    .feature-icon { font-size: 2rem; }
    .steps-grid { grid-template-columns: 1fr 1fr; }

    /* Templates grid → 1 col */
    .templates-grid { grid-template-columns: 1fr; }

    /* Template cards: compact */
    .template-card { padding: 1.25rem; }
    .template-tips { display: none; }

    /* FTP bar: stack */
    .ftp-input-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 1rem;
    }
    .ftp-input-bar .input { max-width: 100%; }
    .ftp-hint { text-align: center; }

    /* Category filters: horizontal scroll */
    .category-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
    }
    .filter-btn { white-space: nowrap; flex-shrink: 0; }

    /* Stats grid: 2x2 */
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .stat-value { font-size: 1.5rem; }

    /* History card */
    .history-header { flex-direction: column; gap: 0.5rem; }
    .history-actions { flex-wrap: wrap; }

    /* Auth card */
    .auth-card { padding: 1.5rem; }
    .form-row-pair { grid-template-columns: 1fr; gap: 0.75rem; }

    /* Settings */
    .settings-form-wrap { max-width: 100%; }

    /* Detail grid: already 1 col via existing media query, reinforce */
    .detail-grid { grid-template-columns: 1fr; gap: 1rem; }

    /* Chart */
    .chart-container { padding: 1rem; }
    .chart-container canvas { height: 200px !important; }

    /* Steps timeline: scrollable on mobile */
    .steps-timeline {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-height: 60px;
        padding-bottom: 0.5rem;
    }
    .step-block { min-width: 40px; }
    .step-label { font-size: 0.6rem; }

    /* Builder */
    .builder-layout { grid-template-columns: 1fr; }
    .step-editor-header { flex-wrap: wrap; }

    /* Education */
    .zone-body { grid-template-columns: 1fr; gap: 0.75rem; }
    .zone-header { flex-wrap: wrap; }
    .edu-grid { grid-template-columns: 1fr; }

    /* Verify banner */
    .verify-banner { padding: 0.6rem 1rem; }
    .verify-banner-text { font-size: 0.8rem; }

    /* Footer */
    .footer { padding: 1.5rem 1rem; }

    /* Dashboard actions: stack */
    .dashboard-actions { flex-direction: column; }
    .dashboard-actions .btn { width: 100%; justify-content: center; }
}

/* Small phones: ≤ 480px */
@media (max-width: 480px) {
    .container { padding: 0.75rem; }

    .navbar { padding: 0.5rem 0.75rem; }
    .nav-brand a { font-size: 1rem; }
    .nav-icon { font-size: 1.2rem; }

    .hero { padding: 1.5rem 0; }
    .hero h1 { font-size: 1.4rem; }
    .hero-sub { font-size: 0.9rem; }

    /* Features: single column */
    .feature-grid { grid-template-columns: 1fr; }
    .feature-card { padding: 1rem; }

    /* Steps: single column */
    .steps-grid { grid-template-columns: 1fr; }

    /* Stats: 2 cols but tighter */
    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.3rem; }

    /* Buttons: full width on small screens */
    .btn-lg { padding: 0.7rem 1.25rem; font-size: 0.95rem; }

    /* Auth */
    .auth-card { padding: 1.25rem; }
    .auth-card h1 { font-size: 1.3rem; }

    /* Download section: stack */
    .download-section .btn { margin-bottom: 0.5rem; }
}

/* Touch-friendly: larger tap targets */
@media (hover: none) and (pointer: coarse) {
    .btn { min-height: 44px; }
    .nav-links a { min-height: 40px; display: flex; align-items: center; }
    .filter-btn { min-height: 40px; padding: 0.5rem 1rem; }
    .input { min-height: 44px; font-size: 16px; }
}

/* =============================================
   ADMIN PANEL
   ============================================= */

.admin-navbar {
    background: #0c1222;
    border-bottom: 2px solid #7c3aed;
}

.admin-icon {
    background: #7c3aed !important;
}

/* Admin Stats */
.admin-stats {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.stat-admin {
    border-left: 3px solid #7c3aed;
}

.stat-sub {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

/* Admin Grid */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.admin-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.admin-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.admin-section-header h2 {
    margin-bottom: 0;
}

/* Admin Lists */
.admin-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.admin-list-item:hover {
    background: var(--bg);
}

.admin-list-link {
    color: var(--text);
    text-decoration: none;
}

.admin-list-link:hover {
    color: var(--accent);
}

.admin-list-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-list-value,
.admin-list-meta {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.empty-text {
    color: var(--text-dim);
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
}

/* Badges */
.badge-admin {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}

.badge-user {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
}

.badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

/* Action Badges */
.admin-action-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.action-grant_admin,
.action-revoke_admin {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}

.action-verify_user,
.action-unverify_user {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.action-reset_password {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.action-delete_user,
.action-delete_workout {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.action-set_ftp {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

/* Admin Toolbar */
.admin-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-search {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.admin-search .input {
    max-width: 300px;
}

.admin-toolbar-info {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Admin Table */
.admin-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: var(--bg);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

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

.admin-table .row-admin td {
    background: rgba(124, 58, 237, 0.05);
}

.td-id {
    font-family: monospace;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.td-email {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.td-date {
    white-space: nowrap;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.td-mono {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.td-details {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-dim);
    font-size: 0.8rem;
}

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

.table-link:hover {
    color: var(--accent);
}

/* Admin Detail */
.admin-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .admin-detail-grid { grid-template-columns: 1fr; }
}

.detail-info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

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

.detail-label { color: var(--text-dim); }

.admin-stats.compact {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-mini {
    text-align: center;
}

.stat-mini-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-mini-label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admin-action-form {
    display: inline;
}

.admin-ftp-form .form-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Admin Pagination */
.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.admin-pagination-info {
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* Admin Responsive */
@media (max-width: 768px) {
    .admin-grid { grid-template-columns: 1fr; }
    .admin-detail-grid { grid-template-columns: 1fr; }

    .admin-table th:nth-child(n+6),
    .admin-table td:nth-child(n+6) {
        display: none;
    }

    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-search .input {
        max-width: 100%;
    }
}
