/* Duckert Design Portal — same look as duckert.design: white, green, rounded, Duckert Sans */

@font-face { font-family: "Duckert Sans"; src: url("/fonts/DuckertSans-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Duckert Sans"; src: url("/fonts/DuckertSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Duckert Sans"; src: url("/fonts/DuckertSans-RegularItalic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Duckert Sans"; src: url("/fonts/DuckertSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --white: #ffffff;
  --green: #60ed2e;
  --green-dark: #2f9e0c;   /* green text on white (readable) */
  --green-soft: #effde9;
  --black: #000000;
  --ink: #111111;
  --muted: #6b6b6b;
  --surface: #f6f7f5;
  --line: rgba(0, 0, 0, 0.07);
  --red: #d93025;
  --red-soft: #fdecea;
  --amber: #a15c00;
  --amber-soft: #fff4dc;

  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 32px;
  --radius-pill: 999px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 84px;

  --shadow-float: 0 8px 30px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100dvh; background: var(--white); color: var(--ink);
  font-family: "Duckert Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: var(--radius-sm); }
h1, h2, h3 { color: var(--black); letter-spacing: -0.02em; margin: 0; line-height: 1.1; }
h1 { font-size: clamp(32px, 4.4vw, 48px); font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
.dot { color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.block { display: block; }
.nowrap { white-space: nowrap; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.up { color: var(--green-dark); font-weight: 700; }
.down, .neg { color: var(--red); }
.link { color: var(--ink); font-size: 14px; font-weight: 700; text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.strong-link { font-weight: 700; text-decoration: none; }
.strong-link:hover { text-decoration: underline; text-decoration-color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 3px; }
kbd { font: inherit; font-size: 12px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); }

/* ---- Spinner (the brand loader) ---- */
.spinner { transform-origin: 50% 50%; animation: spin 1.3s cubic-bezier(0.4, 0.12, 0.6, 0.88) infinite; }
.spinner circle { stroke: var(--green); animation: arc 1.3s cubic-bezier(0.4, 0.12, 0.6, 0.88) infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes arc {
  0% { stroke-dasharray: 4 159; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 100 63; stroke-dashoffset: -30; }
  100% { stroke-dasharray: 4 159; stroke-dashoffset: -163; }
}
.page-loading { min-height: 50vh; display: grid; place-items: center; animation: fade-in 0.4s var(--ease-soft) 0.05s both; }
#app > .page-loading { min-height: 100dvh; }

/* ---- Buttons ---- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 22px; border-radius: var(--radius-pill); border: 1px solid transparent;
  font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-primary { background: var(--green); color: var(--black); }
.btn-primary:hover { background: #55db25; }
.btn-ghost { background: var(--white); color: var(--ink); border-color: rgba(0, 0, 0, 0.12); }
.btn-ghost:hover { background: var(--surface); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-danger-text { color: var(--red); }
.btn-sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn-block { width: 100%; }
.btn svg { flex: none; }
.btn-link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
/* Busy: label fades, spinner takes its place */
.btn.is-busy { opacity: 1 !important; }
.btn.is-busy > :not(.btn-spinner) { visibility: hidden; }
.btn.is-busy { color: transparent; }
.btn-spinner { position: absolute; inset: 0; display: grid; place-items: center; }
.btn-primary .btn-spinner circle, .btn-danger .btn-spinner circle { stroke: var(--black); }
.btn-danger .btn-spinner circle { stroke: var(--white); }

.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.05); }
.icon-btn-ghost { color: var(--muted); }
.icon-btn-ghost:hover { color: var(--ink); }
.icon-btn.danger:hover, .danger { color: var(--red); }
.icon-btn.is-busy svg:not(.spinner) { display: none; }
.icon-btn.is-busy .btn-spinner { position: static; }

/* ---- Header: logo, centred frosted pill, account ---- */
.app-header {
  --glass: 0;
  position: sticky; top: 0; z-index: 50; height: var(--header-h); padding: 0 var(--gutter);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
}
/* The glass sits on a pseudo-element: a backdrop-filter on the header itself would
   trap the fixed bottom nav on phones inside the header */
.app-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: rgba(255, 255, 255, calc(0.72 * var(--glass)));
  -webkit-backdrop-filter: blur(calc(16px * var(--glass))); backdrop-filter: blur(calc(16px * var(--glass)));
  border-bottom: 1px solid rgba(0, 0, 0, calc(0.05 * var(--glass)));
}
.logo { justify-self: start; display: inline-flex; align-items: center; gap: 10px; text-decoration: none; border-radius: var(--radius-sm); }
.logo img { height: 24px; width: auto; }
.logo-tag { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--green-soft); color: var(--green-dark); }
.nav-pill {
  display: flex; gap: 4px; padding: 6px; margin: 0; list-style: none; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.6); -webkit-backdrop-filter: blur(18px) saturate(180%); backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(0, 0, 0, 0.06); box-shadow: var(--shadow-float);
}
.nav-pill a {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-pill);
  font-size: 15px; text-decoration: none; color: var(--ink); white-space: nowrap;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.nav-pill a svg { display: none; }
.nav-pill a:hover { background: rgba(0, 0, 0, 0.05); }
.nav-pill a[aria-current="page"] { background: var(--green); color: var(--black); font-weight: 700; }
.nav-badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); display: inline-grid; place-items: center;
  background: var(--black); color: var(--white); font-size: 12px; font-weight: 700; line-height: 1;
}
.nav-badge[hidden] { display: none; }
.account { justify-self: end; position: relative; }
.avatar-btn { border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; }
.avatar {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--surface); color: var(--black); font-weight: 700; font-size: 15px; border: 1px solid var(--line);
}
.avatar-btn .avatar { background: var(--green); border-color: transparent; transition: transform 0.2s var(--ease); }
.avatar-btn:hover .avatar { transform: scale(1.05); }
.avatar-sm { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; border-radius: 20px; }
.avatar-green { background: var(--green); border-color: transparent; }

/* Dropdown menus */
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; min-width: 240px; padding: 8px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(-6px) scale(0.98); transform-origin: top right;
  transition: opacity 0.2s var(--ease-soft), transform 0.25s var(--ease-soft);
}
.menu.is-open { opacity: 1; transform: none; }
.menu-who { display: flex; flex-direction: column; padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-who span { font-size: 13px; color: var(--muted); }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--radius-sm);
  background: none; font-size: 15px; text-align: left; text-decoration: none; cursor: pointer; color: var(--ink);
}
.menu a:hover, .menu button:hover { background: var(--surface); }
.menu .danger { color: var(--red); }

/* ---- Layout ---- */
.app-main { max-width: 1200px; margin: 0 auto; padding: 24px var(--gutter) 96px; outline: none; }
.app-main.is-entering > * { animation: rise 0.55s var(--ease-soft) both; }
.app-main.is-entering > :nth-child(2) { animation-delay: 0.04s; }
.app-main.is-entering > :nth-child(3) { animation-delay: 0.08s; }
.app-main.is-entering > :nth-child(4) { animation-delay: 0.12s; }
.app-main.is-entering > :nth-child(n+5) { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes fade-in { from { opacity: 0; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin: 16px 0 28px; }
.page-head h1 + p { margin-top: 10px; }
.head-actions { display: flex; gap: 10px; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--muted); font-size: 14px; text-decoration: none; transition: color 0.2s var(--ease), transform 0.2s var(--ease); }
.back:hover { color: var(--ink); transform: translateX(-2px); }
.who { display: flex; align-items: center; gap: 12px; }
.who > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.who-lg { gap: 18px; }
.who-lg p { margin-top: 8px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; }
.grid-aside { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
.stack { display: grid; gap: 20px; align-content: start; }
.settings { display: grid; gap: 20px; max-width: 760px; }

/* Panels */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel > p.muted + .btn { margin-top: 18px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head p { margin-top: 6px; max-width: 52ch; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat {
  display: flex; flex-direction: column; gap: 6px; padding: 22px 24px; border-radius: var(--radius);
  background: var(--surface); text-decoration: none; color: inherit;
  transition: transform 0.4s var(--ease-soft), box-shadow 0.4s var(--ease-soft), background-color 0.3s var(--ease);
}
a.stat:hover { transform: translateY(-3px); background: var(--white); box-shadow: 0 0 0 1px var(--line), 0 18px 40px rgba(0, 0, 0, 0.06); }
.stat-label { font-size: 14px; color: var(--muted); }
.stat-value { font-size: clamp(26px, 2.6vw, 34px); font-weight: 700; letter-spacing: -0.02em; color: var(--black); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 13.5px; color: var(--muted); }
.stat-filter { gap: 10px; }
.date-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-range input { flex: 1 1 120px; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); min-width: 0; }

/* Bar chart */
.bars { --track: 160px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; padding-top: 10px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; height: calc(var(--track) + 54px); }
.bar-value { font-size: 12px; color: var(--muted); white-space: nowrap; min-height: 18px; }
.bar { width: 100%; max-width: 56px; height: max(3px, calc(var(--r) * var(--track))); border-radius: 10px 10px 4px 4px; background: var(--green); transform-origin: bottom; animation: grow 0.9s var(--ease-soft) both; animation-delay: calc(0.15s + var(--i) * 0.06s); }
.bar-col:last-child .bar { background: var(--black); }
.bar-label { font-size: 13px; color: var(--muted); text-transform: capitalize; }
@keyframes grow { from { transform: scaleY(0); } }
.notice { margin-top: 18px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber); font-size: 14px; }
.notice a { color: inherit; font-weight: 700; }

/* Lists */
.list { list-style: none; margin: 0 -12px; padding: 0; }
.list-row {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: var(--radius-sm); text-decoration: none; color: inherit;
  transition: background-color 0.2s var(--ease);
}
a.list-row:hover { background: var(--surface); }
.list > li + li { border-top: 1px solid var(--line); }
.list > li:hover + li, .list > li:hover { border-color: transparent; }
.list-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.list-end { display: flex; flex-direction: column; align-items: flex-end; }
.amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dot-unread { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.dot-unread.is-read { background: transparent; }
.key-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--green-soft); color: var(--green-dark); flex: none; }
.details { display: grid; gap: 0; margin: 0; }
.details > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.details > div:first-child { border-top: 0; padding-top: 0; }
.details dt { color: var(--muted); font-size: 14px; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.details a { text-decoration-color: var(--green); text-underline-offset: 3px; }
.notes { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); }
.notes p { margin-top: 4px; white-space: pre-wrap; }

/* Badges & tags */
.badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 700; white-space: nowrap; flex: none; }
.badge-active, .badge-paid { background: var(--green-soft); color: var(--green-dark); }
.badge-paused, .badge-inactive, .badge-refunded, .badge-archived { background: var(--surface); color: var(--muted); }
.badge-cancelled, .badge-failed { background: var(--red-soft); color: var(--red); }
.badge-pending, .badge-open { background: var(--amber-soft); color: var(--amber); }
.badge-answered { background: var(--green-soft); color: var(--green-dark); }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--surface); color: var(--muted); font-size: 12.5px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.tag svg { width: 14px; height: 14px; }
.tag-green { background: var(--green-soft); color: var(--green-dark); }
.tag-button { border: 1px dashed rgba(0, 0, 0, 0.18); background: var(--white); cursor: pointer; transition: border-color 0.2s var(--ease), color 0.2s var(--ease); }
.tag-button:hover { border-color: var(--green); color: var(--ink); }

/* Toolbar: filters + search */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.segmented { display: inline-flex; gap: 4px; padding: 5px; border-radius: var(--radius-pill); background: var(--surface); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.segmented a { padding: 8px 16px; border-radius: var(--radius-pill); font-size: 14px; text-decoration: none; color: var(--muted); white-space: nowrap; transition: background-color 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease); }
.segmented a:hover { color: var(--ink); }
.segmented a[aria-selected="true"] { background: var(--white); color: var(--black); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.segmented-sm a { padding: 7px 12px; font-size: 13.5px; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 9px; background: var(--green); color: var(--black); font-size: 11.5px; font-weight: 700; text-align: center; line-height: 18px; }
.search { position: relative; display: flex; align-items: center; flex: 1; max-width: 380px; min-width: 220px; }
.search svg { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 44px; padding: 0 16px 0 42px; border: 1px solid var(--line); border-radius: var(--radius-pill);
  font: inherit; font-size: 15px; color: var(--ink); background: var(--white); outline: none; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(96, 237, 46, 0.2); }
.search-block { max-width: none; margin: 14px 0 8px; }

/* Tables */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; overflow-x: auto; background: var(--white); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; font-weight: 400; color: var(--muted); padding: 14px 18px; background: var(--surface); white-space: nowrap; }
.table td { padding: 15px 18px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background-color 0.2s var(--ease); }
.table tbody tr[data-href], .table tbody tr[data-sub], .table tbody tr[data-tx] { cursor: pointer; }
.table tbody tr:hover { background: #fafbf9; }
.table tbody tr:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; border-radius: 0; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .who strong { display: block; }

/* Empty states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 16px; }
.empty p { max-width: 42ch; }
.empty .btn { margin-top: 10px; }
.empty-mark { width: 44px; height: 44px; border-radius: 50%; background: var(--green-soft); position: relative; margin-bottom: 6px; }
.empty-mark::after { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: var(--green); }
.page-error { min-height: 60vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 16px; }
.code404 { font-size: clamp(64px, 10vw, 120px); font-weight: 700; color: var(--green); line-height: 1; letter-spacing: -0.04em; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 8px; font-size: 14px; font-weight: 700; color: var(--black); align-content: start; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); }
.field-wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-weight: 400; font-size: 16px; color: var(--ink); background: var(--white);
  border: 1px solid rgba(0, 0, 0, 0.1); border-radius: var(--radius-sm); padding: 13px 15px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { resize: vertical; min-height: 110px; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 44px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px rgba(96, 237, 46, 0.22); }
.field [aria-invalid="true"] { border-color: var(--red); }
.field-error { color: var(--red); font-weight: 400; font-size: 13.5px; }
.field-error:empty { display: none; }
.hint { font-weight: 400; color: var(--muted); font-size: 13px; }
.form-error { color: var(--red); font-size: 14px; min-height: 0; }
.form-error:empty { display: none; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 18px; }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 50px; }
.password-wrap .reveal { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; font-weight: 400; }
.chip { height: 36px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid rgba(0, 0, 0, 0.12); background: var(--white); font-size: 14px; cursor: pointer; transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease); position: relative; }
.chip:hover { border-color: var(--green); }
.chip.is-on { background: var(--green); border-color: var(--green); color: var(--black); font-weight: 700; }
.chip.is-busy { color: transparent; }

/* ---- Dialogs ---- */
.modal {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; background: transparent; overflow: visible;
  animation: modal-in 0.4s var(--ease-soft);
}
.modal-wide { width: min(680px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(17, 17, 17, 0.28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in 0.3s var(--ease-soft); }
.modal.is-closing { animation: modal-out 0.22s var(--ease) forwards; }
.modal.is-closing::backdrop { animation: fade-out 0.22s var(--ease) forwards; }
.modal-card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); max-height: calc(100dvh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 24px 8px 28px; }
.modal-head h2 { font-size: 22px; }
.modal-body { padding: 8px 28px 28px; overflow-y: auto; }
.modal-body > p + * { margin-top: 18px; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(0.98); } }
@keyframes fade-out { to { opacity: 0; } }
.credentials { display: grid; gap: 10px; margin-top: 18px; }
.credentials > div { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); }
.credentials strong { font-size: 20px; grid-row: 2; }
.credentials .btn { grid-row: 1 / 3; grid-column: 2; }
.action-list { display: grid; gap: 6px; margin-top: 18px; }
.action { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); text-align: left; font-size: 15px; cursor: pointer; transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease); }
.action:hover { background: var(--surface); }
.action.is-busy > :not(.btn-spinner) { visibility: hidden; }
.tx-amount { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; color: var(--black); line-height: 1.1; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.pick-list button { position: relative; display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 12px 14px; border: 0; border-radius: var(--radius-sm); background: none; text-align: left; cursor: pointer; }
.pick-list button:hover { background: var(--surface); }
.pick-list button.is-busy > :not(.btn-spinner) { visibility: hidden; }

/* ---- Toasts ---- */
.toasts { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 20px 12px 16px; border-radius: var(--radius-pill);
  background: var(--white); color: var(--ink); font-size: 15px; font-weight: 700; box-shadow: var(--shadow-pop); border: 1px solid var(--line);
  animation: toast-in 0.5s var(--ease-soft) both; max-width: min(560px, calc(100vw - 32px));
}
.toast::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex: none; }
.toast-error::before { background: var(--red); }
.toast.is-leaving { animation: toast-out 0.3s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---- Login ---- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; position: relative; }
.auth-card { width: min(420px, 100%); animation: rise 0.7s var(--ease-soft) both; transition: opacity 0.35s var(--ease), transform 0.35s var(--ease); }
.auth-card.is-leaving { opacity: 0; transform: translateY(-10px) scale(0.98); }
.auth-logo { height: 26px; width: auto; margin-bottom: 44px; }
.auth h1 { font-size: clamp(36px, 6vw, 48px); }
.auth h1 + p { margin-top: 12px; }
.auth-form { display: grid; gap: 16px; margin-top: 32px; }
.auth-form .btn { margin-top: 4px; height: 52px; font-size: 16px; }
.auth .btn-block { height: 52px; font-size: 16px; }
.auth .btn-block + .btn-block { margin-top: 10px; }
.auth .step-passkey .btn-primary { margin-top: 28px; }
.divider { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--muted); font-size: 14px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-foot { margin-top: 28px; font-size: 14px; display: block; }
.auth-foot a { color: var(--ink); text-decoration-color: var(--green); text-underline-offset: 3px; }
.auth-loading { position: absolute; inset: 0; display: grid; place-items: center; animation: fade-in 0.3s var(--ease-soft) 0.15s both; }
.auth-loading[hidden] { display: none; }
.shake { animation: shake 0.4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.step.is-leaving { animation: fade-out 0.26s var(--ease) forwards; }
.step.is-entering { animation: rise 0.6s var(--ease-soft) both; }
.passkey-hero { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--green); color: var(--black); margin-bottom: 24px; flex: none; }
.passkey-hero svg { width: 30px; height: 30px; }
.passkey-empty { display: flex; gap: 18px; align-items: flex-start; padding: 18px; border-radius: var(--radius-sm); background: var(--surface); }
.passkey-empty .passkey-hero { width: 48px; height: 48px; border-radius: 14px; margin: 0; }
.passkey-empty .passkey-hero svg { width: 24px; height: 24px; }
.passkey-empty p { margin-top: 4px; }

/* ---- Inbox ---- */
.inbox { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
.inbox-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); position: sticky; top: calc(var(--header-h) + 8px); max-height: calc(100dvh - var(--header-h) - 32px); display: flex; flex-direction: column; overflow: hidden; }
.inbox-tools { display: grid; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.inbox-tools .search { max-width: none; min-width: 0; }
.inbox-tools .search input { height: 40px; }
.threads { list-style: none; margin: 0; padding: 6px; overflow-y: auto; overscroll-behavior: contain; }
.thread-row { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--radius-sm); text-decoration: none; color: inherit; position: relative; transition: background-color 0.2s var(--ease); }
.thread-row:hover { background: var(--surface); }
.thread-row.is-active { background: var(--green-soft); }
.thread-row.is-unread::before { content: ""; position: absolute; left: 3px; top: 19px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.thread-row.is-unread .thread-subject { font-weight: 700; color: var(--black); }
.thread-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.thread-subject { font-size: 15px; }
.thread-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.thread-tags:empty { display: none; }
.thread-tags .tag { height: 22px; font-size: 12px; }
.inbox-empty .empty { padding: 48px 16px; }
.inbox-thread { min-width: 0; }
.thread-placeholder { min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1px dashed rgba(0, 0, 0, 0.12); border-radius: var(--radius); }
.thread { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); padding: 26px; }
.thread.is-entering { animation: rise 0.45s var(--ease-soft) both; }
.thread-back { display: none; }
.thread-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.thread-head h2 { font-size: 24px; line-height: 1.2; }
.thread-head p { margin-top: 6px; }
.thread-head a { text-decoration-color: var(--green); text-underline-offset: 3px; }
.thread-customer { margin-top: 12px; }
.thread-actions { display: flex; gap: 2px; align-items: flex-start; }
.messages { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; margin-top: 20px; }
.message { padding: 18px 20px; border-radius: var(--radius); background: var(--surface); max-width: 92%; }
.message.is-out { background: var(--green-soft); justify-self: end; }
.message-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.message-head .muted { margin-left: auto; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.message-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--white); font-size: 14px; }
.message-meta > div { display: contents; }
.message-meta dt { color: var(--muted); }
.message-meta dd { margin: 0; }
.message-error { margin-top: 10px; color: var(--red); font-size: 13.5px; font-weight: 700; }
.reply { margin-top: 20px; border: 1px solid rgba(0, 0, 0, 0.1); border-radius: var(--radius); transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.reply:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(96, 237, 46, 0.2); }
.reply textarea { display: block; width: 100%; min-height: 110px; max-height: 420px; padding: 16px 18px 6px; border: 0; border-radius: var(--radius) var(--radius) 0 0; font: inherit; font-size: 16px; color: var(--ink); resize: none; outline: none; background: transparent; }
.reply .field-error { display: block; padding: 0 18px; }
.reply-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 18px; flex-wrap: wrap; }

/* ---- Responsive ---- */
@media (max-width: 1080px) {
  .nav-label { display: none; }
  .nav-pill a svg { display: block; }
  .nav-pill a { padding: 10px 14px; }
  .nav-pill a[aria-current="page"] .nav-label { display: inline; }
}
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-aside { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .inbox-list { position: static; max-height: none; }
  .inbox.has-thread .inbox-list { display: none; }
  .inbox:not(.has-thread) .inbox-thread { display: none; }
  .thread-back { display: inline-flex; margin: 0 0 14px; }
}
@media (max-width: 720px) {
  :root { --header-h: 64px; }
  body { font-size: 15.5px; }
  .app-header { grid-template-columns: 1fr auto; }
  .logo img { height: 21px; }
  .app-header nav { position: fixed; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 55; max-width: calc(100vw - 24px); }
  .nav-pill { background: rgba(255, 255, 255, 0.82); }
  .nav-pill a { padding: 11px 13px; }
  .nav-pill a[aria-current="page"] .nav-label { display: none; }
  .nav-badge { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; font-size: 10.5px; padding: 0 4px; }
  .app-main { padding-bottom: 120px; }
  .page-head { align-items: flex-start; margin: 8px 0 20px; }
  .stats, .stats-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats-3 > :last-child { grid-column: 1 / -1; }
  .stat { padding: 16px 18px; }
  .panel, .thread { padding: 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .table th, .table td { padding: 13px 14px; }
  .details > div { grid-template-columns: 1fr; gap: 2px; }
  .search { min-width: 0; max-width: none; flex-basis: 100%; }
  .modal-head { padding: 20px 18px 6px 22px; }
  .modal-body { padding: 6px 22px 22px; }
  .head-actions .btn span { display: none; }
  .head-actions .btn { padding: 0 14px; }
  .message { max-width: 100%; }
  .toasts { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 76px); }
  .bars { gap: 6px; --track: 120px; }
  .bar-value { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .spinner, .spinner circle { animation-duration: 1.3s !important; animation-iteration-count: infinite !important; }
}
.show-sm { display: none; }
@media (max-width: 720px) { .show-sm { display: inline; } }

/* ---- Stripe ---- */
.tag-stripe { height: 20px; padding: 0 8px; font-size: 11.5px; background: #f0eeff; color: #533afd; vertical-align: 2px; }
.tag-stripe:hover { background: #e4e0ff; }
.notice-info { background: var(--surface); color: var(--muted); }
a.action { text-decoration: none; color: inherit; }
.dialog-loading { min-height: 180px; display: grid; place-items: center; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.is-entering-soft { animation: rise 0.4s var(--ease-soft) both; }
.stripe-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.stripe-status > div { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.ok-dot, .off-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--green); vertical-align: 1px; }
.off-dot { background: var(--red); }
.sync-result { margin-top: 14px; }
@media (max-width: 720px) { .stripe-status { grid-template-columns: 1fr; } }

/* ---- Payment links ---- */
.tabs-main { margin: -8px 0 22px; }
.choice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; font-weight: 400; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 14px 16px; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: var(--radius-sm); transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.choice-body strong { font-size: 15px; color: var(--black); }
.choice-body span { font-size: 13.5px; color: var(--muted); }
.choice:hover .choice-body { border-color: var(--green); }
.choice input:checked + .choice-body { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 3px rgba(96, 237, 46, 0.18); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--green); outline-offset: 2px; }
.toggle-card { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: var(--radius-sm); cursor: pointer; transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease); }
.toggle-card input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-body { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: rgba(0, 0, 0, 0.14); position: relative; flex: none; transition: background-color 0.25s var(--ease); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.3s var(--ease-soft); }
.toggle-card:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.toggle-card:has(input:checked) .switch { background: var(--green); }
.toggle-card:has(input:checked) .switch::after { transform: translateX(18px); }
.toggle-card:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.pages-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-weight: 400; }
.stepper-sm { display: inline-flex; align-items: center; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: var(--radius-pill); padding: 3px; }
.stepper-sm button { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface); font-size: 18px; cursor: pointer; transition: background-color 0.2s var(--ease); }
.stepper-sm button:hover:not(:disabled) { background: var(--green); }
.stepper-sm button:disabled { opacity: 0.35; cursor: default; }
.stepper-sm output { min-width: 40px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.link-summary { display: flex; gap: 12px; margin-top: 20px; }
.link-summary > div { flex: 1; display: flex; flex-direction: column; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); }
.link-summary strong { font-size: 22px; color: var(--black); font-variant-numeric: tabular-nums; }
.fixed-customer { display: flex; flex-direction: column; padding: 12px 15px; border-radius: var(--radius-sm); background: var(--surface); font-weight: 400; }
.new-customer[hidden] { display: none; }
.new-customer { gap: 16px; }
.link-form .choice-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.price-row > [data-custom-name] { display: contents; }
.price-row[hidden], .price-row > [data-custom-name][hidden] { display: none; }
@media (max-width: 720px) { .choice-grid, .link-form .choice-grid { grid-template-columns: 1fr 1fr; } }
