:root {
  --ux-deep: #064b5d;
  --ux-teal: #087b99;
  --ux-coral: #f1463f;
  --ux-paper: #f4f8f9;
  --ux-surface: #ffffff;
  --ux-line: #d7e3e7;
  --ux-ink: #102a33;
  --ux-muted: #637a83;
}

.brand .colibri-mark,
.brand .colibri-mark b {
  display: flex;
}

.brand .colibri-mark {
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.brand .colibri-mark b {
  color: var(--ux-deep);
  font-style: italic;
  letter-spacing: .06em;
  white-space: nowrap;
}

.health {
  min-width: max-content;
}

.health.has-errors .health-dot {
  background: var(--ux-coral);
  box-shadow: 0 0 0 4px rgb(241 70 63 / 12%);
}

.fact-grid > div {
  min-width: 0;
}

.detail .fact-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.fact-grid b {
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.3;
}

.fact-deadline,
.fact-amount,
.row-side,
.health b {
  font-variant-numeric: tabular-nums;
}

.decision-bar button,
.tabs button,
.country-filter button,
.queue,
.glossary-button,
.language button,
.avatar,
.icon-button {
  min-height: 44px;
}

.row-title,
.row-meta {
  overflow-wrap: anywhere;
  word-break: normal;
}

.row-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.row-facts i {
  display: inline-flex;
  max-width: 100%;
  padding: 3px 6px;
  overflow: hidden;
  border: 1px solid #c9dfe5;
  background: #f2f8f9;
  color: var(--ux-deep);
  font-size: 10px;
  font-style: normal;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tender-brief {
  margin-bottom: 18px;
  border: 1px solid var(--ux-line);
  background: linear-gradient(145deg, #ffffff 0%, #f1f8f9 100%);
}

.tender-brief > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--ux-line);
}

.tender-brief h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.brief-kicker,
.brief-status {
  color: var(--ux-teal);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .14em;
}

.brief-status {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid #afd4de;
  background: #e7f4f6;
  letter-spacing: .06em;
}

.brief-content {
  padding: 18px;
}

.brief-summary {
  max-width: 950px;
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.55;
}

.brief-core {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--ux-line);
  background: var(--ux-line);
}

.brief-core > div {
  min-width: 0;
  padding: 12px;
  background: #ffffff;
}

.brief-core span,
.brief-core b {
  display: block;
}

.brief-core span,
.brief-groups h4 {
  color: var(--ux-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.brief-core b {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.45;
}

.brief-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.brief-groups section {
  min-width: 0;
  padding: 13px;
  border-left: 3px solid var(--ux-teal);
  background: #ffffff;
}

.brief-groups h4 {
  margin: 0 0 8px;
  color: var(--ux-deep);
}

.brief-groups ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
}

.brief-groups li {
  font-size: 13px;
  line-height: 1.45;
}

.brief-groups li small {
  display: block;
  margin-top: 3px;
  color: var(--ux-muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.brief-content footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ux-line);
  color: var(--ux-muted);
  font-size: 10px;
}

.brief-loading {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  color: var(--ux-muted);
  font-size: 12px;
}

.brief-loading i {
  display: block;
  width: 100%;
  height: 9px;
  background: linear-gradient(90deg, #e2ecef, #f8fbfb, #e2ecef);
  background-size: 220% 100%;
  animation: brief-loading 1.2s linear infinite;
}

.brief-loading i:nth-child(2) { width: 83%; }
.brief-loading i:nth-child(3) { width: 62%; }
.brief-unavailable { margin: 0; color: var(--ux-muted); }

.glossary-item {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
  gap: 8px !important;
}

.glossary-term {
  display: grid !important;
  gap: 3px;
  min-width: 0;
}

.glossary-term small {
  color: var(--ux-teal) !important;
  font-size: 9px !important;
  font-weight: 800;
  letter-spacing: .12em;
}

.glossary-term b {
  overflow-wrap: anywhere;
}

.glossary-ai {
  margin: 12px 0;
  padding: 16px;
  border-left: 4px solid var(--ux-teal);
  background: #eaf5f7;
}

.glossary-ai header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.glossary-ai header span {
  padding: 3px 5px;
  background: var(--ux-deep);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.glossary-ai header small { margin-left: auto; color: var(--ux-muted); }
.glossary-ai h3 { margin: 13px 0 5px; font-size: 19px; }
.glossary-ai p { margin: 0; line-height: 1.5; }
.glossary-ai > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.glossary-ai i { padding: 4px 7px; background: #fff; font-size: 11px; font-style: normal; }
.glossary-ai.loading { color: var(--ux-muted); animation: brief-loading 1.2s ease-in-out infinite alternate; }

@keyframes brief-loading {
  to { background-position: -220% 0; }
}

.mobile-detail-back {
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid var(--ux-line);
  background: var(--ux-surface);
  color: var(--ux-teal);
  font: inherit;
  font-weight: 700;
  text-align: left;
}

@media (max-width: 1500px) {
  .detail .fact-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail .fact-grid > div {
    padding: 14px 16px;
    border-bottom: 1px solid var(--ux-line);
  }

  .detail .fact-grid > div:nth-child(3n) {
    border-right: 0;
  }

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

  .decision-bar .primary {
    grid-column: 1 / -1;
  }
}

@media (min-width: 701px) and (max-width: 1200px) {
  html,
  body,
  .app {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(140px, 1fr) auto auto;
    grid-template-rows: 54px 50px;
    width: 100%;
    height: 104px;
    padding: 0 16px;
    gap: 0 12px;
  }

  .brand {
    grid-column: 1 / 3;
    grid-row: 1;
    min-width: 0;
  }

  .brand > img { width: 150px; }
  .language { grid-column: 3; grid-row: 1; }
  .avatar { grid-column: 4; grid-row: 1; }
  .global-search { grid-column: 1 / 3; grid-row: 2; width: 100%; max-width: none; margin: 0; }
  .glossary-button { grid-column: 3; grid-row: 2; }
  .health { grid-column: 4; grid-row: 2; }

  .workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 68px minmax(0, 1fr);
    width: 100%;
    height: calc(100dvh - 104px);
    overflow: hidden;
  }

  .queues {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .tender-list {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
    overflow: hidden;
  }

  .detail {
    min-width: 0;
  }
}

@media (max-width: 1200px) {
  .app {
    min-height: 100dvh;
  }

  .queues {
    display: flex;
    width: 100%;
    min-height: 68px;
    padding: 8px 10px;
    gap: 7px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    background: var(--ux-deep);
  }

  .queue-caption,
  .source-summary {
    display: none !important;
  }

  .queue {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    flex: 0 0 158px;
    min-width: 158px;
    height: 50px;
    padding: 0 10px;
    gap: 7px;
    align-items: center;
    scroll-snap-align: start;
    border: 1px solid rgb(255 255 255 / 16%);
    color: #ffffff;
  }

  .queue > span:not(.queue-symbol) {
    display: block !important;
    overflow: hidden;
    color: inherit;
    font-size: 12px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: normal;
  }

  .queue b {
    position: static;
    min-width: 24px;
    padding: 3px 5px;
    border-radius: 999px;
    background: rgb(255 255 255 / 14%);
    color: #ffffff;
    font-size: 11px;
    text-align: center;
  }

  .queue.active {
    border-color: #ffffff;
    background: rgb(255 255 255 / 16%);
  }

  .country-filter {
    display: flex;
    gap: 7px;
    padding-bottom: 7px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: x proximity;
  }

  .country-filter button {
    flex: 0 0 auto;
    min-width: 72px;
    scroll-snap-align: start;
  }

  .tender-row {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    min-height: 104px;
    gap: 10px;
  }

  .tender-row > span:nth-child(2) {
    min-width: 0;
  }

  body.mobile-detail-open {
    overflow: hidden;
  }

  body.mobile-detail-open .detail {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: block !important;
    width: 100%;
    height: 100dvh;
    overflow-y: auto;
    background: var(--ux-surface);
  }

  body.mobile-detail-open .mobile-detail-back {
    position: sticky;
    top: 0;
    z-index: 5;
    display: block;
    width: 100%;
  }

  .detail-scroll {
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .topbar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    min-height: 0;
    height: auto !important;
    padding: max(9px, env(safe-area-inset-top)) 10px 9px;
    gap: 8px;
    align-items: center;
    background: var(--ux-surface);
  }

  .brand {
    grid-column: 1 / 3;
    grid-row: 1;
    min-width: 0;
    gap: 8px;
  }

  .brand > img {
    width: 112px;
    max-width: 42vw;
    height: auto;
  }

  .brand .colibri-mark {
    display: flex !important;
    min-width: 78px;
    padding-left: 8px;
  }

  .brand .colibri-mark img {
    display: block !important;
    width: 23px;
    height: 23px;
  }

  .brand .colibri-mark b {
    display: block !important;
    font-size: 13px;
  }

  .avatar {
    grid-column: 3;
    grid-row: 1;
    width: 44px;
    height: 44px;
  }

  .global-search {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid !important;
    width: 100%;
    min-height: 48px;
  }

  .global-search input {
    display: block !important;
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding-right: 42px;
    font-size: 16px;
  }

  .global-search kbd {
    display: none;
  }

  .health {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    min-height: 44px;
    padding: 0 6px;
    font-size: 12px;
  }

  .language {
    grid-column: 2;
    grid-row: 3;
    justify-self: center;
  }

  .glossary-button {
    grid-column: 3;
    grid-row: 3;
    justify-self: end;
    min-width: 82px;
    padding-inline: 10px;
    font-size: 12px;
  }

  .queues {
    min-height: 66px;
    padding-inline: 8px;
  }

  .queue {
    flex-basis: 140px;
    min-width: 140px;
  }

  .list-header {
    min-height: 66px;
    padding: 11px 12px;
  }

  .list-header h1 {
    font-size: 24px;
  }

  .country-filter {
    padding: 8px 10px;
  }

  .tender-row {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 13px 11px;
  }

  .tender-row .country-code {
    width: 40px;
  }

  .tender-row .row-side {
    grid-column: 2;
    text-align: left;
  }

  .row-title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .row-meta {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .detail-scroll {
    padding: 0 14px 24px;
  }

  .detail-head,
  .detail-title,
  .detail-buyer {
    margin-inline: 0;
  }

  .detail-title {
    font-size: 25px;
    line-height: 1.18;
  }

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

  .detail .fact-grid > div:nth-child(1),
  .detail .fact-grid > div:nth-child(2) {
    grid-column: 1 / -1;
  }

  .tabs {
    position: sticky;
    top: 48px;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: var(--ux-surface);
  }

  .tabs button {
    min-width: 0;
    padding-inline: 4px;
    font-size: 12px;
  }

  .state-fields,
  .decision-bar {
    grid-template-columns: 1fr;
  }

  .brief-core,
  .brief-groups {
    grid-template-columns: 1fr;
  }

  .brief-content,
  .tender-brief > header {
    padding: 14px;
  }

  .brief-content footer {
    display: grid;
  }

  .decision-bar .primary {
    grid-column: auto;
  }

  .state-fields input,
  .state-fields select,
  .note-field textarea,
  .glossary-panel input {
    font-size: 16px;
  }

  .glossary-panel {
    inset: 0;
    width: 100%;
    max-width: none;
    height: 100dvh;
  }
}

@media (max-width: 360px) {
  .brand > img {
    width: 96px;
  }

  .brand .colibri-mark {
    padding-left: 5px;
  }

  .brand .colibri-mark b {
    font-size: 12px;
  }

  .health span[data-i18n="sources"] {
    display: none;
  }

  .glossary-button {
    min-width: 74px;
    padding-inline: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}
