/* =====================================================================
   Synovia Fusion — shared theme (LIGHT)                       v1.1.0
   Canonical copy: Production/Common/Branding/fusion_theme.css
   Deployed copy : Production/LiveWeb/app/static/css/fusion_theme.css
   (keep the two in sync — Branding is the source of truth)

   Drop-in stylesheet for any Fusion solution's web surface. Brings the
   brand palette, Montserrat type, KPI cards, tiles, status pills and
   the portal shell (sidebar + topbar) used across the platform
   (PTI, Scheduler, Administration, Consignment).
   Tokens mirror fusion_design_tokens.json. Component names and usage
   are defined in BRAND_GUIDE.md ("use the Tile / Status Pill / ...").

   Pair with (optional — theme also works standalone):
   <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap" rel="stylesheet">
   <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
   <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
   <link href="fusion_theme.css" rel="stylesheet">
   ===================================================================== */
:root {
  --navy:      #0B1D3A;
  --teal:      #00C4B4;
  --teal-deep: #00A99B;
  --accent:    #F97316;
  --sky:       #0EA5E9;
  --green:     #198754;
  --amber:     #F97316;
  --rose:      #DC3545;
  --violet:    #7C3AED;
  --bg:        #F0F4FF;
  --surface:   #FFFFFF;
  --text:      #1E2A3A;
  --muted:     #6B7A8D;
  --border:    #D8E0EE;
  --sidebar-w: 220px;
  --radius-card: 10px;
  --radius-tile: 12px;
  --shadow: 0 1px 3px rgba(11,29,58,0.06);
  --shadow-hover: 0 6px 18px rgba(11,29,58,0.08);

  /* Bootstrap overrides → brand */
  --bs-primary: #00C4B4;
  --bs-primary-rgb: 0, 196, 180;
  --bs-dark: #0B1D3A;
  --bs-body-bg: #F0F4FF;
  --bs-body-font-family: 'Montserrat', sans-serif;
  --bs-body-color: #1E2A3A;
  --bs-link-color: #00A99B;
  --bs-link-hover-color: #0B1D3A;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0; padding: 0;
  font-family: var(--bs-body-font-family);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}
code, .mono { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11.5px; color: var(--teal-deep); }

/* ── portal shell: sidebar + topbar ("Portal Shell") ───────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); background: var(--navy);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
}
.sidebar-brand { padding: 18px 18px 14px; border-bottom: 1px solid rgba(255,255,255,0.10); }
.sidebar-brand .brand-logo {
  display: block; width: 100%; height: auto; max-height: 52px;
  object-fit: contain; background: #fff; border-radius: 6px; padding: 6px 8px; margin: 0 0 10px;
}
.sidebar-brand h1 { font-size: 13px; font-weight: 800; color: #fff; letter-spacing: 0.3px; line-height: 1.35; margin: 0; }
.sidebar-brand .tagline {
  font-size: 9px; font-weight: 600; color: var(--teal);
  text-transform: uppercase; letter-spacing: 2px; margin-top: 4px;
}
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 20px;
  color: rgba(255,255,255,0.65); text-decoration: none; font-size: 12px; font-weight: 500;
  transition: all 0.14s; border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(0,196,180,0.08); color: #fff; }
.nav-item.active { background: rgba(0,196,180,0.12); color: var(--teal); border-left-color: var(--teal); }
.nav-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,0.10); }
.sidebar-footer .powered-by { font-size: 9px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 4px; }
.sidebar-footer .partner-logo { display: block; width: 100%; max-height: 30px; object-fit: contain; background: #fff; border-radius: 4px; padding: 4px 6px; }
.version-badge { margin-top: 6px; font-size: 10px; color: rgba(255,255,255,0.45); }

.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 28px; height: 56px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow);
}
.topbar-title { font-size: 14px; font-weight: 600; color: var(--navy); }
.topbar-user .partner-badge { display: block; height: 26px; width: auto; object-fit: contain; }
.page-content { padding: 28px; flex: 1; max-width: 1400px; }

/* ── cards ("Card") ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 0 0 16px; }

/* ── KPI cards ("KPI Card") ────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); padding: 18px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.kpi-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.kpi-card.c-sky::before    { background: linear-gradient(180deg, var(--sky),    #38bdf8); }
.kpi-card.c-green::before  { background: linear-gradient(180deg, var(--green),  #34d399); }
.kpi-card.c-amber::before  { background: linear-gradient(180deg, var(--amber),  #fbbf24); }
.kpi-card.c-rose::before   { background: linear-gradient(180deg, var(--rose),   #f87171); }
.kpi-card.c-violet::before { background: linear-gradient(180deg, var(--violet), #a78bfa); }
.kpi-icon { flex: 0 0 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.kpi-icon.teal   { background: rgba(0,196,180,0.12);  color: var(--teal-deep); }
.kpi-icon.navy   { background: rgba(11,29,58,0.08);   color: var(--navy); }
.kpi-icon.accent { background: rgba(249,115,22,0.10); color: var(--accent); }
.kpi-icon.sky    { background: rgba(14,165,233,0.12); color: var(--sky); }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--text); }
.kpi-label { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

/* ── tiles ("Tile" — clickable launcher card) ──────────────────────── */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tile {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-tile); padding: 18px; box-shadow: var(--shadow);
  text-decoration: none; color: inherit; position: relative; overflow: hidden;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--teal); }
.tile-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; background: rgba(0,196,180,0.14); color: var(--teal-deep); margin-bottom: 8px; }
.tile-title { font-weight: 700; color: var(--navy); font-size: 15px; }
.tile-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }
.tile-cta, .tile-foot { font-size: 12px; font-weight: 600; color: var(--teal-deep); margin-top: 8px; text-transform: uppercase; letter-spacing: 1px; }

/* ── status pills ("Status Pill") ──────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
}
.badge-green  { background: rgba(25,135,84,0.12);   color: var(--green); }
.badge-amber  { background: rgba(249,115,22,0.14);  color: #c2570c; }
.badge-red    { background: rgba(220,53,69,0.12);   color: var(--rose); }
.badge-teal   { background: rgba(0,196,180,0.14);   color: var(--teal-deep); }
.badge-violet { background: rgba(124,58,237,0.12);  color: var(--violet); }
.badge-grey   { background: rgba(107,122,141,0.14); color: var(--muted); }
/* Bootstrap-class compatibility */
.badge.bg-success   { background: var(--green) !important; color: #fff; }
.badge.bg-danger    { background: var(--rose)  !important; color: #fff; }
.badge.bg-secondary { background: var(--muted) !important; color: #fff; }

/* ── pipeline ("Pipeline" — stage tracker) ─────────────────────────── */
.pipeline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.pipeline-stage {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.pipeline-stage.is-done   { background: rgba(25,135,84,0.12);  border-color: rgba(25,135,84,0.30);  color: var(--green); }
.pipeline-stage.is-active { background: rgba(0,196,180,0.14);  border-color: rgba(0,196,180,0.40);  color: var(--teal-deep); }
.pipeline-stage.is-error  { background: rgba(220,53,69,0.12);  border-color: rgba(220,53,69,0.30);  color: var(--rose); }
.pipeline-arrow { color: var(--border); font-size: 12px; user-select: none; }

/* ── tables ("Data Table" + "Header Band") ─────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
thead th {
  background: var(--navy); color: #fff;
  padding: 9px 13px; text-align: left; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
thead th:first-child { border-top-left-radius: 6px; }
thead th:last-child  { border-top-right-radius: 6px; }
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:hover { background: rgba(0,196,180,0.05); }
tbody td { padding: 8px 13px; vertical-align: top; }
tbody td.mono { color: var(--navy); }

/* ── toolbar / buttons ("Toolbar", "Button") ───────────────────────── */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.row-count { font-size: 12px; color: var(--muted); margin-left: auto; }
.btn {
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-block;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.btn:hover { border-color: var(--teal); color: var(--teal-deep); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: var(--navy); }
.btn-primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.pager { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.pager .info { color: var(--muted); font-size: 12px; margin-left: auto; }
.empty-state { padding: 32px; text-align: center; color: var(--muted); font-size: 13px; }

/* ── alerts ("Alert") ──────────────────────────────────────────────── */
.alert { padding: 10px 16px; border-radius: 6px; margin-bottom: 18px; font-size: 13px; font-weight: 500; }
.alert-error { background: rgba(220,53,69,0.10); color: var(--rose); border: 1px solid rgba(220,53,69,0.30); }
.alert-info  { background: rgba(14,165,233,0.10); color: #0369a1; border: 1px solid rgba(14,165,233,0.30); }

/* ── splash ("Splash Screen" — full definition in BRAND_GUIDE.md) ──── */
.splash-body {
  background: radial-gradient(ellipse at center, #14305c 0%, var(--navy) 70%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  min-height: 100vh; overflow: hidden; margin: 0;
}
.splash { text-align: center; opacity: 0; animation: splashFadeIn 0.7s ease-out forwards; }
.splash-logo {
  width: 180px; height: auto; background: #fff;
  border-radius: 12px; padding: 14px 18px; margin: 0 auto 30px;
  box-shadow: 0 8px 30px rgba(0,196,180,0.25);
}
.splash-title { font-size: 38px; font-weight: 700; letter-spacing: 0.6px; margin-bottom: 10px; }
.splash-tagline { color: var(--teal); font-size: 13px; font-weight: 500; text-transform: uppercase; letter-spacing: 3px; }
.splash-loader { margin-top: 40px; display: flex; gap: 8px; justify-content: center; }
.splash-loader span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--teal);
  animation: splashPulse 1.1s infinite ease-in-out;
}
.splash-loader span:nth-child(2) { animation-delay: 0.15s; }
.splash-loader span:nth-child(3) { animation-delay: 0.30s; }
.splash-version {
  position: absolute; bottom: 20px; left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,0.35);
  font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase;
}
@keyframes splashFadeIn { to { opacity: 1; } }
@keyframes splashPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%           { transform: scale(1);   opacity: 1; }
}
