/* IPI-PORTAL-STYLESHEET-VERSION: 1.0.0 (P1 design system, 2026-08-03) */
/* ============================================================================
   IPI Operations Portal — shared design system.
   Tokens come from the LIVE WEBSITE stylesheet (design authority per
   CLAUDE.md), not the brand guidelines document. Defined once here; every
   portal page loads this file and adds only page-specific rules.
   Powered by FinancySuite — same one-shared-file pattern as their nav.css.
   ============================================================================ */

/* ---------------------------------------------------------------- tokens -- */
:root {
  /* colour — from public_html/css/style.css */
  --primary-blue:      #0B5FFF;
  --primary-blue-dark: #0A4DD6;
  --primary-700:       #0A1931;   /* navy — sidebar, headings */
  --light-blue:        #39A0D8;
  --accent-500:        #1874B6;   /* brand-guidelines blue: secondary accent ONLY */

  --grey-50:  #F8FAFC;  --grey-100: #F1F5F9;  --grey-200: #E2E8F0;
  --grey-300: #CBD5E1;  --grey-400: #94A3B8;  --grey-500: #64748B;
  --grey-600: #475569;  --grey-700: #334155;  --grey-800: #1E293B;
  --grey-900: #0F172A;

  --success: #10B981;  --success-bg: #D1FAE5;  --success-ink: #065F46;
  --warning: #F59E0B;  --warning-bg: #FEF3C7;  --warning-ink: #92400E;
  --danger:  #EF4444;  --danger-bg:  #FEE2E2;  --danger-ink:  #991B1B;
  --info-bg: #DBEAFE;  --info-ink:   #1E40AF;

  /* type */
  --font-heading: 'Manrope', 'Inter', -apple-system, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* spacing scale — matches website's --xs:4px … --hero:64px */
  --sp-xs: 4px;  --sp-sm: 8px;  --sp-md: 16px;  --sp-lg: 24px;
  --sp-xl: 32px; --sp-2xl: 48px; --sp-hero: 64px;

  /* radius — website: 8/12/16/20/24 + pill */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-2xl: 24px;
  --r-pill: 999px;

  /* 5 shadow levels — matching the website's scale */
  --shadow-1: 0 1px 2px rgba(10,25,49,.06);
  --shadow-2: 0 1px 3px rgba(10,25,49,.08), 0 1px 2px rgba(10,25,49,.04);
  --shadow-3: 0 4px 6px rgba(10,25,49,.07), 0 2px 4px rgba(10,25,49,.05);
  --shadow-4: 0 10px 15px rgba(10,25,49,.08), 0 4px 6px rgba(10,25,49,.04);
  --shadow-5: 0 20px 25px rgba(10,25,49,.10), 0 8px 10px rgba(10,25,49,.04);

  --nav-width: 264px;
  --transition: all .18s ease;
}

/* ------------------------------------------------------------------ base -- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px; line-height: 1.55;
  background: var(--grey-50); color: var(--grey-900);
}
h1,h2,h3,h4 { font-family: var(--font-heading); color: var(--primary-700); font-weight: 800; }
a { color: var(--primary-blue); }
:focus-visible { outline: 3px solid rgba(11,95,255,.4); outline-offset: 2px; border-radius: 4px; }

/* --------------------------------------------------------------- buttons -- */
/* Extends the website's .btn family (7 variants) — same names, portal-sized */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border: 1px solid transparent; border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--primary-blue); color: #fff; }
.btn-primary:hover:not(:disabled)   { background: var(--primary-blue-dark); }
.btn-secondary { background: #fff; color: var(--grey-700); border-color: var(--grey-300); }
.btn-secondary:hover:not(:disabled) { background: var(--grey-50); border-color: var(--grey-400); }
.btn-outline   { background: transparent; color: var(--primary-blue); border-color: var(--primary-blue); }
.btn-outline:hover:not(:disabled)   { background: rgba(11,95,255,.06); }
.btn-ghost     { background: transparent; color: var(--grey-600); }
.btn-ghost:hover:not(:disabled)     { background: var(--grey-100); color: var(--grey-900); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled)   { filter: brightness(.94); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled)    { filter: brightness(.94); }
.btn-pill      { border-radius: var(--r-pill); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: var(--r-md); }

/* ---------------------------------------------------------------- badges -- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em;
}
.badge-neutral { background: var(--grey-100);   color: var(--grey-600); }
.badge-info    { background: var(--info-bg);    color: var(--info-ink); }
.badge-success { background: var(--success-bg); color: var(--success-ink); }
.badge-warning { background: var(--warning-bg); color: var(--warning-ink); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-ink); }
/* record-status → badge mapping, one place so every screen agrees */
.badge.st-Draft, .badge.st-Pending    { background: var(--grey-100);   color: var(--grey-600); }
.badge.st-Sent, .badge.st-Open        { background: var(--info-bg);    color: var(--info-ink); }
.badge.st-Approved, .badge.st-Active,
.badge.st-Paid, .badge.st-Won         { background: var(--success-bg); color: var(--success-ink); }
.badge.st-RenewalDue, .badge.st-PendingApproval,
.badge.st-PartiallyPaid               { background: var(--warning-bg); color: var(--warning-ink); }
.badge.st-Overdue, .badge.st-Cancelled,
.badge.st-Rejected, .badge.st-Lost,
.badge.st-Expired                     { background: var(--danger-bg);  color: var(--danger-ink); }

/* ----------------------------------------------------------------- cards -- */
.card {
  background: #fff; border: 1px solid var(--grey-200);
  border-radius: var(--r-lg); box-shadow: var(--shadow-2);
}
.card-pad { padding: var(--sp-lg); }
.card-header {
  padding: var(--sp-md) var(--sp-lg); border-bottom: 1px solid var(--grey-100);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md);
}
.card-title { font-size: 15px; font-weight: 700; }

.stat-card { padding: var(--sp-lg); }
.stat-label { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--grey-500); margin-bottom: 6px; }
.stat-value { font-family: var(--font-heading); font-size: 30px; font-weight: 800;
  color: var(--primary-700); line-height: 1.1; }
.stat-sub   { font-size: 12.5px; color: var(--grey-500); margin-top: 4px; }

/* ----------------------------------------------------------------- forms -- */
.form-label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--grey-700); margin-bottom: 6px;
}
.form-label .req { color: var(--danger); }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 14px; font-family: var(--font-body); font-size: 14px;
  color: var(--grey-900); background: #fff;
  border: 1px solid var(--grey-300); border-radius: var(--r-sm);
  transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(11,95,255,.15);
}
.form-input.is-error { border-color: var(--danger); }
.form-error  { font-size: 12.5px; color: var(--danger-ink); margin-top: 5px; }
.form-hint   { font-size: 12.5px; color: var(--grey-500); margin-top: 5px; }
.form-row    { display: grid; gap: var(--sp-md); margin-bottom: var(--sp-md); }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 720px) { .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; } }

/* money pair — original currency first, converted second (CLAUDE.md rule) */
.money { font-variant-numeric: tabular-nums; font-weight: 600; }
.money-converted { font-size: 12px; color: var(--grey-500); font-weight: 500; }

/* ---------------------------------------------------------------- tables -- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 10px 16px; background: var(--grey-50);
  color: var(--grey-600); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--grey-200); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--grey-100); vertical-align: middle; }
.table tbody tr:hover { background: var(--grey-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------------------------------------------------------------- alerts -- */
.alert { display: flex; gap: 10px; padding: 12px 16px; border-radius: var(--r-md);
  font-size: 13.5px; border: 1px solid transparent; }
.alert-info    { background: var(--info-bg);    color: var(--info-ink); }
.alert-success { background: var(--success-bg); color: var(--success-ink); }
.alert-warning { background: var(--warning-bg); color: var(--warning-ink); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger-ink); }

/* ---------------------------------------------------------------- modals -- */
.modal { display: none; position: fixed; inset: 0; background: rgba(10,25,49,.55);
  z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal.show { display: flex; }
.modal-content { background: #fff; border-radius: var(--r-xl); padding: var(--sp-xl);
  max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-5); }
.modal-content h3 { font-size: 19px; margin-bottom: 8px; }
.modal-desc { font-size: 13.5px; color: var(--grey-500); margin-bottom: var(--sp-lg); }
.modal-actions { display: flex; gap: 12px; margin-top: var(--sp-lg); }
.modal-actions .btn { flex: 1; }

/* ---------------------------------------------------- app shell / sidebar -- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--nav-width); min-width: var(--nav-width);
  background: var(--primary-700); color: #fff;
  position: fixed; top: 0; bottom: 0; overflow-y: auto; z-index: 200;
  display: flex; flex-direction: column;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px;
  padding: 20px 22px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo { width: 38px; height: 38px; border-radius: 10px;
  background: var(--primary-blue); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 800; font-size: 15px; color: #fff; }
/* real website logo (same domain once deployed: /assets/logo/logo-white.svg);
   the .sidebar-logo monogram above is the automatic fallback when the file
   isn't reachable (e.g. local preview before deployment) */
.sidebar-logo-img { height: 40px; width: auto; max-width: 170px; display: block; }
.sidebar-name { font-family: var(--font-heading); font-size: 14.5px; font-weight: 800; line-height: 1.25; }
.sidebar-name small { display: block; font-family: var(--font-body); font-size: 10.5px;
  font-weight: 500; color: var(--grey-400); letter-spacing: .04em; }
.nav-section { padding: 14px 0 4px; }
.nav-section-title { padding: 4px 22px 6px; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em; color: var(--grey-400); }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 10px 22px;
  color: var(--grey-300); text-decoration: none; font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent; transition: var(--transition); }
.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-link.active { background: rgba(11,95,255,.18); color: #fff; border-left-color: var(--primary-blue); }
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding: 14px 22px; border-top: 1px solid rgba(255,255,255,.1);
  font-size: 12px; color: var(--grey-400); }
.sidebar-footer .user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sidebar-footer .avatar { width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary-blue); color: #fff; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.sidebar-footer .user-name { color: #fff; font-weight: 600; font-size: 13px; line-height: 1.2; }
.sidebar-footer .powered a { color: var(--grey-400); }

.main { flex: 1; margin-left: var(--nav-width); display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 100; background: #fff;
  border-bottom: 1px solid var(--grey-200); padding: 12px var(--sp-xl);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); }
.breadcrumb { font-size: 13px; color: var(--grey-500); }
.breadcrumb b { color: var(--grey-900); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.content { padding: var(--sp-xl); }
.page-header { margin-bottom: var(--sp-lg); }
.page-title { font-size: 24px; }
.page-subtitle { font-size: 13.5px; color: var(--grey-500); margin-top: 2px; }
.menu-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--grey-600); padding: 6px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-5); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .content { padding: var(--sp-md); }
}

/* ------------------------------------------------------- staging banner -- */
.staging-banner {
  background: var(--warning); color: #7C2D12; text-align: center;
  font-size: 12.5px; font-weight: 700; letter-spacing: .03em;
  padding: 7px 14px; position: sticky; top: 0; z-index: 300;
}
/* the sidebar is fixed, so when the banner is present it must start below it
   (ipi-ui.js adds .has-staging to <body> and sets --staging-h to the
   banner's measured height, so a 2-line banner on phones still works) */
body.has-staging .sidebar { top: var(--staging-h, 31px); }

/* ---------------------------------------------------- notification bell -- */
.notif { position: relative; }
.notif-btn { position: relative; background: none; border: 1px solid var(--grey-200);
  border-radius: var(--r-sm); padding: 8px; cursor: pointer; color: var(--grey-600);
  display: flex; transition: var(--transition); }
.notif-btn:hover { background: var(--grey-50); color: var(--grey-900); }
.notif-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: var(--r-pill); background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif-panel { display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 360px; max-width: 92vw; background: #fff; border: 1px solid var(--grey-200);
  border-radius: var(--r-lg); box-shadow: var(--shadow-4); overflow: hidden; z-index: 500; }
.notif-panel.show { display: block; }
.notif-head { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--grey-50); border-bottom: 1px solid var(--grey-100); }
.notif-head h4 { font-size: 14px; }
.notif-head button { background: none; border: 0; color: var(--primary-blue);
  font-size: 12px; font-weight: 600; cursor: pointer; }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 16px; text-decoration: none;
  color: inherit; border-bottom: 1px solid var(--grey-100); cursor: pointer; }
.notif-item:hover { background: var(--grey-50); }
.notif-item.unread { background: #EFF6FF; }
.notif-item.unread:hover { background: var(--info-bg); }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notif-dot.info { background: var(--primary-blue); } .notif-dot.success { background: var(--success); }
.notif-dot.warning { background: var(--warning); }   .notif-dot.urgent { background: var(--danger); }
.notif-title { font-size: 13px; font-weight: 600; line-height: 1.35; }
.notif-body { font-size: 12px; color: var(--grey-500); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--grey-400); margin-top: 3px; }
.notif-empty { padding: 32px 16px; text-align: center; color: var(--grey-400); font-size: 13px; }

/* ------------------------------------------------------------ utilities -- */
.grid { display: grid; gap: var(--sp-lg); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.mt-md { margin-top: var(--sp-md); } .mt-lg { margin-top: var(--sp-lg); } .mt-xl { margin-top: var(--sp-xl); }
.mb-md { margin-bottom: var(--sp-md); } .mb-lg { margin-bottom: var(--sp-lg); }
.text-muted { color: var(--grey-500); } .text-sm { font-size: 12.5px; }
.flex { display: flex; align-items: center; gap: var(--sp-sm); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); }
