/* Orange Nexus V2 components. White marks the active item and the primary action;
   orange marks rings and the numbers that matter. */

#nx2[dir="rtl"] .nx-icon--dir {
  transform: scaleX(-1);
}

/* ---- Glass panel ---- */
#nx2 .nx-glass {
  position: relative;
  isolation: isolate;
  border-radius: var(--nx-r-lg);
  padding: 28px;
  background: var(--nx-glass-card);
  border: var(--nx-glass-border);
  box-shadow: var(--nx-glass-edge), var(--nx-glass-drop);
  -webkit-backdrop-filter: var(--nx-backdrop);
  backdrop-filter: var(--nx-backdrop);
}
/* The sheen sits behind the content (z-index -1 inside the panel's own stacking
   context), so it adds light without washing the text. */
/* (The dock keeps its glossy top edge without the band: its labels span the
   whole pill and the band would cross one of them.) */
#nx2 .nx-glass::before,
#nx2 .nx-btn--glass::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: min(100%, var(--nx-sheen-height));
  z-index: -1;
  border-radius: inherit;
  background: var(--nx-sheen);
  -webkit-mask-image: var(--nx-sheen-mask);
  mask-image: var(--nx-sheen-mask);
  pointer-events: none;
}
#nx2 .nx-glass--md {
  border-radius: var(--nx-r-md);
  padding: 22px;
}
#nx2 .nx-glass--xl {
  border-radius: var(--nx-r-xl);
  padding: 40px 36px;
  background: var(--nx-glass-hero);
  border: var(--nx-glass-hero-border);
  box-shadow: var(--nx-glass-hero-edge);
  -webkit-backdrop-filter: var(--nx-glass-hero-backdrop);
  backdrop-filter: var(--nx-glass-hero-backdrop);
}
#nx2 .nx-glass--flat {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.3);
}
#nx2 .nx-glass__title {
  font-size: 18px;
  font-weight: var(--nx-w-body);
  line-height: 1.4;
}
#nx2 .nx-glass__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-block-end: 16px;
}

/* A slow light sweep across a hero panel; removed for reduced motion */
#nx2 .nx-shine {
  overflow: hidden;
}
#nx2 .nx-shine::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 45%;
  background: var(--nx-sweep);
  transform: skewX(-18deg);
  animation: nx-sweep 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes nx-sweep {
  0%,
  55% {
    left: -60%;
  }
  100% {
    left: 130%;
  }
}

/* ---- Buttons ---- */
#nx2 .nx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--nx-pill);
  border: 1px solid transparent;
  font: var(--nx-w-title) 15px/1.2 var(--nx-font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform 160ms var(--nx-ease), background-color 160ms var(--nx-ease), box-shadow 160ms var(--nx-ease);
}
/* A long label never widens its card on a phone: the button stays inside and the text wraps */
#nx2 .nx-btn {
  max-width: 100%;
}
#nx2 a.nx-btn {
  white-space: normal;
  text-align: center;
  padding-block: 8px;
}
#nx2 .nx-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}
#nx2 .nx-btn:disabled,
#nx2 .nx-btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.62;
}
#nx2 .nx-btn--primary {
  background: var(--nx-pearl);
  color: var(--nx-ink);
  box-shadow: var(--nx-pearl-edge), 0 12px 34px rgba(30, 20, 60, 0.28);
}
#nx2 .nx-btn--primary:hover:not(:disabled) {
  background: #fff6ec;
  box-shadow: 0 16px 40px rgba(255, 138, 31, 0.32);
}
#nx2 .nx-btn--glass {
  position: relative;
  isolation: isolate;
  /* Its own dark glass, so the label holds 4.5:1 even in a panel's bright corner */
  background: var(--nx-glass-control);
  box-shadow: var(--nx-glass-control-edge);
  border: var(--nx-glass-control-border);
  color: #ffffff;
  font-weight: var(--nx-w-body);
  -webkit-backdrop-filter: var(--nx-glass-control-backdrop);
  backdrop-filter: var(--nx-glass-control-backdrop);
}
#nx2 .nx-btn--glass:hover:not(:disabled) {
  background: var(--nx-glass-control-hover);
}
#nx2 .nx-btn--ghost {
  background: transparent;
  color: #ffffff;
  font-weight: var(--nx-w-body);
}
#nx2 .nx-btn--ghost:hover:not(:disabled) {
  background: rgba(30, 24, 62, 0.3);
}
#nx2 .nx-btn--lg {
  min-height: 56px;
  font-size: 17px;
  padding: 0 30px;
}
#nx2 .nx-btn--sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
}
#nx2 .nx-btn--block {
  width: 100%;
}
#nx2 .nx-btn--icon {
  min-width: 46px;
  padding: 0 12px;
}
#nx2 .nx-btn__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  animation: nx-spin 0.8s linear infinite;
}
@keyframes nx-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Fields ---- */
#nx2 .nx-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
#nx2 .nx-field__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
#nx2 .nx-label {
  font-size: 14px;
  font-weight: var(--nx-w-body);
}
#nx2 .nx-hint {
  font-size: 13px;
  color: var(--nx-text-2);
}
#nx2 .nx-field__error {
  font-size: 13px;
  font-weight: var(--nx-w-body);
  color: #ffffff;
  display: flex;
  gap: 6px;
  align-items: center;
}
#nx2 .nx-field__error::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff9b9b;
  box-shadow: 0 0 8px #ff9b9b;
}
#nx2 .nx-control {
  position: relative;
  display: flex;
  align-items: center;
}
#nx2 .nx-input,
#nx2 .nx-select {
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--nx-pill);
  background: rgba(30, 24, 62, 0.2);
  color: #ffffff;
  font: var(--nx-w-light) 16px/1.2 var(--nx-font);
  transition: border-color 160ms var(--nx-ease), background-color 160ms var(--nx-ease);
  appearance: none;
}
#nx2 .nx-input::placeholder {
  color: rgba(255, 255, 255, 0.82);
}
#nx2 .nx-input:hover,
#nx2 .nx-select:hover {
  border-color: rgba(255, 255, 255, 0.8);
}
#nx2 .nx-input[aria-invalid="true"] {
  border-color: #ffb4b4;
}
/* A text of several lines: the input's look at its own height, its lines as typed. Each line is ordered by its own
   language (plaintext: an English line inside an Arabic page keeps its full stop at its end) and starts at the page's
   start edge, as the same text reads where it is shown. */
#nx2 .nx-textarea {
  display: block;
  min-height: 132px;
  padding: 14px 20px;
  border-radius: var(--nx-r-sm);
  line-height: 1.7;
  letter-spacing: 0;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
  text-align: right;
}
#nx2[dir="ltr"] .nx-textarea {
  text-align: left;
}
#nx2 .nx-input--ltr {
  direction: ltr;
  text-align: start;
}
#nx2 [dir="rtl"] .nx-input--ltr,
#nx2[dir="rtl"] .nx-input--ltr {
  text-align: right;
}
#nx2 .nx-input--with-action {
  padding-inline-end: 64px;
}
#nx2 .nx-control__action {
  position: absolute;
  inset-inline-end: 6px;
}
#nx2 .nx-select {
  padding-inline-end: 44px;
  cursor: pointer;
}
/* The chevron is drawn on the control's wrapper, never as the select's own background. A native list's popup is the
   browser's own: where Firefox lets a page colour it, it drops the page's colours (the select's and every option's
   below) for the system's once the select has a background-image (its SelectChild, _allowCustomStyling). So a select
   here carries no image, and every option its own colour on its own background.
   The wrapper's drawing lies over the whole select with the select's own border, so the chevron keeps its place: 16px
   inside the border at the control's end, centred. Two half-squares make a "v": the 45deg half sits left of the
   135deg half. */
#nx2 .nx-control--select::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  background-image: var(--nx-chevron);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  background-position: left 16px center, left 22px center;
  pointer-events: none;
}
#nx2[dir="ltr"] .nx-control--select::after {
  background-position: right 22px center, right 16px center;
}
#nx2 .nx-select option {
  color: var(--nx-ink);
  background: #ffffff;
}

/* ---- Segmented (role switch, periods) ---- */
#nx2 .nx-seg {
  display: flex;
  gap: 4px;
  padding: 5px;
  border-radius: var(--nx-pill);
  background: var(--nx-glass-track);
  border: var(--nx-glass-track-border);
}
#nx2 .nx-seg__item {
  flex: 1 1 0;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--nx-pill);
  background: transparent;
  color: #ffffff;
  font: var(--nx-w-body) 15px/1.2 var(--nx-font);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 160ms var(--nx-ease), color 160ms var(--nx-ease);
}
#nx2 .nx-seg__item:hover:not([aria-pressed="true"]) {
  background: rgba(255, 255, 255, 0.14);
}
#nx2 .nx-seg__item[aria-pressed="true"] {
  background: var(--nx-pearl);
  color: var(--nx-ink);
  font-weight: var(--nx-w-title);
  box-shadow: 0 6px 18px rgba(30, 20, 60, 0.24);
}
#nx2 .nx-seg--sm .nx-seg__item {
  min-height: 40px;
  font-size: 14px;
}

/* ---- Toggle (switch) ---- */
#nx2 .nx-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #ffffff;
  font: var(--nx-w-body) 15px/1.3 var(--nx-font);
  cursor: pointer;
  text-align: start;
}
#nx2 .nx-toggle__track {
  flex: none;
  width: 56px;
  height: 32px;
  padding: 3px;
  border-radius: var(--nx-pill);
  background: rgba(20, 16, 44, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.45);
  display: flex;
  transition: background-color 180ms var(--nx-ease);
}
#nx2 .nx-toggle__knob {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform 180ms var(--nx-ease);
}
#nx2 .nx-toggle[aria-checked="true"] .nx-toggle__track {
  background: var(--nx-orange-fill);
  border-color: rgba(255, 230, 190, 0.9);
}
#nx2[dir="rtl"] .nx-toggle[aria-checked="true"] .nx-toggle__knob {
  transform: translateX(-24px);
}
#nx2[dir="ltr"] .nx-toggle[aria-checked="true"] .nx-toggle__knob {
  transform: translateX(24px);
}
#nx2 .nx-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}
#nx2 .nx-toggle:focus-visible {
  border-radius: var(--nx-pill);
}

/* ---- Status chip: opaque pastel with ink text, readable over any backdrop ---- */
#nx2 .nx-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: var(--nx-pill);
  font: var(--nx-w-title) 12px/1.2 var(--nx-font);
  white-space: nowrap;
  color: var(--nx-ink);
  background: #ffffff;
}
#nx2 .nx-chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
#nx2 .nx-chip--done {
  background: #ffffff;
  color: #1f5a3a;
}
#nx2 .nx-chip--running {
  background: #d4e2ff;
  color: #1e3a8a;
}
#nx2 .nx-chip--review {
  background: #ffe9a8;
  color: #6b4500;
}
#nx2 .nx-chip--cancelled {
  background: #ffd0d0;
  color: #8a1c2b;
}
#nx2 .nx-chip--neutral {
  background: rgba(255, 255, 255, 0.86);
  color: var(--nx-ink);
}
#nx2 .nx-chip--live {
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--nx-ink);
}
#nx2 .nx-chip--live .nx-chip__dot {
  background: var(--nx-orange-lo);
  animation: nx-pulse 2.2s infinite;
}
@keyframes nx-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.6);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(255, 122, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 122, 0, 0);
  }
}

/* ---- Ring (orange progress arc) ---- */
#nx2 .nx-ring {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
}
#nx2 .nx-ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
#nx2 .nx-ring__track {
  stroke: rgba(255, 255, 255, 0.24);
}
#nx2 .nx-ring__arc {
  filter: drop-shadow(0 0 8px rgba(255, 150, 40, 0.75));
  transition: stroke-dashoffset 600ms var(--nx-ease);
}
#nx2 .nx-ring__core {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
#nx2 .nx-ring__value {
  font-weight: var(--nx-w-light);
  line-height: 1;
}
#nx2 .nx-ring__label {
  font-size: 12px;
  font-weight: var(--nx-w-body);
}

/* ---- Line chart / sparkline ---- */
#nx2 .nx-chart {
  position: relative;
  direction: ltr;
}
#nx2 .nx-chart__plot {
  position: relative;
}
#nx2 .nx-chart__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
#nx2 .nx-chart__line {
  fill: none;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}
#nx2 .nx-chart__cross {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
}
#nx2 .nx-chart__point {
  position: absolute;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
#nx2 .nx-chart__point::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0;
  transition: opacity 120ms var(--nx-ease);
}
#nx2 .nx-chart__point:hover::after {
  opacity: 0.6;
}
#nx2 .nx-chart__point[aria-pressed="true"]::after {
  inset: 8px;
  opacity: 1;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.9);
}
#nx2 .nx-chart__tip {
  position: absolute;
  pointer-events: none;
  padding: 10px 16px;
  border-radius: var(--nx-r-sm);
  background: #ffffff;
  color: var(--nx-ink);
  box-shadow: 0 14px 40px rgba(30, 20, 60, 0.3);
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#nx2 .nx-chart__tip b {
  font-size: 20px;
  font-weight: var(--nx-w-title);
}
#nx2 .nx-chart__tip span {
  font-size: 12px;
  color: var(--nx-ink-2);
}
#nx2 .nx-chart__axis {
  position: relative;
  height: 20px;
  margin-top: 6px;
}
#nx2 .nx-chart__tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 11px;
  white-space: nowrap;
}
/* Edge labels stay inside the panel */
#nx2 .nx-chart__tick--first {
  transform: none;
}
#nx2 .nx-chart__tick--last {
  transform: translateX(-100%);
}
#nx2 .nx-chart {
  container-type: inline-size;
}
/* Narrow charts keep every other label (always the first and last) */
@container (max-width: 520px) {
  #nx2 .nx-chart__tick--alt:not(.nx-chart__tick--last) {
    display: none;
  }
}
#nx2 .nx-spark {
  display: inline-block;
  vertical-align: middle;
}

/* ---- Rows (tables as glass rows) ---- */
#nx2 .nx-rows-wrap {
  container-type: inline-size;
  overflow-x: auto;
  margin-inline: -6px;
  padding-inline: 6px;
}
#nx2 .nx-rows {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-size: 14px;
  text-align: start;
}
#nx2 .nx-rows th {
  padding: 0 14px 2px;
  font-size: 12px;
  font-weight: var(--nx-w-body);
  text-align: start;
  white-space: nowrap;
}
#nx2 .nx-rows td {
  padding: 12px 14px;
  background: rgba(20, 16, 44, 0.16);
  vertical-align: middle;
}
#nx2 .nx-rows td:first-child {
  border-start-start-radius: 20px;
  border-end-start-radius: 20px;
}
#nx2 .nx-rows td:last-child {
  border-start-end-radius: 20px;
  border-end-end-radius: 20px;
}
/* A new row is marked by an orange edge and a lift, not by a white wash that
   would sink white text below 4.5:1. */
#nx2 .nx-rows tr[data-fresh="true"] td {
  background: rgba(20, 16, 44, 0.3);
}
#nx2 .nx-rows tr[data-fresh="true"] td:first-child {
  box-shadow: inset -3px 0 0 var(--nx-orange);
}
#nx2[dir="ltr"] .nx-rows tr[data-fresh="true"] td:first-child {
  box-shadow: inset 3px 0 0 var(--nx-orange);
}
#nx2 .nx-rows tbody tr:hover td {
  background: rgba(20, 16, 44, 0.32);
}
#nx2 .nx-rows .nx-cell--end {
  text-align: end;
}
#nx2 .nx-rows__empty {
  padding: 28px 14px;
  text-align: center;
}
#nx2 .nx-rows td {
  white-space: nowrap;
}
/* Narrow containers: each row becomes a card, every cell labelled by its column */
@container (max-width: 560px) {
  #nx2 .nx-rows,
  #nx2 .nx-rows tbody,
  #nx2 .nx-rows tr,
  #nx2 .nx-rows td {
    display: block;
  }
  #nx2 .nx-rows thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  #nx2 .nx-rows tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  #nx2 .nx-rows tr {
    border-radius: 20px;
    background: rgba(20, 16, 44, 0.18);
    padding: 6px 0;
  }
  #nx2 .nx-rows tr[data-fresh="true"] {
    background: rgba(20, 16, 44, 0.3);
    box-shadow: inset -3px 0 0 var(--nx-orange);
  }
  #nx2[dir="ltr"] .nx-rows tr[data-fresh="true"] {
    box-shadow: inset 3px 0 0 var(--nx-orange);
  }
  #nx2 .nx-rows tbody tr:hover td,
  #nx2 .nx-rows tr[data-fresh="true"] td,
  #nx2 .nx-rows td {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
  #nx2 .nx-rows td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 16px;
    text-align: start;
  }
  #nx2 .nx-rows td[data-label]::before {
    content: attr(data-label);
    font-size: 12px;
  }
  #nx2 .nx-rows .nx-rows__empty {
    justify-content: center;
  }
}
#nx2 .nx-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 13px;
}

/* A short note in a panel header (e.g. "pick a day"): its own dark pill, so it
   stays at 4.5:1 inside the bright gloss corner. */
#nx2 .nx-note-pill {
  font-size: 12px;
  font-weight: var(--nx-w-body);
  padding: 5px 12px;
  border-radius: var(--nx-pill);
  background: rgba(30, 24, 62, 0.5);
  white-space: nowrap;
}

/* ---- Alerts and notes ---- */
#nx2 .nx-alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 16px;
  border-radius: var(--nx-r-sm);
  font-size: 14px;
  font-weight: var(--nx-w-body);
  line-height: 1.6;
}
#nx2 .nx-alert--error {
  background: #ffd9d9;
  color: #7a1626;
}
#nx2 .nx-alert--info {
  background: rgba(255, 255, 255, 0.9);
  color: var(--nx-ink);
}
#nx2 .nx-alert:empty {
  display: none;
}

/* ---- Brand (always LTR; never mirrored or right-aligned in Arabic) ----
   Sizes derive from --nx-mark, set by <Brand> and overridable per layout. */
#nx2 .nx-brand {
  --nx-mark: 40px;
  display: inline-flex;
  align-items: flex-end;
  gap: calc(var(--nx-mark) * 0.25);
  direction: ltr;
  unicode-bidi: isolate;
  text-decoration: none;
  color: #ffffff;
  border-radius: var(--nx-r-sm);
}
#nx2 .nx-brand__mark {
  flex: none;
  display: block;
  /* a soft shadow (not a tile) keeps the cut edges crisp over the orange glow */
  filter: drop-shadow(0 2px 6px rgba(20, 16, 44, 0.35));
}
#nx2 .nx-brand__mark svg {
  width: var(--nx-mark);
  height: var(--nx-mark);
}
#nx2 .nx-brand__words {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(var(--nx-mark) * 0.2);
  margin-bottom: calc(var(--nx-mark) * -0.05);
  font-family: var(--nx-font-mark);
  font-weight: 400;
  line-height: 0.8;
  white-space: nowrap;
}
#nx2 .nx-brand__name {
  color: #ffffff;
  font-size: calc(var(--nx-mark) * 0.56);
  letter-spacing: 0.16em;
  /* trailing tracking would push the centre right; balance it */
  margin-right: -0.16em;
}
#nx2 .nx-brand__sub {
  color: var(--nx-orange);
  font-size: max(7px, calc(var(--nx-mark) * 0.13));
  letter-spacing: 0.6em;
  padding-left: 0.6em;
  /* Michroma has one weight; a hairline stroke matches the approved sub-line */
  -webkit-text-stroke: 0.035em currentColor;
}
