/* Sign-in page, the signed-in user menu, read-only states and Activity Logs.
   Uses the tokens from app.css only. */

:root {
  --ev-login: #276a4f;
  --ev-login-bg: #dbfceb;
  --ev-edit: #12386e;
  --ev-edit-bg: #dce9ff;
  --ev-flag: #5b3ea6;
  --ev-flag-bg: #ece5ff;
  --ev-sql: #00626b;
  --ev-sql-bg: #d6f5f7;
  --ev-off: #6f7976;
  --ev-off-bg: #eef2f6;
}

/* ── role chips ─────────────────────────────────────────────────────────── */

.role-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.role-chip.dev, .role-chip.edit { background: var(--ok-bg); color: var(--ok); border-color: #b9e6cf; }
.role-chip.read, .role-chip.viewer { background: var(--bq-bg); color: var(--bq); border-color: #b9d0f5; }
.role-chip.admin { background: #f1e9fb; color: #5b2a91; border-color: #d9c6f0; }
.role-chip.super { background: #fde8e9; color: #9e1b24; border-color: #f3b7b3; }

.access-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bq-bg);
  color: var(--bq);
  border: 1px solid #b9d0f5;
}
.access-pill .ms { font-size: 15px; }
.access-pill.area { background: var(--surface-low); color: var(--on-surface-variant); border-color: var(--outline-variant); }

/* ── user menu ──────────────────────────────────────────────────────────── */

.user-menu { position: relative; }

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  background: none;
  border-radius: 999px;
  padding: 2px 8px 2px 2px;
  cursor: pointer;
  font: inherit;
  color: var(--on-surface);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-container); border-color: rgba(205, 200, 204, 0.6); }
.user-btn .ms { font-size: 18px; color: var(--on-surface-variant); }
.user-name { font-size: 12px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.session-ending .user-btn .avatar { box-shadow: 0 0 0 2px var(--warn-bg), 0 0 0 3px var(--warn-dot); }

.user-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 290px;
  background: var(--surface-lowest);
  border: 1px solid rgba(205, 200, 204, 0.7);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(29, 27, 30, 0.14), 0 2px 6px rgba(29, 27, 30, 0.06);
  padding: 14px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.user-pop-head { display: flex; align-items: center; gap: 12px; }
.user-pop-id { display: flex; flex-direction: column; min-width: 0; }
.user-pop-id strong { font-size: 14px; }
.user-pop-id .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-pop-rows { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; border-top: 1px solid rgba(205, 200, 204, 0.45); border-bottom: 1px solid rgba(205, 200, 204, 0.45); }
.user-pop-rows > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
#session-left { white-space: nowrap; font-size: 11.5px; }
.session-ending #session-left { color: var(--warn-dot); font-weight: 600; }
.sign-out { justify-content: center; width: 100%; }
.sign-out:hover:not(:disabled) { background: var(--bad-bg); border-color: #f2b8b5; color: var(--bad); }

/* ── read-only controls ─────────────────────────────────────────────────── */

.switch.locked:disabled { opacity: 0.55; cursor: not-allowed; }
.approve-btn:disabled {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: not-allowed;
  opacity: 0.8;
  background: var(--warn-bg);
  color: var(--warn);
}
.approve-btn:disabled .ms { font-size: 14px; }
.approve-btn:disabled:hover { background: var(--warn-bg); color: var(--warn); border-color: inherit; }

/* ── sign-in page ───────────────────────────────────────────────────────── */

.login-body { min-height: 100vh; background: var(--surface); }

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(380px, 46%) 1fr;
}

.login-hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  padding: 36px 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(255, 170, 164, 0.30), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(255, 214, 196, 0.16), transparent 60%),
    linear-gradient(155deg, #5a0a10 0%, var(--primary) 40%, var(--primary-container) 78%, #d9404a 100%);
}
.login-flow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.login-hero > :not(.login-flow) { position: relative; }

.login-brand { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-moglix { height: 40px; width: auto; display: block; }
.login-env {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 5px;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.login-dfc { height: 46px; width: auto; align-self: flex-start; margin-bottom: 14px; }
.login-brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
}
.login-brand .brand-name { font-size: 17px; font-weight: 700; color: #fff; }
.login-brand .brand-sub { font-size: 11px; color: rgba(255, 255, 255, 0.72); }

.login-pitch h1 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: 26px;
}
.login-pitch ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.login-pitch li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: rgba(255, 255, 255, 0.9); }
.login-pitch li .ms {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--secondary-container);
}
.login-foot { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.6); }

.login-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.login-card-head { display: flex; flex-direction: column; gap: 6px; }
.login-mark {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--secondary-container), #fff1ef);
  color: var(--primary);
  margin-bottom: 8px;
}
.login-mark .ms { font-size: 24px; }
.login-card-head h2 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.login-card-head p { color: var(--on-surface-variant); font-size: 14px; }

.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-input { position: relative; display: flex; align-items: center; }
.login-input .ms { position: absolute; left: 13px; color: var(--on-surface-variant); pointer-events: none; }
.login-input input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--outline-variant);
  border-radius: 8px;
  background: var(--surface-lowest);
  font: inherit;
  font-size: 15px;
  color: var(--on-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-input input:focus { outline: none; border-color: var(--primary-container); box-shadow: 0 0 0 3px rgba(197, 35, 45, 0.16); }
.login-input.invalid input { border-color: var(--bad-dot); box-shadow: 0 0 0 3px rgba(186, 26, 26, 0.1); }

.login-go { height: 46px; justify-content: center; font-size: 14px; border-radius: 8px; }
.login-go.loading { cursor: progress; }
.login-go.loading .ms { animation: login-nudge 0.9s ease-in-out infinite; }
@keyframes login-nudge { 50% { transform: translateX(4px); } }

.login-error, .login-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
}
.login-error { background: var(--bad-bg); color: var(--bad); }
.login-note { background: var(--warn-bg); color: var(--warn); }
.login-error .ms, .login-note .ms { font-size: 18px; margin-top: 1px; }

/* app.css pads every <main> for the top bar; the sign-in page has none */
main.login { padding-top: 0; }

.login-contact {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-low);
  border: 1px solid rgba(205, 200, 204, 0.45);
  font-size: 12.5px;
  color: var(--on-surface-variant);
}
.login-contact strong { color: var(--on-surface); font-weight: 600; }
.login-contact-links { display: flex; flex-wrap: wrap; gap: 8px; }
.login-contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-lowest);
  border: 1px solid rgba(205, 200, 204, 0.7);
  color: var(--primary-container);
  font-family: var(--mono);
  font-size: 11.5px;
  text-decoration: none;
}
.login-contact-links a:hover { background: var(--secondary-container); border-color: var(--secondary-fixed-dim); color: var(--primary); }
.login-contact-links .ms { font-size: 15px; }

.login-roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 10px;
  background: var(--surface-low);
  border: 1px solid rgba(205, 200, 204, 0.45);
  font-size: 12px;
  color: var(--on-surface-variant);
}
.login-roles > div { display: flex; align-items: center; gap: 10px; }
.login-roles .role-chip { min-width: 78px; justify-content: center; }
.login-small { font-size: 12px; color: var(--outline); }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-moglix { height: 30px; }
  .login-dfc { height: 38px; }
  .login-hero { padding: 24px 20px; gap: 18px; }
  .login-pitch ul, .login-foot { display: none; }
  .login-pitch h1 { font-size: 22px; margin: 0; }
  .login-side { padding: 28px 16px 40px; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) { .login-go.loading .ms { animation: none; } }

/* ── activity logs ──────────────────────────────────────────────────────── */

.lg-day { height: 36px; border: 1px solid var(--outline-variant); border-radius: 6px; background: var(--surface-lowest); font: inherit; padding: 0 8px; color: var(--on-surface); }

.lg-kinds { max-width: 100%; overflow-x: auto; }
.lg-kinds .tab { white-space: nowrap; }
.lg-kinds .tab[data-kind="changes"] .dot { background: var(--ev-edit); }
.lg-kinds .tab[data-kind="access"] .dot { background: var(--ev-login); }
.lg-kinds .tab[data-kind="problems"] .dot { background: var(--bad-dot); }
.lg-kinds .tab[data-kind="sql"] .dot { background: var(--ev-sql); }

.lg-split { grid-template-columns: minmax(280px, 30%) 1fr; }
.lg-people-card { padding: 0; gap: 0; }
.lg-col-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid rgba(205, 200, 204, 0.45); }
.lg-people { max-height: calc(100vh - 280px); min-height: 320px; overflow: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.lg-people .sk-list { padding: 8px 10px; }

.lg-person {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: none;
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
  font: inherit;
  color: var(--on-surface);
}
.lg-person:hover { background: var(--surface-low); }
.lg-person.active { background: var(--surface-container); border-color: rgba(197, 35, 45, 0.35); box-shadow: inset 3px 0 0 var(--primary-container); }
.lg-person-id { display: flex; flex-direction: column; min-width: 0; }
.lg-person-id strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-person-id .tiny { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-person-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lg-counts { display: flex; gap: 4px; }
.lg-count {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--ev-off-bg);
  color: var(--ev-off);
}
.lg-count .ms { font-size: 12px; }
.lg-count.ok { background: var(--ev-edit-bg); color: var(--ev-edit); }
.lg-count.bad { background: var(--bad-bg); color: var(--bad); }

.avatar.read { background: var(--bq); }
.avatar.none { background: var(--outline); }

.lg-flows-card { padding: 0; min-height: 420px; transition: opacity 0.15s; }
.lg-flows-card .pad { padding: 20px 22px; }
.lg-flows-card.lg-loading { opacity: 0.6; }
.lg-flows-inner { display: flex; flex-direction: column; }

.lg-who {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(205, 200, 204, 0.45);
  background: linear-gradient(90deg, var(--surface-low), var(--surface-lowest) 70%);
  flex-wrap: wrap;
}
.lg-who-id { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.lg-who-id h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.lg-who-stats { display: flex; gap: 8px; }
.lg-who-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 78px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-lowest);
  border: 1px solid rgba(205, 200, 204, 0.55);
}
.lg-who-stats strong { font-family: var(--mono); font-size: 16px; }
.lg-who-stats span { font-size: 10px; color: var(--on-surface-variant); text-transform: uppercase; letter-spacing: 0.06em; }
.lg-who-stats .bad strong { color: var(--bad-dot); }
.lg-range-note { padding: 10px 22px 0; }

.lg-sessions { display: flex; flex-direction: column; gap: 10px; padding: 12px 22px 22px; }

.lg-session {
  border: 1px solid rgba(205, 200, 204, 0.6);
  border-radius: 10px;
  background: var(--surface-lowest);
  overflow: hidden;
}
.lg-session[open] { box-shadow: 0 1px 3px rgba(29, 27, 30, 0.05); }
.lg-session.stray { border-color: #f2b8b5; }
.lg-session summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  cursor: pointer;
  flex-wrap: wrap;
}
.lg-session summary::-webkit-details-marker { display: none; }
.lg-session summary:hover { background: var(--surface-low); }
.lg-session[open] summary { border-bottom: 1px solid rgba(205, 200, 204, 0.45); background: var(--surface-low); }
.lg-caret { transition: transform 0.15s; color: var(--on-surface-variant); }
.lg-session[open] .lg-caret { transform: rotate(90deg); }
.lg-session-title { display: flex; flex-direction: column; min-width: 160px; }
.lg-session-title strong { font-size: 13px; }
.lg-session-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; justify-content: flex-end; }
.lg-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ev-off-bg);
  color: var(--ev-off);
}
.lg-chip .ms { font-size: 14px; }

.lg-timeline { list-style: none; margin: 0; padding: 6px 14px 10px; position: relative; }
.lg-event {
  display: grid;
  grid-template-columns: 74px 28px 1fr;
  gap: 10px;
  padding: 8px 0;
  position: relative;
}
.lg-event + .lg-event { border-top: 1px dashed rgba(205, 200, 204, 0.45); }
.lg-time { font-size: 11px; color: var(--on-surface-variant); padding-top: 5px; text-align: right; }
.lg-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ev-off-bg);
  color: var(--ev-off);
}
.lg-dot .ms { font-size: 15px; }
.lg-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; padding-top: 3px; }
.lg-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.lg-kind { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ev-off); white-space: nowrap; }
.lg-summary { font-size: 13px; color: var(--on-surface); overflow-wrap: anywhere; }
.lg-facts { display: flex; gap: 6px; flex-wrap: wrap; }
.lg-fact {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--on-surface-variant);
  background: var(--surface-low);
  border: 1px solid rgba(205, 200, 204, 0.5);
  border-radius: 4px;
  padding: 1px 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lg-fact .ms { font-size: 13px; }

.lg-diff {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(205, 200, 204, 0.55);
  border-radius: 8px;
  overflow: hidden;
  font-size: 12px;
}
.lg-diff-row {
  display: grid;
  grid-template-columns: minmax(110px, 24%) 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
}
.lg-diff-row + .lg-diff-row { border-top: 1px solid rgba(205, 200, 204, 0.35); }
.lg-diff-field { font-weight: 600; color: var(--on-surface-variant); }
.lg-diff-old, .lg-diff-new { font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; padding: 2px 6px; border-radius: 4px; }
.lg-diff-old { background: var(--bad-bg); color: var(--bad); text-decoration: line-through; text-decoration-color: rgba(147, 0, 10, 0.4); }
.lg-diff-new { background: var(--ok-bg); color: var(--ok); }
.lg-diff-arrow { font-size: 14px; color: var(--outline); }
.lg-diff-old.none { background: var(--surface-low); color: var(--outline); text-decoration: none; }
.lg-empty { font-style: italic; opacity: 0.75; text-decoration: none; }
.lg-failed { margin-left: 4px; padding: 1px 6px; border-radius: 4px; background: var(--bad-bg); color: var(--bad); letter-spacing: 0.04em; }

.lg-error { font-size: 11.5px; color: var(--bad); background: var(--bad-row); border-left: 3px solid var(--bad-dot); padding: 5px 8px; border-radius: 0 4px 4px 0; overflow-wrap: anywhere; }

/* colour per kind of event */
.ev-LOGIN .lg-dot, .lg-chip.ev-LOGIN { background: var(--ev-login-bg); color: var(--ev-login); }
.ev-LOGIN .lg-kind { color: var(--ev-login); }
.ev-ROW_UPDATE .lg-dot, .lg-chip.ev-ROW_UPDATE { background: var(--ev-edit-bg); color: var(--ev-edit); }
.ev-ROW_UPDATE .lg-kind { color: var(--ev-edit); }
.ev-FLAG_CHANGE .lg-dot, .lg-chip.ev-FLAG_CHANGE { background: var(--ev-flag-bg); color: var(--ev-flag); }
.ev-FLAG_CHANGE .lg-kind { color: var(--ev-flag); }
.ev-SQL_VIEW .lg-dot, .lg-chip.ev-SQL_VIEW { background: var(--ev-sql-bg); color: var(--ev-sql); }
.ev-SQL_VIEW .lg-kind { color: var(--ev-sql); }
.ev-SESSION_EXPIRED .lg-dot, .lg-chip.ev-SESSION_EXPIRED { background: var(--warn-bg); color: var(--warn-dot); }
.ev-SESSION_EXPIRED .lg-kind { color: var(--warn-dot); }
.ev-ACCESS_DENIED .lg-dot, .ev-LOGIN_FAILED .lg-dot, .ev-ERROR .lg-dot,
.lg-chip.ev-ACCESS_DENIED, .lg-chip.ev-LOGIN_FAILED, .lg-chip.ev-ERROR { background: var(--bad-bg); color: var(--bad-dot); }
.ev-ACCESS_DENIED .lg-kind, .ev-LOGIN_FAILED .lg-kind, .ev-ERROR .lg-kind { color: var(--bad-dot); }
.lg-event.is-bad .lg-dot { box-shadow: 0 0 0 2px var(--surface-lowest), 0 0 0 3px var(--bad-dot); }

@media (max-width: 1100px) {
  .lg-split { grid-template-columns: 1fr; }
  .lg-people { max-height: 300px; min-height: 0; }
}
@media (max-width: 640px) {
  .lg-event { grid-template-columns: 26px 1fr; }
  .lg-time { grid-column: 2; grid-row: 1; text-align: left; padding: 0; }
  .lg-dot { grid-row: 1 / span 2; }
  .lg-body { grid-column: 2; }
  .lg-diff-row { grid-template-columns: 1fr; gap: 3px; }
  .lg-diff-arrow { display: none; }
  .lg-who-stats { width: 100%; }
  .lg-who-stats > div { flex: 1; min-width: 0; }
  .user-name, .access-pill { display: none; }
  .topbar-right { gap: 8px; }
  .topbar-right .sync { display: none; }
}

/* ── Sign in with Microsoft ─────────────────────────────────────────────── */
/* Follows Microsoft's sign-in button guidance: white, thin grey border,
   the four-square logo on the left, dark grey label. */
.ms-signin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 46px;
  padding: 0 16px;
  border-radius: 8px;
  border: 1px solid #8c8c8c;
  background: #fff;
  color: #3b3b3b;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.ms-signin:hover { background: #f5f5f5; border-color: #6e6e6e; }
.ms-signin:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(197, 35, 45, 0.25); border-color: var(--primary-container); }
.ms-signin .ms-logo { flex: none; }
.ms-signin.loading { cursor: progress; pointer-events: none; }
.ms-signin.loading .ms-logo { animation: ms-signin-pulse 1s ease-in-out infinite; }
.ms-signin[aria-disabled="true"] { cursor: not-allowed; opacity: 0.55; }
.login-how { margin-top: -6px; line-height: 1.5; }
@keyframes ms-signin-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .ms-signin.loading .ms-logo { animation: none; } }

/* ENVIROMENT=local: email sign-in instead of Microsoft */
.login-local-form { display: flex; flex-direction: column; gap: 14px; }
.login-local { background: var(--surface-container); color: var(--on-surface-variant); }

/* idle sign-out warning (core.js) */
.idle-banner {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 12px 12px 12px 16px;
  border-radius: 12px;
  background: var(--on-surface);
  color: #fff;
  font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(29, 27, 30, 0.28);
}
.idle-banner[hidden] { display: none; }
.idle-banner > .ms { color: #ffb4ae; font-size: 20px; }
.idle-banner strong { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.idle-banner .btn { flex: none; white-space: nowrap; }
@media (max-width: 560px) { .idle-banner { flex-wrap: wrap; bottom: 12px; } }
.login-seen { display: block; margin-top: 6px; font-size: 12px; opacity: 0.85; }
.login-seen code { font-family: var(--mono); }

/* Microsoft button + "or" + email form (qa) */
.login-or { display: flex; align-items: center; gap: 12px; color: var(--outline); font-size: 11.5px; letter-spacing: 0.04em; }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--outline-variant); }

/* sidebar item locked for DFC_Read (API Docs) */
.nav-item.nav-locked { cursor: not-allowed; opacity: 0.6; }
.nav-item.nav-locked:hover { background: none; color: var(--on-surface-variant); }
.nav-item.nav-locked .nav-lock { margin-left: auto; font-size: 15px; }

/* ── confirmation dialog (DFC.confirm in core.js) ────────────────────────── */
.modal-open { overflow: hidden; }
.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(29, 27, 30, 0.42);
  animation: modal-fade 0.14s ease-out;
}
.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: var(--surface-lowest);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(29, 27, 30, 0.28);
  overflow: hidden;
  animation: modal-rise 0.16s ease-out;
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.modal-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.modal-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--secondary-container), #fff1ef);
  color: var(--primary);
  flex: none;
}
.modal-icon .ms { font-size: 21px; }
.modal-body { padding: 10px 22px 6px; overflow: auto; font-size: 13.5px; line-height: 1.55; color: var(--on-surface-variant); }
.modal-body p { margin-bottom: 8px; }
.modal-body strong { color: var(--on-surface); }
.modal-lead { font-size: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid rgba(205, 200, 204, 0.45); margin-top: 8px; }

.diff-wrap { border: 1px solid rgba(205, 200, 204, 0.6); border-radius: 10px; overflow: auto; max-height: 46vh; margin: 6px 0 10px; }
.diff-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.diff-table thead th { position: sticky; top: 0; background: var(--surface-low); text-align: left; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--outline); font-weight: 600; padding: 8px 12px; }
.diff-table tbody th { text-align: left; font-weight: 600; color: var(--on-surface); padding: 10px 12px; white-space: nowrap; vertical-align: top; }
.diff-table td { padding: 10px 12px; vertical-align: top; word-break: break-word; font-family: var(--mono); font-size: 12.5px; }
.diff-table tbody tr + tr > * { border-top: 1px solid rgba(205, 200, 204, 0.35); }
.diff-old { color: var(--bad); background: #fff6f5; text-decoration: line-through; text-decoration-color: rgba(147, 0, 10, 0.35); }
.diff-new { color: var(--ok); background: #f1faf6; font-weight: 600; }
.diff-old .dim, .diff-new .dim { text-decoration: none; font-weight: 400; font-style: italic; }
.diff-arrow { width: 24px; padding-left: 0 !important; padding-right: 0 !important; color: var(--outline); text-align: center; }
.diff-arrow .ms { font-size: 16px; }
.diff-table.create td.diff-new { text-decoration: none; }

@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-rise { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) { .modal-scrim, .modal { animation: none; } }
@media (max-width: 560px) {
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; justify-content: center; }
  .diff-table tbody th { white-space: normal; }
}

a.btn.new-btn { text-decoration: none; }

/* ── pending approvals: top bar on every page + topbar pill ─────────────── */
.appr-bar {
  margin: 16px 24px 0;
  border: 1px solid #f0cd8e;
  border-left: 4px solid var(--warn-dot);
  background: linear-gradient(180deg, #fffaf0, #fff);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-margin-top: calc(var(--bar-h) + 12px);
}
.appr-bar.flash { animation: appr-flash 0.9s ease; }
@keyframes appr-flash { 0%, 100% { box-shadow: none; } 40% { box-shadow: 0 0 0 4px rgba(136, 89, 0, 0.18); } }
.appr-head { display: flex; align-items: center; gap: 12px; }
.appr-icon {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--warn-bg); color: var(--warn);
}
.appr-icon .ms { font-size: 20px; }
.appr-title { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.appr-title strong { font-size: 14px; color: var(--on-surface); }
.appr-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.appr-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 7px 8px 7px 10px;
  border-radius: 8px;
  background: var(--surface-lowest);
  border: 1px solid rgba(205, 200, 204, 0.6);
}
.appr-item.here { border-color: var(--warn-dot); }
.appr-kind {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--warn); background: var(--warn-bg); border-radius: 4px; padding: 2px 7px; white-space: nowrap;
}
.appr-name { font-family: var(--mono); font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appr-from { font-size: 12px; color: var(--on-surface-variant); white-space: nowrap; }
.appr-open { font-size: 12px; font-weight: 600; color: var(--warn); }
.appr-item a.btn { text-decoration: none; }
.appr-mine { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 12px; }
.appr-mine .caps { margin-right: 4px; }
.appr-sent {
  display: inline-flex; align-items: center; gap: 4px; text-decoration: none; color: var(--on-surface);
  border: 1px solid var(--outline-variant); background: var(--surface-lowest); border-radius: 999px; padding: 3px 10px 3px 7px;
  font-family: var(--mono); font-size: 11.5px;
}
.appr-sent .ms { font-size: 15px; color: var(--warn-dot); }
.appr-sent .dim { font-family: var(--sans); }
.appr-sent:hover { border-color: var(--warn-dot); }

.appr-pill {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; font-weight: 600;
  border: 1px solid #f0cd8e; background: var(--warn-bg); color: var(--warn); border-radius: 999px;
  padding: 4px 6px 4px 10px; cursor: pointer;
}
.appr-pill .ms { font-size: 17px; }
.appr-count {
  min-width: 20px; height: 20px; border-radius: 999px; background: var(--warn-dot); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; padding: 0 6px;
}

a.approve-btn { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; white-space: nowrap; }
a.approve-btn .ms { font-size: 14px; }
a.approve-btn.review { background: var(--primary-container); border-color: var(--primary-container); color: #fff; }
a.approve-btn.review:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
a.approve-btn.waiting { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 760px) {
  .appr-bar { margin: 12px 16px 0; }
  .appr-item { grid-template-columns: auto minmax(0, 1fr) auto; }
  .appr-from { display: none; }
  .appr-pill > span:not(.ms):not(.appr-count) { display: none; }
  .topbar-right:has(.appr-pill:not([hidden])) .sync,
  .topbar-right:has(.appr-pill:not([hidden])) #refresh { display: none; }
}

.modal-error { margin: 6px 0 0; color: var(--bad); font-weight: 600; font-size: 12.5px; }
.modal.danger .modal-icon { background: var(--bad-bg); color: var(--bad); }
.modal.danger .btn.primary { background: var(--bad-dot); border-color: var(--bad-dot); }

.appr-tag { font-family: var(--sans); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--bq); background: var(--bq-bg); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 1px; }
.appr-icon.back { background: #fff1e6; color: #8a3a00; }
.appr-item.back { border-color: #f3c58f; }
.appr-fix { text-decoration: none; border-color: #f3c58f; color: #8a3a00; background: #fffaf3; }

/* narrow screens: a long row of filter tabs scrolls sideways instead of widening the page */
@media (max-width: 760px) {
  .tabrow { min-width: 0; max-width: 100%; }
  .tabs { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
  .tabs .tab { flex: none; }
}

/* ── type-to-search dropdown (a report picked by code or subject) ───────── */
.combo { position: relative; }
.combo-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--outline); pointer-events: none; }
.combo-input { width: 100%; padding-left: 34px !important; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto;
  background: var(--surface-lowest); border: 1px solid var(--outline-variant); border-radius: 8px;
  box-shadow: 0 12px 28px rgba(29, 27, 30, 0.14); padding: 4px;
}
.combo-opt { padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; line-height: 1.35; }
.combo-opt.active { background: var(--secondary-container); color: var(--on-secondary-container); }
.combo-opt.chosen { font-weight: 600; }
.combo-empty { padding: 10px; font-size: 12.5px; color: var(--on-surface-variant); }

/* ── email suggestions ────────────────────────────────────────────────── */
.pp-anchor { position: relative; }
.pp-wrap input { width: 100%; }
.pp-pop {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: 320px; overflow: auto;
  background: var(--surface-lowest); border: 1px solid var(--outline-variant); border-radius: 8px;
  box-shadow: 0 12px 28px rgba(29, 27, 30, 0.14); padding: 4px;
}
.pp-head { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--on-surface-variant); padding: 6px 10px 4px; }
.pp-item { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 6px; cursor: pointer; }
.pp-item.active { background: var(--secondary-container); }
.pp-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pp-name { font-size: 13px; font-weight: 600; color: var(--on-surface); }
.pp-mail { font-family: var(--mono); font-size: 11.5px; color: var(--on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-item mark { background: rgba(197, 35, 45, 0.14); color: inherit; border-radius: 2px; padding: 0 1px; }
.pp-meta { font-size: 11px; color: var(--on-surface-variant); white-space: nowrap; }
.pp-ext { color: var(--warn); font-weight: 600; }
