:root {
  /* Palette pulled directly from send_import_arrival_notices.php */
  --navy:        #003366;
  --page-bg:     #f4f4f4;
  --surface:     #ffffff;
  --surface-alt: #f0f4f8;
  --border:      #dde3ea;
  --table-head:  #f1f5f9;
  --text:        #333333;
  --text-soft:   #64748b;
  --text-strong: #334155;
  --radius:      6px;

  /* Status colors — exact match to statusBadgeHtml() in the email */
  --status-complete-bg:     #e6f4ea;
  --status-complete-fg:     #15803d;
  --status-complete-border: #b7dfb9;

  --status-partial-bg:      #fff8e1;
  --status-partial-fg:      #b45309;
  --status-partial-border:  #fcd34d;

  --status-notrec-bg:       #fef2f2;
  --status-notrec-fg:       #b91c1c;
  --status-notrec-border:   #fca5a5;

  /* SHIPPED has no equivalent in the email (pre-shipment only) —
     navy-tinted to stay in the same brand family. */
  --status-shipped-bg:      #e8eef5;
  --status-shipped-fg:      #003366;
  --status-shipped-border:  #b9c8dc;

  --font-body: Arial, 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  font-family: var(--font-body);
  color: var(--text);
}

.pss-page {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
}

/* ── Card shell ───────────────────────────────────────────────────── */

.pss-stub {
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.pss-stub-header {
  background: var(--navy);
  padding: 18px 24px;
}

.pss-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #cdd9e6;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.pss-title {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.2;
  margin: 0 0 4px;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.pss-subtitle {
  font-size: 13px;
  color: #dbe4ef;
  margin: 0;
}

/* ── Search form ──────────────────────────────────────────────────── */

.pss-form {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.pss-type-toggle {
  display: flex;
  gap: 4px;
  background: var(--table-head);
  border-radius: 4px;
  padding: 4px;
  margin-bottom: 12px;
}

.pss-type-btn {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  padding: 8px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.pss-type-btn:hover {
  color: var(--text-strong);
}

.pss-type-btn.is-active {
  background: var(--navy);
  color: #ffffff;
}

.pss-type-btn:focus-visible,
.pss-submit-btn:focus-visible,
.pss-input:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.pss-input-row {
  display: flex;
  gap: 8px;
}

.pss-input {
  flex: 1;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}

.pss-input::placeholder {
  color: #9aa5b1;
}

.pss-submit-btn {
  font-weight: 600;
  font-size: 14px;
  color: #ffffff;
  background: var(--navy);
  border: none;
  border-radius: 4px;
  padding: 0 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 100px;
  transition: filter 120ms ease;
}

.pss-submit-btn:hover { filter: brightness(1.15); }
.pss-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Results ──────────────────────────────────────────────────────── */

.pss-results {
  padding: 20px 24px 24px;
}

/* One shipment result (MAWB header + its houses) */
.pss-shipment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ── Shipment header row (FWD ID / MAWB — In Date / Free Time / Bond) ── */

.pss-shipment-header {
  display: flex;
  gap: 24px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}

.pss-shipment-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pss-shipment-col-import {
  padding-left: 20px;
  border-left: 1px solid var(--border);
}

.pss-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy);
  margin: 0 0 2px;
}

/* ── Generic label/value field row (reused in header + house cards) ── */

.pss-field {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.pss-field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}

.pss-field-value {
  font-size: 13px;
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

/* ── House list ───────────────────────────────────────────────────── */

.pss-house-list {
  display: flex;
  flex-direction: column;
}

.pss-house-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.pss-house-card:first-child {
  border-top: none;
}

.pss-house-top-row {
  display: flex;
  gap: 24px;
}

.pss-house-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pss-house-col:last-child {
  padding-left: 20px;
  border-left: 1px solid var(--border);
}

/* ── Handling units / labels list — full card width, no scrollbar ──── */

.pss-handling-units {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.pss-hu-table-wrap {
  overflow-x: auto;
}

.pss-hu-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}

.pss-hu-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--navy);
  background: var(--table-head);
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.pss-hu-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.pss-hu-table tbody tr:last-child td {
  border-bottom: none;
}

.pss-hu-table tbody tr:nth-child(even) {
  background: var(--surface-alt);
}

.pss-hu-num {
  color: var(--text-soft);
  width: 36px;
}

.pss-hu-label {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-strong);
  word-break: break-all;
}

.pss-hu-loc {
  color: var(--text-soft);
  white-space: nowrap;
}

.pss-hu-type {
  color: var(--text-strong);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Status badge ─────────────────────────────────────────────────── */

.pss-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid;
}

.pss-status-badge.complete {
  background: var(--status-complete-bg);
  color: var(--status-complete-fg);
  border-color: var(--status-complete-border);
}

.pss-status-badge.partial {
  background: var(--status-partial-bg);
  color: var(--status-partial-fg);
  border-color: var(--status-partial-border);
}

.pss-status-badge.not-received {
  background: var(--status-notrec-bg);
  color: var(--status-notrec-fg);
  border-color: var(--status-notrec-border);
}

.pss-status-badge.shipped {
  background: var(--status-shipped-bg);
  color: var(--status-shipped-fg);
  border-color: var(--status-shipped-border);
}

.pss-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Reduced motion ───────────────────────────────────────────────── */

/* ── Mobile ───────────────────────────────────────────────────────── */

@media (max-width: 560px) {
  .pss-stub-header,
  .pss-form,
  .pss-results { padding-left: 16px; padding-right: 16px; }

  .pss-input-row { flex-direction: column; }
  .pss-submit-btn { padding: 12px; }

  .pss-shipment-header,
  .pss-house-top-row {
    flex-direction: column;
    gap: 14px;
  }

  .pss-shipment-col-import,
  .pss-house-col:last-child {
    padding-left: 0;
    border-left: none;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }

  .pss-field { flex-direction: column; gap: 2px; }
  .pss-field-value { text-align: left; }
}