@import url("report-content.css");

:root {
  --ink: #14241c;
  --pine: #16382c;
  --moss: #1f6a50;
  --leaf: #2f8f6b;
  --gold: #c4a35a;
  --sand: #f3efe4;
  --paper: #fffcf7;
  --line: #d9d1c0;
  --muted: #5f6e66;
  --danger: #9b2c2c;
  --ok: #1b7a4a;
  --shadow: 0 18px 40px rgba(20, 36, 28, .08);
  --radius: 18px;
  --sidebar: 268px;
  --font: "Outfit", "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--sand);
  min-height: 100vh;
}

a { color: var(--moss); text-decoration: none; }
a:hover { color: var(--pine); }

h1, h2, .brand-type { font-family: var(--serif); font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: 1.85rem; margin: 0 0 .35rem; }
h2 { font-size: 1.25rem; margin: 0 0 .75rem; }
p { line-height: 1.55; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  border: 0; cursor: pointer; font-family: inherit; font-weight: 600;
  border-radius: 999px; padding: .72rem 1.15rem; font-size: .95rem;
  transition: .15s transform, .15s background, .15s box-shadow;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--moss); color: #fff; }
.btn-primary:hover { background: var(--pine); color: #fff; }
.btn-gold { background: var(--gold); color: #1b160c; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: #f8e8e8; color: var(--danger); }
.btn-sm { padding: .42rem .8rem; font-size: .82rem; }
.btn-icon {
  width: 2.1rem; height: 2.1rem; padding: 0; border-radius: 999px; flex-shrink: 0;
}
.btn-icon svg { display: block; }
a.btn-icon { text-decoration: none; color: inherit; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.input, select, textarea {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: .75rem .9rem; outline: none;
}
.input:focus, select:focus, textarea:focus { border-color: var(--leaf); box-shadow: 0 0 0 3px rgba(47,143,107,.15); }
label { display: block; font-size: .82rem; font-weight: 600; margin: 0 0 .35rem; color: var(--pine); }
.field { margin-bottom: 1rem; }
.check-row { display: flex; flex-wrap: wrap; gap: .7rem 1.3rem; }
.check-row label {
  display: flex; align-items: center; gap: .45rem; margin: 0;
  font-weight: 550; color: var(--ink); cursor: pointer;
}
.check-row input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--leaf); }
.input[readonly] { background: #f7f4ec; color: var(--ink); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.clinic-billing-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
}
.clinic-billing-day {
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
}
.clinic-billing-day .input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.clinic-billing-invoice { display: flex; flex-direction: column; justify-content: center; flex: 1 1 12rem; }
.clinic-billing-checkbox {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  min-height: 2.65rem;
}
.time-parts {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: 2.9rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 .2rem;
  gap: 0;
}
.time-parts:focus-within {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(47,143,107,.15);
}
.time-parts-sep {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
  padding: 0 .05rem;
  user-select: none;
}
.time-parts select {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  border: 0;
  border-radius: 8px;
  background-color: transparent;
  box-shadow: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2316382c' d='M1.2 1.3l4.8 4.8 4.8-4.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .28rem center;
  background-size: 9px 6px;
  padding: .62rem 1.15rem .62rem .15rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-overflow: clip;
}
.time-parts select:focus {
  outline: none;
  border: 0;
  box-shadow: none;
  background-color: #f3faf6;
}
.appt-when {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: .7rem;
  align-items: end;
}
.appt-when > .field { min-width: 0; }
.address-row {
  display: flex;
  align-items: stretch;
  gap: .5rem;
}
.address-row .input { min-width: 0; }
.btn-maps {
  flex: 0 0 2.75rem;
  width: 2.75rem;
  min-height: 2.75rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--moss);
  color: #fff;
  border: 0;
  box-shadow: none;
}
.btn-maps:hover { background: var(--pine); color: #fff; transform: translateY(-1px); }
.btn-maps[hidden] { display: none !important; }
.btn-maps.is-empty {
  opacity: .45;
  pointer-events: none;
  transform: none;
}
.date-picker { position: relative; }
.date-picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .45rem;
  width: 100%;
  min-height: 2.9rem;
  padding: .62rem .75rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.date-picker-trigger svg { color: var(--moss); flex-shrink: 0; }
.date-picker-value { font-variant-numeric: tabular-nums; }
.date-picker-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 40;
  width: min(320px, calc(100vw - 2rem));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: .7rem;
}
.date-picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .4rem;
  margin-bottom: .55rem;
}
.date-picker-toolbar .cal-period { font-size: 1rem; min-width: 0; }
.date-picker-month .cal-day {
  min-height: 36px;
  padding: .15rem;
  align-items: center;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  appearance: none;
}
.date-picker-month .cal-day-num { width: 1.85rem; height: 1.85rem; font-size: .8rem; }
.date-picker-month .cal-wd { padding: .4rem .15rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

.flash { border-radius: 12px; padding: .85rem 1rem; margin-bottom: 1rem; font-weight: 500; }
.flash-error { background: #fdecec; color: var(--danger); }
.flash-ok { background: #e8f6ee; color: var(--ok); }
.flash-warn { background: #fff6e5; color: #8a5a12; }

.auth-shell {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr;
  background: radial-gradient(1200px 600px at -10% -10%, #2f8f6b33, transparent),
              linear-gradient(160deg, #10251c, #1b4334 55%, #16382c);
}
.auth-story { color: #f6f1e6; padding: 4.5rem 4rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-story h1 { font-size: 3rem; color: #fff; max-width: 11ch; }
.auth-story p { color: #d7e7de; max-width: 42ch; font-size: 1.05rem; }
.auth-mark { display: flex; align-items: center; gap: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
.auth-card-wrap { display: flex; align-items: center; justify-content: center; padding: 2rem; }
.card {
  background: var(--paper); border: 1px solid #efe8d8; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.4rem;
}
.auth-card { width: min(420px, 100%); padding: 2rem; }
.muted { color: var(--muted); font-size: .92rem; }
.tiny { font-size: .78rem; color: var(--muted); }

.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--pine); color: #e8f3ed; padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 1.4rem;
}
.logo { display: flex; align-items: center; gap: .7rem; color: #fff; padding: .3rem .5rem; }
.logo svg { width: 36px; height: 36px; }
.logo strong { font-family: var(--serif); font-size: 1.35rem; }
.nav a {
  display: flex; align-items: center; gap: .7rem; color: #d5e7dd; padding: .72rem .85rem;
  border-radius: 12px; font-weight: 550;
}
.nav a.active, .nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-foot { margin-top: auto; padding: .85rem; background: rgba(0,0,0,.16); border-radius: 14px; }
.sidebar-foot span { display: block; color: #9db8ab; font-size: .75rem; }

.main { padding: 1.5rem 1.8rem 3rem; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.topbar:has(> .dash-welcome) { align-items: center; }
.dash-welcome { display: flex; align-items: center; gap: 1.1rem; min-width: 0; }
.dash-welcome > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
  min-width: 0;
}
.dash-welcome h1 { margin: 0; line-height: 1.15; }
.dash-welcome > div > .muted { margin: 0; line-height: 1.45; }
.dash-logo {
  display: block;
  max-height: 88px;
  max-width: min(240px, 42vw);
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: .55rem .7rem;
  flex-shrink: 0;
  box-shadow: var(--shadow);
}
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.stat-grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid-5 { grid-template-columns: repeat(5, 1fr); }
a.card.stat:hover { border-color: var(--leaf); color: inherit; }
#financeiro, #lancamento, #cadastro, #agendamento { scroll-margin-top: 1rem; }
.stat { padding: 1.2rem 1.3rem; }
.stat b { display: block; font-family: var(--serif); font-size: 2rem; }
.stat b.money { font-size: 1.45rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.money-ok { color: var(--ok); }
.money-warn { color: #8a5a12; }
.money-danger { color: var(--danger); }

.tabs { display: flex; gap: .4rem; margin: 0 0 1rem; flex-wrap: wrap; }
.tabs a, .tabs button {
  border-radius: 999px; padding: .45rem .9rem; font-weight: 600; font-size: .9rem;
  background: #fff; color: var(--pine); border: 1px solid var(--line);
  font-family: inherit; cursor: pointer;
}
.tabs a.active, .tabs a:hover, .tabs button.active, .tabs button:hover {
  background: var(--moss); color: #fff; border-color: var(--moss);
}

.filter-card { margin-bottom: 1rem; }
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; align-items: end; }
.filter-bar .field { margin: 0; }
.filter-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.finance-actions { min-width: 200px; }
.finance-actions-inner,
.table-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
}
.finance-actions form,
.table-actions form { display: inline-flex; gap: .35rem; align-items: center; margin: 0; flex-shrink: 0; }
.finance-actions select { width: auto; min-width: 110px; padding: .35rem .55rem; font-size: .82rem; }
.table-wrap td.table-actions,
.table-wrap td.pager-actions.table-actions { vertical-align: middle; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .8rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.badge {
  display: inline-flex; border-radius: 999px; padding: .2rem .6rem; font-size: .75rem; font-weight: 700;
  background: #e7f3ec; color: var(--moss);
}
.badge.gold { background: #f6edd6; color: #7a5b16; }
.badge.gray { background: #ececec; color: #555; }
.badge.ok { background: #e8f6ee; color: var(--ok); }
.badge.danger { background: #fdecec; color: var(--danger); }

.drop {
  border: 1.5px dashed #c9b896; border-radius: 18px; padding: 2rem; text-align: center; background: #fffdf8;
}
.drop.drag { background: #eef7f2; border-color: var(--leaf); }
.steps { display: grid; gap: .7rem; margin-top: 1.2rem; }
.step { display: flex; gap: .8rem; align-items: center; padding: .75rem 1rem; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.step.on { border-color: var(--leaf); }
.step.done { background: #e9f6ef; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #ccc; }
.step.on .dot { background: var(--gold); box-shadow: 0 0 0 4px #f3e6c4; }
.step.done .dot { background: var(--ok); }

.exam-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 1rem;
  align-items: start;
}
.exam-main-form { display: contents; }
.exam-data-card { grid-column: 1; grid-row: 1; }
.exam-images-card { grid-column: 2; grid-row: 1 / -1; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.exam-span-full { grid-column: 1; }
.exam-images-card .gallery { grid-template-columns: 1fr; }
.exam-images-card .gallery figure { background: var(--paper); border: 1px solid var(--line); }
.exam-images-card .gallery img { height: 140px; object-fit: cover; border-radius: 12px 12px 0 0; }
.exam-images-card .gallery figcaption {
  position: static; color: var(--ink); background: transparent; padding: .5rem .55rem .65rem;
}

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .8rem; }
.gallery a, .gallery figure {
  margin: 0; background: #111; border-radius: 12px; overflow: hidden; display: block; position: relative;
}
.gallery img { width: 100%; height: 150px; object-fit: cover; display: block; }
.gallery figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: .4rem .55rem;
  color: #fff; font-size: .72rem; background: linear-gradient(transparent, #000c);
}

.report {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1.6rem 1.8rem;
}
.report-editor-wrap .tox-tinymce {
  border-radius: 12px;
  border-color: var(--line);
  box-shadow: none;
}
.report-editor-wrap .tox .tox-edit-area__iframe {
  background: #fff;
}

.pager-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.pager-actions select { width: auto; min-width: 150px; }
.pager-actions .input { min-width: 240px; width: min(360px, 100%); }

@media (max-width: 1280px) {
  .stat-grid, .stat-grid-2, .stat-grid-4, .stat-grid-5 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 980px) {
  .exam-review-grid { grid-template-columns: 1fr; }
  .exam-data-card, .exam-images-card { grid-column: 1; grid-row: auto; }
  .exam-images-card { position: static; max-height: none; }
  .exam-images-card .gallery { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .auth-shell, .app, .grid-2, .grid-3, .stat-grid, .stat-grid-3, .stat-grid-4, .stat-grid-5, .filter-bar { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .sidebar { display: none; }
  .main { padding: 1rem; }
  .mobile-nav { display: flex !important; }
}
.mobile-nav {
  display: none; gap: .4rem; overflow: auto; padding: .6rem 1rem; background: var(--pine);
}
.mobile-nav a { color: #fff; white-space: nowrap; padding: .45rem .7rem; border-radius: 999px; font-size: .85rem; }

.cal-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 0 1rem; }
.cal-period { font-family: var(--serif); font-size: 1.25rem; min-width: 12ch; text-align: center; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.cal-board { padding: 1rem; overflow: auto; }
.cal-month {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.cal-wd {
  background: #f7f4ec; padding: .55rem .4rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: center;
}
.cal-day {
  background: var(--paper); min-height: 108px; padding: .4rem .35rem .5rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.cal-day.is-out { background: #f3efe6; }
.cal-day.is-out .cal-day-num { color: #b3aaa0; }
.cal-day.is-today { background: #eef7f2; }
.cal-day.is-focus { box-shadow: inset 0 0 0 2px var(--leaf); }
.cal-day-num {
  width: 1.7rem; height: 1.7rem; border-radius: 999px; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: var(--ink);
}
.cal-day.is-today .cal-day-num { background: var(--moss); color: #fff; }
.cal-day-events { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.cal-chip, .cal-block {
  display: block; font-size: .72rem; font-weight: 650; padding: .18rem .4rem;
  border-radius: 6px; color: #fff; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
button.cal-chip, button.cal-block {
  width: 100%; font: inherit; border: 0; cursor: pointer; text-align: left;
}
.cal-chip-moss, .cal-chip:not([class*="cal-chip-"]) { background: var(--moss); color: #fff; }
.cal-chip-gold { background: #c4a35a; color: #1b160c; }
.cal-chip-ok { background: var(--ok); color: #fff; }
.cal-chip-gray { background: #8a8a8a; color: #fff; }
.cal-chip-danger { background: var(--danger); color: #fff; }
.cal-chip:hover, .cal-block:hover { color: inherit; filter: brightness(1.08); }
.cal-appt-drag { cursor: grab; }
.cal-appt-drag.is-dragging { cursor: grabbing; opacity: .82; }
.cal-day.is-drop-over, .cal-drop-slot.is-drop-over { background: #eef7f2; box-shadow: inset 0 0 0 2px var(--leaf); }
.cal-board.is-moving { opacity: .65; pointer-events: none; }

.cal-week { min-width: 720px; }
.cal-week-head, .cal-week-body { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); }
.cal-week-head { position: sticky; top: 0; z-index: 2; background: var(--paper); }
.cal-week-h { text-align: center; padding: .4rem; border-bottom: 1px solid var(--line); background: var(--paper); }
.cal-week-h.is-today strong { background: var(--moss); color: #fff; border-radius: 999px; padding: .15rem .55rem; }
.cal-week-gutter { color: var(--muted); font-size: .72rem; }
.cal-hour-label { height: 60px; padding: .2rem .3rem 0 0; text-align: right; }
.cal-week-col { position: relative; border-left: 1px solid var(--line); }
.cal-slot { display: block; height: 60px; border-bottom: 1px solid #efe8d8; }
.cal-slot:hover { background: #eef7f2; }
.cal-block {
  position: absolute; left: 4px; right: 4px; z-index: 1;
  white-space: normal; line-height: 1.2; padding: .3rem .4rem;
}
.cal-block span { display: block; font-weight: 500; font-size: .68rem; opacity: .9; }
.cal-upcoming { list-style: none; margin: 0; padding: 0; }
.cal-upcoming li { border-bottom: 1px solid var(--line); padding: .55rem 0; }
.cal-upcoming a { display: flex; flex-direction: column; gap: .15rem; color: inherit; }
.cal-upcoming a:hover strong { color: var(--moss); }

.dash-agenda-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 1.25rem;
  align-items: start;
}
.dash-agenda-toolbar { margin-bottom: .75rem; }
.dash-cal-period { font-size: 1rem; min-width: 0; }
.dash-cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.dash-cal-day {
  background: var(--paper);
  min-height: 76px;
  padding: .35rem .3rem .45rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
}
.dash-cal-day.is-today { background: #eef7f2; }
.dash-cal-day.is-focus { box-shadow: inset 0 0 0 2px var(--leaf); }
.dash-cal-day-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .05rem;
  color: inherit;
  text-decoration: none;
}
.dash-cal-day-head:hover .dash-cal-day-num { color: var(--moss); }
.dash-cal-day-num {
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.1;
}
.dash-cal-day.is-today .dash-cal-day-num {
  background: var(--moss);
  color: #fff;
  border-radius: 999px;
  min-width: 1.55rem;
  text-align: center;
  padding: .1rem .35rem;
}
.dash-cal-day-events { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.dash-cal-day-events .cal-chip { font-size: .65rem; padding: .12rem .3rem; }
.dash-cal-more { display: block; text-align: center; color: var(--muted); }
.dash-agenda-day {
  border-left: 1px solid var(--line);
  padding-left: 1.25rem;
  min-height: 100%;
}
.dash-agenda-day-title {
  margin: 0 0 .75rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
}
.dash-agenda-list li:last-child { border-bottom: 0; }
.dash-agenda-list-btn {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.dash-agenda-list-btn:hover strong { color: var(--moss); }
.dash-agenda-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .5rem;
}
.dash-agenda-meta .badge { margin: 0; flex-shrink: 0; }
.cal-link-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .6rem; }

.suggest { position: relative; }
.suggest.is-open .input {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 1px);
  z-index: 30;
  margin: 0;
  padding: .25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--leaf);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  max-height: 220px;
  overflow: auto;
  box-shadow: var(--shadow);
}
.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: .55rem .9rem;
}
.suggest-item strong { display: block; font-weight: 650; }
.suggest-item .tiny { display: block; margin-top: .1rem; }
.suggest-item:hover,
.suggest-item.is-active { background: #eef7f2; }
.suggest-empty { padding: .55rem .9rem; color: var(--muted); font-size: .9rem; }

body.modal-open { overflow: hidden; }
.modal[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 3.5rem 1rem 1.5rem;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(20, 36, 28, .42);
  backdrop-filter: blur(16px) saturate(.85);
  -webkit-backdrop-filter: blur(16px) saturate(.85);
  animation: appt-backdrop-in .22s ease-out;
}
@keyframes appt-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  body.modal-open .mobile-nav,
  body.modal-open .sidebar,
  body.modal-open .main > *:not(#appt-modal) {
    filter: blur(10px);
  }
}
.modal-dialog {
  position: relative; z-index: 1;
  width: min(640px, 100%);
  max-height: calc(100vh - 5rem);
  overflow: auto;
  background: var(--paper);
  border: 1px solid rgba(217, 209, 192, .9);
  border-radius: 24px;
  box-shadow: 0 28px 60px rgba(20, 36, 28, .16), 0 4px 14px rgba(20, 36, 28, .06);
  padding: 1.25rem 1.3rem 1.4rem;
}
.appt-modal-dialog {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 5rem);
  animation: appt-dialog-in .28s cubic-bezier(.22, 1, .36, 1);
}
@keyframes appt-dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.appt-modal-dialog #appt-modal-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  overflow: auto;
}
.modal-close {
  position: absolute; top: .7rem; right: .7rem;
  width: 2.1rem; height: 2.1rem; border: 0; border-radius: 999px;
  background: #f3efe4; color: var(--ink); cursor: pointer; font-size: 1.2rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: #e7e0d0; }
.appt-modal-close {
  top: .85rem;
  right: .85rem;
  z-index: 2;
  background: rgba(255, 252, 247, .72);
  border: 1px solid rgba(217, 209, 192, .85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.appt-modal-close:hover { background: #fff; }
.appt-modal-loading {
  padding: 2.5rem 1.5rem;
  text-align: center;
  animation: appt-pulse 1.2s ease-in-out infinite;
}
@keyframes appt-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
.appt-modal-hero {
  padding: 1.35rem 1.35rem 1.15rem;
  padding-right: 3.25rem;
  background:
    linear-gradient(135deg, rgba(31, 106, 80, .11) 0%, rgba(196, 163, 90, .08) 48%, transparent 100%),
    var(--paper);
  border-bottom: 1px solid rgba(217, 209, 192, .65);
}
.appt-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin: 0;
}
.appt-modal-head-main { min-width: 0; flex: 1; }
.appt-modal-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.65rem, 4vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--pine);
}
.appt-modal-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem .45rem;
  margin-top: .55rem;
}
.appt-modal-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: .22rem .65rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--pine);
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(217, 209, 192, .75);
}
.appt-modal-chip-muted { color: var(--muted); font-weight: 550; }
.appt-modal-chips .badge { margin: 0; }
.btn-status-done {
  background: var(--ok);
  color: #fff;
  flex-shrink: 0;
  margin-top: .15rem;
  box-shadow: 0 6px 16px rgba(27, 122, 74, .28);
}
a.btn-icon.btn-status-done,
.btn-status-done.btn-icon { color: #fff; }
.btn-status-done:hover { filter: brightness(1.06); color: #fff; }
.appt-modal-body {
  padding: 1.1rem 1.25rem 1.25rem;
  min-height: 0;
}
.appt-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
  margin: 0 0 1rem;
}
.appt-modal-cell {
  background: #fff;
  border: 1px solid rgba(217, 209, 192, .75);
  border-radius: 16px;
  padding: .75rem .85rem;
  min-width: 0;
}
.appt-modal-cell-wide { grid-column: 1 / -1; }
.appt-modal-label {
  margin: 0 0 .35rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.appt-modal-label-inline {
  margin: .55rem 0 .2rem;
}
.appt-modal-value strong {
  display: block;
  font-weight: 650;
  line-height: 1.35;
}
.appt-modal-notes {
  margin: 0;
  line-height: 1.5;
  font-weight: 550;
  color: var(--ink);
  white-space: pre-wrap;
}
.appt-modal-address { margin-top: 0; }
.appt-modal-address-text {
  display: block;
  background: var(--sand);
  min-height: auto;
  padding: .55rem .75rem;
  line-height: 1.4;
  font-size: .92rem;
  border-radius: 12px;
}
.appt-modal-value-row {
  display: flex;
  align-items: center;
  gap: .45rem;
}
.appt-modal-value-row .money { font-size: 1.05rem; color: var(--pine); }
.appt-modal-summary-card {
  margin: 0;
  padding: 1rem 1.05rem;
  background: linear-gradient(180deg, #f7faf8 0%, #fff 100%);
  border: 1px solid rgba(47, 143, 107, .22);
  border-radius: 18px;
  box-shadow: inset 3px 0 0 var(--leaf);
}
.appt-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .38rem;
}
.appt-modal-summary-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--pine);
}
.appt-summary-meta { margin: 0 0 .45rem; color: var(--muted); }
.appt-summary-body {
  text-align: left;
}
.appt-summary-body .appt-summary-meta { margin-top: 0; }
.appt-summary-body .muted,
.appt-summary-body .flash {
  text-align: left;
}
.btn-send {
  background: var(--moss);
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(31, 106, 80, .25);
}
a.btn-icon.btn-send,
.btn-send.btn-icon { color: #fff; }
.btn-send:hover { background: var(--pine); color: #fff; filter: none; }
.appt-modal-body > .appt-modal-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .65rem .75rem;
  margin: 1rem -1.25rem -1.25rem;
  padding: .95rem 1.25rem 1.15rem;
  border-top: 1px solid rgba(217, 209, 192, .75);
  background: linear-gradient(180deg, rgba(243, 239, 228, .35) 0%, rgba(255, 252, 247, .95) 100%);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.appt-modal-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem .55rem;
  margin: 0;
}
.appt-modal-inline-form { display: inline-flex; margin: 0; margin-left: auto; }
.appt-modal-summary-card .appt-summary {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  line-height: 1.55;
  margin: .2rem 0 0;
  font-size: .94rem;
  color: var(--ink);
  text-align: left;
}
@media (max-width: 640px) {
  .modal { padding-top: 2.5rem; }
  .appt-modal-grid { grid-template-columns: 1fr; }
  .appt-modal-hero { padding-right: 3rem; }
  .appt-modal-head { flex-wrap: wrap; }
  .appt-modal-body > .appt-modal-footer { flex-direction: column; align-items: stretch; }
  .appt-modal-inline-form { margin-left: 0; width: 100%; }
  .appt-modal-inline-form .btn { width: 100%; }
}

#measure-chart { position: relative; }
.measure-charts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.measure-mini {
  position: relative; background: #fff; border: 1px solid var(--line);
  border-radius: 16px; padding: .75rem .8rem .4rem;
}
.measure-mini h3 {
  font-family: var(--font); font-size: .88rem; font-weight: 650;
  margin: 0 0 .35rem; color: var(--pine);
}
.measure-mini .tiny { margin: 0 0 .35rem; }
.measure-mini svg { width: 100%; height: 170px; display: block; }
.measure-mini .measure-dot { cursor: pointer; }
.measure-charts.is-single { grid-template-columns: 1fr; }
.measure-charts.is-single .measure-mini svg { height: 260px; }
.measure-tooltip {
  position: absolute; z-index: 2; pointer-events: none;
  background: var(--pine); color: #fff; border-radius: 10px;
  padding: .4rem .6rem; font-size: .78rem; line-height: 1.35;
  transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap;
  box-shadow: var(--shadow);
}
.measure-tooltip strong { display: block; font-size: .82rem; }
@media (max-width: 800px) {
  .measure-charts { grid-template-columns: 1fr; }
}

.tpl-builder { overflow: hidden; }
.tpl-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) minmax(240px, 300px);
  gap: 1rem;
  align-items: start;
}
.tpl-palette {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  max-height: 640px;
  overflow: auto;
  padding-right: .2rem;
}
.tpl-palette .tiny { margin: .65rem 0 .15rem; font-weight: 700; color: var(--pine); }
.tpl-chip {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: .42rem .55rem;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
}
.tpl-chip:hover { border-color: var(--leaf); background: #eef7f2; }
.tpl-block { background: #f7f4ec; }
.tpl-preview-wrap { min-width: 0; }
.tpl-preview-label { font-size: .78rem; font-weight: 700; color: var(--pine); margin-bottom: .45rem; }
.tpl-preview {
  background: #e8e2d4;
  border-radius: 16px;
  padding: .7rem;
  max-height: 640px;
  overflow: auto;
}
.tpl-preview-sheet {
  background: #fff;
  min-height: 360px;
  padding: 1.1rem 1.15rem;
  border-radius: 4px;
  box-shadow: 0 10px 24px rgba(20, 36, 28, .12);
  transform-origin: top center;
  font-size: .72rem;
}
.tpl-preview-sheet h1 { font-size: 1.05rem; }
.tpl-preview-sheet h2 { font-size: .9rem; }
.tpl-advanced { margin-top: 1rem; }
.tpl-advanced summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--pine);
  margin-bottom: .8rem;
}
.tpl-list-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: .8rem 0;
  border-bottom: 1px solid var(--line);
}
.tpl-list-row:last-child { border-bottom: 0; }

@media (max-width: 1100px) {
  .tpl-layout { grid-template-columns: 1fr; }
  .tpl-palette { max-height: none; flex-direction: row; flex-wrap: wrap; }
  .tpl-chip { width: auto; }
  .cal-layout { grid-template-columns: 1fr; }
  .cal-day { min-height: 84px; }
  .dash-agenda-layout { grid-template-columns: 1fr; }
  .dash-agenda-day {
    border-left: 0;
    padding-left: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
  }
}
