/* CargoExpress portals: app shell, sign-in gate, tiles, tables, charts. Tokens come from site.css. */

.btn--small {
  min-height: 34px;
  padding: 0 14px;
  font-size: 13.5px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

.alert {
  background: #FFF4E5;
  border: 1px solid #F5C58A;
  color: #7A3E00;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-weight: 600;
  margin-bottom: 18px;
}

.alert--info {
  background: var(--chat-soft);
  border-color: #9ADBC4;
  color: #0B5B46;
}

.alert--secret {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.alert--secret .mono {
  color: var(--tape);
  margin-top: 6px;
  font-size: 15px;
  word-break: break-all;
}

/* ---- Gate (sign in / sign up) ---- */
.gate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--paper);
}

.gate__form {
  display: flex;
  flex-direction: column;
  padding: 28px clamp(20px, 5vw, 72px);
}

.gate__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.gate__body {
  width: min(460px, 100%);
  margin: auto 0;
  padding: 48px 0;
}

.gate__title {
  font-size: clamp(38px, 5vw, 60px);
  font-weight: 850;
  font-stretch: 68%;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  line-height: .95;
}

.gate__lede {
  color: var(--muted);
  margin: 14px 0 26px;
  font-size: 17px;
}

.gate__links {
  margin-top: 26px;
  display: grid;
  gap: 8px;
  font-size: 15px;
  color: var(--muted);
}

.gate__links a {
  color: var(--ink);
  font-weight: 700;
}

.gate__aside {
  background: var(--ink);
  color: var(--paper);
  padding: clamp(32px, 6vw, 88px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.gate__aside::before {
  content: "";
  position: absolute;
  inset: auto -10% -18% auto;
  width: 60%;
  aspect-ratio: 1;
  background: repeating-linear-gradient(-45deg, rgba(255, 210, 63, .14) 0 16px, transparent 16px 32px);
  transform: rotate(8deg);
}

.gate__aside h2 {
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 850;
  font-stretch: 68%;
  text-transform: uppercase;
  line-height: .95;
  max-width: 14ch;
}

.roles,
.steps {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  gap: 1px;
  background: #2A3442;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.roles li,
.steps li {
  background: var(--ink-2);
  padding: 16px 18px;
  display: grid;
  gap: 4px;
}

.roles strong,
.steps strong {
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  color: var(--tape);
  letter-spacing: .04em;
}

.roles span,
.steps span {
  color: #C9D4DA;
  font-size: 15px;
}

.steps {
  counter-reset: s;
}

.steps li strong::before {
  counter-increment: s;
  content: counter(s) " · ";
}

.terms {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  position: relative;
}

.terms p {
  background: #1B2330;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 13px;
  color: #B7C3CF;
  display: grid;
  gap: 6px;
}

.terms .mono {
  font-size: 24px;
  color: var(--paper);
  font-weight: 800;
}

.form {
  display: grid;
  gap: 14px;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.form input:not([type=checkbox]),
.form select,
.form textarea,
.filters input,
.filters select,
.rule input,
.input--small {
  border: 1px solid var(--steel-2);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 16px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
  width: 100%;
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.filters input:focus,
.rule input:focus {
  outline: 3px solid rgba(16, 21, 28, .18);
  border-color: var(--ink);
}

.form small {
  font-weight: 500;
}

.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form .check {
  margin-top: 2px;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-wrap input {
  padding-right: 44px !important;
}

.password-toggle {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.password-toggle:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
}

.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 22px;
  font-weight: 500;
}

.security-badge svg {
  color: var(--chat);
  flex-shrink: 0;
}

/* ---- App shell ---- */
.app {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--steel);
}

.side {
  background: var(--ink);
  color: #C9D4DA;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand--side {
  color: var(--paper);
  padding: 4px 10px 22px;
  font-size: 18px;
}

.side__nav {
  display: grid;
  gap: 2px;
}

.side__nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
}

.side__nav a:hover {
  background: #1B2330;
  color: var(--paper);
}

.side__nav a[aria-current="page"] {
  background: var(--tape);
  color: var(--ink);
}

.side__foot {
  margin-top: auto;
  padding: 12px;
}

.side__site {
  color: #8FA3AE;
  font-size: 13px;
  text-decoration: none;
}

.side :focus-visible {
  outline-color: var(--tape);
}

.shell {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--steel-2);
  background: rgba(238, 241, 244, .9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.top__menu {
  display: none;
  background: none;
  border: 0;
  padding: 6px;
  cursor: pointer;
}

.top__title .eyebrow {
  margin: 0 0 4px;
}

.top__title h1 {
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 850;
  font-stretch: 72%;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.top__user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
}

.who__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--tape);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.who__text {
  display: grid;
  line-height: 1.2;
}

.who__text strong {
  font-size: 14px;
}

.who__text small {
  color: var(--muted);
  font-size: 12px;
}

.main {
  padding: clamp(16px, 3vw, 36px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-content: start;
}

/* ---- Building blocks ---- */
.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.tile {
  background: var(--paper);
  border: 1px solid var(--steel-2);
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  display: grid;
  gap: 6px;
  align-content: start;
}

.tile__label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.tile__value {
  font-size: clamp(28px, 3vw, 38px);
  font-weight: 850;
  font-stretch: 72%;
  line-height: 1;
  letter-spacing: -0.01em;
}

.tile__sub {
  font-size: 13px;
  color: var(--muted);
}

.tile--dark {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
  box-shadow: 6px 6px 0 var(--tape);
}

.tile--dark .tile__label,
.tile--dark .tile__sub {
  color: #B7C3CF;
}

.tile--alert {
  border-color: var(--alert);
}

.tile--alert .tile__value {
  color: var(--alert);
}

.tile--cta {
  background: var(--tape);
  border-color: var(--tape);
}

a.tile:hover {
  border-color: var(--ink);
}

.panel {
  background: var(--paper);
  border: 1px solid var(--steel-2);
  border-radius: 14px;
  padding: clamp(16px, 2vw, 22px);
  min-width: 0;
}

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

.panel__head h2 {
  font-size: 18px;
  font-weight: 800;
  font-stretch: 105%;
}

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

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

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

.empty-state {
  color: var(--muted);
  padding: 18px 0;
  display: grid;
  gap: 12px;
  justify-items: start;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
}

.table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}

.table td {
  padding: 12px 8px;
  border-bottom: 1px solid var(--steel-2);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #F7F9FA;
}

.table a {
  font-weight: 700;
}

.table--compact td,
.table--compact th {
  padding: 6px 8px;
}

.num,
.table .num {
  text-align: right;
}

.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--steel);
  color: var(--ink);
  white-space: nowrap;
}

.chip--delivered,
.chip--active,
.chip--approved,
.chip--paid,
.chip--live {
  background: var(--chat-soft);
  color: #0B5B46;
}

.chip--exception,
.chip--suspended,
.chip--void,
.chip--cancelled {
  background: #FDE7DC;
  color: #9A3412;
}

.chip--awaiting_payment,
.chip--pending,
.chip--requested {
  background: #FFF1C2;
  color: #6B4E00;
}

.chip--in_transit,
.chip--out_for_delivery,
.chip--picked_up {
  background: var(--ink);
  color: var(--paper);
}

.chip--affiliate {
  background: var(--tape);
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--steel-2);
  border: 1px solid var(--steel-2);
  border-radius: 10px;
  overflow: hidden;
  margin: 0;
}

.facts div {
  background: var(--paper);
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.facts dt {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.facts dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

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

.facts--stack div {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.facts__total dd,
.facts__total dt {
  font-size: 18px;
  color: var(--ink);
  font-weight: 800;
}

/* Single-series bar chart: ink bars, hover/focus tooltip, table fallback. */
.bars {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  height: 180px;
  align-items: end;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--steel-2);
  position: relative;
}

.bars__col {
  position: relative;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  outline: none;
}

.bars__bar {
  width: min(70%, 22px);
  background: var(--ink);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: background-color .15s;
}

.bars__col:hover .bars__bar,
.bars__col:focus-visible .bars__bar {
  background: var(--kraft-dark);
}

.bars__tip {
  position: absolute;
  bottom: calc(100% - 8px);
  left: 50%;
  transform: translate(-50%, -100%);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 7px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
  z-index: 2;
}

.bars__col:hover .bars__tip,
.bars__col:focus-visible .bars__tip {
  opacity: 1;
  bottom: 100%;
  transform: translate(-50%, -4px);
}

.bars__x {
  position: absolute;
  bottom: -20px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.data-table {
  margin-top: 12px;
  font-size: 13px;
}

.data-table summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 0;
  font-weight: 600;
}

.data-table summary::after {
  content: none;
}

.statelist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.statelist a {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14.5px;
}

.statelist a:hover {
  background: var(--steel);
}

.statelist__bar {
  height: 8px;
  background: var(--steel);
  border-radius: 999px;
  overflow: hidden;
}

.statelist__bar i {
  display: block;
  height: 100%;
  background: var(--ink);
  border-radius: 999px;
}

.todo,
.ledger,
.points-list,
.chips-list,
.assets,
.card__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.todo a {
  display: flex;
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--steel-2);
  text-decoration: none;
}

.todo strong {
  font-family: var(--mono);
  background: var(--tape);
  padding: 0 8px;
  border-radius: 999px;
}

.ledger li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--steel-2);
}

.points-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--steel-2);
}

.points-list small {
  display: block;
  color: var(--muted);
}

.meter {
  height: 8px;
  background: var(--steel);
  border-radius: 999px;
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  background: var(--kraft);
}

.chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips-list li {
  background: var(--steel);
  border-radius: 8px;
  padding: 6px 10px;
}

.chips-list small {
  color: var(--muted);
  margin-left: 4px;
}

.scan__input {
  font-size: 22px !important;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.linkbox {
  display: grid;
  gap: 10px;
}

.linkbox label {
  display: grid;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}

.linkbox input {
  border: 1px solid var(--steel-2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 16px;
  font-family: var(--mono);
}

.linkbox__out {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--ink);
  border-radius: 10px;
  padding: 8px 8px 8px 14px;
}

.linkbox__out output {
  color: var(--tape);
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.linkbox__out .btn--ink {
  background: var(--tape);
  color: var(--ink);
}

.subhead {
  margin-top: 22px;
}

.assets li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--steel-2);
  font-size: 14.5px;
}

.payout {
  display: grid;
  gap: 12px;
  justify-items: start;
  margin-bottom: 12px;
  color: var(--muted);
}

.btn[disabled] {
  cursor: not-allowed;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.filters label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  min-width: 180px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--steel-2);
  border-radius: 14px;
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.card--off {
  opacity: .6;
}

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card__head h2 {
  font-size: 19px;
  font-weight: 800;
}

.card__list li {
  display: grid;
  padding: 6px 0;
  border-top: 1px dashed var(--steel-2);
  font-size: 13.5px;
}

.card__list small {
  color: var(--muted);
}

.chip--card {
  background: var(--steel);
}

.rules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.rule {
  display: grid;
  gap: 10px;
  background: var(--steel);
  border-radius: 12px;
  padding: 16px;
}

.rule h3 {
  font-size: 16px;
  font-weight: 800;
}

.rule label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.inline {
  display: flex;
  gap: 6px;
  align-items: center;
}

.input--small {
  width: 90px !important;
  padding: 7px 9px !important;
  font-size: 14px !important;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .grid-2--wide,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .gate {
    grid-template-columns: 1fr;
  }

  .gate__aside {
    order: 2;
  }

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

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  .side.is-open {
    transform: none;
    box-shadow: 0 0 0 100vmax rgba(16, 21, 28, .45);
  }

  .top__menu {
    display: inline-grid;
  }

  .who__text,
  .top__user .lang {
    display: none;
  }
}

@media (max-width: 560px) {
  .tiles {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

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

  .tile {
    padding: 14px;
  }

  .top {
    flex-wrap: wrap;
  }

  .points-list li {
    grid-template-columns: 1fr auto;
  }

  .points-list .meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

.table-wrap td {
  white-space: nowrap;
}

/* ---- Financial settings ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.billing-intro {
  margin: 0 0 16px;
  max-width: 72ch;
}

.billing-gateways {
  margin-bottom: 20px;
}

.billing-gateways .panel .hint {
  margin: -6px 0 14px;
}

.billing-add {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--steel-2);
  max-width: 640px;
}

.billing-add h3 {
  font-size: 15px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .billing-gateways {
    grid-template-columns: minmax(0, 1fr);
  }
}

.billing-methods td:first-child {
  min-width: 200px;
}

.billing-methods .input--small {
  width: 76px !important;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  margin: 28px 0 12px;
}

.panel__head h3 {
  font-size: 17px;
  font-weight: 800;
}

.panel .form + .form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--steel-2);
}
