.broker-root {
  --font-main:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-family: var(--font-main);
  color: #172033;
  background: #f7f8fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #f7f8fa;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
}

body,
button,
input {
  font-family: var(--font-main);
}

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.broker-frame {
  --navy: #002844;
  --navy-deep: #001e35;
  --navy-side: #012d4d;
  --gold: #c89b2c;
  --red: #c80f16;
  --green: #04763b;
  --ink: #0d1526;
  --muted: #5b6677;
  --line: #d8dee7;
  width: 100vw;
  min-width: 0;
  height: 100vh;
  min-height: 760px;
  display: grid;
  grid-template-columns: 500px minmax(860px, 1fr);
  overflow: hidden;
  background: #f7f8fb;
  color: var(--ink);
}

.broker-frame.login-page,
.broker-frame.dashboard-page {
  grid-template-columns: 1fr;
}

.broker-frame.login-page {
  min-width: 0;
}

.broker-frame.login-page .login-rail {
  border-right: 0;
}

.broker-frame.dashboard-page {
  min-width: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-rail {
  position: relative;
  height: 100vh;
  min-height: 760px;
  overflow: hidden;
  border-top: 2px solid var(--gold);
  border-right: 3px solid var(--gold);
  color: #fff;
  background:
    linear-gradient(180deg, rgba(0, 31, 55, 0.58), rgba(0, 31, 55, 0.86)),
    url('../customs-dark-bg.png') center / cover no-repeat,
    #001f37;
}

.login-rail::before {
  content: '';
  position: absolute;
  inset: 40px -85px auto -85px;
  height: 360px;
  background: url('../customs-emblem-cut.png') center / contain no-repeat;
  opacity: 0.07;
}

.login-center {
  position: absolute;
  z-index: 1;
  top: 84px;
  left: 50%;
  width: 315px;
  margin: 0;
  text-align: center;
  transform: translateX(-50%);
}

.login-emblem {
  width: 185px;
  height: 205px;
  object-fit: contain;
  margin: 0 auto 28px;
  display: block;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.28));
}

.login-center h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.login-subtitle {
  margin: 13px 0 55px;
  color: #e4b640;
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
}

.login-form {
  display: grid;
  gap: 0;
}

.login-form label {
  margin-bottom: 20px;
  font-size: 16px;
  line-height: 1;
  font-weight: 500;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap input {
  width: 100%;
  height: 45px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 4px;
  padding: 0 43px 0 15px;
  color: #fff;
  background: rgba(0, 23, 42, 0.25);
  outline: none;
  font-size: 15px;
}

.login-input-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.66);
}

.login-input-wrap svg {
  position: absolute;
  right: 14px;
  top: 50%;
  color: rgba(255, 255, 255, 0.74);
  transform: translateY(-50%);
}

.inline-icon {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.login-form button {
  height: 47px;
  margin-top: 16px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: linear-gradient(180deg, #e01016, #b9080f);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(112, 0, 5, 0.26);
}

.login-error {
  margin-top: 10px;
  color: #ffb8b8;
  font-size: 13px;
  text-align: left;
}

.login-address {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 114px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 0 38px;
  border-top: 1px solid rgba(201, 155, 44, 0.85);
  background: rgba(0, 31, 55, 0.7);
  font-style: normal;
}

.login-address div {
  display: flex;
  align-items: center;
  gap: 17px;
  color: #fff;
  font-size: 16px;
  line-height: 1.35;
}

.login-address div:last-child {
  justify-self: end;
}

.login-address svg {
  flex: 0 0 auto;
  color: #fff;
}

.portal {
  position: relative;
  height: 100vh;
  min-height: 760px;
  overflow: hidden;
  border-top: 2px solid var(--gold);
  background: #fff;
}

.dashboard-page .portal {
  width: 100vw;
}

.portal-header {
  height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px 0 17px;
  color: #fff;
  background: linear-gradient(180deg, #002844, #001f36);
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
}

.header-left {
  gap: 14px;
}

.menu-button,
.header-right button,
.tracking-card header button,
.product-modal header button {
  border: 0;
  background: transparent;
}

.menu-button {
  width: 34px;
  height: 34px;
  padding: 0;
  color: #fff;
  border-radius: 3px;
  cursor: pointer;
}

.menu-button[aria-expanded='true'],
.menu-button:hover,
.menu-button:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.header-left img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.header-left strong {
  display: block;
  font-size: 22px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0;
}

.header-left span {
  display: block;
  margin-top: 5px;
  color: #e3b63d;
  font-size: 14px;
  line-height: 1;
  font-weight: 800;
}

.header-right {
  gap: 25px;
  font-size: 16px;
  font-weight: 700;
}

.header-right button {
  width: 31px;
  height: 31px;
  padding: 0;
  color: #fff;
}

.portal-body {
  height: calc(100vh - 67px);
  min-height: 693px;
  display: grid;
  grid-template-columns: 0 minmax(0, 1fr);
  transition: grid-template-columns 180ms ease;
}

.portal-body.sidebar-open {
  grid-template-columns: 196px minmax(0, 1fr);
}

.sidebar {
  position: relative;
  min-width: 0;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(0, 37, 65, 0.92), rgba(0, 29, 51, 0.98)),
    url('../customs-dark-bg.png') center / cover no-repeat;
}

.sidebar:not(.open) {
  pointer-events: none;
}

.sidebar-list {
  padding-top: 0;
}

.sidebar button {
  width: 100%;
  height: 49px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 0;
  padding: 0 18px;
  color: #fff;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.sidebar button span {
  white-space: nowrap;
}

.sidebar button.active {
  background: rgba(255, 255, 255, 0.11);
}

.sidebar button:hover,
.sidebar button:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.sidebar button svg {
  color: #fff;
}

.sidebar button em {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #c81824;
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-exit {
  position: absolute;
  left: 0;
  bottom: 0;
}

.dashboard {
  position: relative;
  min-width: 0;
  padding: 12px 22px 28px;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(247, 249, 252, 0.38), rgba(247, 249, 252, 0.24) 54%, rgba(247, 249, 252, 0.08)),
    url('../cabinet-bg.png') left center / cover no-repeat;
  scroll-behavior: smooth;
}

.profile-card {
  height: 110px;
  display: grid;
  grid-template-columns: minmax(260px, 300px) repeat(3, minmax(170px, 1fr));
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 2px rgba(13, 21, 38, 0.04);
  backdrop-filter: blur(2px);
}

.profile-person {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 0 20px;
  border-right: 1px solid var(--line);
}

.profile-person svg {
  flex: 0 0 auto;
  color: #173b63;
}

.profile-person h2 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.profile-label {
  display: block;
  margin-bottom: 9px;
  color: #6d5b20;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
  text-transform: uppercase;
}

.metric {
  display: grid;
  align-content: center;
  justify-items: center;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  color: #0d1526;
  font-size: 14px;
  line-height: 1;
}

.metric strong {
  margin-top: 15px;
  color: var(--green);
  font-size: 23px;
  line-height: 1;
  font-weight: 850;
}

.metric small {
  margin-top: 9px;
  color: #0d1526;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 344px) minmax(420px, 1fr);
  gap: 24px;
  margin-top: 12px;
}

.broker-root[data-page='tracking'] .workspace {
  grid-template-columns: minmax(0, 760px);
}

.broker-root[data-page='epts'] #trackingPanel,
.broker-root[data-page='tracking'] #eptsPanel {
  display: none;
}

.card {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 2px rgba(13, 21, 38, 0.03);
  backdrop-filter: blur(2px);
}

.card h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 850;
}

.epts-card {
  min-height: 278px;
  padding: 18px 14px;
  scroll-margin-top: 12px;
}

.epts-card h2 {
  padding: 0 0 18px;
  font-size: 31px;
  text-transform: uppercase;
}

.section-label {
  margin: 0 0 10px;
  color: #6d5b20;
  font-size: 13px;
  line-height: 1;
  font-weight: 850;
  text-transform: uppercase;
}

.epts-card form {
  display: grid;
  gap: 13px;
  padding: 0;
}

.epts-card input,
.tracking-code-row input {
  height: 40px;
  border: 1px solid #cfd6df;
  border-radius: 3px;
  padding: 0 14px;
  color: #1d2737;
  background: #fff;
  outline: none;
  font-size: 13px;
}

.epts-card input::placeholder {
  color: #9ba3ae;
}

.epts-card form button {
  height: 40px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: linear-gradient(180deg, #003861, #002845);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

.panel-error {
  margin: 10px 0 0;
  color: #b40c17;
  font-size: 13px;
  font-weight: 750;
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 21px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  background: transparent;
}

.status.valid {
  color: #167348;
  background: #dff2e8;
}

.status.pending {
  color: #a36700;
  background: #fff0c8;
}

.status.invalid {
  color: #b40c17;
  background: #ffe2df;
}

.tracking-card {
  min-height: 278px;
  padding: 14px 14px 16px;
  scroll-margin-top: 12px;
}

.tracking-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.tracking-code-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) 42px;
  align-items: center;
  gap: 8px;
  margin-bottom: 13px;
}

.tracking-code-row label {
  color: #6b7280;
  font-size: 19px;
}

.tracking-code-row input {
  height: 29px;
  border: 0;
  padding: 0;
  color: #121b2c;
  font-size: 20px;
  font-weight: 850;
  background: transparent;
}

.tracking-code-row button {
  width: 42px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #174878;
  border-radius: 3px;
  color: #174878;
  background: #fff;
}

.tracking-result {
  display: grid;
  gap: 14px;
}

.transport-summary {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfd;
}

.transport-summary img,
.transport-image-error {
  width: 176px;
  height: 106px;
  border-radius: 4px;
}

.transport-summary img {
  object-fit: cover;
}

.transport-image-error {
  display: grid;
  place-items: center;
  border: 1px dashed #cfd6df;
  color: #7b8491;
  background: #f2f5f8;
  font-size: 14px;
  font-weight: 850;
}

.transport-summary span {
  display: block;
  margin-bottom: 8px;
  color: #6a7483;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.transport-summary strong {
  color: #0d1526;
  font-size: 17px;
  line-height: 1.25;
}

.tracking-statuses {
  display: grid;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  list-style: none;
  overflow: hidden;
}

.tracking-statuses li {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 16px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f4;
  font-size: 14px;
}

.tracking-statuses li:last-child {
  border-bottom: 0;
}

.tracking-statuses time {
  color: #6d5b20;
  font-weight: 850;
}

.tracking-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed #cfd6df;
  border-radius: 4px;
  color: #677386;
  font-size: 14px;
  text-align: center;
}

.product-modal {
  position: fixed;
  z-index: 20;
  left: 340px;
  bottom: 35px;
  width: min(865px, calc(100vw - 380px));
  height: 315px;
  border: 1px solid #9ba7b5;
  border-radius: 4px;
  color: #0d1526;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 26px rgba(13, 21, 38, 0.16);
  backdrop-filter: blur(2px);
}

.product-modal > header {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px 0 13px;
  border-bottom: 1px solid var(--line);
}

.product-modal > header h2 {
  margin: 0;
  font-size: 13px;
  line-height: 1;
  font-weight: 850;
}

.product-modal > header button {
  width: 24px;
  height: 24px;
  padding: 0;
  color: #1d2737;
}

.modal-grid {
  display: grid;
  grid-template-columns: 255px 1fr 1fr;
  gap: 22px;
  padding: 12px 15px 0;
}

.modal-photo h3,
.modal-info-column h3 {
  margin: 0 0 9px;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
}

.modal-photo > img {
  width: 235px;
  height: 137px;
  display: block;
  object-fit: cover;
  border-radius: 4px;
}

.modal-photo .image-error {
  width: 235px;
  height: 137px;
  display: grid;
  place-items: center;
  border: 1px dashed #cfd6df;
  border-radius: 4px;
  color: #7b8491;
  background: #f2f5f8;
  font-size: 16px;
  font-weight: 850;
  text-transform: uppercase;
}

.modal-info-column {
  min-width: 0;
}

.modal-info-column + .modal-info-column {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.modal-info-column dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.modal-info-column div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.modal-info-column dt,
.modal-info-column dd {
  margin: 0;
  font-size: 11px;
  line-height: 1.1;
}

.modal-info-column dt {
  color: #5d6877;
}

.modal-info-column dd {
  color: #101829;
  font-weight: 650;
}

.product-modal footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 42px;
  display: grid;
  grid-template-columns: 275px 125px 1fr 94px;
  align-items: center;
  gap: 15px;
  padding: 0 15px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.product-modal footer > span:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.product-modal footer > span:nth-child(2) {
  color: #5d6877;
}

.product-modal footer strong {
  font-size: 12px;
}

.product-modal footer button {
  height: 28px;
  border: 1px solid #174878;
  border-radius: 3px;
  color: #174878;
  background: #fff;
  font-size: 12px;
  font-weight: 750;
}

@media (max-width: 1180px) {
  .profile-card {
    grid-template-columns: 1fr 1fr;
    height: auto;
  }

  .profile-person,
  .metric {
    min-height: 96px;
    border-bottom: 1px solid var(--line);
  }

  .metric:nth-child(3),
  .metric:nth-child(4) {
    border-bottom: 0;
  }

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

  .product-modal {
    left: 220px;
    width: calc(100vw - 250px);
  }
}

@media (max-width: 820px) {
  .broker-frame {
    min-width: 0;
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .login-rail {
    height: auto;
    min-height: 720px;
    border-right: 0;
    border-bottom: 3px solid var(--gold);
  }

  .portal {
    height: auto;
    min-height: 900px;
    overflow: visible;
  }

  .portal-body {
    height: auto;
    grid-template-columns: 1fr;
    transition: none;
  }

  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: block;
    min-height: 0;
    border-bottom: 1px solid rgba(227, 182, 61, 0.45);
  }

  .sidebar.open .sidebar-list {
    padding-top: 6px;
  }

  .sidebar.open .sidebar-exit {
    position: static;
    margin-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
  }

  .dashboard {
    overflow: visible;
    padding: 14px;
  }

  .profile-card,
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .profile-person,
  .metric {
    min-height: 92px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .product-modal {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    height: min(78vh, 680px);
    overflow: auto;
  }

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

  .modal-photo > img,
  .modal-photo .image-error {
    width: 100%;
    height: 190px;
  }

  .modal-info-column + .modal-info-column {
    padding-left: 0;
    border-left: 0;
  }

  .product-modal footer {
    position: static;
    grid-template-columns: 1fr;
    height: auto;
    gap: 8px;
    padding: 12px 15px;
  }
}

@media (max-width: 560px) {
  .login-center {
    top: 64px;
    width: min(315px, calc(100vw - 40px));
  }

  .login-emblem {
    width: 155px;
    height: 175px;
  }

  .login-center h1 {
    font-size: 21px;
  }

  .login-address {
    height: auto;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px 24px;
  }

  .login-address div:last-child {
    justify-self: start;
  }

  .portal-header {
    height: auto;
    min-height: 67px;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
  }

  .header-left strong {
    font-size: 18px;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .profile-card {
    grid-template-columns: 1fr;
  }

  .profile-person,
  .metric,
  .metric:nth-child(3),
  .metric:nth-child(4) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .transport-summary {
    grid-template-columns: 1fr;
  }

  .transport-summary img,
  .transport-image-error {
    width: 100%;
    height: 180px;
  }

  .tracking-statuses li {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.broker-root[data-page='epts'] .workspace {
  grid-template-columns: minmax(340px, 520px) minmax(560px, 1fr);
  align-items: start;
}

.broker-root[data-page='epts'] .product-modal {
  position: static;
  z-index: auto;
  width: auto;
  height: auto;
  min-height: 315px;
  box-shadow: 0 1px 2px rgba(13, 21, 38, 0.03);
}

.broker-root[data-page='epts'] .modal-grid {
  grid-template-columns: 235px minmax(0, 1fr) minmax(0, 1fr);
  padding-bottom: 0;
}

.broker-root[data-page='epts'] .product-modal footer {
  position: static;
  grid-template-columns: auto 105px minmax(0, 1fr) 94px;
  height: auto;
  min-height: 42px;
  margin-top: 12px;
  padding: 10px 15px;
}

@media (max-width: 1180px) {
  .broker-root[data-page='epts'] .workspace {
    grid-template-columns: 1fr;
  }

  .broker-root[data-page='epts'] .modal-grid {
    grid-template-columns: 1fr;
  }
}
