/* Course Builder — student app styles */
:root {
  --cb-accent: #4f46e5;
  --cbapp-bg: #f4f5fb;
  --cbapp-card: #ffffff;
  --cbapp-text: #111827;
  --cbapp-muted: #6b7280;
  --cbapp-line: #e5e7eb;
  --cbapp-radius: 14px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--cbapp-bg); color: var(--cbapp-text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--cb-accent); }
button, input { font: inherit; color: inherit; }

.cbapp-boot { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.cbapp-boot img { border-radius: 16px; opacity: .85; }

.cbapp-top { position: sticky; top: 0; z-index: 20; background: var(--cb-accent); color: #fff; padding-top: env(safe-area-inset-top); }
.cbapp-top-in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 10px; padding: 10px 16px; min-height: 52px; }
.cbapp-logo { width: 32px; height: 32px; border-radius: 8px; background: rgba(255,255,255,.2); object-fit: cover; }
.cbapp-brand { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.cbapp-main { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.cbapp-hello { font-size: 22px; margin: 4px 0 14px; overflow-wrap: anywhere; }
.cbapp-card { background: var(--cbapp-card); border-radius: var(--cbapp-radius); padding: 16px; margin: 0 0 14px; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
.cbapp-h { font-size: 17px; margin: 0 0 10px; }
.cbapp-muted { color: var(--cbapp-muted); }
.cbapp-small { font-size: 13px; }
.cbapp-offline { background: #fef3c7; color: #78350f; border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 0 0 12px; }

.cbapp-btn { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 46px; padding: 10px 16px; border-radius: 12px; border: 1px solid var(--cb-accent); background: var(--cb-accent); color: #fff; font-weight: 600; text-decoration: none; cursor: pointer; margin-top: 12px; }
.cbapp-btn-ghost { background: #fff; color: var(--cbapp-text); border-color: #d1d5db; }
.cbapp-btn[hidden] { display: none; }

.cbapp-bar { display: block; height: 7px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.cbapp-bar > span { display: block; height: 100%; background: var(--cb-accent); border-radius: 99px; }

.cbapp-continue-in { display: flex; gap: 14px; align-items: flex-start; }
.cbapp-continue-img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex: none; }
.cbapp-continue-text { min-width: 0; flex: 1; }
.cbapp-kicker { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--cb-accent); }
.cbapp-continue-title { font-size: 18px; margin: 2px 0 2px; overflow-wrap: anywhere; }
.cbapp-continue-text p { margin: 0; }

.is-ph { display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--cb-accent) 15%, #fff); color: var(--cb-accent); font-weight: 800; font-size: 26px; }

.cbapp-courses, .cbapp-news { list-style: none; margin: 0; padding: 0; }
.cbapp-courses li + li, .cbapp-news li + li { border-top: 1px solid var(--cbapp-line); }
.cbapp-course { display: flex; gap: 12px; align-items: center; padding: 10px 0; color: inherit; text-decoration: none; }
.cbapp-course-img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; font-size: 20px; }
.cbapp-course-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.cbapp-course-text strong { overflow-wrap: anywhere; }
.cbapp-tag { align-self: flex-start; margin-top: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.cbapp-tag.is-done { background: #dcfce7; color: #166534; }
.cbapp-tag.is-ended { background: #fee2e2; color: #991b1b; }

.cbapp-news a { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; color: inherit; text-decoration: none; }
.cbapp-news-text { font-size: 14px; color: #374151; }

.cbapp-switch { display: flex; align-items: center; gap: 12px; padding: 6px 0; cursor: pointer; position: relative; }
.cbapp-switch-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cbapp-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cbapp-switch-ui { width: 48px; height: 28px; border-radius: 99px; background: #d1d5db; position: relative; flex: none; transition: background .15s; }
.cbapp-switch-ui::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.cbapp-switch-input:checked + .cbapp-switch-ui { background: var(--cb-accent); }
.cbapp-switch-input:checked + .cbapp-switch-ui::after { transform: translateX(20px); }
[dir="rtl"] .cbapp-switch-input:checked + .cbapp-switch-ui::after { transform: translateX(-20px); }
.cbapp-switch-input:focus-visible + .cbapp-switch-ui { outline: 2px solid var(--cb-accent); outline-offset: 2px; }
.cbapp-switch-input:disabled + .cbapp-switch-ui { opacity: .6; }

.cbapp-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--cbapp-line); font-size: 15px; }

.cbapp-toast { position: fixed; inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 480px; margin: 0 auto; background: #111827; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 15px; transform: translateY(150%); transition: transform .2s; z-index: 50; }
.cbapp-toast.is-on { transform: none; }
.cbapp-toast.is-bad { background: #991b1b; }

/* Signed-out screen (uses Course Builder's sign-in panel) */
.cbapp-signin .cbapp-card { padding: 20px; }
.cbapp-signin .cb-auth input[type=text], .cbapp-signin .cb-auth input[type=email], .cbapp-signin .cb-auth input[type=password] { width: 100%; }

/* Due dates on the home screen */
.cbapp-due-when { font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cbapp-due li.is-overdue .cbapp-due-when { color: #991b1b; }
.cbapp-tag-late { background: #fee2e2; color: #991b1b; border-radius: 99px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
