/* Layout: one centred column. The shop's logo and name lead, a month-at-a-glance
   strip of four figures sits under it, then tabs holding Stripe's own components.
   Type: one sans family throughout, heavier and tabular for money. */
:root {
  /* Platinum neutrals with a faint blue bias, sapphire accent. */
  --bg: #f3f4f7;
  --surface: #ffffff;
  --ink: #111827; /* Spot navy */
  --muted: #586275;
  --line: #dce0e8;
  --accent: #23418f;
  --accent-ink: #ffffff;
  --accent-soft: #e8edf8;
  --good: #1b6e47;
  --good-soft: #e1f1e8;
  --neutral-soft: #eceef3;
  --danger: #b0243c;
  --danger-soft: #fbe7eb;
  --shadow: 0 1px 2px rgb(19 26 39 / 0.04), 0 10px 28px -18px rgb(19 26 39 / 0.18);

  --font-ui: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.0625rem;
  --step-2: 1.375rem;
  --step-3: clamp(1.45rem, 1.05rem + 1.6vw, 2.15rem);

  --radius: 12px;
  --radius-small: 8px;

  --spot-logo-light: block;
  --spot-logo-dark: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1118;
    --surface: #151b25;
    --ink: #e7ebf2;
    --muted: #97a1b4;
    --line: #273042;
    --accent: #9cb4f0;
    --accent-ink: #0d1118;
    --accent-soft: #1b2640;
    --good: #72cf9f;
    --good-soft: #15301f;
    --neutral-soft: #1f2634;
    --danger: #f08a9c;
    --danger-soft: #3a1720;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -18px rgb(0 0 0 / 0.6);
    --spot-logo-light: none;
    --spot-logo-dark: block;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0d1118;
  --surface: #151b25;
  --ink: #e7ebf2;
  --muted: #97a1b4;
  --line: #273042;
  --accent: #9cb4f0;
  --accent-ink: #0d1118;
  --accent-soft: #1b2640;
  --good: #72cf9f;
  --good-soft: #15301f;
  --neutral-soft: #1f2634;
  --danger: #f08a9c;
  --danger-soft: #3a1720;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 28px -18px rgb(0 0 0 / 0.6);
  --spot-logo-light: none;
  --spot-logo-dark: block;
  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p {
  margin: 0;
}

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

.small {
  font-size: var(--step--1);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* Shell ------------------------------------------------------------------ */

.shell {
  max-width: 72rem;
  margin: 0 auto;
  padding-inline: clamp(16px, 4vw, 40px);
  padding-block: 0 48px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding-block: 28px 22px;
  border-bottom: 1px solid var(--line);
}

.shop {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 22px;
  min-width: 0;
}

/* The shop's logo is used as a mask and filled with the ink colour. */
.shop-logo {
  --logo-h: clamp(54px, 2.4vw + 42px, 78px);
  flex: none;
  height: var(--logo-h);
  width: calc(var(--logo-h) * var(--logo-ratio, 1.62));
  max-width: 100%;
  background: var(--ink);
  -webkit-mask-image: var(--logo-src);
  mask-image: var(--logo-src);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: left center;
  mask-position: left center;
}

.shop-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.shop-logo:not([hidden]) + .shop-text {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.eyebrow {
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.shop-name {
  font-size: clamp(1.3rem, 1rem + 0.9vw, 1.7rem);
  line-height: 1.15;
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
  }
  .shop {
    flex-direction: column;
    align-items: flex-start;
  }
  .shop-logo:not([hidden]) + .shop-text {
    padding-left: 0;
    border-left: 0;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.spot-brand {
  display: inline-flex;
  align-items: center;
}

.spot-logo {
  height: 28px;
  width: auto;
}

.spot-logo--light {
  display: var(--spot-logo-light);
}

.spot-logo--dark {
  display: var(--spot-logo-dark);
}

/* Buttons and form controls ---------------------------------------------- */

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-small);
  border: 1px solid transparent;
  padding: 9px 16px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

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

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-quiet:hover:not(:disabled) {
  background: var(--neutral-soft);
}

.btn-small {
  padding: 5px 12px;
  font-size: var(--step--1);
}

input,
select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 9px 12px;
  min-width: 0;
}

/* Notices ---------------------------------------------------------------- */

.notice {
  border-radius: var(--radius-small);
  padding: 10px 14px;
  font-size: var(--step--1);
}

.notice-demo {
  background: var(--accent-soft);
  color: var(--ink);
}

.notice-demo strong {
  color: var(--accent);
}

.notice-error,
.form-error {
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-small);
  padding: 10px 14px;
  font-size: var(--step--1);
}

/* Sign-in ---------------------------------------------------------------- */

.login {
  display: flex;
  justify-content: center;
  padding-block: 24px;
}

.login-card {
  width: 100%;
  max-width: 24rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-card h2 {
  font-size: var(--step-2);
}

.login-card label {
  font-weight: 600;
  font-size: var(--step--1);
  margin-top: 6px;
}

.login-card .btn {
  margin-top: 8px;
}

/* Summary strip ---------------------------------------------------------- */

.dash {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.summary {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

/* The month heading is the month picker. */
.month-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: -10px;
}

.month-select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-size: var(--step-2);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  padding: 5px 40px 5px 10px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.month-select:hover,
.month-select:focus-visible {
  background: var(--surface);
  border-color: var(--line);
}

.month-picker::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-75%) rotate(45deg);
  pointer-events: none;
}

.month-select option {
  font-size: var(--step-0);
  font-weight: 400;
}

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

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.tile-label {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile-value {
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-value .pence {
  font-size: 0.58em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.tile-sub {
  font-size: var(--step--1);
  color: var(--muted);
}

.tile--saving {
  background: var(--accent-soft);
  border-color: transparent;
}

.tile--saving .tile-label,
.tile--saving .tile-value,
.tile--saving .tile-value .pence {
  color: var(--accent);
}

.tiles[aria-busy="true"] .tile-value {
  color: var(--muted);
}

@media (max-width: 860px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tabs and panels -------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs [role="tab"] {
  font: inherit;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
}

.tabs [role="tab"]:hover {
  color: var(--ink);
}

.tabs [role="tab"][aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.5vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.panel h3 {
  font-size: var(--step-1);
}

.stripe-host {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.loading {
  color: var(--muted);
  font-size: var(--step--1);
  animation: breathe 1.6s ease-in-out infinite;
}

@keyframes breathe {
  50% {
    opacity: 0.45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading {
    animation: none;
  }
  .btn {
    transition: none;
  }
}

/* Export ----------------------------------------------------------------- */

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

.export-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 34rem;
  min-width: 0;
}

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

.csv-preview {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius-small);
  background: var(--neutral-soft);
  color: var(--ink);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  overflow-x: auto;
}

/* Sample-data tables (preview only; the live panels are Stripe's) -------- */

.demo-note {
  font-size: var(--step--1);
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  min-width: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  text-align: left;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 0;
}

.data-table .num {
  text-align: right;
}

.data-table .when-time {
  color: var(--muted);
  margin-left: 6px;
}

.card-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.wallet {
  font-size: 0.75rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 8px;
}

.pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
}

.pill--good {
  background: var(--good-soft);
  color: var(--good);
}

.pill--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill--neutral {
  background: var(--neutral-soft);
  color: var(--muted);
}

/* Footer ----------------------------------------------------------------- */

.foot {
  font-size: var(--step--1);
  color: var(--muted);
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
