:root {
  --bg: #111214;
  --surface: #181a1d;
  --surface-light: #202226;
  --surface-hover: #282b30;
  --border: #303338;
  --border-light: #41454c;
  --text: #e8e9eb;
  --silver: #b9bdc3;
  --muted: #858990;
  --dim: #62666d;
  --white: #f5f6f7;
  --font: "Manrope", sans-serif;
  --mono: "DM Mono", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea {
  font: inherit;
}

button {
  color: inherit;
}

.background-glow {
  position: fixed;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(140px);
  opacity: .08;
  pointer-events: none;
  z-index: -1;
}

.glow-one {
  top: 80px;
  left: -260px;
  background: #b5bdca;
}

.glow-two {
  right: -270px;
  top: 450px;
  background: #69727f;
}

.topbar {
  height: 75px;
  max-width: 1240px;
  margin: auto;
  padding: 0 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--white);
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.brand-icon {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(145deg, #d9dce1, #777c84);
  color: #17191c;
  font-size: 16px;
  box-shadow: 0 4px 18px rgba(180,190,205,.12);
}

.brand-muted {
  color: #777b82;
  font-weight: 500;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #777c84;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.1px;
}

.system-dot {
  width: 6px;
  height: 6px;
  background: #aab2bd;
  border-radius: 50%;
  box-shadow: 0 0 9px rgba(180,190,205,.4);
}

.main-container {
  width: min(100% - 48px, 1080px);
  margin: auto;
  padding: 76px 0 65px;
}

.page-heading {
  margin-bottom: 35px;
  animation: fade-up .65s ease both;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #9a9ea5;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.8px;
  margin-bottom: 17px;
}

.eyebrow-line {
  width: 21px;
  height: 1px;
  background: #aeb4bd;
}

.heading-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}

h1 {
  font-size: clamp(43px, 7vw, 67px);
  line-height: 1.08;
  letter-spacing: -3.5px;
  font-weight: 700;
}

h1 span {
  color: #888e97;
}

.subtitle {
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
}

.today-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 17px;
  border: 1px solid var(--border-light);
  border-radius: 7px;
  color: #d5d8dd;
  background: linear-gradient(145deg, #272a2f, #1b1d20);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease, transform .25s ease;
}

.today-button span {
  font-size: 16px;
  color: #c4cbd4;
}

.today-button:hover {
  background: #34383e;
  border-color: #727983;
  transform: translateY(-2px);
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(275px, .85fr);
  gap: 17px;
  align-items: stretch;
  animation: fade-up .75s .08s ease both;
}

.calendar-card,
.events-card {
  min-width: 0;
  background: linear-gradient(145deg, #1b1d20, #151619);
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 20px 60px rgba(0,0,0,.17);
}

.calendar-card {
  padding: 25px;
}

.calendar-header,
.events-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.section-label {
  color: #858a92;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.4px;
}

.calendar-header h2,
.events-header h2 {
  margin-top: 7px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.8px;
}

.month-controls {
  display: flex;
  gap: 7px;
}

.month-controls button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #222428;
  color: #bfc3c9;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.month-controls button:hover {
  background: #34383e;
  border-color: #707780;
  transform: translateY(-2px);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
  margin-top: 29px;
  padding-bottom: 12px;
  border-bottom: 1px solid #303338;
}

.calendar-weekdays span {
  text-align: center;
  color: #777d85;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .5px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px 5px;
  padding-top: 12px;
  animation: calendar-enter .28s ease both;
}

.day-cell {
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / .88;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #c4c7cc;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
}

.day-cell:hover:not(.empty-day) {
  background: #292c31;
  border-color: #41464e;
  transform: translateY(-2px);
}

.day-cell.other-month {
  color: #50545a;
}

.day-cell.today {
  color: #fff;
  background: #343940;
  border-color: #8b929d;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}

.day-cell.selected {
  color: #111214;
  background: linear-gradient(145deg, #e1e4e8, #a6acb5);
  border-color: #e1e4e8;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(190,198,210,.12);
}

.day-cell.today.selected {
  background: linear-gradient(145deg, #f2f3f5, #b5bbc4);
  border-color: #fff;
}

.day-cell .event-indicator {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #aab3bf;
}

.day-cell.selected .event-indicator {
  background: #343940;
}

.day-cell.today:not(.selected) .event-indicator {
  background: #e4e8ed;
}

.empty-day {
  pointer-events: none;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 19px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid #303338;
}

.calendar-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #777d85;
  font-size: 9px;
}

.calendar-legend i {
  width: 7px;
  height: 7px;
  display: inline-block;
  border-radius: 2px;
}

.legend-today {
  background: #aeb5bf;
}

.legend-event {
  background: #6f7782;
}

.legend-selected {
  background: #e2e5e9;
}

.events-card {
  display: flex;
  flex-direction: column;
  padding: 25px 21px 21px;
}

.event-count {
  min-width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid #444951;
  border-radius: 7px;
  background: #25282d;
  color: #d9dde3;
  font-family: var(--mono);
  font-size: 11px;
}

.selected-date {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 23px;
  padding: 13px;
  background: #22252a;
  border: 1px solid #343940;
  border-radius: 8px;
}

.date-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #cbd0d8, #747c87);
  color: #191b1e;
  border-radius: 7px;
  font-size: 18px;
}

.selected-date p {
  color: #8f959e;
  font-size: 10px;
}

.selected-date strong {
  display: block;
  margin-top: 4px;
  color: #e2e4e8;
  font-size: 11px;
  font-weight: 600;
}

.events-list {
  flex: 1;
  min-height: 180px;
  max-height: 340px;
  overflow-y: auto;
  padding: 14px 2px;
  scrollbar-width: thin;
  scrollbar-color: #444 #1a1b1e;
}

.empty-state {
  min-height: 165px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  animation: fade-up .3s ease both;
}

.empty-icon {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  color: #a8afb9;
  background: #292d33;
  border: 1px solid #3c424b;
  border-radius: 12px;
  font-size: 22px;
}

.empty-state strong {
  color: #c9cdd3;
  font-size: 12px;
  font-weight: 600;
}

.empty-state p {
  margin-top: 6px;
  color: #777d85;
  font-size: 10px;
}

.event-item {
  position: relative;
  margin-bottom: 9px;
  padding: 13px 12px;
  background: #22252a;
  border: 1px solid #343940;
  border-radius: 7px;
  animation: fade-up .3s ease both;
  transition: border-color .2s ease, background .2s ease;
}

.event-item:hover {
  background: #292d33;
  border-color: #555d68;
}

.event-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(#d7dce3, #737d8a);
}

.event-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.event-item h3 {
  color: #e3e5e8;
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.event-time {
  display: inline-block;
  margin-top: 5px;
  color: #a1a8b1;
  font-family: var(--mono);
  font-size: 9px;
}

.event-description {
  margin-top: 9px;
  color: #858b94;
  font-size: 10px;
  line-height: 1.6;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.event-actions {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.event-actions button {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid #41464e;
  border-radius: 5px;
  background: #2b2f35;
  color: #aeb4bd;
  font-size: 12px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}

.event-actions button:hover {
  background: #444a53;
  color: #fff;
}

.event-actions button.delete-event:hover {
  background: #4a3035;
  border-color: #76535b;
}

.add-event-button {
  width: 100%;
  height: 43px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  border: 1px solid #737b87;
  border-radius: 7px;
  background: linear-gradient(145deg, #d4d8df, #939ba6);
  color: #17191c;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}

.add-event-button span {
  font-size: 18px;
  font-weight: 400;
}

.add-event-button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(180,190,205,.1);
}

.bottom-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 23px;
  animation: fade-up .8s .16s ease both;
}

.info-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(255,255,255,.025);
  border: 1px solid #292c31;
  border-radius: 8px;
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}

.info-block:hover {
  background: rgba(255,255,255,.045);
  border-color: #444a53;
  transform: translateY(-3px);
}

.info-symbol {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 7px;
  background: #2a2e34;
  color: #c0c6cf;
  font-size: 17px;
}

.info-block strong {
  color: #d3d6db;
  font-size: 10px;
  font-weight: 700;
}

.info-block p {
  margin-top: 4px;
  color: #7a8089;
  font-size: 9px;
}

/* MODAL */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.event-modal {
  width: min(100%, 460px);
  padding: 25px;
  background: linear-gradient(145deg, #25282d, #181a1e);
  border: 1px solid #555b65;
  border-radius: 12px;
  box-shadow: 0 25px 90px rgba(0,0,0,.5);
  transform: translateY(15px) scale(.98);
  transition: transform .25s ease;
}

.modal-overlay.open .event-modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 25px;
}

.modal-header h2 {
  margin-top: 7px;
  color: #e9ebee;
  font-size: 21px;
  letter-spacing: -.5px;
}

.modal-close {
  width: 31px;
  height: 31px;
  border: 1px solid #484e57;
  border-radius: 6px;
  background: #30343a;
  color: #c4c9d0;
  font-size: 20px;
  cursor: pointer;
  transition: background .2s ease;
}

.modal-close:hover {
  background: #454b54;
}

.form-field {
  margin-bottom: 17px;
}

.form-field label {
  display: block;
  margin-bottom: 8px;
  color: #a7adb6;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
}

.form-field label span {
  color: #777e87;
  font-size: 8px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 12px;
  outline: none;
  color: #eceef1;
  background: #16181b;
  border: 1px solid #424750;
  border-radius: 6px;
  font-size: 11px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: #a9b1bd;
  box-shadow: 0 0 0 3px rgba(180,190,205,.08);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #60666f;
}

.form-field input[type="date"],
.form-field input[type="time"] {
  color-scheme: dark;
}

.form-field textarea {
  resize: vertical;
  min-height: 78px;
  line-height: 1.6;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 25px;
}

.cancel-button,
.save-button {
  min-height: 39px;
  padding: 0 15px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

.cancel-button {
  color: #c1c5cc;
  background: #30343a;
  border: 1px solid #484e57;
}

.cancel-button:hover {
  background: #41464e;
}

.save-button {
  color: #17191c;
  background: linear-gradient(145deg, #d9dde3, #9da5b0);
  border: 1px solid #d4d8df;
}

.save-button span {
  margin-left: 7px;
}

.save-button:hover {
  background: #eef0f3;
  transform: translateY(-2px);
}

/* TOAST */

.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 25px;
  padding: 11px 17px;
  border: 1px solid #4a515b;
  border-radius: 7px;
  background: #292d33;
  color: #e2e5e9;
  font-size: 11px;
  box-shadow: 0 10px 35px rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .25s ease, transform .25s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.footer {
  max-width: 1240px;
  margin: auto;
  padding: 22px 34px 27px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: #656a72;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  border-top: 1px solid rgba(255,255,255,.05);
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes calendar-enter {
  from {
    opacity: .4;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 850px) {
  .calendar-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .events-card {
    min-height: 350px;
  }

  .events-list {
    max-height: 300px;
  }
}

@media (max-width: 600px) {
  .topbar {
    height: 65px;
    padding: 0 19px;
  }

  .main-container {
    width: min(100% - 30px, 520px);
    padding: 55px 0 45px;
  }

  h1 {
    font-size: 44px;
    letter-spacing: -2.6px;
  }

  .subtitle {
    max-width: 230px;
    line-height: 1.6;
  }

  .today-button {
    padding: 9px 11px;
    font-size: 10px;
  }

  .calendar-card {
    padding: 18px 13px;
  }

  .events-card {
    padding: 20px 16px;
  }

  .calendar-header h2 {
    font-size: 19px;
  }

  .calendar-weekdays {
    gap: 2px;
  }

  .calendar-weekdays span {
    font-size: 8px;
  }

  .calendar-grid {
    gap: 4px 2px;
  }

  .day-cell {
    aspect-ratio: 1 / .95;
    font-size: 11px;
    border-radius: 5px;
  }

  .calendar-legend {
    gap: 12px;
  }

  .calendar-legend span {
    font-size: 8px;
  }

  .bottom-info {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .info-block {
    padding: 12px;
  }

  .footer {
    padding: 19px;
    font-size: 8px;
  }
}

@media (max-width: 370px) {
  .heading-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .today-button {
    align-self: flex-end;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}