:root {
  --bg: #f7f7f9;
  --card: #ffffff;
  --text: #1c1d22;
  --muted: #5d6471;
  --brand: #00334c;
  --border: #d9dde3;
  --error: #b21f1f;
  --error-bg: #fdecec;
  --button: #00334c;
  --button-hover: #014a6d;
  --secondary: #5d6471;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--brand);
  color: #fff;
}

.site-header .brand {
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

/* Brand logo image. Constrained by the header band's vertical space —
   the header has 0.75rem top+bottom padding plus font line-height, so
   ~28-32px usually fits naturally. Tweak max-height if your logo
   wants more room. */
.site-header .brand-logo {
  display: block;
  max-height: 32px;
  width: auto;
}

.site-header .user {
  font-size: 0.9rem;
  color: #d3e2eb;
}

/* ----- User menu (top-right dropdown) ----- */

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  margin: 0;
  padding: 0.35rem 0.7rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 4px;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.user-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.14);
}

.user-menu-trigger[aria-expanded='true'] {
  background: rgba(255, 255, 255, 0.2);
}

.user-menu-name {
  font-weight: 600;
}

.user-menu-role {
  color: #c9d8e3;
  font-size: 0.82rem;
}

.user-menu-caret {
  font-size: 0.75rem;
  color: #c9d8e3;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  min-width: 9rem;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  z-index: 100;
  padding: 0.35rem 0;
  margin: 0;
}

.user-menu-panel[hidden] {
  display: none;
}

.user-menu-item {
  display: block;
  margin: 0;
  padding: 0;
}

/* Higher specificity than the global `button { margin-top: 1.25rem }`
   rule so the sign-out button doesn't get a top margin that opens a
   gap at the top of the dropdown panel. */
.user-menu-item button.link-button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.5rem 0.9rem;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}

.user-menu-item button.link-button:hover {
  background: #eef0f3;
}

.container {
  max-width: 720px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

h1 {
  font-size: 1.4rem;
  margin: 0 0 0.5rem;
  color: var(--brand);
}

h2 {
  font-size: 1.1rem;
  color: var(--brand);
  margin-top: 0;
}

label {
  display: block;
  margin: 1rem 0 0.25rem;
  font-weight: 600;
}

input[type='text'],
input[type='password'],
input[type='email'],
input[type='number'],
input[type='tel'],
input[type='url'],
input[type='search'],
input[type='date'],
input[type='file'],
select {
  display: block;
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  background: #fff;
}

input[type='text']:focus,
input[type='password']:focus,
input[type='email']:focus,
input[type='number']:focus,
input[type='tel']:focus,
input[type='url']:focus,
input[type='search']:focus,
input[type='date']:focus,
input[type='file']:focus,
select:focus {
  outline: 2px solid var(--brand);
  outline-offset: -1px;
  border-color: var(--brand);
}

button {
  margin-top: 1.25rem;
  padding: 0.55rem 1.1rem;
  background: var(--button);
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

button:hover {
  background: var(--button-hover);
}

button.secondary {
  background: var(--secondary);
}

.error {
  background: var(--error-bg);
  color: var(--error);
  padding: 0.6rem 0.85rem;
  border-radius: 4px;
  margin: 0.5rem 0 1rem;
  border: 1px solid #f5c5c5;
}

.help,
.note {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 1rem;
}

code {
  background: #eef0f3;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.92em;
}

.site-footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--muted);
}

nav.secure-menu {
  margin: 1rem 0;
  font-size: 0.95rem;
}

nav.secure-menu a {
  color: var(--brand);
}

ul.menu-list,
ul.row-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1.25rem;
}

ul.menu-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

ul.menu-list li:last-child {
  border-bottom: 0;
}

ul.menu-list a {
  color: var(--brand);
  text-decoration: none;
}

ul.menu-list a:hover {
  text-decoration: underline;
}

ul.row-list .row-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

ul.row-list .row-list-item:last-child {
  border-bottom: 0;
}

.row-main {
  flex: 1;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.row-actions a {
  color: var(--brand);
}

.inline-form {
  display: inline;
  margin: 0;
  padding: 0;
}

button.link-button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--error);
  font-size: inherit;
  font-family: inherit;
  cursor: pointer;
  text-decoration: underline;
}

button.link-button:hover {
  background: none;
}

.muted {
  color: var(--muted);
  font-size: 0.9em;
}

.actions {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

a.button-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--button);
  color: #fff;
  border-radius: 4px;
  text-decoration: none;
}

a.button-link:hover {
  background: var(--button-hover);
}

a.secondary-link {
  color: var(--muted);
  text-decoration: none;
}

a.secondary-link:hover {
  text-decoration: underline;
}

.form-row {
  display: flex;
  gap: 0.85rem;
}

.form-row > label {
  flex: 1;
}

.form-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.form-table th,
.form-table td {
  padding: 0.25rem 0.4rem;
  vertical-align: top;
  text-align: left;
}

.form-table td button {
  margin-top: 0;
}

a.danger,
button.danger {
  color: var(--error);
}

button.danger {
  background: var(--error);
  color: #fff;
}

button.danger:hover {
  background: #8d1818;
}

dl.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.35rem 1rem;
  margin: 1rem 0 1.25rem;
}

dl.kv dt {
  color: var(--muted);
  font-weight: 600;
}

dl.kv dd {
  margin: 0;
}

label.inline-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  margin: 0.6rem 1rem 0.6rem 0;
}

label.inline-checkbox input[type='checkbox'] {
  width: auto;
  margin: 0;
}

textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
}

.audit-metadata {
  display: inline-block;
  max-width: 36rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.82rem;
  line-height: 1.35;
}

/* Entra "Sign in with Microsoft" primary CTA — Microsoft's brand
   colours (dark blue / white). Just a bigger, more prominent
   button-link variant. */
.sso-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #2f2f2f;
  color: #fff;
  text-decoration: none;
  border-radius: 3px;
  font-weight: 600;
  font-size: 1rem;
}

.sso-button:hover {
  background: #000;
}

/* Collapsed by default. Keeps break-glass out of the way but
   discoverable. */
.break-glass {
  margin-top: 2rem;
  padding: 1rem;
  background: #f6f7f9;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.break-glass summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--secondary);
}

.break-glass[open] summary {
  margin-bottom: 0.75rem;
}

/* Audit log lives in a wide layout — 5 columns of timestamp/user/action/
   target/metadata don't fit in the default 720px reading column. */
.container.container-wide {
  max-width: 1200px;
}

/* Horizontal scroll fallback so a long metadata blob still doesn't push
   the page sideways on narrow viewports. */
.table-scroll {
  overflow-x: auto;
  margin: 0.5rem 0 1rem;
}

.table-scroll table {
  min-width: 56rem;
}

.audit-table th,
.audit-table td {
  vertical-align: top;
}

.audit-table th:nth-child(1),
.audit-table td:nth-child(1) {
  white-space: nowrap;
}

.audit-table th:nth-child(3),
.audit-table td:nth-child(3) {
  white-space: nowrap;
}

/* Legal disclaimer rendered at the bottom of every /secure (prospect /
   retail) page. Sized down + low-contrast so it reads as fine print
   rather than competing with the page content. */
.secure-disclaimer {
  max-width: 720px;
  margin: 1.5rem auto 2rem;
  padding: 0 1.5rem;
  color: #6b7480;
  font-size: 0.78rem;
  line-height: 1.45;
  text-align: justify;
}

.secure-disclaimer p {
  margin: 0;
}
