/* Pharmacy Portal - report aesthetic ported from the .ps1 HTML reports
   (Segoe UI, soft background, shaded uppercase table headers, zebra rows, tabular numerals,
   underlined section headers, KPI tiles). Layered over Bootstrap; restyles existing markup. */

:root {
  --ink: #1a2233;
  --mut: #6b7688;
  --line: #e4e8ef;
  --bg: #f6f8fb;
  --head: #eef2f8;
  --good: #0a7f4f;
  --bad: #c0392b;
  --warn: #d97706;
  --accent: #1f6feb;
}

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}
@media (min-width: 768px) {
  html { font-size: 16px; }
}

body {
  margin-bottom: 60px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

/* ---- nav / chrome ---- */
.navbar.bg-white { box-shadow: 0 1px 0 rgba(0, 0, 0, .04); }
.navbar-brand { font-weight: 700; color: var(--ink); }
.breadcrumb { font-size: .8rem; }

/* ---- headings ---- */
main h3 { font-weight: 700; font-size: 1.45rem; color: var(--ink); }
main h5:not(.card-title) {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 1.5rem;
  padding-bottom: .35rem;
  border-bottom: 2px solid var(--line);
}
.fw-semibold.text-uppercase.text-muted { letter-spacing: .04em; }

/* ---- cards / KPI tiles ---- */
.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: none;
}
.card .card-title { font-weight: 700; font-size: 1.05rem; }
.card-body .text-uppercase.small { letter-spacing: .04em; color: var(--mut); }

/* ---- tables: the report look ---- */
.container table.table {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  font-size: .85rem;
  color: var(--ink);
}
.container table.table > thead > tr > th {
  background: var(--head);
  color: var(--mut);
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .04em;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.container table.table > tbody > tr > td,
.container table.table > thead > tr > th { padding: .45rem .7rem; }
.container table.table > tbody > tr > td { border-bottom: 1px solid var(--line); }
.container table.table > tbody > tr:last-child > td { border-bottom: 0; }
/* zebra, but never override a highlighted total row (.table-light) */
.container table.table > tbody > tr:nth-child(even):not(.table-light) > td { background: #fafbfd; }
/* numeric columns line up */
.container table.table .text-end { font-variant-numeric: tabular-nums; }
/* bordered variant (P&L / KPI tables) uses the soft line color */
.container table.table-bordered td,
.container table.table-bordered th { border: 1px solid var(--line); }

/* ---- KPI band (3-card top row, matches the HTML report tiles) ---- */
.kpi-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 0 0 1.1rem;
}
.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.kpi-card.gray { background: #f3f6fa; }   /* light gray highlight (e.g. Gross Profit) */
.kpi-card.green { background: #eef6f1; }   /* light green highlight (e.g. Net Operating Income) */
.kpi-card.red { background: #fbeeec; }
.kpi-label { color: var(--mut); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.5rem; font-weight: 700; margin-top: 5px; line-height: 1.1; }
.kpi-value.sm { font-size: 1.05rem; }
.kpi-sub { color: var(--mut); font-size: .72rem; margin-top: 3px; }

/* ---- P&L highlighted rows (gray Gross Profit, green Net Operating Income) - beat zebra ---- */
.container table.table tr.pl-gp > td { background: #f3f6fa !important; font-weight: 600; }
.container table.table tr.pl-net > td { background: #eef6f1 !important; font-weight: 700; }
/* P&L-by-Entity cards: borderless compact table, no zebra (highlight rows above still win via !important) */
.card table.table { border: none; font-size: .8rem; }
.card table.table td { padding: .3rem .45rem; border-bottom: 1px solid var(--line); }
.container .card table.table > tbody > tr:nth-child(even) > td { background: #fff; }
.card table.table > tbody > tr:last-child > td { border-bottom: 0; }

/* ---- filter forms ---- */
form .form-label.small {
  color: var(--mut);
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .03em;
}

/* ---- positive / negative emphasis (match report greens/reds) ---- */
.text-success { color: var(--good) !important; }
.text-danger { color: var(--bad) !important; }
.text-warning { color: var(--warn) !important; }

/* ---- keep Bootstrap focus + form-floating behavior ---- */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus,
.form-control:focus, .form-select:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder { text-align: start; }
