/* ════════════════════════════════════════════════════════════════════════
   portal.css — the customer portal (portal/layout, portal/auth-layout), redesigned to the PORT wireframes.
   The shop's own portal: its logo and name in a quiet header, the app's teal, the customer's own type size (14px), white
   pages grouped by space: no cards, borders or lines. Everything is under body.portal.
   PC 1100px and up; tablet 768-1099px; phone under 768px (bottom tabs).
   ════════════════════════════════════════════════════════════════════════ */

@font-face { font-family: 'Inter'; src: url('../fonts/inter/inter-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter/inter-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter/inter-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/inter/inter-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

body.portal {
    --pt-teal: #0f766e;
    --pt-teal-dark: #115e59;
    --pt-teal-soft: #e3f1ee;
    --pt-ink: #1f2933;
    --pt-muted: #52606d;
    --pt-faint: #616e7c;
    --pt-quiet: #9aa5b1;
    --pt-fill: #f1f4f6;
    --pt-fill-hover: #e6ebee;
    --pt-chrome: #f6f8f9;
    --pt-good: #047857;
    --pt-warn: #b45309;
    --pt-bad: #b91c1c;
    --pt-tabs: 64px;
    margin: 0; background: #fff; color: var(--pt-ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
body.portal *, body.portal *::before, body.portal *::after { box-sizing: border-box; }
body.portal a { color: var(--pt-ink); text-decoration: none; }
body.portal a:hover { color: var(--pt-teal); }
body.portal :is(h1, h2, h3) { margin: 0; color: var(--pt-ink); font-weight: 700; }
body.portal p { margin: 0; }
body.portal :focus-visible { outline: 2px solid var(--pt-teal); outline-offset: 2px; }
.pt-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ── The header: the shop, its pages, notifications, profile, log out ─── */
.pt-header { position: sticky; top: 0; z-index: 300; background: var(--pt-chrome); }
.pt-header-row { height: 68px; display: flex; align-items: center; gap: 24px; padding: 0 64px; }
.pt-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-size: 16px; font-weight: 700; color: var(--pt-ink) !important; }
.pt-brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-logo { width: 32px; height: 32px; flex: none; border-radius: 8px; object-fit: contain; background: #fff; }
.pt-logo.is-initial { display: inline-flex; align-items: center; justify-content: center; background: var(--pt-teal); color: #fff; font-size: 15px; font-weight: 700; }
.pt-nav { display: flex; gap: 6px; }
body.portal .pt-nav a { padding: 8px 10px; border-radius: 8px; color: var(--pt-ink); }
body.portal .pt-nav a:hover { background: var(--pt-fill-hover); }
body.portal .pt-nav a[aria-current="page"] { background: var(--pt-teal-soft); color: var(--pt-teal); font-weight: 600; }
.pt-header-end { margin-left: auto; display: flex; align-items: center; gap: 18px; }
body.portal .pt-link-btn { padding: 0; border: 0; background: none; color: var(--pt-ink); font: inherit; cursor: pointer; }
body.portal .pt-link-btn:hover { color: var(--pt-teal); }
body.portal .pt-link-btn.is-quiet { color: var(--pt-muted); }
.pt-count { margin-left: 4px; font-weight: 700; color: var(--pt-teal); }
.pt-logout { display: contents; }
.pt-menu-btn, .pt-phone-only { display: none !important; }

/* Notifications: a panel under the header */
.pt-notifs { position: relative; }
.pt-notifs > summary { list-style: none; cursor: pointer; }
.pt-notifs > summary::-webkit-details-marker { display: none; }
.pt-notifs-panel {
    position: absolute; right: 0; top: calc(100% + 14px); z-index: 400; width: 340px; max-width: calc(100vw - 24px); max-height: 440px; overflow-y: auto;
    padding: 8px; background: #fff; border-radius: 14px; box-shadow: 0 16px 40px -12px rgba(17, 24, 31, .22), 0 2px 6px rgba(17, 24, 31, .06);
}
.pt-notifs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 8px; font-weight: 600; }
.pt-notif { display: flex; flex-direction: column; gap: 2px; padding: 9px 8px; border-radius: 10px; }
.pt-notif.is-unread { background: var(--pt-teal-soft); }
.pt-notif-title { font-weight: 600; }
.pt-notif-text { color: var(--pt-muted); font-size: 13px; }
.pt-notif-time { color: var(--pt-faint); font-size: 12px; }
.pt-notif form { display: contents; }
body.portal .pt-notif .pt-link-btn, body.portal .pt-notifs-head .pt-link-btn { color: var(--pt-teal); font-size: 12px; font-weight: 600; width: fit-content; }
.pt-notifs-empty { padding: 22px 8px; text-align: center; color: var(--pt-faint); }

/* The phone's menu, under the header */
.pt-menu { display: none; }

/* ── The page ─────────────────────────────────────────────────────────── */
.pt-page { width: 100%; max-width: 1080px; margin: 0 auto; padding: 40px 24px 48px; display: flex; flex-direction: column; gap: 34px; }
.pt-flash { display: flex; flex-direction: column; gap: 8px; margin-bottom: -14px; }
.pt-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 16px; }
.pt-head-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
body.portal .pt-title { font-size: 28px; line-height: 1.2; overflow-wrap: anywhere; }
.pt-sub { color: var(--pt-muted); }
.pt-back { color: var(--pt-muted) !important; font-size: 13px; }
.pt-back + .pt-head { margin-top: -22px; }
.pt-section { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.pt-section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
body.portal .pt-h2 { font-size: 17px; }
body.portal .pt-section-link { color: var(--pt-teal); font-weight: 600; }
.pt-hint { font-size: 12px; color: var(--pt-faint); line-height: 1.5; }
.pt-muted { color: var(--pt-muted); }
.pt-good { color: var(--pt-good) !important; }
.pt-warn { color: var(--pt-warn) !important; }
.pt-bad { color: var(--pt-bad) !important; }
.pt-status { font-weight: 600; }
.pt-strong { font-weight: 700; }
.pt-num { text-align: right; white-space: nowrap; }

/* The figures */
.pt-figures { display: flex; flex-wrap: wrap; gap: 24px 72px; }
.pt-figure { display: flex; flex-direction: column; gap: 2px; }
.pt-figure-label { color: var(--pt-muted); }
.pt-figure-value { font-size: 30px; font-weight: 700; line-height: 1.2; }

/* A notice */
.pt-notice { padding: 12px 14px; border-radius: 10px; background: var(--pt-chrome); color: var(--pt-ink); line-height: 1.5; }
.pt-notice.is-good { background: #e8f5ef; color: #065f46; }
.pt-notice.is-warn { background: #fdf3e6; color: #92400e; }
.pt-notice.is-bad { background: #fdecec; color: #991b1b; }

/* Open rows: a table without lines */
.pt-table-wrap { overflow-x: auto; }
.pt-table { width: 100%; border-collapse: collapse; }
.pt-table th { padding: 0 9px 6px; text-align: left; font-size: 12px; font-weight: 600; color: var(--pt-faint); white-space: nowrap; }
.pt-table td { padding: 9px; vertical-align: middle; }
.pt-table :is(th, td):first-child { padding-left: 0; }
.pt-table :is(th, td):last-child { padding-right: 0; }
.pt-table tbody tr:hover td { background: #fafbfc; }
.pt-table tfoot td { padding-top: 12px; font-weight: 700; }
.pt-table .pt-sub-row td { padding-top: 2px; color: var(--pt-muted); font-weight: 400; }
/* An invoice's items: on a phone each line is the item over its quantity and price, its total at the right (in four columns
   "Tea Leaves 250g" broke over three lines in what the figures left). The totals under them keep the same two sides. */
.pt-item-each { display: none; }
@media (max-width: 599px) {
    .pt-table.is-items thead { display: none; }
    .pt-table.is-items, .pt-table.is-items :is(tbody, tfoot, tr, td) { display: block; }
    .pt-table.is-items tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px 14px; padding: 9px 0; }
    .pt-table.is-items td { padding: 0 !important; background: none !important; }
    .pt-table.is-items tbody td:is(:nth-child(2), :nth-child(3)) { display: none; }
    .pt-table.is-items tr > td:first-child { text-align: left; }
    .pt-table.is-items tr > td:last-child { text-align: right; white-space: nowrap; }
    .pt-table.is-items tfoot tr { padding: 3px 0; }
    .pt-table.is-items tfoot tr:first-child { padding-top: 12px; }
    .pt-item-each { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--pt-muted); }
}

/* Buttons: only as wide as their words */
body.portal .pt-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: fit-content; flex: none; height: 40px; padding: 0 16px;
    border: 0; border-radius: 8px; background: var(--pt-fill); color: var(--pt-ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
body.portal .pt-btn:hover { background: var(--pt-fill-hover); color: var(--pt-ink); }
body.portal .pt-btn.is-primary { background: var(--pt-teal); color: #fff; }
body.portal .pt-btn.is-primary:hover { background: var(--pt-teal-dark); color: #fff; }
body.portal .pt-btn.is-lg { height: 46px; padding: 0 20px; }

/* Fields */
.pt-form { display: flex; flex-direction: column; gap: 14px; }
.pt-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.pt-fields > .is-wide { grid-column: 1 / -1; }
.pt-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pt-field > label, .pt-label { font-weight: 600; }
body.portal .pt-input {
    width: 100%; min-height: 40px; padding: 9px 12px; border: 0; border-radius: 8px; background: var(--pt-fill);
    color: var(--pt-ink); font: inherit;
}
body.portal .pt-input:focus { outline: none; background: #fff; box-shadow: 0 0 0 2px rgba(15, 118, 110, .4); }
body.portal .pt-input::placeholder { color: var(--pt-quiet); }
.pt-error { color: var(--pt-bad); font-size: 13px; font-weight: 600; }
.pt-field.has-error .pt-input { box-shadow: 0 0 0 2px rgba(185, 28, 28, .35); }
.pt-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.pt-check input { width: 16px; height: 16px; accent-color: var(--pt-teal); }
.pt-pay-row { display: flex; gap: 8px; }
.pt-pay-row .pt-input { flex: 1; min-width: 0; }
/* A line with a pay form keeps its sale, date and amount on one line each; the phone field gives way (at 900 the sale's
   number and its date broke over two lines). */
@media (min-width: 900px) { .pt-table tr:has(.pt-pay-row) > td:is([data-cell="title"], [data-cell="sub"], [data-cell="amount"]) { white-space: nowrap; } }
@media (max-width: 600px) { .pt-fields { grid-template-columns: minmax(0, 1fr); } }

/* A record with its main action at the side (an invoice) */
.pt-record { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 72px; align-items: start; }
.pt-record-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.pt-record-side { display: flex; flex-direction: column; gap: 14px; padding-top: 48px; }
.pt-balance-label { color: var(--pt-muted); }
.pt-balance { margin-top: -10px; font-size: 32px; font-weight: 700; line-height: 1.2; }
@media (max-width: 1099px) { .pt-record { grid-template-columns: minmax(0, 1fr); gap: 30px; } .pt-record-side { padding-top: 0; max-width: 420px; } }

.pt-powered { padding: 8px 0 0; font-size: 12px; color: var(--pt-quiet); }

/* ── Tablet ───────────────────────────────────────────────────────────── */
@media (max-width: 1099px) {
    .pt-header-row { padding: 0 24px; gap: 18px; }
    .pt-header-end { gap: 16px; }
    body.portal .pt-nav a { padding: 8px 9px; }
}
/* The pages and Notifications, Profile, Log out keep their width; only the shop's name gives way (at 900 Log out broke
   over two lines and the name was cut). */
.pt-nav, .pt-header-end { flex: none; }
/* From 900px the header's shop and its Log out line up with the page's edges, not the screen's (the page is 1080px with 24px
   inside: at 1366 the shop sat 103px left of the page's title, at 2560 700px). */
@media (min-width: 900px) { .pt-header-row { padding-inline: max(24px, calc((100% - 1080px) / 2 + 24px)); } }

/* ── Phone: the shop, alerts and Menu above; the pages as tabs below ── */
@media (max-width: 899px) {
    .pt-header-row { height: 56px; padding: 0 16px; gap: 12px; }
    .pt-brand { font-size: 15px; }
    .pt-logo { width: 28px; height: 28px; }
    .pt-nav, .pt-pc-only { display: none !important; }
    .pt-menu-btn, .pt-phone-only { display: inline-flex !important; }
    .pt-header-end { gap: 14px; font-size: 13px; }
    .pt-menu.is-open { display: flex; }
    .pt-menu { position: fixed; top: 56px; left: 0; right: 0; z-index: 290; flex-direction: column; gap: 2px; padding: 8px 16px 18px; background: #fff; box-shadow: 0 18px 30px -18px rgba(17, 24, 31, .25); }
    body.portal .pt-menu a, body.portal .pt-menu button { padding: 11px 0; font-size: 15px; text-align: left; }
    .pt-notifs-panel { position: fixed; left: 8px; right: 8px; top: 60px; width: auto; }
    .pt-page { padding: 18px 16px calc(var(--pt-tabs) + 28px); gap: 22px; }
    body.portal .pt-title { font-size: 22px; }
    body.portal .pt-h2 { font-size: 13px; font-weight: 600; color: var(--pt-faint); }
    .pt-figure-value { font-size: 26px; }
    .pt-tabs {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 280; height: calc(var(--pt-tabs) + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px); display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
        align-items: center; text-align: center; background: var(--pt-chrome); font-size: 11px;
    }
    body.portal .pt-tabs a { color: var(--pt-muted); padding: 10px 2px; }
    body.portal .pt-tabs a[aria-current="page"] { color: var(--pt-teal); font-weight: 700; }
    /* Rows become two-line items: the first cell's words over the rest */
    .pt-table.is-cards thead { display: none; }
    .pt-table.is-cards, .pt-table.is-cards tbody, .pt-table.is-cards tr, .pt-table.is-cards td { display: block; }
    .pt-table.is-cards tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; }
    .pt-table.is-cards td { padding: 0 !important; background: none !important; }
    .pt-table.is-cards td[data-cell="title"] { grid-column: 1; font-weight: 600; }
    .pt-table.is-cards td[data-cell="amount"] { grid-column: 2; grid-row: 1; text-align: right; font-weight: 600; }
    .pt-table.is-cards td[data-cell="sub"] { grid-column: 1; font-size: 12px; color: var(--pt-muted); }
    .pt-table.is-cards td[data-cell="status"] { grid-column: 2; grid-row: 2; text-align: right; font-size: 12px; }
    .pt-table.is-cards td[data-cell="wide"] { grid-column: 1 / -1; margin-top: 8px; }
    .pt-table.is-cards td[data-cell="hide"] { display: none; }
    .pt-table.is-cards td[data-label]:not([data-cell])::before { content: attr(data-label) ' '; color: var(--pt-faint); font-size: 12px; }
    .pt-table.is-cards td:not([data-cell]) { grid-column: 1 / -1; font-size: 13px; }
    /* The record's main action, in a bar at the foot of the screen above the tabs */
    .pt-record-side.is-bar {
        position: fixed; left: 0; right: 0; bottom: calc(var(--pt-tabs) + env(safe-area-inset-bottom, 0px)); z-index: 270;
        max-width: none; padding: 12px 16px 14px; gap: 10px; background: var(--pt-chrome);
    }
    .pt-record-side.is-bar .pt-balance-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
    .pt-record-side.is-bar .pt-balance { margin: 0; font-size: 20px; }
    .pt-record-side.is-bar .pt-hint, .pt-record-side.is-bar .pt-field > label { display: none; }
    .pt-page:has(.pt-record-side.is-bar) { padding-bottom: calc(var(--pt-tabs) + 210px); }
}
@media (min-width: 900px) { .pt-tabs { display: none; } .pt-balance-row { display: contents; } }

/* ── The portal's sign-in pages (portal/auth-layout): one card in the middle of the page, as the staff sign-in pages are, the
   shop's logo and name at its top and Powered by Merqio POS under it. No side panel, on any screen. ─ */
body.portal-auth { min-height: 100vh; background: var(--pt-chrome); }
.pt-auth { display: flex; min-height: 100vh; }
.pt-auth-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 32px 20px; }
.pt-auth-form {
    width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px;
    padding: 26px 30px; border: 1px solid #dfe5e8; border-radius: 20px; background: #fff;
}
.pt-auth-brand { align-self: center; }
.pt-auth-head { display: flex; flex-direction: column; gap: 6px; text-align: center; }
body.portal .pt-auth-title { font-size: 26px; text-wrap: balance; }
.pt-auth-powered { padding: 0; text-align: center; }
/* Centred at every size, a phone's too: the card (and Powered by under it) in the middle of the screen (a card taller than the
   screen makes the page longer and starts at its top), and its button in the middle, as the staff sign-in pages have it. */
.pt-auth-form .pt-form > .pt-btn { align-self: center; }
.pt-label-row { display: flex; justify-content: space-between; gap: 8px; }
body.portal .pt-teal-link { color: var(--pt-teal); font-weight: 600; }
.pt-auth-foot { color: var(--pt-muted); line-height: 1.5; text-align: center; }
@media (max-width: 899px) {
    .pt-auth-main { padding: 20px 12px 16px; }
    .pt-auth-form { padding: 20px 18px; border-radius: 16px; }
}

@media print {
    .pt-header, .pt-tabs, .pt-menu, .pt-record-side.is-bar { display: none !important; }
}
.pt-table th.pt-num { text-align: right; }
.pt-record:not(:has(> .pt-record-side)) { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
/* A form in a narrow column (the profile's) */
body.portal .pt-narrow { max-width: 600px; }
/* (words only a phone shows, inside a line: inline, so the space before them stays) */
@media (max-width: 899px) { span.pt-phone-only:not(.pt-link-btn) { display: inline !important; } }
/* Small rules the sign-in pages asked for */
body.portal .pt-auth-title { line-height: 1.25; }
@media (max-width: 899px) { body.portal .pt-input { font-size: 16px; } }   /* (iOS zooms the page on a field under 16px) */
/* ── The sign-in pages, compact (sign in, create an account, forgot and reset the password, choose a business, the newsletter
   pages; the online shop's Sign in opens these too): the card 400px wide, a 21px title, 12.5px labels, 38px fields and buttons,
   and the form's parts closer together. A field keeps 16px text on a phone (set above). ── */
body.portal-auth .pt-auth-brand { gap: 10px; font-size: 16px; }
body.portal-auth .pt-auth-brand .pt-logo { width: 34px; height: 34px; border-radius: 9px; }
body.portal-auth .pt-auth-main { padding: 28px 20px; }
body.portal-auth .pt-auth-form { max-width: 400px; gap: 12px; }
body.portal-auth .pt-auth-head { gap: 2px; }
body.portal-auth .pt-auth-title { font-size: 21px; line-height: 1.2; }
body.portal-auth .pt-auth-head p { font-size: 13.5px; }
body.portal-auth .pt-form { gap: 10px; }
body.portal-auth .pt-fields { gap: 10px 12px; }
body.portal-auth .pt-field { gap: 3px; }
body.portal-auth :is(.pt-field > label, .pt-label, .pt-label-row) { font-size: 12.5px; }
body.portal-auth .pt-input { min-height: 38px; padding: 7px 12px; }
body.portal-auth .pt-btn, body.portal-auth .pt-btn.is-lg { height: 38px; padding: 0 16px; }
body.portal-auth .pt-check { font-size: 13px; }
body.portal-auth .pt-notice { padding: 8px 11px; border-radius: 9px; font-size: 13px; }
body.portal-auth :is(.pt-hint, .pt-error) { font-size: 12px; }
body.portal-auth .pt-auth-foot { font-size: 13px; }
@media (max-width: 899px) {
    body.portal-auth .pt-auth-main { padding: 14px 12px 10px; }
    body.portal-auth .pt-auth-brand { font-size: 15px; }
    body.portal-auth .pt-auth-brand .pt-logo { width: 28px; height: 28px; }
    body.portal-auth .pt-auth-title { font-size: 20px; }
}
