/*
 * Tax Savings Calculator — "Live Local Savings Scan" deal-card styles.
 *
 * Used in two renderers from ONE stylesheet:
 *   1. On screen, linked on tax-savings-calculator.html (the injected full-width card).
 *   2. Inlined into the client PDF by TaxSavingsPdfService (openhtmltopdf).
 *
 * openhtmltopdf's CSS engine does NOT resolve CSS custom properties (var()) and has
 * limited flexbox support, so this file deliberately uses RAW HEX values (taken from
 * the app's NiceAdmin palette in main.css) and table / inline-block / absolute layout.
 * That also makes the on-screen card a true WYSIWYG preview of the printed PDF.
 *
 * App palette mapping (main.css):
 *   navy/heading  #012970   green/success #21a66c   accent/teal #5b9bd5
 *   default text  #2d3a4e   muted         #667085   light       #98a2b3
 *   border        #dbe3ff   border-light  #ebefff   danger      #e74c63
 *   info          #2f80ed   warning       #ec9f05   surface     #ffffff
 *
 * All rules are scoped under .dealcard / .tsc-sticky so nothing leaks onto the page.
 */

/* Sticky wrapper (screen only; unused in the PDF render) */
.tsc-sticky {
  position: sticky;
  top: calc(64px + 1rem); /* clear the fixed header (--header-height: 64px) */
}

.dealcard {
  font-family: 'Nunito Sans', Helvetica, Arial, sans-serif;
  color: #2d3a4e;
  background: #ffffff;
  border: 1px solid #dbe3ff;
  border-radius: 12px;
  box-shadow: 0 8px 24px -16px rgba(1, 41, 112, 0.35);
  overflow: hidden;
  font-size: 14px;
  line-height: 1.45;
}

/* ---- Head ---- */
.dealcard .dc-head {
  position: relative; /* anchors the screen-only action buttons top-right */
  padding: 18px 24px 14px;
  background: #f5f7ff;
  border-bottom: 1px solid #ebefff;
  text-align: center;
}
/* Screen-only Download / Close buttons, pinned to the card's top-right corner so the
   centered title can never push them around. */
.dealcard .dc-actions {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 1;
}
.dealcard .dc-title {
  font-size: 24px;
  font-weight: 800;
  color: #012970;
}
.dealcard .addr {
  font-size: 14px;
  color: #667085;
  margin-top: 2px;
}
/* PDF-only meta strip under the address line */
.dealcard .meta-strip {
  display: table;
  width: 100%;
  table-layout: fixed;
  margin-top: 12px;
  border-top: 1px solid #dbe3ff;
  padding: 10px 0 0;
}
.dealcard .ms-cell {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
}
.dealcard .ms-k {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #98a2b3;
  font-weight: 700;
  margin-right: 6px;
}
.dealcard .ms-v {
  font-size: 12.5px;
  font-weight: 700;
  color: #2d3a4e;
}

/* ---- Hero ---- */
.dealcard .hero {
  padding: 18px 24px 20px;
  text-align: center;
  border-bottom: 1px solid #ebefff;
}
/* Headline tile (NiceAdmin crypto-card style): the app's accent blue (#5b9bd5, the
   brand color on buttons), gradient toward its 15%-darker shade like main.css's
   .widget-color-stat.primary. Two thirds wide, centered. CSS-table layout
   (openhtmltopdf: no flexbox); the solid background-color stands in wherever the
   gradient is unsupported. */
.dealcard .hero-card {
  display: table;
  width: 66.667%;
  margin: 0 auto;
  table-layout: fixed;
  background-color: #5b9bd5;
  background-image: linear-gradient(135deg, #5b9bd5 0%, #4d84b5 100%);
  border-radius: 12px;
  text-align: left;
}
.dealcard .hc-icon-cell {
  display: table-cell;
  width: 84px;
  vertical-align: middle;
  text-align: center;
  padding: 14px 0;
}
/* The crypto-card translucent disc around the icon. SOLID 25%-white-over-accent tint,
   not rgba: it reads identically on the tile but is guaranteed in the PDF renderer,
   where alpha backgrounds have proven unreliable. The icon inside is an inline SVG
   (bootstrap-icons building-check), absolutely centered. */
.dealcard .hc-icon {
  display: inline-block;
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #84b3de;
  vertical-align: middle;
}
.dealcard .hc-icon svg {
  position: absolute;
  left: 12px;
  top: 12px;
  width: 24px;
  height: 24px;
}
.dealcard .hc-body {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
  padding: 14px 12px;
}
/* Empty right cell mirroring the icon column, so the centered text sits on the
   card's true axis instead of being pushed right by the icon. */
.dealcard .hc-spacer {
  display: table-cell;
  width: 84px;
}
.dealcard .hero .lab {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #eef5fc;
  font-weight: 700;
}
.dealcard .hero .big {
  font-size: 36px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
  margin: 4px 0 2px;
}
.dealcard .hero .perunit {
  font-size: 13px;
  color: #e3eefa;
}

/* Verdict pill (CSS disc, not a glyph) */
.dealcard .verdict {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
}
.dealcard .verdict .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 7px;
  margin-top: -2px;
}
.dealcard .verdict.strong {
  background: #dcf8ea;
  border: 1px solid #b9ecd3;
  color: #178a57;
}
.dealcard .verdict.strong .dot {
  background: #21a66c;
}
.dealcard .verdict.moderate {
  background: #fff3cd;
  border: 1px solid #ffe69c;
  color: #997404;
}
.dealcard .verdict.moderate .dot {
  background: #d39e00;
}
.dealcard .verdict.weak {
  background: #ffe3e8;
  border: 1px solid #f6c4cd;
  color: #c8344a;
}
.dealcard .verdict.weak .dot {
  background: #e74c63;
}

/* ---- Section titles ---- */
.dealcard .sec-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #012970;
  font-weight: 800;
  margin-bottom: 8px;
}

/* ---- Two columns (PDF): tax ledger | diligence flags. On screen the flags column
       is dropped (.single) and the ledger spans the full width. ---- */
.dealcard .dc-cols {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-bottom: 1px solid #ebefff;
}
.dealcard .dc-col {
  display: table-cell;
  vertical-align: top;
  padding: 16px 24px 14px;
}
.dealcard .dc-col-ledger {
  width: 56%;
  border-right: 1px solid #ebefff;
}
.dealcard .dc-col-flags {
  width: 44%;
}
.dealcard .dc-cols.single .dc-col-ledger {
  width: 100%;
  border-right: none;
}

/* Ledger */
.dealcard .dc-line {
  display: table;
  width: 100%;
  padding: 6px 0;
}
.dealcard .dc-line .k {
  display: table-cell;
  text-align: left;
  color: #667085;
  padding-right: 10px;
}
.dealcard .dc-line .v {
  display: table-cell;
  text-align: right;
  font-weight: 700;
  color: #012970;
  white-space: nowrap;
}
.dealcard .dc-line .v.neg {
  color: #e74c63;
}
.dealcard .dc-line .v.pos {
  color: #21a66c;
}
.dealcard .dc-line.subtotal {
  border-top: 1px solid #ebefff;
}
.dealcard .dc-line.subtotal .k {
  font-weight: 700;
  color: #2d3a4e;
}
/* Total row: navy rule + light navy band. Horizontal padding stays 0 so the value
   keeps perfect right-alignment with the rows above (openhtmltopdf has no calc()
   to compensate for negative margins). */
.dealcard .dc-line.total {
  border-top: 2px solid #012970;
  background: #f5f7ff;
}
.dealcard .dc-line.total .k {
  font-weight: 800;
  color: #2d3a4e;
}
.dealcard .dc-line.total .v {
  font-size: 16px;
}

/* Diligence flags */
.dealcard .flags {
  margin-bottom: 10px;
}
.dealcard .flag {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: #667085;
}
.dealcard .flag .fi {
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dealcard .flag b {
  color: #2d3a4e;
}
.dealcard .flag.ok .fi {
  background: #21a66c;
}
.dealcard .flag.info .fi {
  background: #2f80ed;
}
.dealcard .flag.warn .fi {
  background: #ec9f05;
}
.dealcard .flag.danger .fi {
  background: #e74c63;
}

/* Footnote paragraphs under the flags */
.dealcard .dc-note {
  font-size: 11px;
  color: #98a2b3;
  line-height: 1.5;
  margin: 0 0 6px;
}

/* ---- Scenario comparison table ---- */
.dealcard .scenario-table {
  padding: 14px 24px 6px;
}
.dealcard table.scn {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
/* Unit-mix fixed column grid (the scenario table above is independent: its three
   unsized columns split the width into equal thirds under table-layout: fixed).
   Unspecified columns split the remainder. */
.dealcard th.w-type { width: 12%; }
.dealcard th.w-maxrent { width: 13%; }
.dealcard th.w-units { width: 9%; }
.dealcard th.w-exempt { width: 10%; }
.dealcard th.w-money { width: 18%; }
.dealcard table.scn th {
  text-align: right;
  font-size: 9.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #98a2b3;
  font-weight: 700;
  padding: 6px 8px;
  border-bottom: 1px solid #dbe3ff;
  background: #f8f9fc;
}
/* Space-between: first column hugs the left edge, the middle centers, the last hugs
   the right edge. The middle is classed (.scn-mid) rather than :nth-child so
   openhtmltopdf renders it identically to the browser. */
.dealcard table.scn th:first-child,
.dealcard table.scn td:first-child {
  text-align: left;
}
.dealcard table.scn th.scn-mid,
.dealcard table.scn td.scn-mid {
  text-align: center;
}
.dealcard table.scn td {
  text-align: right;
  padding: 8px;
  border-bottom: 1px solid #ebefff;
  color: #2d3a4e;
  font-weight: 700;
}
.dealcard table.scn tr:last-child td {
  border-bottom: none;
}
.dealcard table.scn td.neg {
  color: #e74c63;
}
.dealcard table.scn td.scn-net.pos {
  color: #21a66c;
}
.dealcard table.scn td.scn-net.neg {
  color: #e74c63;
}
/* The single (recommended) row is tinted by the verdict tier — the same red/yellow/
   green family as the verdict pill above. */
.dealcard table.scn tr.strong td {
  background: #dcf8ea;
}
.dealcard table.scn tr.strong td:first-child {
  border-left: 3px solid #21a66c;
}
.dealcard table.scn tr.moderate td {
  background: #fff3cd;
}
.dealcard table.scn tr.moderate td:first-child {
  border-left: 3px solid #d39e00;
}
.dealcard table.scn tr.weak td {
  background: #ffe3e8;
}
.dealcard table.scn tr.weak td:first-child {
  border-left: 3px solid #e74c63;
}

/* ---- Unit-mix table ---- */
.dealcard .perunit-table {
  padding: 14px 24px 6px;
}
.dealcard table.put {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.dealcard table.put th {
  text-align: right;
  font-size: 9.5px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #98a2b3;
  font-weight: 700;
  padding: 6px 8px;
  border-bottom: 1px solid #dbe3ff;
  background: #f8f9fc;
}
.dealcard table.put th:first-child,
.dealcard table.put td:first-child {
  text-align: left;
}
.dealcard table.put td {
  text-align: right;
  padding: 8px;
  border-bottom: 1px solid #ebefff;
  color: #2d3a4e;
}
.dealcard table.put tr:last-child td {
  border-bottom: none;
}
.dealcard table.put tr.alt td {
  background: #fbfcfe;
}
.dealcard table.put td.exempt.exempt-full {
  color: #178a57; /* strong green at 100% */
  font-weight: 700;
}
.dealcard table.put td.exempt.exempt-partial {
  color: #5cbf8a; /* lighter green at 75% */
  font-weight: 700;
}
.dealcard table.put td.exempt.exempt-none {
  color: #c8344a;
  font-weight: 700;
}
/* Money columns share the ledger's navy so the card reads as one system. */
.dealcard table.put td.flat {
  color: #012970;
  font-weight: 700;
}
/* Net benefit above zero is green; $0 stays navy. */
.dealcard table.put td.flat.pos {
  color: #21a66c;
}
.dealcard table.put td.reduction {
  color: #012970;
  font-weight: 700;
}
/* Red only when the winning plan actually gives up rent on the line; $0 stays plain. */
.dealcard table.put td.reduction.neg {
  color: #e74c63;
}
/* Totals row: same emphasis as the ledger's total line. */
.dealcard table.put tr.tot td {
  border-top: 2px solid #012970;
  background: #f5f7ff;
  font-weight: 800;
}
.dealcard table.put tr.tot td.put-type {
  color: #012970;
}

/* ---- Next-step band ---- */
.dealcard .next-band {
  display: table;
  width: 100%;
  table-layout: fixed;
  background: #012970;
  color: #ffffff;
  margin-top: 8px;
}
.dealcard .nb-cell {
  display: table-cell;
  vertical-align: middle;
  padding: 14px 24px;
}
.dealcard .nb-text {
  font-size: 14px;
}
.dealcard .nb-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: #9fb6e8;
  margin-right: 10px;
}
.dealcard .nb-qr {
  width: 220px;
  text-align: right;
  white-space: nowrap;
}
.dealcard .nb-qr-cap {
  display: inline-block;
  vertical-align: middle;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  color: #9fb6e8;
  white-space: normal;
  width: 96px;
  text-align: right;
  margin-right: 10px;
}
/* White plate around the QR so its quiet zone survives on the navy band. */
.dealcard .nb-qr-img {
  display: inline-block;
  vertical-align: middle;
  background: #ffffff;
  padding: 5px;
  border-radius: 4px;
}
.dealcard .nb-qr-img img {
  display: block;
  width: 64px;
  height: 64px;
}

/* ---- Footer ---- */
.dealcard .dc-foot {
  display: table;
  width: 100%;
  padding: 12px 24px 14px;
  background: #f8f9fc;
  border-top: 1px solid #ebefff;
}
.dealcard .df-cell {
  display: table-cell;
  vertical-align: middle;
}
.dealcard .df-logo {
  width: 64px;
  padding-right: 14px;
  border-right: 1px solid #dbe3ff;
}
.dealcard .df-logo img {
  display: block;
  width: 50px;
}
.dealcard .df-text {
  padding-left: 14px;
  font-size: 11px;
  color: #667085;
  line-height: 1.5;
}
.dealcard .df-brand {
  font-size: 12px;
  font-weight: 800;
  color: #012970;
  letter-spacing: 0.02em;
}

/* When the on-screen page itself is printed (Ctrl+P), drop screen-only chrome. */
@media print {
  .tsc-sticky {
    position: static;
  }
  .dealcard {
    box-shadow: none;
    border: 1px solid #dbe3ff;
  }
  .dealcard .no-print {
    display: none !important;
  }
}
