/* ============================================================
   CABIX HUB — Rapport Design System
   Modern Glassmorphic Enterprise ERP/CRM Dashboard
   Author: iRealBy_3D Platform
   ============================================================ */

:root {
  --font: "Urbanist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Light Theme Colors (Rapport Palette) */
  --bg: #ebe8e1;
  --mesh-a: #f5d4bc;
  --mesh-b: #cfded0;
  --mesh-c: #f0e3bf;
  
  --glass: rgba(255, 255, 255, 0.65);
  --glass-2: rgba(255, 255, 255, 0.82);
  --glass-3: rgba(255, 255, 255, 0.95);
  --solid: #ffffff;
  
  --text: #16181b;
  --text-muted: #5e646e;
  --text-dim: #8b929d;
  
  --line: rgba(22, 24, 27, 0.08);
  --line-strong: rgba(22, 24, 27, 0.16);
  --rim: rgba(255, 255, 255, 0.85);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px -4px rgba(35, 25, 15, 0.08), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  --shadow-lg: 0 24px 48px -12px rgba(35, 25, 15, 0.12), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  
  --accent: #2e7d32;
  --accent-gold: #c59b27;
  --accent-blue: #1976d2;
  --accent-purple: #7b1fa2;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  
  --top-height: 64px;
}

[data-theme="dark"] {
  --bg: #0e1114;
  --mesh-a: #1c1424;
  --mesh-b: #0d201a;
  --mesh-c: #201a10;
  
  --glass: rgba(22, 27, 34, 0.7);
  --glass-2: rgba(30, 36, 45, 0.85);
  --glass-3: rgba(38, 46, 58, 0.95);
  --solid: #161b22;
  
  --text: #f0f3f6;
  --text-muted: #9ba4b0;
  --text-dim: #656d78;
  
  --line: rgba(240, 243, 246, 0.08);
  --line-strong: rgba(240, 243, 246, 0.15);
  --rim: rgba(255, 255, 255, 0.08);
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Animated Mesh Background */
.mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.mesh i {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.6;
  mix-blend-mode: multiply;
  transition: all 0.5s ease;
}
[data-theme="dark"] .mesh i {
  mix-blend-mode: screen;
  opacity: 0.45;
}
.mesh__a {
  width: 55vw;
  height: 55vw;
  top: -15vw;
  right: -10vw;
  background: var(--mesh-a);
}
.mesh__b {
  width: 50vw;
  height: 50vw;
  bottom: -10vw;
  left: -10vw;
  background: var(--mesh-b);
}
.mesh__c {
  width: 45vw;
  height: 45vw;
  top: 30vh;
  left: 30vw;
  background: var(--mesh-c);
}

/* App Shell */
.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header (Top Bar) */
.top {
  position: sticky;
  top: 0;
  height: var(--top-height);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  z-index: 100;
  transition: all 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.brand__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.brand__title {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.brand__tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  background: rgba(197, 155, 39, 0.15);
  color: var(--accent-gold);
  border-radius: var(--radius-pill);
}

/* Nav Tabs with Animated Pill */
.tabs {
  position: relative;
  display: flex;
  align-items: center;
}
.tabs__track {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-pill);
  padding: 4px;
  border: 1px solid var(--line);
}
[data-theme="dark"] .tabs__track {
  background: rgba(255, 255, 255, 0.04);
}
.tab {
  position: relative;
  z-index: 2;
  padding: 6px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-pill);
  transition: color 0.2s ease;
  white-space: nowrap;
}
.tab:hover {
  color: var(--text);
}
.tab.active {
  color: var(--text);
}
.tabs__pill {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: var(--radius-pill);
  background: var(--solid);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 1;
  pointer-events: none;
}

/* Top Right Tools */
.top__tools {
  display: flex;
  align-items: center;
  gap: 12px;
}
.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(46, 125, 50, 0.12);
  color: #2e7d32;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2e7d32;
  box-shadow: 0 0 8px #2e7d32;
}
.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-pill);
  background: var(--glass);
  border: 1px solid var(--line);
}
.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c59b27, #2e7d32);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
}

/* Floating Quick Dock */
.dock {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--glass-2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  z-index: 900;
  transition: all 0.3s ease;
}
.dock__btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}
.dock__btn:hover {
  background: var(--solid);
  color: var(--text);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.dock__btn svg {
  width: 20px;
  height: 20px;
}
.dock__sep {
  width: 1px;
  height: 24px;
  background: var(--line);
  margin: 0 4px;
}

/* Tooltip for Dock */
.dock__tip {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--solid);
  background: var(--text);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.dock__btn:hover .dock__tip {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* Main Content Area */
.main {
  flex: 1;
  padding: 32px 32px 100px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.view {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}
.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Headings and Grid System */
.page-header {
  margin-bottom: 28px;
}
.page-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.page-desc {
  font-size: 14.5px;
  color: var(--text-muted);
}

.grid-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

/* Glass Cards */
.card {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
  box-shadow: var(--shadow-lg);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kpi-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.kpi-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-meta.up { color: #2e7d32; font-weight: 600; }

/* 2-Column Split Layout */
.grid-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}
@media (max-width: 960px) {
  .grid-split { grid-template-columns: 1fr; }
}

/* Pipeline Kanban Board */
.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}
.kanban-col {
  background: rgba(0, 0, 0, 0.025);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
[data-theme="dark"] .kanban-col {
  background: rgba(255, 255, 255, 0.02);
}
.col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.col-title {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.col-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
}

.deal-card {
  background: var(--solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: grab;
  transition: all 0.2s ease;
}
.deal-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.deal-title {
  font-weight: 600;
  font-size: 14px;
}
.deal-client {
  font-size: 12px;
  color: var(--text-muted);
}
.deal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.deal-price {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--accent);
}
.deal-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(25, 118, 210, 0.1);
  color: #1976d2;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
}
table.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
table.data-table tr:hover td {
  background: rgba(0, 0, 0, 0.015);
}
[data-theme="dark"] table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Finder (⌘K Command Palette Modal) */
dialog.finder {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 600px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--glass-3);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  overflow: hidden;
  padding: 0;
}
dialog.finder::backdrop {
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}
.finder__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.finder__bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
}
.finder__list {
  max-height: 340px;
  overflow-y: auto;
  list-style: none;
  padding: 8px;
}
.finder__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.finder__item:hover, .finder__item.selected {
  background: rgba(0, 0, 0, 0.05);
}
[data-theme="dark"] .finder__item:hover, [data-theme="dark"] .finder__item.selected {
  background: rgba(255, 255, 255, 0.06);
}

/* Roadmap Plan Styling */
.plan-article {
  line-height: 1.7;
}
.plan-article h2 {
  font-size: 20px;
  margin: 24px 0 12px;
}
.plan-article h3 {
  font-size: 16px;
  margin: 16px 0 8px;
}
.plan-article ul {
  padding-left: 20px;
  margin-bottom: 16px;
}
.plan-article code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 13px;
}
[data-theme="dark"] .plan-article code {
  background: rgba(255, 255, 255, 0.1);
}

/* Responsiveness */
@media (max-width: 768px) {
  .top { padding: 0 16px; }
  .tabs { display: none; } /* On mobile, dock or burger serves nav */
  .main { padding: 20px 16px 90px; }
  .grid-kpi { grid-template-columns: 1fr; }
}
