:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #242833;
    --border: #2e3240;
    --text: #e4e6ed;
    --text2: #9196a8;
    --accent: #6c5ce7;
    --accent-hover: #7c6ef7;
    --green: #00b894;
    --orange: #fdcb6e;
    --red: #e17055;
    --radius: 10px;
}

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

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

/* Layout */
.app { max-width: 800px; margin: 0 auto; padding: 16px; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

header h1 { font-size: 20px; font-weight: 700; }
header h1 span { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 12px; }
.user-tag { color: var(--text2); font-size: 14px; }

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { opacity: 0.85; }
.btn-small { padding: 6px 14px; font-size: 12px; }
.btn-google {
    background: #fff;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    padding: 12px 24px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    cursor: pointer;
    margin: 0 auto;
}
.btn-google:hover { background: #f5f5f5; }
.btn-google svg { width: 20px; height: 20px; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); }
.card-header { display: flex; justify-content: space-between; align-items: center; }
.card-header.collapsible-header { margin-bottom: 0; }
.card-title { font-weight: 600; font-size: 16px; }
.card-meta { color: var(--text2); font-size: 13px; }

/* Sections */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.section-header h2 { font-size: 18px; }

/* Auth screen */
.auth-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    gap: 24px;
}
.auth-screen h1 { font-size: 32px; }
.auth-screen h1 span { color: var(--accent); }
.auth-screen p { color: var(--text2); max-width: 400px; line-height: 1.5; }

/* Modal / Dialog */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 420px;
}
.modal h3 { margin-bottom: 16px; }
.modal input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface2);
    color: var(--text);
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
}
.modal input:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Group detail */
.detail-back {
    color: var(--text2);
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 16px;
    display: inline-block;
}
.detail-back:hover { color: var(--text); }

.invite-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.invite-code { font-family: monospace; font-size: 18px; letter-spacing: 2px; font-weight: 700; }

/* Member list */
.member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.member-row:last-child { border-bottom: none; }
.member-name { font-weight: 500; }
.member-name .leader-badge {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}
.member-sync { color: var(--text2); font-size: 12px; }

/* Progress view */
.progress-section { margin-top: 24px; }
.progress-section h3 { margin-bottom: 12px; }

.assignment-row {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--surface2);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 14px;
    gap: 8px;
}
.assignment-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assignment-due { color: var(--text2); font-size: 12px; white-space: nowrap; flex-shrink: 0; }

.status { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px; white-space: nowrap; flex-shrink: 0; }
.status-submitted { background: rgba(0,184,148,0.15); color: var(--green); }
.status-graded { background: rgba(0,184,148,0.15); color: var(--green); }
.status-late { background: rgba(253,203,110,0.15); color: var(--orange); }
.status-missing { background: rgba(225,112,85,0.15); color: var(--red); }
.status-overdue { background: rgba(200,50,50,0.2); color: #e05555; }
.status-unsubmitted { background: rgba(145,150,168,0.1); color: var(--text2); }

/* Visibility */
.vis-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.vis-row:last-child { border-bottom: none; }

/* Toggle switch */
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider {
    position: absolute;
    inset: 0;
    background: var(--surface2);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: var(--text2);
    border-radius: 50%;
    transition: transform 0.2s, background 0.2s;
}
.toggle input:checked + .slider { background: var(--accent); }
.toggle input:checked + .slider::before { transform: translateX(20px); background: #fff; }

/* Pending prompt */
.pending-banner {
    background: var(--surface2);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pending-banner span { font-size: 14px; }

/* Progress header bar */
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}
.progress-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Leader toggle inline */
.leader-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text2);
    white-space: nowrap;
}

/* View toggle */
.view-toggle { display: flex; gap: 0; }
.view-toggle button {
    padding: 8px 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}
.view-toggle button:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.view-toggle button:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.view-toggle button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Empty state */
.empty {
    text-align: center;
    padding: 40px;
    color: var(--text2);
}

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text2); }

/* Hidden */
.hidden { display: none !important; }

/* Tab bar */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 20px;
    color: var(--text2);
    font-size: 14px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Collapsible sections */
.collapsible-header { cursor: pointer; user-select: none; }
.collapsible-header .chevron {
    display: inline-block;
    font-size: 10px;
    transition: transform 0.2s;
}
.collapsible-header.collapsed .chevron { transform: rotate(-90deg); }
.collapsible-content { overflow: hidden; padding-top: 10px; }
.collapsible-content.collapsed { display: none; }

/* Summary counts in collapsed headers */
.summary-counts { display: inline-flex; gap: 6px; margin: 0 8px; }
.summary-counts .status { font-size: 11px; padding: 1px 6px; }

/* Dashboard */
.dashboard { margin-bottom: 20px; }
.dashboard-section { background: var(--surface); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 8px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; }
.dashboard-title { font-weight: 600; font-size: 14px; }

/* Verification UI */
.verify-actions { display: inline-flex; gap: 4px; align-items: center; margin-left: 8px; }
.verify-select { padding: 2px 6px; font-size: 12px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); }
.verify-badge { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; margin-left: 8px; padding: 2px 8px; border-radius: 4px; }
.verify-pending { background: rgba(255, 170, 0, 0.15); color: #ffaa00; }
.verify-confirmed { background: rgba(0, 200, 100, 0.15); color: #00c864; }
.verify-input { width: 80px; padding: 2px 6px; font-size: 12px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); }

/* Visibility course list */
.vis-course-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.vis-course-card:hover { border-color: var(--accent); }
.vis-course-name { font-weight: 600; font-size: 14px; }
.vis-course-meta { color: var(--text2); font-size: 12px; margin-top: 2px; }

/* Visibility overlay */
.vis-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.vis-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 90%;
    max-width: 420px;
}
.vis-panel h3 { margin-bottom: 4px; }
.vis-panel .vis-course-code { color: var(--text2); font-size: 13px; margin-bottom: 16px; }
.vis-group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.vis-group-row:last-child { border-bottom: none; }
.vis-group-name { font-weight: 500; font-size: 14px; }

/* Course tree in progress */
.course-block { margin-bottom: 16px; }
.course-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
    padding-left: 4px;
}
