:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --primary: #111827;
  --primary-2: #344054;
  --green: #067647;
  --green-bg: #ecfdf3;
  --red: #b42318;
  --red-bg: #fef3f2;
  --orange: #b54708;
  --orange-bg: #fffaeb;
  --blue: #175cd3;
  --blue-bg: #eff8ff;
  --radius: 18px;
  font-family: Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 90% 0%, rgba(17,24,39,.08), transparent 32rem), var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-shell { width: min(1260px, calc(100% - 32px)); margin: 22px auto 48px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; color: white; border-radius: 24px; background: linear-gradient(135deg, #101828, #344054); box-shadow: 0 18px 50px rgba(16,24,40,.18); }
.brand-block { display: flex; align-items: center; gap: 14px; }
.brand-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #111827; background: white; font-size: 25px; font-weight: 900; }
h1,h2,h3,p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(20px, 3vw, 28px); }
h2 { margin-bottom: 0; font-size: 19px; }
.brand-block p { margin-bottom: 0; color: #d0d5dd; font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.button { min-height: 43px; border: 1px solid transparent; border-radius: 12px; padding: 10px 16px; font-weight: 800; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
.button.primary { color: white; background: var(--primary); border-color: var(--primary); }
.topbar .button.primary { color: #111827; background: white; border-color: white; }
.button.secondary { color: #344054; background: white; border-color: #d0d5dd; }
.button.ghost { color: #344054; background: #f2f4f7; border-color: transparent; }
.button.success { color: white; background: var(--green); }
.button.danger { color: var(--red); background: var(--red-bg); border-color: #fecdca; }
.button.small { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.button.full { width: 100%; margin-top: 12px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 31px; border-radius: 999px; padding: 6px 10px; white-space: nowrap; font-size: 11px; font-weight: 800; }
.badge.neutral { color: #344054; background: #f2f4f7; }
.badge.good { color: #05603a; background: #d1fadf; }
.badge.warning { color: #93370d; background: #fef0c7; }
.badge.bad { color: #912018; background: #fee4e2; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 16px; border-radius: 16px; padding: 13px 15px; line-height: 1.75; }
.banner div { display: flex; flex-direction: column; }
.banner.warning { color: var(--orange); background: var(--orange-bg); border: 1px solid #fedf89; }
.tabs { display: flex; gap: 7px; margin: 18px 0 14px; padding: 6px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.8); overflow-x: auto; }
.tab { flex: 1; min-width: 120px; border: 0; border-radius: 11px; padding: 11px 14px; color: #475467; background: transparent; font-weight: 800; }
.tab.active { color: white; background: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.card { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 20px; padding: 19px; background: rgba(255,255,255,.96); box-shadow: 0 9px 25px rgba(16,24,40,.055); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.kicker { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.muted { color: var(--muted); line-height: 1.8; }
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 16px; }
.stat-card { display: flex; flex-direction: column; gap: 7px; padding: 17px; border: 1px solid var(--line); border-radius: 17px; background: white; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { font-size: 27px; }
.dashboard-grid { display: grid; grid-template-columns: 1.3fr .7fr; gap: 16px; }
.next-card { min-height: 210px; background: linear-gradient(135deg, white, #f8fafc); }
.next-details { display: grid; gap: 9px; }
.next-details .detail-line { display: flex; align-items: center; gap: 8px; }
.status-list { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.status-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; background: var(--surface-soft); }
.status-list > div + div { border-top: 1px solid var(--line); }
.status-list span { color: var(--muted); font-size: 12px; }
.status-list strong { font-size: 12px; }
.event-list { display: grid; gap: 10px; }
.event-item { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: center; border: 1px solid var(--line); border-right: 4px solid var(--primary); border-radius: 15px; padding: 13px; background: white; }
.event-time { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-left: 12px; border-left: 1px solid var(--line); }
.event-time strong { font-size: 18px; }
.event-time span { color: var(--muted); font-size: 10px; }
.event-main h3 { margin: 0 0 7px; font-size: 15px; }
.event-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.event-actions { display: flex; gap: 6px; }
.notification-chip { display: inline-flex; border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 800; }
.notification-chip.scheduled { color: var(--green); background: var(--green-bg); }
.notification-chip.error { color: var(--red); background: var(--red-bg); }
.notification-chip.pending_future { color: var(--orange); background: var(--orange-bg); }
.notification-chip.no_reminder { color: #475467; background: #f2f4f7; }
.empty { padding: 32px 14px; text-align: center; color: var(--muted); border: 1px dashed #d0d5dd; border-radius: 14px; background: #fcfcfd; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > span { color: #344054; font-size: 12px; font-weight: 800; }
input, select, textarea { width: 100%; border: 1px solid #d0d5dd; border-radius: 11px; padding: 11px 12px; color: var(--text); background: white; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #667085; box-shadow: 0 0 0 4px rgba(102,112,133,.12); }
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid.one-column { grid-template-columns: 1fr; }
.field.full, .form-grid .full { grid-column: 1/-1; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.accent-card { border-color: #abefc6; background: linear-gradient(135deg, white, #f6fef9); }
.notice, .result { margin-top: 12px; border-radius: 13px; padding: 12px 13px; line-height: 1.8; overflow-wrap: anywhere; }
.notice.info { color: var(--blue); background: var(--blue-bg); border: 1px solid #b2ddff; }
.result.success { color: var(--green); background: var(--green-bg); border: 1px solid #abefc6; }
.result.error { color: var(--red); background: var(--red-bg); border: 1px solid #fecdca; }
.result.warning { color: var(--orange); background: var(--orange-bg); border: 1px solid #fedf89; }
.result code { direction: ltr; display: block; margin-top: 6px; text-align: left; font-size: 10px; }
.role-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-option { display: flex; flex-direction: column; gap: 6px; text-align: right; border: 1px solid var(--line); border-radius: 14px; padding: 14px; color: var(--text); background: white; }
.role-option span { color: var(--muted); font-size: 11px; }
.role-option.active { color: white; border-color: var(--primary); background: var(--primary); }
.role-option.active span { color: #d0d5dd; }
.year-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #d0d5dd; border-radius: 11px; color: #344054; background: white; font-size: 25px; }
.year-toolbar > div { min-width: 150px; }
.year-jump { display: flex; align-items: center; gap: 8px; margin-right: auto; color: var(--muted); font-size: 11px; }
.year-jump input { width: 95px; }
.year-calendar { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.month-card { border: 1px solid var(--line); border-radius: 15px; padding: 11px; background: white; }
.month-card h3 { margin: 0 0 9px; font-size: 14px; }
.month-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.month-grid .weekday { padding: 3px 0; text-align: center; color: #98a2b3; font-size: 9px; font-weight: 800; }
.day-cell { position: relative; min-height: 31px; border: 0; border-radius: 8px; padding: 4px 2px; color: #344054; background: transparent; font-size: 10px; }
.day-cell:hover { background: #f2f4f7; }
.day-cell.has-event { color: white; background: var(--primary-2); font-weight: 800; }
.day-cell.today { outline: 2px solid #12b76a; outline-offset: -2px; }
.day-count { position: absolute; left: 2px; bottom: 1px; display: grid; place-items: center; min-width: 12px; height: 12px; border-radius: 999px; color: #111827; background: white; font-size: 7px; }
dialog { width: min(720px, calc(100% - 22px)); max-height: calc(100vh - 30px); border: 0; border-radius: 21px; padding: 0; overflow: auto; box-shadow: 0 32px 90px rgba(16,24,40,.35); }
dialog::backdrop { background: rgba(16,24,40,.62); backdrop-filter: blur(3px); }
.dialog-card { padding: 20px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 17px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 17px; }
.jalali-wrap { position: relative; }
.jalali-picker { position: absolute; z-index: 20; top: calc(100% + 7px); right: 0; width: min(340px, 88vw); border: 1px solid var(--line); border-radius: 15px; padding: 11px; background: white; box-shadow: 0 18px 46px rgba(16,24,40,.18); display: none; }
.jalali-picker.show { display: block; }
.picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.picker-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; }
.picker-grid .weekday { text-align: center; color: #98a2b3; font-size: 9px; font-weight: 800; padding: 5px 0; }
.picker-day { border: 0; border-radius: 8px; padding: 7px 2px; background: white; }
.picker-day:hover { background: #f2f4f7; }
.picker-day.selected { color: white; background: var(--primary); }
.toast { position: fixed; left: 18px; bottom: 18px; z-index: 100; max-width: min(440px, calc(100% - 36px)); border-radius: 13px; padding: 12px 15px; color: white; background: #101828; opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
body.professor-mode #newEventButton, body.professor-mode #newEventButton2, body.professor-mode .admin-only { display: none !important; }
@media(max-width: 980px) { .year-calendar { grid-template-columns: repeat(2,1fr); } .dashboard-grid, .setup-grid { grid-template-columns: 1fr; } }
@media(max-width: 720px) {
  .app-shell { width: min(100% - 16px, 1260px); margin: 8px auto 30px; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 18px; border-radius: 19px; }
  .top-actions { width: 100%; justify-content: space-between; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .filters, .form-grid { grid-template-columns: 1fr; }
  .field.full, .form-grid .full { grid-column: 1; }
  .year-calendar { grid-template-columns: 1fr; }
  .year-toolbar { flex-wrap: wrap; }
  .year-jump { margin-right: 0; }
  .event-item { grid-template-columns: 72px 1fr; }
  .event-actions { grid-column: 1/-1; justify-content: flex-end; }
  .role-selector { grid-template-columns: 1fr; }
  .banner { align-items: flex-start; flex-direction: column; }
}
