:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #f0f3f9;
  --text: #161b26;
  --text-muted: #5c667a;
  --border: #e1e6f0;
  --primary: #3b5bfd;
  --primary-hover: #2d4ae0;
  --primary-soft: #eef2ff;
  --danger: #dc2626;
  --cat-conference: #7c3aed;
  --cat-meetup: #0d9488;
  --cat-workshop: #d97706;
  --cat-webinar: #2563eb;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(17, 24, 39, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.brand-name {
  display: block;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
}

.brand-sub {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-alt);
}

.btn-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.btn-danger:hover {
  background: #fee2e2;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  background: var(--surface-alt);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  font-size: 0.82rem;
  cursor: pointer;
}

.main-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  padding-top: 24px;
  padding-bottom: 36px;
}

.calendar-panel,
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.calendar-panel {
  padding: 20px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.month-title {
  margin: 0;
  font-size: 1.3rem;
  text-transform: capitalize;
}

.month-nav {
  display: flex;
  gap: 8px;
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-cell {
  min-height: 92px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 7px;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 0.15s, background 0.15s;
}

.day-cell:hover {
  border-color: #b7c5ff;
  background: #fafbff;
}

.day-cell.outside {
  background: var(--surface-alt);
  color: var(--text-muted);
  opacity: 0.65;
}

.day-cell.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 91, 253, 0.14);
}

.day-number {
  font-size: 0.82rem;
  font-weight: 600;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.day-cell.today .day-number {
  background: var(--primary);
  color: #fff;
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.day-pill {
  font-size: 0.72rem;
  line-height: 1.25;
  padding: 2px 5px;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  background: var(--primary);
}

.day-pill.cat-conference { background: var(--cat-conference); }
.day-pill.cat-meetup { background: var(--cat-meetup); }
.day-pill.cat-workshop { background: var(--cat-workshop); }
.day-pill.cat-webinar { background: var(--cat-webinar); }

.day-more {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding-left: 2px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  padding: 18px;
}

.card-title {
  margin: 0 0 12px;
  font-size: 1rem;
}

.card-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

.textarea {
  resize: vertical;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 0.8rem;
  cursor: pointer;
}

.chip.active {
  background: var(--primary-soft);
  border-color: #c7d2fe;
  color: var(--primary);
  font-weight: 600;
}

.events-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.event-item:hover {
  border-color: #b7c5ff;
  background: #fafbff;
}

.event-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.event-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.event-title {
  margin: 0 0 3px;
  font-size: 0.92rem;
  font-weight: 600;
}

.event-location {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
}

.badge.cat-conference { background: var(--cat-conference); }
.badge.cat-meetup { background: var(--cat-meetup); }
.badge.cat-workshop { background: var(--cat-workshop); }
.badge.cat-webinar { background: var(--cat-webinar); }

.empty-state {
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 18px 8px;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 16px 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal.hidden,
.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.modal-meta {
  margin: 0 0 12px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.modal-desc {
  margin: 0 0 18px;
  font-size: 0.94rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.84rem;
  font-weight: 500;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 920px) {
  .main-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .day-cell {
    min-height: 66px;
    padding: 4px;
  }
  .day-pill {
    font-size: 0.65rem;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
}
