:root {
  font-family: "Segoe UI Variable", "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 14px;
  --brand-primary: #2C4966;
  --brand-accent: #79A98F;
  --surface-raised: #F2F2EC;
  --surface-page: #FFFFFF;
  --surface-control: #FFFFFF;
  --text-main: #111111;
  --text-muted: #5B5B58;
  --line-color: #D8D8D2;
  --danger: #B10E1C;
}

.app-frame--dark {
  --surface-raised: #252A2F;
  --surface-page: #171A1E;
  --surface-control: #202429;
  --text-main: #F2F2F2;
  --text-muted: #B7BDC2;
  --line-color: #454C52;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-width: 320px; margin: 0; overflow: hidden; }
#app { height: 100%; overflow-y: auto; overscroll-behavior-y: contain; }
a { color: inherit; }

.app-frame { display: flex; min-height: 100vh; flex-direction: column; background: var(--surface-page); color: var(--text-main); }
.app-topbar { display: flex; min-height: 28px; justify-content: flex-end; padding: 0 max(24px, calc((100vw - 1180px) / 2)); background: #000; font-size: 13px; }
.app-header { display: flex; min-height: 88px; align-items: center; gap: 12px; padding: 12px max(24px, calc((100vw - 1180px) / 2)); color: #fff; background: var(--brand-primary); }
.brand-home { display: inline-flex; align-items: center; }
.brand-logo { display: block; width: auto; height: 64px; }
.brand-divider { width: 1px; height: 60px; margin: 0 8px; background: rgb(255 255 255 / 70%); }
.brand-title { font-size: 22px; font-weight: 700; }
.header-tools { display: flex; align-items: center; gap: 8px; color: #fff; }
.header-tools fluent-button, .header-tools button { color: #fff; }
.header-user { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.page-shell-heading { width: min(100%, 1180px); margin: 0 auto; padding: 28px 24px 12px; }
.page-shell-heading h1 { margin: 0; font-size: 24px; font-weight: 650; line-height: 1.25; }
.view-tabs { display: flex; width: min(100%, 1180px); gap: 4px; margin: 0 auto; padding: 0 24px; border-bottom: 1px solid var(--line-color); }
.view-tab { display: inline-flex; min-height: 42px; align-items: center; padding: 10px 14px; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--text-muted); text-decoration: none; }
.view-tab:is(:hover, :visited, :focus-visible) { color: var(--text-main); }
.view-tab:hover { background: color-mix(in srgb, var(--brand-primary) 5%, var(--surface-page)); }
.view-tab.active { border-bottom-color: var(--brand-accent); color: var(--text-main); font-weight: 650; }

.page-main { width: min(100%, 1180px); flex: 1; margin: 0 auto; padding: 28px 24px 40px; }
.page-section { display: flex; flex-direction: column; gap: 16px; }
.section-heading { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h1 { margin: 0; font-size: 20px; font-weight: 650; line-height: 1.25; }
.section-hint { display: block; margin-top: 3px; color: var(--text-muted); font-size: 12px; }

.request-intro { max-width: 860px; line-height: 1.55; }
.request-intro h2 { margin: 0 0 8px; font-size: 17px; font-weight: 650; }
.request-intro h3 { margin: 12px 0 4px; font-size: 15px; font-weight: 650; }
.request-intro p { margin: 0 0 8px; color: var(--text-muted); }

.form-card, .requests-card { border: 1px solid var(--line-color); border-radius: 6px; background: var(--surface-raised); box-shadow: 0 1px 2px rgb(15 23 42 / 7%), 0 4px 12px rgb(15 23 42 / 4%); }
.request-form { display: flex; flex-direction: column; gap: 18px; padding: 22px; }
.form-field { display: flex; max-width: 720px; flex-direction: column; gap: 4px; }
.form-field > label { font-weight: 600; }
.form-field .required { color: var(--danger); }
.form-input { min-height: 38px; padding: 6px 10px; border: 1px solid var(--line-color); border-radius: 4px; background: var(--surface-control); color: var(--text-main); font: inherit; }
.form-input:focus { outline: 2px solid var(--brand-primary); outline-offset: -1px; }
.form-input--invalid { border-color: var(--danger); }
.field-hint { color: var(--text-muted); font-size: 12px; }
.field-error { color: var(--danger); font-size: 12px; }

.search-results, .selected-members ul { display: grid; max-width: 720px; margin: 6px 0 0; padding: 0; list-style: none; }
.search-results li, .selected-members li { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 2px 8px 10px; border-bottom: 1px solid var(--line-color); }
.member-identity { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.member-id { overflow-wrap: anywhere; color: var(--text-muted); font-size: 12px; }
.member-email { overflow-wrap: anywhere; color: var(--text-muted); font-size: 12px; }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; border-top: 1px solid var(--line-color); }
.form-note { color: var(--text-muted); font-size: 12px; }

.requests-card { overflow: hidden; padding: 0 18px 18px; }
.requests-card__heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 2px 14px; }
.table-scroll { overflow-x: auto; }
.requests-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.requests-table th { padding: 10px 12px; background: color-mix(in srgb, var(--brand-primary) 5%, var(--surface-page)); color: var(--text-muted); font-size: 11px; font-weight: 650; text-align: left; text-transform: uppercase; }
.requests-table td { padding: 12px; border-bottom: 1px solid var(--line-color); font-size: 13px; }
.requests-table tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 8px; }

.admin-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.admin-metric { display: flex; min-height: 82px; flex-direction: column; justify-content: space-between; padding: 14px 16px; border: 1px solid var(--line-color); border-radius: 6px; background: var(--surface-raised); }
.admin-metric span { color: var(--text-muted); font-size: 12px; }
.admin-metric strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.admin-report-note { margin: 0; color: var(--text-muted); font-size: 12px; }

.empty-state { display: flex; min-height: 220px; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 28px 16px; text-align: center; }
.empty-state h2 { margin: 0; font-size: 18px; }
.empty-state p { max-width: 40ch; margin: 0; color: var(--text-muted); }
.loading-state { display: grid; place-items: center; padding: 40px; }

.app-footer { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: auto; padding: 32px max(24px, calc((100vw - 1180px) / 2)) 40px; color: #fff; background: #000; }
.footer-heading { margin: 0; font-size: 26px; font-weight: 700; }
.footer-link, .footer-link:visited { color: #fff; font-size: 16px; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.footer-link:hover, .footer-link:focus-visible { color: #fff; text-decoration-thickness: 2px; }

@media (max-width: 700px) {
  .app-topbar { padding: 0 14px; }
  .app-header { min-height: 64px; padding: 8px 14px; }
  .brand-logo { height: 40px; }
  .brand-divider { height: 40px; margin: 0 2px; }
  .brand-title { font-size: 16px; }
  .page-shell-heading { padding: 22px 14px 10px; }
  .page-shell-heading h1 { font-size: 21px; }
  .view-tabs { padding: 0 10px; overflow-x: auto; }
  .view-tab { white-space: nowrap; }
  .page-main { padding: 20px 14px 32px; }
  .request-form { padding: 16px; }
  .requests-card { padding: 0 10px 12px; }
  .header-user { display: none; }
  .app-footer { padding: 24px 14px 28px; }
}

@media (max-width: 430px) {
  .section-heading { flex-direction: column; align-items: stretch; }
  .form-actions { align-items: stretch; flex-direction: column; }
}
