:root {
    --teal-50: #E1F5EE; --teal-200: #5DCAA5; --teal-400: #1D9E75; --teal-600: #0F6E56; --teal-800: #085041;
    --gray-50: #F1EFE8; --gray-100: #D3D1C7; --gray-200: #B4B2A9; --gray-400: #888780; --gray-600: #5F5E5A; --gray-800: #444441; --gray-900: #2C2C2A;
    --purple-50: #EEEDFE; --purple-400: #7F77DD; --purple-600: #534AB7; --purple-800: #3C3489;
    --coral-50: #FAECE7; --coral-400: #D85A30; --coral-800: #712B13;
    --blue-50: #E6F1FB; --blue-400: #378ADD; --blue-800: #0C447C;
    --amber-50: #FAEEDA; --amber-200: #EF9F27; --amber-400: #BA7517; --amber-600: #854F0B; --amber-800: #633806;
    --red-50: #FCEBEB; --red-400: #E24B4A; --red-800: #791F1F;
    --pink-50: #FBEAF0; --pink-400: #D4537E; --pink-800: #72243E;
    --green-50: #EAF3DE; --green-400: #639922; --green-800: #27500A;
    --bg: #FAFAF8;
    --radius: 10px;
    --radius-lg: 14px;
}

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

body {
    font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--gray-900);
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ─── Typography ─── */
h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
.label { font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.08em; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--gray-400); }
.text-teal { color: var(--teal-800); }

/* ─── Layout ─── */
.px { padding-left: 20px; padding-right: 20px; }
.py { padding-top: 12px; padding-bottom: 12px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 14px; }
.mt-lg { margin-top: 20px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 14px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: 4px; }
.gap-sm { gap: 8px; }
.gap-md { gap: 10px; }

/* ─── Components ─── */
.card {
    padding: 14px;
    border-radius: var(--radius-lg);
    background: #fff;
    border: 1px solid var(--gray-100);
}

.banner {
    padding: 10px 12px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
}
.banner-teal { background: var(--teal-50); color: var(--teal-800); }
.banner-amber { background: var(--amber-50); color: var(--amber-800); }
.banner-blue { background: var(--blue-50); color: var(--blue-800); }

.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
}
.badge-teal { background: var(--teal-50); color: var(--teal-800); }
.badge-amber { background: var(--amber-50); color: var(--amber-800); }
.badge-gray { background: var(--gray-50); color: var(--gray-800); }
.badge-purple { background: var(--purple-50); color: var(--purple-800); }
.badge-coral { background: var(--coral-50); color: var(--coral-800); }
.badge-blue { background: var(--blue-50); color: var(--blue-800); }
.badge-red { background: var(--red-50); color: var(--red-800); }
.badge-pink { background: var(--pink-50); color: var(--pink-800); }

.pill {
    font-size: 11px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--gray-200);
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    white-space: nowrap;
}
.pill-active {
    background: var(--amber-400);
    color: #fff;
    border-color: var(--amber-400);
}

.dot {
    width: 6px; height: 6px;
    border-radius: 3px;
    flex-shrink: 0;
}
.dot-teal { background: var(--teal-400); }
.dot-amber { background: var(--amber-400); }

.progress-bar {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: var(--gray-100);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 2px;
}
.progress-fill-teal { background: var(--teal-400); }
.progress-fill-amber { background: var(--amber-400); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
}
.btn:active { opacity: 0.85; }
.btn-primary { background: var(--amber-400); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--amber-400); color: var(--amber-800); }
.btn-ghost { background: transparent; border: 1px solid var(--gray-200); color: var(--gray-600); }
.btn-block { width: 100%; }

/* ─── Input ─── */
.input {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius);
    border: 1.5px solid var(--gray-100);
    font-size: 14px;
    font-family: inherit;
    color: var(--gray-900);
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.input:focus { border-color: var(--amber-400); }
.input::placeholder { color: var(--gray-200); }

select.input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888780' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
select.input option[disabled] { color: var(--gray-200); }

.input-label {
    font-size: 12px;
    color: var(--gray-400);
    margin-bottom: 4px;
    display: block;
}

/* ─── Tab bar ─── */
.tab-bar {
    display: flex;
    gap: 2px;
    background: var(--gray-50);
    border-radius: 12px;
    padding: 3px;
    margin: 14px 16px 0;
}
.tab-item {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--gray-400);
    cursor: pointer;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition: all 0.15s;
}
.tab-item.active {
    background: #fff;
    color: var(--gray-900);
}
.tab-item.active i { color: var(--amber-400); }
.tab-item i { font-size: 15px; color: var(--gray-400); }

/* ─── Day selector ─── */
.day-selector {
    display: flex;
    gap: 4px;
}
.day-btn {
    flex: 1;
    text-align: center;
    padding: 7px 0;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid var(--gray-100);
    background: transparent;
    position: relative;
    text-decoration: none;
    display: block;
}
.day-btn.active {
    background: var(--amber-400);
    border-color: var(--amber-400);
}
.day-btn .day-name { font-size: 10px; color: var(--gray-400); }
.day-btn .day-num { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.day-btn.active .day-name { color: rgba(255,255,255,0.7); }
.day-btn.active .day-num { color: #fff; }
.day-btn .day-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 7px; height: 7px;
    border-radius: 4px;
    background: var(--amber-400);
}
.day-btn.active .day-dot { background: #fff; }

/* ─── Schedule block ─── */
.sched-row {
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
}
.sched-time {
    width: 40px;
    flex-shrink: 0;
    padding-top: 3px;
}
.sched-time-start { font-size: 12px; font-weight: 600; color: var(--gray-800); }
.sched-time-end { font-size: 11px; color: var(--gray-200); }
.sched-block {
    flex: 1;
    padding: 9px 12px;
    border-radius: var(--radius);
    border-left: 3px solid;
    text-decoration: none;
    display: block;
}
.sched-block .subj { font-size: 14px; font-weight: 600; }
.sched-block .meta { font-size: 11px; margin-top: 1px; }
.sched-block .mat-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
}
.sched-block.has-mat { border-color: var(--amber-400); }

/* ─── Eval item ─── */
.eval-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 0.5px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
}
.eval-item:last-child { border-bottom: none; }
.eval-date-box {
    width: 38px; height: 38px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.eval-date-box .day { font-size: 13px; font-weight: 600; line-height: 1; }
.eval-date-box .month { font-size: 9px; }
.eval-body { flex: 1; min-width: 0; }
.eval-body .name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eval-body .type { font-size: 12px; color: var(--gray-400); }
.eval-countdown { font-size: 11px; flex-shrink: 0; }
.eval-countdown.urgent { color: var(--coral-400); }

/* ─── Event item ─── */
.event-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
}
.event-item:last-child { border-bottom: none; }
.event-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}
.event-body { flex: 1; min-width: 0; }
.event-body .title { font-size: 14px; font-weight: 500; }
.event-body .desc { font-size: 12px; color: var(--gray-400); margin-top: 1px; }
.event-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
}

/* ─── Book item ─── */
.book-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--gray-100);
    text-decoration: none;
    color: inherit;
}
.book-item:last-child { border-bottom: none; }
.book-cover {
    width: 40px; height: 56px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}
.book-body { flex: 1; min-width: 0; }
.book-body .title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-body .author { font-size: 12px; color: var(--gray-400); margin: 1px 0 4px; }

/* ─── Top bar ─── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px 8px;
}
.top-bar a, .top-bar button {
    color: var(--gray-400);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px 14px;
    color: var(--gray-600);
    text-decoration: none;
    font-size: 13px;
}
.back-link i { font-size: 14px; }

/* ─── Upload area ─── */
.upload-area {
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1.5px dashed var(--amber-200);
    background: var(--amber-50);
    text-align: center;
    cursor: pointer;
}
.upload-area i { font-size: 24px; color: var(--amber-400); }

/* ─── Share button (native) ─── */
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: transparent;
    color: var(--gray-600);
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}

/* ─── Stat box ─── */
.stat-box {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    background: var(--gray-50);
    text-align: center;
}
.stat-box .stat-label { font-size: 11px; color: var(--gray-400); }
.stat-box .stat-value { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.stat-box-teal { background: var(--teal-50); }
.stat-box-teal .stat-label { color: var(--teal-600); }
.stat-box-teal .stat-value { color: var(--teal-800); }

/* ─── Student row ─── */
.student-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 0.5px solid var(--gray-50);
}
.student-avatar {
    width: 32px; height: 32px;
    border-radius: 16px;
    background: var(--amber-50);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--amber-800);
    flex-shrink: 0;
}

/* ─── Divider ─── */
.divider {
    height: 0.5px;
    background: var(--gray-100);
    margin: 10px 0;
}

/* ─── List row ─── */
.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius);
    background: var(--gray-50);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.list-row .fa-chevron-right { font-size: 12px; color: var(--gray-200); }

/* ─── Logo ─── */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--amber-400);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}
.logo-text {
    font-size: 22px;
    font-weight: 600;
    color: var(--gray-900);
    letter-spacing: -0.03em;
}

/* ─── Responsive (desktop) ─── */
@media (min-width: 481px) {
    .app {
        margin-top: 20px;
        border: 1px solid var(--gray-100);
        border-radius: 20px;
        min-height: auto;
        padding-bottom: 20px;
    }
}
