:root {
  --bg: #eef2f7;
  --bg-deep: #101828;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --panel-soft: #f8fafc;
  --text: #182230;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #dbeafe;
  --violet: #7c3aed;
  --green: #16803c;
  --yellow: #b54708;
  --red: #d92d20;
  --red-soft: #fee4e2;
  --shadow: 0 24px 70px rgba(16, 24, 40, 0.12);
  --shadow-soft: 0 12px 32px rgba(16, 24, 40, 0.08);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(37, 99, 235, 0.16), transparent 28%),
    radial-gradient(circle at 78% 14%, rgba(124, 58, 237, 0.14), transparent 30%),
    linear-gradient(135deg, #f8fafc 0%, #eef2f7 44%, #e9effb 100%);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 308px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.96)),
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.35), transparent 34%);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, #60a5fa, #2563eb 55%, #7c3aed);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 24px;
  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.34);
}

.brand strong {
  display: block;
  font-size: 20px;
  letter-spacing: -0.03em;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: #b8c2d8;
  font-size: 13px;
}

.side-card {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.side-card small,
.side-card strong,
.side-card span {
  display: block;
}

.side-card small {
  color: #93a4c4;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  font-weight: 800;
}

.side-card strong {
  font-size: 15px;
  line-height: 1.3;
  margin-bottom: 6px;
}

.side-card span {
  color: #b8c2d8;
  font-size: 13px;
  line-height: 1.45;
}

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

.nav-item,
.ghost-btn,
.secondary-btn,
.primary-btn,
.danger-btn {
  border: 0;
  border-radius: 16px;
  min-height: 46px;
  padding: 0 18px;
  transition: 0.18s ease;
}

.nav-item {
  background: transparent;
  color: #c9d3e8;
  text-align: left;
  display: grid;
  gap: 2px;
  padding: 13px 15px;
}

.nav-item span {
  font-weight: 850;
}

.nav-item small {
  color: #8fa0bf;
  font-size: 12px;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
  transform: translateX(2px);
}

.nav-item:hover small,
.nav-item.active small {
  color: #dbeafe;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.user-chip {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
}

.user-chip span,
.user-chip small {
  display: block;
}

.user-chip span {
  font-weight: 850;
}

.user-chip small {
  color: #b8c2d8;
  margin-top: 4px;
}

.main {
  padding: 28px;
  min-width: 0;
}

.login-screen {
  min-height: calc(100vh - 68px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 32px;
  box-shadow: var(--shadow);
  padding: 38px;
  backdrop-filter: blur(18px);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 8px;
  font-size: 23px;
  letter-spacing: -0.035em;
}

p {
  color: var(--muted);
  line-height: 1.58;
}

.pill {
  width: max-content;
  padding: 8px 12px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 850;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.hero-head {
  min-height: auto;
  padding: 30px;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(16, 24, 40, 0.94), rgba(29, 78, 216, 0.86)),
    radial-gradient(circle at 86% 18%, rgba(255, 255, 255, 0.28), transparent 24%);
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero-head::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -95px;
  bottom: -140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
}

.hero-head p {
  color: #dbeafe;
  max-width: 760px;
}

.hero-head .pill {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.hero-actions {
  position: relative;
  z-index: 1;
}

.page-head p {
  max-width: 760px;
  margin-bottom: 0;
}

.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.metric-grid,
.history-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0 0 24px;
  position: relative;
  z-index: 2;
}

.history-summary {
  margin: 0 0 18px;
}

.metric-card,
.summary-card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
  border-radius: 22px;
  padding: 18px;
  backdrop-filter: blur(14px);
}

.metric-card small,
.metric-card strong,
.metric-card span,
.summary-card small,
.summary-card strong,
.summary-card span {
  display: block;
}

.metric-card small,
.summary-card small {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 850;
  margin-bottom: 8px;
}

.metric-card strong,
.summary-card strong {
  font-size: 22px;
  letter-spacing: -0.035em;
  margin-bottom: 4px;
}

.metric-card span,
.summary-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  gap: 22px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 24px;
  backdrop-filter: blur(18px);
}

.card-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.card-title p {
  margin-bottom: 0;
}

.form-card {
  display: grid;
  gap: 20px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

.address-helper {
  grid-column: 1 / -1;
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border-radius: 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}

.address-helper strong {
  font-size: 13px;
  font-weight: 900;
}

.address-helper span {
  font-size: 13px;
  line-height: 1.45;
}

.address-helper.warning {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.form-grid.single {
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  font-weight: 780;
  color: #344054;
}

.field-note {
  margin-top: -2px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 650;
}

.field-note.required {
  color: var(--accent-dark);
}

.field-note.optional {
  color: #667085;
}

.required-star {
  color: var(--red);
  font-weight: 950;
  margin-left: 4px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.92);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.7);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.11);
}

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

.check-card {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(248, 250, 252, 0.78);
  font-weight: 750;
  transition: 0.18s ease;
}

.check-card:hover {
  border-color: rgba(37, 99, 235, 0.42);
  background: #fff;
}

.check-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.primary-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8 56%, #7c3aed);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
}

.primary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.3);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.primary-btn.wide {
  width: 100%;
}

.secondary-btn {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  font-weight: 850;
}

.secondary-btn:hover {
  border-color: rgba(37, 99, 235, 0.5);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.danger-btn {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid rgba(217, 45, 32, 0.16);
  font-weight: 850;
}

.danger-btn:hover {
  background: #ffd7d4;
  transform: translateY(-1px);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-weight: 850;
}

.main .ghost-btn {
  background: var(--panel-soft);
  color: var(--text);
  border-color: var(--line);
}

.result-card {
  min-height: 620px;
  position: sticky;
  top: 22px;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.result-head h2,
.result-head p {
  margin-bottom: 0;
}

.empty-state {
  min-height: 310px;
  border: 1px dashed #cbd5e1;
  border-radius: 22px;
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 8px;
  color: var(--muted);
  padding: 22px;
  background: rgba(248, 250, 252, 0.62);
}

.empty-state.compact {
  min-height: 190px;
  margin-top: 12px;
}

.empty-state strong {
  color: var(--text);
}

.empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  background: linear-gradient(135deg, #dbeafe, #ede9fe);
  color: var(--accent-dark);
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 950;
}

.best-box {
  background: linear-gradient(135deg, #ecfdf3, #f0f9ff);
  border: 1px solid #b7e7c8;
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 16px;
}

.best-box strong {
  display: block;
  color: var(--green);
  font-size: 20px;
  margin-bottom: 6px;
  letter-spacing: -0.03em;
}

.best-box span {
  color: #46605a;
  line-height: 1.5;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
}

.table-wrap:has(table:empty) {
  border: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  background: rgba(255, 255, 255, 0.58);
}

th,
td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

tr:last-child td {
  border-bottom: 0;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.08em;
  background: rgba(248, 250, 252, 0.95);
}

td {
  font-size: 14px;
}

tbody tr {
  transition: 0.16s ease;
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.035);
}

.price {
  font-weight: 950;
  white-space: nowrap;
  color: #101828;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
  background: var(--accent-soft);
  color: var(--accent-dark);
  margin-top: 8px;
}

.status-badge.success {
  background: #dcfae6;
  color: var(--green);
}

.status-badge.warning {
  background: #fef0c7;
  color: var(--yellow);
}

.status-badge.error {
  background: var(--red-soft);
  color: var(--red);
}

.carrier-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.carrier-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 22px;
  backdrop-filter: blur(18px);
  position: relative;
  overflow: hidden;
}

.carrier-card::after {
  content: "";
  position: absolute;
  right: -35px;
  top: -35px;
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.08);
}

.carrier-card h3 {
  margin: 0 0 12px;
  font-size: 19px;
  letter-spacing: -0.03em;
}

.carrier-card p {
  margin-top: 14px;
  margin-bottom: 0;
  font-size: 14px;
}

.docs-card code,
.hint code {
  display: inline-block;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px 6px;
}

.docs-card li {
  margin-bottom: 10px;
  color: var(--muted);
}

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

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 440px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #101828;
  color: #fff;
  box-shadow: var(--shadow);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(15, 23, 42, 0.56);
  display: grid;
  place-items: center;
  padding: 22px;
  backdrop-filter: blur(8px);
}

.modal {
  width: min(900px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: var(--panel-solid);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  right: 18px;
  top: 14px;
  border: 0;
  background: transparent;
  font-size: 34px;
  color: var(--muted);
  min-height: auto;
  padding: 0 8px;
}

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

.detail-item {
  padding: 13px;
  border-radius: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.detail-item small,
.detail-item strong {
  display: block;
}

.detail-item small {
  color: var(--muted);
  margin-bottom: 5px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .layout-grid,
  .carrier-grid,
  .metric-grid,
  .history-summary {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    margin: 0 0 24px;
  }

  .result-card {
    position: static;
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .sidebar-footer {
    grid-template-columns: 1fr auto;
    align-items: center;
  }
}

@media (max-width: 720px) {
  .main,
  .sidebar,
  .login-card,
  .hero-head {
    padding: 18px;
  }

  .page-head,
  .result-head,
  .card-title {
    display: grid;
  }

  .form-grid.two,
  .checkbox-grid,
  .detail-grid,
  .nav,
  .sidebar-footer,
  .button-row {
    grid-template-columns: 1fr;
  }

  .button-row {
    display: grid;
    width: 100%;
  }

  h1 {
    font-size: 34px;
  }

  .hero-head {
    min-height: auto;
  }
}
