/* Study tab (student-study.js) + calendar exam/study chips. Matches the session calendar palette. */
.is-exam { background: #fef3c7; color: #92400e; }
.is-study { background: #e5f7fb; color: #066a75; }
.is-study.is-done { opacity: .55; text-decoration: line-through; }
.session-calendar-legend .calendar-exam-dot:before { background: #d97706; }
.session-calendar-legend .calendar-study-dot:before { background: #5fd4e8; }

#student-study { min-width: 0; }
.study-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.study-col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.study-card { background: #fff; border: 1px solid #dfe9ec; border-radius: 18px; padding: 20px; min-width: 0; }
.study-card h3 { font-size: 18px; margin: 0; color: #19343f; }
.study-card h4 { font-size: 15px; margin: 0; color: #19343f; }
.study-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.study-card-head > div { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.study-card-head small { color: #6b818a; font-size: 12px; }
.study-hint { font-size: 12px; color: #6b818a; margin: 4px 0 12px; line-height: 1.5; }
.study-empty { font-size: 13px; color: #6b818a; margin: 8px 0; }
.study-status { min-height: 1.2em; margin: 0 0 10px; font-size: 13px; color: #0a766e; }
.study-status.is-error { color: #a33b3b; }
.study-warning { background: #fff4dd; color: #8e631c; border-radius: 8px; padding: 9px 12px; font-size: 12px; margin: 8px 0; }

.study-btn-primary, .study-btn-small, .study-btn-link, .study-dialog-actions button {
  font: inherit; cursor: pointer; border-radius: 8px; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.study-btn-primary { background: #087e8b; border: 1px solid #087e8b; color: #fff; padding: 9px 14px; font-weight: 600; }
.study-btn-primary:hover { background: #066a75; }
.study-btn-small, .study-dialog-actions button { background: #f5f9fa; border: 1px solid #d5e2e6; color: #087580; padding: 7px 11px; }
.study-btn-small.is-danger { color: #a33b3b; border-color: #efd2d2; background: #fff; }
.study-btn-link { background: none; border: 0; color: #087580; padding: 4px 6px; text-decoration: underline; text-underline-offset: 2px; }
.study-btn-primary:disabled, .study-dialog-actions button:disabled { opacity: .6; cursor: wait; }

.study-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.study-stats > div { background: #f6f9fa; border-radius: 12px; padding: 12px 10px; text-align: center; }
.study-stats span { display: block; font-size: 18px; font-weight: 700; color: #19343f; }
.study-stats small { font-size: 11px; color: #6b818a; }
.study-timer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border: 1px dashed #cfe0e4; border-radius: 12px; padding: 14px; }
.study-timer > div { flex: 1 1 200px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.study-timer small { font-size: 11px; color: #6b818a; text-transform: uppercase; letter-spacing: .04em; }
.study-timer strong { font-size: 14px; color: #19343f; overflow-wrap: anywhere; }
.study-timer.is-running { border: 1px solid #087e8b; background: #f2faf9; }
.study-timer-clock { font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 700; color: #087e8b; }

.study-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.study-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #f6f9fa; border-left: 3px solid #5fd4e8; }
.study-item.kind-revise { border-left-color: #d97706; }
.study-item.kind-practice { border-left-color: #168b83; }
.study-item.is-done { opacity: .6; }
.study-item.is-done strong { text-decoration: line-through; }
.study-item.is-overdue { background: #fff8ea; }
.study-item-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.study-item-body strong { font-size: 13px; color: #19343f; overflow-wrap: anywhere; }
.study-item-body small { font-size: 11px; color: #6b818a; }
.study-check input { width: 18px; height: 18px; accent-color: #087e8b; cursor: pointer; }

.study-exam { border-top: 1px solid #e4ecef; padding: 14px 0; }
.study-exam:first-of-type { border-top: 0; padding-top: 4px; }
.study-exam-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.study-exam-head p { font-size: 12px; color: #5d747d; margin: 4px 0 0; }
.study-scope-line { overflow-wrap: anywhere; }
.study-progress { flex: 0 0 110px; text-align: right; }
.study-progress span { display: block; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #087e8b var(--pct), #e8eff1 var(--pct)); }
.study-progress small { font-size: 11px; color: #6b818a; }
.study-exam-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.study-plan { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; max-height: 480px; overflow: auto; padding-right: 4px; }
.study-plan-day h5 { margin: 0 0 6px; font-size: 12px; color: #5d747d; }
.study-plan-day.is-today h5 { color: #087e8b; }
.study-past { margin-top: 10px; font-size: 13px; color: #5d747d; }
.study-past ul { padding-left: 18px; }

.study-group { border-top: 1px solid #e4ecef; padding: 14px 0 6px; }
.study-group:first-of-type { border-top: 0; }
.study-board { width: 100%; border-collapse: collapse; font-size: 12px; }
.study-board th { text-align: left; color: #6b818a; font-weight: 600; padding: 6px 4px; border-bottom: 1px solid #e4ecef; }
.study-board td { padding: 7px 4px; border-bottom: 1px solid #f0f4f5; color: #19343f; }
.study-board tr.is-me td { background: #f2faf9; font-weight: 600; }

.study-log { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.study-log li { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f4f5; }
.study-log span { color: #6b818a; }
.study-log strong { font-weight: 500; overflow-wrap: anywhere; color: #19343f; }
.study-log em { font-style: normal; color: #087e8b; font-weight: 600; }

.study-dialog { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; border: 0; border-radius: 16px; padding: 22px; box-sizing: border-box; }
.study-dialog::backdrop { background: rgba(15, 35, 42, .45); }
.study-dialog h2 { font-size: 19px; margin: 0 0 8px; color: #19343f; }
.study-form { display: flex; flex-direction: column; gap: 12px; }
.study-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: #3d5862; }
.study-form input, .study-form select, .study-form textarea { font: inherit; font-size: 14px; font-weight: 400; padding: 9px 10px; border: 1px solid #d5e2e6; border-radius: 8px; width: 100%; box-sizing: border-box; background: #fff; }
.study-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.study-scope { border: 1px solid #e4ecef; border-radius: 12px; padding: 12px; margin: 0; min-width: 0; }
.study-scope legend { font-size: 13px; font-weight: 700; color: #19343f; padding: 0 6px; }
.study-topic-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.study-topic-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 6px 8px; border-radius: 8px; background: #f6f9fa; }
.study-topic-row label { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.study-topic-row label input { width: auto; accent-color: #087e8b; }
.study-topic-row small { color: #8aa0a8; font-weight: 600; }
.study-topic-row select { width: auto; flex: 0 0 auto; padding: 5px 8px; font-size: 12px; }
.study-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.study-form-error { color: #a33b3b; font-size: 13px; margin: 0; min-height: 1em; }
.study-invite-code { font-size: 30px; letter-spacing: .18em; font-weight: 800; text-align: center; color: #087e8b; margin: 6px 0; font-variant-numeric: tabular-nums; }
.study-done-tag { color: #0a766e; font-weight: 600; }

@media (max-width: 1000px) { .study-layout { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .study-card { padding: 14px; border-radius: 14px; }
  .study-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-form-grid { grid-template-columns: 1fr; }
  .study-exam-head { flex-direction: column; }
  .study-progress { flex-basis: auto; width: 100%; text-align: left; }
  .study-board th:nth-child(5), .study-board td:nth-child(5) { display: none; }
  .study-dialog { padding: 16px; }
}

.study-timer .study-goal { flex: 1 0 100%; }
.study-goal-bar { display: block; height: 7px; border-radius: 4px; background: linear-gradient(90deg, #087e8b var(--pct), #dcebee var(--pct)); }
.study-goal small { text-transform: none; letter-spacing: 0; font-size: 12px; }
.study-stats span, .study-goal small { font-variant-numeric: tabular-nums; }

.study-national { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.study-national > div { background: #f6f9fa; border-radius: 12px; padding: 10px 6px; text-align: center; min-width: 0; }
.study-national span { display: block; font-size: 16px; font-weight: 700; color: #19343f; }
.study-national small { font-size: 10.5px; color: #6b818a; }
.study-toggle { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: #19343f; cursor: pointer; }
.study-toggle input { width: 16px; height: 16px; accent-color: #087e8b; }
.study-requests { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.study-requests li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 9px 12px; background: #fff4dd; border-radius: 10px; font-size: 13px; color: #19343f; }
.study-requests span { display: flex; gap: 6px; }

/* Compact layout: stats + timer on one band, sections behind tabs. */
#student-study { display: flex; flex-direction: column; gap: 14px; }
.study-status { position: fixed; right: 24px; bottom: 50px; z-index: 40; margin: 0; max-width: min(420px, calc(100vw - 32px)); min-height: 0; padding: 11px 16px; border-radius: 10px; background: #19343f; color: #fff; font-size: 13px; box-shadow: 0 10px 28px #19343f40; }
.study-status:empty { display: none; }
.study-status.is-error { background: #a33b3b; color: #fff; }
.study-timer-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: stretch; padding: 14px; }
.study-timer-card .study-stats { margin: 0; }
.study-timer-card .study-stats > div { display: flex; flex-direction: column; justify-content: center; }
.study-timer-card .study-stats span { font-size: 16px; }
.study-tabs { display: flex; gap: 4px; padding: 4px; background: #e9f1f3; border-radius: 12px; align-self: flex-start; max-width: 100%; overflow-x: auto; }
.study-tabs button { font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; color: #4c6670; background: transparent; border: 0; border-radius: 9px; padding: 8px 14px; cursor: pointer; }
.study-tabs button[aria-selected=true] { background: #fff; color: #087e8b; box-shadow: 0 1px 4px #19343f1f; }
.study-panel { display: grid; gap: 14px; align-items: start; min-width: 0; }
.study-panel[hidden] { display: none; }
.study-panel-plan { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.study-panel-social { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1250px) { .study-panel-social { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1000px) { .study-timer-card, .study-panel-plan, .study-panel-social { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .study-status { left: 16px; right: 16px; max-width: none; } }

/* Study Tracker look: soft tinted cards, icon tiles, friendly empty states. */
.study-ico { width: 1.15em; height: 1.15em; flex: 0 0 auto; }
.tone-teal { --tone: #087e8b; --tint: #e5f7fb; } .tone-blue { --tone: #087e8b; --tint: #e5f7fb; } .tone-orange { --tone: #d97706; --tint: #fef3c7; }
.tone-purple { --tone: #087e8b; --tint: #e5f7fb; } .tone-navy { --tone: #066a75; --tint: #e5f7fb; } .tone-gold { --tone: #d97706; --tint: #fef3c7; }
.study-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.study-title > b { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; font-size: 19px; color: var(--tone); background: var(--tint); }
.study-title h3, .study-title h4 { margin: 0; font-size: 17px; font-weight: 800; color: #19343f; }
.study-title h4 { font-size: 15px; }
.study-title p { margin: 2px 0 0; font-size: 12px; color: #6b818a; }

.study-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .95fr) 170px; align-items: center; gap: 20px; padding: 16px 12px 16px 20px; border: 1px solid #b8eaf3; border-radius: 18px; background: linear-gradient(110deg, #e5f7fb, #f5fcfe 58%, #e5f7fb); overflow: hidden; }
.study-hero-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.study-hero .study-stats { margin: 0; gap: 8px; }
.study-hero .study-stats > div { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 7px; padding: 9px 10px; background: #fff; border-radius: 12px; text-align: left; box-shadow: 0 2px 8px #19343f0a; }
.study-hero .study-stats i { grid-row: span 2; font-size: 19px; color: var(--tone); display: flex; }
.study-hero .study-stats span { font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.study-hero .study-stats small { font-size: 10.5px; }
.study-hero-cta { display: flex; flex-direction: column; gap: 12px; padding-left: 20px; border-left: 1px solid #b8eaf3; min-width: 0; }
.study-hero-cta .study-btn-primary { gap: 8px; align-self: flex-start; border-radius: 10px; }
.study-hero-cta > small { font-size: 11px; color: #6b818a; text-transform: uppercase; letter-spacing: .04em; }
.study-hero-cta.is-running { gap: 5px; }
.study-hero-cta.is-running strong { font-size: 13px; color: #19343f; overflow-wrap: anywhere; }
.study-hero-cta .study-timer-clock { font-size: 22px; line-height: 1.2; }
.study-hero-cta .study-goal small { font-size: 11px; color: #5d747d; }
.study-hero-cta.is-running .study-btn-primary { margin-top: 5px; }
.study-art { width: 170px; height: auto; align-self: end; margin-bottom: -6px; }

.study-card-head select { font: inherit; font-size: 12px; padding: 6px 8px; border: 1px solid #d5e2e6; border-radius: 8px; background: #fff; color: #19343f; }
.study-date-pill { padding: 6px 11px; border-radius: 9px; background: #e5f7fb; color: #0a766e; font-size: 12px; font-weight: 700; white-space: nowrap; }
.study-empty-state { position: relative; display: flex; align-items: center; gap: 14px; padding: 18px 16px; border-radius: 14px; overflow: hidden; }
.study-empty-state > b { display: grid; place-items: center; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; background: #fff; font-size: 27px; }
.study-empty-state strong { font-size: 14px; color: #19343f; }
.study-empty-state p { margin: 3px 0 0; font-size: 12px; line-height: 1.45; color: #5d747d; }
.study-empty-state .study-btn-primary { margin-top: 10px; border-radius: 9px; }
.study-empty-state.is-green { background: #e5f7fb; } .study-empty-state.is-green > b { color: #087e8b; }
.study-empty-state.is-blue { background: #e5f7fb; } .study-empty-state.is-blue > b { color: #087e8b; }
.study-spark { position: absolute; right: 12px; bottom: 8px; width: 84px; color: #5fd4e8; opacity: .75; }
.study-empty-state.is-green > div { position: relative; padding-right: 76px; }
.study-replan { display: block; margin: 10px 0 0 auto; font-size: 12px; }
.study-exam-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 12px; border-top: 1px solid #e4ecef; }

.study-overall { grid-column: 1 / -1; padding: 14px 20px; }
.study-overall .study-card-head { margin-bottom: 10px; }
.study-overall-row { display: flex; align-items: center; gap: 14px; }
.study-overall-bar { flex: 1 1 auto; height: 11px; border-radius: 6px; background: linear-gradient(90deg, #087e8b var(--pct), #e4ecef var(--pct)); }
.study-overall-row strong { font-size: 14px; color: #19343f; font-variant-numeric: tabular-nums; }
.study-overall-row em { font-style: normal; padding: 4px 10px; border-radius: 8px; background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 700; white-space: nowrap; }

@media (max-width: 1250px) { .study-hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } .study-art { display: none; } }
@media (max-width: 1000px) { .study-hero { grid-template-columns: minmax(0, 1fr); } .study-hero-cta { padding-left: 0; padding-top: 12px; border-left: 0; border-top: 1px solid #b8eaf3; } }
@media (max-width: 600px) { .study-hero { padding: 14px; } .study-hero .study-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .study-overall { padding: 14px; } }

/* Friends & leaderboards */
.tone-green { --tone: #087e8b; --tint: #e5f7fb; }
.study-panel-social { align-items: stretch; }
.study-national-card { padding: 0; overflow: hidden; }
.study-national-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: #fff; background: linear-gradient(110deg, #066a75, #087e8b); }
.study-national-head > b { display: flex; font-size: 25px; color: #fbbf24; }
.study-national-head > div { flex: 1 1 auto; min-width: 0; }
.study-national-head h3 { color: #fff; font-size: 16px; font-weight: 800; }
.study-national-head p { margin: 2px 0 0; font-size: 11.5px; color: #e5f7fb; }
.study-national-head > span { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; padding: 5px 9px; border: 1px solid #ffffff80; border-radius: 16px; font-size: 11px; white-space: nowrap; }
.study-national-body { padding: 14px 16px 16px; }
.study-national > div { background: var(--tint); border-radius: 12px; padding: 12px 6px; }
.study-national i { display: flex; justify-content: center; margin-bottom: 4px; font-size: 21px; color: var(--tone); }
.study-national small { color: #3d5862; }
.study-info { display: flex; gap: 10px; padding: 11px 12px; border-radius: 12px; background: #e5f7fb; color: #087e8b; font-size: 18px; }
.study-info strong { display: block; font-size: 12.5px; color: #19343f; }
.study-info p { margin: 3px 0 0; font-size: 11.5px; line-height: 1.4; color: #5d747d; }
.study-bullets { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.study-bullets li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #27424d; }
.study-bullets b { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px; background: #e5f7fb; color: #087e8b; font-size: 16px; }
.study-wave { padding-bottom: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 50' preserveAspectRatio='none'%3E%3Cpath d='M0 50V38C70 44 120 20 190 24S280 10 320 2V50Z' fill='%23b8eaf3'/%3E%3C/svg%3E") bottom / 100% 40px no-repeat; }
.study-wave.is-green { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 320 50' preserveAspectRatio='none'%3E%3Cpath d='M0 50V38C70 44 120 20 190 24S280 10 320 2V50Z' fill='%23b8eaf3'/%3E%3C/svg%3E"); }
.study-card-cta { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 16px; }
.study-card-cta .study-btn-primary, .study-btn-outline { width: 100%; box-sizing: border-box; gap: 8px; padding: 10px 14px; border-radius: 22px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.study-card-cta .study-btn-primary { background: linear-gradient(100deg, #087e8b, #066a75); border: 0; }
.study-btn-outline { background: #e5f7fb; border: 1px solid #b8eaf3; color: #066a75; }

.study-card-head > .study-title { flex-wrap: nowrap; flex: 1 1 auto; }

@media (min-width: 701px) and (max-width: 1000px) { .study-hero { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } .study-hero-cta { padding: 0 0 0 16px; border-top: 0; border-left: 1px solid #b8eaf3; } }
@media (max-width: 600px) {
  .study-hero .study-title p, .study-hero-cta .study-title > b { display: none; }
  .study-hero-cta:not(.is-running) { flex-direction: row; align-items: center; justify-content: space-between; }
  .study-tabs { align-self: stretch; }
  .study-tabs button { flex: 1 1 auto; padding: 9px 8px; font-size: 12px; }
}
@media (max-width: 820px) { .study-form input, .study-form select, .study-form textarea, .study-card-head select { font-size: 16px; } }
@media (pointer: coarse) { .study-btn-link, .study-btn-small { min-height: 40px; } .study-check input, .study-toggle input { width: 22px; height: 22px; } }
