/* Ridhi Sidhi Overseas — Tracking Portal
   Palette + type matched to the main marketing site. */
:root {
  --cream: #f3f5f9;
  --cream-2: #eef2f7;
  --paper: #ffffff;
  --line: #dde4ee;
  --ink: #1f2e43;
  --ink-soft: #64748b;
  --brown: #1f2e43;
  --tan: #2f5a8f;
  --tan-2: #f28b4b;
  --green: #2e7d32;
  --green-soft: #e8f5e9;
  --red: #c0392b;
  --done-bg: #e8f5e9; --done-fg: #2e7d32;
  --warn-bg: #fdeccb; --warn-fg: #9a6212;
  --transit-bg: #eef2f8; --transit-fg: #2f5a8f;
  --origin-bg: #efe7dd; --origin-fg: #7a5a3a;
  --attn: #c0392b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--tan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top bar ── */
.topbar { background: transparent; color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar-inner {
  max-width: 1000px; margin: 0 auto; padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  font-family: 'Playfair Display', serif; font-weight: 700; font-size: 18px;
  background: #fff1e7; color: #de7d3e; width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: 8px; letter-spacing: .02em;
}
.brand-text { font-family: 'Playfair Display', serif; font-size: 17px; font-weight: 600; line-height: 1.1; }
.brand-text small { display: block; font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; color: #de7d3e; letter-spacing: .08em; text-transform: uppercase; }
.topnav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.topnav a { color: var(--ink); opacity: .9; }
.topnav a:hover { opacity: 1; }
.who { opacity: .7; font-size: 13px; }
.btn-logout { border: 1px solid var(--line); border-radius: 7px; padding: 5px 11px; background: #fff; }

/* ── Layout ── */
.wrap { max-width: 1000px; margin: 0 auto; padding: 26px 18px 48px; }
.foot {
  max-width: 1000px; margin: 0 auto; padding: 20px 18px 40px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  color: var(--ink-soft); font-size: 12.5px; border-top: 1px solid var(--line); margin-top: 20px;
}
h1 { font-family: 'Playfair Display', serif; font-size: 26px; color: var(--brown); font-weight: 700; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--ink-soft); font-size: 13.5px; margin-top: 3px; }

/* ── Buttons & forms ── */
.btn {
  display: inline-block; background: var(--tan); color: #fff; border: none;
  border-radius: 8px; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.btn:hover { background: #25496f; text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: var(--cream-2); color: var(--ink); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.danger { background: var(--red); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--brown); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: var(--paper); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--tan-2); border-color: var(--tan-2); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1; min-width: 160px; }

/* ── Cards & panels ── */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.notice { padding: 11px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 16px; }
.notice.err { background: #fdecea; color: #a33027; border: 1px solid #f3c6c0; }
.notice.ok  { background: var(--green-soft); color: var(--green); border: 1px solid #bfe3c1; }

/* ── Login ── */
.login-wrap { max-width: 400px; margin: 6vh auto 0; }
.login-wrap .card { padding: 28px; }
.login-wrap h1 { text-align: center; margin-bottom: 4px; }
.login-wrap .sub { text-align: center; color: var(--ink-soft); font-size: 13.5px; margin-bottom: 22px; }

/* ── Summary tiles ── */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 14px 10px; text-align: center; }
.tile .num { display: block; font-size: 38px; font-weight: 700; color: #213b59; font-family: 'Playfair Display', serif; line-height: 1; }
.tile .lbl { display: block; font-size: 11px; color: var(--ink-soft); margin-top: 3px; }

/* ── ETA day groups ── */
.day { margin-bottom: 20px; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 3px 8px; }
.day-head h2 { font-family: 'Playfair Display', serif; font-size: 17px; color: var(--brown); }
.day-head .count { font-size: 12px; color: var(--ink-soft); }

/* Keep date group header visible while scrolling through its cards */
.day-head {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
  padding-top: 6px;
}

/* ── Container cards ── */
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; margin-bottom: 8px; }
.box[data-attn="1"] { border-left: 3px solid var(--attn); }
.box-top { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.cntr { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.carrier-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--tan); border: 1px solid var(--tan); border-radius: 5px; padding: 1px 5px;
}
.pill { margin-left: auto; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.pill.done { background: var(--done-bg); color: var(--done-fg); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.transit { background: #e6effa; color: #3f6fa8; }
.pill.origin { background: var(--origin-bg); color: var(--origin-fg); }
.box-mid { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 7px; }
.qty { font-size: 13px; font-weight: 500; }
.vessel { font-size: 12px; color: var(--ink-soft); text-align: right; }
.ldb { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-soft); display: flex; gap: 7px; align-items: baseline; }
.ldb-tag { font-size: 9.5px; font-weight: 700; letter-spacing: .05em; color: #41566f; background: var(--cream-2); border-radius: 4px; padding: 1px 5px; flex-shrink: 0; }

/* ── Tables (admin) ── */
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }
table.data tr:last-child td { border-bottom: none; }
.muted { color: var(--ink-soft); }
.tag-off { font-size: 11px; background: #f0e6da; color: #8a7563; border-radius: 5px; padding: 1px 7px; }
.unsold-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #fff; background: var(--red); border-radius: 5px; padding: 2px 7px;
}
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions form { display: inline-flex; gap: 4px; margin: 0; }
.move-select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; font-family: inherit; font-size: 12.5px; background: var(--paper); max-width: 190px; }

/* ── Shipments / sales admin ── */
.ph { font-family: 'Playfair Display', serif; font-size: 17px; color: var(--brown); margin-bottom: 10px; }
.ship-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.cont { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; background: var(--cream); }
.cont-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cont-actions { display: flex; align-items: center; gap: 10px; }
.cont-forms { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.cont-forms details, .add-cont { flex: 1; min-width: 260px; }
.cont-forms summary, .add-cont summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--tan); padding: 6px 0; }
.add-cont { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 6px; }
.subform { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 12px; margin-top: 6px; }
.item-line { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin: 8px 0; }
.item-line .cont-head { margin-bottom: 6px; }
.item-line .unsold-tag, .item-line .muted { margin-left: 8px; }

/* Sales as stacked cards (no forms-in-tables → no mis-submit) */
.sales-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.sale-card { background: var(--cream); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; }
.sale-info { font-size: 13px; color: var(--ink); line-height: 1.5; }
.sale-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.sale-actions form { display: inline; margin: 0; }

/* Dashboard: admin item / sale breakdown */
.item-block { margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); }
.item-title { font-size: 13px; font-weight: 600; color: var(--brown); margin-bottom: 3px; }
.sale-line { font-size: 12.5px; color: var(--ink-soft); padding: 2px 0 2px 10px; }

/* Two-tier sale rows: primary line + lighter meta line */
.sale-item { margin-top: 7px; padding-left: 2px; }
.box-mid + .sale-item { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.item-block .sale-item { padding-left: 10px; }
.sale-primary { font-size: 13px; color: var(--ink); font-weight: 500; }
.sale-primary .ldb-tag { margin-right: 7px; }
.sale-meta { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.pending-tag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: #fff; background: var(--red); border-radius: 5px; padding: 2px 7px;
}

/* Public journey timeline */
.jr-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.jr-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-soft); }
.jr-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.jr-legend .lg::before { content: ''; width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.jr-legend .lg-actual::before { background: var(--tan); }
.jr-legend .lg-est::before { background: var(--paper); border: 1.5px dashed var(--tan-2); }
.timeline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 0; }
.tl-item { position: relative; padding: 0 0 16px 20px; }
.tl-dot { position: absolute; left: -7px; top: 4px; width: 11px; height: 11px; border-radius: 50%; background: var(--tan); border: 2px solid var(--paper); }
.tl-item.current .tl-dot { background: var(--green); }
.tl-item.est .tl-dot { background: var(--paper); border: 2px dashed var(--tan-2); }
.tl-event { font-size: 13.5px; font-weight: 600; color: var(--brown); }
.tl-item.est .tl-event { color: var(--ink-soft); font-weight: 500; }
.tl-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.tl-tag { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
.tl-item.est .tl-tag { background: var(--warn-bg); color: var(--warn-fg); }
.tl-tag.now { background: var(--done-bg); color: var(--done-fg); }

/* Share-link controls */
.share-box { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.share-box input { flex: 1; min-width: 180px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 12px; background: var(--cream); color: var(--ink-soft); }
.share-link { font-size: 12.5px; font-weight: 600; color: var(--tan); cursor: pointer; }
.share-details { margin-top: 8px; }
.unsold-block { margin-top: 9px; padding: 8px 10px; border-radius: 8px; background: #fdf2ee; border: 1px solid #f3d6cc; }
.unsold-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--red); margin-bottom: 3px; }
.unsold-block .sale-line { color: var(--brown); }
.btn.ghost.active { background: var(--brown); color: var(--cream); border-color: var(--brown); }
@media (prefers-color-scheme: dark) { .unsold-block { background: #2a1712; border-color: #5a2f22; } }
table.data.sales th, table.data.sales td { padding: 6px 9px; font-size: 12.5px; }
.updated { font-size: 12px; color: var(--ink-soft); }

/* ── Filter bar (Supplier / Quality) ── */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 13.5px; background: var(--paper); color: var(--ink); max-width: 220px; }
.filter-bar select:focus { outline: 2px solid var(--tan-2); border-color: var(--tan-2); }

/* ── Purchase / Sale / Match additions ── */
.flag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border-radius: 5px; padding: 2px 7px; }
.flag.on { background: var(--green-soft); color: var(--green); }
.flag.off { background: #f0e6da; color: #8a7563; }
.matched-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--green); background: var(--green-soft); border-radius: 5px; padding: 2px 7px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 600; color: var(--brown); margin: 0 18px 14px 0; }
.check input { width: auto; }
.alloc-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--cream); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; font-size: 13px; }
.alloc-row form { margin: 0; }
/* Broker: container track lines under a purchase order */
.track-line { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.track-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cntr-sm { font-size: 13.5px; font-weight: 700; }
.track-meta { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.add-popover { width: min(720px, 95vw); }

@media (max-width: 760px) {
  .wrap { padding: 18px 12px 32px; }
  .topbar-inner { padding: 10px 12px; }
  .brand-mark { width: 34px; height: 34px; font-size: 16px; }
  .brand-text { font-size: 15px; }
  .topnav { gap: 10px; font-size: 13px; }
  .page-head { align-items: flex-start; margin-bottom: 14px; }
  .page-head h1 { font-size: 24px; line-height: 1.1; }
  .btn { padding: 9px 12px; }
  .row > .field { min-width: 100%; }
  .box { padding: 12px; }
  .box-mid { display: block; }
  .vessel { display: block; text-align: left; margin-top: 4px; }
  .row-actions { width: 100%; }
  .row-actions form { flex: 1 1 calc(50% - 6px); }
  .row-actions .btn,
  .row-actions .btn.sm { width: 100%; text-align: center; }
  .row-actions details { flex: 1 1 100%; }
  .row-actions details > summary { display: inline-block; width: 100%; text-align: center; }
  .add-popover { width: calc(100vw - 24px); max-width: calc(100vw - 24px); }
}

@media (max-width: 560px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
  h1 { font-size: 24px; }
  .tile .num { font-size: 30px; }
  .day-head h2 { font-size: 17px; }
  .cntr { font-size: 15px; }
  .qty { font-size: 13px; }
  .topnav { width: 100%; justify-content: flex-start; }
}
