@font-face { font-family: "Source Sans Pro"; src: url("/fonts/SourceSansPro-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans Pro"; src: url("/fonts/SourceSansPro-It.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Sans Pro"; src: url("/fonts/SourceSansPro-Semibold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans Pro"; src: url("/fonts/SourceSansPro-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Sans Pro"; src: url("/fonts/SourceSansPro-Light.ttf") format("truetype"); font-weight: 300; font-style: normal; font-display: swap; }

:root {
  --navy: #0B1E4A;
  --navy-mid: #1F3864;
  --navy-deep: #081534;
  --blue: #1A75FF;
  --blue-hover: #0d62e0;
  --section: #2C5494;
  --bg: #F3F5F9;
  --card: #fff;
  --text: #1c2330;
  --muted: #5c6575;
  --border: #D5DBE4;
  --border-light: #E6EAF0;
  --light: #E8ECF4;
  --green: #1B7A4A;
  --green-bg: #E5F6EC;
  --red: #C0392B;
  --red-bg: #FDECEA;
  --amber: #B86A00;
  --amber-bg: #FFF4DF;
  --teal: #0E6E7A;
  --teal-bg: #E3F4F6;
  --gray: #5E6672;
  --gray-bg: #EEF0F3;
  --violet: #5B4B9A;
  --violet-bg: #EEEAFA;
  --shadow: 0 1px 3px rgba(11,30,74,.08), 0 1px 2px rgba(11,30,74,.05);
  --shadow-md: 0 8px 24px rgba(11,30,74,.10);
  --sidebar: 250px;
  --radius: 10px;
  --font: "Source Sans Pro", "Liberation Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ===== LOGIN ===== */
.login-body {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  position: relative;
}
.login-body::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 28px;
  height: 4px;
  background: var(--blue);
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 14px;
  padding: 36px 36px 32px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  position: relative;
  z-index: 1;
}
.login-card .logo { display: block; height: 56px; width: auto; margin: 0 auto 18px; }
.login-card h1 { margin: 0 0 4px; text-align: center; font-size: 22px; color: var(--navy); }
.login-card .sub { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.login-card label { display: block; font-weight: 600; margin: 0 0 6px; font-size: 14px; }
.login-card input[type=text],
.login-card input[type=password] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  margin-bottom: 16px;
}
.login-card button {
  width: 100%;
  padding: 11px 16px;
  background: var(--navy);
  color: #fff;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.login-card button:hover { background: var(--navy-mid); }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }

/* ===== APP SHELL ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar);
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
}
.sidebar .brand {
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar .brand img {
  height: 42px;
  width: auto;
  background: #fff;
  border-radius: 7px;
  padding: 4px 7px;
  display: block;
}
.sidebar .brand .tag {
  font-size: 11px;
  color: #9aabc8;
  margin-top: 8px;
  letter-spacing: 0.02em;
}
.sidebar nav { padding: 12px 10px; flex: 1; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d5deee;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--blue); color: #fff; }
.sidebar .side-foot {
  padding: 14px 18px 18px;
  font-size: 12px;
  color: #8a9bb8;
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar .side-foot form { margin: 0; }
.sidebar .side-foot button.link {
  background: none; border: 0; color: #c5d0e4; cursor: pointer;
  font: inherit; padding: 0; font-weight: 600;
}
.sidebar .side-foot button.link:hover { color: #fff; }

.main {
  margin-left: var(--sidebar);
  flex: 1;
  min-width: 0;
  padding: 24px 28px 48px;
}
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 26px; color: var(--navy); letter-spacing: -0.02em; }
.topbar .lead { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.preview-banner {
  background: var(--amber-bg);
  color: #6b4500;
  border: 1px solid #f0d48a;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 7px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); color: #fff; }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-mid); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: #16653d; color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #a33025; color: #fff; }
.btn-amber { background: var(--amber); color: #fff; }
.btn-ghost {
  background: #fff;
  color: var(--navy);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--light); color: var(--navy); }
.btn-sm { padding: 5px 10px; font-size: 13px; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; color: var(--blue); font: inherit; cursor: pointer; padding: 0; font-weight: 600; }

/* cards / summary */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}
.card-stat {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px 14px;
  border-left: 4px solid var(--border);
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card-stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; color: inherit; }
.card-stat.active { outline: 2px solid var(--blue); }
.card-stat .k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.card-stat .n { font-size: 26px; font-weight: 700; color: var(--navy); line-height: 1.15; margin: 2px 0; }
.card-stat .v { font-size: 13px; font-weight: 600; color: var(--text); }
.card-stat .v small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.card-stat.status-Draft { border-left-color: var(--gray); }
.card-stat.status-Sent { border-left-color: var(--blue); }
.card-stat.status-Viewed { border-left-color: var(--teal); }
.card-stat.status-Accepted { border-left-color: var(--green); }
.card-stat.status-Declined { border-left-color: var(--red); }
.card-stat.status-Queried { border-left-color: var(--amber); }
.card-stat.status-all { border-left-color: var(--navy); }

.panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel h2 { margin: 0 0 12px; font-size: 16px; color: var(--navy); }
.panel h2 .hint { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 8px; }

/* tables */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: #fafbfe;
}
table.data td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
table.data tr:hover td { background: #f7f9fc; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .qnum { font-weight: 700; color: var(--navy); font-size: 15px; }
table.data a.qnum { text-decoration: none; }
table.data a.qnum:hover { text-decoration: underline; }
table.data .muted { color: var(--muted); font-size: 12.5px; }
table.data .right { text-align: right; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--gray-bg);
  color: var(--gray);
  white-space: nowrap;
}
.badge-Draft { background: var(--gray-bg); color: var(--gray); }
.badge-Sent { background: #e5efff; color: #1554c0; }
.badge-Viewed { background: var(--teal-bg); color: var(--teal); }
.badge-Accepted { background: var(--green-bg); color: var(--green); }
.badge-Declined { background: var(--red-bg); color: var(--red); }
.badge-Queried { background: var(--amber-bg); color: var(--amber); }
.badge-demo { background: var(--violet-bg); color: var(--violet); margin-left: 6px; }
.badge-preview { background: var(--amber-bg); color: var(--amber); }
.badge-sent { background: var(--green-bg); color: var(--green); }
.badge-failed { background: var(--red-bg); color: var(--red); }
.badge-queued { background: #e5efff; color: #1554c0; }

/* forms */
label, .label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 4px; color: var(--navy-mid); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=tel], input[type=url], input[type=search], input.price-input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font: inherit;
  font-size: 14.5px;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,117,255,.15);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 14px;
}
.form-row { margin-bottom: 12px; }
.form-row.span-2 { grid-column: span 2; }
.help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.checkbox input { width: auto; }

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 14px;
}
.filters .form-row { margin: 0; flex: 1; min-width: 180px; }
.filters input, .filters select { min-width: 0; }

.flash {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
}
.flash-success { background: var(--green-bg); color: var(--green); }
.flash-error { background: var(--red-bg); color: var(--red); }
.flash-info { background: #e5efff; color: #1554c0; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; }

/* ===== EDITOR ===== */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: 1fr; }
}
.sticky-side { position: sticky; top: 16px; }
.totals-box {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.totals-box .line { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.totals-box .grand {
  display: flex; justify-content: space-between;
  border-top: 1px solid rgba(255,255,255,.2);
  margin-top: 8px; padding-top: 10px;
  font-size: 18px; font-weight: 700;
}
.totals-box .qno { font-size: 12px; color: #9aabc8; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 6px; }

.section-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  background: #fff;
  overflow: hidden;
}
.section-head {
  background: #DDE3EE;
  padding: 8px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.section-head input { font-weight: 700; background: transparent; border-color: transparent; }
.section-head input:focus { background: #fff; border-color: var(--blue); }
.section-head .sec-actions { display: flex; gap: 4px; margin-left: auto; }
.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px 90px 100px 100px 36px;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border-light);
  align-items: start;
}
.item-row .desc-fields { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.section-head input { flex: 1; min-width: 0; }
.item-row .amt-display {
  padding: 8px 6px 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.section-foot {
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafbfe;
  border-top: 1px solid var(--border-light);
  font-size: 13px;
}
.section-foot .sec-total { font-weight: 700; }
@media (max-width: 900px) {
  .item-row { grid-template-columns: 1fr 1fr; }
  .item-row .desc-fields { grid-column: 1 / -1; }
}

.list-editor .le-item {
  display: flex; gap: 8px; margin-bottom: 6px; align-items: flex-start;
}
.list-editor textarea { min-height: 54px; }
.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  background: #fafbfe;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag { border-color: var(--blue); background: #eef4ff; }
.att-list { list-style: none; margin: 10px 0 0; padding: 0; }
.att-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
}
.att-list li .grow { flex: 1; min-width: 0; }
.att-list .fname { font-weight: 600; word-break: break-all; }
.att-list .fmeta { font-size: 12px; color: var(--muted); }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13.5px; }
.activity .when { color: var(--muted); font-size: 12px; }

.save-bar {
  position: sticky;
  bottom: 0;
  background: rgba(243,245,249,.95);
  backdrop-filter: blur(6px);
  padding: 10px 0 4px;
  margin: 12px 0 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  z-index: 5;
  border-top: 1px solid var(--border-light);
}
.save-status { font-size: 13px; color: var(--muted); margin-left: auto; }

/* ===== PORTAL ===== */
.portal-body { background: var(--bg); margin: 0; }
.portal-top {
  background: var(--navy);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.portal-top img {
  height: 44px; width: auto;
  background: #fff; border-radius: 7px; padding: 4px 8px;
}
.portal-wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }
.portal-hero {
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.portal-hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: var(--blue);
}
.portal-hero h1 { margin: 0 0 6px; font-size: 26px; font-weight: 600; }
.portal-hero .sub { color: #c5d0e4; margin: 0 0 14px; }
.portal-hero .meta { font-size: 14px; line-height: 1.6; }
.portal-hero .total { font-size: 26px; font-weight: 700; margin-top: 10px; }
.portal-hero .total span { font-size: 13px; font-weight: 400; color: #c5d0e4; display: block; }

.portal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0;
}
.doc-preview .items { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.doc-preview .items th {
  background: var(--navy-mid); color: #fff; text-align: left;
  padding: 7px 10px; font-weight: 600;
}
.doc-preview .items th.r, .doc-preview .items td.r { text-align: right; }
.doc-preview .items th.c, .doc-preview .items td.c { text-align: center; }
.doc-preview .items td { border-bottom: 1px solid var(--border); padding: 7px 10px; vertical-align: top; }
.doc-preview .items .grp td { background: #DDE3EE; font-weight: 700; }
.doc-preview .items .heading { font-weight: 700; }
.doc-preview .items .detail { font-size: 12.5px; color: #444; }
.doc-preview .items .sub td { font-style: italic; font-weight: 600; }
.doc-preview .items .tot td { background: var(--navy-mid); color: #fff; font-weight: 700; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
.terms-box { background: #E6EAF2; border-radius: 0 0 8px 8px; padding: 14px 18px; }
.terms-box-h { background: var(--navy-mid); color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .04em; padding: 8px 14px; border-radius: 8px 8px 0 0; }
.terms-box ul { margin: 0; padding: 0 0 0 18px; }
.terms-box li { margin: 0 0 8px; }

.sig-pad {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
  width: 100%;
  height: 140px;
  cursor: crosshair;
}
.responded {
  padding: 16px 18px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.responded.Accepted { background: var(--green-bg); }
.responded.Declined { background: var(--red-bg); }
.responded.Queried { background: var(--amber-bg); }

/* modal */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(11,30,74,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 22px 24px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  box-shadow: var(--shadow-md);
}
.modal h2 { margin: 0 0 12px; color: var(--navy); }
.hidden { display: none !important; }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0; }

.drawing-preview { max-width: 100%; max-height: 280px; border: 1px solid var(--border); border-radius: 6px; margin-top: 8px; }

code, .mono { font-family: "Geist Mono", "Liberation Mono", ui-monospace, monospace; font-size: 12.5px; }
.link-box { background: #f4f6fa; border-radius: 7px; padding: 8px 10px; word-break: break-all; font-size: 13px; }

.outbox-frame { border: 1px solid var(--border); border-radius: 8px; background: #fff; min-height: 400px; width: 100%; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 800px) { .settings-grid { grid-template-columns: 1fr; } }

.danger { color: var(--red); }

/* Multi-user, approvals, import, footer */
.nav-badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 99px;
  background: #e85d04;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  vertical-align: middle;
}
.sidebar nav a.active .nav-badge { background: #fff; color: var(--blue); }

.badge-Awaiting-approval { background: var(--violet-bg); color: var(--violet); }
.badge-Changes-requested { background: var(--amber-bg); color: var(--amber); }
.card-stat.status-Awaiting-approval { border-left-color: var(--violet); }
.card-stat.status-Changes-requested { border-left-color: var(--amber); }

.approval-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--violet-bg);
  border: 1px solid #d5caf0;
  border-left: 4px solid var(--violet);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 0 0 16px 0;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.approval-banner:hover { text-decoration: none; box-shadow: var(--shadow); color: inherit; }
.approval-banner strong { font-size: 22px; color: var(--violet); margin-right: 4px; }

.return-box, .info-box {
  background: var(--amber-bg);
  border: 1px solid #f0d9a0;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 0 0 16px 0;
}
.return-box h2 { margin: 0 0 6px 0; font-size: 16px; }
.info-box { background: var(--violet-bg); border-color: #d5caf0; border-left-color: var(--violet); }

.return-form { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }

.designed-by {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 28px 16px 12px;
  margin: 24px 0 0 0;
  letter-spacing: .01em;
}
.designed-by strong { color: var(--navy); font-weight: 700; }
.login-body .designed-by { color: #5c6575; }
.login-body .designed-by strong { color: var(--navy); }
.portal-body .designed-by { color: #8a94a6; padding-bottom: 28px; }
.portal-body .designed-by strong { color: var(--navy); }

.email-preview-frame {
  background: #f0f2f6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow: auto;
  max-height: 640px;
}
pre.email-text {
  white-space: pre-wrap;
  font-size: 13px;
  background: var(--light);
  padding: 12px;
  border-radius: 6px;
}

.inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 0 12px 8px 0;
}
.inline-form input { width: auto; min-width: 140px; padding: 6px 8px; }
.user-actions-row td { background: #fafbfe; border-top: none; padding-top: 0; padding-bottom: 12px; }
.add-user-form { margin-top: 8px; }

.mapping-form select, #import-preview select { min-width: 160px; }
.row-flagged { background: #FFF8EC; }
.row-blank { background: #f4f5f7; color: var(--muted); }
.flag { font-size: 12px; margin: 0 0 2px 0; }
.flag-existing { color: var(--amber); }
.flag-infile { color: var(--violet); }
.flag-blank { color: var(--muted); }
.import-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 18px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

/* Phone-friendly login and invite pages */
@media (max-width: 480px) {
  .login-body {
    padding: 24px 16px 56px;
    padding-top: max(24px, env(safe-area-inset-top, 0px));
    align-items: flex-start;
  }
  .login-card { padding: 28px 20px 24px; }
  .login-card input[type=text],
  .login-card input[type=password],
  .login-card input[type=email] {
    font-size: 16px;
    min-height: 48px;
    padding: 12px;
  }
  .login-card button {
    min-height: 48px;
    font-size: 16px;
  }
}

.invite-link-box, .link-box {
  font-family: inherit;
  font-size: 13px;
  word-break: break-all;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
}
.team-status-Invited { }
.copy-invite-btn { margin-top: 6px; }
.role-readonly {
  background: var(--light);
  font-weight: 600;
  color: var(--navy);
}

/* ===== TENDERS ===== */
.badge-Responses-in { background: var(--teal-bg); color: var(--teal); }
.badge-Awarded { background: var(--green-bg); color: var(--green); }
.badge-Closed { background: var(--gray-bg); color: var(--gray); }
.badge-pending { background: var(--gray-bg); color: var(--gray); }
.badge-viewed { background: #e5efff; color: #1554c0; }
.badge-submitted { background: var(--green-bg); color: var(--green); }
.badge-declined { background: var(--red-bg); color: var(--red); }
.badge-queried { background: var(--amber-bg); color: var(--amber); }

.invite-wording {
  background: #f4f6fa;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 18px;
  line-height: 1.55;
}
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 16px;
  margin: 0 0 18px;
  font-size: 14px;
}
.meta-grid .muted { display: block; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; font-weight: 700; margin-bottom: 2px; }
.site-visit-card {
  background: var(--amber-bg);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 18px;
}
.site-visit-card .k,
.drawings-link-banner .k {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--amber);
  margin-bottom: 4px;
}
.drawings-link-banner {
  background: #E5EFFF;
  border-left: 4px solid var(--section);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 18px;
  word-break: break-all;
}
.drawings-link-banner .k { color: var(--section); }
.tender-item-list { margin: 12px 0 0; padding-left: 20px; }
.tender-item-list li { margin-bottom: 8px; }
.tender-item-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 8px;
  margin-bottom: 8px;
  align-items: start;
}
@media (max-width: 800px) {
  .tender-item-row { grid-template-columns: 1fr; }
}
.trade-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.trade-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}
.trade-pill:has(input:checked) {
  background: #e5efff;
  border-color: var(--blue);
  color: var(--navy);
}
.subbie-picker {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
.subbie-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  margin: 0;
}
.subbie-row span { display: flex; flex-direction: column; min-width: 0; }
.subbie-row:hover { background: #f7f8fb; }
.compare-wrap { overflow-x: auto; }
.compare-table td, .compare-table th { vertical-align: top; }
.compare-table tr.is-lowest { background: var(--green-bg); }
.compare-table tr.is-awarded { box-shadow: inset 3px 0 0 var(--green); }
.lowest-tag { font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .04em; }
.attend-yes { color: var(--green); font-weight: 600; }
.compare-notes { font-size: 13px; max-width: 280px; }
.compare-notes > div { margin-bottom: 6px; }
.chk-inline { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 6px 0; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}
.upload-progress { margin-top: 10px; font-size: 13px; color: var(--muted); }
.upload-bar {
  height: 8px;
  background: var(--light);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.upload-bar span {
  display: block;
  height: 100%;
  background: var(--blue);
  border-radius: 999px;
}
.form-row .help, .help { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

input.price-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.portal-body .save-bar {
  position: static;
  background: transparent;
  backdrop-filter: none;
  border-top: 0;
  padding: 16px 0 0;
  margin: 16px 0 0;
}

.drop-zone { position: relative; }
.drop-zone input[type=file] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.plan-trade {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 14px;
  background: #fff;
}
.plan-trade.is-off { opacity: .65; }
.plan-trade-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.badge-conf-high { background: var(--green-bg); color: var(--green); }
.badge-conf-medium { background: var(--amber-bg); color: var(--amber); }
.badge-conf-low { background: var(--gray-bg); color: var(--gray); }
.badge-plan-ready { background: #e5efff; color: #1554c0; }
.badge-plan-created { background: var(--green-bg); color: var(--green); }
.badge-plan-analysing { background: var(--amber-bg); color: var(--amber); }
.badge-plan-failed { background: var(--red-bg); color: var(--red); }
.badge-plan-draft { background: var(--gray-bg); color: var(--gray); }

@media (max-width: 640px) {
  .doc-preview .table-wrap { overflow: visible; }
  .doc-preview .items thead { display: none; }
  .doc-preview .items,
  .doc-preview .items tbody { display: block; width: 100%; }
  .doc-preview .items tr {
    display: block;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 0 0 10px;
    padding: 10px 12px;
  }
  .doc-preview .items td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border: 0;
    padding: 3px 0;
  }
  .doc-preview .items td[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted);
    text-align: left;
    margin-right: auto;
  }
  .doc-preview .items td:not([data-label]) { display: block; text-align: left; }
  .doc-preview .items td.skip-mobile { display: none; }
  .doc-preview .items tr.grp {
    background: #DDE3EE;
    border: 0;
    padding: 8px 12px;
    margin: 16px 0 8px;
  }
  .doc-preview .items tr.tot { background: var(--navy-mid); color: #fff; }
  .doc-preview .items tr.tot td[data-label]::before { color: #c5d0e4; }
}
