:root {
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f7f9;
  color: #1d232b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0, #f5f7f9 260px),
    #f5f7f9;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #54708c;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
}

h3 {
  font-size: 16px;
  line-height: 1.3;
}

.server-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #d9e2ea;
  border-radius: 8px;
  background: #ffffff;
  color: #385067;
  font-size: 14px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #238a58;
}

.layout {
  display: grid;
  gap: 18px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

#appPanel {
  display: grid;
  gap: 18px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 18px;
  align-items: stretch;
}

.auth-context,
.auth-panel,
.form-panel,
.lookup-panel,
.empty-state,
.approval-panel {
  border: 1px solid #d9e2ea;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(37, 54, 75, 0.06);
}

.auth-context {
  display: grid;
  align-content: space-between;
  gap: 28px;
  min-height: 360px;
  padding: 26px;
  background: #12324a;
  color: #ffffff;
}

.auth-context .eyebrow {
  color: #b6d1e7;
}

.auth-context h2 {
  max-width: 420px;
  color: #ffffff;
  font-size: 28px;
}

.auth-status-grid {
  display: grid;
  gap: 10px;
}

.auth-status-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
}

.auth-status-grid span {
  color: #cfe2f1;
  font-size: 13px;
}

.auth-status-grid strong {
  color: #ffffff;
  font-size: 14px;
}

.auth-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  padding: 24px;
}

.auth-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.auth-badge {
  flex: 0 0 auto;
  border: 1px solid #c8d9e8;
  border-radius: 999px;
  padding: 7px 10px;
  background: #f4f8fb;
  color: #315d82;
  font-size: 12px;
  font-weight: 700;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-note {
  margin: 0;
  color: #65778a;
  font-size: 14px;
  line-height: 1.45;
}

.invite-box {
  display: grid;
  gap: 4px;
  border: 1px solid #dfe8ef;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.invite-box span {
  color: #6c7e90;
  font-size: 12px;
  font-weight: 700;
}

.invite-box strong {
  overflow-wrap: anywhere;
  color: #1f2a36;
  font-size: 15px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.step {
  min-height: 38px;
  border: 1px solid #dce5ec;
  border-radius: 8px;
  padding: 9px 10px;
  background: #f8fafc;
  color: #69798a;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.step.active {
  border-color: #5c946f;
  background: #eaf5ef;
  color: #226b4c;
}

.field-help {
  color: #6c7e90;
  font-size: 12px;
  font-weight: 400;
}

.form-panel,
.lookup-panel {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
}

.auth-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.qr-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.qr-frame {
  display: grid;
  place-items: center;
  width: 196px;
  height: 196px;
  border: 1px solid #d9e2ea;
  border-radius: 8px;
  background: #fbfcfd;
}

#totpQr {
  width: 180px;
  height: 180px;
  background: #ffffff;
}

label {
  color: #33485f;
  font-size: 14px;
  font-weight: 700;
}

.lookup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cdd8e2;
  border-radius: 6px;
  background: #ffffff;
  color: #1d232b;
  outline: none;
}

input {
  min-height: 42px;
  padding: 0 12px;
}

.readonly-value {
  display: flex;
  min-height: 42px;
  align-items: center;
  border: 1px solid #dfe8ef;
  border-radius: 6px;
  padding: 0 12px;
  background: #f7fafc;
  color: #1d232b;
  font-family: Consolas, "Courier New", monospace;
  font-size: 14px;
  overflow-wrap: anywhere;
}

textarea {
  resize: vertical;
  min-height: 84px;
  padding: 10px 12px;
}

input:focus,
textarea:focus {
  border-color: #3378b9;
  box-shadow: 0 0 0 3px rgba(51, 120, 185, 0.14);
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#loadButton,
.primary {
  background: #2367a2;
  color: #ffffff;
}

#loadButton:hover,
.primary:hover {
  background: #1d5a8d;
}

.secondary-danger {
  border-color: #d5a8a8;
  background: #ffffff;
  color: #a53838;
}

.secondary-danger:hover {
  background: #fff4f4;
}

.message {
  min-height: 22px;
  color: #5a6b7d;
  font-size: 14px;
}

.message.error {
  color: #a53838;
}

.message.success {
  color: #226b4c;
}

.empty-state {
  display: grid;
  align-items: center;
  min-height: 180px;
  padding: 28px;
  color: #69798a;
  text-align: center;
}

.approval-panel {
  padding: 22px;
}

.approval-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e6edf3;
}

.status-badge {
  align-self: flex-start;
  min-width: 112px;
  border-radius: 999px;
  padding: 7px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.status-pending {
  background: #fff4d7;
  color: #7a5517;
}

.status-approved,
.status-in-sap {
  background: #dff3e9;
  color: #226b4c;
}

.status-rejected,
.status-cancelled,
.status-sap-error {
  background: #f9dddd;
  color: #8a2f2f;
}

.status-expired,
.status-waiting-for-sap {
  background: #e7ebef;
  color: #5d6b78;
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.facts div {
  min-width: 0;
  border: 1px solid #e2eaf1;
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfd;
}

.facts.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

dt {
  margin: 0 0 5px;
  color: #6c7e90;
  font-size: 12px;
  font-weight: 700;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #1f2a36;
  font-size: 14px;
}

.payload-section,
.decision-section,
.decision-info {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e6edf3;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.hash-chip {
  color: #6a7887;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.payload-table {
  display: grid;
  border: 1px solid #e2eaf1;
  border-radius: 6px;
  overflow: hidden;
}

.payload-row {
  display: grid;
  grid-template-columns: minmax(140px, 240px) minmax(0, 1fr);
  min-height: 42px;
}

.payload-row + .payload-row {
  border-top: 1px solid #e2eaf1;
}

.payload-key,
.payload-value {
  padding: 10px 12px;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.payload-key {
  background: #f7fafc;
  color: #526579;
  font-weight: 700;
}

.payload-value {
  background: #ffffff;
  color: #1f2a36;
}

.decision-section {
  display: grid;
  gap: 10px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.auth-actions {
  margin-top: 2px;
}

.hidden {
  display: none !important;
}

.browser-username {
  display: none;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-context {
    min-height: auto;
  }

  .auth-context h2 {
    font-size: 24px;
  }

  .auth-card-head {
    flex-direction: column;
  }

  .auth-badge {
    align-self: flex-start;
  }

  .lookup-row {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .qr-layout {
    grid-template-columns: 1fr;
  }

  .qr-frame {
    width: 100%;
  }

  .approval-head {
    flex-direction: column;
  }

  .facts,
  .facts.compact {
    grid-template-columns: 1fr;
  }

  .payload-row {
    grid-template-columns: 1fr;
  }

  .payload-value {
    border-top: 1px solid #e2eaf1;
  }

  .actions {
    flex-direction: column-reverse;
  }

  button {
    width: 100%;
  }
}
