:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --text: #151515;
  --muted: #666666;
  --border: #d8d8d2;
  --accent: #111111;
  --soft: #efefea;
  --danger: #262626;
  --shadow: 0 12px 24px rgba(0, 0, 0, 0.05);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Nunito, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 24px 100px;
}

.topbar {
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.topbar p {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 500;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.next-event-card {
  grid-column: 1 / 3;
}

.tasks-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

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

.card-header h2 {
  font-size: 1.12rem;
  font-weight: 800;
}

.next-event-content {
  min-height: 76px;
  padding: 14px;
  background: var(--soft);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.event-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.event-title {
  font-size: 1.02rem;
  font-weight: 800;
}

.event-meta,
.event-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.priority-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fafaf8;
}

.priority-group h3 {
  font-size: 0.96rem;
  margin-bottom: 10px;
  font-weight: 700;
}

.task-list,
.event-list {
  display: grid;
  gap: 8px;
}

.task-item,
.event-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-delete,
.event-delete {
  border: 0;
  background: transparent;
  color: var(--danger);
  font-weight: 800;
  cursor: pointer;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.calendar-cell {
  min-height: 88px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.calendar-cell:hover {
  border-color: #8e8e8e;
  background: #f9f9f7;
}

.calendar-cell.inactive {
  opacity: 0.45;
}

.calendar-cell.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.day-number {
  font-weight: 700;
  font-size: 0.92rem;
}

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #222;
}

.day-events {
  margin-top: 14px;
}

.day-events h3 {
  margin-bottom: 10px;
  font-size: 0.96rem;
}

.empty-state {
  color: var(--muted);
}

.fab {
  position: fixed;
  right: 30px;
  bottom: 26px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 0;
  background: #111;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  z-index: 10;
  transition: transform 0.25s ease;
}

.fab:hover {
  transform: scale(1.07);
}

.fab-menu {
  position: fixed;
  right: 30px;
  bottom: 26px;
  width: 62px;
  height: 62px;
  pointer-events: none;
  z-index: 9;
}

.fab-action {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid #1a1a1a;
  background: #fff;
  color: #121212;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.08);
  position: absolute;
  right: 5px;
  bottom: 5px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(0) scale(0.6);
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.fab-menu.open .fab-action {
  opacity: 1;
  pointer-events: auto;
}

.fab-menu.open .fab-action-event {
  transform: translateY(-78px) scale(1);
}

.fab-menu.open .fab-action-task {
  transform: translateY(-138px) scale(1);
}

.fab-action:hover {
  background: #f1f1ee;
}

.create-dialog {
  width: min(760px, 92vw);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
}

.create-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.dialog-content {
  padding: 20px;
  display: grid;
  gap: 14px;
  background: #fff;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-group {
  display: grid;
  gap: 8px;
}

input,
textarea,
select,
button {
  font-family: inherit;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 10px;
  font-size: 0.96rem;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.time-wheel-group {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.wheel-select {
  height: 52px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  background: #f6f6f2;
  border: 1px solid #cfcfc7;
  appearance: auto;
}

.time-separator {
  font-size: 1.6rem;
  font-weight: 800;
  color: #222;
  line-height: 1;
}

.duration-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.duration-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.duration-field span {
  font-weight: 700;
  color: var(--muted);
}

.chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  background: #fbfbf8;
}

.chip input {
  width: auto;
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.primary-btn,
.ghost-btn {
  border: 1px solid #151515;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-weight: 700;
}

.primary-btn {
  color: #fff;
  background: #111;
}

.ghost-btn {
  background: #fff;
  color: #111;
}

.hidden {
  display: none;
}

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

  .next-event-card {
    grid-column: 1;
  }
}

@media (max-width: 720px) {
  .inline-fields {
    grid-template-columns: 1fr;
  }

  .duration-group {
    grid-template-columns: 1fr;
  }

  .calendar-cell {
    min-height: 72px;
  }
}
