/* ═══════════════════════════════════════════════════════════
   FIFTYMIN — STYLESHEET
   iPad-first, minimalistic, touch-optimised
═══════════════════════════════════════════════════════════ */

/* ── TOKENS ──────────────────────────────────────────────── */
:root {
  --color-bg:            #f5f0eb;
  --color-bg-deep:       #faf6f1;
  --color-surface:       #fffdfb;
  --color-primary:       #2d4a3e;
  --color-primary-h:     #1e3329;
  --color-primary-hover: #1e3329;
  --color-accent:        #d4a574;
  --color-accent-h:      #c4956a;
  --color-danger:        #a63d40;
  --color-danger-h:      #8b3234;
  --color-success:       #557b6a;
  --color-warning:       #c9a227;
  --color-text:          #1a1a1a;
  --color-muted:         #6b6259;
  --color-border:        #e0d8d0;
  --color-inr:           #8b6b4a;
  --color-aud:           #4a7c6f;

  --gradient-bg:       linear-gradient(145deg, #f5f0eb 0%, #ebe4dc 50%, #e8dfd5 100%);
  --gradient-header:   linear-gradient(90deg, #2d4a3e 0%, #3d5a4e 100%);
  --gradient-accent:   linear-gradient(135deg, #d4a574 0%, #c49a6c 100%);

  --font-display:      'Fraunces', Georgia, serif;
  --font-body:         'Bricolage Grotesque', system-ui, sans-serif;

  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-xl:   24px;
  --radius-pill: 999px;

  --shadow-sm: 0 2px 8px rgba(45, 74, 62, 0.08);
  --shadow-md: 0 4px 16px rgba(45, 74, 62, 0.12);
  --shadow-lg: 0 8px 32px rgba(45, 74, 62, 0.16);

  --ease-out:  cubic-bezier(.2, .8, .2, 1);

  --header-h:  60px;
  --nav-h:     72px;
  --safe-bot:  env(safe-area-inset-bottom, 0px);
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--gradient-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── UTILITY ─────────────────────────────────────────────── */
.hidden   { display: none !important; }
.center   { text-align: center; }
.muted-text { color: var(--color-muted); font-size: 14px; padding: 16px 0; }
.error-text { color: var(--color-danger); font-size: 13px; margin-top: 6px; }

/* ── LOGIN SCREEN ────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--gradient-bg);
  padding: 24px;
  z-index: 1000;
}

#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%232d4a3e' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  border-left: 4px solid var(--color-accent);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(45,74,62,0.12), 0 2px 8px rgba(45,74,62,0.08);
  text-align: center;
  animation: fadeInUp 0.5s ease both;
}

.login-logo {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 72px; height: 72px;
  background: rgba(212,165,116,0.12);
  border-radius: 20px;
  color: var(--color-primary);
  margin-bottom: 20px;
}

/* ── TALLY BRANDMARK ─────────────────────────────────────── */
.tally {
  --stroke: #2d4a3e;
  --w: 4px;
  --h: 44px;
  --gap: 8px;
  position: relative;
  width: calc(var(--w) * 4 + var(--gap) * 3);
  height: var(--h);
  display: flex; align-items: center; justify-content: space-between;
}
.tally i {
  display: block;
  width: var(--w); height: 100%;
  background: var(--stroke);
  border-radius: calc(var(--w) / 2);
}
.tally::after {
  content: "";
  position: absolute;
  left: calc(var(--w) * -0.6); right: calc(var(--w) * -0.6);
  top: 50%; height: var(--w);
  background: var(--stroke);
  border-radius: calc(var(--w) / 2);
  transform: translateY(-50%) rotate(-18deg);
}
.tally-sm {
  --h: 30px;
  --w: 3px;
  --gap: 6px;
}
.plate-green .tally,
[data-theme="dark"] .tally {
  --stroke: #d4a574;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.login-subtitle {
  color: var(--color-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

/* Switch between sign-in / sign-up / verify */
.auth-switch-text {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--color-muted);
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-primary);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
  min-height: 44px;   /* tap target */
  display: inline-flex;
  align-items: center;
}

.link-btn:active { opacity: 0.7; }

.auth-hint {
  font-size: 13px;
  color: var(--color-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Verification code input — large, numeric, centred */
.input-code {
  text-align: center;
  font-size: 28px;
  letter-spacing: 8px;
  font-weight: 600;
}

/* Password show/hide toggle */
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
}
.pw-toggle:active { color: var(--color-primary); }

/* ── APP SHELL ───────────────────────────────────────────── */
#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
}

/* ── HEADER ──────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: var(--gradient-header);
  border-bottom: none;
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  padding-top: env(safe-area-inset-top, 0px);
}

.app-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  flex: 1;
}

.user-email-label {
  font-size: 12px;
  color: var(--color-accent);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}
.user-email-label:hover { opacity: 0.8; }

/* ── MAIN SCROLL AREA ────────────────────────────────────── */
.app-main {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* ── VIEWS ───────────────────────────────────────────────── */
.view {
  position: absolute; inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-bot) + 16px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.view.hidden { display: none; }
.view.active { display: flex; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.card-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  margin-bottom: 10px;
}

/* ── INPUTS ──────────────────────────────────────────────── */
.input {
  width: 100%;
  height: 48px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 16px;
  color: var(--color-text);
  background: var(--color-surface);
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}

.input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(212,165,116,0.25);
}
.input::placeholder { color: #94a3b8; }

/* Date input wrapper — wheel + keyboard toggle */
.date-input-wrap { position: relative; }
.date-input-wrap .input { padding-right: 48px; }
.date-mode-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
}
.date-mode-btn:active { color: var(--color-primary); }

/* Per-session notes peek button */
.session-peek-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  min-width: 36px;
  min-height: 44px;
  touch-action: manipulation;
}
.session-peek-btn:active { color: var(--color-primary); }
.peek-chevron { transition: transform .2s ease; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, opacity .15s, transform .08s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:not(:disabled):hover { background: var(--color-primary-h); }

.btn-accent {
  background: var(--gradient-accent);
  color: #fff;
}
.btn-accent:not(:disabled):hover { filter: brightness(0.95); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:not(:disabled):hover { background: var(--color-danger-h); }

.btn-ghost {
  background: transparent;
  color: var(--color-muted);
  border: none;
  padding: 8px;
  height: auto;
}
.btn-ghost:hover { color: var(--color-text); }

.app-header .btn-ghost {
  color: var(--color-accent);
  opacity: 1;
}
.app-header .btn-ghost:hover { opacity: 0.8; color: var(--color-accent); }

.btn-full { width: 100%; }

.btn-sm { height: 44px; padding: 0 14px; font-size: 14px; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* ── ICON BUTTON ─────────────────────────────────────────── */
.icon-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: background .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--color-bg); color: var(--color-text); }

/* ── PATIENT SELECTOR GRID ───────────────────────────────── */
.patient-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.patient-toggle {
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.patient-toggle.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ── SECTION HEADING ─────────────────────────────────────── */
.section-heading {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  padding: 4px 4px 0;
}

/* ── SESSIONS LIST ───────────────────────────────────────── */
.session-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.session-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  background: #f8fafc;
}

.session-date-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
}

.session-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
}
.session-row:last-child { border-bottom: none; }

.session-patient-name {
  flex: 1;
  font-size: 15px;
}

.session-delete-btn {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none;
  color: #cbd5e1;
  cursor: pointer;
  border-radius: 6px;
  transition: color .15s, background .15s;
  touch-action: manipulation;
}
.session-delete-btn:hover { color: var(--color-danger); background: #fef2f2; }

/* ── VIEW ACTION BAR ─────────────────────────────────────── */
.view-action-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 4px;
}

/* ── PATIENTS LIST ───────────────────────────────────────── */
.patient-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow .15s;
  touch-action: manipulation;
}
.patient-card:hover { box-shadow: var(--shadow-md); }

.patient-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.patient-info { flex: 1; }
.patient-name  {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--color-primary);
}
.patient-rate  { font-size: 13px; color: var(--color-muted); margin-top: 2px; }

.patient-edit-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: var(--color-bg);
  border-radius: 50%;
  color: var(--color-muted);
  cursor: pointer;
  transition: background .15s;
  touch-action: manipulation;
  flex-shrink: 0;
}
.patient-edit-btn:hover { background: var(--color-border); }

/* ── PATIENT NOTES SHEET ─────────────────────────────────── */
.patient-note-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
}
.patient-note-item:last-child { border-bottom: none; }

.patient-note-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 8px;
}

.patient-note-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-muted);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.patient-notes-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--color-muted);
  font-size: 15px;
}

/* ── PATIENT PROFILE SHEET ───────────────────────────────── */
.patient-profile-info {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  min-height: 44px;
}

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

.profile-info-label {
  font-weight: 500;
  color: var(--color-muted);
  font-size: 15px;
  flex-shrink: 0;
  margin-right: 16px;
}

.profile-info-value {
  font-size: 16px;
  color: var(--color-text);
  text-align: right;
  word-break: break-word;
}

.profile-info-value a {
  color: var(--color-primary);
  text-decoration: none;
}

.profile-info-value a:hover {
  text-decoration: underline;
}

.profile-actions {
  display: flex;
  gap: 12px;
  padding: 20px;
}

.profile-actions .btn {
  flex: 1;
  min-height: 44px;
}

/* ── CURRENCY BADGE ──────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.badge-inr  { background: rgba(139,107,74,0.12); color: var(--color-inr); }
.badge-aud  { background: rgba(74,124,111,0.12); color: var(--color-aud); }
.badge-sent { background: #2d4a3e; color: #f5f0eb; }

/* ── STATUS BADGE ────────────────────────────────────────── */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  touch-action: manipulation;
}

.status-unpaid  { background: #f1f5f9; color: var(--color-muted); }
.status-paid    { background: #d1fae5; color: #065f46; }
.status-partial { background: #fef3c7; color: #92400e; }

/* ── EARNINGS CHART ──────────────────────────────────────── */
.earnings-card { margin-bottom: 0; }

.earnings-chart-wrap {
  position: relative;
  height: 180px;
  margin-top: 10px;
}

/* Hero stat */
.earnings-hero-stat {
  margin: 14px 0 6px;
}

.earnings-hero-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.earnings-hero-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  color: var(--color-primary);
}

.earnings-hero-value--inr {
  color: var(--color-inr);
}

.earnings-hero-value--aud {
  color: var(--color-aud);
  font-size: 22px;
}

/* Month list */
.earnings-month-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.earnings-month-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  padding: 6px 0;
  border-bottom: 1px solid var(--color-border);
}

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

.earnings-month-label {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-muted);
  min-width: 60px;
}

.earnings-month-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-align: right;
}

.earnings-amount-inr {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--color-inr);
}

.earnings-amount-aud {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-aud);
}

.earnings-amount-zero {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-muted);
  opacity: 0.55;
}

/* Empty state */
.earnings-empty {
  text-align: center;
  padding: 32px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-muted);
  line-height: 1.5;
}

/* ── PROFILE VIEW ────────────────────────────────────────── */
.user-profile-link {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  font: inherit;
  padding: 8px 12px;
  min-height: 44px;
  min-width: 44px;
  text-align: right;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}
.user-profile-link:hover {
  background: rgba(255,255,255,0.15);
}
.user-profile-link svg {
  color: rgba(255,255,255,0.85);
  flex-shrink: 0;
}

.profile-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0;
}
.profile-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-muted);
  margin-bottom: -1px;
}
.profile-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.profile-tab-content.hidden { display: none; }

.profile-template-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.profile-template-actions .btn {
  min-height: 44px;
}
.card .muted-text {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-bottom: 10px;
  padding: 0;
}

/* ── TIMEZONE — SLOT MODAL PREVIEW ──────────────────────── */
.slot-tz-preview {
  font-size: 13px;
  color: var(--color-primary);
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(212,165,116,0.12);
  border-radius: var(--radius-sm);
}

/* ── TIMEZONE — CALENDAR SLOT SECONDARY LINE ─────────────── */
.cal-slot-tz {
  font-size: 10px;
  opacity: 0.85;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── BILLING ─────────────────────────────────────────────── */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4px 0 8px;
}

.month-label {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  min-width: 160px;
  text-align: center;
}

.billing-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.summary-stat { text-align: center; }
.summary-stat-value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
}
.summary-stat-label {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 2px;
}

.billing-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

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

.billing-patient-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--color-primary);
  flex: 1;
}

.billing-rows { display: flex; flex-direction: column; gap: 8px; }

.billing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
}

.billing-row-label { color: var(--color-muted); }
.billing-row-value { font-weight: 500; }

.billing-row-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
  margin-top: 4px;
}

.billing-card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* Adjustment inline input */
.adj-input {
  width: 80px;
  height: 44px;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 14px;
  text-align: center;
  outline: none;
  transition: border-color .15s;
}
.adj-input:focus { border-color: var(--color-accent); }

.copy-btn {
  margin-left: auto;
  height: 44px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 8px;
  background: rgba(212,165,116,0.15);
  color: var(--color-primary);
  border: none;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background .15s;
  touch-action: manipulation;
}
.copy-btn:hover { background: rgba(212,165,116,0.25); }

/* ── BOTTOM NAV ──────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-bot));
  padding-bottom: var(--safe-bot);
  background: var(--color-surface);
  border-top: 2px solid var(--color-border);
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 4px;
  border: none;
  border-top: 2px solid transparent;
  background: none;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  margin-top: -2px;
  transition: color .15s, border-color .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn.active {
  color: var(--color-primary);
  border-top-color: var(--color-accent);
}
.nav-btn:hover  { color: var(--color-text); }

/* ── MODAL ───────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0;
  z-index: 200;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(26,26,26,0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.modal-sheet {
  position: relative; z-index: 1;
  background: var(--color-surface);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  animation: slideUp .25s ease-out;
}

.modal-sheet-sm { max-height: 60vh; }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 0;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
}

.modal-close-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: var(--color-bg);
  border-radius: 50%;
  color: var(--color-muted);
  cursor: pointer;
  transition: background .15s;
  touch-action: manipulation;
}
.modal-close-btn:hover { background: var(--color-border); }

.modal-body { padding: 0 20px; }
.modal-footer {
  padding: 20px;
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.field-error {
  display: none;
  color: var(--color-danger);
  font-size: 13px;
  margin-top: 4px;
}
.field-error.visible {
  display: block;
}

.radio-group {
  display: flex; gap: 12px;
}

.radio-option {
  display: flex; align-items: center; gap: 8px;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  flex: 1;
  transition: border-color .15s, background .15s;
}
.radio-option:has(input:checked) {
  border-color: var(--color-accent);
  background: rgba(212,165,116,0.12);
  color: var(--color-primary);
}
.radio-option input { display: none; }

/* ── TOAST ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  top: auto;
  bottom: calc(var(--nav-h) + var(--safe-bot) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast {
  background: var(--color-primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .2s ease-out;
  white-space: nowrap;
}

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

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── WHAT'S NEW BANNER ───────────────────────────────────── */
.whats-new-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: rgba(212,165,116,0.15);
  color: var(--color-primary);
  padding: 12px 16px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border);
}
.whats-new-banner.hidden { display: none; }
.whats-new-body {
  flex: 1;
  line-height: 1.5;
}
.whats-new-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 4px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.7;
}
.whats-new-dismiss:hover,
.whats-new-dismiss:active {
  opacity: 1;
}

/* ── LOADING OVERLAY ─────────────────────────────────────── */
#loading-overlay {
  position: fixed; inset: 0;
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.5);
  backdrop-filter: blur(2px);
}

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--color-muted);
}
.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

.empty-state-icon {
  color: var(--color-muted);
  margin-bottom: 12px;
  opacity: 0.6;
}

.empty-state-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 6px 0;
}

.empty-state-subtitle {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.empty-state-cta {
  min-height: 44px;
  padding: 12px 28px;
  font-size: 0.95rem;
  margin-top: 4px;
}

.empty-state-link {
  color: var(--color-accent);
  text-decoration: underline;
  cursor: pointer;
}

.empty-state-link:active {
  opacity: 0.7;
}

/* ── FORM ROW ────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── CALENDAR ────────────────────────────────────────────── */
.calendar-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.cal-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
  min-width: 560px;
}

.cal-gutter-header { width: 44px; flex-shrink: 0; }

.cal-day-header {
  flex: 1;
  text-align: center;
  padding: 10px 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-muted);
  border-left: 1px solid var(--color-border);
}
.cal-day-header.cal-today {
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
}

.cal-body {
  display: flex;
  min-width: 560px;
  padding-top: 24px; /* keeps 7 AM label from being clipped by sticky header */
}

.cal-time-gutter {
  width: 44px;
  flex-shrink: 0;
  position: relative;
}

.cal-hour-label {
  position: absolute;
  right: 8px;
  font-size: 10px;
  color: var(--color-muted);
  transform: translateY(-50%);
  white-space: nowrap;
  user-select: none;
}

.cal-half-hour-label {
  position: absolute;
  right: 6px;
  font-size: 9px;
  color: #9ca3af;
  transform: translateY(-50%);
  white-space: nowrap;
  user-select: none;
}

.cal-day-col {
  flex: 1;
  position: relative;
  border-left: 1px solid var(--color-border);
  min-width: 0;
}
.cal-day-col.cal-today-col { background: rgba(212,165,116,0.08); }

.cal-hour-line {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: var(--color-border);
  pointer-events: none;
}

.cal-half-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-border, #e0e0e0);
  opacity: 0.45;
  pointer-events: none;
}

.cal-slot {
  position: absolute;
  left: 3px; right: 3px;
  border-radius: 6px;
  padding: 4px 7px;
  cursor: pointer;
  overflow: hidden;
  transition: filter .15s, transform .08s;
  touch-action: manipulation;
}
.cal-slot:hover  { filter: brightness(.88); }
.cal-slot:active { transform: scale(.97); }

.cal-slot-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-slot-time {
  font-size: 10px;
  color: rgba(255,255,255,.85);
  white-space: nowrap;
  overflow: hidden;
}

.cal-outside-row {
  display: flex;
  min-width: 560px;
}

.cal-gutter-outside {
  width: 44px;
  flex-shrink: 0;
}

.cal-outside-slots-col {
  flex: 1;
  min-width: 0;
  border-left: 1px solid var(--color-border);
  padding: 4px 4px 2px;
}

.cal-slot-outside {
  position: relative;
  background: #fff7ed;
  color: #92400e;
  border-radius: 6px;
  padding: 6px 40px 6px 8px;
  margin-bottom: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: filter .15s;
  touch-action: manipulation;
}
.cal-slot-outside:active { filter: brightness(.94); }

.cal-slot-outside-badge {
  font-size: 10px;
  font-style: italic;
  color: #b45309;
  opacity: .8;
}

.cal-slot-outside-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-slot-outside-time {
  font-size: 10px;
  opacity: .75;
  white-space: nowrap;
}

.cal-slot-outside-del {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  background: none;
  border: none;
  color: #ef4444;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.cal-slot-reschedule {
  border: 2px dashed var(--color-border);
  background: rgba(45, 74, 62, 0.08);
}

.today-reschedule-label {
  display: inline-block;
  font-size: 11px;
  color: var(--color-muted);
}

.reschedule-toggle-group {
  display: flex;
  flex-direction: row;
  gap: 10px;
  width: 100%;
}

.reschedule-toggle-group button.active {
  background: var(--color-primary);
  color: #fff;
}

.cal-empty {
  text-align: center;
  padding: 40px 24px;
  color: var(--color-muted);
  font-size: 14px;
}

/* ── SESSION NOTES BUTTON ────────────────────────────────── */
.session-notes-btn {
  min-width: 44px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none;
  color: #cbd5e1;
  cursor: pointer;
  border-radius: 6px;
  transition: color .15s, background .15s;
  touch-action: manipulation;
  flex-shrink: 0;
}
.session-notes-btn:hover      { color: var(--color-primary); background: rgba(212,165,116,0.12); }
.session-notes-btn.has-notes  { color: var(--color-primary); }

.session-note-preview {
  font-size: 12px;
  color: var(--color-muted);
  padding: 4px 16px 10px 48px;
  white-space: pre-wrap;
  line-height: 1.5;
  border-bottom: 1px solid var(--color-border);
}
.session-note-preview:last-child { border-bottom: none; }

/* ── TEXTAREA INPUTS ─────────────────────────────────────── */
textarea.input {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.6;
  font-family: inherit;
}
.notes-textarea   { min-height: 200px; }
.invoice-textarea { min-height: 240px; font-size: 14px; white-space: pre-wrap; }

/* ── TODAY VIEW ──────────────────────────────────────────── */
.today-slot-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
}
.today-slot-row:last-child { border-bottom: none; }
.today-slot-info { flex: 1; min-width: 0; }
.today-slot-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.today-slot-time { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
.today-log-btn  { min-width: 64px; flex-shrink: 0; }
.today-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--color-success);
  flex-shrink: 0;
}
.today-meet-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.today-meet-copy,
.today-meet-open {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-primary);
  background: rgba(212,165,116,0.12);
  border: none;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.today-meet-copy:hover,
.today-meet-open:hover { background: rgba(212,165,116,0.25); }

.today-rescheduled-section {
  margin-top: 12px;
}
.today-rescheduled-row {
  display: flex;
  align-items: center;
  padding: 12px 0;
  gap: 12px;
  border-bottom: 1px solid var(--color-border);
  opacity: 0.6;
}
.today-rescheduled-row:last-child { border-bottom: none; }
.today-rescheduled-label {
  font-size: 12px;
  font-style: italic;
  color: var(--color-muted);
  margin-top: 4px;
}

/* ── RESPONSIVE — larger iPads / desktop ─────────────────── */
@media (min-width: 768px) {
  .app-main { display: flex; justify-content: center; }
  .view { max-width: 640px; margin: 0 auto; width: 100%; }
  .month-nav { padding: 8px 0 12px; }
  .billing-summary { grid-template-columns: repeat(3, 1fr); }
}

/* ── PATIENT MEET LINK ───────────────────────────────────── */
.patient-meet-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
}
.patient-meet-label {
  flex: 1;
  font-size: 12px;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.patient-meet-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: none;
  color: var(--color-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.patient-meet-btn:hover { color: var(--color-primary); background: rgba(212,165,116,0.12); }


/* ── RESPONSIVE — phone screens (FAB for log sessions) ───── */
@media (max-width: 480px) {
  #log-sessions-btn {
    position: fixed;
    bottom: calc(var(--nav-h, 64px) + var(--safe-bot, 0px) + 16px);
    right: 16px;
    width: auto;
    min-width: 160px;
    height: 52px;
    border-radius: 26px;
    padding: 0 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    z-index: 50;
  }

  :root {
    --nav-h: 64px;
    --header-h: 52px;
  }

  /* View */
  .view {
    padding: 12px 12px calc(var(--nav-h) + var(--safe-bot) + 12px);
  }

  /* Cards */
  .card { padding: 14px; }

  /* Modal */
  .modal-header { padding: 16px 16px 0; }
  .modal-body   { padding: 0 16px; }
  .modal-footer { padding: 16px; }

  /* Login */
  .login-card   { padding: 28px 20px; }
  .login-logo   { width: 56px; height: 56px; }
  .login-card h1 { font-size: 20px; }

  /* Typography */
  .summary-stat-value { font-size: 18px; }
  .month-label        { font-size: 16px; }
  .toast              { white-space: normal; }

  /* Grids & lists */
  .patient-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  .billing-card-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .session-row  { padding: 10px 12px; }
  .patient-card { gap: 10px; }
  .empty-state  { padding: 32px 16px; }
  .earnings-chart-wrap { height: 140px; }
  .profile-tab  { padding: 10px 12px; }

  /* Calendar — intentional horizontal scroll on phone */
  /* min-width: 560px is kept; .calendar-card scrolls horizontally */
}

/* ── ENTRANCE ANIMATIONS ─────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.animate-in { animation: fadeInUp 0.4s ease both; }
.animate-in.delay-1 { animation-delay: 0.05s; }
.animate-in.delay-2 { animation-delay: 0.1s; }
.animate-in.delay-3 { animation-delay: 0.15s; }
.animate-in.delay-4 { animation-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  .modal-sheet { animation: none; }
  .toast       { animation: none; }
  .animate-in, [class*="delay-"] { animation: none !important; }
}
