:root {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d8deea;
  --primary: #2563eb;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea {
  font: inherit;
}
button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.hidden { display: none !important; }
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  box-shadow: 0 16px 40px rgba(16, 24, 40, .08);
}
.login-panel h1 { margin: 0 0 18px; }
.login-panel button { width: 100%; margin-top: 12px; }
.login-panel p { color: var(--danger); min-height: 22px; }
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px 1fr;
}
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
}
.brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.brand h1 { margin: 0; font-size: 24px; }
.brand p { margin: 4px 0 0; color: var(--muted); }
.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.file-button {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.file-button input { display: none; }
.sidebar h2 { margin: 12px 0 0; font-size: 16px; }
.day-events { display: flex; flex-direction: column; gap: 8px; }
.event-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  cursor: pointer;
}
.event-card strong { display: block; }
.event-card span { color: var(--muted); font-size: 13px; }
.calendar { min-width: 0; padding: 18px; display: flex; flex-direction: column; }
.calendar-header {
  display: grid;
  grid-template-columns: 44px 1fr 44px auto;
  gap: 10px;
  align-items: center;
}
.calendar-header h2 { margin: 0; text-align: center; }
.weekdays, .month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays {
  padding: 14px 0 8px;
  color: var(--muted);
  text-align: center;
}
.month-grid {
  flex: 1;
  min-height: 620px;
  border: 1px solid var(--line);
  border-right: 0;
  border-bottom: 0;
  background: var(--line);
}
.day {
  min-height: 112px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 8px;
  overflow: hidden;
}
.day.other { background: #f0f3f8; color: #98a2b3; }
.day.selected { outline: 2px solid var(--primary); outline-offset: -2px; }
.day.today .date {
  background: var(--primary);
  color: #fff;
}
.day-head { display: flex; justify-content: space-between; align-items: center; }
.date {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 999px;
  font-weight: 650;
}
.mini-add { width: 28px; height: 28px; padding: 0; }
.chip {
  display: block;
  margin-top: 6px;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
dialog {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
}
dialog::backdrop { background: rgba(15, 23, 42, .28); }
#eventForm {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#eventForm h2 { margin: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 3px solid transparent;
}
.swatch.active { border-color: #111827; }
menu {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  margin: 0;
  padding: 0;
}
.danger { color: var(--danger); border-color: #fecaca; }
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { max-height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .calendar { padding: 12px; }
  .month-grid { min-height: 560px; }
  .day { min-height: 92px; padding: 6px; }
}
