/*
 * core.css — Shared styles for Provid Proposal authenticated pages
 * -----------------------------------------------------------
 * Extracted from 18 inline <style> blocks.
 * Each page should <link> this in <head>, then keep ONLY page-specific styles inline.
 */

/* ── Design Tokens ──────────────────────────────────────────────────────── */
:root {
  --blue1: #0b3c7a;
  --blue2: #0a58b0;
  --accent: #1b55db;
  --ink: #0b1220;
  --muted: rgba(11,18,32,.62);
  --line: rgba(10,88,176,.14);
  --card: rgba(255,255,255,.94);
  --radius: 18px;
  --ok: #1f7a39;
  --warn: #b86b00;
  --bad: #b42318;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 700px at 50% 30%, #e6eeff 0%, #f7f9ff 55%, #ffffff 100%);
  color: var(--ink);
  padding-bottom: 70px;
}

/* ── Sticky Header ──────────────────────────────────────────────────────── */
header.ps-header {
  background: linear-gradient(180deg, var(--blue1) 0%, var(--blue2) 100%);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: nowrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}
.ps-brand { display:flex; align-items:center; gap:12px; font-weight:900; letter-spacing:.2px; font-size:16px; white-space:nowrap; }
.ps-brand img { height:48px; width:auto; }
.ps-nav { display:flex; align-items:center; gap:8px; flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; }
.ps-nav::-webkit-scrollbar { display:none; }
.ps-nav a { flex-shrink:0; }
.ps-nav a {
  color: #fff; text-decoration: none; font-weight: 800;
  padding: 10px 12px; border: 1px solid rgba(255,255,255,.22);
  border-radius: 12px; background: rgba(255,255,255,.10);
  line-height: 1; font-size: 13px;
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .15s, border-color .15s;
}
.ps-nav a svg { flex-shrink: 0; vertical-align: middle; }
.ps-nav a:hover { background: rgba(255,255,255,.18); }
.ps-nav a.active { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.35); }
.ps-right { display:flex; align-items:center; gap:10px; white-space:nowrap; }
.ps-pill {
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px;
  padding: 8px 10px; background: rgba(255,255,255,.18);
  font-weight: 800; font-size: 12px;
}
.ps-pill.clickable { cursor:pointer; color:#fff; }
.ps-icon-btn {
  display:flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:999px;
  background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.18);
  color:#fff; text-decoration:none; cursor:pointer; transition:background .15s;
}
.ps-icon-btn:hover { background:rgba(255,255,255,.22); }
.ps-logout-btn {
  display:flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:999px;
  border:1px solid rgba(255,255,255,.22); background:rgba(255,255,255,.10);
  color:#fff; text-decoration:none; cursor:pointer; transition:background .15s;
}
.ps-logout-btn:hover { background:rgba(255,255,255,.22); }
.ps-btn {
  cursor:pointer; color:#fff; text-decoration:none; font-weight:900;
  padding:10px 14px; border:1px solid rgba(255,255,255,.25);
  border-radius:12px; background: rgba(255,255,255,.10); font-size:13px;
}
.ps-btn:hover { background: rgba(255,255,255,.18); }

/* Platform admin nav uses same blue header styling as tenant nav */

/* ── Layout ─────────────────────────────────────────────────────────────── */
main { padding:18px; display:flex; justify-content:center; }
.wrap { width: min(1440px, 96%); margin: 0 auto; }
.wrap-wide { width: min(1600px, 98%); margin: 0 auto; }
.wrap-narrow { width: min(960px, 96%); margin: 0 auto; }
.toprow { display:flex; align-items:flex-end; justify-content:space-between; gap:14px; margin:6px 0 14px 0; }
h1 { margin:0; font-size:22px; font-weight:950; letter-spacing:.2px; }
.sub { margin-top:6px; color:var(--muted); font-size:13px; line-height:1.4; max-width:900px; }

/* ── Cards & Panels ─────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 12px 26px rgba(0,0,0,.06);
  border: 1px solid var(--line);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
}
.card:hover {
  box-shadow: 0 16px 36px rgba(0,0,0,.10);
  border-color: rgba(10,88,176,.22);
}
.panel { padding: 14px; }
.panelhead { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; margin-bottom:10px; }
.ptitle { font-size:14px; font-weight:980; color:rgba(11,18,32,.85); }
.psub { font-size:12px; color:var(--muted); margin-top:4px; }
.pmeta { font-size:12px; color:var(--muted); font-weight:800; }

/* ── KPI Grid ───────────────────────────────────────────────────────────── */
.grid-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.kpi { padding:14px; display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:92px; }
.kpi .meta { display:flex; flex-direction:column; gap:6px; }
.kpi .label { font-size:12px; font-weight:950; color:rgba(11,18,32,.78); }
.kpi .value { font-size:30px; font-weight:980; letter-spacing:.2px; }
.kpi .hint { font-size:12px; color:var(--muted); }
.badge {
  font-weight:950; font-size:12px; padding:8px 10px;
  border-radius:12px; border:1px solid rgba(0,0,0,.08);
  background: rgba(255,255,255,.65); color: rgba(11,18,32,.78);
  user-select:none; min-width:110px; text-align:center;
}
.b-ok { border-color: rgba(31,122,57,.30); background: rgba(31,122,57,.10); color: rgba(31,122,57,.95); }
.b-soon { border-color: rgba(180,35,24,.0); background: rgba(10,88,176,.10); color: rgba(10,88,176,.95); }

/* ── 2-Column Layout ────────────────────────────────────────────────────── */
.layout { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:12px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
input, textarea {
  width: 100%; padding: 10px;
  border-radius: 12px; border: 1px solid rgba(10,88,176,.14);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
button {
  width: auto; padding: 10px;
  border-radius: 12px; border: 1px solid rgba(10,88,176,.14);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus, .input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,85,219,.10);
  outline: none;
}
textarea { min-height:110px; resize:vertical; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.field-full { grid-column: 1 / -1; }
.action-row { display:flex; gap:10px; flex-wrap:wrap; margin-top:6px; }
.action-row button { width:auto; background:#0a58b0; color:#fff; border:0; font-weight:800; cursor:pointer; transition: opacity .15s, transform .1s; }
.action-row button:hover { opacity:.92; }
.action-row button:active { transform: scale(.97); }

/* ── Preformatted ────────────────────────────────────────────────────────── */
pre {
  background: #f6f9ff; border: 1px solid rgba(10,88,176,.10);
  border-radius: 12px; padding: 12px; overflow: auto;
  font-size: 12px; white-space: pre-wrap; word-break: break-word;
}

/* ── Modals ──────────────────────────────────────────────────────────────── */
.modal { position:fixed; inset:0; display:none; z-index:10040; }
.modal.show { display:block; }
/* Injected modal pattern used by opportunities.js (_showNoAttachmentsModal,
   _showOppUpgradeModal). Mirrors the .modal/.modalBackdrop overlay contract —
   without these rules the JS-built panels render in normal flow at the end of
   body and are invisible to users. Audit: audit_opp_modal_css.sh. */
.opp-modal { position:fixed; inset:0; display:none; z-index:10050; }
.opp-modal-backdrop { position:absolute; inset:0; background: rgba(2,8,23,.45); }
.opp-modal-panel { position:relative; z-index:1; max-height: 90vh; overflow-y: auto; }
.modalBackdrop {
  position:absolute; inset:0; background: rgba(2,8,23,.45);
  animation: modalFadeIn .2s ease-out;
}
.modalPanel {
  position:relative; max-width:720px;
  margin: 9vh auto 0 auto; background: var(--card);
  border-radius: 18px; box-shadow: 0 14px 40px rgba(2,8,23,.22);
  border: 1px solid rgba(15,23,42,.10); overflow: hidden;
  max-height: 90vh; overflow-y: auto;
  animation: modalSlideIn .25s ease-out;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideIn { from { opacity: 0; transform: translateY(-16px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modalHead {
  padding: 14px 16px; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  border-bottom: 1px solid rgba(15,23,42,.10);
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
}
.modalTitle { font-weight:900; font-size:16px; }
.modalSub { color: var(--muted); font-size:12px; margin-top:2px; }
.iconBtn {
  border: 1px solid rgba(15,23,42,.12); background: #fff;
  width:34px; height:34px; border-radius:10px;
  cursor:pointer; font-weight:900; color: var(--muted);
  transition: background .15s, border-color .15s, transform .1s;
  display:flex; align-items:center; justify-content:center;
  line-height:1; padding:0;
}
.iconBtn:hover { background: #f0f4ff; border-color: rgba(10,88,176,.20); }
.iconBtn:active { transform: scale(.93); }
.modalBody { padding: 14px 16px 4px 16px; }
.grid2 { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lbl { display:block; font-size:12px; font-weight:900; color: #0b3c7a; margin-bottom:6px; }
.input {
  width:100%; padding:10px 12px; border-radius:12px;
  border:1px solid rgba(15,23,42,.18); outline:none;
  font-size:13px; background:#fff;
}
.help { margin-top:10px; color: var(--muted); font-size:12px; }
.err {
  margin-top:10px; padding:10px 12px; border-radius:12px;
  background: rgba(220,38,38,.08); border:1px solid rgba(220,38,38,.20);
  color: rgba(153,27,27,1); font-size:12px; font-weight:800; display:none;
}
.ok {
  margin-top:10px; padding:10px 12px; border-radius:12px;
  background: rgba(22,163,74,.08); border:1px solid rgba(22,163,74,.20);
  color: #166534; font-size:12px; font-weight:800; display:none;
}
.modalFoot {
  padding: 12px 16px 14px 16px; display: flex;
  justify-content: flex-end; gap: 10px; flex-wrap: wrap;
}
.btnLite, .btnPri {
  padding: 9px 12px; border-radius: 12px; font-weight: 900;
  font-size: 13px; cursor: pointer;
  border: 1px solid rgba(15,23,42,.16); background: #fff;
  color: var(--ink); width: auto;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.btnLite:hover { background: #f0f4ff; border-color: rgba(10,88,176,.20); }
.btnLite:active, .btnPri:active { transform: scale(.97); }
.btnPri {
  border-color: rgba(11,78,162,.22);
  background: linear-gradient(180deg, var(--blue1) 0%, var(--blue2) 100%);
  color: #fff;
}
.btnPri:hover { box-shadow: 0 4px 12px rgba(11,60,122,.25); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
table { width:100%; border-collapse:collapse; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: #fff;
  color: rgba(11,18,32,.65); font-size: 12px; font-weight: 800;
  padding: 10px 12px; text-align: left; white-space: nowrap;
  border-bottom: 2px solid var(--line);
}
tbody td {
  padding: 10px 12px; font-size: 13px;
  border-bottom: 1px solid var(--line);
}
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(10,88,176,.04); }

/* ── Footer ─────────────────────────────────────────────────────────────── */
.ps-footer {
  position: fixed; left: 0; right: 0; bottom: 0; height: 44px;
  display: flex; justify-content: center; align-items: center;
  text-align: center; z-index: 9999; pointer-events: none;
  background: rgba(255,255,255,.96);
  border-top: 1px solid rgba(10,88,176,.10);
  backdrop-filter: blur(6px);
}
.ps-footer__text {
  font: 700 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color: #0b3c7a; letter-spacing: .2px;
}

/* ── Utility Classes ────────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 12px; }
.gap-lg { gap: 18px; }
.grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.grid-3 { display:grid; grid-template-columns:repeat(3, 1fr); gap:12px; }
.grid-4 { display:grid; grid-template-columns:repeat(4, 1fr); gap:12px; }
.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; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 13px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 22px; }
.font-bold { font-weight: 800; }
.font-heavy { font-weight: 950; }
.text-muted { color: var(--muted); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* ── Shared Filter Bar ──────────────────────────────────────────────────── */
.filters { display:flex; gap:8px; flex-wrap:wrap; }
.filters input, .filters select {
  padding:7px 10px; border:1.5px solid var(--line);
  border-radius:8px; font-size:12px; font-family:inherit;
  outline:none; background:#fff;
}
.filters input:focus, .filters select:focus { border-color: var(--accent); }
.filters input { width:200px; }
.btn-primary {
  padding:9px 18px; border:none; border-radius:10px;
  background: linear-gradient(135deg, var(--accent), var(--blue1));
  color:#fff; font-weight:800; font-size:13px; cursor:pointer;
  transition: opacity .15s, transform .1s, box-shadow .15s;
}
.btn-primary:hover { opacity:.92; box-shadow: 0 4px 12px rgba(27,85,219,.30); }
.btn-primary:active { transform: scale(.97); }

/* ── Toast Notifications ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed; top: 18px; right: 18px; z-index: 10050;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); pointer-events: auto;
  animation: toastIn .3s ease-out;
  max-width: 380px;
}
.toast--success { background: #ecfdf5; border: 1px solid rgba(22,163,74,.25); color: #166534; }
.toast--error { background: #fef2f2; border: 1px solid rgba(220,38,38,.25); color: #991b1b; }
.toast--info { background: #eff6ff; border: 1px solid rgba(10,88,176,.20); color: var(--blue1); }
.toast--out { animation: toastOut .25s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

/* ── Button Loading State ───────────────────────────────────────────────── */
.btn-loading {
  pointer-events: none;
  opacity: .7;
  position: relative;
}
.btn-loading::after {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btnSpin .6s linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}
@keyframes btnSpin { to { transform: rotate(360deg); } }

/* ── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: .6;
}
.empty-state .empty-msg {
  font-size: 14px;
  font-weight: 800;
  color: rgba(11,18,32,.65);
  margin-bottom: 4px;
}
.empty-state .empty-hint {
  font-size: 12px;
  color: var(--muted);
}

/* ── Confirmation Dialog ───────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 10060;
  display: flex; align-items: center; justify-content: center;
  background: rgba(2,8,23,.45);
  animation: modalFadeIn .2s ease-out;
}
.confirm-panel {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 14px 40px rgba(2,8,23,.22);
  border: 1px solid rgba(15,23,42,.10);
  max-width: 420px; width: 90%;
  animation: modalSlideIn .25s ease-out;
  overflow: hidden;
}
.confirm-panel .confirm-head {
  padding: 16px 18px 0 18px;
}
.confirm-panel .confirm-title {
  font-weight: 900; font-size: 16px; color: var(--ink);
}
.confirm-panel .confirm-body {
  padding: 10px 18px 18px 18px;
  font-size: 13px; color: var(--muted); line-height: 1.5;
}
.confirm-panel .confirm-foot {
  padding: 0 18px 16px 18px;
  display: flex; justify-content: flex-end; gap: 10px;
}
.confirm-panel .btn-cancel {
  padding: 9px 16px; border-radius: 10px; font-weight: 800;
  font-size: 13px; cursor: pointer; background: #fff;
  border: 1px solid rgba(15,23,42,.16); color: var(--ink);
  transition: background .15s; width: auto;
}
.confirm-panel .btn-cancel:hover { background: #f0f4ff; }
.confirm-panel .btn-danger {
  padding: 9px 16px; border-radius: 10px; font-weight: 800;
  font-size: 13px; cursor: pointer; color: #fff;
  background: #dc2626; border: 1px solid #dc2626;
  transition: opacity .15s; width: auto;
}
.confirm-panel .btn-danger:hover { opacity: .9; }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; padding: 12px 0; flex-wrap: wrap;
}
.pagination button {
  min-width: 34px; height: 34px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font-size: 12px; font-weight: 700;
  cursor: pointer; color: var(--ink);
  transition: background .15s, border-color .15s;
  width: auto;
}
.pagination button:hover:not(:disabled) { background: #f0f4ff; border-color: var(--accent); }
.pagination button:disabled { opacity: .4; cursor: default; }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .page-info { font-size: 12px; color: var(--muted); font-weight: 700; margin: 0 8px; }

/* ── Offline Banner ─────────────────────────────────────────────────────── */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10100;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #fef3c7, #fde68a);
  border-bottom: 1px solid rgba(217,119,6,.30);
  color: #92400e; font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  animation: offlineBannerIn .3s ease-out;
}
.offline-banner svg {
  flex-shrink: 0;
}
@keyframes offlineBannerIn {
  from { opacity: 0; transform: translateY(-100%); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Loading Skeleton ───────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #e8edf5 25%, #f0f4fa 50%, #e8edf5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}
.skeleton-text { height: 14px; width: 80%; margin-bottom: 8px; }
.skeleton-card { height: 92px; border-radius: var(--radius); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Page Transition ────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
main { animation: fadeIn .25s ease-out; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
/* ProvidProposal-BreakpointFix 2026-05-28: was max-width: 1400px which hid nav
   labels on every 14" laptop (1366, 1440, 1512 all ≤ 1400). Lowered to
   1100px so all common laptop displays (≥1100px wide) keep labels and only
   tablets/small windows collapse to icon-only. */
@media (max-width: 1100px) {
  .ps-nav a .nav-label { display:none; }
  .ps-nav a { padding:10px; }
  .ps-nav { gap:5px; }
}
@media (max-width: 1180px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  header.ps-header { position: static; }
}
@media (max-width: 768px) {
  .toprow { flex-direction:column; align-items:flex-start; }
  .panelhead { flex-direction:column; align-items:flex-start; }
  .panelhead > div:last-child { width:100%; display:flex; flex-wrap:wrap; gap:8px; }
  .grid2 { grid-template-columns:1fr; }
  .filters, .filter-group, .top-bar { flex-direction:column; align-items:stretch; }
  .filters select, .filters input { min-width:0; width:100%; }
}
@media (max-width: 600px) {
  .grid-kpi { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .ps-nav { gap: 4px; }
  .ps-nav a { padding: 8px; }
  .ps-brand img { height:36px; }
  .ps-brand #orgName { font-size:14px; }
  h1 { font-size:18px; }
}
