/*
 * SAP Fiori — Morning Horizon. Components built on SAP's own published tokens.
 *
 * `horizon-tokens.css` is vendored verbatim from @sap-theming/theming-base-content (Apache 2.0)
 * and loaded first; nothing below invents a colour. Every value here is a `var(--sapXxx)`
 * reference, which is what `AC-0.35c-h` checks: a hard-coded hex in this file is a bug, because
 * the moment one appears the page stops tracking the design system it is imitating.
 *
 * The fidelity comes from three things, in this order of importance:
 *   1. structure  — shell bar → launchpad → list report → object page
 *   2. the greys  — --sapContent_LabelColor on labels is what makes a page read as SAP
 *   3. the blue   — least important, most often the only thing an imitation gets right
 */

@font-face {
  font-family: "72";
  src: url("/static/fonts/72-Regular-full.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "72";
  src: url("/static/fonts/72-Semibold-full.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "72";
  src: url("/static/fonts/72-Bold-full.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "72";
  src: url("/static/fonts/72-Light-full.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "SAP-icons";
  src: url("/static/fonts/SAP-icons.woff2") format("woff2");
  font-weight: normal;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--sapFontFamily);
  font-size: var(--sapFontSize);
  color: var(--sapTextColor);
  background: var(--sapBackgroundColor);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--sapLinkColor);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ------------------------------------------------------------------ *
 * Shell bar. Fiori 3 moved off the dark bar; Horizon's shell is white
 * with a hairline border, and getting that wrong dates the imitation
 * by about six years.
 * ------------------------------------------------------------------ */

.shell {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 2.75rem;
  padding: 0 1rem;
  background: var(--sapShellColor);
  border-bottom: 1px solid var(--sapShell_BorderColor);
  color: var(--sapShell_TextColor);
}

.shell__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.25rem;
  background: var(--sapBrandColor);
  color: var(--sapButton_Emphasized_TextColor);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: -0.02em;
}

.shell__title {
  font-weight: 700;
  font-size: 1rem;
}

.shell__subtitle {
  color: var(--sapContent_LabelColor);
  font-size: 0.8125rem;
}

.shell__spacer {
  flex: 1;
}

/*
 * The simulator marker. Not configurable, by design: a switchable marker gets switched off for
 * "a clean screenshot" and never switched back on (ADR-0002, ADR-0004).
 */
.shell__marker {
  padding: 0.125rem 0.5rem;
  border-radius: 0.75rem;
  background: var(--sapInformationBackground);
  color: var(--sapInformativeColor);
  border: 1px solid var(--sapInformativeColor);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.shell__scenario {
  padding: 0.125rem 0.5rem;
  border-radius: 0.75rem;
  background: var(--sapNeutralBackground);
  color: var(--sapContent_LabelColor);
  border: 1px solid var(--sapNeutralColor);
  font-size: 0.6875rem;
  font-weight: 600;
}

.shell__fault {
  padding: 0.125rem 0.5rem;
  border-radius: 0.75rem;
  background: var(--sapWarningBackground);
  color: var(--sapCriticalColor);
  border: 1px solid var(--sapCriticalColor);
  font-size: 0.6875rem;
  font-weight: 700;
}

.shell__clock {
  color: var(--sapContent_LabelColor);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.shell__avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--sapNeutralBackground);
  color: var(--sapContent_LabelColor);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
}

/* ------------------------------------------------------------------ *
 * Navigation
 * ------------------------------------------------------------------ */

.nav {
  display: flex;
  gap: 0.25rem;
  padding: 0 1rem;
  background: var(--sapShellColor);
  border-bottom: 1px solid var(--sapShell_BorderColor);
  overflow-x: auto;
}

.nav__item {
  padding: 0.625rem 0.75rem;
  color: var(--sapContent_LabelColor);
  font-size: 0.8125rem;
  white-space: nowrap;
  border-bottom: 0.1875rem solid transparent;
}
.nav__item:hover {
  color: var(--sapTextColor);
  text-decoration: none;
  background: var(--sapList_Hover_Background);
}
.nav__item--active {
  color: var(--sapTextColor);
  font-weight: 600;
  border-bottom-color: var(--sapBrandColor);
}

/* ------------------------------------------------------------------ *
 * Page scaffold
 * ------------------------------------------------------------------ */

.page {
  padding: 1rem;
  max-width: 100rem;
  margin: 0 auto;
}

.page__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--sapTitleColor);
  margin: 0 0 0.25rem;
}

.page__subtitle {
  color: var(--sapContent_LabelColor);
  font-size: 0.8125rem;
  margin: 0 0 1rem;
}

.card {
  background: var(--sapGroup_ContentBackground);
  border: 1px solid var(--sapList_BorderColor);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.card__header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--sapList_BorderColor);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--sapTitleColor);
  margin: 0;
}

.card__body {
  padding: 1rem;
}

/* ------------------------------------------------------------------ *
 * Launchpad tiles
 * ------------------------------------------------------------------ */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.tile {
  display: block;
  background: var(--sapTile_Background);
  border: 1px solid var(--sapList_BorderColor);
  border-radius: 0.75rem;
  padding: 0.875rem;
  min-height: 7rem;
  color: var(--sapTextColor);
}
.tile:hover {
  text-decoration: none;
  background: var(--sapList_Hover_Background);
}

.tile__label {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
}

.tile__sub {
  font-size: 0.75rem;
  color: var(--sapContent_LabelColor);
  margin-top: 0.125rem;
}

.tile__value {
  font-size: 1.75rem;
  font-weight: 300;
  margin-top: 1rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.tile__unit {
  font-size: 0.8125rem;
  color: var(--sapContent_LabelColor);
  margin-left: 0.25rem;
}

.tile--critical .tile__value {
  color: var(--sapCriticalColor);
}
.tile--negative .tile__value {
  color: var(--sapNegativeColor);
}
.tile--positive .tile__value {
  color: var(--sapPositiveColor);
}

/* ------------------------------------------------------------------ *
 * Filter bar
 * ------------------------------------------------------------------ */

.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--sapGroup_ContentBackground);
  border: 1px solid var(--sapList_BorderColor);
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
  min-width: 10rem;
}

.field__label {
  font-size: 0.75rem;
  color: var(--sapContent_LabelColor);
}

.field input,
.field select {
  font-family: inherit;
  font-size: var(--sapFontSize);
  color: var(--sapTextColor);
  background: var(--sapField_Background);
  border: 1px solid var(--sapField_BorderColor);
  border-radius: 0.25rem;
  padding: 0.3125rem 0.5rem;
  height: 2.25rem;
}

.field input:focus,
.field select:focus {
  outline: 0.0625rem dotted var(--sapContent_FocusColor);
  outline-offset: 0.0625rem;
}

/* ------------------------------------------------------------------ *
 * Buttons
 * ------------------------------------------------------------------ */

.btn {
  font-family: inherit;
  font-size: var(--sapFontSize);
  height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--sapButton_BorderColor);
  background: var(--sapButton_Background);
  color: var(--sapButton_TextColor);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}
.btn:hover:not(:disabled) {
  background: var(--sapButton_Hover_Background);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn--emphasized {
  background: var(--sapButton_Emphasized_Background);
  color: var(--sapButton_Emphasized_TextColor);
  border-color: var(--sapButton_Emphasized_BorderColor);
  font-weight: 600;
}
.btn--emphasized:hover:not(:disabled) {
  background: var(--sapButton_Emphasized_Hover_Background);
}

.btn--transparent {
  background: transparent;
  border-color: transparent;
  color: var(--sapButton_TextColor);
}
.btn--transparent:hover:not(:disabled) {
  background: var(--sapButton_Lite_Hover_Background);
}

.btn--negative {
  color: var(--sapButton_Reject_TextColor);
  border-color: var(--sapButton_Reject_BorderColor);
  background: var(--sapButton_Reject_Background);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ *
 * Responsive table (list report)
 * ------------------------------------------------------------------ */

.table-wrap {
  overflow-x: auto;
}

table.ui-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--sapFontSize);
}

.ui-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--sapList_HeaderTextColor);
  background: var(--sapList_HeaderBackground);
  border-bottom: 1px solid var(--sapList_BorderColor);
  padding: 0.625rem 0.75rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.ui-table tbody td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--sapList_BorderColor);
  vertical-align: top;
}

.ui-table tbody tr:hover {
  background: var(--sapList_Hover_Background);
}

.ui-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ui-table .muted {
  color: var(--sapContent_LabelColor);
}

/* Object status — Fiori's inverted variant, which is what tables actually use. */
.status {
  display: inline-block;
  padding: 0.0625rem 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.status--positive {
  background: var(--sapSuccessBackground);
  color: var(--sapPositiveColor);
  border-color: var(--sapPositiveColor);
}
.status--critical {
  background: var(--sapWarningBackground);
  color: var(--sapCriticalColor);
  border-color: var(--sapCriticalColor);
}
.status--negative {
  background: var(--sapErrorBackground);
  color: var(--sapNegativeColor);
  border-color: var(--sapNegativeColor);
}
.status--information {
  background: var(--sapInformationBackground);
  color: var(--sapInformativeColor);
  border-color: var(--sapInformativeColor);
}
.status--neutral {
  background: var(--sapNeutralBackground);
  color: var(--sapContent_LabelColor);
  border-color: var(--sapNeutralColor);
}

/* ------------------------------------------------------------------ *
 * Object page
 * ------------------------------------------------------------------ */

.object-header {
  background: var(--sapObjectHeader_Background);
  border-bottom: 1px solid var(--sapPageHeader_BorderColor);
  padding: 1rem;
}

.object-header__title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--sapTitleColor);
  margin: 0;
}

.object-header__subtitle {
  color: var(--sapContent_LabelColor);
  font-size: 0.875rem;
  margin: 0.125rem 0 0.75rem;
}

.object-header__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 0.75rem;
}

.fact__label {
  font-size: 0.75rem;
  color: var(--sapContent_LabelColor);
}

.fact__value {
  font-size: 0.9375rem;
  font-weight: 600;
}

/* Definition grid — the two-column label/value layout of a Fiori form. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 0.75rem 2rem;
}

.form-row {
  display: grid;
  grid-template-columns: minmax(9rem, 12rem) 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.3125rem 0;
}

.form-row__label {
  color: var(--sapContent_LabelColor);
  font-size: 0.8125rem;
}

.form-row__value {
  font-size: 0.875rem;
  word-break: break-word;
}

.form-row__value--empty {
  color: var(--sapContent_LabelColor);
}

/* ------------------------------------------------------------------ *
 * Tree table (org structure — PPOME flavour)
 * ------------------------------------------------------------------ */

.tree-row td:first-child {
  white-space: nowrap;
}

.tree-indent {
  display: inline-block;
}

.tree-caret {
  color: var(--sapContent_LabelColor);
  margin-right: 0.375rem;
}

/* ------------------------------------------------------------------ *
 * Messages and empty states
 * ------------------------------------------------------------------ */

.msg {
  display: flex;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
}
.msg--info {
  background: var(--sapInformationBackground);
  border-color: var(--sapInformativeColor);
  color: var(--sapTextColor);
}
.msg--warning {
  background: var(--sapWarningBackground);
  border-color: var(--sapCriticalColor);
  color: var(--sapTextColor);
}
.msg--error {
  background: var(--sapErrorBackground);
  border-color: var(--sapNegativeColor);
  color: var(--sapTextColor);
}

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--sapContent_LabelColor);
}

.empty__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--sapTextColor);
  margin-bottom: 0.25rem;
}

.mono {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--sapList_BorderColor);
  color: var(--sapContent_LabelColor);
  font-size: 0.8125rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--sapList_BorderColor);
}
.switch-row:last-child {
  border-bottom: none;
}

.switch-row__desc {
  color: var(--sapContent_LabelColor);
  font-size: 0.75rem;
  margin-top: 0.125rem;
}

details.raw {
  margin-top: 0.5rem;
}
details.raw summary {
  cursor: pointer;
  color: var(--sapLinkColor);
  font-size: 0.8125rem;
}
details.raw pre {
  background: var(--sapNeutralBackground);
  border: 1px solid var(--sapList_BorderColor);
  border-radius: 0.5rem;
  padding: 0.75rem;
  overflow-x: auto;
  font-size: 0.75rem;
  max-height: 24rem;
}
