:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f2f5f8;
  color: #172637;
  --navy: #101f32;
  --muted: #526478;
  --line: #dce4ed;
  --accent: #1755a5;
  --radius: 12px;
}
* { box-sizing: border-box }
body { margin: 0 }
[hidden] { display: none !important }
:focus-visible { outline: 3px solid #3680d4; outline-offset: 3px }
.skip-link { position: fixed; z-index: 5; top: .75rem; left: 1rem; transform: translateY(-200%); background: white; padding: .6rem }
.skip-link:focus { transform: none }
.topbar { min-height: 66px; padding: .75rem clamp(1rem, 3vw, 2.5rem); display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: var(--navy); color: #fff; border-bottom: 1px solid #2e4058 }
.brand { display: flex; align-items: center; gap: .75rem }
.brand img { display: block; width: clamp(88px, 18vw, 126px); height: auto }
.brand > span:last-child { padding-left: .75rem; border-left: 1px solid #4a5b71; color: #c1ccdb; font-size: .875rem }
.topbar button { color: white; border-color: #586b83; background: transparent }
.topbar button:hover { background: #24364b }
h1, h2, h3, p { margin-top: 0 }
h1 { font-size: clamp(1.85rem, 4vw, 2.65rem); line-height: 1.08; letter-spacing: -.035em; margin-bottom: .45rem }
h2 { font-size: 1.16rem; line-height: 1.3; margin-bottom: .25rem }
h3 { font-size: 1.05rem; line-height: 1.4; margin: 1.2rem 0 .55rem }
p { line-height: 1.5; margin-bottom: .75rem }
p:last-child { margin-bottom: 0 }
.eyebrow { display: block; margin-bottom: .35rem; color: var(--muted); font-size: .72rem; line-height: 1.3; font-weight: 700; letter-spacing: .095em; text-transform: uppercase }
.subtitle { color: var(--muted); margin-bottom: 0 }
.loading { padding: 2rem }
.login { min-height: calc(100vh - 66px); display: grid; grid-template-columns: 1.25fr 1fr; align-content: center; gap: clamp(2rem, 8vw, 8rem); align-items: center; max-width: 1050px; margin: auto; padding: 3rem clamp(1.5rem, 5vw, 4rem) }
.login-intro h1 { font-size: clamp(2.8rem, 6vw, 4.8rem); max-width: 11ch }
.login-intro > p:last-child { max-width: 42ch; color: var(--muted); font-size: 1.06rem }
.login-panel { padding: 2rem }
.login-panel .primary { width: 100%; justify-content: space-between; margin-top: .6rem }
#test-login { margin-top: 1.1rem; color: var(--muted) }
#test-login summary { cursor: pointer; font-size: .9rem }
.test-session { padding: .75rem 1rem; border: 1px solid #c4d7ee; border-radius: 7px; background: #e7effa; color: #154987 }
.time-description { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 12rem }
.workspace { max-width: 1600px; min-height: calc(100vh - 66px); margin: auto; display: grid; grid-template-columns: 235px minmax(0, 1fr) }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 1.65rem .9rem }
.tenant { padding: .35rem .7rem 1.15rem; margin-bottom: .65rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere }
.tenant strong { font-size: 1rem }
#portal-nav, .nav-group { display: grid; gap: .28rem }
.nav-group { margin-top: 1.25rem }
.nav-group .eyebrow { padding: .45rem .7rem .2rem; margin: 0 }
#portal-nav button { justify-content: flex-start; text-align: left; color: #344b64; padding: .58rem .68rem; border-color: transparent; background: transparent }
#portal-nav button:hover { background: #f0f4f9 }
#portal-nav button[aria-current="page"] { background: #e7effa; color: #154987; font-weight: 700; border-color: #d5e3f5 }
.content { padding: clamp(1rem, 3vw, 2.5rem); min-width: 0 }
.page-heading, .panel-heading { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1.3rem; justify-content: space-between }
.page-heading { margin-bottom: 1.45rem }
.panel-heading { margin-bottom: .8rem }
.panel { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1rem, 2vw, 1.4rem) }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: .85rem; margin-bottom: 1rem }
.metrics:empty { margin-bottom: 0 }
.metric { background: white; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem }
.metric strong { display: block; font-size: 1.95rem; font-variant-numeric: tabular-nums; line-height: 1.15; margin: .4rem 0 }
.metric p { color: var(--muted); font-size: .83rem; margin: 0 }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 1rem; align-items: start }
.dashboard-grid:has(#operations[hidden], #activity-panel[hidden]) { grid-template-columns: minmax(0, 1fr) }
.activity-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem 1rem; align-items: center; padding: .7rem 0; border-top: 1px solid var(--line) }
.activity-row strong { overflow-wrap: anywhere }
.activity-row small { display: block; margin-top: .2rem; color: var(--muted) }
.activity-row button { min-width: 0; text-align: left; justify-content: flex-start; padding: 0; color: var(--accent); background: transparent; border: 0 }
.activity-row button:hover { text-decoration: underline; background: transparent }
button, a.primary { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; border: 1px solid #bccadb; border-radius: 7px; background: #fff; color: #24394f; padding: .55rem .8rem; cursor: pointer; font: inherit; font-size: .9rem; line-height: 1.4; text-decoration: none }
button:hover { background: #eef3f9 }
.primary, a.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 650 }
.primary:hover, a.primary:hover { background: #154685; border-color: #154685 }
.quiet { color: #185393 }
button:disabled { opacity: .6; cursor: wait }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: .75rem 0 }
.actions:last-child { margin-bottom: 0 }
.filters { display: grid; grid-template-columns: minmax(12rem, 1.6fr) repeat(2, minmax(8rem, 1fr)); gap: .8rem; margin: .8rem 0 }
.filters.system-filters { grid-template-columns: minmax(12rem, 2fr) minmax(8rem, 1fr) }
label { display: grid; gap: .35rem; color: #31475c; font-size: .875rem; font-weight: 600 }
label.check { display: flex; align-items: center; gap: .55rem }
input:not([type=checkbox]), select, textarea { width: 100%; min-width: 0; max-width: 100%; font: inherit; font-weight: 400; padding: .53rem .65rem; border: 1px solid #b9c7d7; border-radius: 7px; background: white; color: #172637 }
input[type=month] { width: auto; max-width: 15rem }
textarea { min-height: 4.5rem }
form { display: grid; gap: .8rem; border-top: 1px solid var(--line); padding-top: .9rem; margin-top: .9rem }
form h3 { margin-top: 0 }
form > button { justify-self: start }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: .8rem; min-width: 0 }
fieldset .check { margin: .35rem 0 }
.material { display: grid; grid-template-columns: minmax(0, 1fr) 5rem auto; gap: .5rem; align-items: end; margin-bottom: .5rem }
#request-panel { margin-bottom: .75rem }
#notice { margin: .75rem 0 }
#notice:empty, form .error:empty, form [role=status]:empty { display: none }
.details { padding: .7rem 0; border-top: 1px solid var(--line) }
details > summary { cursor: pointer; padding: .2rem 0 }
.details > p { margin: .55rem 0 }
.summary { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .45rem .75rem; margin-left: .35rem }
.badge { display: inline-block; border-radius: 6px; padding: .19rem .45rem; background: #edf2f7; color: #3a526a; font-size: .78rem; line-height: 1.35; font-weight: 650 }
.badge.review, .badge.degraded, .badge.pending { background: #fff0d2; color: #724600 }
.badge.working, .badge.approved { background: #e4efff; color: #154d89 }
.badge.completed, .badge.online { background: #def3e8; color: #195b42 }
.badge.rejected, .badge.cancelled, .badge.offline { background: #fbe8e8; color: #892e36 }
.error { color: #8b2832; background: #fff0f0; border: 1px solid #ecc8cb; border-radius: 7px; padding: .7rem .85rem }
.muted { color: var(--muted) }
.result-count { font-size: .84rem }
.request-timeline { margin: .4rem 0 1rem; padding-inline-start: 1.5rem }
.request-timeline li { padding-block: .22rem }
.request-timeline time { display: inline-block; margin-inline-start: .6rem }
.account-table { overflow-x: auto; margin: .7rem 0 }
.account-table table { width: 100%; border-collapse: collapse }
.account-table th, .account-table td { text-align: left; vertical-align: top; padding: .65rem; border-bottom: 1px solid var(--line) }
.account-table th { font-size: .73rem; letter-spacing: .04em; background: #eef3f8; color: #3e5267 }
.account-table a { color: var(--accent) }
@media(max-width: 970px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) }
  .workspace { grid-template-columns: 185px minmax(0, 1fr) }
}
@media(max-width: 680px) {
  .workspace, .login { display: block }
  .login-intro { margin-bottom: 1.6rem }
  .sidebar { padding: .75rem 1rem; border: 0; border-bottom: 1px solid var(--line) }
  .tenant { padding: 0 0 .55rem; margin-bottom: .45rem }
  #portal-nav, .nav-group { display: flex; flex-wrap: wrap; align-items: center; gap: .18rem }
  .nav-group { margin: 0 }
  .nav-group .eyebrow { display: none }
  #portal-nav button { padding: .4rem .5rem; font-size: .82rem }
  .metrics { grid-template-columns: repeat(auto-fit, minmax(min(100%, 145px), 1fr)); gap: .6rem }
  .metric { padding: .75rem }
  .filters, .filters.system-filters { grid-template-columns: 1fr }
  .material { grid-template-columns: minmax(0, 1fr) 5rem }
  .material button { grid-column: 1/-1; justify-self: start }
}
