/* ==========================================================================
   Inflow — sistema visual
   Mobile-first (iPhone), com layout de secretária a partir de 1024px.
   ========================================================================== */

:root {
  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-2: #f5f5f8;
  --fill: rgba(118, 118, 128, 0.12);
  --fill-strong: rgba(118, 118, 128, 0.2);
  --text: #111114;
  --muted: #6c6c73;
  --faint: #a1a1a8;
  --border: rgba(60, 60, 67, 0.13);
  --border-strong: rgba(60, 60, 67, 0.22);
  --primary: #0f6e66;
  --primary-hover: #0b5a53;
  --primary-soft: color-mix(in srgb, var(--primary) 11%, var(--surface));
  --on-primary: #ffffff;
  --danger: #d92d20;
  --danger-soft: #fdecea;
  --success: #15803d;
  --success-soft: #e7f6ec;
  --warning: #b45309;
  --warning-soft: #fdf3e1;
  --chart: #0f6e66;
  --chart-grid: #e7e7ec;
  --chart-axis: #c9c9d1;
  --header-bg: rgba(249, 249, 251, 0.82);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 20px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.18);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232326;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.34);
    --text: #f5f5f7;
    --muted: #9b9ba3;
    --faint: #6b6b72;
    --border: rgba(84, 84, 88, 0.55);
    --border-strong: rgba(120, 120, 128, 0.6);
    --primary: #34b3a6;
    --primary-hover: #4cc3b6;
    --primary-soft: color-mix(in srgb, var(--primary) 18%, var(--surface));
    --on-primary: #06201d;
    --danger: #ff6b5e;
    --danger-soft: #3a1d1a;
    --success: #4ade80;
    --success-soft: #14301f;
    --warning: #fbbf24;
    --warning-soft: #33280f;
    --chart: #34b3a6;
    --chart-grid: #2c2c2e;
    --chart-axis: #48484a;
    --header-bg: rgba(22, 22, 24, 0.78);
    --shadow: none;
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-2: #232326;
  --fill: rgba(118, 118, 128, 0.24);
  --fill-strong: rgba(118, 118, 128, 0.34);
  --text: #f5f5f7;
  --muted: #9b9ba3;
  --faint: #6b6b72;
  --border: rgba(84, 84, 88, 0.55);
  --border-strong: rgba(120, 120, 128, 0.6);
  --primary: #34b3a6;
  --primary-hover: #4cc3b6;
  --primary-soft: color-mix(in srgb, var(--primary) 18%, var(--surface));
  --on-primary: #06201d;
  --danger: #ff6b5e;
  --danger-soft: #3a1d1a;
  --success: #4ade80;
  --success-soft: #14301f;
  --warning: #fbbf24;
  --warning-soft: #33280f;
  --chart: #34b3a6;
  --chart-grid: #2c2c2e;
  --chart-axis: #48484a;
  --header-bg: rgba(22, 22, 24, 0.78);
  --shadow: none;
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

body:has(dialog[open]) {
  overflow: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 8px;
  letter-spacing: -0.015em;
}

h1 {
  font-size: 1.85rem;
  font-weight: 700;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

h3 {
  font-size: 1.02rem;
  font-weight: 650;
}

p {
  margin: 0 0 12px;
}

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

.small {
  font-size: 0.875rem;
}

.hidden {
  display: none !important;
}

.spacer {
  flex: 1;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stack > * + * {
  margin-top: 12px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.num,
.tnum {
  font-variant-numeric: tabular-nums;
}

/* --- Ícones ------------------------------------------------------------- */

.icon {
  display: inline-flex;
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* --- Cabeçalho e contentores --------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--border);
  padding-top: var(--safe-top);
}

.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  min-height: 52px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px calc(40px + var(--safe-bottom));
}

.container.wide {
  max-width: 1180px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* --- Botões ---------------------------------------------------------------- */

.btn {
  appearance: none;
  border: none;
  background: var(--fill);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  transition:
    background 0.15s,
    transform 0.08s,
    opacity 0.15s;
  user-select: none;
  -webkit-user-select: none;
}

.btn:hover {
  background: var(--fill-strong);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.danger {
  color: var(--danger);
}

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

.btn.ghost {
  background: transparent;
}

.btn.ghost:hover {
  background: var(--fill);
}

.btn.small {
  padding: 6px 12px;
  min-height: 34px;
  font-size: 0.875rem;
  border-radius: 10px;
}

.btn.large {
  min-height: 52px;
  font-size: 1.05rem;
  border-radius: 14px;
  width: 100%;
}

.btn.link {
  background: none;
  padding: 0;
  min-height: 0;
  color: var(--primary);
}

.btn.link.danger {
  color: var(--danger);
}

/* Ligação à ficha do INFLOW Hub (nova marcação) */
.hub-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 12px;
}

.hub-link:empty {
  display: none;
}

.match-row {
  align-items: flex-start;
  gap: 10px;
}

.match-row select {
  margin-top: 6px;
  width: 100%;
}

/* Área de clientes */
.client-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0 4px;
}

.client-stats .stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.client-stats .stat strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.client-stats .stat span {
  font-size: 0.75rem;
  color: var(--muted);
}

.client-stats .stat.bad strong {
  color: var(--danger);
}

.client-session .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.client-session .tags:empty {
  display: none;
}

.again-btn {
  width: 100%;
  margin-top: 20px;
}

.delete-zone {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.delete-zone .hint {
  margin-top: 6px;
}

.delete-list {
  margin: 12px 0 16px;
  padding-left: 20px;
  color: var(--muted);
}

.btn.icon-only {
  padding: 0;
  width: 40px;
  min-height: 40px;
  border-radius: 50%;
}

/* --- Campos ------------------------------------------------------------- */

label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  /* 16px evita o zoom automático do iPhone ao tocar num campo */
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 11px 13px;
  min-height: 46px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

input[type='checkbox'],
input[type='radio'] {
  width: 20px;
  height: 20px;
  min-height: 0;
  padding: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

input[type='color'] {
  padding: 4px;
  cursor: pointer;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}

.btn:focus-visible,
.option:focus-visible,
.chip:focus-visible,
.seg button:focus-visible,
.bk:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.field {
  margin-bottom: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 10px;
}

.input-affix {
  position: relative;
}

.input-affix .affix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 600;
  pointer-events: none;
}

.input-affix input {
  padding-right: 38px;
}

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.alert.error {
  background: var(--danger-soft);
  color: var(--danger);
}

.alert.success {
  background: var(--success-soft);
  color: var(--success);
}

/* --- Controlo segmentado, chips, emblemas ------------------------------- */

.seg {
  display: flex;
  background: var(--fill);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
  width: 100%;
}

.seg button {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  padding: 8px 6px;
  border-radius: 9px;
  cursor: pointer;
  min-height: 36px;
  white-space: nowrap;
}

.seg button.active {
  background: var(--surface);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.12),
    0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

.seg button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.seg.inline {
  width: auto;
  display: inline-flex;
}

.seg.inline button {
  flex: none;
  padding: 7px 14px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chips.scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 2px 16px 6px;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 16px;
}

.chips.scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: 999px;
  padding: 8px 15px;
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  min-height: 40px;
  white-space: nowrap;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chip:hover {
  border-color: var(--primary);
}

.chip.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}

.chip.day {
  flex-direction: column;
  gap: 0;
  border-radius: 14px;
  padding: 7px 0;
  width: 58px;
  min-height: 62px;
  justify-content: center;
}

.chip.day .dw {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.75;
}

.chip.day .dn {
  font-size: 1.15rem;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 650;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok {
  background: var(--success-soft);
  color: var(--success);
}

.badge.warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.brand {
  background: var(--primary-soft);
  color: var(--primary);
}

/* --- Página pública de marcação -------------------------------------------- */

.page-hero {
  margin: 8px 0 18px;
}

.page-hero h1 {
  margin-bottom: 6px;
}

.page-hero .intro {
  color: var(--muted);
  margin: 0;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.progress .bar {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--fill);
  overflow: hidden;
}

.progress .bar span {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.steps {
  display: none;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition:
    border-color 0.15s,
    transform 0.08s;
}

.option:hover {
  border-color: color-mix(in srgb, var(--primary) 40%, transparent);
}

.option:active {
  transform: scale(0.99);
}

.option.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.option .body {
  flex: 1;
  min-width: 0;
}

.option .title {
  font-weight: 650;
  font-size: 1.02rem;
}

.option .meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 2px;
}

.option .price {
  font-weight: 700;
  white-space: nowrap;
}

.option .chev {
  color: var(--faint);
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.avatar.sm {
  width: 36px;
  height: 36px;
  font-size: 0.85rem;
}

.calendar-head {
  max-width: 460px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.calendar-head h3 {
  margin: 0;
}

.calendar {
  max-width: 460px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  text-align: center;
}

.calendar .dow {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 4px 0;
  text-transform: uppercase;
  font-weight: 600;
}

.calendar .day {
  height: 44px;
  border-radius: 50%;
  border: none;
  background: none;
  font: inherit;
  font-size: 1rem;
  color: var(--faint);
  padding: 0;
  aspect-ratio: 1;
  justify-self: center;
  width: min(44px, 100%);
}

.calendar .day.available {
  color: var(--primary);
  background: var(--primary-soft);
  cursor: pointer;
  font-weight: 650;
}

.calendar .day.selected {
  background: var(--primary);
  color: var(--on-primary);
}

.slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 8px;
}

.slots .chip {
  justify-content: center;
}

.summary {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.summary dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
}

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

.summary dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Botões de navegação: fixos em baixo no telemóvel (zona do polegar) */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.nav-buttons .btn.primary {
  min-width: 160px;
}

@media (max-width: 640px) {
  .flow .nav-buttons {
    position: sticky;
    bottom: 0;
    margin: 22px -20px -20px;
    padding: 12px 20px calc(12px + var(--safe-bottom));
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .flow .nav-buttons .btn.primary {
    flex: 1;
  }
}

/* --- Listas agrupadas (estilo iOS) ---------------------------------------- */

.group {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.group + .group {
  margin-top: 14px;
}

.group-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  margin: 20px 4px 8px;
}

.group-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  min-height: 50px;
  border-bottom: 0.5px solid var(--border);
}

.group-row:last-child {
  border-bottom: none;
}

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 20px 4px 8px;
}

.group-head .group-title {
  margin: 0;
}

.check:has(input:disabled) {
  color: var(--muted);
}

.group-row .k {
  color: var(--muted);
  min-width: 96px;
  font-size: 0.93rem;
}

.group-row .v {
  flex: 1;
  text-align: right;
  font-weight: 550;
  overflow-wrap: anywhere;
}

button.group-row {
  width: 100%;
  border-left: none;
  border-right: none;
  border-top: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

button.group-row:hover {
  background: var(--surface-2);
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 0.5px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
}

/* --- Tabelas ------------------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 0.5px solid var(--border);
  vertical-align: middle;
}

th {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-2);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

td.num,
th.num {
  text-align: right;
  white-space: nowrap;
}

/* --- Formulários de edição (coaches, tipos de sessão) ------------------------ */

fieldset {
  border: none;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 14px 14px 4px;
  margin: 0 0 16px;
}

legend {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0;
  float: left;
  width: 100%;
  margin-bottom: 10px;
}

legend + * {
  clear: both;
}

.interval-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.interval-row .wd {
  width: 90px;
  font-weight: 600;
  font-size: 0.92rem;
}

.interval-row input[type='time'] {
  width: 136px;
}

.interval-row input[type='datetime-local'] {
  width: 220px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.filters .field {
  margin: 0;
}

.copy-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.copy-row .code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--surface-2);
  min-height: 40px;
}

.copy-row textarea.code {
  resize: none;
  min-height: 0;
}

/* --- Folhas (dialog): sobem de baixo no telemóvel; modal / painel no Mac ------ */

dialog {
  border: none;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

dialog[open] {
  display: flex;
  flex-direction: column;
}

/* "Tem a certeza?" — por cima da folha aberta, ao centro */
dialog.confirm-dialog {
  margin: auto;
  width: min(340px, calc(100vw - 32px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
  border-radius: 16px;
}

dialog.confirm-dialog[open] {
  animation: pop-in 0.18s ease-out;
}

.confirm-box {
  padding: 20px 18px 16px;
  text-align: center;
}

.confirm-box h2 {
  font-size: 1.1rem;
  margin: 0 0 6px;
}

.confirm-box p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.sheet-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
}

.sheet-head h2 {
  margin: 0;
  font-size: 1.12rem;
  flex: 1;
  min-width: 0;
}

.sheet-head .sub {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
}

.sheet-grabber {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 36px;
  height: 5px;
  margin-left: -18px;
  border-radius: 3px;
  background: var(--fill-strong);
}

.sheet-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 16px 16px 20px;
}

.sheet-foot {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--border);
}

.sheet-foot .btn.primary {
  flex: 1;
}

@media (max-width: 767px) {
  dialog {
    margin: auto 0 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - var(--safe-top) - 10px);
    border-radius: 18px 18px 0 0;
  }

  dialog.full {
    height: calc(100dvh - var(--safe-top) - 10px);
  }

  dialog[open] {
    animation: sheet-up 0.32s cubic-bezier(0.2, 0.85, 0.25, 1);
  }

  .sheet-head {
    padding-top: 20px;
  }
}

@media (min-width: 768px) {
  dialog {
    width: min(640px, calc(100vw - 48px));
    max-height: min(860px, calc(100vh - 48px));
    border-radius: var(--radius-lg);
  }

  .sheet-grabber {
    display: none;
  }

  dialog[open] {
    animation: pop-in 0.2s ease-out;
  }

  /* Detalhe da marcação: painel lateral à direita */
  dialog.drawer {
    margin: 0 0 0 auto;
    height: 100vh;
    max-height: 100vh;
    width: min(480px, 100vw);
    border-radius: 0;
  }

  dialog.drawer[open] {
    animation: drawer-in 0.26s cubic-bezier(0.2, 0.85, 0.25, 1);
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(100%);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
}

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

/* Ações rápidas (Ligar, WhatsApp, Email, Zoom) */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.quick-actions a,
.quick-actions button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 6px 10px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.quick-actions .icon {
  width: 24px;
  height: 24px;
}

.block {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.block > label {
  margin-bottom: 8px;
}

.hint {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 6px;
}

/* --- Gestão: layout ------------------------------------------------------- */

.admin-shell {
  min-height: 100dvh;
}

.app-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px 8px;
}

/* Rodapé da gestão: versão a correr + recarregar (o espaço da barra de separadores fica aqui) */
.app-foot {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 16px 16px calc(var(--tabbar-h) + 28px + var(--safe-bottom));
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.app-foot .version strong {
  color: var(--text);
}

.page-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 14px;
  flex-wrap: wrap;
}

.page-head h1 {
  margin: 0;
  font-size: 1.9rem;
}

.page-head .actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

#flash {
  position: fixed;
  left: 50%;
  top: calc(12px + var(--safe-top));
  transform: translateX(-50%);
  z-index: 100;
  box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 32px);
  min-width: 220px;
  text-align: center;
  font-weight: 600;
}

/* Barra de separadores (iPhone) */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 6px 4px calc(4px + var(--safe-bottom));
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--border);
}

.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--faint);
  padding: 4px 0;
  cursor: pointer;
  min-height: 48px;
}

.tabbar button .icon {
  width: 26px;
  height: 26px;
}

.tabbar button.active {
  color: var(--primary);
}

.tabbar .fab {
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  min-height: 54px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  margin: -18px 6px 2px;
  justify-content: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 40%, transparent);
}

.tabbar .fab .icon {
  width: 28px;
  height: 28px;
}

/* Menu lateral (Mac) */
.sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .admin-shell {
    display: grid;
    grid-template-columns: 248px 1fr;
  }

  .admin-shell .site-header {
    display: none;
  }

  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 14px;
    background: var(--surface);
    border-right: 0.5px solid var(--border);
  }

  .sidebar .brand {
    padding: 0 10px 18px;
  }

  .sidebar .new-btn {
    margin: 0 4px 16px;
  }

  .sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .sidebar nav button {
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 550;
    color: var(--text);
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
  }

  .sidebar nav button .icon {
    color: var(--muted);
  }

  .sidebar nav button:hover {
    background: var(--fill);
  }

  .sidebar nav button.active {
    background: var(--primary-soft);
    color: var(--primary);
  }

  .sidebar nav button.active .icon {
    color: var(--primary);
  }

  .sidebar .foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .tabbar {
    display: none;
  }

  .app-main {
    padding: 28px 36px 16px;
    width: 100%;
  }

  .app-foot {
    width: 100%;
    padding: 8px 36px 28px;
  }
}

/* --- Agenda ----------------------------------------------------------------- */

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .seg {
  flex: 1;
  min-width: 240px;
  max-width: 420px;
}

.day-group {
  margin-bottom: 18px;
}

.day-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 4px 8px;
  font-size: 0.95rem;
  font-weight: 700;
}

.day-title .muted {
  font-weight: 500;
  font-size: 0.85rem;
}

.bk-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.bk {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 4px 12px;
  width: 100%;
  padding: 13px 14px;
  border: none;
  border-bottom: 0.5px solid var(--border);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  align-items: start;
}

.bk:last-child {
  border-bottom: none;
}

.bk:hover {
  background: var(--surface-2);
}

.bk .time {
  white-space: nowrap;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  border-left: 3px solid var(--primary);
  padding-left: 8px;
}

.bk .time small {
  display: block;
  font-weight: 500;
  color: var(--muted);
  font-size: 0.78rem;
}

.bk .who {
  min-width: 0;
}

.bk .name {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bk .what {
  color: var(--muted);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bk .tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.bk.cancelled {
  opacity: 0.55;
}

/* Seleção de várias marcações */
.bk.selectable {
  position: relative;
  padding-left: 52px;
}

.bk .pick {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 24px;
  height: 24px;
  margin-top: -12px;
  border-radius: 50%;
  border: 2px solid var(--faint);
  display: grid;
  place-items: center;
  color: #fff;
}

.bk.picked .pick {
  background: var(--danger);
  border-color: var(--danger);
}

.bk.picked .pick .icon {
  width: 16px;
  height: 16px;
}

.bk.selectable.cancelled.picked,
.bk.selectable.picked {
  opacity: 1;
  background: var(--surface-2);
}

.select-bar {
  position: fixed;
  z-index: 31;
  left: 12px;
  right: 12px;
  bottom: calc(var(--tabbar-h) + 14px + var(--safe-bottom));
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
  border: 0.5px solid var(--border);
}

.select-bar .count {
  flex: 1;
  font-weight: 600;
  white-space: nowrap;
}

.select-bar .btn.small {
  padding: 6px 10px;
}

@media (max-width: 480px) {
  .select-bar .count-label,
  .select-bar .btn-label {
    display: none;
  }

  /* No telemóvel os botões da seleção são só ícones */
  .select-bar .btn.small {
    width: 44px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
  }

  .select-bar .btn.small .icon {
    width: 20px;
    height: 20px;
  }

  .select-bar .count strong {
    display: inline-grid;
    place-items: center;
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border-radius: 14px;
    background: var(--fill);
  }
}

.agenda-list:has(+ .select-bar) {
  padding-bottom: 80px;
}

@media (min-width: 1024px) {
  .select-bar {
    bottom: 24px;
    left: calc(248px + 24px);
  }
}

.bk.cancelled .name {
  text-decoration: line-through;
}

.bk.cancelled .time {
  border-left-color: var(--faint);
}

.bk.done .time {
  border-left-color: var(--success);
}

.bk.noshow .time {
  border-left-color: var(--danger);
}

/* No Mac a agenda vira uma lista compacta em colunas */
@media (min-width: 1024px) {
  .bk {
    grid-template-columns: 124px minmax(180px, 1.3fr) minmax(200px, 1.6fr) 230px;
    align-items: center;
    padding: 11px 18px;
  }

  .bk .time small {
    display: inline;
    margin-left: 4px;
  }

  .bk .who .what {
    display: none;
  }

  .bk .desk-what {
    display: block !important;
    color: var(--muted);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bk .tags {
    margin-top: 0;
  }
}

.bk .desk-what {
  display: none;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}

.empty .icon {
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  color: var(--faint);
}

/* Sugestões de clientes */
.suggest {
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.suggest button {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: none;
  border-bottom: 0.5px solid var(--border);
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
}

.suggest button:last-child {
  border-bottom: none;
}

.suggest button:hover {
  background: var(--surface-2);
}

/* Faixa de instalação no iPhone */
.install-banner {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--primary-soft);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}

.install-banner img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

/* --- Painel (dashboard) ------------------------------------------------------ */

.kpis {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.kpi .label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 550;
}

.kpi .value {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi .delta {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 4px;
  color: var(--muted);
}

.kpi .delta.up {
  color: var(--success);
}

.kpi .delta.down {
  color: var(--danger);
}

.kpi.hero {
  grid-column: 1 / -1;
}

.kpi.hero .value {
  font-size: 2.6rem;
}

.dash-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  min-width: 0;
}

.panel h3 {
  margin-bottom: 2px;
}

.panel .sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
}

.panel .panel-list {
  margin: 0 -18px -16px;
}

.panel .panel-list .list-item {
  padding: 11px 18px;
}

@media (min-width: 700px) {
  .kpis {
    grid-template-columns: repeat(4, 1fr);
  }

  .kpi.hero {
    grid-column: span 2;
  }
}

@media (min-width: 1024px) {
  .kpis {
    grid-template-columns: repeat(6, 1fr);
  }

  .kpi.hero {
    grid-column: span 2;
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 22px;
  }

  .kpi.hero .value {
    font-size: 3.2rem;
  }

  .dash-grid {
    grid-template-columns: repeat(12, 1fr);
  }

  .span-12 {
    grid-column: span 12;
  }

  .span-8 {
    grid-column: span 8;
  }

  .span-6 {
    grid-column: span 6;
  }

  .span-4 {
    grid-column: span 4;
  }
}

/* Gráficos (SVG) */
.chart {
  position: relative;
  width: 100%;
}

.chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart .grid line {
  stroke: var(--chart-grid);
  stroke-width: 1;
}

.chart .baseline {
  stroke: var(--chart-axis);
  stroke-width: 1;
}

.chart .tick {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}

.chart .bar {
  fill: var(--chart);
  transition: opacity 0.12s;
}

.chart .hit {
  fill: transparent;
  cursor: default;
}

.chart .hit:hover + .bar,
.chart .bar.hover {
  opacity: 0.75;
}

.chart .value-label {
  fill: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  font-variant-numeric: tabular-nums;
}

.chart .cat-label {
  fill: var(--text);
  font-size: 13px;
  font-family: var(--font);
}

.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  color: var(--text);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-lg);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 0.82rem;
  white-space: nowrap;
  z-index: 5;
  transform: translate(-50%, calc(-100% - 10px));
}

.chart-tip strong {
  display: block;
  font-size: 0.95rem;
}

.chart-tip .muted {
  font-size: 0.78rem;
}

/* --- Gestão: componentes adicionais ------------------------------------------- */

.app-col {
  min-width: 0;
}

.desktop-only {
  display: none !important;
}

@media (min-width: 1024px) {
  .desktop-only {
    display: inline-flex !important;
  }
}

.login-view {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-top)) 16px calc(24px + var(--safe-bottom));
}

.login-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  padding: 28px 22px 24px;
}

.login-card .field {
  text-align: left;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin-bottom: 12px;
}

.page-sub {
  font-size: 0.92rem;
  margin-top: 2px;
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 28px 4px;
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--fill-strong);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.sheet {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sheet-head .btn.icon-only {
  margin: -6px -8px -6px 0;
  color: var(--muted);
}

.sheet-body > .group-title:first-child,
.sheet-body > .alert.hidden + .group-title {
  margin-top: 4px;
}

.btn.icon-only .icon {
  width: 22px;
  height: 22px;
}

.site-header .btn.icon-only {
  width: 36px;
  min-height: 36px;
  color: var(--primary);
}

/* Agenda: barra de ferramentas */
.toolbar .search-wrap {
  position: relative;
  order: 3;
  flex: 1 1 100%;
}

.search-wrap .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-input {
  padding-left: 40px;
  min-height: 42px;
  background: var(--fill);
  border-color: transparent;
}

.search-input:focus {
  background: var(--surface);
}

@media (min-width: 700px) {
  .toolbar .search-wrap {
    order: 0;
    flex: 0 1 300px;
  }
}

/* Agenda: Semana / Mês com anterior e seguinte */
.period-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.period-nav .period-label {
  min-width: 150px;
  text-align: center;
  font-size: 1rem;
}

.period-nav .btn.icon-only {
  width: 36px;
  min-height: 36px;
}

/* No telemóvel: as 5 vistas na primeira linha, pesquisa e filtros na segunda */
@media (max-width: 699px) {
  .toolbar .agenda-views {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
  }

  .agenda-views button {
    font-size: 0.8rem;
    padding: 8px 2px;
  }

  .toolbar .search-wrap {
    flex: 1 1 0;
  }

  .toolbar .filter-btn {
    order: 4;
  }
}

@media (min-width: 700px) {
  .toolbar .agenda-views {
    max-width: 520px;
  }
}

.range-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  max-width: 460px;
}

.range-row input {
  flex: 1;
  min-width: 0;
}

.coach-chips {
  margin-bottom: 12px;
}

.seg-scroll {
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
  flex: 1;
}

.seg-scroll::-webkit-scrollbar {
  display: none;
}

.toolbar .seg-scroll .seg,
.seg-scroll .seg {
  width: max-content;
  min-width: 100%;
  max-width: none;
  flex: none;
}

.seg-scroll .seg button {
  flex: 1 0 auto;
  padding-left: 12px;
  padding-right: 12px;
}

@media (min-width: 1024px) {
  .seg-scroll {
    flex: 0 1 auto;
  }
}

.compact-select {
  width: auto;
  min-height: 36px;
  padding: 6px 30px 6px 12px;
  font-size: 0.9rem;
  border-radius: 10px;
}

.seg button {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Linhas da agenda (telemóvel: hora | cliente, etiquetas por baixo; sem valores — esses ficam no painel) */
.bk .time {
  grid-row: 1 / span 2;
}

.bk .who {
  grid-column: 2;
  grid-row: 1;
}

.bk .tags {
  grid-column: 2 / -1;
  grid-row: 2;
}

.bk .tags:empty {
  display: none;
}

.badge .icon {
  width: 12px;
  height: 12px;
}

@media (min-width: 1024px) {
  .bk .time,
  .bk .who,
  .bk .tags {
    grid-row: auto;
    grid-column: auto;
  }

  .bk .tags:empty {
    display: block;
  }

  .bk .time small::before {
    content: '– ';
  }
}

.empty p {
  margin: 0 0 14px;
}

/* Detalhe da marcação */
.when {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.when-date {
  font-weight: 700;
  font-size: 1.08rem;
}

.when-time {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2px 0 4px;
}

.when-time .muted {
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0;
}

.when-client {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.when .tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.when .tags:empty {
  display: none;
}

.method-chips {
  margin-top: 10px;
}

.method-chips .chip {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 0.86rem;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 8px;
  align-items: center;
  margin-top: 14px;
}

.price-row label {
  grid-column: 1 / -1;
  margin: 0;
}

.client-notes p {
  margin: 0;
  white-space: pre-wrap;
}

.block textarea {
  min-height: 80px;
}

.alert.warn {
  background: var(--warning-soft);
  color: var(--text);
}

/* Sessão online sem link: botão "Criar link" e o motivo quando não dá */
.link-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.link-reason {
  max-width: 340px;
  text-align: right;
  color: var(--danger);
}

.conflicts ul {
  margin: 6px 0 10px;
  padding-left: 18px;
}

.danger-row {
  color: var(--danger);
}

/* Nova marcação */
.options.compact {
  gap: 8px;
}

.options.compact .option {
  padding: 12px 14px;
  box-shadow: none;
  border-color: var(--border-strong);
  border-width: 1px;
}

.options.compact .option.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.static-value {
  font-weight: 600;
  padding: 4px 0;
}

.avatar.xs {
  width: 24px;
  height: 24px;
  font-size: 0.65rem;
  margin-left: -8px;
}

.picker-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
}

.picker-label label {
  margin: 0;
}

.picker > label.picker-label {
  margin: 14px 0 8px;
}

.day-strip {
  margin-top: 6px;
  margin-bottom: 8px;
}

.picker input[type='date'] {
  margin-bottom: 6px;
}

.chip.day.other .icon {
  width: 20px;
  height: 20px;
}

.time-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.time-row input {
  width: 130px;
}

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

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--fill);
  border-radius: 12px;
  padding: 3px;
}

.stepper .btn {
  background: var(--surface);
  width: 36px;
  min-height: 34px;
  padding: 0;
  font-size: 1.1rem;
}

.stepper input {
  width: 52px;
  min-height: 34px;
  text-align: center;
  padding: 4px;
  border: none;
  background: transparent;
  font-weight: 700;
  -moz-appearance: textfield;
}

.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.price-input {
  max-width: 200px;
}

.suggest-field {
  position: relative;
}

.suggest-field .suggest {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
}

.suggest-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

details.more {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 6px;
}

details.more summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
}

details.more summary::-webkit-details-marker {
  display: none;
}

details.more summary::after {
  content: '+';
  color: var(--muted);
  font-weight: 500;
}

details.more[open] summary::after {
  content: '−';
}

.more-body {
  padding: 0 16px 4px;
}

/* Listas (coaches, tipos de sessão, painel) */
.list-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  text-align: left;
}

.list-text .name {
  font-weight: 650;
}

.group-row > .icon:last-child {
  color: var(--faint);
}

.group-row .amount {
  font-weight: 650;
}

.panel-list .list-item {
  gap: 8px;
}

.list-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.list-main .list-text .name,
.list-main .list-text .small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-main .amount {
  margin-left: auto;
  font-weight: 650;
  white-space: nowrap;
}

.date-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
  line-height: 1.05;
}

.date-chip .dw {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
}

.date-chip .dn {
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-link {
  margin: 12px -6px -6px auto;
  display: flex;
  color: var(--primary);
}

.panel-link .icon {
  width: 16px;
  height: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

/* Painel: KPIs */
.kpi-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 4px;
}

.meter {
  height: 6px;
  border-radius: 4px;
  background: var(--fill);
  margin-top: 12px;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--chart);
}

.table-toggle {
  margin-top: 10px;
}

.table-toggle summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 0.88rem;
  font-weight: 600;
}

.table-toggle .table-wrap {
  margin-top: 10px;
}

.table-wrap.flat {
  box-shadow: none;
  border: 0.5px solid var(--border);
}

/* Barras horizontais */
.hbars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hbar-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.92rem;
}

.hbar-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar-value {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hbar-track {
  height: 8px;
  margin-top: 6px;
}

.hbar-track span {
  display: block;
  height: 100%;
  background: var(--chart);
  border-radius: 0 4px 4px 0;
  min-width: 0;
}

.hbar-sub {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.chart .bar {
  pointer-events: none;
}

.chart .hit {
  touch-action: pan-y;
}

.zoom-row {
  flex-wrap: wrap;
}

.zoom-row .list-text {
  gap: 4px;
  align-items: flex-start;
}

.steps-list {
  padding-left: 20px;
  margin: 8px 0 10px;
}

.steps-list li {
  margin-bottom: 8px;
}

.steps-list .copy-row {
  margin-top: 6px;
}

.steps-list code,
.panel code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--fill);
  padding: 1px 5px;
  border-radius: 5px;
}

/* --- Páginas do cliente (marcação e "a minha marcação") ------------------------ */

.zone-note {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.zone-note .btn.link {
  font-size: 0.85rem;
  font-weight: 600;
}

.zone-picker {
  margin-top: 16px;
  max-width: 360px;
}

.done-hero {
  text-align: center;
  margin: 6px 0 4px;
}

.done-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  background: var(--success-soft);
  color: var(--success);
  font-size: 1.7rem;
  font-weight: 700;
}

.done-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.done-actions .btn.link {
  align-self: center;
  margin-top: 4px;
}

.manage-head {
  margin: 4px 0 16px;
}

.manage-head .badge {
  margin-right: 6px;
}

.manage-head h1 {
  margin: 10px 0 4px;
}

.manage-head p {
  margin: 0;
}

.manage-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.manage-actions .btn.large.danger {
  background: var(--surface);
}

.section-title {
  font-size: 1.05rem;
  margin: 20px 0 10px;
}

.muted-when .when-date {
  font-size: 1rem;
  margin-top: 2px;
}

.chip.day .dm {
  font-size: 0.68rem;
  opacity: 0.75;
}

.chip.day {
  flex-shrink: 0;
}

@media (min-width: 641px) {
  .done-actions,
  .manage-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .manage-actions .btn.large,
  .done-actions .btn {
    width: auto;
    flex: 1 1 200px;
  }

  .done-actions .btn.link {
    flex: 0 0 100%;
  }
}

/* --- Modo incorporado (widget noutro site) ------------------------------------ */

html.embed body {
  background: transparent;
}

html.embed .site-header,
html.embed .intro {
  display: none;
}

html.embed .container {
  padding: 12px 12px 16px;
}

html.embed h1 {
  font-size: 1.35rem;
}

/* Sem rede (dados guardados pelo service worker) */
html.offline body::before {
  content: 'Sem rede: a mostrar os últimos dados guardados';
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--warning);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  white-space: nowrap;
}

/* Próximas vagas: marcação num toque */
.quick-picks {
  margin: -4px -4px 22px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--primary) 22%, transparent) 0%, transparent 60%),
    var(--primary-soft);
  border: 1px solid color-mix(in srgb, var(--primary) 18%, transparent);
}
.quick-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.quick-head h3 {
  margin: 0;
  font-size: 15px;
}
.quick-head .muted {
  margin-left: auto;
}
.quick-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
  animation: quick-pulse 2s infinite;
}
.quick-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.quick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 92px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px);
  animation: quick-in 0.35s ease-out forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.quick-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 18%, transparent);
}
.quick-card:active {
  transform: scale(0.97);
}
.quick-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.quick-day {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.quick-time {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
}
.quick-meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.quick-card.skeleton {
  cursor: default;
  box-shadow: none;
  background: linear-gradient(90deg, var(--fill) 0%, var(--fill-strong) 50%, var(--fill) 100%);
  background-size: 200% 100%;
  animation: quick-in 0.2s forwards, quick-shimmer 1.2s linear infinite;
}
@keyframes quick-in {
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes quick-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}
@keyframes quick-pulse {
  70% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}
@media (max-width: 380px) {
  .quick-time {
    font-size: 22px;
  }
  .quick-card {
    padding: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .quick-card,
  .quick-card.skeleton,
  .quick-dot {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

/* Programas do INFLOW Hub: indicador na agenda e anel na ficha */
.badge.program {
  background: color-mix(in srgb, #6d4bd8 12%, var(--surface));
  color: #5b3cc4;
  font-variant-numeric: tabular-nums;
}
.badge.program.ending {
  background: var(--warning-soft);
  color: var(--warning);
}
.program-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}
.program-block.ending {
  border-color: color-mix(in srgb, var(--warning) 40%, transparent);
  background: color-mix(in srgb, var(--warning) 6%, var(--surface));
}
.program-ring {
  position: relative;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
}
.program-ring svg {
  display: block;
}
.program-ring .track {
  fill: none;
  stroke: var(--fill-strong);
  stroke-width: 7;
}
.program-ring .fill {
  fill: none;
  stroke: #6d4bd8;
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}
.program-block.ending .program-ring .fill {
  stroke: var(--warning);
}
.program-ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.program-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}
.program-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .badge.program {
    background: color-mix(in srgb, #8b6cf0 22%, var(--surface));
    color: #c3b2ff;
  }
}
:root[data-theme='dark'] .badge.program {
  background: color-mix(in srgb, #8b6cf0 22%, var(--surface));
  color: #c3b2ff;
}

/* Eventos (página pública) */
.event-cover {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin: 8px 0 4px;
}
.event-hero .badge {
  margin-bottom: 8px;
}
.event-description p {
  margin: 0 0 12px;
  white-space: pre-line;
}
.seats {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--muted);
}
.seats-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--fill);
  overflow: hidden;
}
.seats-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.6s ease;
}
.seats.full .seats-bar span {
  background: var(--warning);
}
.event-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.done-check.wait {
  background: var(--warning-soft);
  color: var(--warning);
}

/* Eventos (gestão) */
.fill-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  color: var(--muted);
}
.fill-row .seats-bar {
  flex: 0 0 90px;
  height: 6px;
}
.reg-group {
  margin: 16px 0 6px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.reg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;
}
.reg-row + .reg-row {
  border-top: 1px solid var(--border);
}
.reg-actions {
  gap: 6px;
  flex-wrap: wrap;
}
.date-rows .interval-row input[type='date'] {
  flex: 1.4;
}

.warn-text {
  color: var(--warning);
  font-weight: 600;
}

/* Eventos: escolha de edição e lista /eventos */
.editions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 4px 0 16px;
}
.edition {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.edition:hover {
  border-color: var(--primary);
}
.edition:active {
  transform: scale(0.98);
}
.edition.current {
  border: 2px solid var(--primary);
  background: var(--primary-soft);
}
.edition-mode {
  font-weight: 650;
}
.edition-when {
  font-size: 14px;
  color: var(--muted);
}
.edition-seats {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
}
.edition-seats.full {
  color: var(--warning);
}
.edition-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.edition-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.edition-row:hover {
  border-color: var(--primary);
}
.edition-row .edition-when {
  grid-column: 1;
}
.edition-row .edition-seats {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}
.event-card h2 {
  margin: 8px 0 4px;
}

.reg-answers {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 4px;
  color: var(--text);
}

/* Lista de espera para as próximas edições */
.interest-card {
  margin-top: 16px;
  scroll-margin-top: 72px;
}
.interest-card .perk {
  font-weight: 600;
}
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Telemóvel na ficha: guardar nos contactos e WhatsApp ao lado do número */
.phone-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.phone-actions .btn.small {
  min-height: 30px;
  padding: 4px 10px;
}
