/* Customer portal (/account/). Light and dark follow the device setting. */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --text: #1d2433; --muted: #5b6475; --line: #e1e4ea;
  --accent: #663399; --accent-text: #ffffff; --accent-soft: #f1eaf8; --brand: #663399;
  --ok: #17663a; --ok-soft: #e4f4ea; --warn: #8a5300; --warn-soft: #fdf1dc; --bad: #a3221b; --bad-soft: #fbe7e5;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --surface: #1b2029; --text: #e7eaf0; --muted: #9aa3b2; --line: #2c3340;
    --accent: #c4a3ee; --accent-text: #1a0f29; --accent-soft: #2c2140; --brand: #663399;
    --ok: #6fd39a; --ok-soft: #173023; --warn: #f2b45a; --warn-soft: #34270f; --bad: #f08a82; --bad-soft: #3a1d1b;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 .6rem; }
.card > h2:first-child, .head h2 { margin-top: 0; }
p { margin: 0 0 .75rem; }

.top { background: var(--surface); border-top: 4px solid var(--brand); border-bottom: 1px solid var(--line); }
.bar { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; line-height: 0; }
.brand img { height: 44px; width: auto; max-width: 62vw; }
@media (max-width: 420px) { .brand img { height: 34px; } }
nav.main { max-width: 960px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
nav.main a { padding: 10px 12px; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; }
nav.main a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
nav.main a:hover { color: var(--text); }
.me { position: relative; }
.me summary { cursor: pointer; list-style: none; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me summary::-webkit-details-marker { display: none; }
.me summary::after { content: " ▾"; color: var(--muted); }
.me > div { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 6px; display: grid; }
.me > div a, .me > div button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); text-decoration: none; font: inherit; cursor: pointer; }
.me > div a:hover, .me > div button:hover { background: var(--accent-soft); }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; }
footer { max-width: 960px; margin: 0 auto; padding: 0 16px 32px; color: var(--muted); font-size: .85rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card.narrow { max-width: 560px; }
.signin { margin: 24px auto; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: .5rem; }
.head h1, .head h2 { margin-bottom: .25rem; }
.welcome h1 { font-size: 1.6rem; margin-bottom: .25rem; }
.crumb { margin: 0 0 10px; }
.crumb a { text-decoration: none; }
.meta, .muted { color: var(--muted); }
.meta { font-size: .9rem; display: block; }
.small { font-size: .9rem; }
.center { text-align: center; }
.summary { font-size: 1.05rem; }
.text { white-space: normal; overflow-wrap: anywhere; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.tiles a { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.tiles strong { display: block; font-size: 1.5rem; line-height: 1.2; }
.tiles span { color: var(--muted); font-size: .9rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.list > li > a { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.list > li > a:hover .title { text-decoration: underline; }
.list > li > div:first-child { flex: 1; min-width: 0; }
.title { display: block; font-weight: 600; overflow-wrap: anywhere; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--line); color: var(--text); white-space: nowrap; }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.tabs { display: flex; gap: 6px; margin: 4px 0 8px; flex-wrap: wrap; }
.tabs a { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--muted); }
.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); }

.stages { list-style: none; display: flex; margin: 16px 0; padding: 0; gap: 4px; }
.stages li { flex: 1; text-align: center; font-size: .82rem; color: var(--muted); }
.stages li::before { content: ""; display: block; height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 6px; }
.stages li.done::before { background: var(--ok); }
.stages li.current::before { background: var(--accent); }
.stages li.current { color: var(--text); font-weight: 600; }
.timeline { list-style: none; margin: 0 0 16px; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: 2px 0 12px 14px; margin-left: 4px; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; margin: 0; }
.facts dt { color: var(--muted); font-size: .85rem; }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.table { overflow-x: auto; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
td small { display: block; color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
tfoot th { text-align: right; font-weight: 500; color: var(--muted); }
tfoot .total th, tfoot .total td { font-weight: 700; color: var(--text); font-size: 1.05rem; }

form { margin: 0; }
.stack { display: grid; gap: 14px; }
.stack > button:not(.wide) { justify-self: start; }
.signin form + p, .signin form + .or { margin-top: 14px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row.three { grid-template-columns: 2fr 1fr 1fr; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .92rem; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset.choice { border: 0; padding: 0; margin: 0; display: flex; gap: 18px; flex-wrap: wrap; }
fieldset.choice legend { font-weight: 600; font-size: .92rem; margin-bottom: 4px; padding: 0; }
fieldset.choice label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
fieldset.choice input { width: auto; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
button:hover, .button:hover { border-color: var(--accent); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.microsoft { background: var(--surface); }
button.link { border: 0; padding: 4px 0; background: none; color: var(--accent); font-weight: 500; text-decoration: underline; }
.wide { width: 100%; }
.buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.reply { margin-top: 8px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 18px 0; font-size: .9rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.alert, .notice { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert { background: var(--bad-soft); color: var(--bad); }
.notice { background: var(--ok-soft); color: var(--ok); }

@media (max-width: 700px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row, .row.three { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .list > li { align-items: flex-start; flex-direction: column; }
  .actions { justify-content: flex-start; }
  .stages li span { display: none; }
  .stages li.current span { display: inline; }
}
ul.plain { margin: 0 0 12px; padding-left: 18px; }
.head > a { align-self: center; }
