/* Things Tailwind doesn't cover neatly: the card look, the floating nav, sheets, motion. */

:root {
  --paper: #FFFFFF;
  --mist: #F5F5F4;
  --line: #E7E5E4;
  --graphite: #6B6B6B;
  --ink: #0A0A0A;
  --error: #D92D20; /* red only ever means: something needs fixing */
  --accent: #1F5F4A; /* deep green. The rule: green = do it, or chosen; red = fix this; black = what you read */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[hidden] { display: none !important; }

/* Screens fade in softly when shown. */
.screen { animation: fade-in 260ms var(--ease); }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- Card ---------------------------------------------------------------- */
.bank-card {
  position: relative;
  aspect-ratio: 1.586 / 1;
  border-radius: 20px;
  padding: 22px;
  color: #FAFAF9;
  background: linear-gradient(135deg, #1C1C1C 0%, #0A0A0A 55%, #161616 100%);
  box-shadow: 0 18px 40px -18px rgba(10, 10, 10, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  isolation: isolate;
}
.bank-card--graphite { background: linear-gradient(135deg, #3A3A3A 0%, #222222 50%, #2E2E2E 100%); }
/* The other finishes: deep and muted, so each card is easy to tell apart and still calm. */
.bank-card--forest { background: linear-gradient(135deg, #2A6352 0%, #163D32 55%, #215244 100%); }
.bank-card--navy { background: linear-gradient(135deg, #2C4470 0%, #172544 55%, #22375C 100%); }
.bank-card--plum { background: linear-gradient(135deg, #5E3459 0%, #351C33 55%, #4C2A48 100%); }
.bank-card--clay { background: linear-gradient(135deg, #82503A 0%, #4C2B1F 55%, #6C4232 100%); }

/* Soft light sheen across the top corner. */
.bank-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.06) 50%, transparent 60%);
  z-index: -1;
  pointer-events: none;
}
/* Very fine grain, so it reads as a material rather than flat black. */
.bank-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.09;
  mix-blend-mode: overlay;
  z-index: -1;
  pointer-events: none;
}
.card-chip {
  width: 42px;
  height: 32px;
  border-radius: 7px;
  background:
    linear-gradient(90deg, transparent 32%, rgba(10, 10, 10, 0.25) 33%, transparent 34%, transparent 66%, rgba(10, 10, 10, 0.25) 67%, transparent 68%),
    linear-gradient(180deg, transparent 48%, rgba(10, 10, 10, 0.25) 49%, transparent 52%),
    linear-gradient(135deg, #E7E5E4, #A8A6A3);
  opacity: 0.85;
}

/* --- Card carousel (swipe between cards) ---------------------------------- */
.card-carousel {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: -24px -24px 0; /* room for the card shadow, then pulled back */
  padding: 24px 24px 52px;
  scroll-padding: 0 24px;
}
.card-carousel::-webkit-scrollbar { display: none; }
.card-carousel > .bank-card { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }

.card-dots { display: flex; justify-content: center; gap: 8px; margin-top: -30px; }
.card-dots button { width: 6px; height: 6px; border-radius: 999px; background: var(--line); padding: 0; transition: all 250ms var(--ease); position: relative; }
.card-dots button::after { content: ""; position: absolute; inset: -12px -6px; } /* bigger tap area */
.card-dots button[aria-selected="true"] { width: 18px; background: var(--accent); }

.trial-label {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  vertical-align: 2px;
}

/* --- Floating nav ------------------------------------------------------- */
.floating-nav {
  position: fixed;
  right: max(16px, calc((100vw - 440px) / 2 + 16px));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(245, 245, 244, 0.86); /* mist, so pressed-in shadows read as one soft surface */
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 12px 30px -12px rgba(10, 10, 10, 0.28), 0 1px 2px rgba(10, 10, 10, 0.06);
  z-index: 30;
}
.nav-item {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--graphite);
  transition: color 200ms var(--ease), background 200ms var(--ease);
}
.nav-item { transition: color 250ms var(--ease), box-shadow 250ms var(--ease), transform 250ms var(--ease); }
.nav-item:hover { color: var(--ink); }
/* The screen you're on: softly pressed into the pill (light from the top left). */
.nav-item.is-active {
  color: var(--ink);
  box-shadow:
    inset 3px 3px 7px rgba(10, 10, 10, 0.14),
    inset -3px -3px 7px rgba(255, 255, 255, 0.95);
}
.nav-item:active { transform: scale(0.96); }
.nav-add { background: var(--accent); color: var(--paper); box-shadow: 0 6px 14px -6px rgba(31, 95, 74, 0.7); }
.nav-add:hover { color: var(--paper); }
.nav-add.is-active {
  color: var(--paper);
  box-shadow:
    inset 3px 3px 7px rgba(0, 0, 0, 0.75),
    inset -2px -2px 5px rgba(255, 255, 255, 0.14);
}

/* --- Form fields -------------------------------------------------------- */
.field-label { display: block; font-size: 13px; color: var(--graphite); margin-bottom: 6px; }
.field-input {
  width: 100%;
  background: var(--mist);
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 16px; /* 16px stops phones zooming in on focus */
  color: var(--ink);
  outline: none;
  transition: border-color 200ms var(--ease), background 200ms var(--ease);
  appearance: none;
}
.field-input:focus { border-color: var(--accent); background: var(--paper); }
.field-input.has-error { border-color: var(--error); box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12); }
.field-error { font-size: 13px; color: var(--error); margin-top: 6px; }
.field-error:empty { display: none; }
.field-error::before { content: "· "; }

/* Segmented choice (Website / App) */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--mist); border-radius: 14px; padding: 4px; }
.segmented button { padding: 10px; border-radius: 10px; font-size: 15px; color: var(--graphite); transition: all 200ms var(--ease); }
.segmented button[aria-pressed="true"] { background: var(--paper); color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(10, 10, 10, 0.12); }

/* On/off switch */
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background 200ms var(--ease); pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 999px; background: var(--paper); box-shadow: 0 1px 3px rgba(10, 10, 10, 0.25); transition: transform 200ms var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { width: 100%; background: var(--accent); color: var(--paper); border-radius: 999px; padding: 16px; font-size: 16px; font-weight: 500; transition: opacity 200ms var(--ease); }
.btn-primary:disabled { opacity: 0.5; }
.btn-primary--accent { background: var(--accent); }

/* --- Sheet (slides up over the current screen) --------------------------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 10, 10, 0.25); z-index: 40; animation: fade 200ms var(--ease); }
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 440px;
  transform: translateX(-50%);
  background: var(--paper);
  border-radius: 24px 24px 0 0;
  padding: 12px 24px calc(24px + env(safe-area-inset-bottom));
  max-height: 90dvh;
  overflow-y: auto;
  z-index: 50;
  animation: sheet-up 300ms var(--ease);
}
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Rows animate in when added. */
.row-in { animation: fade-in 260ms var(--ease); }

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

/* --- Toast (a calm note after saving) ------------------------------------ */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(28px, env(safe-area-inset-bottom));
  width: calc(100% - 32px);
  max-width: 340px;
  transform: translate(-50%, 16px);
  margin-left: -36px; /* keep clear of the floating nav on the right */
  background: var(--ink);
  color: var(--paper);
  border-radius: 18px;
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 14px 34px -14px rgba(10, 10, 10, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms var(--ease), transform 250ms var(--ease);
  z-index: 60;
}
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* --- Needs attention ---------------------------------------------------- */
.attention-item { background: var(--mist); border-radius: 20px; padding: 18px; }
.due-pill { flex: none; background: var(--ink); color: var(--paper); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 500; }
.trial-label--ink { background: var(--ink); color: var(--paper); }
.btn-small { border: 1px solid var(--ink); border-radius: 999px; padding: 10px 12px; font-size: 14px; font-weight: 500; background: var(--paper); transition: opacity 200ms var(--ease); }
.btn-small--ink { background: var(--accent); border-color: var(--accent); color: var(--paper); } /* the filled small button: the action */
.btn-small:disabled { opacity: 0.5; }

/* --- Rows and details ------------------------------------------------------ */
.row-link { transition: opacity 200ms var(--ease); }
.row-link:active { opacity: 0.55; }
.detail-row { display: flex; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.detail-row dt { color: var(--graphite); flex: none; }
.detail-row dd { text-align: right; min-width: 0; overflow-wrap: anywhere; }

/* --- Landing and profile ---------------------------------------------------- */
.landing { min-height: calc(100dvh - 10rem); /* the page keeps 10rem free at the bottom for the nav */ display: flex; flex-direction: column; justify-content: center; padding: 48px 0 64px; }
.landing-dot { flex: none; width: 6px; height: 6px; margin-top: 9px; border-radius: 999px; background: var(--ink); }
.profile-button { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; background: var(--mist); color: var(--ink); transition: background 200ms var(--ease); }
.profile-button:hover { background: var(--line); }

/* --- Date and time pickers (soft, pressed-in, like the nav) -------------------- */
.picker-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; color: var(--ink); }
.picker-field svg { flex: none; color: var(--graphite); }
.picker-field.is-empty [data-picker-text] { color: var(--graphite); }
.picker-backdrop { z-index: 70; }
.picker-sheet { z-index: 80; background: var(--mist); }

.soft-round {
  width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center;
  font-size: 22px; line-height: 1; color: var(--ink); background: var(--mist);
  box-shadow: 3px 3px 8px rgba(10, 10, 10, 0.10), -3px -3px 8px rgba(255, 255, 255, 0.95);
  transition: box-shadow 200ms var(--ease), opacity 200ms var(--ease);
}
.soft-round:active { box-shadow: inset 3px 3px 7px rgba(10, 10, 10, 0.14), inset -3px -3px 7px rgba(255, 255, 255, 0.95); }
.soft-round:disabled { opacity: 0.3; box-shadow: none; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-day {
  aspect-ratio: 1; max-width: 44px; width: 100%; margin: 0 auto; border-radius: 999px;
  font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums;
  transition: box-shadow 200ms var(--ease), background 200ms var(--ease);
}
.calendar-day:hover:not(:disabled) { background: rgba(255, 255, 255, 0.7); }
.calendar-day:disabled { opacity: 0.28; cursor: default; }
.calendar-day.is-today { box-shadow: inset 0 0 0 1px var(--ink); }
.calendar-day.is-selected {
  font-weight: 600; background: var(--accent); color: var(--paper);
  box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.25);
}
.calendar-day.is-selected:hover { background: var(--accent); }
.calendar-day:focus-visible, .wheel:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wheels { position: relative; display: flex; justify-content: center; gap: 8px; height: 220px; } /* 5 rows of 44px */
.wheel-band {
  position: absolute; left: 0; right: 0; top: 88px; height: 44px; border-radius: 14px; pointer-events: none;
  box-shadow: inset 3px 3px 7px rgba(10, 10, 10, 0.14), inset -3px -3px 7px rgba(255, 255, 255, 0.95);
}
.wheel {
  position: relative; width: 72px; height: 220px; overflow-y: auto; scroll-snap-type: y mandatory;
  overscroll-behavior: contain; scrollbar-width: none; padding: 88px 0; outline: none;
  mask-image: linear-gradient(to bottom, transparent, #000 32%, #000 68%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 32%, #000 68%, transparent);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-item {
  height: 44px; display: grid; place-items: center; scroll-snap-align: center;
  font-size: 22px; font-variant-numeric: tabular-nums; color: var(--graphite); cursor: pointer;
  transition: color 150ms var(--ease), transform 150ms var(--ease);
}
.wheel-item.is-centre { color: var(--ink); font-weight: 600; transform: scale(1.06); }

/* --- Demo inbox ---------------------------------------------------------------- */
.inbox-dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 999px; background: var(--accent); box-shadow: 0 0 0 2px var(--mist); }
.inbox-frame { width: 100%; height: 72dvh; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.toast.is-shown { pointer-events: auto; }
.toast-link { color: var(--paper); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; margin-left: 4px; }

/* --- Guided tour ------------------------------------------------------------------ */
.tour-blocker { position: fixed; inset: 0; z-index: 90; }
.tour-spotlight {
  position: fixed; z-index: 91; border-radius: 22px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(10, 10, 10, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  transition: top 300ms var(--ease), left 300ms var(--ease), width 300ms var(--ease), height 300ms var(--ease);
}
.tour-card {
  position: fixed; z-index: 92; background: var(--mist); border-radius: 22px; padding: 18px 20px;
  box-shadow: 0 18px 40px -18px rgba(10, 10, 10, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  animation: fade-in 260ms var(--ease);
  transition: top 300ms var(--ease), left 300ms var(--ease);
}
.tour-blocker.is-dim { background: rgba(10, 10, 10, 0.42); animation: fade 200ms var(--ease); }
.tour-card .field-input { background: var(--paper); border-color: var(--line); }
.tour-card .field-input:focus { border-color: var(--accent); }
.tour-card .field-input.has-error { border-color: var(--error); }

/* --- Demo / Live -------------------------------------------------------------- */
.mode-badge {
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; color: var(--ink); background: var(--mist);
  box-shadow: inset 2px 2px 5px rgba(10, 10, 10, 0.10), inset -2px -2px 5px rgba(255, 255, 255, 0.9);
}
.tour-pill {
  position: fixed; z-index: 92; top: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-size: 13px; box-shadow: 0 10px 24px -10px rgba(10, 10, 10, 0.5);
  max-width: calc(100% - 32px);
}
.tour-pill button { color: var(--paper); opacity: 0.75; text-decoration: underline; text-underline-offset: 2px; }
.tour-blocker.is-open { pointer-events: none; }
.tour-card.is-moving { opacity: 0.55; pointer-events: none; transition: opacity 150ms var(--ease); }

/* --- Busy: a calm spinning ring while a button waits on the server ---------------- */
button.is-busy { position: relative; color: transparent !important; }
button.is-busy > * { visibility: hidden; }
button.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: var(--paper);
  animation: spin 800ms linear infinite;
}
/* On light buttons (outlined, segmented, text links), the ring is ink-coloured. */
.btn-small:not(.btn-small--ink).is-busy::after, .segmented button.is-busy::after, button.underline.is-busy::after {
  border-color: rgba(10, 10, 10, 0.15); border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  /* No spinning for people who asked for less motion: a gentle steady ring instead. */
  button.is-busy::after { animation: none !important; border-top-color: rgba(10, 10, 10, 0.5); }
}

/* --- Card colour swatches (card sheet) ------------------------------------- */
.swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch { position: relative; width: 40px; height: 40px; cursor: pointer; }
.swatch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.swatch span { position: absolute; inset: 4px; border-radius: 999px; transition: box-shadow 200ms var(--ease), transform 200ms var(--ease); pointer-events: none; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--accent); }
.swatch input:focus-visible + span { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--graphite); }
.swatch--ink span { background: linear-gradient(135deg, #1C1C1C, #0A0A0A); }
.swatch--forest span { background: linear-gradient(135deg, #2A6352, #163D32); }
.swatch--navy span { background: linear-gradient(135deg, #2C4470, #172544); }
.swatch--plum span { background: linear-gradient(135deg, #5E3459, #351C33); }
.swatch--clay span { background: linear-gradient(135deg, #82503A, #4C2B1F); }
.swatch--graphite span { background: linear-gradient(135deg, #3A3A3A, #222222); }

/* --- Service icons: the site's own logo, or a soft monogram ------------------ */
.service-icon {
  flex: none; width: 36px; height: 36px; border-radius: 10px; object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.06);
}
.service-icon--monogram { display: grid; place-items: center; font-size: 15px; font-weight: 600; }
.site-input { padding-right: 56px; }
.site-icon-preview {
  position: absolute; right: 10px; top: 50%; width: 32px; height: 32px; border-radius: 9px; object-fit: cover;
  transform: translateY(-50%) scale(0.6); opacity: 0; transition: transform 300ms var(--ease), opacity 300ms var(--ease);
}
.site-icon-preview.is-in { transform: translateY(-50%) scale(1); opacity: 1; }
