/* The payment portal in Global Docs Hub's look: the same palette, type and shapes as the desktop app
   (GTSbooks\C Helpers\Theme\Theme.cs - ThemeColors, ThemeFonts, ThemeMetrics). */
:root {
    --primary: #0C447C;         /* ThemeColors.Primary - the app's sidebar */
    --primary-hover: #185FA5;   /* ThemeColors.PrimaryHover */
    --accent: #378ADD;          /* ThemeColors.Accent - focus rings, links */
    --brand-line: #225C96;      /* the line under the sidebar's brand header */
    --surface: #FFFFFF;
    --page: #F4F6F9;            /* ThemeColors.PageBackground */
    --border: #E2E6EC;
    --text: #1E2530;
    --text-2: #5F6B7A;
    --muted-on-primary: #B9CBDD;
    --row-alt: #F9FAFB;
    --tag-bg: #E6F0FB;          /* the blue tag / selected row colour in the app's lists */
    --good-fg: #27500A; --good-bg: #EAF3DE;
    --warn-fg: #854F0B; --warn-bg: #FAEEDA;
    --bad-fg: #791F1F;  --bad-bg: #FCEBEB;
    --radius-card: 8px;
    --radius-btn: 6px;
    --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--page);
    color: var(--text);
    font: 15px/1.45 var(--font);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- header: the app's dark blue rail with the round logo, a bold title and a muted subtitle */
.brandbar { background: var(--primary); border-bottom: 3px solid var(--brand-line); color: #fff; }
/* the full width of the window: the brand hard left, "Secure payment" hard right, with just a small margin */
.brandbar-inner { width: 100%; margin: 0; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 44px; height: auto; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { color: var(--muted-on-primary); font-size: 12.5px; }
.secure-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); font-size: 12.5px; font-weight: 600; white-space: nowrap; }

/* ---- page */
.page { flex: 1; width: 100%; max-width: 1140px; margin: 0 auto; padding: 28px 24px 40px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { font-size: 26px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.lede { margin: 6px 0 0; color: var(--text-2); }
.dot { margin: 0 6px; color: var(--border); }
.head-amount { text-align: right; }
.head-amount .caption { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .3px; }
.head-amount .big { font-size: 30px; font-weight: 700; color: var(--primary); }

.layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.col-main, .col-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-side { position: sticky; top: 16px; }

/* ---- cards: white, thin border, 8px corners, a faint shadow (CardPanel) */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: 3px 3px 0 rgba(0,0,0,.04); padding: 18px 20px 20px; }
.card.flush { padding: 0; overflow: hidden; }
.pad { padding: 16px 20px; margin: 0; }
/* the small blue capitals at the top of every SectionCard */
.section { font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--primary); margin: 0 0 12px; }
.section.pad { margin: 0; padding-bottom: 6px; }
.section.spaced { margin-top: 22px; }
.muted { color: var(--text-2); }
.center { text-align: center; }

.facts { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; }
.facts dt { color: var(--text-2); font-size: 12.5px; font-weight: 700; padding-top: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts .line { display: block; }

.tag { display: inline-block; background: var(--tag-bg); color: var(--primary); font-weight: 700; font-size: 12.5px; padding: 3px 12px; border-radius: 999px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; padding: 3px 11px 3px 9px; border-radius: 999px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-good { background: var(--good-bg); color: var(--good-fg); }
.pill-wait { background: var(--warn-bg); color: var(--warn-fg); }
.pill-bad { background: var(--bad-bg); color: var(--bad-fg); }

/* ---- tables: the list screens' grid (pale header, horizontal lines only, alternate rows) */
.table-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { background: var(--row-alt); color: var(--text-2); font-weight: 700; text-align: left; padding: 12px 14px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.grid tbody tr:nth-child(even) td { background: var(--row-alt); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .late { color: var(--bad-fg); font-weight: 600; }
.grid tfoot td { font-weight: 700; white-space: nowrap; border-bottom: 0; background: var(--surface); padding-top: 14px; padding-bottom: 14px; }
.grid tfoot td:last-child { color: var(--primary); font-size: 16px; }
.table-note { margin: 0; padding: 12px 20px 14px; font-size: 12.5px; }
.grid .fold-under { display: none; color: var(--text-2); font-size: 12px; white-space: normal; }

.note p { margin: 0; white-space: pre-line; }
.advance .tag { font-size: 14px; padding: 5px 14px; }
.advance p { margin: 10px 0 0; }

/* ---- paying by bank / wire transfer */
.wire-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wire-card .section { margin-bottom: 6px; }
.wire-card p { margin: 0; }
.wire-card .btn { flex: none; }
.wire-details { background: var(--row-alt); border: 1px solid var(--border); border-radius: var(--radius-btn); padding: 12px 14px; font-variant-numeric: tabular-nums; }
.wire-details .line { display: block; overflow-wrap: anywhere; }
.wire-ref { margin: 12px 0 0; line-height: 1.9; }
.steps { margin: 0; padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.steps li:last-child { margin-bottom: 0; }

/* ---- form fields: caption above, bordered 38px box, blue ring when focused (FieldBox) */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field input, .field select, .field textarea, .money-input {
    height: 38px; width: 100%; border: 1px solid #C9D1DC; border-radius: var(--radius-btn); background: var(--surface);
    font: inherit; color: var(--text); padding: 0 11px; outline: none; transition: border-color .12s, box-shadow .12s;
}
.field textarea { height: auto; padding: 8px 11px; resize: vertical; }
.field input.file-input { height: auto; padding: 8px; cursor: pointer; }
.field input:focus, .field select:focus, .field textarea:focus, .money-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(55,138,221,.18); }
.field input[readonly] { background: var(--row-alt); color: var(--text-2); }
.money-input { display: flex; align-items: center; gap: 6px; padding: 0 11px; }
.money-input span { color: var(--text-2); font-weight: 700; }
.money-input input { border: 0; height: 36px; padding: 0; box-shadow: none !important; font-size: 17px; font-weight: 700; }
.field.has-error input, .field.has-error select, .field.has-error .money-input { border-color: var(--bad-fg); }
.field-error { color: var(--bad-fg); font-size: 12.5px; }
.field-error:empty { display: none; }
.hint { color: var(--text-2); font-size: 12.5px; }
/* minmax(0, 1fr): the two columns share the card's width and can only shrink - never grow to fit a box that wants to be wider */
.row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
/* Date boxes: iPhone / iPad Safari draws its own date box with a minimum width of its own (wider than a narrow column), so it hung
   out of the card. Without that native look it fills its column like every other box, with the date on the left. */
.field input[type="date"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; line-height: 36px; text-align: left; }
.field input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; min-height: 1.45em; }
.field input[type="date"]::-webkit-datetime-edit { padding: 0; }
.brands { color: var(--text-2); font-size: 12px; margin: 2px 0 0; }
[hidden] { display: none !important; }

/* ---- buttons: filled Primary, 6px corners (ThemePrimaryButton / ThemeSecondaryButton) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px; border-radius: var(--radius-btn); font: 700 15px var(--font); cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-primary:disabled { background: var(--border); color: var(--text-2); cursor: not-allowed; }
.btn-primary.busy { background: var(--primary-hover); color: #fff; cursor: progress; }
.btn-outline { background: var(--surface); color: var(--text-2); border-color: var(--text-2); }
.btn-outline:hover { background: var(--page); }
.btn-block { width: 100%; height: 46px; font-size: 16px; margin-top: 8px; }
.secure-note { display: flex; gap: 6px; align-items: center; justify-content: center; color: var(--text-2); font-size: 12.5px; margin: 12px 0 0; text-align: center; }

/* ---- alerts and notices */
.alert { border-radius: var(--radius-card); padding: 12px 16px; margin-bottom: 16px; font-weight: 600; }
.alert-danger { background: var(--bad-bg); color: var(--bad-fg); border: 1px solid #F1C9C9; }
.alert-good { background: var(--good-bg); color: var(--good-fg); border: 1px solid #CFE3B8; }
.alert-info { background: var(--tag-bg); color: var(--primary); border: 1px solid #C7DBF2; }
.notice { max-width: 560px; margin: 40px auto; text-align: center; padding: 34px 32px; }
.notice h1 { font-size: 22px; margin: 14px 0 8px; }
.notice p { color: var(--text-2); margin: 0 0 10px; }
.notice-contact { margin-top: 18px !important; }
.notice-icon { width: 58px; height: 58px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.notice-icon.good { background: var(--good-bg); color: var(--good-fg); }
.notice-icon.warn { background: var(--warn-bg); color: var(--warn-fg); }
.notice-icon.muted { background: #ECEEF2; color: var(--text-2); }
.notice-icon.info { background: var(--tag-bg); color: var(--primary); }

/* ---- receipt */
.receipt { max-width: 620px; margin: 10px auto; padding: 30px 32px; }
.receipt-head { text-align: center; }
.receipt-head h1 { font-size: 22px; margin: 14px 0 6px; }
.receipt-amount { text-align: center; font-size: 36px; font-weight: 700; color: var(--primary); margin: 18px 0 20px; }
.receipt-facts { border-top: 1px solid var(--border); padding-top: 18px; grid-template-columns: 130px 1fr; }
.receipt-actions { text-align: center; margin-top: 24px; }

.footer { text-align: center; color: var(--text-2); font-size: 13px; padding: 18px 24px 26px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-muted { font-size: 12px; margin-top: 4px; }

/* ---- phones and small tablets */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .col-side { position: static; }
}
@media (max-width: 560px) {
    .page { padding: 18px 16px 28px; }
    .brandbar-inner { padding: 10px 12px; }
    .brand-title { font-size: 15px; }
    .secure-chip { padding: 4px 9px; font-size: 11.5px; }
    h1 { font-size: 22px; }
    .head-amount { text-align: left; }
    .card { padding: 16px; }
    .pad { padding: 14px 16px; }
    .facts { grid-template-columns: 100px 1fr; }
    .row-2 { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .wire-card { flex-direction: column; align-items: stretch; }
    .receipt { padding: 22px 18px; }
    /* the invoice table fits a phone without sideways scrolling: the invoice date gives way (the due date stays) */
    .grid .col-date, .grid .col-total { display: none; }
    .grid th, .grid td { padding-left: 10px; padding-right: 10px; }
    .grid .tag { padding: 3px 9px; }
    /* every table fits inside its card: words wrap onto a second line, while amounts and dates (and invoice numbers) stay whole */
    .grid th, .grid td { white-space: normal; }
    .grid .num, .grid .nowrap, .grid .tag { white-space: nowrap; }
    .grid .pill { white-space: normal; }
    .grid tfoot td:last-child { font-size: 15px; }
}
@media (max-width: 380px) {
    /* the smallest phones (320-380 px wide): a little less room around each cell and slightly smaller table text */
    .grid { font-size: 13px; }
    .grid th, .grid td { padding-left: 7px; padding-right: 7px; }
    .grid tfoot td:last-child { font-size: 14px; }
    .grid .tag { padding: 2px 7px; font-size: 12px; }
    .grid .pill { padding: 2px 8px 2px 7px; font-size: 12px; }
    /* a column that folds into the one before it (shown under it as a small second line) */
    .grid .col-fold { display: none; }
    .grid .fold-under { display: block; }
    /* the company name in the header stays whole: a little smaller, with the logo */
    .brand { gap: 9px; }
    .brand img { width: 36px; }
    .brand-title { font-size: 14px; }
    .brand-sub { font-size: 11.5px; }
}
@media (max-width: 420px) {
    .secure-chip { padding: 6px; }
    .chip-text { display: none; }
}

@media print {
    .brandbar, .footer, .no-print { display: none; }
    body { background: #fff; }
    .card { border: 0; box-shadow: none; }
}

/* ================= Request a quote (/request) ================= */
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 12px; margin-right: 8px; letter-spacing: 0; }
.req { color: var(--bad-fg); }
.block { display: block; }
.tight { margin: -4px 0 12px; }
.sub { font-size: 14px; font-weight: 700; margin: 6px 0 10px; color: var(--text); }
.sub.spaced { margin-top: 24px; }
.alert-sub { font-weight: 400; margin-top: 4px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.website-box { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* quote or bid: two big tiles */
.choices { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.choice { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px 14px 46px; border: 2px solid var(--border); border-radius: var(--radius-card); cursor: pointer; background: var(--surface); transition: border-color .12s, background .12s; }
.choice:hover { border-color: #C9D1DC; }
.choice.on { border-color: var(--accent); background: var(--tag-bg); }
.choice input { position: absolute; left: 16px; top: 17px; width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.choice:focus-within { box-shadow: 0 0 0 3px rgba(55,138,221,.25); }
.choice-title { font-weight: 700; font-size: 16px; color: var(--primary); }
.choice-text { color: var(--text-2); font-size: 13.5px; }

/* typed items */
.items { display: flex; flex-direction: column; gap: 10px; }
.item { border: 1px solid var(--border); border-radius: var(--radius-btn); padding: 10px 12px 8px; background: var(--row-alt); }
.item.has-error { border-color: var(--bad-fg); background: var(--bad-bg); }
.item-main { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.3fr) minmax(0, .8fr) minmax(0, .9fr) 36px; gap: 10px; align-items: end; }
.item .field { margin-bottom: 8px; }
.item .n { display: inline-block; min-width: 18px; color: var(--primary); }
.item .f-note { margin: 0 0 8px; }
.item .note-toggle { font-size: 12.5px; margin: 0 0 4px; }
.item .field-error { display: block; margin-bottom: 4px; }
.icon-btn { width: 34px; height: 34px; border-radius: var(--radius-btn); border: 1px solid transparent; background: transparent; color: var(--text-2); font-size: 22px; line-height: 1; cursor: pointer; margin-bottom: 8px; }
.icon-btn:hover { background: var(--bad-bg); color: var(--bad-fg); }
.item-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-outline { height: 40px; }
.paste { margin-top: 14px; padding: 14px; border: 1px dashed #C9D1DC; border-radius: var(--radius-btn); background: var(--row-alt); }
.paste textarea { width: 100%; border: 1px solid #C9D1DC; border-radius: var(--radius-btn); padding: 8px 11px; font: inherit; resize: vertical; margin: 6px 0; }
.paste-label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.paste .btn { margin-right: 8px; }

/* documents */
.drop { position: relative; border: 2px dashed #B7C2D0; border-radius: var(--radius-card); padding: 22px 16px; text-align: center; background: var(--row-alt); cursor: pointer; transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--tag-bg); }
.drop.has-error { border-color: var(--bad-fg); }
.drop-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-text strong { color: var(--primary); }
.files { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-btn); background: var(--surface); }
.files .file-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.files .icon-btn { margin: 0; width: 30px; height: 30px; }
.files.plain li { padding: 8px 12px; }

.check { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--primary); flex: none; }

.submit-card { text-align: center; }
.submit-card .btn-block { margin-top: 0; }
.error-summary { color: var(--bad-fg); font-weight: 700; margin: 10px 0 0; }

/* confirmation */
.sent { text-align: center; padding: 28px 24px; margin-bottom: 20px; }
.sent h1 { font-size: 22px; margin: 14px 0 8px; }
.sent-ref { margin: 0 0 10px; }
.sent .tag { font-size: 16px; padding: 5px 16px; }
.message { background: var(--tag-bg); border: 1px solid #C7DBF2; border-radius: var(--radius-btn); padding: 12px 14px; margin-top: 12px; }
.message p { margin: 4px 0 0; white-space: pre-line; }
.caption { display: block; font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .3px; }
.note-text { margin: 14px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.grid td.wrap { white-space: normal; min-width: 180px; overflow-wrap: anywhere; }
.fold-note { display: block; color: var(--text-2); font-size: 12.5px; }

/* the item rows follow the width of their own card, not the window, so they stay readable beside the side panel */
.items { container-type: inline-size; }
@container (max-width: 600px) {
    .item-main { grid-template-columns: minmax(0, 1.5fr) minmax(0, .9fr) minmax(0, 1fr) 36px; gap: 8px; }
    .item-main .f-desc { grid-column: 1 / -1; }
}
@container (max-width: 380px) {
    .item-main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; }
    .item-main .f-part { grid-column: 1 / 3; }
    .item-main .f-qty { grid-column: 1; }
    .item-main .f-unit { grid-column: 2; }
    .item-main .remove { grid-column: 3; grid-row: 3; }
}
@media (max-width: 560px) {
    .choices { grid-template-columns: minmax(0, 1fr); }
    .grid .col-fold { display: none; }
    .grid .fold-under { display: block; }
}
