:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #65758b;
  --border: #d8e0ea;
  --primary: #1f6feb;
  --primary-dark: #1557bd;
  --danger: #c93535;
  --danger-dark: #a72828;
  --warning-bg: #fff4d8;
  --warning-border: #f1c765;
  --shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.login-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 18px;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}

.login-card h1,
.app-header h1,
.panel-card h2,
.modal h2 {
  margin: 0;
}

.login-card h1 {
  font-size: 32px;
}

.form-stack,
.modal-form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 12px 13px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

textarea {
  resize: vertical;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.view-buttons button {
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 750;
}

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

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

.secondary-button,
.view-buttons button {
  background: #eef3fb;
  color: var(--text);
}

.ghost-button {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
}

.danger-button {
  background: var(--danger);
  color: #fff;
}

.danger-button:hover {
  background: var(--danger-dark);
}

.full-width {
  width: 100%;
}

.error-message {
  margin: 0;
  min-height: 20px;
  color: var(--danger);
  font-weight: 650;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(18px, env(safe-area-inset-top)) 22px 14px;
}

.app-header h1 {
  font-size: clamp(25px, 5vw, 36px);
  letter-spacing: -0.04em;
}

.app-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.warning-card {
  margin: 0 22px 16px;
  padding: 12px 14px;
  border: 1px solid var(--warning-border);
  border-radius: 14px;
  background: var(--warning-bg);
  color: #6a4a00;
  font-weight: 650;
}

.app-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  padding: 0 22px 22px;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

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

.panel-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.panel-card h2 {
  font-size: 18px;
}

.calendar-card {
  min-width: 0;
  padding: 16px;
}

.people-filters {
  display: grid;
  gap: 10px;
}

.person-filter,
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 700;
}

.person-filter input,
.checkbox-row input {
  width: auto;
}

.color-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.view-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.fc {
  --fc-border-color: var(--border);
  --fc-button-bg-color: var(--primary);
  --fc-button-border-color: var(--primary);
  --fc-button-hover-bg-color: var(--primary-dark);
  --fc-button-hover-border-color: var(--primary-dark);
  --fc-today-bg-color: rgba(31, 111, 235, 0.08);
  font-size: 14px;
}

.fc .fc-toolbar-title {
  font-size: clamp(18px, 4vw, 25px);
}

.fc-event {
  border-radius: 9px;
  padding: 2px 4px;
}

.evento-concluido {
  opacity: 0.68;
  text-decoration: line-through;
}

.modal {
  width: min(620px, calc(100% - 24px));
  border: 0;
  border-radius: 22px;
  padding: 0;
  box-shadow: 0 30px 90px rgba(23, 32, 51, 0.25);
}

.modal::backdrop {
  background: rgba(23, 32, 51, 0.45);
}

.modal-form {
  padding: 22px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-header {
  justify-content: space-between;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #eef3fb;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.spacer {
  flex: 1;
}

.people-settings-list {
  display: grid;
  gap: 12px;
}

.person-settings-row {
  display: grid;
  grid-template-columns: 1fr 2fr 56px 78px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.person-settings-row strong {
  font-size: 15px;
}

.person-settings-row input[type="checkbox"] {
  width: auto;
  justify-self: center;
}

.person-settings-row input[type="color"] {
  height: 42px;
  padding: 4px;
}

.notification-fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.notification-fieldset legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 800;
}

.notification-fieldset .small-text {
  margin: 0;
}

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

  .side-panel {
    grid-template-columns: 1fr;
  }

  .people-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
    padding-left: 14px;
    padding-right: 14px;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-actions button {
    flex: 1;
  }

  .warning-card,
  .app-layout {
    margin-left: 0;
    margin-right: 0;
    padding-left: 12px;
    padding-right: 12px;
  }

  .calendar-card,
  .panel-card {
    border-radius: 16px;
    padding: 12px;
  }

  .small-only-hidden {
    display: none;
  }

  .form-grid,
  .person-settings-row {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-wrap: wrap;
  }

  .modal-actions button {
    flex: 1 1 auto;
  }

  .fc .fc-toolbar.fc-header-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }
}

.small-text {
  font-size: 13px;
  margin-top: 4px;
}

.users-settings-list {
  display: grid;
  gap: 12px;
}

.user-settings-row {
  display: grid;
  grid-template-columns: 1.4fr 1.6fr 92px 140px;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.user-title {
  display: grid;
  gap: 3px;
}

.user-title span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .user-settings-row {
    grid-template-columns: 1fr;
  }
}

/* v1.7 - leitura mais completa dos eventos no calendário */
.fc .fc-event,
.fc .fc-daygrid-event,
.fc .fc-timegrid-event,
.fc .fc-list-event-title {
  cursor: pointer;
}

.fc .fc-daygrid-event,
.fc .fc-list-event-title a {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--text) !important;
}

.fc-family-event {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-weight: 800;
  line-height: 1.25;
}

.fc-family-event-dot {
  width: 12px;
  height: 12px;
  min-width: 12px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.22), 0 1px 4px rgba(15, 23, 42, 0.25);
}

.fc-family-event-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc .fc-timegrid-event .fc-family-event {
  color: #ffffff;
}

.fc .fc-timegrid-event .fc-family-event-dot {
  width: 14px;
  height: 14px;
  min-width: 14px;
}

@media (max-width: 640px) {
  .fc-family-event {
    font-size: 12px;
    gap: 5px;
  }

  .fc-family-event-dot {
    width: 11px;
    height: 11px;
    min-width: 11px;
  }
}
