/* Painel da Agenda do Casal — sem dependências externas (fontes incluídas em /admin/fonts). */

@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Lora"; src: url("fonts/Lora-Variable.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --ink: #14263a;
  --ink-soft: #3b4d61;
  --mute: #66768a;
  --paper: #f1f4f7;
  --card: #ffffff;
  --line: #d6dde5;
  --line-soft: #e8ecf1;
  --ok: #0b7a5e;
  --ok-bg: #e2f3ed;
  --warn: #7d5200;
  --warn-bg: #fcefc9;
  --bad: #b3261e;
  --bad-bg: #fbe5e3;
  --link: #1d4ed8;
  --side: #14263a;
  --side-text: #c9d4e0;
  --side-active: #ffffff;
  --side-hi: #ffffff;
  --side-mute: #8fa2b8;
  --side-hover: rgba(255, 255, 255, 0.07);
  --side-on: rgba(255, 255, 255, 0.13);
  --side-dot: #5d728a;
  --dot-ok: #3ec59d;
  --edge: #b9c4d0;
  --edge-hover: #8d9db0;
  --field: #ffffff;
  --btn: var(--ink);
  --btn-hover: #0c1a2a;
  --btn-text: #ffffff;
  --on-ok: #ffffff;
  --ev: #e6edf5;
  --ev-all: #dfeee6;
  --over: #eef3f9;
  --r-ctl: 6px;
  --r-card: 10px;
  --shadow: none;

  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  font-feature-settings: "calt", "kern";
}

a { color: var(--link); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.005em; }
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 22px; line-height: 1.25; }
h3 { font-size: 17px; line-height: 1.3; }
p { margin: 0; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }

:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------ login */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-box {
  width: min(100%, 380px);
}
.login-box h1 { margin-bottom: 8px; }
.login-box .lede { margin-bottom: 28px; }

/* ------------------------------------------------------------ shell */

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }

.side {
  background: var(--side);
  color: var(--side-text);
  padding: 28px 16px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { padding: 0 12px 28px; }
.brand b { display: block; font: 600 21px/1.2 var(--serif); color: var(--side-hi); }
.brand span { font-size: 13px; color: var(--side-mute); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--side-text);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: var(--r-ctl);
  font-weight: 500;
}
.nav a:hover { background: var(--side-hover); color: var(--side-hi); }
.nav a[aria-current="page"] { background: var(--side-on); color: var(--side-active); }
.nav a:focus-visible { outline-color: var(--side-hi); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: transparent; box-shadow: inset 0 0 0 1.5px var(--side-dot); }
.dot.ok { background: var(--dot-ok); box-shadow: none; }
.dot.warn { background: #f1b92c; box-shadow: none; }
.dot.off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--side-dot); }

.side-foot { margin-top: auto; padding: 0 12px; }
.side-foot button {
  background: none; border: 0; padding: 6px 0; color: var(--side-mute); font: inherit; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.side-foot button:hover { color: var(--side-hi); }
.side-foot button:focus-visible { outline-color: var(--side-hi); }

main:focus { outline: none; }
main { padding: 44px clamp(20px, 5vw, 64px) 96px; max-width: 920px; width: 100%; }

.page-head { margin-bottom: 32px; }
.lede { color: var(--ink-soft); max-width: 62ch; margin-top: 10px; }
.page-head .lede { font-size: 16px; }

.stack > * + * { margin-top: 32px; }
.stack-sm > * + * { margin-top: 16px; }

/* ------------------------------------------------------------ painéis e formulários */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 24px;
  box-shadow: var(--shadow);
}
.panel > h2 + .lede, .panel > h3 + .lede { margin-top: 6px; }
.panel .body { margin-top: 20px; }

.field + .field { margin-top: 16px; }
.field label, .field .label { display: block; font-weight: 600; margin-bottom: 6px; }
.field .hint { color: var(--mute); font-size: 13.5px; margin-top: 6px; max-width: 64ch; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--edge);
  border-radius: var(--r-ctl);
  background: var(--field);
  color: var(--ink);
  font: inherit;
}
input::placeholder { color: var(--mute); opacity: .8; }
input:hover, select:hover { border-color: var(--edge-hover); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--link); outline-offset: 0; border-color: var(--link); }
input[readonly] { background: var(--paper); }
.row { display: flex; gap: 8px; align-items: stretch; }
.row > input, .row > select { flex: 1; min-width: 0; }
.field + .grid2, .grid2 + .field { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 18px;
  border-radius: var(--r-ctl); border: 1px solid var(--btn);
  background: var(--btn); color: var(--btn-text);
  font: 600 14.5px/1 var(--sans);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
.btn.ghost { background: var(--field); color: var(--ink); border-color: var(--edge); }
.btn.ghost:hover { background: var(--paper); border-color: var(--edge-hover); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.btn.danger { background: var(--field); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.danger:hover { background: var(--bad-bg); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn.spin::before {
  content: ""; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; align-items: center; }

.link-btn { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--edge); position: relative; transition: background 0.15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--field); transition: transform 0.15s; }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--link); outline-offset: 2px; }

/* selos */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--line-soft); color: var(--ink-soft); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.note { border-radius: 8px; padding: 12px 14px; font-size: 14px; background: var(--line-soft); color: var(--ink-soft); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.bad { background: var(--bad-bg); color: var(--bad); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note b { font-weight: 600; }

details.help { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
details.help summary { cursor: pointer; font-weight: 600; }
details.help ol { margin: 12px 0 0; padding-left: 22px; color: var(--ink-soft); }
details.help li + li { margin-top: 6px; }

/* ------------------------------------------------------------ início: trilha de configuração */

.rail { list-style: none; margin: 0; padding: 0; }
.rail li { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 0 16px; padding-bottom: 28px; }
.rail li:last-child { padding-bottom: 0; }
.rail li::before {
  content: ""; position: absolute; left: 17px; top: 38px; bottom: 2px; width: 2px; background: var(--line);
}
.rail li.done::before { background: var(--ok); }
.rail li:last-child::before { display: none; }
.node {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 15px/1 var(--sans);
  background: var(--field); color: var(--mute); box-shadow: inset 0 0 0 2px var(--line);
}
.done .node { background: var(--ok); color: var(--on-ok); box-shadow: none; }
.attention .node { background: #f1b92c; color: #3d2a00; box-shadow: none; }
.rail h3 { padding-top: 5px; }
.rail .detail { color: var(--ink-soft); margin-top: 2px; overflow-wrap: anywhere; }
.rail .go { align-self: start; padding-top: 3px; }

.ready { margin-top: 28px; }

.agenda-list { list-style: none; margin: 0; padding: 0; }
.agenda-list li { display: flex; gap: 16px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.agenda-list li:first-child { border-top: 0; }
.agenda-list .when { width: 150px; flex: none; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.empty { color: var(--mute); }

/* ------------------------------------------------------------ listas (pessoas, pedidos, calendários) */

.items { list-style: none; margin: 0; padding: 0; }
.items > li { padding: 16px 0; border-top: 1px solid var(--line-soft); }
.items > li:first-child { border-top: 0; padding-top: 0; }
.items > li:last-child { padding-bottom: 0; }
.item-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.item-title { font-weight: 600; font-size: 16px; }
.item-sub { color: var(--ink-soft); font-size: 14px; margin-top: 2px; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 13px; background: var(--line-soft); color: var(--ink-soft); padding: 2px 10px; border-radius: 999px; }
.item-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form { margin-top: 14px; padding: 16px; background: var(--paper); border-radius: 8px; }
.quote { color: var(--ink-soft); font-style: italic; margin-top: 4px; overflow-wrap: anywhere; }

.radio-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.radio-list label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-ctl); cursor: pointer; }
.radio-list label:hover { border-color: var(--edge-hover); }
.radio-list input { margin-top: 3px; accent-color: var(--ink); }
.radio-list input:checked ~ span b { color: var(--ok); }
.radio-list small { display: block; color: var(--mute); }

.code-box { text-align: center; padding: 22px 16px; border: 1px dashed var(--edge-hover); border-radius: var(--r-card); background: var(--paper); }
.code-box .code { font: 600 34px/1.1 var(--sans); letter-spacing: 0.16em; font-variant-numeric: tabular-nums; margin: 8px 0 14px; user-select: all; }

.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; }

/* ------------------------------------------------------------ avisos */

#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 50; width: min(380px, calc(100vw - 32px)); }
.toast {
  background: var(--btn); color: var(--btn-text); padding: 12px 16px; border-radius: var(--r-ctl); box-shadow: 0 8px 24px rgba(10, 20, 35, 0.28);
  animation: rise 0.18s ease-out;
}
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: var(--on-ok); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.loading { color: var(--mute); padding: 40px 0; }

/* ------------------------------------------------------------ agenda e listas novas */

.cal-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.cal-title { margin: 0; font-size: 18px; }
.cal-title::first-letter { text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cal-day { background: var(--card); padding: 6px; min-height: 96px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-grid.mes .cal-day { min-height: 84px; }
.cal-grid.semana .cal-day { min-height: 220px; }
.cal-day.out { background: var(--paper); color: var(--mute); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--ink); }
.cal-day.over { background: var(--over); }
.dnum { all: unset; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-soft); }
.dnum:focus-visible, .ev:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.dnum .dow { font-weight: 400; color: var(--mute); }
.ev { all: unset; box-sizing: border-box; cursor: pointer; font-size: 12px; line-height: 1.3; padding: 2px 6px; border-radius: 4px; background: var(--ev); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-grid.semana .ev { white-space: normal; overflow: visible; padding: 4px 6px; }
.ev.all { background: var(--ev-all); }
.ev.ro { background: var(--line-soft); color: var(--ink-soft); font-style: italic; cursor: pointer; }
.ev:hover { filter: brightness(0.96); }
.status-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.status-list .dot, .log .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--mute); }
.status-list .dot.ok { background: var(--ok); }
.status-list .dot.off { background: transparent; box-shadow: inset 0 0 0 2px var(--mute); }
.status-list small { color: var(--mute); }
.log { list-style: none; margin: 0; padding: 0; font-size: 14px; max-height: 420px; overflow: auto; }
.log li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); overflow-wrap: anywhere; }
.log li.erro { color: var(--bad); }
.log time { color: var(--mute); margin-right: 8px; font-variant-numeric: tabular-nums; }
.log .origem { color: var(--ink-soft); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; }
.check .done { text-decoration: line-through; color: var(--mute); }

/* ------------------------------------------------------------ celular */

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 16px 0 0; flex-direction: column; }
  .brand { padding: 0 16px 12px; }
  .nav { flex-direction: row; overflow-x: auto; padding: 0 8px 10px; gap: 4px; scrollbar-width: none; }
  .nav a { flex: none; padding: 8px 12px; }
  .side-foot { display: none; }
  main { padding: 28px 16px 72px; }
  h1 { font-size: 27px; }
  .panel { padding: 18px; }
  .grid2 { grid-template-columns: 1fr; }
  .rail li { grid-template-columns: 36px minmax(0, 1fr); }
  .rail .go { grid-column: 2; padding-top: 8px; }
  .agenda-list li { flex-direction: column; gap: 0; }
  .agenda-list .when { width: auto; }
  .cal-grid.semana { grid-template-columns: minmax(0, 1fr); }
  .cal-grid.semana .cal-day { min-height: 0; }
  .cal-grid.mes .ev { font-size: 0; padding: 2px; width: 6px; height: 6px; display: inline-block; border-radius: 50%; }
  .row { flex-wrap: wrap; }
  .row .btn { flex: 1 1 100%; }
  .cal-bar .row { flex-wrap: nowrap; }
  .cal-bar .row .btn { flex: 0 0 auto; }
  .cal-bar .cal-title { order: -1; flex: 1 1 100%; }
  #toasts { right: 16px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
