:root {
  --ink: #20122f;
  --muted: #75687f;
  --purple: #6c2cff;
  --pink: #ff408f;
  --orange: #ff783d;
  --yellow: #ffd43b;
  --line: #eadfff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: linear-gradient(135deg, #fff7fb 0%, #f5f0ff 48%, #edfffc 100%);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex: 0 0 240px;
  min-height: 100vh;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  background: #21113d;
  color: #fff;
}
.brand { display: flex; gap: 10px; align-items: center; margin: 0 10px 40px; }
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: #5a3c41;
  font-size: 23px;
  box-shadow: 0 8px 20px #ff7a3d55;
}
.brand strong { font: 700 22px 'Playfair Display'; letter-spacing: -1px; }
.brand strong span { color: #ff5fa2; }
.brand small { display: block; margin-top: 1px; color: #bdaed8; font-size: 8px; letter-spacing: 1.2px; }
.profile-mini { display: flex; align-items: center; gap: 9px; margin-bottom: 25px; padding: 12px; border-radius: 14px; background: #ffffff17; }
.profile-mini small { display: block; color: #cfc1e8; font-size: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #7b58d5; color: #fff; font-size: 11px; font-weight: 700; }
.avatar.small { width: 38px; height: 38px; }
.sidebar nav a,
.sidebar-bottom a,
.sidebar-bottom button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 3px 0;
  padding: 13px 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #cfc1e8;
  text-align: left;
  text-decoration: none;
  font-size: 13px;
}
.sidebar nav a span,
.sidebar-bottom a span,
.sidebar-bottom span { width: 18px; text-align: center; font-size: 18px; }
.sidebar nav a.active, .sidebar-bottom a.active { background: linear-gradient(100deg, #7635ff, #e23dbe); color: #fff; font-weight: 700; box-shadow: 0 8px 22px #6c2cff55; }
.sidebar nav em { margin-left: auto; padding: 3px 7px; border-radius: 10px; background: #ffe1db; color: #e56a59; font-size: 10px; font-style: normal; }
.sidebar-bottom { margin-top: auto; }
.sidebar-bottom button:hover { background: #ffffff12; }
.sidebar-bottom button.install-app { margin-bottom: 11px; background: #ffffff12; color: #fff; font-weight: 700; }
.sidebar-bottom button.install-app:hover { background: #ffffff1f; }

.main { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(600px, 1fr) 320px; align-content: start; }
.topbar {
  grid-column: 1 / -1;
  height: 90px;
  padding: 20px 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #fff9;
  backdrop-filter: blur(14px);
}
.greeting span { color: #8d8691; font-size: 13px; }
.greeting h1 { margin: 3px 0; font: 700 21px 'Playfair Display'; }
.top-actions { display: flex; align-items: center; gap: 15px; }
.icon-btn, .mobile-menu { border: 0; background: none; color: #706978; font-size: 24px; }
.mobile-menu { display: none; }
.role-switch { padding: 9px 12px; border: 1px solid #dfd6f7; border-radius: 9px; background: #faf8ff; color: #6d4bc9; font-size: 11px; font-weight: 600; white-space: nowrap; }

.content { min-height: calc(100vh - 90px); padding: 30px 42px 50px; }
.hero {
  padding: 28px 33px;
  display: flex;
  justify-content: space-between;
  overflow: hidden;
  border-radius: 22px;
  background: linear-gradient(120deg, var(--pink), var(--orange) 48%, var(--yellow));
  color: #fff;
  box-shadow: 0 16px 35px #ff4f8733;
}
.student-mode .hero { background: linear-gradient(110deg, #c7b0ff, #8c6ce0); }
.eyebrow { margin: 0 0 9px; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 1.5px; }
.hero h2 { margin: 0; font: 700 31px/1.15 'Playfair Display'; }
.hero h2 i { color: #fff9f2; }
.hero-message { min-height: 72px; transition: opacity .22s ease, transform .22s ease; }
.hero-message.is-changing { opacity: 0; transform: translateY(6px); }
.hero-sub { margin: 17px 0 0; color: #fff; font-size: 12px; }
.sun { align-self: center; color: #fff; font-size: 115px; line-height: 1; opacity: .7; }
.toolbar { margin: 29px 0 18px; display: flex; align-items: center; justify-content: space-between; }
.tabs { display: flex; align-items: center; }
.period-tabs { display: flex; gap: 5px; padding: 4px; border-radius: 10px; background: #e9ddff; }
.tab { padding: 9px 16px; border: 0; border-radius: 8px; background: none; color: #8b8590; font-size: 12px; font-weight: 600; }
.tab.active { background: var(--purple); color: #fff; }
.pricing-tab { margin-left: 18px; border: 0; background: linear-gradient(110deg, var(--pink), var(--orange)); color: #fff; box-shadow: 0 7px 18px #ff4f8738; }
.primary { padding: 12px 17px; border: 0; border-radius: 10px; background: linear-gradient(110deg, var(--purple), #d52cca); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 7px 18px #6c2cff40; }
.primary:hover { transform: translateY(-1px); }
.calendar-surface { margin-top: 18px; }
.app-view { display: none; }
.app-view.show { display: block; }

.right-panel { min-height: calc(100vh - 90px); padding: 34px 25px; border-left: 1px solid var(--line); background: #fff9; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h3 { margin: 0; font: 700 18px 'Playfair Display'; }
.panel-head a, .reminder a { color: var(--purple); text-decoration: none; font-size: 10px; font-weight: 700; }
.reminder { margin: 18px 0 30px; padding: 15px; display: flex; gap: 12px; border-radius: 14px; background: linear-gradient(120deg, #fff0a5, #ffd2df); }
.reminder-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 9px; background: var(--pink); color: #fff; }
.reminder b { font-size: 12px; }
.reminder p { margin: 4px 0; color: #7d7278; font-size: 11px; line-height: 1.4; }
.next { margin-bottom: 14px; }
.mini-course { width: 100%; padding: 10px 0; display: flex; align-items: center; gap: 12px; border: 0; border-bottom: 1px solid #f1edef; background: transparent; color: var(--ink); text-align: left; }
.mini-date { width: 38px; height: 42px; flex: 0 0 38px; padding-top: 5px; border-radius: 10px; background: #e5d6ff; color: #6327d9; text-align: center; }
.mini-date b, .mini-date small, .mini-course>span:nth-child(2)>b, .mini-course>span:nth-child(2)>small { display: block; }
.mini-date b { font-size: 16px; }
.mini-date small { font-size: 8px; }
.mini-course>span:nth-child(2) { flex: 1; }
.mini-course>span:nth-child(2)>b { font-size: 12px; }
.mini-course>span:nth-child(2)>small { margin-top: 4px; color: #9a9299; font-size: 10px; }
.quote { margin-top: 30px; padding: 22px; border-radius: 16px; background: linear-gradient(140deg, var(--purple), #1f9de8); color: #fff; font: 600 italic 16px/1.35 'Playfair Display'; box-shadow: 0 12px 28px #6c2cff36; }
.quote small { display: block; margin-top: 12px; opacity: .75; font: 10px 'DM Sans'; }
.right-panel .empty-state { padding: 12px; font-size: 11px; }

.toast { position: fixed; z-index: 110; bottom: 22px; left: 50%; padding: 12px 18px; border-radius: 10px; background: #292230; color: #fff; font-size: 12px; opacity: 0; transform: translate(-50%, 20px); transition: .25s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.notification-fab { position: fixed; z-index: 80; right: 24px; bottom: 24px; width: 58px; height: 58px; border: 0; border-radius: 50%; background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff; font-size: 23px; box-shadow: 0 13px 30px #6c2cff66; }
.notification-fab b { position: absolute; right: -2px; top: -4px; min-width: 22px; height: 22px; padding: 3px; border-radius: 12px; background: var(--yellow); color: #3d234d; font-size: 11px; }
.notification-drawer { position: fixed; z-index: 100; right: 22px; bottom: 92px; width: min(390px, calc(100vw - 30px)); max-height: min(610px, calc(100vh - 120px)); overflow: auto; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 24px 70px #20122f44; }
.notification-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.notification-head h2 { margin: 0; font: 700 20px 'Playfair Display'; }
.notification-head button { border: 0; border-radius: 8px; padding: 7px 9px; background: #f1eaff; color: var(--purple); font-size: 10px; font-weight: 700; }
.notification-item { width: 100%; display: block; margin-top: 9px; padding: 12px; border: 1px solid #ede5f7; border-radius: 12px; background: #faf8fc; color: var(--ink); text-align: left; }
.notification-item.unread { border-color: #bd9cff; background: linear-gradient(110deg,#f4ecff,#fff2f7); }
.notification-item.version-update-notification { border-color: #ffb13b; background: linear-gradient(110deg,#fff0d8,#f3e9ff); box-shadow: inset 4px 0 #ff8a3d; }
.notification-item b,.notification-item span,.notification-item small { display: block; }
.notification-item span { margin: 4px 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.notification-item small { color: #a195a9; font-size: 9px; }
.event-poster-button { position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 12px; background: transparent; cursor: zoom-in; overflow: hidden; }
.event-poster-button .event-poster { margin-bottom: 0; transition: transform .2s ease; }
.event-poster-button:hover .event-poster { transform: scale(1.025); }
.event-poster-button span { position: absolute; right: 9px; bottom: 9px; padding: 5px 8px; border-radius: 999px; background: #160b26d9; color: #fff; font-size: 9px; font-weight: 800; }
.cal-dialog.image-viewer-dialog { position: relative; width: min(1000px, 96vw); max-height: 94vh; padding: 12px; background: #0d0915; overflow: auto; }
.image-viewer-picture { display: block; width: 100%; max-height: 82vh; object-fit: contain; border-radius: 14px; }
.image-viewer-close { position: sticky; z-index: 2; float: right; top: 4px; margin: 4px; width: 38px; height: 38px; padding: 0 !important; border-radius: 50% !important; background: #fff !important; color: #28133f !important; font-size: 24px; }
.image-viewer-title { margin: 10px 8px 4px; color: #fff; text-align: center; font-weight: 800; }
.event-price-pill { display: inline-block; margin-left: 6px; padding: 4px 7px; border-radius: 6px; background: #fff1c7; color: #835100; font-size: 8px; font-weight: 900; }
.student-balance { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.credits-chip { min-width: 128px; padding: 10px 13px; border: 1px solid #d8c4ff; border-radius: 13px; background: linear-gradient(135deg, #f4edff, #fff3f8); text-align: right; box-shadow: 0 7px 18px #6c2cff16; }
.credits-chip span, .credits-chip small { display: block; color: var(--muted); font-size: 9px; }
.credits-chip b { display: block; margin: 1px 0; color: var(--purple); font: 700 22px 'Playfair Display'; }
.member-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.member-card-head .credits-chip { min-width: 118px; padding: 8px 10px; }
.member-card-head .credits-chip b { font-size: 19px; }

body.section-open .content { padding-top: 30px; }
body.section-open .right-panel { padding-top: 34px; }

.settings-card-wide { grid-column: 1 / -1; }
.settings-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.settings-card-head h3 { margin-bottom: 4px; }
.settings-card-head .settings-note { margin: 0; }
.settings-count { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; background: #eee5ff; color: var(--purple); font-size: 9px; font-weight: 800; }
.home-message-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; margin: 15px 0 17px; padding: 14px; border-radius: 13px; background: #faf7ff; }
.home-message-form label { margin: 0; }
.home-message-form textarea { min-height: 70px; resize: vertical; }
.home-message-form-actions { display: flex; gap: 7px; padding-bottom: 1px; }
.home-message-list { display: grid; gap: 8px; }
.home-message-item { display: flex; justify-content: space-between; gap: 14px; padding: 13px; border: 1px solid #e3d6fa; border-radius: 12px; background: linear-gradient(110deg, #fff, #f6f0ff); }
.home-message-item.inactive { opacity: .62; background: #f5f2f7; }
.home-message-item p { margin: 5px 0 0; font: 600 14px/1.4 'Playfair Display'; }
.message-status { color: #197c5d; font-size: 8px; font-weight: 900; letter-spacing: .8px; }
.home-message-item.inactive .message-status { color: #8b7e91; }
.home-message-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; flex-wrap: wrap; }
.home-message-actions button { padding: 7px 9px; border: 0; border-radius: 8px; background: #eee7f7; color: #6242a7; font-size: 9px; font-weight: 800; }
.home-message-actions button.danger { border: 1px solid #ffc7d9; background: #fff; color: #c82b60; }

.auth-gate {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 18px;
  background: radial-gradient(circle at 15% 15%, #ff408f55, transparent 30%), linear-gradient(135deg, #25103d, #6c2cff);
}
.auth-card { width: min(430px, 100%); margin: auto; padding: 28px; border-radius: 24px; background: #fff; box-shadow: 0 30px 90px #17052299; }
.auth-brand { display: flex; align-items: center; gap: 11px; }
.auth-brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: linear-gradient(135deg, var(--yellow), var(--orange)); color: #5a3c41; font-size: 23px; box-shadow: 0 8px 20px #ff7a3d44; }
.auth-card h1 { margin: 0; font: 700 28px 'Playfair Display'; }
.auth-card h1 span { color: var(--purple); }
.auth-intro { min-height: 34px; margin: 10px 0 17px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 15px; padding: 4px; border-radius: 11px; background: #f0e9fc; }
.auth-tabs button { padding: 9px; border: 0; border-radius: 8px; background: transparent; color: #75687f; font-size: 12px; font-weight: 700; }
.auth-tabs button.active { background: #fff; color: var(--purple); box-shadow: 0 3px 12px #35105d17; }
.auth-card label { display: block; margin: 11px 0; font-size: 11px; font-weight: 700; }
.auth-card input { width: 100%; margin-top: 6px; padding: 12px; border: 1px solid #e4d4ff; border-radius: 10px; background: #fff; font: 13px inherit; outline: none; }
.auth-card input:focus { border-color: var(--purple); box-shadow: 0 0 0 3px #6c2cff16; }
.auth-hint { margin: -5px 0 4px; color: #8c7f93; font-size: 10px; }
.auth-forgot { display: block; margin: -3px 0 4px auto; padding: 2px 0; border: 0; background: transparent; color: var(--purple); font-size: 10px; font-weight: 700; }
.auth-feedback { min-height: 32px; margin: 8px 0 4px; font-size: 11px; line-height: 1.4; }
.auth-feedback.error { color: #c82b60; }
.auth-feedback.success { color: #137b5a; }
.auth-feedback.pending { color: var(--purple); }
.auth-submit { width: 100%; padding: 13px; border: 0; border-radius: 10px; background: linear-gradient(110deg, var(--purple), #d52cca); color: #fff; font-weight: 800; box-shadow: 0 8px 20px #6c2cff33; }
.auth-submit:disabled { cursor: wait; opacity: .7; }
.auth-back { width: 100%; margin-top: 9px; padding: 8px; border: 0; background: transparent; color: var(--purple); font-size: 11px; font-weight: 700; }
.auth-install { width: 100%; margin-top: 10px; padding: 10px; border: 1px solid #dfd1f4; border-radius: 10px; background: #faf7ff; color: #6242a7; font-size: 11px; font-weight: 700; }
.auth-version { margin-top: 13px; padding: 9px 11px; border-radius: 999px; background: #f2ecfb; color: #6242a7; text-align: center; font-size: 10px; font-weight: 800; }
.auth-version.current { background: #e5fbf2; color: #137b5a; }
.auth-version.outdated { background: #fff0d8; color: #9b5c00; }
.auth-credit { margin: 10px 0 0; color: #8c7f93; text-align: center; font-size: 9px; }
.auth-credit a,.app-credit a { color: #6c2cff; font-weight: 700; }
.recipient-picker { grid-column: 1/-1; display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 7px; max-height: 210px; overflow: auto; padding: 10px; border: 1px solid #e4d4ff; border-radius: 10px; }
.recipient-picker label { display: flex; gap: 7px; align-items: center; margin: 0; }
.recipient-picker input { width: auto; margin: 0; }
.app-credit { margin-top: 12px; color: #75687f; font-size: 11px; }

.install-layer { position: fixed; z-index: 130; inset: 0; display: grid; place-items: center; padding: 18px; background: #1d0d33a8; backdrop-filter: blur(7px); }
.install-dialog { position: relative; width: min(410px, 100%); padding: 28px; border-radius: 22px; background: #fff; box-shadow: 0 28px 80px #17052280; }
.install-close { position: absolute; top: 13px; right: 13px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f2ecfb; color: #5d5266; font-size: 20px; }
.install-mark { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(135deg, var(--yellow), var(--orange)); color: #5a3c41; font-size: 30px; box-shadow: 0 9px 22px #ff7a3d44; }
.install-dialog h2 { margin: 17px 0 7px; font: 700 23px 'Playfair Display'; }
.install-dialog p, .install-dialog li { color: var(--muted); font-size: 12px; line-height: 1.55; }
.install-dialog ol { margin: 17px 0; padding-left: 20px; }
.install-dialog li + li { margin-top: 6px; }
.install-understood { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--purple); color: #fff; font-weight: 800; }

@media (max-width: 950px) {
  .right-panel { display: none; }
  .main { display: block; }
  .topbar { padding: 18px 25px; }
  .content { padding: 25px; }
}

@media (max-width: 650px) {
  .sidebar { display: none; }
  .sidebar.open { position: fixed; z-index: 95; inset: 0 auto 0 0; display: flex; box-shadow: 18px 0 45px #18062266; }
  .mobile-menu { display: block; }
  .topbar { height: 74px; padding: 15px 18px; }
  .content { min-height: calc(100vh - 74px); padding: 18px 15px; }
  .greeting h1 { font-size: 17px; }
  .top-actions { gap: 7px; }
  .role-switch { padding: 8px; font-size: 10px; }
  .hero { padding: 22px; }
  .hero h2 { font-size: 25px; }
  .hero-message { min-height: 58px; }
  .sun { font-size: 75px; }
  .toolbar { align-items: flex-start; gap: 12px; }
  .pricing-tab { margin-left: 8px; }
  .home-message-form { grid-template-columns: 1fr; }
  .home-message-form-actions { flex-wrap: wrap; }
  .home-message-item { display: block; }
  .home-message-actions { margin-top: 11px; }
}
