/* ===========================================================
   Standalone demo of the proposed PO form - not part of ConnectPortal.
   The look is copied from the portal's stylesheets (mailsafe.css + portal.css);
   the "demo-" rules at the end are only for this demo.
   =========================================================== */

/* ---------- design tokens (mailsafe.css) ---------- */
:root {
  --blue: #2f80d6; --blue-600: #2670c0; --blue-700: #1f5fa8;
  --cyan: #5bc0eb; --navy: #0d2340; --navy-900: #08182e;
  --red: #e5202a;
  --ink: #16263f; --muted: #5d6b82; --muted-2: #8593a8;
  --bg: #ffffff; --bg-soft: #f3f8fe; --bg-soft-2: #eef4fb;
  --line: #e7eef7; --line-2: #dce6f2;
  --r-sm: 10px; --r: 16px; --r-lg: 26px; --r-pill: 999px;
  --sh-sm: 0 1px 2px rgba(13,35,64,.06), 0 1px 3px rgba(13,35,64,.05);
  --grad: linear-gradient(135deg,#2f80d6 0%,#36a7e6 55%,#5bc0eb 100%);
  --grad-deep: linear-gradient(140deg,#102b50 0%,#16386b 45%,#1f5fa8 100%);
  --ease: cubic-bezier(.22,.61,.36,1);
  --maxw: 1480px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-head: 'Plus Jakarta Sans', var(--font);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg-soft);
  font-size: 17px; line-height: 1.65; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-head); color: var(--navy); line-height: 1.15; margin: 0 0 .5em; font-weight: 800; letter-spacing: -.02em; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1rem; }
a { color: var(--blue-700); text-decoration: none; transition: color .2s; }
a:hover { color: var(--blue); }
img { max-width: 100%; display: block; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55em; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: .98rem;
  padding: .85em 1.6em; border-radius: var(--r-pill); border: 1px solid transparent;
  cursor: pointer; transition: transform .18s var(--ease), box-shadow .25s, background .25s, color .2s;
  white-space: nowrap; line-height: 1;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px rgba(47,128,214,.32); }
.btn-primary:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 16px 34px rgba(47,128,214,.42); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--line-2); box-shadow: var(--sh-sm); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }

/* ---------- top bar ---------- */
.app-header { position: sticky; top: 0; z-index: 60; background: var(--grad-deep); color: #fff; box-shadow: 0 6px 24px rgba(13,35,64,.18); }
.app-header .nav { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 24px; }
.app-header .brand img { height: 34px; width: auto; }
.app-header .nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.app-header .nav-links a {
  font-family: var(--font-head); font-weight: 600; font-size: .95rem;
  color: rgba(255,255,255,.82); padding: .5em .95em; border-radius: var(--r-pill); transition: background .2s, color .2s;
}
.app-header .nav-links a:hover { background: rgba(255,255,255,.12); color: #fff; }
.app-header .nav-links a.active { background: rgba(255,255,255,.16); color: #fff; }
.profile-btn {
  display: flex; align-items: center; gap: 10px; color: #fff;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.24);
  border-radius: var(--r-pill); padding: .38em .8em .38em .95em;
}
.profile-btn .who { font-family: var(--font-head); font-weight: 600; font-size: .92rem; color: #fff; line-height: 1.3; text-align: center; }
.profile-btn .who small { display: block; font-weight: 500; font-size: .76rem; color: rgba(255,255,255,.62); }

/* ---------- page ---------- */
.app-main { max-width: var(--maxw); margin: 0 auto; padding: 34px 24px; }
.app-main h1 { font-size: 1.7rem; line-height: 1.25; letter-spacing: -.015em; }
.page-title { font-family: var(--font-head); color: var(--navy); font-weight: 800; margin: 0 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 26px; }
.page-center { margin-left: auto; margin-right: auto; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh-sm); padding: 26px; }

/* ---------- forms ---------- */
.form-stack { display: grid; gap: 16px; }
.form-stack .field { display: flex; flex-direction: column; gap: 7px; }
.form-stack label { font-family: var(--font-head); font-weight: 600; font-size: .88rem; color: var(--navy); }
.form-stack label small { font-weight: 500; font-size: 1em; color: var(--muted); }
.form-stack input, .form-stack select, .form-stack textarea {
  font-family: var(--font); font-size: 1rem; color: var(--ink);
  padding: .72em 1em; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--bg-soft); transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-stack input:focus, .form-stack select:focus, .form-stack textarea:focus {
  outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 4px rgba(47,128,214,.12);
}
.form-stack textarea { line-height: 1.5; min-height: 5.6em; resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-error { color: var(--red); font-size: .84rem; }
.field-hint { color: var(--muted); font-size: .82rem; }
.form-stack label.req::after { content: " *"; color: var(--red); }

/* ---------- workflow form: steps, sections, side cards ---------- */
.flow-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; list-style: none; margin: 0 0 22px; padding: 0; }
.flow-steps li { display: flex; align-items: center; gap: 9px; font-family: var(--font-head); font-weight: 600; font-size: .88rem; color: var(--muted-2); }
.flow-steps li + li::before { content: ""; width: 38px; height: 2px; border-radius: 2px; background: var(--line-2); margin-right: 3px; }
.flow-steps li.done + li::before { background: #bce4cd; }
.flow-steps .dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid var(--line-2); font-size: .78rem; font-weight: 800; }
.flow-steps .done { color: #14653b; }
.flow-steps .done .dot { background: #e6f6ee; border-color: #bce4cd; }
.flow-steps .current { color: var(--navy); }
.flow-steps .current .dot { background: var(--blue); border-color: var(--blue); color: #fff; }

.flow-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.flow-main { display: grid; gap: 18px; }
.flow-side { position: sticky; top: 88px; display: grid; gap: 18px; }
.flow-section { padding: 0; }
.flow-section-head { display: flex; align-items: center; gap: 14px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.flow-num {
  display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-soft-2); color: var(--blue-700); font-family: var(--font-head); font-weight: 800; font-size: .92rem;
}
.flow-section-head h3 { margin: 0; font-size: 1.05rem; }
.flow-section-head p { margin: 2px 0 0; color: var(--muted); font-size: .86rem; }
.flow-section-body { padding: 22px 24px 24px; }
.flow-subhead { font-family: var(--font-head); font-weight: 700; font-size: .9rem; color: var(--navy); margin-bottom: -6px; }
.flow-subhead small { font-weight: 500; color: var(--muted); }

.upload-box {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 26px 20px; text-align: center;
  border: 2px dashed var(--line-2); border-radius: var(--r-sm); background: var(--bg-soft); transition: border-color .2s, background .2s;
}
.upload-box:hover, .upload-box:focus-within { border-color: var(--blue); background: #fff; }
.upload-box input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.upload-icon { width: 34px; height: 34px; color: var(--blue); }
.upload-title { font-family: var(--font-head); font-weight: 700; color: var(--navy); }
.upload-title span { color: var(--blue-700); text-decoration: underline; }
.upload-hint { color: var(--muted); font-size: .84rem; }
.upload-file { margin-top: 4px; font-size: .9rem; font-weight: 600; color: #14653b; overflow-wrap: anywhere; }
.upload-file.is-empty { display: none; }
.upload-box.is-invalid { border-color: var(--red); background: #fff8f8; }

.flow-card-title { font-family: var(--font-head); font-weight: 700; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 10px; }
.flow-customer { font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; color: var(--navy); margin-bottom: 14px; overflow-wrap: anywhere; }
.flow-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px 14px; margin: 0; font-size: .92rem; }
.flow-dl dt { color: var(--muted); }
.flow-dl dd { margin: 0; text-align: right; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
#sumPeriod { white-space: nowrap; }
.flow-actions { display: grid; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.flow-actions .btn { width: 100%; justify-content: center; text-align: center; }
.flow-note { margin: 12px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }

@media (max-width: 1000px) {
  .flow-layout { grid-template-columns: 1fr; }
  .flow-side { position: static; }
}
@media (max-width: 760px) {
  .app-header .nav-links { display: none; }   /* demo only: keeps the bar on one line on a phone */
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
  .flow-steps { flex-direction: column; align-items: flex-start; }
  .flow-steps li + li::before { display: none; }
}

/* ---------- demo only ---------- */
.demo-banner { padding: 14px 18px; margin-bottom: 18px; border: 1px solid #bcd8f5; border-radius: var(--r-sm); background: #eef6ff; color: var(--navy); font-size: .92rem; line-height: 1.5; }
.demo-banner-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 18px; }
.demo-switch { font-family: var(--font-head); font-weight: 700; white-space: nowrap; }
.demo-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; color: var(--muted); font-size: .84rem; }
.demo-legend .demo-tag { margin-right: 6px; }
.demo-tag { display: inline-block; padding: .2em .6em; border-radius: var(--r-pill); font-family: var(--font-head); font-size: .66rem; font-weight: 700; letter-spacing: .06em; line-height: 1.5; text-transform: uppercase; vertical-align: middle; white-space: nowrap; }
.demo-tag.new { background: #e6f6ee; color: #14653b; }
.demo-tag.deal { background: #eef1f5; color: #5b6b80; }
.demo-tag.extra { background: #f1ecfb; color: #5b3fa0; }
.demo-tag.decide { background: #fff1d6; color: #8a5a00; }
.flow-section-head h3 .demo-tag, .flow-subhead .demo-tag, .flow-card-title .demo-tag { margin-left: 8px; }
.demo-label { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.demo-decide { padding: 8px 11px; border-left: 3px solid #f0b54a; border-radius: 0 6px 6px 0; background: #fffaf0; color: #7a5200; font-size: .82rem; line-height: 1.45; }
.demo-decide strong { color: #6b4700; }
.form-stack input[readonly] { background: #eef2f7; color: #5b6b80; cursor: default; }
.form-stack input[readonly]:focus { border-color: var(--line-2); background: #eef2f7; box-shadow: none; }
.demo-row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.demo-declaration { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-soft); color: var(--ink); font-size: .92rem; line-height: 1.55; }
.form-stack label.demo-check { display: flex; align-items: flex-start; gap: 10px; color: var(--ink); font-family: var(--font); font-size: .94rem; font-weight: 500; line-height: 1.45; cursor: pointer; }
.demo-check input[type=checkbox] { flex-shrink: 0; width: 18px; height: 18px; margin: 2px 0 0; padding: 0; accent-color: var(--blue); }
.demo-after dd { font-weight: 500; }
.demo-sent { display: none; margin-top: 10px; padding: 9px 12px; border-radius: var(--r-sm); background: #eef6ff; color: var(--navy); font-size: .86rem; }
@media (max-width: 640px) { .demo-row3 { grid-template-columns: 1fr; } }

/* ---------- start page (index.html) ---------- */
.demo-start { max-width: 980px; margin: 0 auto; }
.demo-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-top: 8px; }
.demo-card { display: flex; flex-direction: column; gap: 12px; color: var(--ink); transition: transform .18s var(--ease), box-shadow .25s, border-color .2s; }
.demo-card:hover { color: var(--ink); transform: translateY(-3px); border-color: var(--blue); box-shadow: 0 16px 34px rgba(18,52,92,.12); }
.demo-card h2 { margin: 0; font-size: 1.25rem; }
.demo-card p { margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.55; }
.demo-card ul { margin: 0; padding-left: 1.15em; color: var(--ink); font-size: .92rem; line-height: 1.6; }
.demo-card .demo-open { margin-top: auto; font-family: var(--font-head); font-weight: 700; color: var(--blue-700); }
.demo-card-kicker { font-family: var(--font-head); font-weight: 700; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.demo-start-note { margin-top: 22px; color: var(--muted); font-size: .88rem; }
@media (max-width: 760px) { .demo-cards { grid-template-columns: 1fr; } }
