/* Variables and base styles are defined in the Phase 1 block below */

* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 0;
  box-sizing: border-box;
  overflow: hidden;
}

#tenant-dashboard {
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 0;
}

#platform-admin-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

#platform-admin-panel .workspace-shell {
  flex: 1;
  min-height: 0;
  align-items: stretch;
  grid-template-rows: 1fr;
}

#platform-admin-panel .workspace-content {
  overflow-y: auto;
  min-height: 0;
  padding: 16px;
}

#platform-admin-panel .module-sidebar {
  height: 100%;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-2);
  font-size: 0.8rem;
  margin: 0 0 8px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
  margin-bottom: 12px;
  max-width: 12ch;
}

.lede {
  color: var(--muted);
  max-width: 56ch;
}

.lede.small,
.helper {
  font-size: 0.98rem;
}

.hero-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-shell {
  display: grid;
  grid-template-columns: minmax(220px, 240px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  height: 100%;
}

.workspace-content {
  min-width: 0;
  overflow-y: auto;
  min-height: 0;
}

.module-sidebar {
  height: 100%;
  position: static;
}

/* Dark green sidebar panel */
.sidebar-panel {
  background: #1a3a26;
  border-radius: 18px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  height: 100%;
}

/* Brand / logo area */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.03em;
}

.sidebar-biz-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Nav menu inside sidebar */
.module-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  flex: 1;
  overflow-y: auto;
  scrollbar-width: none;
}

.module-menu::-webkit-scrollbar { display: none; }

.module-menu button {
  width: 100%;
  min-width: 0;
  text-align: left;
}

.module-menu button.ghost {
  background: transparent;
  border-color: transparent;
  color: rgba(255, 255, 255, 0.65);
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.88rem;
  gap: 9px;
}

.module-menu button.ghost:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: transparent;
}

.module-menu button.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: transparent;
  box-shadow: none;
}

.sidebar-report-btn {
  margin-top: 8px;
  opacity: 0.5;
  font-size: 0.82rem !important;
}

.sidebar-env-info {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.3);
  text-align: center;
  padding: 8px 4px 2px;
  letter-spacing: 0.04em;
}

.sidebar-flex-spacer {
  flex: 1;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.sidebar-plan-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 140ms ease;
}

.sidebar-plan-card:hover {
  background: rgba(255, 255, 255, 0.12);
}

.sidebar-plan-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.03em;
}

.sidebar-plan-info {
  min-width: 0;
  flex: 1;
}

.sidebar-plan-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.sidebar-plan-tier {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-platform-btn {
  background: transparent !important;
  border-color: transparent !important;
  color: rgba(255, 255, 255, 0.5) !important;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 0.82rem;
  gap: 8px;
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  box-shadow: none !important;
}

.sidebar-platform-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: rgba(255, 255, 255, 0.85) !important;
}

#tenant-dashboard,
#platform-admin-panel,
[data-module-id],
#platform-module-directory,
#platform-module-commercial,
#platform-module-users {
  scroll-margin-top: 108px;
}

[data-module-id].module-hidden {
  display: none !important;
}

[data-module-id].module-enter {
  animation: module-enter-fade 380ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-module-id].module-enter .panel,
[data-module-id].module-enter .metric,
[data-module-id].module-enter .card,
[data-module-id].module-enter .schedule-segment,
[data-module-id].module-enter .slot {
  animation: module-enter-rise 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes module-enter-fade {
  from {
    opacity: 0.7;
  }

  to {
    opacity: 1;
  }
}

@keyframes module-enter-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#business-summary .card {
  min-height: 100%;
}

.pill {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 0.95rem;
}

.pill.muted {
  background: var(--surface-2);
  color: var(--ink);
}

.grid {
  display: grid;
  gap: 18px;
}

.metrics {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.metrics.compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.auth-panel {
  margin-bottom: 18px;
}

.auth-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-org-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-setup {
  margin-top: 14px;
}

.auth-setup-copy {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

#org-setup-details {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

#org-setup-details[open] {
  padding-bottom: 4px;
}

.org-setup-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  background: var(--surface-alt, #f8f6f1);
  list-style: none;
  font-size: 0.875rem;
}

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

.org-setup-summary::marker {
  display: none;
}

.org-setup-summary:hover {
  background: var(--border);
}

.org-setup-summary-label {
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-setup-summary-hint {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.02em;
}

#org-setup-details > *:not(summary) {
  padding-left: 14px;
  padding-right: 14px;
}

#org-setup-details > button {
  margin: 8px 14px 10px;
  padding-left: 0;
  padding-right: 0;
  width: calc(100% - 28px);
}

#organization-upgrade-plans {
  border-top: 1px solid var(--border);
}

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

.upgrade-plan-card {
  padding: 16px;
}

.upgrade-plan-card.current {
  border-color: var(--accent);
  background: #eef7f2;
}

.upgrade-plan-price {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.upgrade-plan-features {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.upgrade-plan-features li + li {
  margin-top: 4px;
}

.upgrade-plan-cta {
  margin-top: 12px;
}

.billing-overview-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.billing-breakdown-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  background: rgba(247, 241, 227, 0.7);
}

.billing-breakdown-card span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.billing-overview-stat,
.billing-breakdown-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  min-height: 168px;
  overflow: hidden;
}

.billing-breakdown-card strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1.05;
  margin-bottom: 8px;
}

.payment-history-list {
  margin-top: 8px;
}

.payment-history-card {
  background: rgba(255, 253, 248, 0.95);
}

.billing-overview-stat {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: white;
}

.billing-overview-stat span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.billing-overview-stat strong {
  display: block;
  font-size: 1.1rem;
}

.billing-overview-note {
  margin: 0;
  color: var(--muted);
}

#user-invitations .card {
  background: #fff8e7;
}

#sign-in {
  min-height: 24px;
}

.schedule-panel {
  margin-bottom: 18px;
}

.two-up {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-bottom: 18px;
}

.panel,
.metric {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.metric strong {
  display: block;
  font-size: 2rem;
  margin-bottom: 4px;
}

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

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

.stack {
  display: grid;
  gap: 12px;
}

.stack.compact {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  margin-bottom: 14px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  padding: 14px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card.interactive {
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.card.interactive:hover {
  transform: translateY(-1px);
  border-color: #b8aa84;
  box-shadow: 0 14px 28px rgba(60, 52, 36, 0.08);
}

.card.selected {
  border-color: var(--accent);
  background: #eef7f2;
}

.card.past-appointment {
  background: #fbf7ee;
  border-style: dashed;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.card h3 {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.card-head {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 10px;
}

.meta {
  color: var(--muted);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.helper {
  color: var(--muted);
  margin-bottom: 12px;
}

.helper.error-text {
  color: var(--danger);
}

.schedule-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.legend {
  display: inline-flex;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.legend.appointment {
  background: #e7f2eb;
  color: #16573e;
}

.legend.free {
  background: #f5edd7;
  color: #7a5613;
}

.legend.blocked {
  background: #f5dddd;
  color: #7e2323;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.checkbox-row input {
  width: auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger {
  border-color: #d3a4a4;
  color: var(--danger);
}

.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-field {
  min-width: 180px;
}

.team-row {
  align-items: end;
}

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

.schedule-segment {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: white;
}

.schedule-segment.free {
  background: #fff8e7;
}

.schedule-segment.blocked {
  background: #fff1f1;
}

.schedule-segment.appointment {
  background: #edf7f2;
}

.schedule-time {
  font-weight: 700;
}

.schedule-copy h3 {
  margin-bottom: 4px;
}

.schedule-copy p {
  margin-bottom: 0;
}

.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.slot {
  padding: 10px 12px;
  border-radius: 999px;
  background: #ebf6f1;
  border: 1px solid #b5d9c9;
  color: #18533d;
  cursor: pointer;
}

.slot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 20px 28px;
  gap: 10px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--accent);
  opacity: 0.45;
  margin-bottom: 6px;
}

.empty-state h4 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  font-weight: 700;
}

.empty-state p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--muted);
  max-width: 34ch;
  line-height: 1.5;
}

.empty-state button {
  margin-top: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.82rem;
  margin-left: 8px;
  background: #f0e6ce;
  color: #6c4b13;
  white-space: nowrap;
  text-align: center;
}

.badge.confirmed {
  background: #dff4ea;
  color: #16573e;
}

.badge.pending_confirmation {
  background: #fff1d8;
  color: #8a5512;
}

.badge.cancelled {
  background: #f5dede;
  color: #7e2323;
}

.badge.no_show {
  background: #e4d5f5;
  color: #3d1e6e;
}

.badge.completed {
  background: #dde3db;
  color: #2e3e2b;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(31, 42, 31, 0.16);
  backdrop-filter: blur(2px);
  z-index: 60;
}

.loading-card {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.loading-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(31, 122, 90, 0.22);
  border-top-color: var(--accent);
  animation: loading-spin 0.8s linear infinite;
}

@keyframes loading-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  z-index: 9999;
}

.toast.error {
  background: var(--danger);
}

/* Ocultar "Manage account" del popup de Clerk — los usuarios no deben editar la cuenta de Clerk directamente */
.cl-userButtonPopoverActionButton__manageAccount,
[data-localization-key="userButton.action__manageAccount"] {
  display: none !important;
}

.hidden {
  display: none;
}

@media (max-width: 700px) {
  .hero {
    flex-direction: column;
  }

  h1 {
    max-width: none;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .shell {
    height: auto;
    overflow: visible;
    padding: 10px 10px 36px;
    gap: 6px;
  }

  #tenant-dashboard {
    height: auto;
    flex: none;
    min-height: 0;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-up {
    grid-template-columns: 1fr;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
    height: auto;
    align-items: start;
  }

  .workspace-content {
    overflow-y: visible;
  }

  .module-sidebar {
    position: static;
    height: auto;
  }

  .sidebar-panel {
    height: auto;
  }

  .sidebar-flex-spacer {
    display: none;
  }

  /* Mobile: sidebar becomes horizontal scrollable tab bar */
  .sidebar-panel {
    border-radius: 16px;
    padding: 8px 10px;
    position: relative;
    overflow: hidden;
  }

  .sidebar-brand { display: none; }

  .module-menu {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 6px;
    padding: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }

  .module-menu::-webkit-scrollbar { display: none; }

  .module-menu button.ghost {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    width: auto;
    min-width: 64px;
    max-width: 80px;
    min-height: 58px;
    padding: 10px 8px;
    font-size: 0.66rem;
    font-weight: 700;
    text-align: center;
    border-radius: 12px;
    scroll-snap-align: start;
    line-height: 1.2;
    white-space: normal;
    word-break: keep-all;
    color: rgba(255,255,255,0.65);
  }

  .module-menu button svg {
    width: 20px;
    height: 20px;
    opacity: 1;
  }

  .sidebar-report-btn { display: none; }

  .actions-row {
    flex-direction: column;
  }

  .schedule-segment {
    grid-template-columns: 1fr;
  }
}

/* ── Design tokens ────────────────────────────────────────────────── */

:root {
  --bg: #f4efe5;
  --bg-deep: #ebe3d4;
  --surface: rgba(255, 252, 246, 0.94);
  --surface-2: #f6efe1;
  --surface-3: #fcf8f1;
  --ink: #203126;
  --muted: #4e5a4b;
  --line: #d8ccb3;
  --line-strong: #c9b894;
  --accent: #1d7a5b;
  --accent-strong: #165c45;
  --accent-soft: rgba(29, 122, 91, 0.12);
  --accent-2: #cc6b2c;
  --accent-2-soft: rgba(204, 107, 44, 0.12);
  --danger: #943737;
  --shadow-sm: 0 4px 12px rgba(59, 45, 24, 0.06);
  --shadow: 0 20px 44px rgba(59, 45, 24, 0.08);
  --shadow-strong: 0 24px 60px rgba(44, 32, 17, 0.12);
  --radius-panel: 30px;
  --radius-card: 22px;
  --radius-control: 16px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
}

html {
  scroll-behavior: smooth;
}

body {
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(204, 107, 44, 0.18), transparent 25%),
    radial-gradient(circle at 90% 8%, rgba(29, 122, 91, 0.2), transparent 24%),
    radial-gradient(circle at 30% 100%, rgba(233, 221, 196, 0.5), transparent 32%),
    linear-gradient(180deg, #f8f2e7 0%, #f3ece1 100%);
  background-attachment: fixed;
}

h1,
h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  letter-spacing: -0.02em;
}

.shell {
  padding: 8px;
}

#app-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.shell-surface {
  position: relative;
  overflow: hidden;
}

.shell-surface::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.36), transparent 38%),
    radial-gradient(circle at top right, rgba(29, 122, 91, 0.08), transparent 28%),
    radial-gradient(circle at bottom left, rgba(204, 107, 44, 0.08), transparent 24%);
  pointer-events: none;
}

.panel,
.metric {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(250, 244, 235, 0.94));
  border: 1px solid rgba(201, 184, 148, 0.72);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
}

.inset-panel {
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(247, 239, 225, 0.96));
}

.auth-panel {
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Slim topbar mode when user is logged in */
.auth-panel--topbar #organization-controls {
  display: none !important;
}

.auth-panel--topbar {
  position: fixed;
  top: 10px;
  right: 12px;
  z-index: 200;
  width: auto !important;
  height: auto !important;
  padding: 6px 10px !important;
  background: rgba(255, 252, 246, 0.92) !important;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(201, 184, 148, 0.45) !important;
  border-radius: 100px !important;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.1) !important;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  overflow: visible;
}

.auth-panel--topbar .notif-bell {
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--ink, #1a1a1a);
}

.auth-panel--topbar #auth-meta {
  gap: 4px;
}

.platform-refresh-btn {
  display: none !important;
}

html[data-app-route="/platform"] .auth-panel--topbar .platform-refresh-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ink, #1a1a1a);
  padding: 0;
}

.auth-panel--topbar::before {
  display: none;
}

.auth-panel--topbar .panel-head,
.auth-panel--topbar #sign-in,
.auth-panel--topbar #organization-setup,
.auth-panel--topbar #user-invitations {
  display: none !important;
}

.auth-panel--topbar #auth-meta {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  position: static;
}

.auth-panel .panel-head,
#platform-admin-panel > .panel-head {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(216, 204, 179, 0.8);
}

.panel-head {
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.panel-head > div,
.panel-head > p,
.panel-head > h2,
.panel-head > h3 {
  min-width: 0;
  flex-shrink: 1;
}

.panel-head > button,
.panel-head > .button-row {
  flex-shrink: 0;
}

.panel-head h2,
.panel-head h3 {
  margin-bottom: 6px;
}

.panel-head h2 {
  font-size: clamp(1.4rem, 2.8vw, 2.7rem);
}

.panel-head h3 {
  font-size: clamp(1.1rem, 1.8vw, 1.7rem);
}

.eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--accent-2);
  font-weight: 700;
}

.helper,
.lede.small,
.meta,
label {
  color: var(--muted);
}

.helper {
  max-width: 66ch;
}

.product-hero {
  align-items: stretch;
  gap: 30px;
  padding: 34px 34px 30px;
  margin-bottom: 28px;
}

.product-hero > :first-child {
  flex: 1 1 0;
  min-width: 0;
}

.product-hero > :last-child {
  display: flex;
  align-content: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  min-width: min(240px, 100%);
}

h1 {
  font-size: clamp(2.6rem, 4vw, 5rem);
  line-height: 0.92;
  margin-bottom: 16px;
  max-width: 10ch;
}

.lede {
  font-size: 1.08rem;
  line-height: 1.58;
  max-width: 58ch;
}

.hero-meta {
  gap: 12px;
  align-items: flex-start;
}

.pill {
  padding: 10px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(29, 122, 91, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.pill.muted {
  background: rgba(255, 250, 242, 0.9);
  color: var(--ink);
  border-color: rgba(201, 184, 148, 0.72);
}

.workspace-shell {
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  height: 100%;
}

.workspace-content {
  display: grid;
  gap: 22px;
  overflow-y: auto;
  min-height: 0;
  align-content: start;
}

.module-sidebar {
  height: 100%;
  position: static;
}

.module-menu-shell {
  padding: 18px;
  border-radius: 28px;
  border: 1px solid rgba(201, 184, 148, 0.72);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0.96), rgba(244, 236, 222, 0.92));
  box-shadow: var(--shadow);
}

.module-menu {
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.module-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  font-weight: 700;
  border-radius: 18px;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.module-menu button svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

.module-menu button.active svg {
  opacity: 1;
}

.module-menu button:hover {
  transform: translateY(-1px);
}

.module-menu-shell .module-menu button.ghost {
  background: rgba(255, 251, 245, 0.96);
  border-color: rgba(201, 184, 148, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: var(--ink, #1a1a1a);
}

.module-menu-shell .module-menu button.ghost:hover {
  background: rgba(255, 248, 238, 0.98);
  color: var(--ink, #1a1a1a);
  border-color: rgba(180, 162, 128, 0.9);
}

.module-menu-shell .module-menu button.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 28px rgba(22, 92, 69, 0.22);
  color: #fff;
}

.module-menu-shell .module-menu button.active svg {
  opacity: 1;
  color: #fff;
}

.metrics {
  gap: 16px;
  margin-bottom: 0;
}

.metric {
  padding: 22px 20px 18px;
  min-height: 136px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-top: 4px solid rgba(29, 122, 91, 0.18);
}

.metric strong {
  font-size: clamp(1.6rem, 3vw, 2.7rem);
  line-height: 0.92;
  margin-bottom: 14px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-wrap: balance;
  color: var(--accent-strong);
}

.metric span {
  font-size: 0.98rem;
  line-height: 1.3;
  max-width: 14ch;
}

.metric-denom {
  font-size: 0.48em;
  color: var(--muted);
  font-weight: 400;
  font-family: "Aptos", "Segoe UI", "Trebuchet MS", sans-serif;
  letter-spacing: 0;
}

.metric-bar-track {
  height: 5px;
  background: rgba(201, 184, 148, 0.38);
  border-radius: 999px;
  overflow: hidden;
  margin-top: auto;
  padding-top: 10px;
}

.metric-bar-track::after {
  content: none;
}

/* use a wrapper so margin-top: auto works on the bar track */
.metric.with-bar {
  gap: 6px;
}

.metric.with-bar .metric-bar-track {
  display: block;
  flex-shrink: 0;
}

.metric-bar-fill {
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: 999px;
  transition: width 700ms cubic-bezier(0.2, 0.8, 0.2, 1);
  min-width: 2px;
}

.metric-bar-fill.warn {
  background: linear-gradient(90deg, #cc6b2c, #b05522);
}

.metric-bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #7a2020);
}

.two-up {
  gap: 22px;
  margin-bottom: 0;
}

.stack {
  gap: 14px;
}

.stack.compact {
  gap: 12px;
}

.card {
  padding: 18px;
  border-radius: var(--radius-card);
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(247, 241, 229, 0.9));
  border: 1px solid rgba(216, 204, 179, 0.82);
  box-shadow: 0 12px 28px rgba(59, 45, 24, 0.06);
}

.card.interactive:hover {
  transform: translateY(-2px);
  border-color: rgba(29, 122, 91, 0.42);
  box-shadow: 0 16px 34px rgba(59, 45, 24, 0.1);
}

.card.selected {
  border-color: rgba(29, 122, 91, 0.55);
  background: linear-gradient(180deg, rgba(239, 248, 243, 0.98), rgba(231, 243, 236, 0.96));
}

.card-head {
  gap: 10px;
  flex-wrap: nowrap;
  justify-content: flex-start;
}

.card-head > div {
  min-width: 0;
  flex: 1 1 0;
}

.card-head .badge {
  flex-shrink: 0;
  margin-left: auto;
}

.card h3 {
  margin-bottom: 8px;
  font-size: clamp(1.0rem, 1.5vw, 1.6rem);
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.card p:last-child,
.panel p:last-child,
.helper:last-child,
.meta:last-child {
  margin-bottom: 0;
}

label {
  gap: 8px;
  font-size: 0.93rem;
  font-weight: 600;
}

input,
select,
textarea {
  padding: 13px 14px;
  border-radius: var(--radius-control);
  border-color: rgba(201, 184, 148, 0.84);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.66);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(29, 122, 91, 0.72);
  box-shadow:
    0 0 0 4px rgba(29, 122, 91, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  background: white;
}

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

button {
  padding: 13px 18px;
  border-radius: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 14px 24px rgba(22, 92, 69, 0.18);
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    opacity 140ms ease,
    background 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(22, 92, 69, 0.24);
}

button.ghost,
button.secondary {
  background: rgba(255, 252, 246, 0.92);
  color: var(--ink);
  border: 1px solid rgba(201, 184, 148, 0.82);
  box-shadow: none;
}

.button-row,
.actions-row,
.card-actions {
  gap: 12px;
}

.badge {
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.badge.confirmed {
  border-color: rgba(22, 87, 62, 0.16);
}

.badge.pending_confirmation {
  border-color: rgba(138, 85, 18, 0.16);
}

.badge.cancelled {
  border-color: rgba(126, 35, 35, 0.14);
}

.badge.completed {
  border-color: rgba(80, 96, 85, 0.14);
}

.billing-overview-grid,
.billing-breakdown-grid {
  gap: 14px;
}

.billing-overview-stat,
.billing-breakdown-card {
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(245, 239, 228, 0.9));
  border-color: rgba(216, 204, 179, 0.84);
}

.billing-overview-stat strong,
.billing-breakdown-card strong {
  font-size: clamp(1.8rem, 2.8vw, 2.5rem);
  line-height: 0.98;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: pretty;
  hyphens: none;
}

#tenant-billing-overview .billing-overview-stat strong {
  font-size: clamp(1.8rem, 2.6vw, 3rem);
  line-height: 0.96;
  letter-spacing: -0.03em;
}

#tenant-billing-overview .billing-overview-stat:nth-child(2) strong,
#tenant-billing-overview .billing-overview-stat:nth-child(3) strong,
#tenant-billing-overview .billing-overview-stat:nth-child(4) strong,
#tenant-billing-overview .billing-overview-stat:nth-child(5) strong {
  font-size: clamp(1.08rem, 1.7vw, 1.55rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

#billing-summary .billing-breakdown-card strong,
#platform-commercial-summary .billing-breakdown-card strong {
  font-size: clamp(1.45rem, 2.1vw, 2.2rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

#billing-summary .billing-breakdown-card p,
#platform-commercial-summary .billing-breakdown-card p {
  margin: 0;
}

.schedule {
  gap: 14px;
}

.schedule-segment {
  grid-template-columns: 128px 1fr auto;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.98), rgba(246, 239, 226, 0.92));
  border-color: rgba(216, 204, 179, 0.82);
  box-shadow: 0 12px 28px rgba(59, 45, 24, 0.05);
}

.schedule-segment.free {
  background: linear-gradient(180deg, rgba(255, 248, 232, 0.98), rgba(250, 240, 214, 0.95));
}

.schedule-segment.blocked {
  background: linear-gradient(180deg, rgba(255, 241, 241, 0.98), rgba(251, 229, 229, 0.95));
}

.schedule-segment.appointment {
  background: linear-gradient(180deg, rgba(239, 248, 243, 0.98), rgba(232, 243, 237, 0.95));
}

.schedule-time {
  font-size: 1.1rem;
  line-height: 1.2;
}

.slots {
  gap: 12px;
}

.slot {
  padding: 11px 14px;
  font-weight: 700;
  background: rgba(234, 246, 240, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.slot:hover {
  transform: translateY(-1px);
  background: rgba(222, 242, 232, 0.98);
}

.empty {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px dashed rgba(201, 184, 148, 0.9);
  background: rgba(255, 251, 244, 0.72);
}

.toast {
  right: 24px;
  bottom: 24px;
  border-radius: 18px;
  background: rgba(31, 49, 38, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-strong);
}

.loading-card {
  border-radius: 20px;
}

#platform-business-list .card,
#platform-users-list .card,
#whatsapp-messages .card,
#audit-list .card,
#platform-audit-list .card {
  overflow: hidden;
}

#platform-commercial-summary,
#platform-audit-list,
#business-summary,
#billing-summary {
  gap: 16px;
}

@media (max-width: 980px) {
  .shell {
    height: auto;
    overflow: visible;
    padding: 10px 10px 48px;
  }

  #app-shell {
    flex: none;
  }

  #tenant-dashboard {
    height: auto;
    flex: none;
    min-height: 0;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
    height: auto;
    align-items: start;
  }

  .workspace-content {
    overflow-y: visible;
  }

  .module-sidebar {
    position: static;
    height: auto;
  }

  .sidebar-panel {
    height: auto;
  }

  .sidebar-flex-spacer {
    display: none;
  }

  .auth-panel--topbar {
    height: auto;
    padding: 6px 8px;
  }

  .module-menu-shell {
    padding: 16px;
  }

  .module-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: none;
    overflow-y: visible;
  }

  .product-hero {
    padding: 26px 24px 24px;
  }
}

@media (max-width: 700px) {
  .shell {
    height: auto;
    overflow: visible;
    padding: 10px 10px 32px;
    overflow-x: hidden;
  }

  #app-shell {
    flex: none;
  }

  #tenant-dashboard {
    height: auto;
    flex: none;
    min-height: 0;
  }

  .workspace-shell {
    grid-template-columns: 1fr;
    height: auto;
    align-items: start;
  }

  .workspace-content {
    overflow-y: visible;
  }

  .module-sidebar {
    position: static;
    height: auto;
  }

  .sidebar-panel {
    height: auto;
  }

  .module-menu {
    flex: none;
    overflow-y: visible;
  }

  .panel {
    padding: 18px;
    border-radius: 24px;
  }

  .product-hero {
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border-radius: 24px;
    margin: 0 18px 14px;
    width: calc(100% - 36px);
    box-sizing: border-box;
  }

  .product-hero > :last-child {
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
  }

  h1 {
    font-size: clamp(20px, 7vw, 40px);
    max-width: none;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .hero-meta {
    width: 100%;
  }

  .hero-meta .pill {
    justify-content: center;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    min-height: 118px;
    padding: 18px 16px 16px;
  }

  .module-menu {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .module-menu button {
    padding: 12px 12px;
    font-size: 0.94rem;
  }

  .schedule-segment {
    grid-template-columns: 1fr;
  }

  .actions-row,
  .button-row,
  .card-actions {
    flex-direction: column;
  }
}

/* Phase 2: operational agenda + admin workspace */

.platform-business-grid,
.platform-commercial-grid {
  align-items: start;
}

.platform-business-create,
.platform-business-directory,
.platform-business-editor,
.platform-business-summary-panel,
.platform-business-activity-panel,
.agenda-hero-panel,
.agenda-appointments-panel,
.agenda-availability-panel,
.agenda-editor-panel,
.agenda-support-panel,
.agenda-blocked-list-panel,
.agenda-blocked-form-panel {
  position: relative;
}

.platform-business-create::after,
.platform-business-editor::after,
.agenda-editor-panel::after,
.agenda-hero-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(29, 122, 91, 0.2));
}

.platform-business-directory::after,
.platform-business-summary-panel::after,
.platform-business-activity-panel::after,
.agenda-appointments-panel::after,
.agenda-availability-panel::after,
.agenda-blocked-list-panel::after,
.agenda-blocked-form-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(204, 107, 44, 0.9), rgba(204, 107, 44, 0.18));
}

.platform-business-grid {
  grid-template-columns: minmax(340px, 0.95fr) minmax(420px, 1.05fr);
}

.platform-commercial-grid {
  grid-template-columns: minmax(420px, 1.1fr) minmax(340px, 0.9fr);
}

.platform-business-editor {
  grid-row: span 2;
}

.platform-business-summary-panel .card:first-child,
.platform-business-activity-panel .card:first-child,
.platform-business-directory .card:first-child {
  background: linear-gradient(180deg, rgba(255, 253, 249, 1), rgba(244, 238, 225, 0.92));
}

#platform-business-list,
#platform-audit-list,
#platform-commercial-summary {
  gap: 18px;
}

#platform-business-list .card,
#platform-audit-list .card,
#platform-commercial-summary .card {
  padding: 20px;
}

#platform-business-list .card .actions-row {
  margin-top: 16px;
}

.agenda-hero-panel {
  padding-bottom: 28px;
}

.agenda-hero-panel .panel-head {
  margin-bottom: 20px;
}

.agenda-hero-panel .schedule {
  gap: 16px;
}

.agenda-planning-grid {
  grid-template-columns: minmax(360px, 0.95fr) minmax(320px, 0.85fr);
}

.agenda-editor-panel {
  background:
    linear-gradient(180deg, rgba(255, 251, 245, 0.99), rgba(244, 237, 223, 0.96)),
    var(--surface);
}

.agenda-editor-panel form {
  display: grid;
  gap: 14px;
}

.agenda-editor-panel .card.compact {
  background: linear-gradient(180deg, rgba(239, 248, 243, 0.98), rgba(229, 240, 234, 0.92));
  border-color: rgba(29, 122, 91, 0.24);
}

.agenda-support-grid,
.agenda-blocks-grid {
  grid-template-columns: minmax(360px, 1fr);
}

.agenda-support-panel .stack {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.agenda-support-panel .card {
  min-height: 100%;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(247, 240, 228, 0.92));
}

.agenda-appointments-panel #appointments-list,
.agenda-blocked-list-panel #blocked-slots-list,
.agenda-availability-panel #availability-list {
  margin-top: 10px;
}

.agenda-appointments-panel .card,
.agenda-blocked-list-panel .card {
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(246, 239, 226, 0.92));
}

.agenda-appointments-panel .card.selected {
  background: linear-gradient(180deg, rgba(238, 248, 242, 0.98), rgba(227, 242, 234, 0.96));
}

.agenda-availability-panel .slots {
  align-content: flex-start;
  min-height: 120px;
}

.agenda-availability-panel .slot {
  min-width: 116px;
  justify-content: center;
}

.schedule-copy h3,
#appointments-list .card h3,
#clients-list .card h3,
#platform-business-list .card h3 {
  line-height: 1.05;
}

.schedule-copy p,
#appointments-list .meta,
#clients-list .meta,
#platform-business-list .meta {
  line-height: 1.42;
}

@media (max-width: 1100px) {
  .platform-business-grid,
  .platform-commercial-grid,
  .agenda-planning-grid {
    grid-template-columns: 1fr;
  }

  .platform-business-editor {
    grid-row: auto;
  }
}

@media (max-width: 700px) {
  .platform-business-grid,
  .platform-commercial-grid,
  .agenda-planning-grid {
    grid-template-columns: 1fr;
  }

  .platform-business-editor {
    grid-row: auto;
  }
}

/* Phase 3: finish module consistency and empty states */

.business-context-grid,
.subscription-grid,
.team-grid,
.clients-grid,
.services-grid,
.whatsapp-grid {
  align-items: start;
}

.business-profile-panel,
.business-context-panel,
.subscription-plan-panel,
.subscription-usage-panel,
.team-management-panel,
.team-context-panel,
.clients-list-panel,
.client-form-panel,
.services-list-panel,
.service-form-panel,
.whatsapp-queue-panel,
.whatsapp-templates-panel {
  position: relative;
}

.business-profile-panel::after,
.subscription-plan-panel::after,
.team-management-panel::after,
.client-form-panel::after,
.service-form-panel::after,
.whatsapp-templates-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(29, 122, 91, 0.18));
}

.business-context-panel::after,
.subscription-usage-panel::after,
.team-context-panel::after,
.clients-list-panel::after,
.services-list-panel::after,
.whatsapp-queue-panel::after {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(204, 107, 44, 0.9), rgba(204, 107, 44, 0.18));
}

.business-context-grid,
.subscription-grid,
.team-grid,
.clients-grid,
.services-grid,
.whatsapp-grid {
  grid-template-columns: minmax(360px, 1fr) minmax(340px, 0.95fr);
}

.subscription-plan-panel #tenant-billing-overview,
.subscription-usage-panel #billing-summary,
.whatsapp-queue-panel #whatsapp-provider-status,
.whatsapp-queue-panel #whatsapp-messages,
.whatsapp-templates-panel #whatsapp-template-list {
  margin-top: 12px;
}

.business-context-panel .card,
.team-context-panel .card,
.subscription-plan-panel .card,
.subscription-usage-panel .card,
.clients-list-panel .card,
.services-list-panel .card,
.whatsapp-queue-panel .card,
.whatsapp-templates-panel .card {
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(246, 239, 226, 0.92));
}

.clients-list-panel .card.selected,
.services-list-panel .card.selected,
.whatsapp-templates-panel .card.selected {
  background: linear-gradient(180deg, rgba(238, 248, 242, 0.98), rgba(227, 242, 234, 0.96));
}

#team-list,
#team-invitations,
#clients-list,
#services-list,
#whatsapp-messages,
#whatsapp-template-list {
  gap: 16px;
}

#team-list .card,
#clients-list .card,
#services-list .card,
#whatsapp-messages .card,
#whatsapp-template-list .card {
  padding: 20px;
}

.subscription-usage-panel .billing-breakdown-grid,
.subscription-plan-panel .billing-breakdown-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.empty {
  display: flex;
  align-items: center;
  gap: 12px;
  font-style: normal;
  color: var(--muted);
}

.empty::before {
  content: "·";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(29, 122, 91, 0.08);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

#whatsapp-metrics .metric span,
#platform-metrics .metric span,
#metrics .metric span {
  max-width: none;
}

.team-management-panel form,
.client-form-panel form,
.service-form-panel form,
.whatsapp-templates-panel form {
  margin-top: 10px;
}

.whatsapp-grid {
  grid-template-columns: minmax(420px, 1.15fr) minmax(360px, 0.85fr);
}

.whatsapp-queue-panel .metrics.compact {
  margin-bottom: 14px;
}

.whatsapp-queue-panel .card-head + p,
.whatsapp-templates-panel .card-head + p {
  margin-top: 10px;
}

/* ── Form sections ───────────────────────────────────────────────── */

.form-section {
  display: grid;
  gap: 16px;
}

.form-section + .form-section {
  padding-top: 22px;
  border-top: 1px solid rgba(216, 204, 179, 0.65);
}

.form-section.two-col {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-items: end;
}

/* section titles inside form-section always span full width */
.form-section .form-section-title {
  grid-column: 1 / -1;
}

.form-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-2);
  margin: 0;
}

/* section title used as flat divider inside stack.compact multi-column grid */
.stack.compact .form-section-title {
  grid-column: 1 / -1;
  padding-top: 14px;
  border-top: 1px solid rgba(216, 204, 179, 0.65);
}

.stack.compact .form-section-title:first-child {
  padding-top: 0;
  border-top: none;
}

/* ── Button loading state ─────────────────────────────────────────── */

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: currentColor;
  animation: loading-spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ghost/secondary buttons have dark text, adjust spinner tones */
button.ghost .btn-spinner,
button.secondary .btn-spinner {
  border-color: rgba(32, 49, 38, 0.18);
  border-top-color: var(--ink);
}

/* auto-flex the button content when spinner is present */
button:has(.btn-spinner) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0.82;
}

/* ── Toast — mobile safe area ─────────────────────────────────────── */

.toast {
  bottom: max(20px, calc(env(safe-area-inset-bottom, 0px) + 16px));
}

/* ── Mobile refinements ───────────────────────────────────────────── */

/* ensure minimum 44px touch target on interactive elements */
@media (hover: none) and (pointer: coarse) {
  button,
  input,
  select,
  textarea {
    min-height: 44px;
  }

  .slot,
  .slot-button,
  .module-menu button {
    min-height: 44px;
  }

  /* larger tap area on card interactive */
  .card.interactive {
    cursor: default;
  }
}

/* very small screens: nav buttons icon+text may overflow — go single column */
@media (max-width: 400px) {
  .module-menu {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .business-context-grid,
  .subscription-grid,
  .team-grid,
  .clients-grid,
  .services-grid,
  .whatsapp-grid {
    grid-template-columns: 1fr;
  }
}

/* ── 480px: small phones ──────────────────────────────────── */
@media (max-width: 480px) {
  .panel {
    padding: 16px;
    border-radius: 20px;
  }

  .product-hero {
    padding: 18px 16px 16px;
    border-radius: 20px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric {
    padding: 14px 12px 12px;
    min-height: 100px;
  }

  .metric strong {
    font-size: 1.6rem;
  }

  .schedule-segment {
    grid-template-columns: 1fr;
  }

  .agenda-calendar-wrap .cw-nav-btn {
    width: 36px;
    height: 36px;
  }

  .module-menu button {
    padding: 10px 8px;
    font-size: 0.72rem;
  }

  .actions-row,
  .button-row,
  .card-actions {
    flex-direction: column;
  }

  .actions-row button,
  .button-row button,
  .card-actions button {
    width: 100%;
    justify-content: center;
  }
}

/* ── Quick client create dialog ──────────────────────────── */
button.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.quick-client-dialog {
  border: none;
  border-radius: 20px;
  padding: 0;
  max-width: min(92vw, 440px);
  width: 100%;
  box-shadow: 0 24px 60px rgba(60, 52, 36, 0.18);
  background: var(--surface-3);
}

.quick-client-dialog::backdrop {
  background: rgba(30, 40, 30, 0.45);
  backdrop-filter: blur(2px);
}

.quick-client-dialog-inner {
  padding: 24px;
}

.quick-client-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.quick-client-dialog-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  flex-shrink: 0;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Agenda calendar widget ───────────────────────────────── */
.agenda-calendar-wrap {
  margin-bottom: 14px;
}

.agenda-calendar-wrap .cw-root {
  max-width: 100%;
}

.agenda-calendar-wrap .cw-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.agenda-calendar-wrap .cw-month-label {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
}

.agenda-calendar-wrap .cw-nav-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--muted);
  padding: 0;
  transition: border-color 0.12s, color 0.12s;
}

.agenda-calendar-wrap .cw-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.agenda-calendar-wrap .cw-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.agenda-calendar-wrap .cw-day-header {
  text-align: center;
  font-size: clamp(0.68rem, 1.8vw, 0.72rem);
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  padding: 2px 0 5px;
}

.agenda-calendar-wrap .cw-cell {
  aspect-ratio: 1;
  border: 1.5px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: clamp(0.78rem, 2vw, 0.82rem);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s;
  padding: 0;
  color: var(--ink);
}

.agenda-calendar-wrap .cw-cell--empty,
.agenda-calendar-wrap .cw-cell--disabled {
  color: #c4cec9;
  border: none;
  cursor: default;
  pointer-events: none;
}

.agenda-calendar-wrap .cw-cell--available {
  border-color: rgba(29, 122, 91, 0.25);
  color: var(--accent);
}

.agenda-calendar-wrap .cw-cell--available:hover {
  background: rgba(29, 122, 91, 0.07);
  border-color: var(--accent);
}

.agenda-calendar-wrap .cw-cell--today {
  position: relative;
}

.agenda-calendar-wrap .cw-cell--today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}

.agenda-calendar-wrap .cw-cell--selected {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: white !important;
}

/* ── Stats ──────────────────────────────────────────────────────────────────── */
.stats-grid { display: flex; flex-direction: column; gap: 16px; }
.stats-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.stats-details { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .stats-details { grid-template-columns: 1fr; } }
.stats-block { }
.stats-block h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.stats-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.peak-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.peak-bar-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: 1; height: 100%; }
.peak-bar { width: 100%; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 3px; transition: height 0.2s; }
.peak-bar-wrap span { font-size: 0.6rem; color: var(--text-muted); }

/* ── Announcement banner ────────────────────────────────────────────────────── */
#announcements-banner { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.announcement-banner { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius); font-size: 0.875rem; border-left: 3px solid; }
.announcement-banner strong { flex-shrink: 0; font-weight: 600; }
.announcement-banner span { flex: 1; }
.announcement-close { flex-shrink: 0; background: none; border: none; cursor: pointer; font-size: 1rem; line-height: 1; color: inherit; opacity: 0.6; }
.announcement-close:hover { opacity: 1; }
.announcement-info { background: #e8f4fd; border-color: #2196f3; color: #0d47a1; }
.announcement-warning { background: #fff8e1; border-color: #ffc107; color: #6d4c00; }
.announcement-alert { background: #fdecea; border-color: #f44336; color: #7f0000; }

/* ── Day grid ───────────────────────────────────────────────────────────────── */
.day-grid { position: relative; overflow: auto; }
.day-grid-inner { position: relative; height: 700px; display: grid; grid-template-columns: 48px 1fr; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.day-grid-hour { position: absolute; left: 0; right: 0; display: grid; grid-template-columns: 48px 1fr; pointer-events: none; }
.day-grid-hour span { font-size: 0.68rem; color: var(--text-muted); padding: 0 4px; line-height: 1; }
.day-grid-hour::after { content: ''; display: block; border-top: 1px solid var(--border); }
.day-grid-events { position: absolute; left: 48px; right: 0; top: 0; bottom: 0; }
.day-grid-block { position: absolute; left: 2px; right: 2px; border-radius: 4px; padding: 4px 6px; font-size: 0.78rem; overflow: hidden; cursor: pointer; border-left: 3px solid; }
.day-grid-block strong { display: block; font-weight: 600; font-size: 0.8rem; }
.day-grid-block span { display: block; line-height: 1.2; }
.day-grid-block.status-confirmed { background: #e8f5e9; border-color: #4caf50; color: #1b5e20; }
.day-grid-block.status-pending_confirmation { background: #fff8e1; border-color: #ff9800; color: #5d3c00; }
.day-grid-block.status-cancelled { background: #fce4ec; border-color: #e91e63; color: #4a0020; opacity: 0.6; }
.day-grid-block.status-no_show { background: #f3e5f5; border-color: #9c27b0; color: #2a003a; opacity: 0.6; }
@media (max-width: 600px) { .day-grid-inner { height: 500px; } }

/* ── Onboarding funnel ──────────────────────────────────────────────────────── */
.onboarding-funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-step { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.funnel-step-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-alt, #f8f6f1); font-size: 0.85rem; }
.funnel-score { font-weight: 700; font-size: 1rem; min-width: 28px; }
.funnel-label { flex: 1; color: var(--text-muted); }
.funnel-businesses { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; }
.funnel-biz { font-size: 0.78rem; background: var(--surface-alt, #f0ece4); border-radius: 4px; padding: 2px 8px; }
.funnel-biz.churn-risk { background: #fdecea; color: #c62828; border: 1px solid #ef9a9a; }
.funnel-bar-track { flex: 1; height: 6px; background: var(--border, #e0d8c8); border-radius: 999px; overflow: hidden; }
.funnel-bar-fill { height: 100%; border-radius: 999px; transition: width 400ms ease; }
.platform-search-meta { font-size: 0.8rem; color: var(--text-muted, #888); margin-bottom: 6px; }
.field-error { border-color: var(--danger, #c0392b) !important; }
.pagination-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0 4px; border-top: 1px solid var(--border, #e0d8c8); margin-top: 8px; }
.doc-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border, #e0d8c8); }
.doc-row:last-child { border-bottom: none; }
.doc-icon { font-size: 1.4rem; flex-shrink: 0; }
.doc-info { flex: 1; min-width: 0; }
.doc-name { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Client detail dialog */
.client-detail-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; font-size: 0.9rem; color: var(--text-muted, #666); }
.client-detail-notes { background: var(--surface-alt, #f9f6f0); border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; margin-bottom: 12px; }
.client-stats-row { display: flex; gap: 0; border: 1px solid var(--border, #e0d8c8); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.client-stat { flex: 1; text-align: center; padding: 10px 4px; border-right: 1px solid var(--border, #e0d8c8); }
.client-stat:last-child { border-right: none; }
.client-stat-val { display: block; font-size: 1.3rem; font-weight: 700; color: var(--text, #1a1a1a); }
.client-stat-label { display: block; font-size: 0.7rem; color: var(--text-muted, #888); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px; }
.section-divider { display: flex; align-items: center; justify-content: space-between; margin: 0 0 10px; }
.section-divider h4 { margin: 0; font-size: 0.95rem; }
.upload-label-btn { cursor: pointer; padding: 4px 10px; border: 1px solid var(--border, #ccc); border-radius: 6px; font-size: 0.82rem; }

/* Document grid */
#doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 8px; }
.doc-card { border: 1px solid var(--border, #e0d8c8); border-radius: 10px; overflow: hidden; background: var(--surface, #fff); display: flex; flex-direction: column; }
.doc-thumb { height: 90px; background: var(--surface-alt, #f5f1eb); display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; }
.doc-thumb-img { width: 100%; height: 100%; object-fit: cover; transition: transform 200ms; }
.doc-thumb-img:hover { transform: scale(1.05); }
.doc-thumb-placeholder { font-size: 2.2rem; }
.doc-card-body { padding: 6px 8px; flex: 1; }
.doc-card-body .doc-name { display: block; font-size: 0.78rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.doc-card-body .meta { display: block; font-size: 0.7rem; line-height: 1.3; }
.doc-card-actions { display: flex; gap: 4px; padding: 4px 6px 6px; }
.doc-card-actions a, .doc-card-actions button { flex: 1; text-align: center; font-size: 0.75rem; padding: 3px 0; }

/* Appointment history rows */
.appt-history-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border, #e0d8c8); }
.appt-history-row:last-child { border-bottom: none; }
.appt-history-time { font-weight: 600; font-size: 0.88rem; }

/* Lightbox */
#doc-lightbox { display: none; position: fixed; inset: 0; z-index: 9999; align-items: center; justify-content: center; }
#doc-lightbox.active { display: flex; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.85); }
.lightbox-content { position: relative; z-index: 1; max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lightbox-close { position: absolute; top: -36px; right: 0; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.lightbox-title { color: #fff; font-size: 0.85rem; margin: 0; max-width: 80vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lightbox-img { max-width: 90vw; max-height: 80vh; border-radius: 8px; object-fit: contain; display: block; }

/* ── Integration card ───────────────────────────────────────────────────────── */
.integration-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface, #fff); }
.integration-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.integration-card-head svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--accent-1); }
.integration-card-head strong { flex: 1; font-size: 1rem; }

/* ── Agenda Workspace (3-column redesign) ───────────────────────────────────── */
.agenda-workspace { display: flex; flex-direction: column; gap: 14px; }

.agenda-day-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.agenda-strip-card {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 18px 14px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
}

.agenda-strip-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(29, 122, 91, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.agenda-strip-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.agenda-strip-card strong {
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-strip-card span {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
}

.agenda-strip-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-strip-card.accent-confirmed .agenda-strip-icon { background: rgba(29, 122, 91, 0.1); color: #1d7a5b; }
.agenda-strip-card.accent-confirmed strong { color: #1d7a5b; }
.agenda-strip-card.accent-pending .agenda-strip-icon { background: rgba(180, 83, 9, 0.1); color: #b45309; }
.agenda-strip-card.accent-pending strong { color: #b45309; }
.agenda-strip-card.accent-muted .agenda-strip-icon { background: rgba(78, 90, 75, 0.1); color: var(--muted); }
.agenda-strip-card.accent-muted strong { color: var(--muted); }
.agenda-strip-card.accent-income .agenda-strip-icon { background: rgba(29, 122, 91, 0.08); color: #1d7a5b; }
.agenda-strip-card.accent-income strong { color: var(--ink); }

.agenda-three-col {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 440px;
  gap: 14px;
  align-items: start;
}

/* Left panel */
.agenda-left-panel {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  box-shadow: var(--shadow);
  scrollbar-width: none;
}

.agenda-left-panel::-webkit-scrollbar { display: none; }

.agenda-date-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.agenda-date-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-filter-block {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.agenda-avail-block {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 4px;
}

.agenda-staff-select {
  display: block;
  width: 100%;
  margin-top: 8px;
  height: 34px;
  font-size: 0.83rem;
  border: 1px solid rgba(201, 184, 148, 0.84);
  border-radius: 10px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
}

/* Center panel */
.agenda-center-panel {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  min-height: 320px;
  box-shadow: var(--shadow);
}

.agenda-center-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.agenda-timeline { gap: 10px !important; }

/* Right panel */
.agenda-right-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  max-height: calc(100vh - 20px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 184, 148, 0.5) transparent;
}

.agenda-right-card {
  background: rgba(255, 251, 245, 0.98);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 14px 12px;
  position: relative;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.agenda-right-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(29, 122, 91, 0.15));
}

.agenda-right-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.agenda-right-card-head h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.agenda-right-card form.stack {
  gap: 8px;
}

.agenda-right-card label {
  font-size: 0.88rem;
  gap: 4px;
}

.agenda-right-card input,
.agenda-right-card select,
.agenda-right-card textarea {
  padding: 8px 10px;
  font-size: 0.88rem;
}

.agenda-right-card textarea {
  min-height: 60px;
}

.agenda-right-card .card.compact {
  padding: 8px 12px;
}

.agenda-right-card .card.compact h3 {
  font-size: 0.82rem;
  margin-bottom: 2px;
}

.agenda-right-card .actions-row {
  gap: 6px;
  margin-top: 2px;
}

.agenda-right-card button[type=submit] {
  padding: 10px 14px;
  font-size: 0.88rem;
}

.agenda-right-card button.ghost {
  padding: 8px 12px;
  font-size: 0.85rem;
}

.agenda-block-details summary {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  padding: 8px 0 0;
  list-style: none;
}

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

/* Agenda workspace responsive */
@media (max-width: 1200px) {
  .agenda-three-col { grid-template-columns: 220px minmax(0, 1fr) 280px; }
}

@media (max-width: 1024px) {
  .agenda-three-col { grid-template-columns: 200px minmax(0, 1fr); }
  .agenda-right-panel { position: static; max-height: none; grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .agenda-right-card { flex: 1; min-width: 260px; }
}

@media (max-width: 860px) {
  .agenda-three-col { grid-template-columns: 1fr; }
  .agenda-left-panel { position: static; max-height: none; }
  .agenda-right-panel { flex-direction: column; }
  .agenda-day-strip { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .agenda-day-strip { grid-template-columns: repeat(2, 1fr); }
  .agenda-strip-card strong { font-size: 1.6rem; }
}

/* ── Summary Dashboard ──────────────────────────────────────────────────── */
/* ── Dashboard (Resumen) ────────────────────────────────────────────────── */
.summary-wrapper {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dash-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.dash-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.dash-date {
  font-size: 0.84rem;
  color: var(--muted);
  margin: 0;
  text-transform: capitalize;
}

/* ── Base card ── */
.dash-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

/* ── Row 1: KPI cards ── */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.dash-kpi-card {
  background: #fff;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dash-kpi-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-kpi-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.dash-kpi-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--ink, #1a1a1a);
}

.dash-kpi-number--warn { color: #d97706; }

.dash-kpi-trend {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.dash-kpi-trend-label {
  font-size: 0.72rem;
  color: var(--muted);
}

.dash-kpi-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.dash-kpi-sparkline {
  width: 68px;
  height: 28px;
  flex-shrink: 0;
}

.dash-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dash-metric-row .dash-kpi-sparkline {
  width: 56px;
  height: 24px;
}

/* ── Row 2: Agenda | Métricas | Clientes ── */
.dash-mid-row {
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Agenda card */
.dash-appt-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 300px;
  margin-bottom: 12px;
}

.dash-appt-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #f0ece4;
}

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

.dash-appt-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink, #1a1a1a);
  min-width: 46px;
  flex-shrink: 0;
}

.dash-appt-info {
  flex: 1;
  overflow: hidden;
}

.dash-appt-name {
  font-size: 0.87rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.dash-appt-service {
  font-size: 0.71rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.dash-add-appt-btn {
  width: 100%;
  text-align: center;
  border: 1px dashed var(--border) !important;
  border-radius: 8px !important;
  padding: 7px 0 !important;
}

/* Metrics card */
.dash-metrics-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dash-metric-block {
  padding: 10px 0;
  border-bottom: 1px solid #f0ece4;
}

.dash-metric-block:first-child { padding-top: 0; }
.dash-metric-block:last-child { border-bottom: none; padding-bottom: 0; }

.dash-metric-sublabel {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0 0 3px;
}

.dash-metric-big {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1;
  margin: 0 0 4px;
}

.dash-metric-trend {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.dash-metric-trend-label {
  font-size: 0.71rem;
  color: var(--muted);
}

/* Clients card */
.dash-card--clients {
  display: flex;
  flex-direction: column;
}

.dash-client-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  margin-bottom: 12px;
}

.dash-client-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 3px 4px;
  transition: background 0.12s;
}

.dash-client-row:hover { background: #f8f5f0; }

.dash-client-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dash-client-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}

.dash-client-name {
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-client-email {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-all-clients-btn {
  width: 100%;
  text-align: center;
}

/* ── Row 3: Estadísticas | Historial ── */
.dash-bot-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Stats card */
.dash-stats-body {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}

.dash-stats-revenue {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.dash-stats-eyebrow {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 4px;
}

.dash-stats-big {
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1;
}

.dash-stats-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-stats-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin: 0 0 6px;
}

.dash-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  padding: 4px 0;
  border-bottom: 1px solid #f0ece4;
}

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

/* Historial preview card */
.dash-hist-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.dash-hist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f0ece4;
}

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

.dash-hist-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.dash-hist-body {
  flex: 1;
  overflow: hidden;
}

.dash-hist-text {
  font-size: 0.83rem;
  margin: 0 0 2px;
  line-height: 1.3;
}

.dash-hist-time {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

/* ── Shared delta badge ── */
.dash-delta {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.dash-delta.up {
  background: rgba(29,122,91,0.12);
  color: #1d7a5b;
}

.dash-delta.down {
  background: rgba(192,57,43,0.10);
  color: #c0392b;
}

.dash-empty {
  font-size: 0.83rem;
  color: var(--muted);
  padding: 8px 0;
}

/* ── Notification bell ──────────────────────────────────────────────────── */
.notif-bell-wrap {
  position: relative;
}

.notif-bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--fg, #1a1a1a);
  transition: background 0.15s;
  padding: 0;
}

.notif-bell:hover { background: var(--surface); }

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 16px;
  height: 16px;
  background: var(--danger);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}

.notif-badge.hidden { display: none; }

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 288px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  z-index: 200;
  overflow: hidden;
}

.notif-dropdown.hidden { display: none; }

.notif-dropdown-head {
  padding: 11px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.notif-list {
  max-height: 320px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

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

.notif-item[style*="cursor:pointer"]:hover { background: var(--surface-alt, #f4efe5); }

.notif-item.notif-read { opacity: 0.45; }

.notif-item-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: currentColor;
  background: rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

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

.notif-item-title {
  font-size: 0.84rem;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-item-desc {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 2px 0 0;
}

.notif-empty {
  padding: 18px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.notif-dropdown-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Peak bars (stats) */
.peak-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 52px;
}

.peak-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  height: 100%;
}

.peak-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height 0.2s;
}

.peak-bar-wrap span {
  font-size: 0.58rem;
  color: var(--muted);
}

/* Dashboard responsive */
@media (max-width: 1200px) {
  .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .dash-mid-row { grid-template-columns: 1fr 1fr; }
  .dash-mid-row .dash-card--agenda { grid-column: span 2; }
}

@media (max-width: 860px) {
  .dash-bot-row { grid-template-columns: 1fr; }
  .dash-stats-body { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dash-kpi-row { grid-template-columns: 1fr 1fr; }
  .dash-mid-row { grid-template-columns: 1fr; }
  .dash-mid-row .dash-card--agenda { grid-column: span 1; }
}

/* ── Agenda form enhancements ───────────────────────────────────────────── */
.form-row-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

/* Date + Time split row */
.date-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.date-time-row label {
  gap: 0;
}

/* Pill toggle (status / location) */
.pill-toggle {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pill-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  background: var(--surface-alt, #f4efe5);
  border: 1.5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1;
}

.pill-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pill-toggle-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Client card (selected client display) */
.appt-client-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-alt, #f4efe5);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.appt-client-card.hidden { display: none; }

.appt-client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.appt-client-info {
  flex: 1;
  min-width: 0;
}

.appt-client-info strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-client-info span {
  font-size: 0.76rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.appt-client-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
}

.appt-client-clear:hover { color: var(--danger); }

/* Service info (duration + price) */
.appt-service-info {
  font-size: 0.78rem;
  color: var(--muted);
  margin: -4px 0 0;
  display: flex;
  gap: 8px;
  align-items: center;
}

.appt-service-info:not(.hidden) { display: flex; }

.appt-service-tag {
  background: var(--surface-alt, #f4efe5);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.76rem;
  font-weight: 500;
}

/* Submit button area */
.appt-submit-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}

.appt-submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
}

.appt-secondary-actions {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.appt-secondary-actions button { font-size: 0.8rem; }

/* Timeline appointment cards - cleaner layout */
.schedule-segment.appointment .schedule-copy h3 {
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.schedule-segment.appointment .schedule-copy p {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Subscription billing dashboard ── */
.sub-panel {
  padding: 0;
  overflow: hidden;
}

.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.sub-status-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sub-status-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sub-status-icon.active   { background: #d1fae5; color: #065f46; }
.sub-status-icon.trialing { background: #dbeafe; color: #1e40af; }
.sub-status-icon.danger   { background: #fee2e2; color: #991b1b; }

.sub-status-text h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.sub-status-text p {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sub-zone-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 12px;
}

/* Usage zone */
.sub-usage-zone {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.sub-usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.sub-usage-card {
  background: var(--surface-alt, #f8f5ef);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.sub-usage-card.warn { border-color: #f59e0b; }
.sub-usage-card.over { border-color: #ef4444; background: #fff5f5; }

.sub-usage-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.sub-usage-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.sub-usage-count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

.sub-usage-count.warn { color: #d97706; }
.sub-usage-count.over { color: #dc2626; }

.sub-usage-total {
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--muted);
}

.sub-progress-track {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.sub-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.sub-progress-fill.warn { background: #f59e0b; }
.sub-progress-fill.over { background: #ef4444; }

.sub-usage-extra {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

.sub-usage-extra.warn { color: #d97706; font-weight: 600; }

/* Finances zone */
.sub-finances-zone {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.sub-finances-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.sub-finance-card {
  background: var(--surface-alt, #f8f5ef);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.sub-finance-card.highlighted {
  border-color: #ef4444;
  background: #fff5f5;
}

.sub-finance-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 6px;
}

.sub-finance-value {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.sub-finance-value.danger { color: #dc2626; }

.sub-finance-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
}

/* Actions zone */
.sub-actions-zone {
  padding: 16px 24px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 600px) {
  .sub-header { padding: 14px 16px; }
  .sub-usage-zone, .sub-finances-zone { padding: 14px 16px; }
  .sub-actions-zone { padding: 12px 16px; }
  .sub-finances-grid { grid-template-columns: 1fr; }
  .sub-usage-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Team module ── */
.team-module-panel { padding: 0; overflow: hidden; }

.team-invite-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt, #f8f5ef);
  flex-wrap: wrap;
}

.team-invite-bar input[type="email"] {
  flex: 1;
  min-width: 180px;
}

.team-invite-bar select { min-width: 120px; }

.team-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.team-member-row:last-child { border-bottom: none; }
.team-member-row:hover { background: var(--surface-alt, #f8f5ef); }

.team-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.team-avatar.inactive { background: var(--muted); }

.team-member-info {
  flex: 1;
  min-width: 0;
}

.team-member-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink, #203126);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-member-email {
  font-size: 0.76rem;
  color: var(--muted, #4e5a4b);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.team-role-select {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 6px;
  min-width: 110px;
  max-width: 160px;
  flex-shrink: 1;
}

.team-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.team-row-actions button {
  font-size: 0.76rem;
  padding: 4px 10px;
}

.team-invitation-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: #fffbeb;
}

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

.team-invitation-email {
  font-size: 0.85rem;
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-invitation-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

#team-list, #team-invitations { overflow: hidden; }

.team-panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.team-panel-head h2 { margin: 0; }
.team-panel-head .helper { margin: 2px 0 0; font-size: 0.82rem; }

.team-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding: 8px 20px 4px;
  background: var(--surface-alt, #f8f5ef);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 600px) {
  .team-invite-bar { flex-direction: column; align-items: stretch; }
  .team-invite-bar input, .team-invite-bar select { width: 100%; }
  .team-member-row { flex-wrap: wrap; }
  .team-row-actions { width: 100%; justify-content: flex-end; }
}
