/* ====================================================================
   Oasel Design System for Masjid Ar-Royyaan Management Portal — portal.css
   Pixel-Accurate Architectural Parity with Oasel (demo.codeandchill.store/oasel/)
   Warm Sand Glass & Obsidian Glassmorphic Desk
   © 2026 Masjid Ar-Royyaan
   ==================================================================== */

:root {
  --font: "Urbanist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 12.5px;
  --fs-md: 13.5px;
  --fs-base: 14.5px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 21px;
  --fs-3xl: 24px;
  --fs-4xl: 28px;
  --fs-display: 34px;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 28px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --max: 1520px;
  --gap: 20px;
  --pad: 28px;
  --desk-gap: 28px;
  --sidebar-inset: 20px;
  --rail-w: 82px;
  --rail-w-expanded: 240px;
  --blur: 22px;
  --sat: 130%;

  /* Oasel Sand Glass Light Mode */
  --bg: #cdb894;
  --veil: linear-gradient(180deg, rgba(255, 243, 222, 0.12), rgba(244, 230, 204, 0.45));
  --card: rgba(255, 249, 237, 0.72);
  --card-2: rgba(255, 250, 240, 0.55);
  --card-3: rgba(255, 252, 246, 0.85);
  --panel: rgba(250, 243, 230, 0.94);
  --bar: rgba(253, 247, 236, 0.75);
  --well: rgba(70, 48, 20, 0.08);

  --ink: #2a2014;
  --ink-2: #44362a;
  --muted: #645546;
  --line: rgba(60, 40, 15, 0.12);
  --line-2: rgba(60, 40, 15, 0.20);
  --rim: rgba(60, 40, 15, 0.15);

  --shadow-sm: 0 1px 2px rgba(70, 44, 14, 0.08);
  --shadow: 0 1px 2px rgba(70, 44, 14, 0.06), 0 18px 40px -26px rgba(70, 44, 14, 0.42);
  --shadow-lg: 0 2px 6px rgba(70, 44, 14, 0.12), 0 34px 70px -28px rgba(70, 44, 14, 0.52);

  --glass-hi: rgba(255, 255, 255, 0.65);
  --glass-rim: rgba(255, 250, 240, 0.75);
  --glass-top: rgba(255, 255, 255, 0.95);
  --glass-edge: rgba(70, 46, 16, 0.08);

  --accent: #2b2117;
  --accent-from: #3a2c1f;
  --accent-to: #1f170f;
  --accent-ink: #fbf3e2;
  --accent-soft: rgba(43, 33, 23, 0.12);
  --accent-soft-solid: #ecdfc9;

  /* Oasel Electric Lime & Pastels */
  --hl: #c8f94a;
  --hl-from: #dcff86;
  --hl-deep: #4e8a00;
  --hl-ink: #132000;
  --hl-soft: rgba(176, 240, 40, 0.26);
  --hl-glow: rgba(140, 220, 0, 0.55);

  --butter: #f3df86;
  --butter-deep: #e6c64e;
  --butter-ink: #2a2014;
  --butter-soft: rgba(243, 223, 134, 0.45);

  --mint: #bfe9b4;
  --mint-deep: #6fb67c;
  --mint-ink: #183b22;
  --mint-soft: rgba(111, 182, 124, 0.25);

  --good: #1f6b45;
  --warn: #855505;
  --bad: #a33724;
  --info: #285b8a;
  --good-soft: rgba(111, 182, 124, 0.25);
  --warn-soft: rgba(230, 168, 40, 0.22);
  --bad-soft: rgba(205, 80, 50, 0.18);
  --info-soft: rgba(60, 120, 180, 0.18);

  /* Oasel Pastel Tile Tints */
  --tile-1: rgba(243, 223, 134, 0.65);
  --tile-2: rgba(191, 233, 180, 0.60);
  --tile-3: rgba(255, 251, 243, 0.45);
  --tile-4: rgba(236, 210, 176, 0.58);
  --tile-ink: var(--ink);
  --tile-muted: var(--ink-2);
}

/* Oasel Dark Obsidian Mode */
[data-theme="dark"] {
  --bg: #1b150f;
  --veil: linear-gradient(180deg, rgba(16, 11, 6, 0.55), rgba(12, 8, 5, 0.75));
  --card: rgba(36, 27, 18, 0.68);
  --card-2: rgba(255, 240, 214, 0.08);
  --card-3: rgba(255, 240, 214, 0.14);
  --panel: rgba(34, 26, 18, 0.95);
  --bar: rgba(30, 23, 15, 0.72);
  --well: rgba(255, 238, 210, 0.06);

  --ink: #f7efe1;
  --ink-2: #e7dbc6;
  --muted: #cdbea6;
  --line: rgba(255, 236, 205, 0.11);
  --line-2: rgba(255, 236, 205, 0.20);
  --rim: rgba(255, 236, 205, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 22px 44px -26px rgba(0, 0, 0, 0.75);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.45), 0 34px 80px -26px rgba(0, 0, 0, 0.90);

  --glass-hi: rgba(255, 244, 222, 0.09);
  --glass-rim: rgba(255, 238, 210, 0.14);
  --glass-top: rgba(255, 246, 228, 0.32);
  --glass-edge: rgba(0, 0, 0, 0.22);

  --accent: #c6ff3d;
  --accent-from: #dcff7d;
  --accent-to: #b2ef1f;
  --accent-ink: #121c00;
  --accent-soft: rgba(198, 255, 61, 0.16);
  --accent-soft-solid: #3b3020;

  --hl: #c6ff3d;
  --hl-from: #dcff7d;
  --hl-deep: #c6ff3d;
  --hl-ink: #121c00;
  --hl-soft: rgba(198, 255, 61, 0.16);
  --hl-glow: rgba(198, 255, 61, 0.48);

  --butter: #f1dc7e;
  --mint: #a9e0a0;
  --good: #9adba6;
  --warn: #f2c879;
  --bad: #f5a28c;
  --info: #a6c9ec;

  --tile-1: rgba(241, 220, 126, 0.18);
  --tile-2: rgba(154, 219, 166, 0.15);
  --tile-3: rgba(255, 240, 214, 0.07);
  --tile-4: rgba(235, 160, 124, 0.14);
  --tile-ink: var(--ink);
  --tile-muted: var(--ink-2);
}

/* ====================================================================
   Portal Layout & Atmosphere
   ==================================================================== */

.portal-layout {
  min-height: 100vh;
  background-color: var(--bg);
  background-image: 
    var(--veil),
    radial-gradient(85% 55% at 50% -10%, rgba(255, 248, 235, 0.35) 0%, transparent 100%),
    radial-gradient(75% 45% at 90% 100%, rgba(240, 210, 160, 0.25) 0%, transparent 100%),
    radial-gradient(60% 40% at 10% 50%, rgba(200, 235, 180, 0.18) 0%, transparent 100%);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  position: relative;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

/* Main Area */
.portal-main {
  margin-left: calc(var(--sidebar-inset) + var(--rail-w) + var(--desk-gap));
  flex: 1;
  min-width: 0;
  padding: var(--sidebar-inset) var(--desk-gap) 40px 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s var(--ease);
}

.page-container {
  max-width: 100%;
  width: 100%;
  margin: 0;
  animation: oasel-reveal 0.35s var(--ease);
}

/* ====================================================================
   Oasel Floating Rail Sidebar (.portal-sidebar, .rail)
   Supports Collapse / Expand Wide Mode via html.is-wide
   ==================================================================== */

html.is-wide, body.is-wide, .portal-layout.is-wide {
  --rail-w: 240px;
}

.portal-sidebar {
  position: fixed;
  top: var(--sidebar-inset);
  bottom: var(--sidebar-inset);
  left: var(--sidebar-inset);
  width: var(--rail-w);
  border-radius: var(--r-xl);
  background: linear-gradient(170deg, var(--glass-hi), transparent 40%), var(--bar);
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  box-shadow: inset 0 0 0 1px var(--glass-rim), inset 1px 1px 0 var(--glass-top), var(--shadow-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 12px 8px;
  z-index: 100;
  overflow: hidden;
  transition: width 0.3s var(--ease), box-shadow 0.3s ease;
}

/* Wide Mode: Permanent Expanded State */
html.is-wide .portal-sidebar {
  width: var(--rail-w) !important;
}

html.is-wide .brand-text,
html.is-wide .sidebar-label,
html.is-wide .rail-user {
  opacity: 1 !important;
  transform: translateX(0) !important;
}

/* Hover Expand in Collapsed Mode */
html:not(.is-wide) .portal-sidebar:hover {
  width: var(--rail-w-expanded);
  box-shadow: inset 0 0 0 1px var(--glass-rim), inset 1px 1px 0 var(--glass-top), 0 20px 50px -10px rgba(0, 0, 0, 0.4);
}

html:not(.is-wide) .portal-sidebar:hover .brand-text,
html:not(.is-wide) .portal-sidebar:hover .sidebar-label,
html:not(.is-wide) .portal-sidebar:hover .rail-user {
  opacity: 1;
  transform: translateX(0);
}

/* Sidebar Toggle Button (Circled in Oasel Reference) */
.rail-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

.rail-toggle-btn:hover {
  background: var(--card-3);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px var(--glass-rim), var(--shadow-sm);
}

.rail-toggle-btn.active {
  background: var(--card-3);
  box-shadow: inset 0 0 0 1.5px var(--hl), var(--shadow-sm);
  color: var(--ink);
}

/* Sidebar Brand */
.sidebar-brand {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  border-radius: var(--r-md);
  color: var(--ink);
  text-decoration: none;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--hl) 0%, var(--butter) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 14px var(--hl-glow);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.portal-sidebar:hover .brand-text {
  opacity: 1;
  transform: translateX(0);
}

.brand-name {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.brand-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Sidebar Nav Menu */
.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-menu::-webkit-scrollbar {
  display: none;
}

.sidebar-item {
  width: 100%;
}

.sidebar-link {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  border-radius: 16px;
  color: var(--ink-2);
  font-size: var(--fs-md);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  transition: all 0.2s var(--ease);
}

.sidebar-link:hover {
  background: var(--card-2);
  color: var(--ink);
  transform: translateX(2px);
}

.sidebar-link.active {
  background: var(--hl);
  color: var(--hl-ink);
  font-weight: 700;
  box-shadow: 0 4px 16px var(--hl-glow);
}

.sidebar-icon {
  font-size: 1.2rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-label {
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.portal-sidebar:hover .sidebar-label {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-divider {
  height: 1px;
  background: var(--line);
  margin: 8px 10px;
}

/* Sidebar Footer Profile (.me) */
.sidebar-footer {
  padding: 10px 8px 4px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rail-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--card-3);
  box-shadow: inset 0 0 0 1px var(--glass-rim);
  color: var(--ink);
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rail-user {
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.portal-sidebar:hover .rail-user {
  opacity: 1;
  transform: translateX(0);
}

/* ====================================================================
   Oasel Floating Topline Header (.portal-topbar, .topline)
   ==================================================================== */

.portal-topbar {
  position: sticky;
  top: var(--sidebar-inset);
  height: 62px;
  border-radius: var(--r-lg);
  background: linear-gradient(170deg, var(--glass-hi), transparent 46%), var(--bar);
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  box-shadow: inset 0 0 0 1px var(--glass-rim), inset 1px 1px 0 var(--glass-top), var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 20px;
  margin-bottom: var(--gap);
  z-index: 90;
  transition: background-color 0.35s var(--ease), box-shadow 0.35s ease;
}

/* Breadcrumbs */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.crumb-root {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 700;
}

.crumb-sep {
  color: var(--line-2);
  font-size: 0.85rem;
}

.crumb-current {
  color: var(--ink);
  font-weight: 800;
  font-size: 1rem;
}

/* Topbar Tools & Actions */
.topbar-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tool-search {
  height: 38px;
  padding: 0 14px;
  border-radius: 9999px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.tool-search:hover {
  background: var(--card-3);
  color: var(--ink);
  border-color: var(--line-2);
}

.kbd {
  font-size: 10px;
  font-weight: 700;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  color: var(--ink-2);
}

/* Oasel Theme Switcher Pill Button */
.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.tool-btn:hover {
  background: var(--card-3);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px var(--glass-rim), var(--shadow-sm);
}

.tv-pill-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: var(--fs-sm);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.2s var(--ease);
}

.tv-pill-btn:hover {
  background: var(--card-3);
  border-color: var(--line-2);
  transform: translateY(-1px);
}

/* User Pill Badge */
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 9999px;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--butter);
  color: var(--butter-ink);
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-meta {
  line-height: 1.2;
}

.user-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
}

.user-role {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

/* ====================================================================
   Page Header & Eyebrow (.phead)
   ==================================================================== */

.phead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 6px 0 16px;
  flex-wrap: wrap;
  gap: var(--gap);
}

.phead__main {
  flex: 1 1 340px;
  min-width: 280px;
}

.phead__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  gap: 10px;
  flex-wrap: wrap;
}

.phead__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.breathe-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hl);
  box-shadow: 0 0 8px var(--hl-glow);
  animation: breathe-ring 2s infinite var(--ease);
}

.phead__title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--ink);
  line-height: 1.15;
  margin-bottom: 6px;
}

.phead__desc {
  font-size: var(--fs-base);
  color: var(--muted);
  max-width: 680px;
  line-height: 1.5;
  margin: 0;
}

/* ====================================================================
   Oasel KPI Metric Cards Grid (.kpis, .kpi)
   Parity with demo.codeandchill.store/oasel/assets/portfolio-4mMqeNGg.css
   ==================================================================== */

.kpis, .stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.kpi, .stat-card {
  border-radius: var(--r-lg);
  padding: 16px 18px 14px;
  min-height: 128px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  box-shadow: inset 0 0 0 1px var(--glass-rim), inset 1px 1px 0 var(--glass-top), var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease;
}

.kpi:hover, .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: inset 0 0 0 1px var(--glass-rim), inset 1px 1px 0 var(--glass-top), var(--shadow);
}

/* KPI Pastel Tile Tints */
.kpi--1, .stat-card:nth-child(1) { background: linear-gradient(135deg, var(--tile-1) 0%, var(--card) 100%); }
.kpi--2, .stat-card:nth-child(2) { background: linear-gradient(135deg, var(--tile-2) 0%, var(--card) 100%); }
.kpi--3, .stat-card:nth-child(3) { background: linear-gradient(135deg, var(--tile-3) 0%, var(--card) 100%); }
.kpi--4, .stat-card:nth-child(4) { background: linear-gradient(135deg, var(--tile-4) 0%, var(--card) 100%); }

.kpi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.kpi__label, .stat-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.kpi__val, .stat-val {
  font-size: clamp(1.45rem, 2.3vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin: 4px 0 6px;
}

.kpi__sub, .kpi__foot {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
}

/* ====================================================================
   Oasel Bento Glass Cards (.card, .portal-card)
   Parity with demo.codeandchill.store/oasel/assets/index-DdPSFN1d.css
   ==================================================================== */

.card, .portal-card {
  background: linear-gradient(160deg, var(--glass-hi), transparent 60%), var(--card);
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--glass-rim), inset 1px 1px 0 var(--glass-top), var(--shadow);
  padding: 18px 20px 20px;
  margin-bottom: var(--gap);
  position: relative;
  min-width: 0;
  transition: transform 0.25s var(--ease), box-shadow 0.25s ease;
}

.card__head, .chead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 32px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}

.chead__text {
  flex: 1;
  min-width: 0;
}

.card__title, .chead h2, .chead h3 {
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.25;
  margin: 0;
}

.card__desc, .chead p {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* ====================================================================
   Oasel Portfolio Grid (.pf__grid, .portfolio-grid)
   Exact Layout Parity with demo.codeandchill.store/oasel/#/portfolio
   ==================================================================== */

.pf__grid, .portfolio-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "trend trend trend today"
    "mix mix ladder ladder";
  gap: var(--gap);
  margin-bottom: var(--gap);
}

.pf__grid > .card,
.portfolio-grid > .card {
  margin-bottom: 0;
}

.pf-trend { grid-area: trend; }
.pf-today, .pf-flow { grid-area: today; }
.pf-mix { grid-area: mix; }
.pf-ladder { grid-area: ladder; }

.pf-trend__total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: -2px 0 14px;
}

.pf-trend__total > span {
  font-size: var(--fs-display);
  letter-spacing: -0.025em;
  font-weight: 800;
  color: var(--ink);
}

.pf-trend__total small {
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-sm);
}

/* Oasel Needs a Decision / Today Action Items List (.today__list) */
.today__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.today__item {
  text-align: left;
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--glass-rim);
  border-radius: 14px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  display: flex;
  text-decoration: none;
  color: var(--ink);
  transition: all 0.2s var(--ease);
  cursor: pointer;
}

.today__item:hover {
  background: var(--card-3);
  transform: translateX(2px);
  color: var(--ink);
}

.today__ico {
  border-radius: 11px;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  display: grid;
  font-size: 1.1rem;
}

.today__ico.tone--warn { background: var(--butter-soft); color: var(--warn); }
.today__ico.tone--good { background: var(--good-soft); color: var(--good); }
.today__ico.tone--info { background: var(--info-soft); color: var(--info); }
.today__ico.tone--hl { background: var(--hl-soft); color: var(--hl-deep); }

.today__item .cell__text {
  flex: 1;
  min-width: 0;
}

.today__item .cell__title {
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.today__item .cell__sub {
  font-size: var(--fs-xs);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.today__item .cell__arrow {
  color: var(--muted);
  font-size: 1.1rem;
  flex: none;
  transition: transform 0.2s var(--ease);
}

.today__item:hover .cell__arrow {
  transform: translateX(2px);
  color: var(--ink);
}

/* ====================================================================
   Oasel Tables (.table, .portal-table)
   ==================================================================== */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--r-md);
}

.table, .portal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-sm);
  text-align: left;
}

.table th, .portal-table th {
  padding: 12px 16px;
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: var(--well);
}

.table td, .portal-table td {
  padding: 14px 16px;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s ease;
}

.table tbody tr:hover td, .portal-table tbody tr:hover td {
  background-color: var(--card-2);
}

.table tbody tr:last-child td, .portal-table tbody tr:last-child td {
  border-bottom: none;
}

/* ====================================================================
   Oasel Segmented Control Tabs (.seg)
   ==================================================================== */

.seg {
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line);
  border-radius: 14px;
  padding: 4px;
  display: inline-flex;
  gap: 4px;
}

.seg__btn {
  padding: 6px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: transparent;
  transition: all 0.2s var(--ease);
}

.seg__btn:hover {
  color: var(--ink);
}

.seg__btn.active, .seg__btn.is-active, .seg__btn[aria-selected="true"] {
  background: var(--hl);
  color: var(--hl-ink);
  font-weight: 700;
  box-shadow: 0 2px 8px var(--hl-glow);
}

/* ====================================================================
   Oasel Buttons & Pills (.btn)
   Exact Parity with demo.codeandchill.store/oasel/
   Secondary: Translucent Warm Glass Card Button (e.g. "Export")
   Primary: Obsidian Espresso Solid Card Button (e.g. "+ New application")
   ==================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  background: var(--card-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-2);
  border: none;
  transition: transform 0.15s var(--ease), box-shadow 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  background: var(--card-3);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--glass-rim), 0 4px 14px rgba(70, 44, 14, 0.08);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

/* Oasel Primary Button: Obsidian Espresso Solid Card Button (like "+ New application" in Image 1) */
.btn-primary, .btn--primary, .btn-dark, .btn-hl {
  background: #231a11;
  background-image: linear-gradient(180deg, #2e2318 0%, #1a120a 100%);
  color: #fbf3e2 !important;
  font-weight: 700;
  height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 2px 4px rgba(35, 26, 17, 0.25), 0 8px 18px -6px rgba(35, 26, 17, 0.45);
}

.btn-primary:hover, .btn--primary:hover, .btn-dark:hover, .btn-hl:hover {
  background: #120b06;
  background-image: linear-gradient(180deg, #1f150c 0%, #0c0703 100%);
  color: #ffffff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 4px 12px rgba(35, 26, 17, 0.35), 0 12px 24px -6px rgba(35, 26, 17, 0.6);
  transform: translateY(-1px);
}

.btn-primary:active, .btn--primary:active, .btn-dark:active, .btn-hl:active {
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

/* Dark Mode Overrides for Buttons */
[data-theme="dark"] .btn {
  background: var(--card-2);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

[data-theme="dark"] .btn:hover {
  background: var(--card-3);
  color: var(--ink);
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn--primary,
[data-theme="dark"] .btn-dark,
[data-theme="dark"] .btn-hl {
  background: #f7efe1;
  background-image: none;
  color: #1b150f !important;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn--primary:hover,
[data-theme="dark"] .btn-dark:hover,
[data-theme="dark"] .btn-hl:hover {
  background: #ffffff;
  color: #0c0804 !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

/* Secondary Glass Button */
.btn-outline, .btn-glass, .btn-gold {
  background: var(--card-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--ink);
}

.btn-outline:hover, .btn-glass:hover, .btn-gold:hover {
  background: var(--card-3);
  box-shadow: inset 0 0 0 1px var(--glass-rim), 0 4px 12px rgba(70, 44, 14, 0.08);
}

/* Button Sizes */
.btn-sm, .btn--sm {
  height: 32px;
  font-size: var(--fs-sm);
  border-radius: 10px;
  padding: 0 12px;
}

.btn-lg, .btn--lg {
  height: 48px;
  font-size: var(--fs-lg);
  border-radius: 14px;
  padding: 0 22px;
}

.btn-block, .btn--block {
  width: 100%;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.badge-green {
  background: var(--good-soft);
  color: var(--good);
}

.badge-gold {
  background: var(--butter-soft);
  color: var(--warn);
}

.badge-blue {
  background: var(--info-soft);
  color: var(--info);
}

.badge-red {
  background: var(--bad-soft);
  color: var(--bad);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  font-weight: 600;
  box-sizing: border-box;
  transition: all 0.2s var(--ease);
}

.form-control:focus {
  outline: none;
  background: var(--card-3);
  border-color: var(--hl);
  box-shadow: 0 0 0 3px var(--hl-soft);
}

/* Custom Styled Select Dropdown (Elegant Oasel Style - Arrow with Inset Breathing Room) */
select.form-control,
.select-custom,
select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-color: var(--card-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23645546' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 15px) center;
  background-size: 13px;
  padding-right: 40px !important;
  cursor: pointer;
  line-height: 1.3;
}

[data-theme="dark"] select.form-control,
[data-theme="dark"] .select-custom,
[data-theme="dark"] select {
  background-color: var(--card-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23cdbea6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

select.form-control option,
select option {
  background: var(--card-3, #faf3e6);
  color: var(--ink, #2a2014);
  padding: 8px 12px;
}

/* ====================================================================
   Portal Modal Component (.modal-backdrop, .modal-card)
   ==================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(18, 12, 6, 0.68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  box-sizing: border-box;
  animation: modal-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-card {
  background: var(--panel);
  color: var(--ink);
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  border-radius: var(--r-lg);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-slide-up 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-2);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
}

.modal-body {
  padding: 22px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: var(--card-2);
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--card-3);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.category-chip__remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: color 0.15s ease;
}

.category-chip__remove:hover {
  color: var(--bad);
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-slide-up {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ====================================================================
   Keyframe Animations
   ==================================================================== */

@keyframes oasel-reveal {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes breathe-ring {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.35);
  }
}

@keyframes flash {
  0% { color: var(--hl); }
  100% { color: inherit; }
}

/* ====================================================================
   Mobile & Responsive Adaptations
   ==================================================================== */

@media (max-width: 1099px) {
  .kpis, .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pf__grid, .portfolio-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "trend"
      "today"
      "mix"
      "ladder";
  }
  .tool-search {
    display: none;
  }
}

@media (max-width: 768px) {
  .portal-sidebar {
    display: none;
  }
  .portal-main {
    margin-left: 0;
    padding: 12px;
  }
  .portal-topbar {
    top: 8px;
    height: 56px;
    padding: 0 12px;
    margin-bottom: 12px;
  }
  .kpis, .stat-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .pf__grid, .portfolio-grid {
    gap: 12px;
  }
  .card, .portal-card {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: 18px;
  }
}

/* ====================================================================
   CDN Upload Component (.cdn-upload-box, .cdn-upload-preview)
   Direct Cloudflare R2 Upload Widget for Financial Proofs & Receipts
   ==================================================================== */

.cdn-upload-box {
  border: 2px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--card-2);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.22s var(--ease);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.cdn-upload-box:hover {
  border-color: var(--good);
  background: var(--card-3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.cdn-upload-box.is-dragover {
  border-color: var(--good);
  background: var(--good-soft);
  transform: scale(1.01);
}

.cdn-upload-box.is-uploading {
  border-color: var(--info);
  background: var(--info-soft);
  cursor: wait;
}

.cdn-upload-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-3);
  border: 1px solid var(--good-soft);
  border-radius: var(--r-md);
  padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(31, 107, 69, 0.08);
  position: relative;
}

.cdn-upload-preview__thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--card-2);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.cdn-upload-preview__icon {
  width: 52px;
  height: 52px;
  border-radius: var(--r-sm);
  background: var(--good-soft);
  color: var(--good);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cdn-upload-preview__info {
  flex: 1;
  min-width: 0;
}

.cdn-upload-preview__title {
  font-weight: 700;
  font-size: var(--fs-sm);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.cdn-upload-preview__url {
  font-family: monospace;
  font-size: 11px;
  color: var(--good);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  display: block;
}

.cdn-upload-preview__actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.cdn-upload-progress {
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 10px;
}

.cdn-upload-progress__bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--good) 0%, var(--hl) 100%);
  animation: cdn-indeterminate 1.4s infinite ease-in-out;
}

@keyframes cdn-indeterminate {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* User & Role Management / RBAC & Profile Extensions */
.badge-purple {
  background: rgba(168, 85, 247, 0.15) !important;
  color: #9333ea !important;
  border: 1px solid rgba(168, 85, 247, 0.3) !important;
}

[data-theme="dark"] .badge-purple {
  background: rgba(168, 85, 247, 0.22) !important;
  color: #c084fc !important;
  border-color: rgba(168, 85, 247, 0.4) !important;
}

.btn-google:hover {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

[data-theme="dark"] #btnGoogleLogin,
[data-theme="dark"] #btnOpenLinkGoogleModal {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #111827 !important;
}
