/* Divine CRM — matches site luxury dark + gold */
:root {
  --bg: #0d0f12;
  --card: #15181d;
  --elevated: #1a1e24;
  --text: #e8eaed;
  --muted: #9ca3af;
  --accent: #d4a853;
  --accent-hover: #e4b963;
  --border: rgba(255, 255, 255, 0.08);
  --danger: #f87171;
  --radius: 12px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Syne", var(--font);
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  min-height: 100svh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.login-screen {
  min-height: 100dvh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1rem, env(safe-area-inset-top, 0px))
    max(1rem, env(safe-area-inset-right, 0px))
    max(1rem, env(safe-area-inset-bottom, 0px))
    max(1rem, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(ellipse 80% 60% at 50% -20%, rgba(212, 168, 83, 0.12), transparent),
    var(--bg);
}
/* [hidden] must win over display:flex/grid — otherwise both login + CRM show at once */
.login-screen[hidden] {
  display: none !important;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.login-kicker {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.login-card h1 {
  font-family: var(--display);
  font-size: 1.75rem;
  margin: 0 0 0.5rem;
}

.login-hint {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 1.5rem;
}

.field {
  display: block;
  margin-bottom: 1rem;
}
.field span {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font-size: 1rem;
}

.btn-primary,
.btn-ghost,
.btn-outline,
.btn-danger {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #111;
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: 100%;
}
.btn-ghost:hover {
  color: var(--text);
}
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(212, 168, 83, 0.4);
}
.btn-outline:hover {
  background: rgba(212, 168, 83, 0.1);
}
.btn-danger {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.msg-error {
  color: var(--danger);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

.login-foot {
  margin-top: 1.5rem;
  margin-bottom: 0;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 640px) {
  .login-card .field input {
    font-size: 16px;
  }
  .login-card .btn-primary {
    min-height: 48px;
  }
}

/* Shell */
.crm-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100dvh;
}
.crm-shell[hidden] {
  display: none !important;
}

/* Mobile: slide-out nav + top bar */
.crm-mobile-bar {
  display: none;
  align-items: center;
  gap: 0.75rem;
}

.crm-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--elevated);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.crm-hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 20px;
}

.crm-hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.crm-mobile-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.crm-sidebar-backdrop {
  display: none;
}

.crm-sidebar-close {
  display: none;
}

@media (max-width: 900px) {
  .crm-shell {
    grid-template-columns: 1fr;
  }

  .crm-mobile-bar {
    display: flex;
    margin: -1.5rem -1.75rem 1rem;
    padding: 0.65rem 1rem;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-top: max(0.65rem, env(safe-area-inset-top, 0px));
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
  }

  .crm-main {
    padding-top: 0.75rem;
  }

  .crm-top h1 {
    display: none;
  }

  .crm-top .view-desc {
    margin-top: 0;
  }

  .crm-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 200;
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  body.crm-nav-open .crm-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .crm-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(288px, 88vw);
    z-index: 210;
    margin: 0;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    padding-top: max(1rem, env(safe-area-inset-top, 0px));
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  }

  body.crm-nav-open .crm-sidebar {
    transform: translateX(0);
  }

  .crm-sidebar-close {
    display: flex;
    position: absolute;
    top: max(0.65rem, env(safe-area-inset-top, 0px));
    right: 0.65rem;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--elevated);
    color: var(--muted);
    cursor: pointer;
  }

  .crm-brand {
    padding-right: 2.5rem;
  }

  .crm-nav {
    flex-direction: column;
  }

  .crm-nav-btn {
    min-height: 46px;
    padding: 0.65rem 0.85rem;
    font-size: 0.95rem;
  }

  .crm-sidebar-bottom {
    margin-top: auto;
    padding-top: 1rem;
  }

  .crm-sidebar-bottom .btn-ghost {
    min-height: 46px;
  }
}

@media (max-width: 640px) {
  .crm-mobile-bar {
    margin: -1rem -1rem 0.85rem;
  }
}

.crm-sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

.crm-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.crm-logo {
  font-size: 1.5rem;
  color: var(--accent);
}
.crm-brand strong {
  display: block;
  font-family: var(--display);
  font-size: 1.05rem;
}
.crm-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.crm-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.crm-nav-btn {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.95rem;
  cursor: pointer;
}
.crm-nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}
.crm-nav-btn.is-active {
  color: var(--accent);
  background: rgba(212, 168, 83, 0.1);
  border-color: rgba(212, 168, 83, 0.25);
}

.crm-sidebar-bottom {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.session-email {
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-all;
  margin: 0 0 0.5rem;
}

.crm-main {
  padding: 1.5rem 1.75rem 2.5rem;
  padding-bottom: max(2.5rem, env(safe-area-inset-bottom, 0px));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .crm-main {
    padding: 1rem 1rem 2rem;
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
  }
}

.crm-top h1 {
  font-family: var(--display);
  font-size: clamp(1.25rem, 4.5vw, 1.65rem);
  margin: 0 0 0.35rem;
  line-height: 1.2;
}
.view-desc {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.grid-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 480px) {
  .grid-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }
  .kpi {
    padding: 0.85rem 0.75rem;
  }
  .kpi-value {
    font-size: 1.35rem;
  }
}

.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
}
.kpi-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.35rem;
}
.kpi-value {
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}
.kpi-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.panel h2 {
  font-family: var(--display);
  font-size: 1.1rem;
  margin: 0 0 1rem;
  color: var(--text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}
.toolbar input[type="search"],
.toolbar input[type="text"] {
  flex: 1;
  min-width: min(100%, 180px);
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font-size: 0.95rem;
}

@media (max-width: 640px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar .btn-outline {
    width: 100%;
    min-height: 44px;
  }
}

.table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  max-height: min(70vh, 640px);
  overflow-y: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.data th,
table.data td {
  padding: 0.65rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

@media (max-width: 640px) {
  table.data {
    font-size: 0.82rem;
  }
  table.data th,
  table.data td {
    padding: 0.55rem 0.5rem;
  }
  table.data .btn-outline,
  table.data .btn-danger {
    min-height: 44px;
    padding: 0.45rem 0.55rem;
    font-size: 0.85rem;
  }
}
table.data th {
  position: sticky;
  top: 0;
  background: var(--elevated);
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}
table.data tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-up {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.badge-past {
  background: rgba(156, 163, 175, 0.15);
  color: var(--muted);
}
.badge-cancelled {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

.bookings-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
}
.btn-segment {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}
.btn-segment.is-active {
  border-color: rgba(59, 130, 246, 0.5);
  color: var(--text);
  background: rgba(59, 130, 246, 0.12);
}

/* [hidden] must win: a plain .crm-modal-overlay { display: flex } overrides the UA [hidden] rule,
   so the overlay could stay on-screen and intercept clicks (e.g. calendar) while "closed". */
.crm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
}
.crm-modal-overlay:not([hidden]) {
  display: flex;
}
.crm-modal-overlay[hidden] {
  display: none !important;
  pointer-events: none !important;
}
.crm-modal {
  width: min(100%, 26rem);
  padding: 1.25rem;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.crm-modal-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.crm-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: flex-end;
}

.kpi-cancelled .kpi-value {
  color: #f87171;
}
.kpi-lost .kpi-value {
  color: var(--muted);
}

.form-row {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
@media (min-width: 560px) {
  .form-row.cols-2 {
    grid-template-columns: 1fr 1fr;
  }
}
.form-row label span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font: inherit;
}
.form-row textarea {
  resize: vertical;
  min-height: 4rem;
}

/* Prevent iOS zoom on focus (inputs under 16px trigger zoom) */
@media (max-width: 640px) {
  .form-row input,
  .form-row textarea,
  .form-row select,
  .field input {
    font-size: 16px;
  }
  .panel .btn-primary,
  .panel .btn-outline,
  .panel .btn-danger {
    min-height: 44px;
  }
  .form-row.cols-2 {
    grid-template-columns: 1fr;
  }
}

.team-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.team-row:last-child {
  border-bottom: none;
}
.team-row-body {
  flex: 1;
  min-width: 0;
}
.team-row-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.team-row-details {
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text);
}
.team-row-field {
  line-height: 1.4;
  word-break: break-word;
}
.team-row-label {
  color: var(--muted);
  margin-right: 0.35rem;
}
.team-row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .team-row {
    flex-direction: column;
    align-items: stretch;
  }
  .team-row-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .team-row-actions .btn-outline,
  .team-row-actions .btn-danger {
    flex: 1 1 auto;
    min-height: 44px;
    justify-content: center;
  }
}

.empty-state {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.msg-banner {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.msg-banner.error {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

/* Desktop: comfortable nav column */
@media (min-width: 901px) {
  .crm-nav-btn {
    min-height: 40px;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Booking calendar (matches public site ddw-cal-* — see styles.css) */
#view-bookings {
  --bg-elevated: var(--elevated);
  --bg-card: var(--card);
  --bg-dark: var(--bg);
  --text-muted: var(--muted);
  --accent-dim: rgba(212, 168, 83, 0.15);
  --success: #22c55e;
  --radius-lg: 20px;
  --font-sans: var(--font);
  --font-display: var(--display);
  --transition: 0.2s ease;
}

.crm-cal-outer {
  margin-top: 0.35rem;
}

.crm-cal-time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.crm-cal-time-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.crm-cal-time-row select {
  min-height: 44px;
  padding: 0.45rem 0.65rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--elevated);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
}

.crm-cal-tz {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.crm-service-estimate {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.ddw-calendar-root {
  margin-top: 0.65rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, var(--bg-elevated) 0%, var(--bg-card) 45%, #10141a 100%);
  border: 1px solid rgba(212, 168, 83, 0.14);
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow: hidden;
  position: relative;
}

.ddw-calendar-root.ddw-cal-is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(212, 168, 83, 0.06),
    transparent
  );
  background-size: 200% 100%;
  animation: ddw-cal-shimmer 1.2s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
  border-radius: inherit;
}

@keyframes ddw-cal-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ddw-calendar-root.ddw-cal-is-loading::before {
    animation: none;
    opacity: 0.4;
  }
}

.ddw-cal-header {
  padding: 1.1rem 0.85rem 0.95rem;
  background: linear-gradient(180deg, rgba(212, 168, 83, 0.09) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}

.ddw-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.ddw-cal-nav-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 3.5vw, 1.25rem);
  letter-spacing: -0.03em;
  color: var(--text);
  text-align: center;
  flex: 1;
  line-height: 1.15;
  padding: 0 0.25rem;
}

.ddw-cal-nav-arrow {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(13, 15, 18, 0.85);
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 300;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ddw-cal-nav-arrow span {
  position: relative;
  top: -1px;
}

.ddw-cal-nav-arrow:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: rgba(212, 168, 83, 0.4);
  color: var(--accent-hover);
}

.ddw-cal-nav-arrow:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ddw-cal-nav-arrow:active:not(:disabled) {
  transform: scale(0.96);
}

.ddw-cal-nav-arrow:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ddw-cal-sub {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0.65rem 0 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
}

.ddw-cal-days {
  padding: 0.65rem 0.65rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: min(68vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ddw-cal-day-card {
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.95rem 1rem 1rem;
  backdrop-filter: blur(6px);
}

@supports not (backdrop-filter: blur(6px)) {
  .ddw-cal-day-card {
    background: var(--bg-dark);
  }
}

.ddw-cal-day-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.75rem;
}

.ddw-cal-day-wday {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.ddw-cal-day-date {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 3vw, 1.2rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.ddw-cal-spots-left {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--success);
  margin: 0 0 0.65rem;
  letter-spacing: 0.02em;
}

.ddw-cal-spots-left.is-highlight {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.03em;
  text-shadow: 0 0 24px rgba(212, 168, 83, 0.2);
}

.ddw-cal-spots-left.is-full {
  color: var(--text-muted);
  font-weight: 500;
  font-style: italic;
}

.ddw-cal-spots-left.is-plenty {
  color: var(--text-muted);
  font-weight: 500;
  font-style: normal;
}

.ddw-cal-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.25rem), 1fr));
  gap: 0.45rem;
}

.ddw-cal-slot-btn {
  min-height: 48px;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elevated) 0%, rgba(26, 30, 36, 0.9) 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color var(--transition),
    background var(--transition),
    color var(--transition),
    box-shadow var(--transition),
    transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ddw-cal-slot-btn:hover:not(:disabled) {
  border-color: rgba(212, 168, 83, 0.35);
  background: rgba(212, 168, 83, 0.07);
  color: var(--text);
}

.ddw-cal-slot-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ddw-cal-slot-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.ddw-cal-slot-btn.is-selected {
  border-color: var(--accent);
  background: linear-gradient(
    145deg,
    rgba(212, 168, 83, 0.18) 0%,
    rgba(212, 168, 83, 0.06) 100%
  );
  color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(212, 168, 83, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.ddw-cal-closed,
.ddw-cal-full {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
  font-style: italic;
}

.ddw-calendar-error:not([hidden]) {
  margin-top: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  font-size: 0.9rem;
}

.ddw-calendar-status:not([hidden]) {
  margin-top: 0.65rem;
  padding: 0.5rem 0;
  color: var(--success);
  font-weight: 500;
  font-size: 0.9rem;
}

@media (min-width: 480px) {
  .ddw-cal-header {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }
  .ddw-cal-days {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* —— Dashboard (hero metrics + gallery) —— */
.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.dash-hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1rem;
}

.dash-hero-card {
  background: linear-gradient(165deg, rgba(212, 168, 83, 0.08) 0%, var(--card) 45%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  position: relative;
  overflow: hidden;
}

.dash-hero-card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle at 100% 0%, rgba(212, 168, 83, 0.12), transparent 70%);
  pointer-events: none;
}

.dash-hero-primary {
  grid-column: span 1;
}

@media (min-width: 900px) {
  .dash-hero-primary {
    grid-column: span 2;
  }
}

.dash-hero-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.dash-hero-stat {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0;
  color: var(--text);
}

.dash-hero-stat-gold {
  color: var(--accent);
}

.dash-hero-label {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.dash-hero-footnote {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  opacity: 0.95;
}

.dash-hero-subrow {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

.dash-hero-subrow strong {
  color: var(--text);
  font-weight: 600;
}

.dash-mini {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
}

.dash-mini-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.dash-mini-val {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

.dash-section-title {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0 0 0.85rem;
  color: var(--text);
}

.dash-metrics {
  margin: 0;
}

.dash-kpi-grid {
  margin-bottom: 0;
}

.dash-gallery-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
}

.dash-gallery-head {
  margin-bottom: 1rem;
}

.dash-panel-title {
  font-family: var(--display);
  font-size: 1.2rem;
  margin: 0 0 0.35rem;
}

.dash-panel-sub {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
  max-width: 48rem;
}

.dash-panel-sub a {
  font-weight: 600;
}

.dash-gallery-notice {
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(212, 168, 83, 0.08);
  border: 1px solid rgba(212, 168, 83, 0.2);
}

.crm-gallery-upload {
  border: 2px dashed rgba(212, 168, 83, 0.35);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  margin-bottom: 1.25rem;
  transition:
    border-color 0.2s,
    background 0.2s;
}

.crm-gallery-upload.is-drag {
  border-color: var(--accent);
  background: rgba(212, 168, 83, 0.06);
}

.crm-gallery-upload-inner {
  text-align: center;
}

.crm-drop-hint {
  margin: 0.65rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.crm-gallery-strip {
  min-height: 2rem;
}

.crm-gallery-empty {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

.crm-gallery-strip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.85rem;
}

.crm-gallery-strip-item {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.crm-gallery-thumb-wrap {
  aspect-ratio: 4/3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--elevated);
}

.crm-gallery-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.crm-gallery-legacy-panel {
  margin-top: 1.25rem;
}

.crm-gallery-legacy-item .crm-gallery-legacy-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.4rem 0.65rem;
  width: 100%;
}

.dash-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}

.dash-info-card h2 {
  margin-bottom: 0.65rem;
}

.dash-info-text {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
}

/* Schedule calendar */
#view-schedule .schedule-wrap {
  max-width: 100%;
}

.schedule-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(145deg, rgba(212, 168, 83, 0.08), rgba(21, 24, 29, 0.9));
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.schedule-toolbar-center {
  flex: 1 1 200px;
  text-align: center;
  min-width: 0;
}

.schedule-month-title {
  font-family: var(--display);
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  margin: 0 0 0.2rem;
  color: var(--text);
}

.schedule-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.schedule-nav-btn {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.65rem;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 600;
}

.schedule-today-btn {
  flex: 1 1 auto;
  min-height: 44px;
  width: 100%;
  max-width: 120px;
  margin-left: auto;
}

@media (min-width: 520px) {
  .schedule-today-btn {
    width: auto;
    margin-left: 0;
  }
}

.schedule-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.schedule-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.schedule-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.schedule-dot.is-upcoming {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.schedule-dot.is-past {
  background: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.25);
}

.schedule-dot.is-cancelled {
  background: #f87171;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.25);
}

.schedule-cal-inner {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
}

.schedule-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.schedule-weekday {
  padding: 0.5rem 0.25rem;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: var(--elevated);
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
}

.schedule-cell-pad {
  min-height: 72px;
  background: rgba(0, 0, 0, 0.15);
}

.schedule-cell-day {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  padding: 0.35rem 0.3rem 0.45rem;
  border: none;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.schedule-cell-day:hover {
  background: var(--elevated);
}

.schedule-cell-day:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  z-index: 1;
}

.schedule-cell-day.is-today {
  box-shadow: inset 0 0 0 2px rgba(212, 168, 83, 0.65);
  background: rgba(212, 168, 83, 0.06);
}

.schedule-cell-day.has-events {
  background: rgba(21, 24, 29, 0.98);
}

.schedule-day-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.schedule-cell-day.is-today .schedule-day-num {
  color: var(--accent);
}

.schedule-day-pills {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.schedule-pill {
  font-size: 0.58rem;
  line-height: 1.2;
  padding: 0.2rem 0.28rem;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.schedule-pill.is-upcoming {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.schedule-pill.is-past {
  background: rgba(100, 116, 139, 0.2);
  color: #cbd5e1;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.schedule-pill.is-cancelled {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
  text-decoration: line-through;
  border: 1px solid rgba(248, 113, 113, 0.35);
}

.schedule-more {
  font-size: 0.6rem;
  color: var(--accent);
  margin-top: auto;
  padding-top: 0.15rem;
}

.schedule-day-detail {
  margin-top: 1.25rem;
  padding: 1.1rem 1.15rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.schedule-day-detail-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.schedule-day-detail-title {
  font-family: var(--display);
  font-size: 1.15rem;
  margin: 0 0 1rem;
  color: var(--text);
}

.schedule-day-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.schedule-detail-empty {
  color: var(--muted);
  font-style: italic;
  margin: 0;
  padding: 0;
  list-style: none;
}

.schedule-detail-row {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--elevated);
}

.schedule-detail-row.is-upcoming {
  border-color: rgba(34, 197, 94, 0.35);
}

.schedule-detail-row.is-past {
  border-color: rgba(100, 116, 139, 0.35);
}

.schedule-detail-row.is-cancelled {
  border-color: rgba(248, 113, 113, 0.4);
  opacity: 0.95;
}

.schedule-detail-row-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
}

.schedule-detail-time {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}

.schedule-detail-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.schedule-detail-row.is-upcoming .schedule-detail-badge {
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
}

.schedule-detail-row.is-past .schedule-detail-badge {
  color: #cbd5e1;
}

.schedule-detail-row.is-cancelled .schedule-detail-badge {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.12);
}

.schedule-detail-name {
  font-weight: 600;
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
}

.schedule-detail-sub {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  word-break: break-all;
}

.schedule-detail-svc {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text);
}

.schedule-detail-reason {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 900px) {
  body.crm-nav-open {
    overflow: hidden;
  }
}

@media (max-width: 520px) {
  .schedule-cell-day {
    min-height: 76px;
    padding: 0.25rem 0.2rem;
  }

  .schedule-pill {
    font-size: 0.52rem;
    padding: 0.15rem 0.22rem;
  }

  .schedule-weekday {
    font-size: 0.62rem;
    padding: 0.4rem 0.15rem;
  }
}
