/*
 * Customer portal page. Standalone on purpose: guests never load console.css or the staff shell.
 * Brand values, fonts and the sign-in panel match console.css; stage and status colours match
 * Active Projects.
 */
@font-face { font-family: Barlow; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/Barlow-400.woff2") format("woff2"); }
@font-face { font-family: Barlow; font-style: normal; font-weight: 500; font-display: swap; src: url("/fonts/Barlow-500.woff2") format("woff2"); }
@font-face { font-family: Barlow; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/Barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("/fonts/BarlowSemiCondensed-600.woff2") format("woff2"); }

:root {
  --flame: #238dc1;
  --deep: #1a6e99;
  --deep-hover: #124f6f;
  --trade: #6f7271;
  --plate: #f3f6f8;
  --panel: #ffffff;
  --thead: #f7f9fa;
  --tint: #e6f2f9;
  --tint-ink: #155e84;
  --line: #dce3e8;
  --line-soft: #e6ecf0;
  --field: #c9d3da;
  --dash: #a9b7c1;
  --ink: #1b262e;
  --muted: #5b6268;
  --link: #1a6e99;
  --shadow-sm: 0 1px 2px rgba(27, 38, 46, .06);
  --pill-draft-bg: #eef1f3; --pill-draft: #4a5359;
  --pill-sent-bg: #e3f1f9;  --pill-sent: #155e84;
  --pill-won-bg: #e4f3ea;   --pill-won: #24663f;
  --pill-lost-bg: #f8e8e5;  --pill-lost: #93392c;
  --pill-hold-bg: #f8f1dc;  --pill-hold: #7a5b12;
  --pill-budget-bg: #efeaf7; --pill-budget: #5a3f8a;
  --ap-welding: #155e84;
  --ap-structural: #3f4549;
  --ap-assembly: #24663f;
  --ap-ndt: #5a3f8a;
  --ap-testing: #7a5b12;
  --ap-coating: #1a625c;
  --ap-finalizing: #8a3c17;
  --font: Barlow, ui-sans-serif, system-ui, sans-serif;
  --font-cond: "Barlow Semi Condensed", Barlow, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--plate);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 3px solid color-mix(in srgb, var(--flame) 45%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- Sign-in (same as the console) */
.gate { position: relative; min-height: 100vh; display: flex; background: var(--plate); overflow: hidden; }
.gate-panel {
  position: relative;
  flex: 0 0 57%;
  min-height: 100vh;
  background: var(--flame);
  clip-path: polygon(0 0, 100% 0, 84% 100%, 0 100%);
  overflow: hidden;
}
.gate-watermark { position: absolute; left: 26%; top: 28%; height: 92%; opacity: .13; pointer-events: none; user-select: none; }
.gate-kerf {
  position: absolute;
  left: -5%;
  top: 68%;
  width: 125%;
  height: 2px;
  background: rgba(255, 255, 255, .55);
  transform: rotate(-17deg);
  transform-origin: left center;
}
.gate-lockup { position: absolute; left: 64px; top: 64px; width: 300px; max-width: calc(100% - 96px); height: auto; }
.gate-side { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; padding: 48px 96px 48px 40px; min-width: 0; }
.gate-form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 24px; }
.gate-head { display: flex; flex-direction: column; gap: 8px; }
.gate-form h1 { margin: 0; font-family: var(--font-cond); font-weight: 600; font-size: 36px; line-height: 1.1; }
.gate-sub, .gate-note { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.5; }
.gate-note { font-size: 14px; }
.gate-ms {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--field);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font: 600 16px var(--font);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.gate-ms:hover { border-color: var(--dash); background: color-mix(in srgb, var(--panel) 92%, var(--flame)); }
.gate-ms:disabled { color: var(--muted); cursor: default; background: var(--panel); }
.gate-ms svg { width: 20px; height: 20px; flex-shrink: 0; }
.gate-status { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--tint); color: var(--tint-ink); font-size: 14px; }
.gate-foot { position: absolute; right: 96px; bottom: 40px; margin: 0; font-size: 13px; color: var(--trade); }

/* ---------------------------------------------------------------- Signed in */
.pt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  background: var(--flame);
  color: #fff;
}
.pt-lockup { width: 168px; height: auto; display: block; }
.pt-who { display: flex; align-items: center; gap: 16px; font-weight: 500; }
.pt-link { border: 0; background: none; color: #fff; font: 500 15px var(--font); text-decoration: underline; cursor: pointer; padding: 4px 0; }
.pt-main { max-width: 1440px; margin: 0 auto; padding: 28px 32px 40px; }
.pt-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pt-head h1 { margin: 0; font-family: var(--font-cond); font-weight: 600; font-size: 30px; line-height: 1.1; }
.pt-sub { margin: 4px 0 0; color: var(--muted); font-size: 16px; }
.pt-tools { display: flex; gap: 8px; }
.pt-search {
  height: 38px;
  width: 240px;
  padding: 0 12px;
  border: 1px solid var(--field);
  border-radius: 8px;
  font: 400 15px var(--font);
  color: var(--ink);
  background: var(--panel);
}
.pt-btn {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--deep);
  color: #fff;
  font: 600 15px var(--font);
  cursor: pointer;
}
.pt-btn:hover { background: var(--deep-hover); }
.pt-btn:disabled { opacity: .6; cursor: default; }
.pt-status { margin: 16px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--tint); color: var(--tint-ink); }
.pt-asof { margin: 16px 0 8px; color: var(--muted); font-size: 14px; min-height: 1em; }
.pt-empty { margin: 24px 0; padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); }
.pt-foot { margin: 20px 0 0; color: var(--trade); font-size: 13px; }

/* ---------------------------------------------------------------- Table */
.pt-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); }
.pt-table { width: 100%; border-collapse: collapse; min-width: 1100px; }
.pt-table th, .pt-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.pt-table thead th {
  position: sticky;
  top: 0;
  background: var(--thead);
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.pt-stage-h { border-top: 3px solid var(--line); }
.pt-stage-h.ap-welding { border-top-color: var(--ap-welding); }
.pt-stage-h.ap-structural { border-top-color: var(--ap-structural); }
.pt-stage-h.ap-assembly { border-top-color: var(--ap-assembly); }
.pt-stage-h.ap-ndt { border-top-color: var(--ap-ndt); }
.pt-stage-h.ap-testing { border-top-color: var(--ap-testing); }
.pt-stage-h.ap-coating { border-top-color: var(--ap-coating); }
.pt-stage-h.ap-finalizing { border-top-color: var(--ap-finalizing); }
.pt-group + .pt-group tr:first-child > * { border-top: 2px solid var(--line); }
.pt-proj { min-width: 220px; max-width: 320px; font-weight: 400; }
.pt-id { display: block; font-weight: 600; }
.pt-desc { display: block; color: var(--ink); }
.pt-design { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.pt-comp .pt-proj { padding-left: 28px; }
.pt-cname { color: var(--muted); font-weight: 500; }
.pt-comp td, .pt-comp th { background: color-mix(in srgb, var(--plate) 55%, var(--panel)); }
.pt-stage { min-width: 112px; }
.pt-dates { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pt-ship { white-space: nowrap; }
.pt-ready {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--pill-won-bg);
  color: var(--pill-won);
  font-size: 12px;
  font-weight: 600;
}

.pt-chip { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 600; white-space: nowrap; background: var(--pill-draft-bg); color: var(--pill-draft); }
.pt-chip.pt-blank { background: transparent; color: var(--dash); font-weight: 500; padding-left: 0; }
.pt-chip.st-done { background: var(--pill-won-bg); color: var(--pill-won); }
.pt-chip.st-in_progress { background: var(--pill-sent-bg); color: var(--pill-sent); }
.pt-chip.st-needed { background: var(--pill-lost-bg); color: var(--pill-lost); }
.pt-chip.st-hold { background: var(--pill-hold-bg); color: var(--pill-hold); }
.pt-chip.st-paused { background: var(--pill-budget-bg); color: var(--pill-budget); }
.pt-chip.st-none { background: var(--pill-draft-bg); color: var(--pill-draft); }

/* ---------------------------------------------------------------- Narrower screens */
@media (max-width: 1180px) {
  .gate-panel { flex-basis: 50%; }
}

/* Phone: the sign-in panel stacks, and each project becomes a card with labelled stages. */
@media (max-width: 760px) {
  .gate { flex-direction: column; overflow: auto; }
  .gate-panel { flex: 0 0 420px; min-height: 420px; clip-path: polygon(0 0, 100% 0, 100% 84%, 0 100%); }
  .gate-lockup { left: 24px; top: 40px; width: 210px; }
  .gate-watermark { left: 38%; top: 20%; height: 100%; }
  .gate-kerf { top: 72%; }
  .gate-side { padding: 8px 24px 32px; justify-content: flex-start; }
  .gate-form h1 { font-size: 30px; }
  .gate-foot { position: static; margin-top: 28px; }

  .pt-bar { padding: 12px 16px; }
  .pt-lockup { width: 132px; }
  .pt-main { padding: 20px 16px 32px; }
  .pt-tools, .pt-search { width: 100%; }
  .pt-search { flex: 1 1 auto; }

  .pt-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .pt-table, .pt-table tbody, .pt-table tr, .pt-table th, .pt-table td { display: block; min-width: 0; max-width: none; }
  .pt-table { min-width: 0; }
  .pt-table thead { display: none; }
  .pt-group { margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .pt-group + .pt-group tr:first-child > * { border-top: 0; }
  .pt-table tr { padding: 4px 0; }
  .pt-comp { border-top: 1px solid var(--line); }
  .pt-table th.pt-proj { border-bottom: 1px solid var(--line-soft); padding: 12px 14px; }
  .pt-comp .pt-proj { padding-left: 14px; }
  .pt-table td {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    padding: 6px 14px;
    border-bottom: 0;
  }
  .pt-table td::before { content: attr(data-label); flex: 0 0 7.5rem; color: var(--muted); font-size: 13px; font-weight: 500; }
  .pt-dates { display: inline; margin: 0; }
}
