/* ==========================================================================
   FairPinch design system
   --------------------------------------------------------------------------
   Direction: "the docket". The product's whole promise is a receipt you can
   read — gross, discount, fee, net — so the receipt is the recurring object.
   Tailwind (CDN) does layout; this file carries the identity.

   Type    Bricolage Grotesque (display) · Public Sans (body) · IBM Plex Mono (money)
           Public Sans is the typeface of Australian government services, which
           is the right register for a product about fair access.
   Colour  aubergine ink, lilac canvas, warm docket paper, violet brand, jade savings
   ========================================================================== */

:root {
    /* surfaces */
    --ink:        #1B1035;   /* aubergine-black: nav, dark sections, headings */
    --ink-soft:   #2C1D50;   /* raised surface on dark */
    --ink-line:   #3B2B63;   /* hairline on dark */
    --canvas:     #F3F2F7;   /* app background */
    --surface:    #FFFFFF;   /* cards */
    --paper:      #FFFCF5;   /* docket paper — warm, used only for receipts */

    /* brand */
    --brand:      #4C2FD7;
    --brand-lift: #7C5CFF;
    --brand-wash: #EFEBFF;

    /* semantic */
    --save:       #00875A;   /* jade: money the customer kept */
    --save-wash:  #E3F5EE;
    --amber:      #B26A00;
    --amber-wash: #FFF3DC;
    --danger:     #C22945;
    --danger-wash:#FDE8EC;

    /* text */
    --text:       #1B1035;
    --text-muted: #625A7A;
    --text-faint: #8B84A3;
    --line:       #E4E1EE;

    --radius:     14px;
    --radius-sm:  10px;

    --shadow-sm:  0 1px 2px rgba(27, 16, 53, .05);
    --shadow:     0 1px 3px rgba(27, 16, 53, .06), 0 8px 24px -12px rgba(27, 16, 53, .18);
    --shadow-lg:  0 2px 6px rgba(27, 16, 53, .06), 0 24px 56px -20px rgba(27, 16, 53, .28);

    --font-display: "Bricolage Grotesque", "Public Sans", system-ui, sans-serif;
    --font-body:    "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* -------------------------------------------------------------- baseline -- */

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, .display {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.022em;
    line-height: 1.08;
}

.display-xl { font-size: clamp(2.6rem, 6.4vw, 4.6rem); line-height: 0.98; letter-spacing: -0.035em; }
.display-lg { font-size: clamp(2rem, 4.2vw, 3rem);     line-height: 1.04; letter-spacing: -0.028em; }
.display-md { font-size: clamp(1.4rem, 2.4vw, 1.85rem); letter-spacing: -0.02em; }

/* The one recurring typographic device: a small uppercase eyebrow that names
   the section the way a field on a form names its input. */
.eyebrow {
    font-family: var(--font-mono);
    font-size: .6875rem;
    font-weight: 500;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.eyebrow--onDark { color: #A99BD6; }

.lede { font-size: 1.0625rem; line-height: 1.65; color: var(--text-muted); }

/* Money always sets in mono with tabular figures so columns line up and the
   digits never reflow while a total animates. */
.figure {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    letter-spacing: -0.02em;
}
.figure-xl { font-size: clamp(2.25rem, 7vw, 3.25rem); font-weight: 600; }
.figure-lg { font-size: 1.75rem; font-weight: 600; }

:focus-visible {
    outline: 2px solid var(--brand-lift);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection { background: var(--brand-wash); color: var(--ink); }

/* ------------------------------------------------------- signature: docket --

   A real docket: warm paper, scalloped tear edges, dot-leader rows. Set
   --notch to whatever sits behind it so the tear reads as a cut, not a shape. */

.docket {
    position: relative;
    background: var(--paper);
    --notch: var(--canvas);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow);
    color: var(--ink);
}

.docket::before,
.docket::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 10px;
    background-repeat: repeat-x;
    background-size: 16px 10px;
    pointer-events: none;
}
.docket::before {
    top: 0;
    background-image: radial-gradient(circle at 8px 0, var(--notch) 6px, transparent 6.5px);
}
.docket::after {
    bottom: 0;
    background-image: radial-gradient(circle at 8px 10px, var(--notch) 6px, transparent 6.5px);
}

.docket--onInk  { --notch: var(--ink); }
.docket--onWhite{ --notch: var(--surface); }

.docket__head {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 1px dashed rgba(27, 16, 53, .22);
}
.docket__title {
    font-family: var(--font-mono);
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.docket__meta {
    font-family: var(--font-mono);
    font-size: .6875rem;
    color: var(--text-muted);
    letter-spacing: .04em;
}

/* One line of the receipt: label ......... $12.34 */
.docket-row {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    font-family: var(--font-mono);
    font-size: .8125rem;
    padding: .3rem 0;
}
.docket-row__label { white-space: nowrap; }
.docket-row__lead {
    flex: 1 1 auto;
    min-width: 1.5rem;
    border-bottom: 1px dotted rgba(27, 16, 53, .3);
    transform: translateY(-.3em);
}
.docket-row__value {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}
.docket-row--save  .docket-row__label,
.docket-row--save  .docket-row__value { color: var(--save); font-weight: 600; }
.docket-row--muted { color: var(--text-muted); }
.docket-row--total {
    margin-top: .35rem;
    padding-top: .8rem;
    border-top: 1px dashed rgba(27, 16, 53, .22);
    font-size: 1.0625rem;
    font-weight: 600;
}

/* The docket prints itself on the success screen. */
@keyframes docket-print {
    from { clip-path: inset(0 0 100% 0); transform: translateY(-8px); }
    to   { clip-path: inset(0 0 0 0);    transform: translateY(0); }
}
.docket--printing { animation: docket-print .85s cubic-bezier(.2, .7, .3, 1) both; }

/* ------------------------------------------------------------------ cards -- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--line);
}
.card__title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; letter-spacing: -.01em; }
.card__body { padding: 1.35rem; }
.card--flush .card__body { padding: 0; }

.card--ink {
    background: var(--ink);
    border-color: var(--ink-line);
    color: #EDE9F8;
}
.card--ink .card__head { border-color: var(--ink-line); }

/* ---------------------------------------------------------------- buttons -- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .6875rem 1.15rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .12s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.btn--primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(76,47,215,.28); }
.btn--primary:hover { background: #3F26BD; }

.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: #FAF9FD; border-color: #D3CEE6; }

.btn--onInk { background: rgba(255,255,255,.09); color: #fff; border-color: rgba(255,255,255,.18); }
.btn--onInk:hover { background: rgba(255,255,255,.16); }

.btn--paper { background: #fff; color: var(--ink); }
.btn--paper:hover { background: #F3F1FB; }

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

.btn--save { background: var(--save); color: #fff; }
.btn--save:hover { background: #026F4A; }

.btn--lg { padding: .9rem 1.5rem; font-size: 1rem; border-radius: 12px; }
.btn--sm { padding: .45rem .75rem; font-size: .8125rem; }
.btn--block { display: flex; width: 100%; }

/* ----------------------------------------------------------------- forms -- */

.field { display: block; margin-bottom: 1.05rem; }
.field__label {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .375rem;
}
.field__hint { font-size: .75rem; color: var(--text-muted); margin-top: .375rem; }
.field__error { font-size: .75rem; color: var(--danger); margin-top: .375rem; font-weight: 500; }

.input, .select, .textarea {
    width: 100%;
    padding: .6875rem .875rem;
    border: 1px solid #D8D4E8;
    border-radius: var(--radius-sm);
    background: #fff;
    font-family: var(--font-body);
    font-size: .9375rem;
    color: var(--text);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder { color: #A9A2C0; }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--brand-lift);
    box-shadow: 0 0 0 3px rgba(124, 92, 255, .16);
}
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--danger); }
.input--mono { font-family: var(--font-mono); letter-spacing: .02em; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23625A7A' d='M1.4 0 6 4.6 10.6 0 12 1.4 6 7.4 0 1.4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9rem center;
    padding-right: 2.25rem;
}

/* --------------------------------------------------------------- badges --- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .1875rem .5rem;
    border-radius: 999px;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge--save   { background: var(--save-wash);   color: var(--save); }
.badge--brand  { background: var(--brand-wash);  color: var(--brand); }
.badge--amber  { background: var(--amber-wash);  color: var(--amber); }
.badge--danger { background: var(--danger-wash); color: var(--danger); }
.badge--muted  { background: #EDEBF4;            color: var(--text-muted); }
.badge--onInk  { background: rgba(255,255,255,.12); color: #DDD5F6; }

.badge__dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* The customer's discount, worn proudly but not loudly. */
.tier-chip {
    display: inline-flex;
    align-items: baseline;
    gap: .4rem;
    padding: .3rem .7rem .3rem .55rem;
    border-radius: 999px;
    background: var(--save-wash);
    color: var(--save);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: .875rem;
}

/* ------------------------------------------------------------ tier band --- */
/* Five segments, one lit. Reads as a scale you sit on, not a score you earn. */

.tier-band { display: flex; gap: 4px; }
.tier-band__seg {
    flex: 1;
    padding: .55rem .35rem;
    border-radius: 8px;
    background: #EDEBF4;
    text-align: center;
    font-family: var(--font-mono);
    font-size: .6875rem;
    color: var(--text-faint);
    transition: background-color .2s ease, color .2s ease;
}
.tier-band__seg strong { display: block; font-size: .9375rem; font-weight: 600; color: var(--text-muted); }
.tier-band__seg--active { background: var(--save); color: rgba(255,255,255,.75); }
.tier-band__seg--active strong { color: #fff; }

/* ---------------------------------------------------------------- tables -- */

.table { width: 100%; border-collapse: collapse; }
.table th {
    text-align: left;
    padding: .7rem 1.35rem;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-faint);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    background: #FBFAFD;
}
.table td {
    padding: .85rem 1.35rem;
    border-bottom: 1px solid #F0EEF7;
    font-size: .875rem;
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FBFAFE; }
.table .num {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* position:relative so an absolutely-positioned sr-only label inside a wide
   table anchors here instead of escaping to the initial containing block. */
.table-scroll { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ----------------------------------------------------------------- stats -- */

.stat { padding: 1.25rem 1.35rem; }
.stat__label { font-size: .75rem; font-weight: 600; color: var(--text-muted); letter-spacing: .01em; }
.stat__value { font-family: var(--font-mono); font-size: 1.75rem; font-weight: 600; letter-spacing: -.03em; margin-top: .2rem; }
.stat__foot  { font-size: .75rem; color: var(--text-faint); margin-top: .3rem; }

/* ------------------------------------------------------------ empty state -- */

.empty { padding: 3rem 1.5rem; text-align: center; }
.empty__icon {
    width: 44px; height: 44px;
    margin: 0 auto .9rem;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--brand-wash);
    color: var(--brand);
}
.empty__title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; }
.empty__body  { font-size: .875rem; color: var(--text-muted); margin: .35rem auto 1.1rem; max-width: 34ch; }

/* --------------------------------------------------------------- toasts --- */

.toast-stack {
    position: fixed;
    z-index: 60;
    left: 50%;
    bottom: 1.25rem;
    transform: translateX(-50%);
    width: min(30rem, calc(100vw - 2rem));
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .8rem 1rem;
    border-radius: 12px;
    background: var(--ink);
    color: #F0ECFB;
    box-shadow: var(--shadow-lg);
    font-size: .875rem;
    line-height: 1.45;
}
.toast__bar { width: 3px; align-self: stretch; border-radius: 999px; background: var(--brand-lift); flex: none; }
.toast--success .toast__bar { background: #2BD49A; }
.toast--error   .toast__bar { background: #FF7A8F; }

@media (min-width: 768px) {
    .toast-stack { left: auto; right: 1.5rem; bottom: 1.5rem; transform: none; }
}

/* ------------------------------------------------------------------- nav -- */

.nav-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .55rem .75rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    color: #B7ACDD;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link[aria-current="page"] { background: rgba(255,255,255,.11); color: #fff; font-weight: 600; }
.nav-link svg { flex: none; opacity: .85; }

/* Mobile tab bar for the customer app. */
.tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;
    display: flex;
    background: var(--ink);
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--ink-line);
}
.tabbar__item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .2rem;
    padding: .6rem 0 .55rem;
    font-size: .625rem;
    font-weight: 600;
    letter-spacing: .02em;
    color: #9E92CB;
    text-decoration: none;
}
.tabbar__item[aria-current="page"] { color: #fff; }

/* ------------------------------------------------------------- utilities -- */

.hairline { height: 1px; background: var(--line); border: 0; }
.hairline--onInk { background: var(--ink-line); }

.link { color: var(--brand); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }

.prose-muted { color: var(--text-muted); line-height: 1.7; }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: .75rem 1rem;
    background: var(--ink);
    color: #fff;
    border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* Ambient grain on the dark hero — stops the flat block reading as a swatch. */
.ink-field {
    background: var(--ink);
    background-image:
        radial-gradient(70rem 40rem at 78% -12%, rgba(124, 92, 255, .30), transparent 62%),
        radial-gradient(46rem 30rem at 6% 108%, rgba(0, 168, 118, .16), transparent 60%);
}

/* Rule that carries a label, used between landing sections. */
.section-rule {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.section-rule::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}
.section-rule--onInk::after { background: var(--ink-line); }

/* Loading */
@keyframes fp-spin { to { transform: rotate(360deg); } }
.spinner {
    width: 1em; height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    animation: fp-spin .6s linear infinite;
    display: inline-block;
}

@keyframes fp-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.pulse { animation: fp-pulse 1.4s ease-in-out infinite; }

@keyframes fp-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rise { animation: fp-rise .5s cubic-bezier(.2,.7,.3,1) both; }
.rise-1 { animation-delay: .06s; }
.rise-2 { animation-delay: .12s; }
.rise-3 { animation-delay: .18s; }
.rise-4 { animation-delay: .24s; }

[x-cloak] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* ----------------------------------------------------------------- print -- */
/* The merchant's counter card is a real thing they print and stand up. */

@media print {
    body { background: #fff; }
    .no-print, .tabbar, .toast-stack, nav, aside, header, footer { display: none !important; }
    .print-only { display: block !important; }
    .card, .docket { box-shadow: none; border: 1px solid #ddd; }
    .counter-card { page-break-inside: avoid; }
    @page { margin: 12mm; }
}
.print-only { display: none; }
