/* 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; }
.brandbar-inner { max-width: 1140px; margin: 0 auto; padding: 12px 24px; 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); }

/* ---- 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; }

.note p { margin: 0; white-space: pre-line; }

/* ---- 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, .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 input:focus, .field select: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; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.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; }
.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 16px; }
    .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: 1fr; gap: 0; }
    .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; }
}
@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; }
}
