:root {
    --bg-dark: #050810;
    --bg-panel: rgba(15, 23, 42, 0.7);
    --bg-panel-hover: rgba(30, 41, 59, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-gold: rgba(212, 175, 55, 0.3);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-gold: #d4af37;
    --accent-gold-hover: #b8972e;
    
    --status-running: #3b82f6;
    --status-queued: #f59e0b;
    --status-completed: #10b981;
    --status-failed: #ef4444;
    --status-waiting: #8b5cf6;
    
    --glass-blur: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(212, 175, 55, 0.05) 0%, transparent 40%);
}

/* Glassmorphism panel base */
.glass-panel {
    background: var(--bg-panel);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(10, 15, 29, 0.95);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 20px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-gold);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.logo-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-gold), #8c7322);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    flex-shrink: 0;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.05);
}

.nav-menu {
    list-style: none;
    padding: 20px 12px;
    flex: 1;
}

.nav-menu li {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-menu li i {
    width: 20px;
    font-size: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.nav-menu li:hover {
    background: var(--bg-panel-hover);
    color: var(--text-main);
}

.nav-menu li.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2) 0%, transparent 100%);
    color: var(--accent-blue);
    border-left: 3px solid var(--accent-blue);
}

.system-status {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    white-space: nowrap;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-completed);
    box-shadow: 0 0 8px var(--status-completed);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

/* Sidebar Collapsed State */
.sidebar.collapsed {
    width: 76px;
}

.sidebar.collapsed .logo {
    justify-content: center;
    padding: 24px 10px;
}

.sidebar.collapsed .logo-brand span,
.sidebar.collapsed .nav-menu li span,
.sidebar.collapsed .system-status span {
    display: none;
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar.collapsed .nav-menu li {
    justify-content: center;
    padding: 12px;
}

.sidebar.collapsed .system-status {
    justify-content: center;
    padding: 20px 10px;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Main Content */
.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.tab-pane {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
}

.tab-pane.active {
    opacity: 1;
    visibility: visible;
}

.top-bar {
    height: 72px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 15, 29, 0.5);
    backdrop-filter: blur(10px);
}

.top-bar h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.google-auth-status {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.google-auth-status .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.google-auth-status.connected .status-dot {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.google-auth-status.expired .status-dot {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--accent-gold);
    color: #000;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.btn-primary:hover {
    background: var(--accent-gold-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-gold {
    background: var(--accent-gold);
    color: #000;
    font-weight: 600;
}

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

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    flex: 1;
    padding: 24px;
    gap: 24px;
    overflow: hidden;
}

.course-list-panel {
    width: 340px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
    font-size: 1rem;
    color: var(--text-muted);
}

.course-groups {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.course-groups::-webkit-scrollbar {
    width: 6px;
}
.course-groups::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.course-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 16px 0 8px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Course Items */
.course-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.course-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-color);
}

.course-item.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
}

.course-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.course-item-title {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    text-transform: uppercase;
}

.course-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), #60a5fa);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.course-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-text {
    font-weight: 500;
}
.status-running { color: var(--status-running); }
.status-queued { color: var(--status-queued); }
.status-completed { color: var(--status-completed); }
.status-failed { color: var(--status-failed); }
.status-waiting { color: var(--status-waiting); }
.status-waiting-auth { color: var(--status-queued); }
.status-paused { color: var(--status-queued); }

/* Workspace Detail */
.workspace-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 16px;
}
.empty-state i {
    font-size: 3rem;
    opacity: 0.5;
}
.hidden {
    display: none !important;
}

.workspace-content {
    display: grid;
    grid-template-rows: auto auto minmax(260px, 2fr) minmax(180px, 1fr);
    height: 100%;
    min-height: 0;
}

.ws-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}
.ws-header h2 {
    font-size: 1.25rem;
    margin-right: auto;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(59, 130, 246, 0.2);
    color: var(--status-running);
}

/* Timeline */
.pipeline-timeline {
    display: flex;
    padding: 24px;
    gap: 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-color);
}

.timeline-step {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    position: relative;
}

.timeline-step::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    z-index: 1;
}
.timeline-step:last-child::after {
    display: none;
}

.step-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-panel);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    z-index: 2;
    transition: all 0.3s;
}

.timeline-step.active {
    opacity: 1;
}
.timeline-step.active .step-icon {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}
.timeline-step.completed {
    opacity: 1;
}
.timeline-step.completed .step-icon {
    border-color: var(--status-completed);
    background: var(--status-completed);
    color: #fff;
}
.timeline-step.completed::after {
    background: var(--status-completed);
}

.step-label {
    font-size: 0.75rem;
    text-align: center;
    font-weight: 500;
}

/* Checkpoint */
.syllabus-checkpoint {
    margin: 20px 24px;
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    background: rgba(212, 175, 55, 0.05);
    display: flex;
    flex-direction: column;
    max-height: calc(100% - 40px);
    min-height: 0;
    overflow: hidden;
}
.checkpoint-header {
    background: rgba(212, 175, 55, 0.1);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.checkpoint-header h3 {
    font-size: 0.9rem;
    color: var(--accent-gold);
}
.countdown {
    font-family: monospace;
    font-size: 1.1rem;
    color: var(--status-failed);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkpoint-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}
.checkpoint-body textarea {
    width: 100%;
    height: 150px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    padding: 12px;
    font-family: monospace;
    font-size: 0.85rem;
    resize: vertical;
    margin-bottom: 12px;
}
.checkpoint-actions {
    display: flex;
    justify-content: flex-end;
}

/* Auth Warning Panel */
.auth-warning-panel {
    margin: 20px 24px;
    border: 1px solid var(--accent-gold);
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.12);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.auth-warning-content {
    display: flex;
    align-items: center;
    gap: 14px;
}
.auth-warning-content i {
    font-size: 1.6rem;
    color: var(--accent-gold);
}
.auth-warning-text strong {
    color: var(--accent-gold);
    font-size: 0.95rem;
    display: block;
    margin-bottom: 4px;
}
.auth-warning-text p {
    color: var(--text-main);
    font-size: 0.85rem;
    margin: 0;
}

/* Studio operations workspace */
.studio-workspace {
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}
.studio-workspace-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.studio-header-actions { display: flex; gap: 8px; }
.mobile-logs-button { display: none; }
.studio-workspace-header h3, .console-panel h3 {
    font-size: 0.9rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.studio-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 12px 0;
}
.studio-stat {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.78rem;
}
.studio-stat strong { color: var(--text-main); font-size: 1rem; }
.studio-groups {
    min-height: 0;
    padding-right: 4px;
}
.studio-lesson-group {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}
.studio-lesson-group summary {
    cursor: pointer;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.85rem;
}
.studio-lesson-group summary span { color: var(--text-muted); font-weight: 400; }
.studio-asset-row {
    display: grid;
    grid-template-columns: minmax(88px, 1fr) minmax(115px, 1.4fr) minmax(90px, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
}
.studio-status-badge { display:inline-flex; width:max-content; padding:3px 8px; border-radius:999px; font-size:.72rem; font-weight:600; }
.studio-status-badge.state-downloaded { background:rgba(16,185,129,.16); color:#34d399; }
.studio-status-badge.state-creating, .studio-status-badge.state-reconciling, .studio-status-badge.state-tracking, .studio-status-badge.state-downloading { background:rgba(59,130,246,.16); color:#60a5fa; }
.studio-status-badge.state-queued { background:rgba(148,163,184,.16); color:#cbd5e1; }
.studio-status-badge.state-failed, .studio-status-badge.state-creation_unknown { background:rgba(239,68,68,.16); color:#f87171; }
.studio-row-actions { display: inline-flex; gap: 4px; }
.studio-audit-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.studio-audit-row { display:flex; flex-direction:column; gap:5px; padding:10px 0; border-top:1px solid var(--border-color); font-size:.8rem; }
.studio-audit-row small { color: var(--text-muted); overflow-wrap:anywhere; }
.studio-audit {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(520px, 92%);
    z-index: 20;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-panel);
    border-left: 1px solid var(--border-color);
    box-shadow: -16px 0 32px rgba(0, 0, 0, 0.28);
}
.console-panel {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
}
.workspace-logs-panel { border-top: 1px solid var(--border-color); }

/* Collapsible Assets Groups */
.assets-groups {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    overflow-y: auto;
    max-height: 500px;
}
.assets-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}
.assets-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    user-select: none;
    transition: background 0.2s ease;
}
.assets-group-header:hover {
    background: rgba(255, 255, 255, 0.08);
}
.assets-group-header .header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.assets-group-header .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.assets-group-header .toggle-icon {
    font-size: 10px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.assets-group.collapsed .toggle-icon {
    transform: rotate(-90deg);
}
.assets-group-content {
    max-height: 280px;
    overflow-y: auto;
    transition: max-height 0.25s ease-out;
}
.assets-group-content::-webkit-scrollbar {
    width: 6px;
}
.assets-group-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
.assets-group-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
.assets-group.collapsed .assets-group-content {
    max-height: 0;
    overflow: hidden;
}

.assets-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}
.assets-table th {
    text-align: left;
    padding: 8px;
    color: var(--text-muted);
    font-size: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
.assets-table th:first-child, .assets-table td:first-child {
    width: 70%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.assets-table th:last-child, .assets-table td:last-child {
    width: 30%;
    text-align: right;
    white-space: nowrap;
}
.assets-table td {
    padding: 12px 8px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.assets-table tr:hover td {
    background: rgba(255,255,255,0.02);
}
.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    margin-right: 8px;
    transition: color 0.2s;
}
.btn-icon:hover {
    color: var(--accent-blue);
}

.console-output {
    flex: 1;
    background: #000;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    padding: 12px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #a3be8c;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
    line-height: 1.5;
}
.console-output::-webkit-scrollbar { width: 6px; }
.console-output::-webkit-scrollbar-thumb { background: #333; }

.logs-header:hover {
    color: var(--accent-blue) !important;
}
.workspace-logs-panel.collapsed .console-output {
    display: none;
}
.workspace-logs-panel.collapsed {
    padding: 12px 24px;
    height: auto;
    min-height: 0;
}
.workspace-content.logs-collapsed {
    grid-template-rows: auto auto 1fr auto;
}

@media (max-width: 900px) {
    .dashboard-layout { padding: 12px; gap: 12px; }
    .course-list-panel { width: 72px; }
    .course-list-panel .panel-header, .course-list-panel .course-item-title,
    .course-list-panel .course-item-meta, .course-list-panel .badge,
    .course-list-panel .course-progress { display: none; }
    .course-groups { padding: 8px; }
    .course-item { padding: 10px 6px; min-height: 42px; }
    .workspace-content { grid-template-rows: auto auto minmax(260px, 1fr); }
    .mobile-logs-button { display: inline-flex; }
    .workspace-logs-panel { display: none; }
    .workspace-content.mobile-logs-open .studio-workspace { display: none; }
    .workspace-content.mobile-logs-open .workspace-logs-panel { display: flex; }
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.modal.active {
    opacity: 1;
    visibility: visible;
}
.modal-content {
    width: 600px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    padding: 0;
    transform: translateY(20px);
    transition: all 0.3s;
}
.modal.active .modal-content {
    transform: translateY(0);
}
.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
input[type="text"], input[type="password"], input[type="number"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
}
.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}
.checkbox label {
    margin-bottom: 0;
}
.form-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}
.form-divider::before {
    content: '';
    position: absolute;
    left: 0; top: 50%; width: 100%; height: 1px;
    background: var(--border-color);
    z-index: 0;
}
.form-divider span {
    background: var(--bg-dark);
    padding: 0 10px;
    position: relative;
    z-index: 1;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255,255,255,0.02);
}
.upload-zone:hover {
    border-color: var(--accent-blue);
    background: rgba(59,130,246,0.05);
}
.upload-zone i {
    font-size: 2rem;
    color: var(--accent-blue);
    margin-bottom: 12px;
}
.upload-zone span {
    color: var(--accent-blue);
}
.filename-display {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--accent-gold);
}

/* Prompt Studio & Settings */
.prompts-layout, .settings-layout {
    padding: 24px;
    display: flex;
    gap: 24px;
    height: calc(100vh - 72px);
}
.prompts-sidebar {
    width: 250px;
    padding: 16px 0;
    overflow-y: auto;
}
.nav-list {
    list-style: none;
}
.nav-list li {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}
.nav-list li:hover { background: rgba(255,255,255,0.05); }
.nav-list li.active {
    border-left-color: var(--accent-gold);
    background: rgba(212,175,55,0.1);
    color: var(--accent-gold);
}
.prompt-editor-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.prompt-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.prompt-vars {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.var-badge {
    font-size: 0.75rem;
    background: rgba(255,255,255,0.1);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.code-editor {
    flex: 1;
    background: rgba(0,0,0,0.2);
    border: none;
    padding: 20px;
    color: var(--text-main);
    font-family: monospace;
    font-size: 0.9rem;
    resize: none;
    line-height: 1.5;
}
.code-editor:focus { outline: none; }

/* Prompt fields container for multi-textarea groups */
.prompt-fields-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}
.prompt-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.prompt-field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}
.prompt-field .code-editor {
    flex: none;
    width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
    min-height: 80px;
    resize: vertical;
}

.settings-layout {
    flex-direction: column;
    overflow-y: auto;
}
.settings-card {
    padding: 24px;
    margin-bottom: 24px;
}
.settings-card h3 {
    margin-bottom: 20px;
    color: var(--accent-gold);
}
.input-with-btn {
    display: flex;
    gap: 12px;
}

/* Completed Panel */
.completed-panel {
    margin: 20px 24px 0 24px;
    border: 1px solid var(--status-completed);
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.12);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.completed-content {
    display: flex;
    align-items: center;
    gap: 14px;
}
.completed-content i {
    font-size: 1.6rem;
    color: var(--status-completed);
}
.completed-text strong {
    color: var(--status-completed);
    font-size: 0.95rem;
    display: block;
    margin-bottom: 4px;
}
.completed-text p {
    color: var(--text-main);
    font-size: 0.85rem;
    margin: 0;
}
.btn-success {
    background: var(--status-completed);
    color: #fff !important;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
}
.btn-success:hover {
    background: #107e54;
}

/* Guide Page */
.guide-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 32px;
    overflow-y: auto;
    flex: 1;
}
.guide-card {
    padding: 24px;
}
.guide-card h3 {
    margin-bottom: 20px;
    color: var(--accent-gold);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.guide-intro {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 24px;
}
.pipeline-flow-vertical {
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
    padding-left: 20px;
}
/* Draw vertical line behind steps */
.pipeline-flow-vertical::before {
    content: '';
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 36px;
    width: 2px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1;
}
.flow-step {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    position: relative;
    z-index: 2;
}
.step-num-badge {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #171d30;
    border: 2px solid var(--accent-blue);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}
.step-desc {
    flex: 1;
}
.step-desc strong {
    font-size: 1rem;
    color: var(--text-main);
    display: block;
    margin-bottom: 4px;
}
.step-desc p {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}
.step-desc code {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: var(--accent-gold);
}
.guide-notes {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.guide-notes li {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-muted);
    position: relative;
    padding-left: 20px;
}
.guide-notes li::before {
    content: '•';
    color: var(--accent-gold);
    font-size: 1.5rem;
    position: absolute;
    left: 0;
    top: -2px;
}
.guide-notes li strong {
    color: var(--text-main);
}
.guide-notes ul {
    list-style-type: circle;
    padding-left: 20px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.guide-notes ul li {
    padding-left: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.guide-notes ul li::before {
    content: none;
}
.guide-notes ul li strong {
    color: var(--text-main);
}

/* Prompt Variables Legend */
.prompt-vars-legend {
    margin-top: 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}
.legend-item {
    font-size: 0.8rem;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.legend-item .var-name {
    color: var(--accent-gold);
    font-family: monospace;
    font-weight: 600;
    flex-shrink: 0;
    width: 200px;
    background: rgba(212, 175, 55, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.15);
}
.legend-item .var-desc {
    color: var(--text-muted);
    flex: 1;
}

/* Syllabus Visual Editor Cards */
.syllabus-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}
.syllabus-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    transition: all 0.25s ease;
}
.syllabus-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
}
.syllabus-card.active {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.03);
}
.syllabus-card-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}
.syllabus-card-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.syllabus-card-id {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    flex-shrink: 0;
}
.syllabus-card-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}
.syllabus-card-section-badge {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.syllabus-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.syllabus-card-actions button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 3px 6px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
.syllabus-card-actions button:hover {
    border-color: rgba(255,255,255,0.3);
    color: var(--text-main);
}
.syllabus-card-actions button.btn-delete-lesson {
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}
.syllabus-card-actions button.btn-delete-lesson:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}
.syllabus-card-body {
    display: none;
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.15);
    flex-direction: column;
    gap: 12px;
}
.syllabus-card.active .syllabus-card-body {
    display: flex;
}
.syllabus-card-body-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}
.syllabus-card-body-row-equal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.ws-export-slides {
    color: var(--accent-gold) !important;
}
.ws-export-slides:hover {
    background: rgba(212, 175, 55, 0.1) !important;
}
.syllabus-textarea-field {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    resize: vertical;
}
.syllabus-input-field {
    width: 100%;
    padding: 6px 8px;
    background: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.85rem;
}

.btn-delete-course {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.btn-delete-course:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Account Management */
#accounts-section {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

#add-account-modal.modal.active {
    display: flex;
}

.account-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.account-badge-success { background: #28a74520; color: #28a745; }
.account-badge-warning { background: #ffc10720; color: #856404; }
.account-badge-danger { background: #dc354520; color: #dc3545; }
.account-badge-info { background: #17a2b820; color: #17a2b8; }
.account-badge-secondary { background: #6c757d20; color: #6c757d; }

#accounts-list .assets-table th,
#accounts-list .assets-table td {
    width: auto;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}
#accounts-list .assets-table th:first-child,
#accounts-list .assets-table td:first-child {
    width: auto;
}
#accounts-list .assets-table th:last-child,
#accounts-list .assets-table td:last-child {
    width: auto;
    text-align: left;
}
