/* Identidade visual do Portal Notarial (mesma da CPF-RF). */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --line: #e5e7eb;
  --line-strong: #cbd5e1;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eaf0ff;
  --brand-ink: #ffffff;
  --ok: #0d8f57;
  --error: #b42318;
  --radius: 14px;
  --shadow: 0 12px 30px rgba(2, 6, 23, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* Todos os controles usam a fonte do site (campos, menus e botões). */
input, select, textarea, button { font-family: inherit; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
  /* Conteúdo centralizado em 1170px, barra ocupando a largura toda. */
  padding: 0.6rem max(18px, calc((100% - 1170px) / 2));
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; min-width: 0; }
.brand-logo { display: block; height: 34px; width: auto; max-width: min(460px, 62vw); object-fit: contain; object-position: left center; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 9px;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 0.85rem;
}
.brand-name { font-weight: 800; color: var(--ink); }
.topnav { display: flex; align-items: center; flex-wrap: wrap; gap: 1.1rem; justify-content: flex-end; }
.topnav a { color: var(--ink); text-decoration: none; font-size: 0.95rem; font-weight: 600; opacity: 0.9; }
.topnav a:hover { color: var(--brand); opacity: 1; }

.content { max-width: 1100px; margin: 1.8rem auto; padding: 0 1.8rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.6rem;
  margin-bottom: 1.2rem;
}
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }

.pwd-wrap { position: relative; display: block; }
.pwd-wrap input { padding-right: 2.6rem; }
.pwd-eye {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1rem; opacity: 0.6;
}
.pwd-eye:hover { opacity: 1; }

h1 { font-size: 1.7rem; margin: 0 0 0.4rem; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.lead { color: var(--muted); font-size: 1rem; margin: 0.2rem 0 1rem; max-width: 640px; }

/* Eyebrow (pílula azul clara, estilo Portal/atesta) */
.eyebrow {
  display: inline-block; background: var(--brand-soft); color: var(--brand);
  font-weight: 700; font-size: 0.78rem; padding: 0.25rem 0.7rem;
  border-radius: 999px; margin-bottom: 0.7rem;
}

/* Lista de destaques com check azul */
.feature-list { display: grid; gap: 0.7rem; margin: 1.2rem 0; }
.feature {
  display: flex; gap: 0.6rem; align-items: flex-start;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem;
}
.feature .chk { color: var(--brand); font-weight: 800; flex: 0 0 auto; }
.feature span { color: var(--ink); }

.btn.block { display: block; width: 100%; text-align: center; }
.small { font-size: 0.85rem; }
.hint { display: block; color: var(--muted); font-size: 0.82rem; margin: -0.4rem 0 0.6rem; }
.hidden { display: none; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-title { display: flex; flex-direction: column; gap: 0.1rem; }
.page-title h1 { margin: 0; }
.page-title .eyebrow { margin-bottom: 0.3rem; }

.form { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 1rem; }
.form label { font-weight: 700; font-size: 0.9rem; margin-top: 0.5rem; color: #172f4b; }

/* Controle base: campos e menus ficam na mesma altura e fonte dos botões. */
.form input,
.form textarea,
.select,
.bk-cf,
.grid-2 input,
textarea {
  font-size: 1rem;
  line-height: 1.25;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}
.form input:focus,
.form textarea:focus,
.select:focus,
.bk-cf:focus,
textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  margin-top: 0.8rem;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }

.msg { margin-top: 0.8rem; font-size: 0.9rem; min-height: 1.2em; }
.msg.ok { color: var(--ok); }
.msg.error { color: var(--error); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.org-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.org-card h3 { margin: 0 0 0.2rem; font-size: 1.05rem; }

h2 { font-size: 1.25rem; margin: 0 0 0.6rem; font-weight: 800; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; }
.grid-2 .span-2 { grid-column: 1 / -1; }
.weekdays { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0.3rem 0; }
.weekdays label { display: inline-flex; align-items: center; gap: 0.25rem; font-weight: 500; font-size: 0.88rem; }
.grid-2 label { font-size: 0.85rem; }
.grid-2 input { width: 100%; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media (max-width: 720px) { .cols, .grid-2 { grid-template-columns: 1fr; } }

.list { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; }
.list-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.45rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; font-size: 0.92rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

.form.inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.form.inline input:not([type="checkbox"]):not([type="color"]):not([type="time"]):not([type="datetime-local"]) { flex: 1 1 180px; min-width: 150px; }
.form.inline .btn { margin-top: 0; }
.form.inline .select { flex: 0 0 auto; }

.page-head.wrap { flex-wrap: wrap; gap: 0.6rem; }
.controls { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.viewtoggle { display: inline-flex; gap: 0.3rem; }

.cal-nav { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cal-nav .btn.small { margin-top: 0; }
.cal-nav .nav-spacer { flex: 1; }
.cal-nav label { font-size: 0.85rem; color: var(--muted); display: flex; align-items: center; gap: 0.3rem; }
.cal-nav input, .cal-nav .select { padding: 0.4rem 0.55rem; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 0.9rem; }

/* Grade semanal estilo Google Calendar */
.week-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(96px, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: 70vh;
}
.wk-corner { position: sticky; top: 0; left: 0; z-index: 3; background: var(--surface); grid-column: 1; grid-row: 1; }
.wk-head {
  position: sticky; top: 0; z-index: 2; background: #f8fafc;
  grid-row: 1; text-align: center; font-size: 0.8rem; font-weight: 600;
  padding: 0.4rem 0.2rem; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.wk-head.today { background: #eef5ff; color: var(--brand); }
.wk-head { box-sizing: border-box; }
.wk-subhead {
  position: sticky; z-index: 2; background: #f8fafc; box-sizing: border-box;
  grid-row: 2; text-align: center; font-size: 0.7rem; font-weight: 600; color: var(--muted);
  padding: 0.25rem 0.2rem; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wk-time {
  grid-column: 1; font-size: 0.7rem; color: var(--muted); text-align: right;
  padding-right: 0.3rem; transform: translateY(-0.5em); border-right: 1px solid var(--line);
}
.wk-cell { border-left: 1px solid var(--line); border-bottom: 1px solid #eef1f5; cursor: pointer; }
.wk-cell:hover { background: #eef5ff; }
.wk-event {
  margin: 1px 2px; padding: 1px 4px; border-radius: 5px; overflow: hidden;
  background: var(--brand); color: #fff; font-size: 0.72rem; line-height: 1.15;
  position: relative; z-index: 1; cursor: default;
}
.wk-event.editable { cursor: pointer; }
.wk-event.editable:hover { filter: brightness(1.08); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.wk-event.blocked { background: #9ca3af; }
.wk-event strong { font-weight: 700; }
.wk-x { position: absolute; top: 0; right: 2px; background: none; border: none; color: #fff; cursor: pointer; font-size: 0.9rem; line-height: 1; }

.cal-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(160px, 1fr); gap: 0.8rem; overflow-x: auto; }
.cal-col header {
  font-weight: 600; font-size: 0.92rem; padding: 0.4rem 0.5rem; margin-bottom: 0.5rem;
  border-bottom: 3px solid var(--brand); background: #f8fafc; border-radius: 6px 6px 0 0;
}
.cal-card {
  display: flex; flex-direction: column; gap: 0.15rem;
  border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 6px; padding: 0.4rem 0.5rem; margin-bottom: 0.4rem; font-size: 0.85rem;
}
.cal-card.blocked { background: #f3f4f6; border-left-color: #9ca3af; color: var(--muted); }
.cal-card strong { font-size: 0.82rem; }
.link-btn { background: none; border: none; color: var(--error); cursor: pointer; padding: 0; font-size: 0.78rem; text-align: left; }

.list-row.between { justify-content: space-between; }
.row-actions { display: flex; gap: 0.4rem; align-items: center; }
.edit-row {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.4rem; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 0.4rem;
}
.edit-row input[type="text"], .edit-row input:not([type]) { flex: 1; min-width: 90px; padding: 0.4rem 0.55rem; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 0.9rem; }
.edit-row input[type="color"] { width: 36px; height: 34px; padding: 0; border: 1px solid var(--line-strong); border-radius: 8px; }
.edit-row .chk { display: flex; align-items: center; gap: 0.2rem; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.reorder { display: inline-flex; flex-direction: column; gap: 1px; }
.ord-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 4px; cursor: pointer; line-height: 1; font-size: 0.7rem; padding: 1px 4px; }
.ord-btn:disabled { opacity: 0.3; cursor: default; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.list-head h3 { margin: 0; }
.bk-custom { display: contents; }
.bk-cf { padding: 0.5rem 0.6rem; border: 1px solid var(--line); border-radius: 8px; min-width: 140px; }
.tpl { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.tpl h3 { margin: 0 0 0.5rem; }
.tpl label { display: block; font-weight: 600; font-size: 0.85rem; margin: 0.5rem 0 0.2rem; }
.tpl input, .tpl textarea { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--line-strong); border-radius: 10px; font-family: inherit; font-size: 1rem; }
.btn.small { padding: 0.4rem 0.7rem; font-size: 0.9rem; border-radius: 8px; margin-top: 0; }
.select.small { padding: 0.4rem 0.55rem; font-size: 0.9rem; border-radius: 8px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th, .table td { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--line); }
.table thead th { background: #f8fafc; font-weight: 600; }

.invite-banner { background: #eef5ff; border: 1px solid #cfe0fb; border-radius: var(--radius); padding: 0.8rem 1rem; margin-bottom: 1rem; }
.invite-banner button { margin-left: 0.5rem; }

.footer { text-align: center; color: var(--muted); font-size: 0.82rem; padding: 1.5rem; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .brand-logo { height: 26px; max-width: 80vw; }
}

/* Eventos coloridos legíveis sobre qualquer cor */
.wk-event.editable strong { text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }

/* Linha do "agora" no calendário semanal */
.wk-now {
  position: relative; z-index: 4; pointer-events: none; height: 0;
  border-top: 2px solid #ef4444; align-self: start;
}
.wk-now::before {
  content: ""; position: absolute; left: -4px; top: -5px;
  width: 8px; height: 8px; border-radius: 50%; background: #ef4444;
}

/* Visão Mês */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mo-head { background: #f8fafc; text-align: center; font-size: 0.78rem; font-weight: 600; padding: 0.4rem 0; color: var(--muted); }
.mo-cell { background: var(--surface); min-height: 96px; padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.mo-cell.out { background: #fafbfc; }
.mo-cell.today { background: #eef5ff; }
.mo-day { align-self: flex-start; background: none; border: none; font-weight: 600; font-size: 0.82rem; color: var(--ink); cursor: pointer; padding: 1px 4px; border-radius: 6px; }
.mo-day:hover { background: #e6eefc; }
.mo-cell.out .mo-day { color: var(--muted); }
.mo-chip { font-size: 0.7rem; color: #fff; background: var(--brand); border-radius: 5px; padding: 1px 4px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-chip.blocked { background: #9ca3af; cursor: default; }
.mo-more { font-size: 0.68rem; color: var(--muted); }
.cal-card.editable { cursor: pointer; }
.cal-card.editable:hover { background: #f3f7ff; }

/* Modal de detalhes */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 1.2rem 1.4rem; max-width: 460px; width: 100%; position: relative; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.modal-box h3 { margin: 0 0 0.6rem; }
.modal-close { position: absolute; top: 8px; right: 10px; background: none; border: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.dl { display: flex; flex-direction: column; gap: 0.35rem; }
.dl-row { display: grid; grid-template-columns: 38% 62%; gap: 0.5rem; font-size: 0.92rem; }
.dl-row dt { color: var(--muted); }
.dl-row dd { margin: 0; word-break: break-word; }
.btn.danger { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.btn.danger:hover { background: #fee2e2; }
.row-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }

/* Seletor de horários (agendamento público) */
.slots { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.2rem 0 0.4rem; }
.slot { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 0.45rem 0.7rem; cursor: pointer; font-size: 0.95rem; }
.slot:hover { border-color: var(--brand); }
.slot.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.public-link { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; margin-top: 0.4rem; }
.public-link code { background: #f1f5f9; padding: 0.3rem 0.5rem; border-radius: 6px; font-size: 0.85rem; word-break: break-all; }

/* Painel de métricas */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.metric .num { font-size: 1.8rem; font-weight: 700; color: var(--brand); line-height: 1; }
.metric .lbl { color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
.bar-row { display: grid; grid-template-columns: 40% 60%; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.9rem; }
.bar-track { background: #eef1f5; border-radius: 6px; overflow: hidden; height: 18px; }
.bar-fill { background: var(--brand); height: 100%; border-radius: 6px; min-width: 2px; }
.bar-row .bar-val { font-size: 0.8rem; color: var(--muted); }
