:root {
  color-scheme: light;
  --ink: #21213a;
  --muted: #8d8da4;
  --line: #eeedf4;
  --purple: #7657e8;
  --lavender: #f0edff;
  --surface: #fff;
  --bg: #f6f6fb;
  --shadow: 0 18px 55px rgba(45, 37, 89, .07);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.app-shell { max-width: 1440px; min-height: 100vh; margin: 0 auto; padding: 0 42px 36px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #eae9f1; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: -.8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(145deg, #927cff, #6745dc); display: grid; grid-template-columns: repeat(2, 5px); grid-template-rows: repeat(2, 5px); align-content: center; justify-content: center; gap: 4px; box-shadow: 0 5px 13px #7657e84a; }
.brand-mark span { background: #fff; border-radius: 2px; }
.topbar-right { display: flex; align-items: center; gap: 24px; }
.today-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.primary-button { border: 0; border-radius: 12px; color: #fff; background: linear-gradient(135deg, #8468f1, #7050df); font-weight: 700; box-shadow: 0 7px 16px #7657e833; transition: transform .16s ease, box-shadow .16s ease; }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px #7657e844; }
.top-add { padding: 12px 17px; font-size: 12px; }
.plus { font-size: 18px; vertical-align: -1px; margin-right: 4px; font-weight: 500; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 338px; gap: 24px; padding-top: 29px; align-items: stretch; }
.calendar-panel, .agenda-panel { background: var(--surface); border: 1px solid #eeedf5; border-radius: 22px; box-shadow: var(--shadow); }
.calendar-panel { padding: 30px 32px 20px; }
.calendar-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.eyebrow { color: #a2a0b5; font-size: 9px; letter-spacing: 1.35px; font-weight: 800; margin: 0 0 7px; }
h1, h2, p { margin-top: 0; }
.calendar-heading h1 { margin: 0; font-size: 27px; font-weight: 800; letter-spacing: -1px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #6c6a82; font-size: 21px; line-height: 1; }
.icon-button:hover { background: #f7f5ff; color: var(--purple); }
.today-button { height: 34px; padding: 0 13px; border: 1px solid #e8e4ff; border-radius: 10px; color: var(--purple); background: #f7f5ff; font-size: 11px; font-weight: 800; margin-left: 4px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekday-row { color: #a5a4b7; font-size: 9px; font-weight: 800; letter-spacing: .75px; text-align: center; padding-bottom: 10px; }
.days-grid { border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.day-cell { min-width: 0; min-height: 102px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 9px 8px 6px; background: #fff; text-align: left; position: relative; transition: background .12s ease; }
.day-cell:hover { background: #faf9ff; }
.day-cell.other-month { background: #fcfcfe; }
.day-cell.other-month .day-number { color: #c5c4d0; }
.day-cell.selected { background: #fbfaff; box-shadow: inset 0 0 0 1.5px #8a71ef; z-index: 1; }
.day-cell.today .day-number { color: #fff; background: var(--purple); }
.day-number { width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center; color: #58576f; font-size: 11px; font-weight: 700; }
.day-events { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.event-chip { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-radius: 5px; padding: 3px 5px; color: #684ad0; background: #f0edff; font-size: 9px; font-weight: 700; line-height: 1.4; }
.event-chip.blue { color: #3970c4; background: #eaf2ff; }
.event-chip.green { color: #31836a; background: #e9f7f1; }
.event-chip.orange { color: #bf7540; background: #fff2e8; }
.more-events { color: #9290a6; font-size: 9px; font-weight: 700; padding-left: 4px; }
.calendar-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 17px; }
.legend { display: flex; gap: 18px; color: #88879c; font-size: 10px; font-weight: 700; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--purple); }
.legend-dot.blue { background: #5e91e4; }
.reminder-note { color: #aaa8b9; font-size: 9px; font-weight: 600; }
.reminder-note span { color: var(--purple); font-size: 14px; margin-right: 4px; vertical-align: -1px; }
.agenda-panel { padding: 26px 22px 20px; display: flex; flex-direction: column; min-height: 555px; }
.agenda-top { display: flex; justify-content: space-between; align-items: flex-start; }
.agenda-top h2 { margin: 0; font-size: 20px; letter-spacing: -.5px; }
.event-count { min-width: 24px; height: 24px; padding: 0 7px; border-radius: 8px; display: grid; place-items: center; color: var(--purple); background: var(--lavender); font-size: 10px; font-weight: 800; }
.agenda-list { padding-top: 16px; flex: 1; }
.agenda-empty { min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #a6a4b8; }
.empty-icon { width: 55px; height: 55px; display: grid; place-items: center; border-radius: 18px; background: #f6f4ff; color: #8974e8; font-size: 25px; margin-bottom: 13px; }
.agenda-empty strong { color: #77758c; font-size: 12px; }
.agenda-empty p { max-width: 190px; margin: 6px 0 0; font-size: 10px; line-height: 1.6; }
.agenda-event { display: flex; gap: 12px; width: 100%; padding: 13px 0; text-align: left; border: 0; border-bottom: 1px solid #f0eff5; background: transparent; }
.event-timeline { width: 3px; flex: 0 0 3px; border-radius: 3px; background: var(--purple); margin: 2px 0; }
.agenda-event.blue .event-timeline { background: #5e91e4; }
.agenda-event.green .event-timeline { background: #4aa88b; }
.agenda-event.orange .event-timeline { background: #e29955; }
.agenda-event-content { min-width: 0; }
.agenda-event-title { display: block; color: #36354c; font-size: 11px; font-weight: 800; overflow-wrap: anywhere; }
.agenda-event-meta { display: block; color: #a09eaf; font-size: 9px; font-weight: 600; margin-top: 5px; }
.quick-tip { display: flex; gap: 11px; padding: 13px; margin: 12px 0 15px; border: 1px solid #efedfa; border-radius: 13px; background: linear-gradient(135deg, #fbfaff, #f8f7ff); }
.tip-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; color: #7557e2; background: #efebff; border-radius: 9px; }
.quick-tip strong { color: #55536c; font-size: 10px; }
.quick-tip p { margin: 4px 0 0; color: #9997aa; font-size: 9px; line-height: 1.55; }
.secondary-button { border: 1px solid #e9e6fa; border-radius: 11px; background: #fff; color: var(--purple); font-size: 10px; font-weight: 800; }
.secondary-button:hover { background: #faf9ff; }
.add-from-agenda { width: 100%; padding: 11px; }
.add-from-agenda span { font-size: 15px; margin-right: 4px; vertical-align: -1px; }
.load-error { min-height: 20px; padding: 0 6px; color: #bd4760; font-size: 11px; }
.event-dialog { width: min(500px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 22px; color: var(--ink); box-shadow: 0 25px 100px #25204433; }
.event-dialog::backdrop { background: #201c34a3; backdrop-filter: blur(4px); }
.event-dialog form { padding: 26px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 21px; }
.dialog-head h2 { margin: 0; font-size: 20px; letter-spacing: -.6px; }
.close-dialog { border: 0; background: #f5f4f9; font-size: 20px; }
.field-label { display: block; margin-bottom: 7px; color: #77758d; font-size: 10px; font-weight: 800; }
.text-input { width: 100%; min-width: 0; height: 42px; border: 1px solid #eae9f1; border-radius: 10px; outline: 0; padding: 0 11px; color: #35344d; background: #fff; font-size: 11px; }
.text-input:focus { border-color: #9d8aef; box-shadow: 0 0 0 3px #8970e91b; }
.text-input::placeholder { color: #bfbdcb; }
#eventForm > .text-input { margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; margin-bottom: 14px; }
.field-wrap { display: block; flex: 1; min-width: 0; }
.checkbox-wrap { align-self: flex-end; display: flex; align-items: center; gap: 8px; height: 42px; color: #77758d; font-size: 10px; font-weight: 700; white-space: nowrap; }
.checkbox-wrap input { position: absolute; opacity: 0; }
.checkmark { width: 17px; height: 17px; border: 1px solid #dcd9e9; border-radius: 5px; background: #fff; }
.checkbox-wrap input:checked + .checkmark { border-color: var(--purple); background: var(--purple); box-shadow: inset 0 0 0 4px #fff; }
.form-hint { padding: 10px 12px; margin: 0; border-radius: 9px; color: #8b88a0; background: #f8f7fc; font-size: 9px; }
.dialog-actions { display: flex; align-items: center; gap: 9px; margin-top: 19px; }
.action-spacer { flex: 1; }
.plain-button, .delete-button { border: 0; background: transparent; color: #89879c; font-size: 10px; font-weight: 800; padding: 10px; }
.delete-button { color: #cf5267; }
.save-button { padding: 11px 18px; font-size: 10px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 12px; background: #27253d; color: #fff; font-size: 11px; font-weight: 700; box-shadow: 0 10px 35px #1e1a3a44; transition: .2s ease; z-index: 5; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 1000px) {
  .app-shell { padding: 0 22px 30px; }
  .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
  .calendar-panel { padding: 24px 22px 18px; }
  .day-cell { min-height: 88px; padding: 7px 5px; }
  .event-chip { font-size: 8px; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 12px 26px; }
  .topbar { height: 67px; }
  .topbar-right { gap: 10px; }
  .today-label { display: none; }
  .top-add { padding: 10px 12px; font-size: 10px; }
  .layout { grid-template-columns: 1fr; padding-top: 15px; }
  .calendar-panel { padding: 21px 14px 15px; border-radius: 18px; }
  .calendar-heading { margin-bottom: 18px; }
  .calendar-heading h1 { font-size: 22px; }
  .day-cell { min-height: 72px; padding: 5px 3px; }
  .weekday-row { font-size: 8px; }
  .day-number { width: 22px; height: 22px; font-size: 10px; }
  .event-chip { padding: 2px 3px; font-size: 7px; }
  .calendar-footer { align-items: flex-start; gap: 10px; flex-direction: column; }
  .agenda-panel { min-height: 0; padding: 21px 17px 16px; border-radius: 18px; }
  .agenda-list { min-height: 90px; }
  .agenda-empty { min-height: 130px; }
}
@media (max-width: 400px) {
  .app-shell { padding-inline: 8px; }
  .brand-name { font-size: 16px; }
  .brand-mark { width: 27px; height: 27px; }
  .calendar-panel { padding-inline: 9px; }
  .month-nav { gap: 4px; }
  .icon-button { width: 30px; height: 30px; }
  .today-button { height: 30px; padding-inline: 8px; font-size: 9px; }
  .day-cell { min-height: 65px; }
}
