:root {
  --bg-base: #eef4ff;
  --bg-accent: #dce9ff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --line: rgba(44, 80, 141, 0.12);
  --text-main: #14213d;
  --text-soft: #60708f;
  --brand: #2563eb;
  --brand-deep: #1d4ed8;
  --shadow: 0 24px 60px rgba(30, 64, 175, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(14, 165, 233, 0.16), transparent 22%),
    linear-gradient(180deg, #f7faff 0%, var(--bg-base) 48%, var(--bg-accent) 100%);
}

.page-shell {
  width: min(1920px, 98.75vw);
  margin: 0 auto;
  padding: 16px 0;
}

.app-layout {
  display: grid;
  grid-template-columns: 376px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar {
  display: grid;
  grid-template-rows: minmax(320px, auto) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  align-items: start;
  align-self: start;
  padding-inline: 6px;
}

.content-area {
  min-width: 0;
}

.panel,
.table-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.panel,
.table-panel {
  padding: 20px;
}

.panel-query {
  display: flex;
  flex-direction: column;
  height: auto;
  min-height: 320px;
  overflow: visible;
  padding-bottom: 22px;
}

.panel-filter {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: visible;
  flex: 1 1 auto;
}

.panel-summary-filter {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: visible;
  flex: 1 1 auto;
}

.table-panel {
  height: calc(100vh - 32px);
  min-height: calc(100vh - 32px);
  overflow: hidden;
}

.panel-head,
.table-head {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.panel-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel-query h2,
.panel-query .panel-badge {
  display: none;
}

.panel-query .panel-kicker {
  margin-bottom: 0;
  font-size: 18px;
}

.panel-head h2,
.table-head h2 {
  margin: 0;
  font-size: 22px;
}

.panel-filter .panel-head h2 {
  font-size: 18px;
}

.panel-summary-filter .panel-head h2 {
  font-size: 18px;
}

.summary-clear-button {
  min-width: 58px;
  color: #475569;
  background: rgba(255, 255, 255, 0.9);
}

.summary-clear-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.confirm-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.confirm-dialog::backdrop {
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(3px);
}

.confirm-dialog-card {
  width: min(420px, calc(100vw - 32px));
  margin: 0;
  padding: 24px 24px 20px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.confirm-dialog-card h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 20px;
}

.confirm-dialog-message {
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.confirm-dialog-actions .primary-button {
  min-width: 92px;
}

.workbench-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.workbench-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.workbench-unlock-field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--text-main);
  font-weight: 700;
}

.workbench-unlock-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
}

.workbench-unlock-field input:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.workbench-unlock-error {
  min-height: 20px;
  margin: 8px 0 0;
  color: #c2413b;
  font-size: 13px;
}

.carrier-timeliness-dialog {
  border: 0;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden;
  padding: 0;
  background: transparent;
}

.carrier-timeliness-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
}

.carrier-timeliness-card {
  width: min(1600px, calc(100vw - 24px));
  height: min(92vh, 980px);
  padding: 24px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

.carrier-timeliness-head,
.carrier-timeliness-details-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.carrier-timeliness-head h3,
.carrier-timeliness-details-head h4 {
  margin: 0;
  color: var(--text-main);
}

.carrier-timeliness-head h3 {
  font-size: 24px;
}

.carrier-timeliness-subtitle {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.carrier-timeliness-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.08);
  border-radius: 18px;
  background: #f8fbff;
}

.carrier-timeliness-country-filter {
  position: relative;
}

.carrier-timeliness-country-filter > button {
  min-width: 150px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 10px;
  background: #fff;
  color: var(--text-main);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.carrier-timeliness-country-filter > button.active {
  border-color: rgba(37, 99, 235, 0.34);
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-deep);
}

.carrier-timeliness-country-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(760px, calc(100vw - 64px));
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
}

.carrier-timeliness-country-popover input[type="search"] {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 10px;
  background: #fff;
  color: var(--text-main);
}

.carrier-timeliness-country-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(37, 99, 235, 0.08);
}

.carrier-timeliness-country-actions button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 9px;
  background: #f8fbff;
  color: var(--text-main);
  cursor: pointer;
}

.carrier-timeliness-country-actions span {
  margin-left: auto;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}

.carrier-timeliness-country-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 34px;
  gap: 4px 4px;
  max-height: 376px;
  margin-top: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.carrier-timeliness-country-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--text-main);
  font-size: 13px;
  cursor: pointer;
}

.carrier-timeliness-country-option:hover {
  background: rgba(37, 99, 235, 0.06);
}

.carrier-timeliness-country-option input {
  flex: 0 0 auto;
}

.carrier-timeliness-country-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carrier-timeliness-country-empty {
  grid-column: 1 / -1;
  padding: 24px 8px;
  color: var(--text-soft);
  text-align: center;
}

.carrier-timeliness-scheme-controls {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
}

.carrier-timeliness-scheme-controls button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 10px;
  background: #fff;
  color: var(--text-main);
  cursor: pointer;
}

.carrier-timeliness-scheme-controls button.active {
  border-color: rgba(37, 99, 235, 0.34);
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand-deep);
}

.carrier-timeliness-summary {
  flex: 1 1 auto;
  color: var(--text-soft);
  font-size: 13px;
}

.carrier-timeliness-table-wrap,
.carrier-timeliness-details-table-wrap {
  overflow: auto;
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 18px;
}

.carrier-timeliness-table-wrap {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 220px;
}

.carrier-timeliness-table {
  min-width: 2100px;
}

.carrier-timeliness-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fbff;
}

.carrier-timeliness-table th button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.carrier-timeliness-table th button::after {
  content: " ↕";
  color: var(--text-soft);
}

.carrier-timeliness-table th button.sort-asc::after {
  content: " ↑";
  color: var(--brand);
}

.carrier-timeliness-table th button.sort-desc::after {
  content: " ↓";
  color: var(--brand);
}

.carrier-timeliness-table tbody tr[data-carrier-name] {
  cursor: pointer;
}

.carrier-timeliness-table tbody tr.selected {
  background: rgba(37, 99, 235, 0.08);
}

.carrier-timeliness-table .empty-row td {
  padding: 48px 20px;
  text-align: left;
}

.carrier-timeliness-bucket-value {
  white-space: nowrap;
}

.carrier-timeliness-bucket-value span {
  color: var(--text-soft);
}

.carrier-timeliness-score,
.carrier-timeliness-tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.carrier-timeliness-score {
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand-deep);
}

.carrier-timeliness-tag {
  background: rgba(20, 33, 61, 0.06);
  color: var(--text-main);
}

.carrier-timeliness-details {
  flex: 0 0 auto;
  padding-top: 14px;
  border-top: 1px solid rgba(37, 99, 235, 0.1);
}

.carrier-timeliness-details-head {
  align-items: center;
  margin-bottom: 10px;
}

.carrier-timeliness-details-table-wrap {
  max-height: 230px;
}

.carrier-timeliness-details-table-wrap table {
  min-width: 840px;
}

.carrier-timeliness-details-table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fbff;
}

.timeliness-bucket-settings-dialog {
  border: 0;
  max-width: 100vw;
  max-height: 100vh;
  overflow: hidden;
  padding: 0;
  background: transparent;
}

.timeliness-bucket-settings-dialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
}

.timeliness-bucket-settings-card {
  width: min(760px, calc(100vw - 24px));
  max-height: min(88vh, 900px);
  padding: 24px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeliness-bucket-settings-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.timeliness-bucket-settings-head h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 22px;
}

.timeliness-bucket-settings-head p:not(.panel-kicker) {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 13px;
}

.timeliness-bucket-editor {
  min-height: 120px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 4px;
}

.timeliness-bucket-editor-row {
  display: grid;
  grid-template-columns: 42px minmax(110px, 1fr) minmax(110px, 1fr) minmax(120px, 1fr) 74px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 14px;
  background: #f8fbff;
}

.timeliness-bucket-editor-index {
  align-self: center;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.timeliness-bucket-editor-field {
  display: grid;
  gap: 5px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.timeliness-bucket-editor-field input,
.timeliness-bucket-editor-field select {
  width: 100%;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 9px;
  background: #fff;
  color: var(--text-main);
}

.timeliness-bucket-delete {
  min-height: 36px;
  border: 1px solid rgba(220, 38, 38, 0.16);
  border-radius: 9px;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
}

.timeliness-bucket-editor-tools,
.timeliness-bucket-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.timeliness-bucket-settings-actions {
  justify-content: flex-end;
}

.timeliness-bucket-error {
  min-height: 20px;
  margin: 0;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.5;
}

.workbench-card {
  width: min(1120px, calc(100vw - 28px));
  height: min(88vh, 940px);
  padding: 24px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(15, 23, 42, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.workbench-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.workbench-head h3 {
  margin: 0;
  font-size: 24px;
  color: var(--text-main);
}

.workbench-subtitle {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.workbench-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.08);
  border-radius: 18px;
  background: #f8fbff;
}

.workbench-status {
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
}

.workbench-toolbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.workbench-body {
  flex: 1 1 auto;
  overflow: auto;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 16px;
  padding-right: 6px;
}

.workbench-empty {
  padding: 32px 20px;
  text-align: center;
  border: 1px dashed rgba(37, 99, 235, 0.14);
  border-radius: 18px;
  color: var(--text-soft);
  background: rgba(248, 250, 252, 0.9);
}

.workbench-carrier {
  border: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 22px;
  background: #ffffff;
  overflow: hidden;
}

.workbench-carrier-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 18px 14px;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.88), rgba(255, 255, 255, 0.98));
  border-bottom: 1px solid rgba(37, 99, 235, 0.08);
}

.workbench-carrier-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.workbench-carrier-title h4 {
  margin: 0;
  font-size: 20px;
}

.workbench-code {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
}

.workbench-carrier-meta {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
}

.workbench-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.workbench-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(20, 33, 61, 0.06);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
}

.workbench-switch input {
  width: 16px;
  height: 16px;
}

.workbench-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.workbench-block {
  border: 1px solid rgba(37, 99, 235, 0.08);
  border-radius: 18px;
  padding: 16px;
  background: rgba(248, 250, 252, 0.76);
}

.workbench-block.block-full {
  grid-column: 1 / -1;
}

.workbench-block h5 {
  margin: 0;
  font-size: 16px;
}

.workbench-block-tip {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.workbench-block-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.7;
}

.workbench-fields {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.workbench-field {
  display: grid;
  gap: 6px;
}

.workbench-field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.workbench-field small {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.5;
}

.workbench-field input,
.workbench-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 14px;
  background: #fff;
  color: var(--text-main);
  font: inherit;
  outline: none;
}

.workbench-field textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.6;
}

.workbench-field input:focus,
.workbench-field textarea:focus {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.panel-filter .panel-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel-filter .panel-head .panel-kicker {
  order: 2;
  margin-bottom: 0;
  font-size: 12px;
}

.panel-filter .panel-head h2 {
  order: 1;
}

.panel-summary-filter .panel-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel-summary-filter .panel-head .panel-kicker {
  order: 2;
  margin-bottom: 0;
  font-size: 12px;
}

.panel-summary-filter .panel-head h2 {
  order: 1;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-badge,
.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.panel-badge {
  background: rgba(20, 33, 61, 0.06);
  color: var(--text-soft);
}

#active-filter-text {
  display: none;
}

.query-form {
  display: flex;
  flex-direction: column;
  flex: initial;
  min-height: auto;
  margin-top: 14px;
  height: auto;
}

.tracking-input-wrap {
  position: relative;
}

.query-form textarea {
  width: 100%;
  min-height: 168px;
  flex: initial;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  color: var(--text-main);
  font: inherit;
  font-size: 14px;
  line-height: 1.75;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.query-form textarea:focus {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}

.tracking-count {
  position: absolute;
  right: 14px;
  bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(20, 33, 61, 0.06);
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
}

.input-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.query-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 14px;
}

.query-actions button {
  flex: 1 1 50%;
  min-width: 0;
}

button {
  border: 0;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(29, 78, 216, 0.16);
}

button:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}

.secondary-button {
  color: var(--brand-deep);
  background: rgba(37, 99, 235, 0.1);
}

.ghost-button {
  color: var(--text-main);
  background: rgba(20, 33, 61, 0.06);
}

.ghost-button-inline {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: none;
}

.ghost-button-inline:hover {
  box-shadow: none;
}

.helper-text {
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  margin-top: 12px;
  width: 100%;
  flex: 0 1 auto;
  min-height: auto;
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.summary-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  flex: 0 0 calc(33.333% - 4px);
  width: calc(33.333% - 4px);
  max-width: calc(33.333% - 4px);
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(37, 99, 235, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-main);
  text-align: left;
  box-shadow: none;
}

.status-chip:hover {
  border-color: rgba(37, 99, 235, 0.2);
}

.status-chip.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.status-chip-label,
.status-chip-count {
  font-weight: 700;
  font-size: 11px;
}

.status-chip-label {
  min-width: 0;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip-count {
  min-width: auto;
  flex: 0 0 auto;
  text-align: left;
  opacity: 0.88;
}

.summary-chip {
  min-height: 31px;
  padding-inline: 10px;
  width: 100%;
  max-width: 100%;
}

.panel-filter .status-filters .status-chip {
  min-height: 28px;
  padding-inline: 7px;
  gap: 5px;
}

.panel-filter .status-chip-label,
.panel-filter .status-chip-count {
  font-size: 12px;
}

.panel-filter .status-chip:not(.active) .status-chip-label {
  color: var(--text-main);
}

.panel-filter .status-chip:not(.active) .status-chip-count {
  color: #6b7280;
}

.panel-filter .status-chip-count {
  min-width: auto;
  flex-basis: auto;
}

.panel-summary-filter .status-filters .status-chip {
  flex: initial;
  padding-inline: 8px;
}

.panel-summary-filter .status-chip-label,
.panel-summary-filter .status-chip-count {
  font-size: 12px;
}

.panel-summary-filter .status-chip:not(.active) .status-chip-label {
  color: var(--text-main);
}

.panel-summary-filter .status-chip:not(.active) .status-chip-count {
  color: #6b7280;
}

.table-panel {
  display: flex;
  flex-direction: column;
}

.table-head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.table-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.result-badge {
  min-height: 36px;
}

.summary-action-button {
  min-width: 88px;
  color: var(--brand-deep);
  background: rgba(37, 99, 235, 0.1);
}

#result-badge {
  display: none;
}

.export-button {
  min-width: 72px;
}

.config-workbench-button {
  min-width: 104px;
}

.summary-action-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.summary-action-button.is-hidden {
  display: none;
}

.table-summary {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.7;
}

.carrier-filter-th {
  overflow: visible;
}

thead th.carrier-filter-th {
  z-index: 20;
}

.carrier-filter-heading {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.carrier-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  box-shadow: none;
  cursor: pointer;
  transform: none;
}

.carrier-filter-button:hover,
.carrier-filter-button.is-open {
  border-color: rgba(37, 99, 235, 0.16);
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-deep);
  box-shadow: none;
  transform: none;
}

.carrier-filter-button.has-active-filter {
  background: rgba(37, 99, 235, 0.14);
  color: var(--brand-deep);
}

.carrier-filter-button:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 1px;
}

.carrier-filter-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.six-dot-icon {
  display: grid;
  grid-template-columns: repeat(2, 3px);
  grid-template-rows: repeat(3, 3px);
  gap: 2px;
}

.six-dot-icon span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
}

.carrier-filter-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 8px;
  z-index: 30;
  width: max-content;
  min-width: 190px;
  max-width: 260px;
  padding: 10px;
  border: 1px solid rgba(20, 33, 61, 0.14);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(20, 33, 61, 0.16);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}

.carrier-filter-popover[hidden] {
  display: none;
}

.carrier-filter-menu-title {
  margin-bottom: 7px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.carrier-filter-options {
  display: grid;
  gap: 4px;
}

.carrier-filter-option {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 5px 7px;
  border-radius: 6px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
}

.carrier-filter-option:hover {
  background: rgba(37, 99, 235, 0.07);
}

.carrier-filter-option input {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--brand);
}

.carrier-filter-option em {
  color: var(--text-soft);
  font-style: normal;
  font-weight: 700;
}

.neutral {
  background: rgba(20, 33, 61, 0.08);
  color: var(--text-soft);
}

.success {
  background: rgba(15, 159, 110, 0.14);
  color: #0b7a54;
}

.warning {
  background: rgba(217, 119, 6, 0.14);
  color: #a55e08;
}

.danger {
  background: rgba(220, 38, 38, 0.14);
  color: #b91c1c;
}

.info {
  background: rgba(37, 99, 235, 0.14);
  color: var(--brand-deep);
}

.table-wrap {
  margin-top: 18px;
  flex: 1 1 auto;
  height: calc(100vh - 220px);
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
}

.table-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-top: 14px;
}

.pagination-summary {
  color: var(--text-soft);
  font-size: 13px;
}

.pagination-controls,
.pagination-nav,
.pagination-pages,
.page-size-control {
  display: flex;
  align-items: center;
}

.pagination-controls {
  gap: 14px;
  margin-left: auto;
}

.pagination-nav,
.pagination-pages,
.page-size-control {
  gap: 8px;
}

.page-size-control {
  color: var(--text-soft);
  font-size: 13px;
}

.page-size-control select {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(37, 99, 235, 0.14);
  border-radius: 10px;
  background: #fff;
  color: var(--text-main);
  font: inherit;
  outline: none;
}

.pagination-page,
.pagination-ellipsis {
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13px;
}

.pagination-page {
  border: 1px solid rgba(37, 99, 235, 0.08);
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-main);
  box-shadow: none;
}

.pagination-page.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff;
  border-color: transparent;
}

.pagination-page:hover {
  box-shadow: none;
}

.pagination-ellipsis {
  color: var(--text-soft);
}

table {
  width: max-content;
  min-width: 1680px;
  border-collapse: collapse;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 15px 16px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  background: #f5f7fb;
  white-space: nowrap;
}

.th-copy-wrap,
.copy-tools {
  display: flex;
  align-items: center;
}

.th-copy-wrap {
  gap: 10px;
}

.th-copy-wrap > span {
  color: var(--text-main);
}

.table-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

.table-sort-button:hover {
  color: var(--brand-deep);
  transform: none;
  box-shadow: none;
}

.table-sort-button.active {
  color: var(--brand-deep);
}

.sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
}

.table-sort-button.active .sort-indicator {
  color: var(--brand-deep);
}

.copy-tools {
  flex-direction: row;
  align-items: center;
  gap: 7px;
}

.copy-button {
  width: auto;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(20, 33, 61, 0.1);
  border-radius: 999px;
  background: rgba(20, 33, 61, 0.04);
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  box-shadow: none;
}

.copy-button:hover {
  background: rgba(20, 33, 61, 0.08);
  color: #4b5563;
  transform: translateY(-1px);
  box-shadow: none;
}

.copy-scope-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.copy-scope-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.copy-scope-track {
  position: relative;
  width: 56px;
  height: 24px;
  flex: 0 0 56px;
  border: 1px solid #166534;
  border-radius: 999px;
  background: #15803d;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.copy-scope-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 33, 61, 0.28);
  transition: transform 0.18s ease;
}

.copy-scope-switch input:checked + .copy-scope-track {
  border-color: var(--brand);
  background: var(--brand);
}

.copy-scope-switch input:checked + .copy-scope-track .copy-scope-thumb {
  transform: translateX(32px);
}

.copy-scope-switch input:focus-visible + .copy-scope-track {
  outline: 2px solid rgba(37, 99, 235, 0.35);
  outline-offset: 2px;
}

.copy-scope-label {
  position: absolute;
  top: 0;
  right: 3px;
  bottom: 0;
  left: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  pointer-events: none;
  transition: left 0.18s ease, right 0.18s ease, color 0.18s ease;
}

.copy-scope-switch input:checked + .copy-scope-track .copy-scope-label {
  right: 23px;
  left: 3px;
  color: #fff;
}

tbody td {
  padding: 15px 16px;
  border-top: 1px solid rgba(44, 80, 141, 0.08);
  font-size: 14px;
  line-height: 1.65;
  vertical-align: top;
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

.empty-row td {
  padding: 42px 18px;
  text-align: center;
  color: var(--text-soft);
}

.tracking-code {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-text {
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
}

.effective-transport-days {
  min-width: 120px;
  white-space: nowrap;
}

.pickup-date {
  min-width: 120px;
  white-space: nowrap;
}

.latest-track {
  min-width: 560px;
  white-space: nowrap;
}

.tracking-no-2 {
  width: 200px;
  min-width: 180px;
  max-width: 220px;
}

.tracking-no-2-wrap {
  min-width: 0;
}

.tracking-no-2-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.last-mile-carrier {
  min-width: 320px;
  white-space: nowrap;
}

.last-mile-carrier-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.last-mile-carrier-name {
  flex: 0 0 auto;
  color: var(--text-main);
  font-weight: 700;
  white-space: nowrap;
}

.last-mile-carrier-link {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.last-mile-carrier-link:hover {
  text-decoration: underline;
}

.last-mile-carrier-phone {
  flex: 0 0 auto;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .app-layout {
    grid-template-columns: 304px minmax(0, 1fr);
  }

  .query-actions button {
    flex-basis: 50%;
  }

  .status-chip {
    flex-basis: calc(50% - 3px);
    width: calc(50% - 3px);
    max-width: calc(50% - 3px);
  }

  .summary-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    top: auto;
    grid-template-rows: auto auto auto;
    gap: 8px;
    height: auto;
    max-height: none;
    overflow: visible;
    padding-inline: 0;
  }

  .panel-query,
  .panel-filter,
  .panel-summary-filter,
  .table-panel {
    height: auto;
    min-height: auto;
    max-height: none;
  }

  .table-panel {
    overflow: visible;
  }

  .panel-query {
    overflow: visible;
  }

  .query-form {
    height: auto;
    flex: initial;
  }

  .query-form textarea {
    min-height: 150px;
    flex: initial;
    resize: vertical;
  }

  .status-filters {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .status-chip {
    flex-basis: calc(50% - 3px);
    width: calc(50% - 3px);
    max-width: calc(50% - 3px);
  }

  .summary-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-wrap {
    height: auto;
    min-height: 0;
    max-height: none;
  }

  .query-actions button {
    flex: 1 1 calc(33.333% - 7px);
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 8px, 1400px);
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .panel,
  .table-panel {
    padding: 18px;
    border-radius: 20px;
  }

  .panel-head,
  .table-head {
    flex-direction: column;
    align-items: stretch;
  }

  .panel-head-actions {
    justify-content: space-between;
  }

  .table-head-side {
    align-items: flex-start;
    text-align: left;
  }

  .table-head-actions {
    justify-content: flex-start;
  }

  .workbench-card {
    width: min(100vw - 16px, 1120px);
    height: min(92vh, 980px);
    padding: 18px;
  }

  .carrier-timeliness-card {
    width: calc(100vw - 12px);
    height: 94vh;
    padding: 16px;
  }

  .workbench-head,
  .workbench-toolbar,
  .carrier-timeliness-head,
  .carrier-timeliness-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .carrier-timeliness-scheme-controls {
    align-items: stretch;
  }

  .timeliness-bucket-settings-card {
    width: calc(100vw - 12px);
    max-height: 94vh;
    padding: 16px;
  }

  .timeliness-bucket-settings-head {
    flex-direction: column;
  }

  .timeliness-bucket-editor-row {
    grid-template-columns: 46px 1fr 1fr;
  }

  .timeliness-bucket-editor-row .timeliness-bucket-editor-field:nth-of-type(3) {
    grid-column: 2 / 4;
  }

  .timeliness-bucket-delete {
    grid-column: 2 / 4;
  }

  .workbench-toolbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .workbench-grid {
    grid-template-columns: 1fr;
  }

  .th-copy-wrap {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-controls {
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-nav {
    flex-wrap: wrap;
  }

  .query-actions {
    flex-direction: column;
  }

  .query-actions button {
    flex: 1 1 100%;
    width: 100%;
  }

  .status-chip {
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
  }

  .summary-filters {
    grid-template-columns: 1fr;
  }

  .panel-query {
    padding-bottom: 20px;
  }

  .query-form textarea {
    min-height: 132px;
  }
}
