:root {
  color-scheme: dark;
  --background: #07101e;
  --sidebar: #060e1a;
  --panel: #0c192a;
  --panel-raised: #102037;
  --border: #1b2c43;
  --text: #edf4ff;
  --muted: #9aaac0;
  --blue: #79baff;
  --purple: #a18cff;
  --green: #45d6a0;
  --sans: "Manrope", sans-serif;
  --mono: "DM Mono", monospace;
}

* { box-sizing: border-box; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 82% 4%, #102b50 0, transparent 34rem), var(--background);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.portal-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 2;
  display: flex;
  width: 220px;
  flex-direction: column;
  padding: 22px 14px;
  border-right: 1px solid var(--border);
  background: rgba(6, 14, 26, .97);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 5px 35px; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid #315994; border-radius: 10px; background: #102544; color: var(--blue); font: 11px var(--mono); }
.brand-light { color: var(--muted); font-weight: 500; }
.sidebar-caption, .eyebrow, .card-label { color: #87a3c6; font: 9px var(--mono); letter-spacing: .12em; }
.sidebar-caption { padding: 0 10px 12px; }
.side-link { display: flex; align-items: center; gap: 11px; margin-bottom: 5px; padding: 12px 10px; border: 1px solid transparent; border-radius: 9px; color: #bcc9dc; font-size: 11px; font-weight: 700; }
.side-link > span { width: 17px; color: var(--blue); font-size: 14px; text-align: center; }
.side-link.active { border-color: #1f67bd; background: linear-gradient(100deg,#1264bd,#14356c); box-shadow: 0 0 22px #1478ed35; color: #fff; }
.side-link:hover { border-color: #28436a; background: #0d1d32; color: #fff; }
.sidebar-status { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 12px 9px; color: #899bb3; font: 8px var(--mono); letter-spacing: .04em; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #e6b450; box-shadow: 0 0 10px #e6b45066; }
.main-content { width: min(1120px, calc(100% - 220px)); margin-left: 220px; padding: 42px clamp(24px, 5vw, 72px) 60px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.eyebrow { margin: 0 0 11px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(29px, 4vw, 43px); font-weight: 700; letter-spacing: -.055em; }
.accent { color: var(--blue); }
.back-link { padding: 10px 13px; border: 1px solid #28436a; border-radius: 8px; background: #0d1d32; color: #c6d9f4; font-size: 9px; font-weight: 700; white-space: nowrap; }
.back-link span { padding-left: 6px; color: var(--blue); }
.welcome-card, .status-card, .calendar-section { border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(145deg,#0d1a2d,#091422); box-shadow: 0 12px 32px #02081238,inset 0 1px #ffffff08; }
.welcome-card { display: grid; grid-template-columns: 58px 1fr; gap: 22px; align-items: start; padding: clamp(22px, 4vw, 36px); }
.welcome-icon, .card-icon { display: grid; place-items: center; border: 1px solid #29538a; background: #102747; color: var(--blue); }
.welcome-icon { width: 52px; height: 52px; border-radius: 14px; font-size: 23px; box-shadow: 0 0 28px #1978e62b; }
.welcome-card h2 { margin-bottom: 10px; font-size: clamp(18px, 2.4vw, 24px); letter-spacing: -.035em; }
.welcome-card p:last-child { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.status-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; margin-top: 15px; }
.status-card { display: flex; min-height: 170px; flex-direction: column; align-items: flex-start; padding: 18px; }
.card-icon { width: 36px; height: 36px; margin-bottom: 18px; border-radius: 10px; font-size: 16px; }
.card-icon.purple { border-color: #4a408c; background: #25224e; color: var(--purple); }
.card-icon.green { border-color: #17684f; background: #0c3b32; color: var(--green); }
.card-label { margin-bottom: 8px; font-size: 8px; }
.status-card strong { margin-bottom: 7px; font-size: 11px; line-height: 1.5; }
.card-note { color: #8394ab; font-size: 9px; line-height: 1.6; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading .eyebrow { margin-bottom: 8px; }
.panel-heading h2 { margin-bottom: 0; font-size: 17px; letter-spacing: -.025em; }
.calendar-section { margin-top: 15px; padding: clamp(20px, 3vw, 28px); }
.add-event-button, .cancel-event-button { padding: 11px 14px; border: 1px solid #315994; border-radius: 8px; background: #102544; color: #dcecff; font-size: 10px; font-weight: 700; cursor: pointer; }
.add-event-button:hover { border-color: var(--blue); background: #15325a; }
.cancel-event-button { border-color: #34445a; background: #101a28; color: #b6c4d7; }
.calendar-feedback { min-height: 18px; margin: 14px 0 0; color: var(--green); font-size: 10px; }
.calendar-feedback:empty { display: none; }
.calendar-feedback.error { color: #ffb1a8; }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(240px, .75fr); gap: 20px; margin-top: 18px; }
.month-panel, .event-side-panel { min-width: 0; padding: 16px; border: 1px solid #1b2c43; border-radius: 10px; background: #081321; }
.month-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.month-toolbar h3 { margin: 0; color: #edf4ff; font-size: 15px; text-transform: capitalize; }
.month-nav { width: 34px; height: 34px; border: 1px solid #28436a; border-radius: 8px; background: #0d1d32; color: var(--blue); font-size: 17px; cursor: pointer; }
.month-nav:hover { border-color: var(--blue); }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.calendar-weekday { padding: 7px 0; color: #8095b2; font: 9px var(--mono); text-align: center; }
.calendar-empty { min-height: 58px; }
.calendar-day { position: relative; display: grid; min-width: 0; min-height: 58px; place-items: center; border: 1px solid transparent; border-radius: 8px; background: #0d1b2c; color: #dbe7f6; font: 11px var(--sans); cursor: pointer; }
.calendar-day:hover { border-color: #426697; background: #132744; }
.calendar-day.today { color: var(--blue); box-shadow: inset 0 0 0 1px #315994; }
.calendar-day.selected { border-color: var(--blue); background: #15325a; color: #fff; }
.event-count { position: absolute; right: 5px; bottom: 4px; display: grid; min-width: 15px; height: 15px; place-items: center; border-radius: 8px; background: #1c4d7e; color: #d8efff; font: 8px var(--mono); }
.event-side-panel { display: grid; align-content: start; gap: 22px; }
.event-list-section h3, .event-form h3 { margin: 0 0 11px; font-size: 12px; }
.event-list { display: grid; gap: 8px; }
.event-item { min-width: 0; padding: 11px; border: 1px solid #20344d; border-radius: 8px; background: #0c192a; }
.event-item-heading { display: flex; justify-content: space-between; gap: 10px; color: #e6f0ff; font-size: 10px; }
.event-item-heading strong { overflow-wrap: anywhere; }
.event-item-heading > span { flex: 0 0 auto; color: var(--blue); font: 9px var(--mono); }
.event-date, .event-description { margin: 7px 0 0; color: #91a4bc; font-size: 9px; line-height: 1.6; overflow-wrap: anywhere; }
.event-description { color: #c1ccdc; white-space: pre-wrap; }
.event-actions { display: flex; gap: 12px; margin-top: 9px; }
.event-actions button { padding: 0; border: 0; background: none; color: #99caff; font: 9px var(--sans); cursor: pointer; }
.event-actions button:last-child { color: #ffaaa1; }
.upcoming-date { display: block; margin-bottom: 5px; color: #8095b2; font: 8px var(--mono); }
.empty-events { margin: 0; color: #8192a9; font-size: 9px; line-height: 1.6; }
.event-form { margin-top: 18px; padding: 18px; border: 1px solid #28436a; border-radius: 10px; background: #081321; }
.event-form[hidden] { display: none; }
.event-form-fields { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 13px; }
.event-form-fields label { display: grid; gap: 7px; color: #9eb4d0; font: 8px var(--mono); letter-spacing: .08em; }
.event-form-fields input, .event-form-fields textarea { width: 100%; min-width: 0; padding: 10px; border: 1px solid #263a54; border-radius: 7px; background: #060e19; color: var(--text); font: 10px var(--sans); }
.event-form-fields input:focus, .event-form-fields textarea:focus { outline: 1px solid var(--blue); border-color: var(--blue); }
.event-form-fields textarea { resize: vertical; line-height: 1.6; }
.event-description-field { grid-column: 1 / -1; }
.event-form-actions { display: flex; gap: 9px; margin-top: 14px; }
.account-controls { display: flex; align-items: center; gap: 10px; }
.account-name { color: #c6d9f4; font-size: 9px; font-weight: 700; }
.logout-button { padding: 10px 12px; border: 1px solid #28436a; border-radius: 8px; background: #0d1d32; color: #c6d9f4; font: inherit; font-size: 9px; cursor: pointer; }
.logout-button:hover { border-color: var(--blue); }
.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; }
.auth-card { width: min(460px, 100%); padding: clamp(26px, 6vw, 46px); border: 1px solid var(--border); border-radius: 16px; background: linear-gradient(145deg,#0d1a2d,#091422); box-shadow: 0 18px 55px #02081270; }
.auth-brand { margin-bottom: 48px; }
.auth-card .eyebrow { margin-bottom: 12px; }
.auth-card h1 { margin-bottom: 16px; font-size: clamp(34px, 8vw, 48px); }
.auth-copy { margin-bottom: 26px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.auth-message { min-height: 0; margin-bottom: 14px; color: #ffc57a; font-size: 11px; line-height: 1.6; }
.auth-message:empty { display: none; }
.discord-login { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 15px 17px; border: 1px solid #5865f2; border-radius: 9px; background: #5865f2; color: #fff; font-size: 12px; font-weight: 800; transition: background .2s, transform .2s; }
.discord-login:hover { transform: translateY(-2px); background: #4752c4; }
.auth-back { display: inline-block; margin-top: 20px; color: #a9bad1; font-size: 10px; }
.auth-back:hover { color: #fff; }

@media (max-width: 800px) {
  .sidebar { width: 180px; }
  .main-content { width: calc(100% - 180px); margin-left: 180px; padding-inline: 22px; }
  .status-grid { grid-template-columns: 1fr; }
  .status-card { min-height: 145px; }
  .calendar-layout { grid-template-columns: 1fr; }
}
@media (max-width: 580px) {
  .sidebar { position: static; width: auto; min-height: auto; padding: 13px 17px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0; }
  .sidebar-caption, .side-link, .sidebar-status { display: none; }
  .main-content { width: 100%; margin: 0; padding: 28px 18px 42px; }
  .topbar { align-items: flex-start; flex-direction: column; margin-bottom: 22px; }
  .back-link { align-self: flex-start; }
  .account-controls { flex-wrap: wrap; }
  .welcome-card { grid-template-columns: 1fr; gap: 16px; }
  .status-grid { gap: 10px; }
  .calendar-section { padding: 18px 12px; }
  .calendar-section > .panel-heading { align-items: flex-start; flex-direction: column; }
  .month-panel, .event-side-panel { padding: 11px; }
  .calendar-grid { gap: 3px; }
  .calendar-empty, .calendar-day { min-height: 42px; }
  .event-form-fields { grid-template-columns: 1fr 1fr; }
  .event-title-field, .event-description-field { grid-column: 1 / -1; }
}
