/* Customer portal styles. Colors and fonts come from /static/brand.css (CSS variables). */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgb(25 48 67 / .06);
  --shadow: 0 1px 2px rgb(25 48 67 / .05), 0 4px 16px rgb(25 48 67 / .06);
  --shadow-lg: 0 2px 4px rgb(25 48 67 / .04), 0 16px 40px rgb(25 48 67 / .10);
  --tint: color-mix(in srgb, var(--brand-primary) 6%, var(--color-surface));
  color-scheme: light;
}
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-family: var(--font-family);
  color: var(--color-text); background: var(--color-bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--brand-primary); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--brand-accent); }
:focus-visible { outline: 3px solid var(--brand-copper); outline-offset: 2px; border-radius: 3px; }
.wrap { width: 100%; max-width: 68rem; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--color-surface); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; top: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted, .help { color: var(--color-muted); }
.help { font-size: .875rem; margin: .35rem 0 0; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 5; background: rgb(255 255 255 / .92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--color-border); }
.topbar::before { content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--brand-primary) 0 70%, var(--brand-copper) 70% 100%); }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; min-height: 4rem; padding-top: .5rem; padding-bottom: .5rem; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--color-text); text-decoration: none; margin-right: auto; }
.brand:hover { color: var(--color-text); }
.brand img { display: block; }
.wordmark { font-size: 1.4rem; font-weight: 700; letter-spacing: -.045em; line-height: 1; }
.wordmark span { color: var(--brand-copper); }
.nav { display: flex; flex-wrap: wrap; gap: .25rem; list-style: none; margin: 0; padding: 0; align-items: center; }
.nav a, .nav .linklike { display: inline-block; padding: .45rem .75rem; border-radius: var(--radius-sm); color: var(--color-text);
  text-decoration: none; font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav .linklike:hover { background: var(--tint); color: var(--brand-primary); }
.nav a[aria-current=page] { background: var(--tint); color: var(--brand-primary); box-shadow: inset 0 -2px 0 var(--brand-copper); }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.btn-sm { padding: .5rem .9rem; font-size: .9rem; }
/* Language switcher: same look as the corporate site (site/src/components/LangSwitcher.astro) */
.lang-switcher { position: relative; }
.lang-switcher summary { cursor: pointer; list-style: none; padding: .45rem .75rem; border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); font-weight: 600; }
.lang-switcher summary::-webkit-details-marker { display: none; }
.lang-switcher summary::after { content: ' ▾'; }
.lang-switcher ul { position: absolute; right: 0; z-index: 10; min-width: 10rem; margin: .25rem 0 0; padding: .25rem 0; list-style: none;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.lang-switcher a, .lang-switcher button { display: block; width: 100%; padding: .4rem 1rem; background: none; border: 0; font: inherit;
  text-align: left; color: var(--color-text); text-decoration: none; cursor: pointer; }
.lang-switcher a:hover, .lang-switcher a:focus-visible, .lang-switcher button:hover, .lang-switcher button:focus-visible { background: var(--tint); color: var(--color-text); }
.lang-switcher a[aria-current=true] { font-weight: 700; }
.inline { display: inline; margin: 0; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-primary); text-decoration: underline; cursor: pointer; }
.nav .linklike { text-decoration: none; cursor: pointer; }

/* Page */
main.wrap { flex: 1; padding-top: 2.5rem; padding-bottom: 3rem; }
main:focus { outline: none; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); margin: 0 0 .35rem; }
h2 { font-size: 1.15rem; margin: 0 0 1rem; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.card > h2:first-child::before, .card > header > h2::before { content: ""; width: 4px; height: 1.1em; border-radius: 2px; background: var(--brand-copper); }
.lead { font-size: 1.05rem; color: var(--color-muted); margin-top: 0; }
main > .muted:first-of-type { margin: 0 0 1.75rem; }
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem;
  margin: 0 0 1.25rem; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card.narrow { max-width: 34rem; margin-left: auto; margin-right: auto; }
.grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); margin-bottom: 1.25rem; }
.grid .card { margin: 0; }
.card ul, .card ol { padding-left: 1.25rem; }
.card li { margin: .3rem 0; }

/* Access pages (signup, login, email links): centered card on a branded backdrop */
body:has(.access-logo), body:has(main > .card.narrow:only-child) {
  background: radial-gradient(60rem 30rem at 50% -8rem, color-mix(in srgb, var(--brand-primary) 9%, transparent), transparent 70%),
    radial-gradient(30rem 20rem at 85% 110%, color-mix(in srgb, var(--brand-copper) 8%, transparent), transparent 70%), var(--color-bg); }
.access-logo { max-width: 34rem; margin: 1rem auto 1.75rem; }
.access-logo img { display: block; width: min(100%, 22rem); height: auto; margin: 0 auto; }
@media (max-width: 29rem) { .access-logo { display: none; } }
.card.narrow { box-shadow: var(--shadow-lg); padding: 2rem; }
.card.narrow h1 { margin-bottom: .5rem; }
.card.narrow .btn-primary { width: 100%; padding: .75rem 1rem; }
.card.narrow > p:last-child:not(.help) { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--color-border);
  text-align: center; }

/* Forms */
.field { margin: 0 0 1.15rem; border: 0; padding: 0; min-width: 0; }
legend, label { font-weight: 600; font-size: .925rem; display: block; margin-bottom: .35rem; }
label.choice { font-weight: normal; font-size: 1rem; display: flex; gap: .65rem; align-items: flex-start; margin: .5rem 0; padding: .75rem .9rem;
  border: 1px solid var(--color-border); border-radius: var(--radius-sm); cursor: pointer; transition: border-color .15s, background .15s; }
label.choice:hover { border-color: var(--brand-primary); }
label.choice:has(input:checked) { border-color: var(--brand-primary); background: var(--tint); box-shadow: 0 0 0 1px var(--brand-primary); }
label.choice input { margin-top: .3rem; accent-color: var(--brand-primary); }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=password], input[type=date], textarea, select {
  width: 100%; padding: .65rem .8rem; font: inherit; color: var(--color-text); background: #fff;
  border: 1px solid color-mix(in srgb, var(--color-border) 70%, var(--color-muted)); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
input:hover:not([readonly]) { border-color: var(--color-muted); }
input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 18%, transparent); }
input:focus-visible { outline: none; }
input[aria-invalid=true] { border-color: var(--color-danger); }
input[readonly] { background: var(--color-bg); box-shadow: none; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
input[type=radio], input[type=checkbox] { accent-color: var(--brand-primary); }
.slug-input { display: flex; align-items: stretch; border: 1px solid color-mix(in srgb, var(--color-border) 70%, var(--color-muted));
  border-radius: var(--radius-sm); background: #fff; box-shadow: var(--shadow-sm); overflow: hidden; }
.slug-input:focus-within { border-color: var(--brand-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 18%, transparent); }
.slug-input input { flex: 1; min-width: 4rem; border: 0; box-shadow: none; border-radius: 0; padding-left: .2rem; padding-right: .2rem; }
.slug-input input:focus { box-shadow: none; }
.prefix, .suffix { display: flex; align-items: center; color: var(--color-muted); white-space: nowrap; background: var(--color-bg); padding: 0 .65rem; font-size: .9rem; }
.prefix { border-right: 1px solid var(--color-border); }
.suffix { border-left: 1px solid var(--color-border); }
.field-error { color: var(--color-danger); font-weight: 600; font-size: .9rem; margin: .35rem 0 0; }
.field-ok { color: var(--color-success); font-weight: 600; font-size: .9rem; margin: .35rem 0 0; }
.field-error::before { content: "⚠ "; }
.field-ok::before { content: "✓ "; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .62rem 1.1rem; font: inherit; font-weight: 600;
  line-height: 1.2; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text); text-decoration: none; box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
form > .btn + .help { margin-top: .6rem; }
form > .help + .btn, form > .help + button { margin-top: 1rem; }

/* Notices */
.notice { padding: .8rem 1rem; border-radius: var(--radius-sm); border: 1px solid; border-left-width: 4px; margin: 0 0 1.25rem; }
.notice p { margin: .2rem 0; }
.notice-warn { border-color: color-mix(in srgb, var(--color-warning) 35%, transparent); border-left-color: var(--color-warning);
  background: color-mix(in srgb, var(--color-warning) 7%, var(--color-surface)); }
.notice-error { border-color: color-mix(in srgb, var(--color-danger) 30%, transparent); border-left-color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 6%, var(--color-surface)); }
.notice-ok { border-color: color-mix(in srgb, var(--color-success) 30%, transparent); border-left-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 6%, var(--color-surface)); }

/* Tenant state */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; padding: .15rem .6rem; border-radius: 999px;
  color: var(--b, var(--brand-primary)); background: color-mix(in srgb, var(--b, var(--brand-primary)) 10%, var(--color-surface));
  border: 1px solid color-mix(in srgb, var(--b, var(--brand-primary)) 25%, transparent); letter-spacing: .01em; }
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge-trial, .badge-creating { --b: var(--brand-primary); }
.badge-active { --b: var(--color-success); }
.badge-past_due, .badge-closing, .badge-suspended { --b: var(--color-warning); }
.badge-error, .badge-deleted { --b: var(--color-danger); }
.badge-creating::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.state { position: relative; overflow: hidden; border-left: 4px solid var(--s, var(--brand-primary)); }
.state-active { --s: var(--color-success); }
.state-past_due, .state-closing, .state-suspended { --s: var(--color-warning); }
.state-error, .state-deleted { --s: var(--color-danger); }
.state > h2::before { display: none; }
.state { background: linear-gradient(90deg, color-mix(in srgb, var(--s, var(--brand-primary)) 4%, var(--color-surface)), var(--color-surface) 60%); }
progress { -webkit-appearance: none; appearance: none; width: 100%; height: .6rem; border: 0; border-radius: 999px; overflow: hidden;
  background: var(--tint); margin: .5rem 0; }
progress::-webkit-progress-bar { background: var(--tint); border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--brand-primary), var(--brand-copper)); border-radius: 999px; transition: width .4s; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--brand-primary), var(--brand-copper)); border-radius: 999px; }

/* Key / value lists */
.facts { display: grid; grid-template-columns: max-content 1fr; margin: 0; }
.facts dt, .facts dd { padding: .6rem 0; border-top: 1px solid var(--color-border); }
.facts dt:first-of-type, .facts dt:first-of-type + dd { border-top: 0; padding-top: 0; }
.facts dt { font-weight: 500; color: var(--color-muted); padding-right: 1.5rem; font-size: .925rem; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd .help { margin-top: .1rem; }
.preview { border-top: 1px solid var(--color-border); margin-top: 1.25rem; padding-top: 1.25rem; }
details.provider-help { margin: 0 0 1rem; padding: .75rem 1rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-bg); }
details.provider-help summary { cursor: pointer; font-weight: 600; }
details.provider-help[open] summary { margin-bottom: .5rem; }

/* Footer */
.footer { border-top: 1px solid var(--color-border); color: var(--color-muted); font-size: .875rem; padding: 1.25rem 0; background: var(--color-surface); }
.footer p { margin: 0; }
.footer a { color: var(--color-muted); }
.footer a:hover { color: var(--brand-primary); }

@media (max-width: 40rem) {
  .facts { grid-template-columns: 1fr; }
  .facts dd { border-top: 0; padding-top: 0; }
  .topbar { position: static; }
  .topbar-inner { gap: .5rem; }
  .topbar nav { order: 3; width: 100%; }
  .lang-switcher ul { left: 0; right: auto; }
  .card, .card.narrow { padding: 1.25rem; }
  main.wrap { padding-top: 1.25rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
