/* TAG Management Systems: the landing page with the sign-in card, the systems home, the account pages,
 * and the "signed in as" strip that base.html shows above every page of the Reserve Fund Works System
 * while someone is signed in. Loaded after app.css; no external resources.
 *
 * The colours are TAG's logo colours (the same six as the --tag-* properties of app.css). Gold and lime
 * are too light to be read on white: they are fills, rules and markers, or text on the dark green only.
 * The logo has a white background and black lettering, so it always sits on the white header bar,
 * with clear space around it, never recoloured, cropped or stretched.
 * tests/test_auth.py computes the contrast of every text / background pair listed there.
 */

:root {
  --au-green: #004925;
  --au-green-2: #0a5530;          /* the far end of the green bands' gradient */
  --au-green-mid: #366D32;
  --au-lime: #ABD041;
  --au-gold: #DEB509;
  --au-black: #231F20;
  --au-white: #FFFFFF;

  --au-bg: #f4f6f1;
  --au-surface: #FFFFFF;
  --au-ink: #231F20;
  --au-ink-2: #454d47;
  --au-muted: #5c655d;
  --au-line: #dfe4da;
  --au-field: #737c71;            /* input borders: 3:1 or more against white */
  --au-on-green: #FFFFFF;
  --au-on-green-2: #dde9d8;       /* secondary text on the green bands */
  --au-on-green-label: var(--au-lime);
  --au-on-green-card: #165e3a;    /* the system card (5 % white) over the lighter end of the band: its text is checked on this */
  --au-foot-bg: var(--au-black);
  --au-foot-ink: #cfd4cc;
  --au-error: #b3261e;
  --au-error-bg: #fdeceb;
  --au-setup-bg: #fffbef;
  --au-code-bg: var(--au-black);
  --au-code-ink: #f4f6f1;
}

/* ---------------------------------------------------------------- the page frame */

body.portal { min-height: 100vh; display: flex; flex-direction: column; background: var(--au-bg); color: var(--au-ink); }
.portal-main { flex: 1 0 auto; display: flex; flex-direction: column; }
.portal-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding-left: 28px; padding-right: 28px; }

.portal-bar { background: var(--au-white); border-bottom: 4px solid var(--au-gold); }
.portal-bar-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; min-height: 76px; padding-top: 10px; padding-bottom: 10px; }
.portal-logo { display: block; flex: none; padding: 4px 0; }
.portal-logo img { display: block; height: 52px; width: auto; }
.portal-name { color: var(--au-green); font-weight: 700; font-size: 1.14rem; letter-spacing: 0.01em; padding-left: 20px;
  border-left: 1px solid var(--au-line); line-height: 1.2; }
.portal-user { margin-left: auto; display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; color: var(--au-ink-2); font-size: 0.93rem; }
.portal-user strong { color: var(--au-ink); }
.portal-user form { margin: 0; }
.portal-landing .portal-logo img { height: 74px; }
.portal-landing .portal-bar-inner { min-height: 96px; }

.portal-foot { background: var(--au-foot-bg); color: var(--au-foot-ink); border-top: 4px solid var(--au-green-mid); font-size: 0.93rem; }
.portal-foot-inner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; padding-top: 18px; padding-bottom: 20px; }
.portal-foot p { margin: 0; }
.portal-foot strong { color: var(--au-white); font-weight: 650; }
.portal-foot-contact span + span::before { content: "\00b7"; margin: 0 8px; }
.portal-foot-note { flex-basis: 100%; font-size: 0.86rem; }

.portal :focus-visible { outline: 2px solid var(--au-green); outline-offset: 2px; }
.landing-hero :focus-visible, .portal-band :focus-visible { outline-color: var(--au-gold); }
.signin-card :focus-visible { outline-color: var(--au-green); }

/* ---------------------------------------------------------------- forms (portal pages) */

.portal input[type="text"], .portal input[type="password"] {
  display: block; width: 100%; max-width: 440px; font: inherit; font-size: 16px; color: var(--au-ink); background: var(--au-surface);
  border: 1px solid var(--au-field); border-radius: 6px; padding: 10px 12px; min-height: 46px;
}
.portal input[type="text"]:focus, .portal input[type="password"]:focus { border-color: var(--au-green); }
.portal input[aria-invalid="true"] { border-color: var(--au-error); }
.portal-field { display: grid; gap: 5px; margin-top: 16px; }
.portal-field > label, .portal-field > legend { font-size: 0.95rem; font-weight: 600; color: var(--au-ink); padding: 0; }
.portal-field .hint { margin-top: 0; }
fieldset.portal-field { border: 0; margin-left: 0; margin-right: 0; padding: 0; min-width: 0; }
.portal-choice { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.portal-choice label { font-size: 0.95rem; color: var(--au-ink); display: inline-flex; align-items: center; gap: 4px; }
.portal-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 22px; }
.portal .btn.big, .portal button.big { min-height: 44px; padding: 8px 18px; font-size: 1rem; border-radius: 6px; }
.portal-errors { border: 1px solid #f0c4c0; border-left: 4px solid var(--au-error); background: var(--au-error-bg); color: var(--au-ink);
  border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; }
.portal-errors strong { color: var(--au-error); }
.portal-errors ul { margin: 4px 0 0; padding-left: 18px; }
.portal-rules { margin: 6px 0 0; padding-left: 18px; color: var(--au-ink-2); font-size: 0.93rem; }

/* ---------------------------------------------------------------- the landing page */

.landing-hero, .portal-band {
  position: relative; overflow: hidden; color: var(--au-on-green);
  background: linear-gradient(155deg, var(--au-green) 0%, var(--au-green) 48%, var(--au-green-2) 100%);
}
/* the swoosh of the logo, as a thin gold arc and a faint lime glow (decoration only; no text sits on anything lighter
   than --au-green-2). The shorter bands of the other pages keep only the glow: an arc would cross their text. */
.landing-hero::before {
  content: ""; position: absolute; left: -15%; right: -15%; top: 80%; height: 140%; border-radius: 50%;
  border-top: 2px solid rgba(222, 181, 9, 0.55); pointer-events: none;
}
.landing-hero::after, .portal-band::before {
  content: ""; position: absolute; right: -180px; top: -220px; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(171, 208, 65, 0.08), rgba(171, 208, 65, 0)); pointer-events: none;
}
.landing-hero { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; }      /* the content sits in the middle of the band */
.landing-grid {
  position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 410px);
  grid-template-areas: "intro card" "systems card"; grid-template-rows: auto 1fr; gap: 30px 72px;
  padding-top: 64px; padding-bottom: 72px; align-items: start;
}
.landing-intro { grid-area: intro; }
.landing-systems { grid-area: systems; }
.signin-card { grid-area: card; }

.landing-eyebrow { display: flex; align-items: center; gap: 12px; color: var(--au-on-green-label); text-transform: uppercase;
  letter-spacing: 0.16em; font-size: 0.86rem; font-weight: 700; margin-bottom: 14px; }
.landing-eyebrow::before { content: ""; width: 34px; height: 3px; background: var(--au-gold); border-radius: 2px; flex: none; }
.landing-intro h1 { font-size: 3rem; line-height: 1.08; font-weight: 750; letter-spacing: -0.02em; color: var(--au-on-green); text-wrap: balance; }
.landing-lead { margin-top: 16px; font-size: 1.25rem; line-height: 1.45; color: var(--au-on-green-2); max-width: 36ch; }

.landing-label { color: var(--au-on-green-label); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.8rem; font-weight: 700; margin-bottom: 10px; }
.system-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 580px; }
.system-item { display: flex; gap: 14px; align-items: center; padding: 15px 18px 16px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.16); border-left: 4px solid var(--au-gold); }
.system-item h3 { color: var(--au-on-green); font-size: 1.1rem; font-weight: 650; }
.system-item p { color: var(--au-on-green-2); margin-top: 3px; font-size: 0.97rem; line-height: 1.45; }
.landing-note { margin-top: 14px; color: var(--au-on-green-2); font-size: 0.93rem; max-width: 60ch; }

.system-icon { flex: none; display: block; width: 40px; height: 40px; }
.system-icon .bg { fill: var(--au-green); }
.system-icon .bar-a { fill: var(--au-lime); }
.system-icon .bar-b { fill: var(--au-gold); }
.landing-hero .system-icon .bg { fill: rgba(255, 255, 255, 0.1); }

.signin-card { background: var(--au-surface); color: var(--au-ink); border-radius: 10px; border-top: 5px solid var(--au-gold);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.30), 0 2px 6px rgba(0, 0, 0, 0.12); padding: 28px 30px 26px; }
.signin-card h2 { font-size: 1.5rem; font-weight: 700; color: var(--au-green); }
.signin-sub { margin-top: 4px; color: var(--au-ink-2); font-size: 0.97rem; }
.signin-form input[type="text"], .signin-form input[type="password"] { max-width: none; }
.signin-button { width: 100%; justify-content: center; margin-top: 22px; min-height: 48px; font-size: 1.1rem; font-weight: 650;
  background: var(--au-green); border: 1px solid var(--au-green); color: var(--au-white); border-radius: 6px; }
.signin-button:hover { background: var(--au-green-mid); border-color: var(--au-green-mid); color: var(--au-white); }
.signin-help { margin-top: 16px; color: var(--au-ink-2); font-size: 0.95rem; }
.signin-help + .signin-help { margin-top: 6px; color: var(--au-muted); font-size: 0.9rem; }
.signin-error { margin-top: 16px; border: 1px solid #f0c4c0; border-left: 4px solid var(--au-error); background: var(--au-error-bg);
  color: var(--au-ink); border-radius: 6px; padding: 10px 12px; font-weight: 600; }
.signin-flash { margin-top: 14px; border: 1px solid var(--au-line); border-left: 4px solid var(--au-green-mid); background: var(--au-bg);
  color: var(--au-ink); border-radius: 6px; padding: 9px 12px; }
.signin-setup { margin-top: 14px; border: 1px solid var(--au-line); border-left: 4px solid var(--au-gold); background: var(--au-setup-bg);
  color: var(--au-ink-2); border-radius: 6px; padding: 12px 14px; font-size: 0.95rem; }
.signin-setup p + p, .signin-setup pre + p { margin-top: 8px; }
.signin-setup strong { color: var(--au-ink); }
.signin-command { margin: 10px 0 0; background: var(--au-code-bg); color: var(--au-code-ink); border-radius: 6px; padding: 10px 12px;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace; font-size: 0.88rem; white-space: pre-wrap; word-break: break-word; }

/* ---------------------------------------------------------------- the systems home and the account pages */

.portal-band { padding: 34px 0 32px; }
.portal-band .portal-wrap { position: relative; z-index: 1; }
.portal-band h1 { font-size: 2.15rem; line-height: 1.15; font-weight: 750; letter-spacing: -0.015em; color: var(--au-on-green); }
.portal-band-lead { margin-top: 6px; font-size: 1.14rem; color: var(--au-on-green-2); max-width: 70ch; }
.portal-crumbs { font-size: 0.93rem; color: var(--au-on-green-2); margin-bottom: 4px; }
.portal-crumbs a { color: var(--au-on-green); text-decoration: underline; text-underline-offset: 2px; }
.portal-crumbs a:hover { color: var(--au-on-green); text-decoration-thickness: 2px; }

.portal-body { padding-top: 26px; padding-bottom: 44px; }
.portal-body a:not(.btn) { text-decoration: underline; text-decoration-color: rgba(54, 109, 50, 0.45); text-underline-offset: 2px; }
.portal-body a:not(.btn):hover { text-decoration-color: currentColor; }
.portal-section { font-size: 1.2rem; font-weight: 700; color: var(--au-green); margin: 0 0 12px; }
.portal-section + .hint { margin: -8px 0 12px; }
.portal-body .flashes { max-width: 900px; }

.system-tiles { list-style: none; margin: 0 0 30px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.system-tile { position: relative; display: flex; flex-direction: column; gap: 10px; background: var(--au-surface); border: 1px solid var(--au-line);
  border-top: 4px solid var(--au-gold); border-radius: 8px; padding: 20px 20px 18px; box-shadow: 0 1px 2px rgba(35, 31, 32, 0.06);
  transition: box-shadow 0.15s ease, border-color 0.15s ease; }
.system-tile:hover { box-shadow: 0 8px 22px rgba(35, 31, 32, 0.12); border-color: var(--au-green-mid); border-top-color: var(--au-gold); }
.system-tile:focus-within { outline: 2px solid var(--au-green); outline-offset: 2px; }
.system-tile h3 { font-size: 1.2rem; font-weight: 700; }
.portal-body .system-tile h3 a { color: var(--au-green); text-decoration: none; }
.system-tile h3 a::after { content: ""; position: absolute; inset: 0; border-radius: 8px; }     /* the whole tile opens the system */
.system-tile h3 a:focus-visible { outline: none; }
.system-tile p { color: var(--au-ink-2); line-height: 1.45; }
.system-open { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; background: var(--au-green);
  color: var(--au-white); font-weight: 650; border-radius: 6px; padding: 8px 16px; }
.system-tile:hover .system-open { background: var(--au-green-mid); }
.system-tile-head { display: flex; align-items: center; gap: 12px; }

.portal-card { background: var(--au-surface); border: 1px solid var(--au-line); border-radius: 8px; padding: 20px 22px 22px; max-width: 900px; }
.portal-card.narrow { max-width: 620px; }
.portal-card > h2 { font-size: 1.15rem; font-weight: 700; color: var(--au-green); }
.portal-card > .sub { color: var(--au-muted); margin-top: 3px; }
.account-links { list-style: none; margin: 0; padding: 0; }
.account-links li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; padding: 11px 0; border-top: 1px solid var(--au-line); }
.account-links li:first-child { border-top: 0; padding-top: 2px; }
.account-links li > a, .account-links li > form button.link { font-weight: 650; font-size: 1rem; min-width: 190px; }
.account-links li > span { color: var(--au-ink-2); }
.account-links form { margin: 0; }

.portal-table { max-width: 100%; }
.portal-table table.data th, .portal-table table.data td { vertical-align: middle; }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.user-actions form { margin: 0; }
.portal .note { max-width: 900px; }

/* ---------------------------------------------------------------- the strip above every page of a system (base.html) */

.account-strip { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 4px 16px; padding: 8px 0 7px;
  border-bottom: 1px solid var(--au-line); font-size: 0.9rem; color: var(--au-ink-2); }
.account-strip strong { color: var(--au-ink); font-weight: 650; }
.account-strip .account-home { font-weight: 650; }
.account-strip form { margin: 0; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 900px) {
  .landing-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "card" "systems"; grid-template-rows: none;
    gap: 26px; padding-top: 34px; padding-bottom: 44px; }
  .landing-intro h1 { font-size: 2.3rem; }
  .landing-lead { font-size: 1.12rem; }
  .signin-card { max-width: 520px; width: 100%; }
}
@media (max-width: 640px) {
  .portal-wrap { padding-left: 16px; padding-right: 16px; }
  .portal-bar-inner { min-height: 64px; gap: 8px 14px; }
  .portal-logo img, .portal-landing .portal-logo img { height: 50px; }
  .portal-landing .portal-bar-inner { min-height: 70px; }
  .portal-name { font-size: 1rem; padding-left: 14px; }
  .portal-user { margin-left: 0; width: 100%; justify-content: space-between; }
  .landing-intro h1 { font-size: 2rem; }
  .landing-hero::before { display: none; }                             /* on a phone the arc would only cross the text */
  .signin-card { padding: 22px 18px 20px; }
  .portal-band { padding: 24px 0 22px; }
  .portal-band h1 { font-size: 1.75rem; }
  .portal-card { padding: 16px 16px 18px; }
  .account-links li > a { min-width: 0; }
}
@media (max-width: 420px) {
  .portal-landing .portal-name { display: none; }                      /* the logo says it; the page's heading too */
}

/* ---------------------------------------------------------------- print: the strip and the portal chrome stay off the paper */

@media print {
  .account-strip, .portal-user, .signin-card form { display: none !important; }
  body.portal { background: #fff; }
  .landing-hero, .portal-band { background: #fff; color: #000; }
  .landing-hero::before, .landing-hero::after, .portal-band::before { display: none; }
}
