/*
 * The MyAccount portal, in the public website's own clothes.
 *
 * Every colour and font here reads a --canopy-* variable the website publishes at /theme.css, with
 * a plain fallback for a site that is unreachable. That is the whole mechanism: change the website's
 * theme and this portal follows on the next page load.
 */
:root {
    --ma-bg: var(--canopy-color-surface-alt, #faf8f4);
    --ma-surface: var(--canopy-color-surface, #ffffff);
    --ma-text: var(--canopy-color-text, #23201c);
    --ma-muted: var(--canopy-color-text-muted, #6f685f);
    --ma-primary: var(--canopy-color-primary, #7a4f2a);
    --ma-on-primary: var(--canopy-color-primary-contrast, #ffffff);
    --ma-accent: var(--canopy-color-secondary, var(--ma-primary));
    --ma-border: var(--canopy-color-border, #e5dfd6);
    --ma-heading: var(--canopy-font-heading, Georgia, "Times New Roman", serif);
    --ma-body: var(--canopy-font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
    --ma-radius: var(--canopy-radius, 10px);
    --ma-button-radius: var(--canopy-button-radius, 999px);
    --ma-shadow: var(--canopy-shadow, 0 1px 2px rgba(0, 0, 0, .05), 0 10px 24px -16px rgba(0, 0, 0, .25));
}
* { box-sizing: border-box; }
html, body { margin: 0; }
.ma-body { background: var(--ma-bg); color: var(--ma-text); font-family: var(--ma-body); line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }

.ma-header {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: 1rem clamp(1rem, 4vw, 2.5rem); background: var(--ma-surface); border-bottom: 1px solid var(--ma-border);
}
.ma-brand { font-family: var(--ma-heading); font-size: 1.35rem; font-weight: 700; color: var(--ma-text); text-decoration: none; }
.ma-nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.ma-nav a, .ma-linkbutton { color: var(--ma-text); text-decoration: none; font-size: .95rem; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.ma-nav a:hover, .ma-linkbutton:hover { color: var(--ma-primary); }
.ma-nav__cta { background: var(--ma-primary); color: var(--ma-on-primary) !important; padding: .45rem 1rem; border-radius: var(--ma-button-radius); }
.ma-inline { display: inline; margin: 0; }

.ma-main { flex: 1 0 auto; width: 100%; box-sizing: border-box; max-width: 960px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 3rem; }
.ma-title { font-family: var(--ma-heading); font-size: clamp(1.6rem, 3vw, 2.2rem); margin: .5rem 0 1rem; }
.ma-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.ma-card { background: var(--ma-surface); border: 1px solid var(--ma-border); border-radius: var(--ma-radius); padding: 1.1rem 1.25rem; box-shadow: var(--ma-shadow); }
.ma-card__title { font-family: var(--ma-heading); font-size: 1.05rem; margin: 0 0 .5rem; }
.ma-big { font-family: var(--ma-heading); font-size: 2.2rem; margin: .2rem 0; }
.ma-muted { color: var(--ma-muted); }
.ma-empty { color: var(--ma-muted); }
.ma-link { color: var(--ma-primary); text-decoration: none; font-weight: 600; }
.ma-link:hover { text-decoration: underline; }
.ma-list { list-style: none; padding: 0; margin: 0 0 .75rem; }
.ma-list li { display: flex; justify-content: space-between; gap: .75rem; padding: .35rem 0; border-bottom: 1px solid var(--ma-border); }
.ma-list li:last-child { border-bottom: 0; }

.ma-orders { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: .75rem; }
.ma-order { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.ma-order__head { display: flex; gap: .6rem; align-items: baseline; }
.ma-order__total { font-weight: 700; white-space: nowrap; }

.ma-form { display: grid; gap: .9rem; }
.ma-field { display: grid; gap: .3rem; }
.ma-field > span { font-weight: 600; font-size: .9rem; }
.ma-input { font: inherit; padding: .6rem .75rem; border: 1px solid var(--ma-border); border-radius: calc(var(--ma-radius) * .6); background: var(--ma-surface); color: var(--ma-text); width: 100%; }
.ma-input:focus { outline: 2px solid var(--ma-primary); outline-offset: 1px; }
.ma-check { display: flex; gap: .6rem; align-items: flex-start; }
.ma-check input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; }
.ma-button { display: inline-block; font: inherit; font-weight: 600; padding: .65rem 1.3rem; border-radius: var(--ma-button-radius); background: var(--ma-primary); color: var(--ma-on-primary); border: 0; cursor: pointer; text-decoration: none; }
.ma-button:hover { filter: brightness(.95); }
.ma-button--quiet { background: transparent; color: var(--ma-primary); border: 1px solid var(--ma-primary); }
.ma-error { color: #a4372a; background: rgba(164, 55, 42, .08); padding: .6rem .8rem; border-radius: calc(var(--ma-radius) * .6); }
.ma-success { color: #2f6f3f; background: rgba(47, 111, 63, .1); padding: .6rem .8rem; border-radius: calc(var(--ma-radius) * .6); }

.ma-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 2.5rem); color: var(--ma-muted); font-size: .9rem; border-top: 1px solid var(--ma-border); }
.ma-footer a { color: var(--ma-muted); }

/* Sign-in security: the authenticator QR code and the key for typing it by hand. */
.ma-qr { max-width: 220px; margin: .5rem 0; background: #fff; border-radius: calc(var(--ma-radius) * .6); padding: .5rem; }
.ma-qr svg { display: block; width: 100%; height: auto; }
.ma-key { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1rem; letter-spacing: .06em; word-break: break-all; background: var(--ma-bg); padding: .5rem .7rem; border-radius: calc(var(--ma-radius) * .6); }
.ma-inline + .ma-inline { margin-left: .5rem; }

/* The sign-in card: the Employee Portal's shape in the website's clothes. One centred card with the
   cafe's mark and name, a title and a line under it, then two accordion panels — sign in, create an
   account — built on <details>, since these pages carry no script. */
.ma-auth { max-width: 440px; margin: 1.5rem auto 0; }
.ma-auth__card { background: var(--ma-surface); border: 1px solid var(--ma-border); border-radius: var(--ma-radius); box-shadow: var(--ma-shadow); padding: 1.6rem 1.5rem 1.4rem; }
.ma-auth__brand { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.1rem; }
.ma-auth__mark { width: 34px; height: 34px; border-radius: 9px; background: var(--ma-primary); color: var(--ma-on-primary); display: inline-flex; align-items: center; justify-content: center; font-family: var(--ma-heading); font-weight: 700; font-size: 1.05rem; }
.ma-auth__name { font-weight: 600; font-size: 1rem; }
.ma-auth__title { font-family: var(--ma-heading); font-size: 1.45rem; margin: 0 0 .3rem; }
.ma-auth__subtitle { color: var(--ma-muted); font-size: .92rem; margin: 0 0 1rem; line-height: 1.45; }
.ma-auth__hint { color: var(--ma-muted); font-size: .85rem; margin: 0; line-height: 1.45; }
.ma-auth .ma-error { margin: 0 0 .9rem; }
.ma-auth__form { display: grid; gap: .9rem; }
.ma-auth .ma-field > span { font-size: .85rem; }
.ma-auth .ma-button { width: 100%; text-align: center; }
.ma-auth__code { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.ma-auth__links { display: flex; gap: 1rem; justify-content: center; }
.ma-auth__link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--ma-muted); font-size: .9rem; }
.ma-auth__link:hover { color: var(--ma-primary); }

.ma-acc { border: 1px solid var(--ma-border); border-radius: calc(var(--ma-radius) * .7); margin-bottom: .6rem; overflow: hidden; }
.ma-acc > summary { list-style: none; cursor: pointer; padding: .8rem 1rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; background: var(--ma-bg); }
.ma-acc > summary::-webkit-details-marker { display: none; }
.ma-acc > summary::after { content: ""; width: .5rem; height: .5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); opacity: .55; transition: transform .15s ease; margin-right: .2rem; }
.ma-acc[open] > summary::after { transform: rotate(-135deg); margin-top: .3rem; }
.ma-acc[open] > summary { border-bottom: 1px solid var(--ma-border); }
.ma-acc > summary:focus-visible { outline: 2px solid var(--ma-primary); outline-offset: -2px; }
.ma-acc__body { padding: 1rem; }
/* A shut row has to say enough to choose from: the name, then the price and how many dates. */
.ma-acc__head { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.ma-acc__name { font-family: var(--ma-heading); font-size: 1.05rem; }
.ma-acc__head .ma-muted { font-weight: 400; font-size: .85rem; }
.ma-acc__body > .ma-rich { margin-bottom: 1rem; }
.ma-acc__body > .ma-card__title:first-child { margin-top: 0; }

/* ----- the customer portal: bookings, organizations, invoices, applications ----- */
.ma-flash { padding: 10px 14px; border-radius: 8px; background: #e8f5e9; color: #1b5e20; }
.ma-flash--error { background: #fdecea; color: #b71c1c; }
.ma-pill { display: inline-block; font-size: 0.78em; padding: 2px 8px; border-radius: 999px; background: #eceff1; color: #37474f; vertical-align: middle; }
.ma-pill--good { background: #e8f5e9; color: #1b5e20; }
.ma-pill--wait { background: #fff8e1; color: #8d6e00; }
.ma-pill--off { background: #eceff1; color: #78909c; }
.ma-booking { display: flex; flex-direction: column; gap: 8px; }
.ma-booking--past { opacity: .8; }
.ma-booking__head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.ma-booking__docs ul, .ma-list { margin: 4px 0 0; padding-left: 18px; }
.ma-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ma-booking__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.ma-inline { display: inline-block; }
.ma-inline summary { list-style: none; cursor: pointer; }
.ma-inline summary::-webkit-details-marker { display: none; }
.ma-form--inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin-top: 8px; }
.ma-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ma-tab { padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(0,0,0,.15); text-decoration: none; color: inherit; }
.ma-tab.is-active { background: var(--ma-accent, #333); color: #fff; border-color: transparent; }
.ma-cal { max-width: 420px; }
.ma-cal__nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.ma-cal__nav a { text-decoration: none; padding: 2px 10px; font-size: 1.3em; }
.ma-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.ma-cal__dow { font-size: 11px; opacity: .65; text-transform: uppercase; }
.ma-cal__day { display: block; padding: 7px 0; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); text-decoration: none; color: inherit; }
.ma-cal__day.is-past, .ma-cal__day.is-taken { opacity: .4; background: rgba(0,0,0,.06); text-decoration: line-through; }
.ma-cal__day.is-picked { border-color: currentColor; font-weight: 700; }
.ma-cal__day.is-open:hover { border-color: currentColor; }
.ma-avail { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 12px; font-size: .9em; }

/*
 * A booking calendar with what is on the diary, the way the website's own component draws it:
 * day squares with a chip per booking and the hours in a tooltip.
 *
 * No script. The tooltip is a nested span revealed on :hover and :focus-within, and the chip
 * carries tabindex so a keyboard reaches it -- the hours and the town are written nowhere else.
 * The month is changed by the links above the grid, which is also why this works with script off.
 */
.ma-cal__grid--bands { gap: 4px; }
.ma-cal__cell {
    display: flex; flex-direction: column; gap: 3px; min-height: 58px; padding: 3px;
    border: 1px solid var(--ma-border); border-radius: calc(var(--ma-radius) * .5); background: var(--ma-surface);
}
.ma-cal__cell.is-blank { border: 0; background: none; min-height: 0; }
.ma-cal__cell.is-past, .ma-cal__cell.is-taken { background: var(--ma-bg); }
.ma-cal__cell.is-picked { border-color: var(--ma-primary); box-shadow: 0 0 0 1px var(--ma-primary) inset; }
.ma-cal__grid--bands .ma-cal__day {
    display: block; padding: 0; border: 0; border-radius: 0; background: none;
    text-decoration: none; color: inherit; text-align: center; opacity: 1;
}
.ma-cal__cell.is-past .ma-cal__daynum, .ma-cal__cell.is-taken .ma-cal__daynum { opacity: .45; }
.ma-cal__daynum { font-size: .82rem; font-variant-numeric: tabular-nums; }
.ma-cal__grid--bands .ma-cal__day:hover .ma-cal__daynum { color: var(--ma-primary); font-weight: 700; }

.ma-cal__bands { display: flex; flex-direction: column; gap: 2px; margin-top: auto; }
/* A chip, not a label: a month of squares has no room for text, which is what the tooltip is for. */
.ma-cal__band {
    position: relative; display: block; height: 6px; border-radius: 3px;
    background: var(--ma-primary); cursor: help;
}
.ma-cal__band.is-other { background: var(--ma-accent); opacity: .65; }
.ma-cal__band.is-blocked { background: var(--ma-muted); opacity: .4; }
.ma-cal__band:focus-visible { outline: 2px solid var(--ma-primary); outline-offset: 2px; }

.ma-cal__tip {
    position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
    z-index: 5; display: none; width: max-content; max-width: 190px;
    padding: .4rem .55rem; border-radius: calc(var(--ma-radius) * .5);
    background: var(--ma-text); color: var(--ma-surface);
    font-size: .78rem; line-height: 1.35; text-align: left; box-shadow: var(--ma-shadow);
}
.ma-cal__band:hover .ma-cal__tip, .ma-cal__band:focus .ma-cal__tip, .ma-cal__band:focus-within .ma-cal__tip { display: block; }

.ma-cal__legend { list-style: none; padding: 0; margin: .6rem 0 0; display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; color: var(--ma-muted); }
.ma-cal__legend li { display: flex; align-items: center; gap: .45rem; }
.ma-cal__swatch { width: 18px; height: 6px; border-radius: 3px; background: var(--ma-primary); flex: 0 0 auto; }
.ma-cal__swatch.is-other { background: var(--ma-accent); opacity: .65; }
.ma-cal__swatch.is-blocked { background: var(--ma-muted); opacity: .4; }

/* What the cafe will book: one card per mobile unit and per space it lets. */
.ma-subtitle { font-family: var(--ma-heading); font-size: 1.25rem; margin: 1.75rem 0 .75rem; }
.ma-subtitle:first-of-type { margin-top: .5rem; }
.ma-offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: .5rem; }
.ma-offer { display: flex; flex-direction: column; gap: .4rem; }
.ma-offer__name { font-family: var(--ma-heading); font-size: 1.1rem; margin: 0; }
.ma-offer__kind { margin: 0; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ma-muted); }
.ma-offer__about { margin: .2rem 0 .8rem; font-size: .92rem; color: var(--ma-muted); }
/* The button sits on the floor of the card so a row of cards lines up however long the terms run. */
.ma-offer .ma-button { margin-top: auto; align-self: flex-start; }

/*
 * Café-authored rich text: a course description, a job posting's duties.
 *
 * These came across from the old site as the editor's HTML — headings with inline font sizes,
 * nested lists — and the back office sanitises them on the way out. The styling here is what keeps
 * that markup inside the card instead of fighting the page: the editor's own heading sizes are
 * overridden, because a 24px heading in a description under a 1.15rem card title reads as a
 * mistake, and long words and wide tables are kept from pushing the page sideways.
 */
.ma-rich { max-width: 68ch; }
.ma-rich > :first-child { margin-top: 0; }
.ma-rich > :last-child { margin-bottom: 0; }
.ma-rich p { margin: 0 0 .7rem; }
.ma-rich h1, .ma-rich h2, .ma-rich h3, .ma-rich h4, .ma-rich h5, .ma-rich h6 {
    font-family: var(--ma-heading); font-size: 1rem !important; font-weight: 700; margin: 1rem 0 .4rem;
}
.ma-rich span { font-size: inherit !important; }
.ma-rich ul, .ma-rich ol { margin: 0 0 .7rem; padding-left: 1.4rem; }
.ma-rich li { margin: .2rem 0; }
.ma-rich a { color: var(--ma-primary); }
.ma-rich img { max-width: 100%; height: auto; border-radius: calc(var(--ma-radius) * .6); }
.ma-rich table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.ma-rich th, .ma-rich td { padding: .4rem .5rem; border-bottom: 1px solid var(--ma-border); text-align: left; }
.ma-rich--lead { font-weight: 600; margin-bottom: .9rem; }
/* A one-line summary on a card: the muted treatment the plain version had. */
.ma-offer__about.ma-rich { color: var(--ma-muted); font-size: .92rem; max-width: none; }

/* A priced list: a catering basket, a class order. Scrolls in its own box on a phone. */
.ma-items { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.ma-items th, .ma-items td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--ma-border); vertical-align: top; }
.ma-items thead th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ma-muted); }
.ma-items tbody th { font-weight: 600; }
.ma-items tbody th .ma-muted { font-weight: 400; font-size: .88rem; }
.ma-items__price { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ma-items tfoot th { text-align: right; font-weight: 600; }
.ma-items__grand th, .ma-items__grand td { font-size: 1.05rem; border-bottom: 0; }
.ma-items__total { text-align: right; font-weight: 600; margin: .6rem 0 0; }

/* The employment application: a grouped form, and the availability grid. */
.ma-fieldset { border: 1px solid var(--ma-border); border-radius: calc(var(--ma-radius) * .6); padding: .9rem 1rem; margin: 0 0 .9rem; }
.ma-fieldset legend { padding: 0 .4rem; font-weight: 600; font-size: .88rem; }
.ma-fieldset .ma-grid { margin-bottom: .6rem; }
/* The grid is wider than a phone, so it scrolls in its own box rather than the page sideways. */
.ma-avail-table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.ma-avail-table th, .ma-avail-table td { padding: .45rem .6rem; text-align: center; border-bottom: 1px solid var(--ma-border); }
.ma-avail-table thead th { font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ma-muted); }
.ma-avail-table tbody th { text-align: left; font-weight: 600; }
.ma-avail-table input { width: 1.2rem; height: 1.2rem; }

/* An organization's listing: its name and address, then what you can do with it. */
.ma-org { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1rem; }
.ma-org__head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.ma-org__name { font-family: var(--ma-heading); font-size: 1.15rem; margin: 0; }
.ma-org__head p { margin: .2rem 0 0; font-size: .92rem; }
.ma-org__actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-start; }
.ma-org__code { padding: .75rem .9rem; border: 1px dashed var(--ma-border); border-radius: calc(var(--ma-radius) * .6); }
.ma-org__code .ma-key { display: inline-block; margin: .2rem 0; }
.ma-org__code p { margin: .3rem 0 0; font-size: .88rem; }
.ma-org__edit { padding-top: .5rem; border-top: 1px solid var(--ma-border); }
.ma-org__members ul { margin-top: .3rem; }

/* One unit's own page: what you have booked on it, its calendar, then the form. */
.ma-booking--new { border-color: var(--ma-primary); box-shadow: 0 0 0 2px var(--ma-primary) inset, var(--ma-shadow); }
.ma-terms { margin: 0 0 1.25rem; color: var(--ma-muted); max-width: 65ch; }

/* ----- wholesale ----- */
.ma-wholesale-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid rgba(0,0,0,.08); }
.ma-wholesale-row__img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.ma-wholesale-row__info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ma-wholesale-row__info s { opacity: .6; }
.ma-wholesale-row__controls { display: flex; gap: 6px; align-items: center; }
.ma-input--qty { width: 70px; }
.ma-wholesale-pay { border: 1px solid rgba(0,0,0,.12); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.ma-check { display: block; margin: 4px 0; }
