/* =========================================================
   ContainerBooking — manage-* pages (bookings / shipments /
   invoices / quotes). Preview UI shells, wired to real data
   later — see manage-quotes.js for the one page that already is.
   ========================================================= */

.mgmt { padding: 56px 0 120px; min-height: 60vh; }
.mgmt .acct-signedout { margin-top: 20px; }

.mgmt__back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: .8rem;
  text-decoration: none; margin-bottom: 30px;
}
.mgmt__back:hover { color: var(--accent); }

.mgmt__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 40px; }
.mgmt__head h1 { font-size: 2.2rem; margin-bottom: 8px; }
.mgmt__head p { color: var(--ink-soft); max-width: 46ch; }

.mgmt__head-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }

.mgmt__badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 7px 12px; border-radius: 999px; border: 1px dashed var(--line);
  color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: .74rem;
  letter-spacing: .06em; text-transform: uppercase;
}
.mgmt__badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- Filter bar (search + single-select status chips) ----------
   Mirrors the Flutter staff app's own Bookings/Shipments filter shape —
   a search box plus one row of single-select chips — not a heavier
   multi-field panel. */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 22px; }
.filter-search { position: relative; flex: 1 1 240px; min-width: 200px; }
.filter-search input {
  width: 100%; font: inherit; font-size: .92rem; color: var(--ink); background: var(--paper-2);
  border: 1.5px solid var(--line); border-radius: 8px; padding: .68em .9em .68em 2.4em;
}
.filter-search input:focus { outline: none; border-color: var(--accent); }
.filter-search::before {
  content: "⌕"; position: absolute; left: .8em; top: 50%; transform: translateY(-50%);
  color: var(--ink-soft); font-size: 1rem; pointer-events: none;
}
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
  font-family: "Space Grotesk", sans-serif; font-weight: 600; font-size: .84rem;
  padding: .5em 1.1em; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--paper-2); color: var(--ink-soft); cursor: pointer; transition: all .15s;
}
.filter-chip:hover { border-color: var(--ink-soft); color: var(--ink); }
.filter-chip.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.filter-empty { text-align: center; color: var(--ink-soft); padding: 30px 0; }

/* ---------- Row list ---------- */
.mgmt__list { display: flex; flex-direction: column; gap: 10px; }
.mgmt__row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 18px;
  padding: 16px 20px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r);
  text-decoration: none; color: inherit;   /* rows are <a> when they link to a detail page */
}
.mgmt__row-ref { font-family: "IBM Plex Mono", monospace; font-size: .8rem; color: var(--ink-soft); white-space: nowrap; }
.mgmt__row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mgmt__row-title { font-family: "Space Grotesk", sans-serif; font-weight: 600; overflow-wrap: anywhere; }
.mgmt__row-sub { color: var(--ink-soft); font-size: .84rem; overflow-wrap: anywhere; }
/* short values ("47d overdue") stay on one line; a long one (a reviewer's note on a rejected upload) wraps
   instead of pushing the row wider than its card */
.mgmt__row-meta { color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: .8rem; text-align: right; max-width: 34ch; overflow-wrap: anywhere; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok       { background: rgba(60,120,90,.12);  color: #2f6b4c; }
.pill--pending  { background: rgba(226,85,43,.12);  color: var(--accent-d); }
.pill--due      { background: rgba(196,60,50,.12);  color: #b3392c; }
.pill--neutral  { background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line); }

.mgmt__empty { text-align: center; color: var(--ink-soft); padding: 30px 0; }

/* ---------- Shipment detail (map + milestones) ---------- */
.mgmt__row--clickable { cursor: pointer; transition: border-color .15s; }
.mgmt__row--clickable:hover, .mgmt__row--clickable.is-open { border-color: var(--ink); }

.mgmt-detail {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px;
  padding: 18px; margin-top: -1px;
  background: var(--paper-2); border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 var(--r) var(--r);
}
.mgmt-detail__map { height: 260px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.mgmt-detail__side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.mgmt-detail__track {
  align-self: flex-start; color: var(--accent-d); font-size: .84rem; font-weight: 600; text-decoration: none;
}
.mgmt-detail__track:hover { text-decoration: underline; }

/* ---------- Shared detail panel (used by the booking inline detail AND
   every section on the shipment detail page — one card look everywhere,
   instead of each page inventing its own). ---------- */
.detail-panel {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px 24px;
}
.detail-panel h2 {
  font-size: .8rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-soft); margin: 0 0 16px;
}
.mgmt-fields { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 32px; row-gap: 10px; }
.mgmt-fields li { display: flex; justify-content: space-between; gap: 16px; font-size: .86rem; }
.mgmt-fields__k { color: var(--ink-soft); }
.mgmt-fields__v { font-weight: 500; text-align: right; }

/* ---------- Booking detail (fields, no map) ---------- */
/* The outer .mgmt-detail already carries margin-top:-1px (base rule) to sit
   flush against the row above — this variant just strips its own box
   styling down to an invisible wrapper so the inner .detail-panel is the
   only visible box (don't re-add margin-top here, it would double up). */
.mgmt-detail--single { grid-template-columns: 1fr; padding: 0; background: none; border: none; border-radius: 0 0 var(--r) var(--r); overflow: hidden; }
.mgmt-detail--single .detail-panel { border-radius: 0 0 var(--r) var(--r); border-top: none; }
.mgmt-detail__links { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.mgmt-detail__hint { color: var(--ink-soft); font-size: .84rem; margin: 14px 0 0; }

/* ---------- Skeleton loaders (shared — list rows + detail panels) ---------- */
.skel { position: relative; overflow: hidden; background: var(--line); border-radius: 4px; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.skel-row {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 18px;
  padding: 16px 20px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r);
}
.skel-row .skel { height: 12px; }
.skel-row__ref { width: 70px; }
.skel-row__main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.skel-row__title { width: 55%; height: 14px !important; }
.skel-row__sub { width: 35%; }
.skel-row__pill { width: 64px; height: 20px !important; border-radius: 999px; }
.skel-row__meta { width: 80px; justify-self: end; }

.skel-panel {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px 24px; display: flex; flex-direction: column; gap: 14px;
}
.skel-panel .skel { height: 12px; }
.skel-panel .skel:nth-child(1) { width: 40%; }
.skel-panel .skel:nth-child(2) { width: 70%; }
.skel-panel .skel:nth-child(3) { width: 55%; }
.skel-panel .skel:nth-child(4) { width: 65%; }
.skel-map { height: 300px; background: var(--line); border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  .skel::after { animation: none; }
}

/* phones and tablets (up to 900 px): a card — the reference with its status pill beside it, then the title and sub,
   then the meta line. Below 900 px the four-column row squeezed long titles into a narrow column. Columns may shrink
   below their longest line (a plain 1fr would grow to fit it and run off the card). */
@media (max-width: 900px) {
  .mgmt__row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "ref pill" "main main" "meta meta";
    gap: 5px 10px; text-align: left;
  }
  .mgmt__row-ref { grid-area: ref; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .mgmt__row > .pill { grid-area: pill; }
  .mgmt__row-main { grid-area: main; }
  .mgmt__row-meta { grid-area: meta; text-align: left; max-width: none; }
}

@media (max-width: 640px) {
  .mgmt-detail { grid-template-columns: 1fr; }
  .mgmt-fields { grid-template-columns: 1fr; }
}
