/*
 * Bid Manager design system, part 1: tokens, base, layout, the app header and footer, buttons and form controls.
 * Shared by the landing page, the customer pages and the admin pages (served from <base>/shared/). Part 2 is
 * components.css. Nothing here loads from another origin: the CSP allows this origin only, so the logo and the icons
 * are files of this service and the font is the system one. Colours are tokens; a theme is a block of tokens.
 */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* himalay.io brand */
  --navy-900: #0f1b2d;
  --navy-800: #162238;
  --navy-700: #1d2e4a;
  --navy-600: #24395c;
  --navy-300: #7a9bc4;
  --navy-200: #b0c8e4;
  --navy-100: #dce8f5;
  --navy-50: #f0f5fb;
  --blue-700: #1262b0;
  --blue-600: #1a7ae0;
  --blue-500: #4d9fff;
  --blue-400: #75b7fa;

  /* spacing scale */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s5: 1.5rem;
  --s6: 2rem;
  --s7: 3rem;
  --s8: 4.5rem;

  /* type scale */
  --fs-xs: 0.8125rem;
  --fs-sm: 0.9rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: clamp(2rem, 4.4vw + 0.8rem, 3.1rem);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  /* light theme (the default) */
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef3f9;
  --text: #0f1b2d;
  --text-2: #435068;
  --line: #dde5ef;
  --line-strong: #b9c6d8;
  --accent: #1262b0;
  --accent-hover: #0f5398;
  --on-accent: #ffffff;
  --link: #1262b0;
  --focus: #1a7ae0;
  --header-bg: #0f1b2d;
  --header-text: #ffffff;
  --header-text-2: #b0c8e4;
  --shadow: 0 1px 2px rgba(15, 27, 45, 0.06), 0 4px 16px rgba(15, 27, 45, 0.05);
  --shadow-lg: 0 12px 40px rgba(15, 27, 45, 0.18);
  --ok-bg: #e7f6ec; --ok-fg: #14602f; --ok-line: #a6d9b8;
  --warn-bg: #fdf3d9; --warn-fg: #7a3d05; --warn-line: #ecc766;
  --bad-bg: #fdeaea; --bad-fg: #a31b1b; --bad-line: #f1b0b0;
  --info-bg: #e6f0fc; --info-fg: #164c8c; --info-line: #a9c8ef;
  --neutral-bg: #eef2f7; --neutral-fg: #3a475c; --neutral-line: #d3dbe6;
  --mark: #fde68a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1424;
    --surface: #131f33;
    --surface-2: #17253c;
    --surface-3: #1d2e4a;
    --text: #e8eff8;
    --text-2: #aebfd6;
    --line: #26384f;
    --line-strong: #3a5070;
    --accent: #4d9fff;
    --accent-hover: #75b7fa;
    --on-accent: #0f1b2d;
    --link: #75b7fa;
    --focus: #75b7fa;
    --header-bg: #0a1220;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --ok-bg: #11301f; --ok-fg: #8fe0ad; --ok-line: #23603b;
    --warn-bg: #36280b; --warn-fg: #f6cf7b; --warn-line: #7c5a14;
    --bad-bg: #3a1618; --bad-fg: #ffb3b3; --bad-line: #7d2a2e;
    --info-bg: #13294a; --info-fg: #a5d1fd; --info-line: #2a4f84;
    --neutral-bg: #1d2b42; --neutral-fg: #c3d1e4; --neutral-line: #2f425f;
    --mark: #6b5a12;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  overflow-wrap: anywhere;
}
#app { display: flex; flex-direction: column; min-height: 100vh; }
.app-main { flex: 1; padding: var(--s6) 0 var(--s7); outline: none; }
img, svg { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-base); }
p { margin: 0 0 var(--s3); }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
ul, ol { margin: 0; padding-left: 1.25rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s5) 0; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---- layout ---- */
.container { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 var(--s4); }
.container.narrow { max-width: 44rem; }
.container.wide { max-width: 84rem; }
.stack > * + * { margin-top: var(--s4); }
.stack-lg > * + * { margin-top: var(--s5); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: var(--s4); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.nowrap { white-space: nowrap; }
.skip-link { position: absolute; left: var(--s3); top: -4rem; z-index: 100; background: var(--surface); color: var(--text); padding: var(--s2) var(--s4); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.skip-link:focus { top: var(--s3); }

/* ---- app header and footer ---- */
.app-header { background: var(--header-bg); color: var(--header-text); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); min-height: 3.75rem; padding-top: var(--s2); padding-bottom: var(--s2); }
.brand { display: inline-flex; align-items: center; gap: var(--s3); color: var(--header-text); text-decoration: none; min-width: 0; }
.brand-logo { display: inline-block; width: 8.6rem; height: 1.45rem; flex: none; background: url(brand/logo-2.svg) left center / contain no-repeat; }
.brand-name { font-weight: 600; font-size: var(--fs-base); padding-left: var(--s3); border-left: 1px solid rgba(255, 255, 255, 0.28); white-space: nowrap; }
.account { display: flex; align-items: center; gap: var(--s3); color: var(--header-text-2); font-size: var(--fs-sm); min-width: 0; }
.account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem; }
.app-header :focus-visible { outline-color: var(--blue-400); }
.app-footer { border-top: 1px solid var(--line); padding: var(--s4) 0; color: var(--text-2); font-size: var(--fs-xs); background: var(--surface); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2) var(--s4); align-items: center; }
.footer-logo { display: inline-block; width: 6rem; height: 1rem; vertical-align: middle; background: url(brand/logo-2-dark.svg) left center / contain no-repeat; margin-right: var(--s2); }
@media (prefers-color-scheme: dark) { .footer-logo { background-image: url(brand/logo-2.svg); } }
@media (max-width: 560px) {
  .brand-logo { width: 6.6rem; }
  .brand-name { padding-left: var(--s2); font-size: var(--fs-sm); }
  .account-email { display: none; }
  .app-main { padding-top: var(--s5); }
}

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  font: inherit; font-weight: 600; font-size: var(--fs-sm); line-height: 1.2;
  min-height: 2.5rem; padding: 0.55rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not([disabled]) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.btn-secondary:hover:not([disabled]) { background: var(--surface-3); }
.btn-danger { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
.btn-danger:hover:not([disabled]) { background: var(--bad-fg); color: var(--bad-bg); }
.btn-ghost { background: transparent; color: var(--link); padding-left: var(--s2); padding-right: var(--s2); }
.btn-ghost:hover:not([disabled]) { background: var(--surface-3); }
.app-header .btn-ghost { color: var(--header-text); border-color: rgba(255, 255, 255, 0.28); }
.app-header .btn-ghost:hover:not([disabled]) { background: rgba(255, 255, 255, 0.1); }
.btn-lg { min-height: 3rem; padding: 0.7rem 1.5rem; font-size: var(--fs-base); }
.btn-sm { min-height: 2rem; padding: 0.3rem 0.7rem; font-size: var(--fs-xs); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn.is-busy { position: relative; color: transparent; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--on-accent); border-right-color: transparent; animation: spin 0.7s linear infinite; }

/* ---- form controls: every control has a visible label ---- */
.field { display: block; margin: 0 0 var(--s4); }
.field-label { display: block; font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--s1); }
.hint { display: block; color: var(--text-2); font-size: var(--fs-xs); margin-top: var(--s1); }
.input, .select, .textarea {
  display: block; width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0.6rem 0.75rem; min-height: 2.6rem;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-2); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.textarea { min-height: 5rem; resize: vertical; }
.input.sm, .select.sm { min-height: 2.2rem; padding: 0.35rem 0.6rem; font-size: var(--fs-sm); }
.check { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin: 0 0 var(--s2); cursor: pointer; }
.check:hover { border-color: var(--line-strong); }
.check input { width: 1.15rem; height: 1.15rem; margin: 0.15rem 0 0; flex: none; accent-color: var(--accent); }
.check span { min-width: 0; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s4); min-width: 0; }
legend { padding: 0; font-weight: 600; font-size: var(--fs-sm); margin-bottom: var(--s2); }

@keyframes spin { to { transform: rotate(360deg); } }
