:root {
  --ink: #1c1b18;
  --paper: #ffffff;
  --line: #ddd8cc;
  --muted: #6f6a5f;
  --grn-bar:   #2f9f57;
  --grn-bar2:  #38ad5f;
  --grn-tint:  #e9f5ec;
  --grn-line:  #c4e3cc;
  --grn-text:  #1f7a43;
  --grn-deep:  #155f33;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Spline Sans', sans-serif;
  background:
    radial-gradient(1200px 600px at 12% -8%, #f3f7f1 0%, rgba(243,247,241,0) 60%),
    radial-gradient(900px 500px at 100% 0%, #f7f3ea 0%, rgba(247,243,234,0) 55%),
    var(--paper);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.portal {
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 32px 72px;
}

/* --- Portal header --- */
.portal-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 26px;
  margin-bottom: 32px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--grn-text);
  font-weight: 600;
  margin-bottom: 10px;
}

.portal-title {
  font-family: 'Fraunces', serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.portal-title .order-ref {
  color: var(--muted);
  font-style: italic;
}

.portal-sub {
  margin-top: 12px;
  font-size: 14px;
  color: var(--muted);
  max-width: 52ch;
}

/* --- Lookup form --- */
.lookup {
  margin-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.lookup-field {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.lookup-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.lookup-field input {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  padding: 14px 16px 14px 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lookup-field input::placeholder { color: #b3aea2; }
.lookup-field input:focus {
  outline: none;
  border-color: var(--grn-bar);
  box-shadow: 0 0 0 4px rgba(47,159,87,0.13);
}
.lookup-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(180deg, var(--grn-bar2), var(--grn-bar));
  border: none;
  border-radius: 11px;
  padding: 0 24px;
  cursor: pointer;
  box-shadow: 0 10px 22px -12px rgba(21,95,51,0.7);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.lookup-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 26px -12px rgba(21,95,51,0.8); }
.lookup-btn:active { transform: translateY(0); }
.lookup-btn:disabled { opacity: 0.6; cursor: progress; }

/* --- Placeholder / idle + empty states --- */
.placeholder {
  text-align: center;
  padding: 56px 24px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.5);
}
.placeholder-mark {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 14px;
  display: grid; place-items: center;
  background: var(--grn-tint);
  border: 1px solid var(--grn-line);
  color: var(--grn-text);
}
.placeholder-mark svg { width: 28px; height: 28px; }
.placeholder h2 {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 600;
}
.placeholder p {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  max-width: 46ch;
  margin-inline: auto;
}
.placeholder.error .placeholder-mark {
  background: #fbeae6; border-color: #e7b6ab; color: #b3401f;
}

.suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 22px;
}
.suggest button {
  font-family: 'Spline Sans', monospace;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--grn-deep);
  background: #fff;
  border: 1px solid var(--grn-line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}
.suggest button:hover { background: var(--grn-tint); transform: translateY(-1px); }

/* --- Skeleton loader --- */
.skeleton {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.sk-bar { height: 64px; background: #eceae3; }
.sk-body { padding: 22px; display: grid; grid-template-columns: 1fr 312px; gap: 18px; }
.sk-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.sk-box { height: 104px; border-radius: 9px; background: #f0eee7; }
.sk-cal { height: 280px; border-radius: 9px; background: #f0eee7; }
.shimmer {
  position: relative;
  overflow: hidden;
}
.shimmer::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.65), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
@media (max-width: 760px) { .sk-body { grid-template-columns: 1fr; } }

/* --- Status card --- */
.status-card {
  border: 1px solid var(--grn-line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--grn-tint);
  box-shadow: 0 14px 34px -22px rgba(21, 95, 51, 0.55);
  animation: rise 0.4s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card-bar {
  background: linear-gradient(180deg, var(--grn-bar2), var(--grn-bar));
  color: #fff;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.card-mark {
  width: 34px; height: 34px;
  border-radius: 7px;
  background: rgba(255,255,255,0.16);
  border: 1.5px solid rgba(255,255,255,0.55);
  display: grid; place-items: center;
  flex: none;
}
.card-mark svg { width: 18px; height: 18px; }
.card-bar h2 { font-size: 18px; font-weight: 600; letter-spacing: 0.01em; flex: 1; }

.pill {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.today-date {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.today-date::before { content: "Today · "; opacity: 0.8; font-weight: 500; }

/* customer strip */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--grn-line);
  background: rgba(255,255,255,0.55);
}
.meta-item { display: flex; flex-direction: column; gap: 2px; }
.meta-item .k {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.meta-item .v { font-size: 14px; font-weight: 600; color: var(--ink); }

/* --- Card body --- */
.card-body {
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr 312px;
  gap: 18px;
  align-items: start;
}
.date-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.date-box {
  position: relative;
  background: #fff;
  border: 3.5px solid var(--grn-bar);
  border-radius: 9px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  min-height: 104px;
}
.date-box .label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted); line-height: 1.3;
}
.date-box .value {
  font-size: 21px; font-weight: 600; color: var(--ink);
  margin-top: auto; padding-top: 10px;
}
.date-box .value.empty { color: #bdb8ab; }
.date-box .caption { font-size: 12px; color: var(--muted); margin-top: 5px; }
.date-box .label::before {
  content: ""; display: inline-block;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--grn-bar); margin-right: 7px; vertical-align: middle;
}

.date-box.c-inhand     { border-color: #c44536; background: #fbf0ee; }
.date-box.c-inhand     .label::before { background: #c44536; }
.date-box.c-estimate   { border-color: #2f9f57; background: #f0f8f3; }
.date-box.c-estimate   .label::before { background: #2f9f57; }
.date-box.c-proof      { border-color: #d8a72b; background: #fbf6e8; }
.date-box.c-proof      .label::before { background: #d8a72b; }
.date-box.c-ship       { border-color: #2f6fb0; background: #eef3f9; }
.date-box.c-ship       .label::before { background: #2f6fb0; }
.date-box.c-turnaround { border-color: #6a4c93; background: #f2eff7; }
.date-box.c-turnaround .label::before { background: #6a4c93; }
.date-box.c-freight    { border-color: #1f8a8a; background: #e9f5f5; }
.date-box.c-freight    .label::before { background: #1f8a8a; }

.date-box.c-turnaround .value {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 2px 0 0; margin-top: 0;
}
.turnaround-num {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(50px, 11vw, 84px);
  font-weight: 700; line-height: 0.82; color: #6a4c93; letter-spacing: -0.03em;
}
.turnaround-num small { font-size: 0.28em; font-weight: 700; letter-spacing: 0.04em; }

.date-box.c-inhand { border-width: 4.5px; box-shadow: 0 0 0 4px rgba(196,69,54,0.10); }
.date-box.c-inhand .value { color: #c44536; }

.box-flag {
  position: absolute; top: -13px; right: 12px;
  width: 27px; height: 27px; border-radius: 50%;
  background: #c44536; border: 2.5px solid #fff;
  box-shadow: 0 3px 9px -2px rgba(196,69,54,0.65);
  display: grid; place-items: center;
}
.box-flag svg { width: 13px; height: 13px; }

.priority-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em;
  color: #c44536; margin-top: 6px;
}
.priority-tag svg { width: 10px; height: 10px; }
.priority-tag.ok { color: var(--grn-text); }
.priority-tag.miss { color: #b3401f; }

.date-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 50%;
  margin-left: 8px; vertical-align: middle;
  box-shadow: 0 1px 3px -1px rgba(0,0,0,0.4);
}
.date-check svg { width: 11px; height: 11px; }
.c-proof .date-check { background: #d8a72b; }

/* fulfillment box rows */
.fr-grid { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.fr-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding-bottom: 4px; border-bottom: 1px dashed #cfe4e4;
}
.fr-row:last-child { border-bottom: none; padding-bottom: 0; }
.fr-k {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted);
}
.fr-v { font-size: 14px; font-weight: 600; color: var(--ink); text-align: right; }

.proj-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  color: #2f6fb0; background: #e4eef8; border: 1px solid #bcd5ee;
  padding: 3px 9px; border-radius: 999px; margin-top: 8px; width: fit-content;
}
.proj-badge svg { width: 11px; height: 11px; }

/* --- Calendar --- */
.cal-stack { display: flex; flex-direction: column; gap: 12px; }
.calendar {
  background: #fff; border: 1px solid var(--grn-line);
  border-radius: 9px; padding: 13px 14px 11px; width: 100%;
}
.cal-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.cal-head .cal-title { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--grn-text); }
.cal-head .cal-month { font-family: 'Fraunces', serif; font-size: 14px; font-weight: 600; color: var(--ink); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { font-size: 8.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); text-align: center; padding-bottom: 2px; }
.cal-day {
  position: relative; aspect-ratio: 1 / 1; display: flex;
  align-items: center; justify-content: center;
  font-size: 11px; border-radius: 5px; color: var(--ink);
}
.cal-day.blank { background: transparent; }
.cal-day.weekend { color: #bdb8ab; }
.cal-day.today { outline: 2px solid var(--ink); outline-offset: -2px; font-weight: 700; }
.cal-day.evt { font-weight: 700; color: #fff; box-shadow: 0 2px 6px -2px rgba(0,0,0,0.4); }
.cal-day.ev-proof   { background: #d8a72b; }
.cal-day.ev-ship    { background: #2f6fb0; }
.cal-day.ev-inhand  { background: #c44536; box-shadow: 0 2px 7px -1px rgba(196,69,54,0.7); }
.day-star {
  position: absolute; top: -5px; right: -5px;
  width: 14px; height: 14px; background: #c44536;
  border: 1.5px solid #fff; border-radius: 50%;
  color: #fff; font-size: 8px; line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 1px 4px -1px rgba(0,0,0,0.5);
}
.cal-legend {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--grn-line);
  font-size: 10px; color: var(--muted);
}
.cal-legend span { display: flex; align-items: center; gap: 6px; }
.cal-legend i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cal-legend i.lg-proof   { background: #d8a72b; }
.cal-legend i.lg-ship    { background: #2f6fb0; }
.cal-legend i.lg-inhand  { background: #c44536; }

/* --- Line items --- */
.items-wrap { padding: 4px 22px 0; }
.items-wrap h3 {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.items {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: #fff; border: 1px solid var(--grn-line); border-radius: 9px; overflow: hidden;
}
.items th {
  text-align: left; font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--muted);
  padding: 10px 12px; background: #f6f4ee; border-bottom: 1px solid var(--grn-line);
}
.items td { padding: 10px 12px; border-bottom: 1px solid #eee9dd; vertical-align: top; }
.items tr:last-child td { border-bottom: none; }
.items .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.items .item-name { font-weight: 600; color: var(--ink); }
.items .item-bom { font-family: 'Spline Sans', monospace; font-size: 11.5px; color: var(--muted); }
.items .brand-tag {
  display: inline-block; font-size: 11px; color: var(--grn-deep);
  background: var(--grn-tint); border: 1px solid var(--grn-line);
  border-radius: 999px; padding: 2px 9px;
}
.items tfoot td {
  padding: 12px; font-weight: 700; background: #f6f4ee;
  border-top: 2px solid var(--grn-line);
}

/* --- Alert / notes / footer --- */
.alert-banner {
  margin: 16px 22px 0; padding: 14px 16px;
  background: #fbeae6; border: 1px solid #e7b6ab; border-radius: 9px;
  display: flex; align-items: flex-start; gap: 11px;
  font-size: 13px; line-height: 1.5; color: #7a2b18;
}
.alert-banner strong { color: #a8331c; }
.alert-banner.info { background: #fbf6e8; border-color: #ead6a0; color: #6b551d; }
.alert-banner.info strong { color: #8a6a14; }
.alert-banner.info .alert-dot { background: #d8a72b; box-shadow: 0 0 0 4px rgba(216,167,43,0.18); }
.alert-dot {
  flex: none; width: 14px; height: 14px; border-radius: 50%;
  background: #c44536; margin-top: 2px; box-shadow: 0 0 0 4px rgba(196,69,54,0.18);
}

.card-note { margin: 0; padding: 16px 22px 0; font-size: 12px; line-height: 1.55; color: #908b80; }
.card-note strong { color: #6f6a5f; font-weight: 700; }

.card-foot {
  border-top: 1px solid var(--grn-line); margin-top: 16px; padding: 14px 22px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted);
}
.card-foot .item-ref { font-family: 'Spline Sans', monospace; font-weight: 600; color: var(--grn-deep); letter-spacing: 0.02em; }

/* --- Shareable link --- */
.share-bar {
  margin: 16px 22px 0;
  padding: 16px 18px;
  background: var(--grn-tint);
  border: 1px solid var(--grn-line);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.share-lead { display: flex; align-items: flex-start; gap: 12px; min-width: 220px; flex: 1 1 260px; }
.share-lead svg { width: 20px; height: 20px; color: var(--grn-text); flex-shrink: 0; margin-top: 1px; }
.share-title { font-size: 13px; font-weight: 700; color: var(--grn-deep); letter-spacing: 0.01em; }
.share-sub { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
.share-actions { display: flex; align-items: center; gap: 8px; flex: 1 1 300px; }
.share-url {
  flex: 1; min-width: 0; font-family: 'Spline Sans', monospace; font-size: 12.5px;
  color: var(--ink); background: #fff; border: 1px solid var(--grn-line);
  border-radius: 8px; padding: 9px 11px;
}
.share-url:focus { outline: none; border-color: var(--grn-bar); }
.share-btn {
  flex-shrink: 0; border: 0; cursor: pointer; color: #fff; font-weight: 600; font-size: 13px;
  padding: 10px 16px; border-radius: 8px;
  background: linear-gradient(180deg, var(--grn-bar2), var(--grn-bar));
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}
.share-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 22px -12px rgba(21,95,51,0.8); }
.share-btn:active { transform: translateY(0); }
.share-btn.copied { background: var(--grn-deep); }

.status-card.late .share-bar { background: rgba(255,255,255,0.6); border-color: #e7c4bd; }
.status-card.late .share-lead svg,
.status-card.late .share-title { color: #b3401f; }

/* ===== Behind-schedule theme overrides ===== */
.status-card.late { border-color: #e7c4bd; background: #fcf2f0; box-shadow: 0 14px 34px -22px rgba(140,40,25,0.5); }
.status-card.late .card-bar { background: linear-gradient(180deg, #cf5236, #b3401f); }
.status-card.late .card-meta { background: rgba(255,255,255,0.6); border-bottom-color: #e7c4bd; }

.date-box.c-proof.pending { border-style: dashed; }
.date-box.c-proof.pending .value.empty { color: #c08a1e; font-style: italic; }

@media (max-width: 760px) {
  .card-body { grid-template-columns: 1fr; }
  .calendar { max-width: 360px; }
}
@media (max-width: 480px) {
  .date-grid { grid-template-columns: 1fr; }
  .portal { padding: 32px 18px 56px; }
}
