/* costdash – application styles (served from 'self'; no inline styles). */
:root {
  --bg: #f5f6f8; --card: #fff; --text: #1b1f24; --muted: #5b6470; --accent: #0f62c8; --accent-text: #fff;
  --border: #d9dde3; --warn-bg: #fff4e5; --warn: #8a4b00; --ok: #1f7a3a; --err: #b42318; --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 var(--font); color: var(--text); background: var(--bg); min-height: 100vh;
  display: flex; flex-direction: column; }
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 1rem 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.break { word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--card); padding: .5rem; z-index: 10; }
:focus-visible { outline: 3px solid #6aa7ff; outline-offset: 2px; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1.25rem; background: #102a43; color: #fff; flex-wrap: wrap; }
.topbar a { color: #fff; text-decoration: none; }
.topbar nav { display: flex; gap: 1rem; }
.topbar nav a[aria-current="page"] { border-bottom: 2px solid #fff; }
.brand { font-weight: 700; letter-spacing: .02em; display: inline-flex; align-items: center; gap: .5rem; }
.brand img { display: block; }
.user { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.user select { max-width: 260px; }
main { width: 100%; flex: 1 0 auto; max-width: 1400px; margin: 0 auto; padding: 0 1.25rem 2rem; }
footer { display: flex; gap: 1rem; justify-content: space-between; padding: 1rem 1.25rem; color: var(--muted); font-size: .8rem; flex-wrap: wrap; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card.narrow { max-width: 640px; margin: 3rem auto; }
.card.info { border-left: 4px solid var(--accent); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }
.grid-2 > .card { margin-bottom: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpi { display: flex; flex-direction: column; gap: .25rem; margin-bottom: 0; }
.kpi .value { font-size: 1.5rem; font-weight: 650; }
.label { font-weight: 600; font-size: .85rem; color: var(--muted); }

.controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.field.actions { flex-direction: row; gap: .5rem; margin-left: auto; }
.field.inline-check { flex-direction: row; align-items: center; gap: .4rem; }
.filters-field { flex-basis: 100%; }
.scope-field { position: relative; }
.scope-panel { position: absolute; z-index: 20; top: 100%; left: 0; width: min(560px, 90vw); max-height: 420px; overflow: auto;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.scope-list, .rg-list, .selection-list { list-style: none; margin: .5rem 0; padding: 0; }
.rg-list { padding-left: 1.5rem; }
.scope-list li, .selection-list li { padding: .15rem 0; }
.row { display: flex; gap: .5rem; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.inline { display: inline-flex; align-items: center; gap: .35rem; font-weight: normal; color: var(--text); }

input, select, textarea, button, .button { font: inherit; }
input[type="text"], input[type="search"], input[type="date"], input:not([type]), select, textarea {
  padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); min-width: 0; }
textarea { width: 100%; font-family: var(--mono); }
button, .button { display: inline-block; padding: .45rem .9rem; border-radius: 6px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: #fff; color: var(--accent); }
button.link { background: none; border: none; color: var(--accent); padding: 0 .25rem; text-decoration: underline; }
button:disabled { opacity: .5; cursor: not-allowed; }
.file-label { cursor: pointer; }
fieldset { border: none; padding: 0; margin: 0 0 .75rem; }
legend { font-weight: 600; margin-bottom: .25rem; }
.tag-row { margin-bottom: .4rem; }
.tag-row .tag-name { width: 260px; }
.tag-row .tag-value { width: 320px; }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .25rem 0 .5rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: #e7f0fd; color: #0b3d80; border-radius: 999px; padding: .15rem .3rem .15rem .65rem; font-weight: normal; }
.chip-x { background: none; border: none; color: #0b3d80; padding: 0 .35rem; font-size: 1rem; line-height: 1; }

.warnings { background: var(--warn-bg); color: var(--warn); border: 1px solid #f5c27a; border-radius: var(--radius); padding: .5rem 1rem; margin-bottom: 1rem; }
.warnings p { margin: .25rem 0; }
.warning { color: var(--warn); }
.totals { font-weight: 650; margin-left: 1rem; }
.chart-box { position: relative; height: 320px; margin-bottom: 1rem; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; }
.props dt { font-weight: 600; color: var(--muted); }
.props dd { margin: 0; }
table.simple { border-collapse: collapse; width: 100%; }
table.simple th, table.simple td { border-bottom: 1px solid var(--border); padding: .35rem .5rem; text-align: left; }
.status.updated { color: var(--ok); font-weight: 600; }
.status.failed { color: var(--err); font-weight: 600; }
.status.skipped { color: var(--warn); }

#toast { position: fixed; right: 1rem; bottom: 1rem; max-width: 460px; padding: .75rem 1rem; border-radius: var(--radius);
  background: #102a43; color: #fff; opacity: 0; transform: translateY(10px); transition: all .2s; pointer-events: none; }
#toast.show { opacity: 1; transform: none; }
#toast.error { background: var(--err); }
body.busy { cursor: progress; }
body.busy main { opacity: .7; }
[hidden] { display: none !important; }

/* Welcome / sign-in (Sign in with Microsoft asset used unaltered: learn.microsoft.com/entra/identity-platform/howto-add-branding-in-apps) */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 400px); gap: 3rem; align-items: center;
  max-width: 1080px; margin: 4rem auto 2rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 700; color: var(--accent); margin: 0 0 .5rem; }
.hero h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 .75rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.5rem; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
.features li { position: relative; padding-left: 2.1rem; }
.features li::before { content: "✓"; position: absolute; left: 0; top: .05rem; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--accent); background: #e7f0fd; }
.signin-card { padding: 2rem; margin: 0; box-shadow: 0 10px 30px rgba(16, 42, 67, .08); }
.signin-card.narrow { max-width: 480px; margin: 4rem auto; text-align: center; }
.signin-card h1, .signin-card h2 { margin: 0 0 .35rem; }
.signin-card h2 { font-size: 1.3rem; }
.ms-signin { display: inline-block; margin: 1rem 0 1.25rem; line-height: 0; border-radius: 2px; transition: box-shadow .15s; }
.ms-signin img { display: block; }
.ms-signin:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.requirements { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 1rem; padding: .75rem 1rem;
  background: var(--bg); border-radius: var(--radius); font-size: .9rem; }
.requirements dt { font-weight: 600; color: var(--muted); }
.requirements dd { margin: 0; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 2rem; margin-top: 2rem; } .hero h1 { font-size: 1.7rem; } }
@media (max-width: 720px) { .field.actions { margin-left: 0; } .grid-2 { grid-template-columns: 1fr; } }
