:root {
  --ink: #172033;
  --muted: #647089;
  --line: #dce3ec;
  --line-strong: #c7d1df;
  --canvas: #f3f6f9;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --brand: #087e9f;
  --brand-dark: #075d78;
  --brand-soft: #e9f7fb;
  --accent: #d8f06a;
  --danger: #b4233c;
  --danger-soft: #fff0f2;
  --success: #14795b;
  --success-soft: #ebf8f3;
  --shadow: 0 24px 70px rgba(31, 45, 68, .12);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: linear-gradient(135deg, #eef4f7 0%, var(--canvas) 42%, #f7f8f3 100%); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.app-nav { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; font-weight: 760; text-decoration: none; }
.brand-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; color: white; background: var(--brand); font-size: 14px; font-weight: 800; box-shadow: 0 6px 16px rgba(8, 126, 159, .24); }
.nav-note { color: var(--muted); font-size: 12px; }
.nav-actions { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 12px; font-weight: 700; }
.nav-actions a { text-decoration: none; }
.nav-actions a:hover { color: var(--brand-dark); }
.nav-actions .nav-primary { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink); background: white; }
.app-main { width: min(1120px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 64px; display: grid; place-items: center; }
.workspace-card { width: min(100%, 720px); border: 1px solid rgba(199, 209, 223, .82); border-radius: var(--radius); background: rgba(255,255,255,.96); box-shadow: var(--shadow); overflow: hidden; }
.workspace-card.compact { width: min(100%, 480px); }
.workspace-head { padding: 30px 34px 24px; border-bottom: 1px solid var(--line); background: linear-gradient(120deg, #fff 0%, #f6fbfc 68%, #f7faea 100%); }
.eyebrow { margin: 0 0 7px; color: var(--brand-dark); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.workspace-title { margin: 0; font-size: clamp(24px, 4vw, 34px); line-height: 1.1; letter-spacing: 0; }
.workspace-subtitle { max-width: 560px; margin: 9px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.workspace-body { padding: 28px 34px 34px; }
.flash { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 11px 13px; border: 1px solid #f3b9c3; border-radius: 7px; background: var(--danger-soft); color: #8c1d32; font-size: 13px; }
.flash.info, .flash.success { border-color: #b9dfd1; background: var(--success-soft); color: #0e6147; }
.flash button { border: 0; background: transparent; color: inherit; cursor: pointer; }
.upload-zone { min-height: 178px; padding: 30px 20px; display: grid; place-items: center; align-content: center; gap: 7px; border: 1.5px dashed #aebccc; border-radius: 8px; background: var(--surface-soft); text-align: center; cursor: pointer; transition: .16s ease; }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }
.upload-zone.has-file { border-style: solid; border-color: #57a98d; background: var(--success-soft); }
.upload-icon { width: 38px; height: 38px; color: var(--brand); }
.upload-text { font-size: 15px; font-weight: 720; }
.upload-hint, .file-name, .field-help { color: var(--muted); font-size: 12px; line-height: 1.45; }
.file-name { color: var(--success); font-weight: 650; }
input[type="file"] { display: none; }
.divider { margin: 20px 0; display: flex; align-items: center; gap: 12px; color: #8793a6; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.field-group { margin-bottom: 22px; }
.field-label { display: block; margin-bottom: 7px; color: #2f3b50; font-size: 12px; font-weight: 720; }
.input-shell input, .input-shell select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 7px; outline: none; background: white; color: var(--ink); }
.input-shell input:focus, .input-shell select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(8,126,159,.12); }
.field-help { margin-top: 6px; }
.primary-btn, .secondary-btn, .google-btn { min-height: 44px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; border: 1px solid transparent; border-radius: 7px; font-weight: 720; font-size: 13px; text-decoration: none; cursor: pointer; transition: .16s ease; }
.primary-btn { width: 100%; color: white; background: var(--brand); box-shadow: 0 8px 18px rgba(8,126,159,.18); }
.primary-btn:hover { background: var(--brand-dark); transform: translateY(-1px); }
.primary-btn:disabled { opacity: .55; cursor: wait; transform: none; }
.secondary-btn { width: 100%; color: var(--ink); border-color: var(--line-strong); background: white; }
.secondary-btn:hover { background: var(--surface-soft); }
.google-btn { width: 100%; color: var(--ink); border-color: var(--line-strong); background: white; }
.google-btn:hover { border-color: #9cabbf; background: #fafcfe; }
.google-btn svg { width: 20px; height: 20px; }
.spinner { width: 17px; height: 17px; border: 2px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-message { display: none; margin-top: 12px; padding: 10px 12px; border: 1px solid #f1b8c2; border-radius: 7px; color: var(--danger); background: var(--danger-soft); font-size: 12px; }
.error-message.visible { display: block; }
.feature-list { margin: 25px 0 0; padding: 22px 0 0; border-top: 1px solid var(--line); list-style: none; }
.feature-list li { margin: 0 0 11px; display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.feature-list i { color: var(--success); margin-top: 2px; }
.days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day-option input { position: absolute; opacity: 0; }
.day-option span { min-height: 38px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 6px; background: white; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.day-option input:checked + span { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.time-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; }
.time-selects { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; }
.time-separator { color: var(--muted); font-size: 12px; }
.form-actions { margin-top: 28px; }
.status-icon { width: 54px; height: 54px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-size: 24px; }
.centered { text-align: center; }
.inline-links { margin-top: 18px; color: var(--muted); font-size: 12px; }
.inline-links a { color: var(--brand-dark); font-weight: 700; text-decoration: none; }
.site-footer { width: min(1120px, calc(100% - 40px)); margin: auto auto 0; padding: 20px 0 28px; display: flex; justify-content: center; gap: 18px; color: var(--muted); font-size: 11px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--brand-dark); }
.legal-main { place-items: start center; }
.legal-card { width: min(100%, 760px); }
.legal-copy { color: #334158; font-size: 14px; line-height: 1.65; }
.legal-copy h2 { margin: 28px 0 7px; color: var(--ink); font-size: 17px; }
.legal-copy p { margin: 0 0 14px; }

.dashboard-main { place-items: start center; }
.dashboard-shell { width: min(100%, 980px); }
.dashboard-head { padding: 28px 30px; display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 18px 50px rgba(31,45,68,.09); }
.dashboard-head h1 { margin: 0; font-size: 32px; }
.dashboard-head p:not(.eyebrow) { margin: 8px 0 0; max-width: 620px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.connection-panel { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.connection-panel > div { display: flex; align-items: center; gap: 8px; }
.connection-panel form { margin: 0; }
.connection-status, .compact-action { min-height: 38px; padding: 8px 11px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 750; text-decoration: none; }
.connection-status.connected { border-color: #b9dfd1; color: var(--success); background: var(--success-soft); }
.compact-action { border-color: var(--brand); color: var(--brand-dark); background: var(--brand-soft); }
.text-button { padding: 5px; border: 0; background: transparent; color: var(--muted); font-size: 11px; cursor: pointer; }
.semester-section { margin-top: 30px; }
.semester-heading { margin-bottom: 12px; display: flex; align-items: baseline; justify-content: space-between; }
.semester-heading h2 { margin: 0; font-size: 18px; }
.semester-heading span { color: var(--muted); font-size: 11px; }
.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.course-card { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 8px 28px rgba(31,45,68,.06); }
.course-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.course-code { color: var(--brand-dark); font-size: 11px; font-weight: 850; letter-spacing: .05em; }
.sync-state { color: var(--success); font-size: 10px; font-weight: 750; }
.sync-state.pending { color: #8a5a08; }
.course-card h3 { margin: 8px 0 16px; font-size: 16px; line-height: 1.35; }
.course-meta { min-height: 44px; display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.review-count { color: #9b4b12; }
.course-open { margin-top: 18px; display: flex; align-items: center; justify-content: space-between; color: var(--brand-dark); font-size: 12px; font-weight: 800; text-decoration: none; }
.empty-workspace { margin-top: 28px; padding: 64px 28px; border: 1px dashed var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.7); text-align: center; }
.empty-workspace > i { color: var(--brand); font-size: 30px; }
.empty-workspace h2 { margin: 14px 0 6px; }
.empty-workspace p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }

@media (max-width: 640px) {
  .app-nav, .app-main { width: min(100% - 24px, 1120px); }
  .app-nav { padding-top: 14px; }
  .nav-note { display: none; }
  .nav-actions { gap: 10px; }
  .app-main { padding-top: 18px; }
  .workspace-head, .workspace-body { padding-left: 20px; padding-right: 20px; }
  .days-grid { grid-template-columns: repeat(4, 1fr); }
  .time-grid { grid-template-columns: 1fr; }
  .time-separator { display: none; }
  .dashboard-head { align-items: flex-start; flex-direction: column; padding: 22px; }
  .course-grid { grid-template-columns: 1fr; }
}
