/* Calendário — estilos */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f8;
  --bg-hover: #eceef2;
  --line: #dfe2e8;
  --text: #1c2330;
  --muted: #5d6675;
  --primary: #1d6fd8;
  --primary-dark: #1557ad;
  --danger: #b42318;
  --ok: #0b7a55;
  --radius: 8px;
  --shadow: 0 8px 30px rgba(15, 23, 42, .16);
  --side-w: 280px;
  --fc-border-color: var(--line);
  --fc-today-bg-color: rgba(29, 111, 216, .07);
  --fc-now-indicator-color: #d92d20;
  --fc-page-bg-color: var(--bg);
  --fc-neutral-bg-color: var(--bg-soft);
  --fc-list-event-hover-bg-color: var(--bg-soft);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary-dark); }
h1, h2 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--bg); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--text);
  font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); }
.icon-btn.small { width: 30px; height: 30px; font-size: 1.1rem; }
button.link { border: 0; background: none; padding: 0; font: inherit; color: var(--primary-dark); text-decoration: underline; cursor: pointer; }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label, .form .label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9rem; }
.form label small { font-weight: 400; color: var(--muted); }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=number],
.form input[type=date], .form input[type=time], .form select, .form textarea {
  width: 100%; min-height: 38px; padding: 7px 10px;
  border: 1px solid #b8bec9; border-radius: var(--radius);
  background: var(--bg); color: var(--text); font: inherit; font-weight: 400;
}
.form textarea { resize: vertical; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 1rem; }
.form input[type=checkbox], .form input[type=radio] { width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.form input[type=color] { width: 44px; height: 32px; padding: 2px; border: 1px solid #b8bec9; border-radius: 6px; background: var(--bg); }
.form .btn { align-self: flex-start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.choices { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.choices legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.choices label { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; font-size: 1rem; }
.choices p { margin: 0; font-size: .9rem; }
.form-error { margin: 0; padding: 8px 12px; border-radius: var(--radius); background: #fdecea; color: #8a1c13; }

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-success { background: #e4f5ee; color: #075e41; }
.alert-error { background: #fdecea; color: #8a1c13; }

/* ---------- páginas simples (login, configurações, administração) ---------- */
body.page { background: var(--bg-soft); min-height: 100%; display: flex; flex-direction: column; }
.page-bar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 10px 20px; background: var(--bg); border-bottom: 1px solid var(--line); }
.page-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.page-nav form { margin: 0; }
.page-main { width: 100%; max-width: 860px; margin: 0 auto; padding: 28px 20px; flex: 1; }
.page-foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: var(--primary); box-shadow: inset 0 6px 0 rgba(255, 255, 255, .35); }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin-bottom: 20px; }
.card.narrow { max-width: 400px; margin: 6vh auto 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.danger-zone { border-color: #f0c4bf; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--muted); margin: 0; }
.checks { list-style: none; padding: 0; margin: 0 0 20px; }
.checks .ok { color: var(--ok); }
.checks .fail { color: var(--danger); font-weight: 600; }
.card .form h2 { margin: 12px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.card .form h2 + p { margin: 0; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table td.right { text-align: right; }

/* ---------- tela do calendário ---------- */
body.app { display: flex; height: 100%; overflow: hidden; }
.side {
  width: var(--side-w); flex: none; height: 100%;
  display: flex; flex-direction: column; gap: 16px;
  padding: 16px; background: var(--bg-soft); border-right: 1px solid var(--line); overflow-y: auto;
}
.goto { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.goto input { min-height: 36px; padding: 6px 10px; border: 1px solid #b8bec9; border-radius: var(--radius); font: inherit; color: var(--text); background: var(--bg); }
.side-section { flex: 1; min-height: 0; }
.side-title { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cal-list { list-style: none; margin: 4px 0 0; padding: 0; }
.cal-list li { display: flex; align-items: center; gap: 2px; border-radius: var(--radius); }
.cal-list li:hover { background: var(--bg-hover); }
.cal-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 8px; border: 0; border-radius: var(--radius); background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.cal-toggle[aria-checked=false] .cal-name { color: var(--muted); }
.cal-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 16px; height: 16px; flex: none; border-radius: 50%; border: 2px solid; }
.side-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .92rem; }
.side-foot form { margin: 0; }
.who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-backdrop { position: fixed; inset: 0; z-index: 29; background: rgba(15, 23, 42, .4); }

.main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.nav-group { display: flex; align-items: center; gap: 2px; }
.top-title { flex: 1; min-width: 8ch; margin: 0; font-size: 1.2rem; }
.top-title::first-letter { text-transform: uppercase; }
.views { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.views button { min-height: 36px; padding: 0 12px; border: 0; border-left: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.views button:first-child { border-left: 0; }
.views button:hover { background: var(--bg-hover); }
.views button[aria-pressed=true] { background: var(--primary); color: #fff; }
.cal-wrap { flex: 1; min-height: 0; }
.only-mobile { display: none; }

/* FullCalendar */
.fc { font-size: .9rem; }
.fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number, .fc .fc-list-day-text, .fc .fc-list-day-side-text,
.fc .fc-multimonth-title, .fc a.fc-daygrid-week-number { color: var(--text); text-decoration: none; }
.fc .fc-col-header-cell-cushion { padding: 8px 4px; text-transform: capitalize; font-weight: 600; }
.fc .fc-scrollgrid { border-left: 0; border-top: 0; }
.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number { background: var(--primary); color: #fff; border-radius: 999px; min-width: 26px; text-align: center; margin: 2px; }
.fc .fc-event { cursor: pointer; border-radius: 5px; }
.fc .fc-daygrid-event { padding: 1px 4px; }
.fc .fc-daygrid-dot-event { color: var(--text); }
.fc .ev-cancelled .fc-event-title, .fc .ev-cancelled .fc-list-event-title { text-decoration: line-through; }
.fc .ev-cancelled { opacity: .6; }
.fc .ev-tentative { opacity: .8; background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .28) 0 6px, transparent 6px 12px); }
.fc .fc-highlight { background: rgba(29, 111, 216, .14); }
.fc .fc-list-event-title a { color: var(--text); }
.fc .fc-timegrid-slot { height: 2.1em; }

/* ---------- editor de evento ---------- */
.editor {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(420px, 100vw); background: var(--bg);
  border-left: 1px solid var(--line); box-shadow: var(--shadow);
}
.editor form { height: 100%; gap: 0; }
.editor-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.editor-head h2 { margin: 0; }
.editor-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.editor-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.editor-foot .btn { align-self: auto; }
.when { display: flex; flex-direction: column; gap: 10px; }
.when-row { display: flex; gap: 8px; }
.when-row input[type=time] { flex: 0 0 120px; }

.dialog { width: min(420px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 12px; padding: 20px; color: var(--text); background: var(--bg); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(15, 23, 42, .4); }
.dialog .editor-foot { padding: 4px 0 0; border: 0; }
.dialog p { margin: 0; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch[aria-pressed=true] { border-color: var(--bg); box-shadow: 0 0 0 2px var(--text); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: var(--radius); background: #1c2330; color: #fff; box-shadow: var(--shadow); }

/* ---------- telas pequenas ---------- */
@media (max-width: 860px) {
  .only-mobile { display: inline-flex; }
  .side { position: fixed; top: 0; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .top { padding: 8px 10px; gap: 8px; }
  .top-title { font-size: 1.05rem; order: 3; flex-basis: 100%; }
  .views { margin-left: auto; }
  .views button { padding: 0 9px; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .side { transition: none; }
}
