@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  font-family: "DM Sans", sans-serif;
  color: #1c2434;
  background: #f5f7fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1c2434;
  --muted: #81899a;
  --line: #e9ecf2;
  --purple: #6954e8;
  --purple-soft: #f0edff;
  --green: #168d68;
  --red: #d45563;
  --white: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: #f5f7fb; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; background: #f5f7fb; }

/* Floating Boxed Header with Executive Dark Gradient */
.app-top-header {
  position: sticky;
  top: 14px;
  z-index: 100;
  max-width: 1400px;
  width: calc(100% - 36px);
  margin: 14px auto 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #090d16 0%, #11162b 38%, #1c183d 75%, #241442 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 20px 45px -10px rgba(10, 14, 28, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
  position: relative;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeInDown 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Animated Top Shimmer Accent */
.app-top-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 35%, #ec4899 70%, #38bdf8 100%);
  background-size: 200% 100%;
  animation: headerShimmer 6s linear infinite;
}

@keyframes headerShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes livePulse {
  0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
  50% { transform: scale(1.2); opacity: 0.8; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0); }
}

.top-header-inner {
  padding: 0 24px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.top-header-left { display: flex; align-items: center; gap: 24px; min-width: 0; flex: 1; }

.brand { display: flex; align-items: center; gap: 11px; margin: 0; color: inherit; text-decoration: none; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--purple); color: #fff; font: 800 20px "Manrope", sans-serif; }
.brand-logo { display: block; width: 48px; height: 36px; flex: 0 0 auto; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(99, 102, 241, 0.35)); }
.auth-logo { width: 136px; height: 82px; }
.brand-title-wrap { display: inline-flex; align-items: center; gap: 8px; }
.brand strong { display: block; font: 750 15px "Manrope", sans-serif; letter-spacing: -.3px; color: #ffffff; line-height: 1.1; }
.brand small { display: block; color: #94a3b8; font-size: 10px; margin-top: 2px; }

.demo-live-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 20px; background: rgba(99, 102, 241, 0.24); border: 1px solid rgba(168, 85, 247, 0.38); color: #c4b5fd; font-size: 8.5px; font-weight: 800; letter-spacing: 0.5px; }
.pulse-dot { width: 5px; height: 5px; border-radius: 50%; background: #34d399; box-shadow: 0 0 6px #34d399; animation: livePulse 2s infinite ease-in-out; }

/* Top Navigation Links in Boxed Header */
.top-nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.top-nav::-webkit-scrollbar { display: none; }
.nav-item { height: 38px; border: 0; border-radius: 9px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; background: transparent; color: rgba(255, 255, 255, 0.72); font-size: 12.5px; font-weight: 550; cursor: pointer; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1); white-space: nowrap; flex-shrink: 0; }
.nav-item > span { font-size: 14px; color: rgba(255, 255, 255, 0.55); display: inline-flex; align-items: center; transition: color 0.15s ease; }
.nav-item:hover { background: rgba(255, 255, 255, 0.09); color: #ffffff; transform: translateY(-1px); }
.nav-item:hover > span { color: #c4b5fd; }
.nav-item.active { background: linear-gradient(135deg, rgba(99, 102, 241, 0.38) 0%, rgba(168, 85, 247, 0.32) 100%); color: #ffffff; font-weight: 700; border: 1px solid rgba(168, 85, 247, 0.45); box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25); }
.nav-item.active > span { color: #a5b4fc; }

/* Top Header Right */
.top-header-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.nav-item-settings { height: 36px; padding: 0 12px; font-size: 12px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 9px; color: rgba(255, 255, 255, 0.85); }
.nav-item-settings:hover { background: rgba(255, 255, 255, 0.15); color: #ffffff; border-color: rgba(255, 255, 255, 0.25); }
.header-divider { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.15); }
.today-label { padding: 4px 10px; border-radius: 20px; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1); color: #cbd5e1; font-size: 11px; font-weight: 500; }

/* Sub-bar below Boxed Header */
.sub-bar { background: transparent; border: 0; }
.sub-bar-inner { max-width: 1400px; width: calc(100% - 36px); margin: 10px auto 0; padding: 0 6px; display: flex; align-items: center; justify-content: space-between; }
.breadcrumb { display: flex; gap: 8px; align-items: center; color: #94a3b8; font-size: 11.5px; }
.breadcrumb strong { color: var(--ink); font-weight: 600; }
.crumb-sep { color: #cbd5e1; }
.demo-sub-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; background: #ffffff; border: 1px solid #e2e8f0; color: #64748b; font-size: 10px; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.demo-sub-pill .sparkle { color: #7c3aed; font-size: 11px; }

/* Legacy sidebar fallback */
.sidebar { display: none; }
.help-card { display: none; }

.avatar { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: #e7e2ff; color: #604bd2; font-weight: 700; }
.main-content { min-height: calc(100vh - 120px); margin-left: 0; width: 100%; }
.topbar { display: none; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.account-menu { position: relative; }
.top-avatar { width: 34px; height: 34px; background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%); color: #ffffff; border: 2px solid rgba(255, 255, 255, 0.3); box-shadow: 0 0 14px rgba(99, 102, 241, 0.45); transition: all 0.2s ease; }
.top-avatar:hover { transform: scale(1.06); box-shadow: 0 0 18px rgba(168, 85, 247, 0.65); }
.top-avatar:focus-visible, .account-menu-logout:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.account-menu-panel { position: absolute; z-index: 105; top: calc(100% + 10px); right: 0; width: 210px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16); }
.account-menu-user { padding: 9px 10px 11px; border-bottom: 1px solid var(--line); }
.account-menu-user strong, .account-menu-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-user strong { color: var(--ink); font-size: 12px; }
.account-menu-user small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.account-menu-logout { width: 100%; margin-top: 6px; padding: 9px 10px; border: 0; border-radius: 6px; background: transparent; color: #747d8d; text-align: left; font-size: 11px; font-weight: 700; }
.account-menu-logout:hover { background: #f3f1ff; color: var(--purple); }
.page-content { max-width: 1400px; padding: 20px 18px 56px; margin: auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.eyebrow { margin: 0 0 8px; color: var(--purple); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font: 750 26px "Manrope", sans-serif; letter-spacing: -.8px; }
.subtitle { margin: 0; color: var(--muted); font-size: 12px; }

/* Modern Gradient Hero Card */
.dashboard-hero-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 26px 30px; border-radius: 16px; background: linear-gradient(135deg, #ffffff 0%, #f7f9fe 50%, #eef2ff 100%); border: 1px solid #c7d2fe; box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.08); margin-bottom: 24px; position: relative; overflow: hidden; animation: slideFadeUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.dashboard-hero-card::after { content: ""; position: absolute; top: -40px; right: -40px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, transparent 70%); pointer-events: none; }
.hero-badge-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hero-eyebrow { color: #4f46e5; font-size: 10px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.hero-status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 12px; background: #ecfdf5; border: 1px solid #a7f3d0; color: #059669; font-size: 9px; font-weight: 700; }
.pulse-dot-green { width: 5px; height: 5px; border-radius: 50%; background: #10b981; box-shadow: 0 0 6px #10b981; animation: livePulse 2s infinite ease-in-out; }
.dashboard-hero-card h1 { margin: 0 0 6px; font: 800 28px "Manrope", sans-serif; letter-spacing: -0.9px; color: #0f172a; }
.hero-subtitle { margin: 0; color: #64748b; font-size: 12.5px; line-height: 1.5; }
.hero-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.hero-btn { padding: 0 16px; min-height: 40px; border-radius: 9px; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; }

.button { min-height: 38px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #525c6f; font-size: 11px; font-weight: 700; text-decoration: none; transition: all 0.2s ease; }
.button:hover { border-color: #cbc5f6; transform: translateY(-1px); }
.button.primary { background: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #7c3aed 100%); background-size: 200% 100%; border: 0; color: #ffffff; box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3); transition: all 0.25s ease; }
.button.primary:hover { background-position: 100% 0%; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(79, 70, 229, 0.42); }
.button.secondary { background: #ffffff; border: 1px solid #c7d2fe; color: #4338ca; transition: all 0.2s ease; }
.button.secondary:hover { background: #f5f3ff; border-color: #a5b4fc; transform: translateY(-1px); }
.button.soft { border-color: #e8e4ff; background: #f6f4ff; color: var(--purple); }
.button.whatsapp-button { border-color: #c4ead6; background: #eaf7ef; color: #137944; }
.button.whatsapp-button:hover { border-color: #93d5b0; background: #def2e6; }
.button.small { min-height: 29px; padding: 0 10px; font-size: 10px; }
.button.danger { color: var(--red); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 21px; }
.stat-card, .panel, .table-card { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.stat-card {
  padding: 19px 20px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.02);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  animation: slideFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.stat-card:nth-child(1) { animation-delay: 0.06s; }
.stat-card:nth-child(2) { animation-delay: 0.12s; }
.stat-card:nth-child(3) { animation-delay: 0.18s; }
.stat-card:nth-child(4) { animation-delay: 0.24s; }
.stat-card:hover {
  transform: translateY(-4px);
  border-color: #c7d2fe;
  box-shadow: 0 16px 32px -8px rgba(99, 102, 241, 0.14), 0 0 0 1px rgba(99, 102, 241, 0.18);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; color: #737c8c; font-size: 11px; }
.stat-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; background: #f0edff; color: var(--purple); font-size: 15px; transition: transform 0.2s ease; }
.stat-card:hover .stat-icon { transform: scale(1.1); }
.stat-card:nth-child(2) .stat-icon { background: #eaf7f2; color: var(--green); }
.stat-card:nth-child(3) .stat-icon { background: #fff5e9; color: #dd9132; }
.stat-card:nth-child(4) .stat-icon { background: #fff0f1; color: var(--red); }
.stat-card-alert { border-color: #fecdd3 !important; background: #fffbfa !important; }
.icon-alert { background: #ffe4e6 !important; color: #e11d48 !important; }
.text-danger { color: #e11d48 !important; }
.stat-value { margin: 16px 0 5px; font: 750 25px "Manrope", sans-serif; letter-spacing: -.7px; }
.stat-caption { margin: 0; color: #9aa1af; font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(270px, .9fr); gap: 17px; }

/* Interactive Charts & Analytics Grid */
.dashboard-analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 18px;
  margin-bottom: 22px;
  animation: slideFadeUp 0.55s 0.28s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}
.chart-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.02);
  transition: all 0.25s ease;
}
.chart-panel:hover {
  border-color: #cbd5e1;
  box-shadow: 0 14px 30px -8px rgba(15, 23, 42, 0.07);
}
.chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chart-title-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chart-title-wrap h2 { margin: 0; font: 700 14px "Manrope", sans-serif; color: #1e293b; }
.chart-pill-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 9px; font-weight: 750; letter-spacing: 0.3px; text-transform: uppercase; }
.badge-green { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.badge-purple { background: #f5f3ff; color: #7c3aed; border: 1px solid #ddd6fe; }
.chart-subtitle { margin: 3px 0 0; color: #94a3b8; font-size: 11px; }

/* Segmented Control Filter */
.segmented-control { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; font-size: 10px; font-weight: 600; color: #64748b; cursor: pointer; transition: all 0.15s ease; }
.seg-btn:hover { color: #1e293b; }
.seg-btn.active { background: #ffffff; color: var(--purple); font-weight: 750; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

/* KPI Mini Strip */
.chart-kpi-bar { display: flex; align-items: center; gap: 20px; padding: 10px 14px; background: #f8fafc; border: 1px solid #edf2f7; border-radius: 9px; margin-bottom: 14px; flex-wrap: wrap; }
.chart-kpi-item { display: flex; align-items: center; gap: 8px; }
.chart-kpi-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-billed { background: #6366f1; }
.dot-collected { background: #10b981; }
.dot-rate { background: #8b5cf6; }
.chart-kpi-item small { display: block; color: #94a3b8; font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.chart-kpi-item strong { display: block; color: #1e293b; font-size: 12px; font-weight: 750; }
.text-indigo { color: #6366f1 !important; }

/* Chart Canvas Wrapper */
.chart-canvas-container { position: relative; height: 230px; width: 100%; }

/* Portfolio Doughnut Section */
.portfolio-container { display: flex; flex-direction: column; gap: 14px; }
.doughnut-canvas-wrap { position: relative; height: 195px; display: flex; align-items: center; justify-content: center; }
.doughnut-center-pill { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.doughnut-center-pill strong { font-size: 24px; font-weight: 800; color: #1e293b; line-height: 1; }
.doughnut-center-pill small { font-size: 9.5px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 3px; }

/* Status Legend Grid */
.status-legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-legend-card { padding: 9px 11px; border-radius: 8px; border: 1px solid #f1f5f9; background: #fafbfd; transition: all 0.15s ease; cursor: pointer; }
.status-legend-card:hover { border-color: #cbd5e1; background: #ffffff; box-shadow: 0 4px 12px rgba(0,0,0,0.05); transform: translateY(-1px); }
.legend-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 3px; }
.legend-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-paid { background: #10b981; }
.dot-partial { background: #f59e0b; }
.dot-pending { background: #6366f1; }
.dot-overdue { background: #f43f5e; }
.legend-label { font-size: 10px; font-weight: 600; color: #64748b; flex: 1; margin-left: 2px; }
.legend-badge { font-size: 8px; font-weight: 700; color: #94a3b8; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1px 5px; }
.legend-val { font-size: 11.5px; font-weight: 750; color: #1e293b; display: block; }

/* Interactive Activity Tab Drawer */
.dashboard-activity-panel { margin-top: 22px; border-radius: 12px; }
.activity-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.activity-tab-nav { display: inline-flex; align-items: center; gap: 4px; background: #f1f5f9; padding: 3px; border-radius: 8px; }
.activity-tab-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; font-size: 10.5px; font-weight: 600; color: #64748b; cursor: pointer; transition: all 0.15s ease; }
.activity-tab-btn:hover { color: #1e293b; }
.activity-tab-btn.active { background: #ffffff; color: var(--purple); font-weight: 750; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.tab-count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 10px; background: #e2e8f0; color: #475569; font-size: 9px; font-weight: 700; }
.activity-tab-btn.active .tab-count-pill { background: #ede9fe; color: #6d28d9; }
.tab-content-pane { animation: fadeIn 0.2s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.panel { min-width: 0; padding: 19px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.panel-heading-actions { display: flex; align-items: center; gap: 12px; }
.panel-heading h2 { margin: 0; font: 700 13px "Manrope", sans-serif; }
.text-link { border: 0; background: transparent; color: var(--purple); font-size: 10px; font-weight: 700; }
.table-card { overflow: hidden; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { padding: 11px 15px; background: #fbfbfd; color: #9aa1af; font-size: 9px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; }
td { padding: 13px 15px; border-top: 1px solid #f0f1f5; color: #626b7b; font-size: 10px; white-space: nowrap; }
td strong { color: #30394a; font-size: 10px; font-weight: 700; }
/* Modern Micro Action Buttons in Tables */
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 29px;
  padding: 0 11px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  background: #ffffff;
  color: #4f46e5;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  white-space: nowrap;
}
.table-action > span {
  font-size: 11px;
  line-height: 1;
}
.table-action:hover {
  background: #f5f3ff;
  border-color: #c7d2fe;
  color: #4338ca;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.14);
}
.table-action:active {
  transform: translateY(0);
}
.table-action + .table-action {
  margin-left: 6px;
}

/* Specific Action Button Variants */
.table-action[data-invoice], .table-action[data-quote], .table-action.action-open {
  background: #f8faff;
  border-color: #dbeafe;
  color: #2563eb;
}
.table-action[data-invoice]:hover, .table-action[data-quote]:hover, .table-action.action-open:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.16);
}

.table-action[data-convert-quote], .table-action.action-convert {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #059669;
}
.table-action[data-convert-quote]:hover, .table-action.action-convert:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
  color: #047857;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.18);
}

.table-action.danger, .button.danger {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #e11d48;
}
.table-action.danger:hover, .button.danger:hover {
  background: #ffe4e6;
  border-color: #fda4af;
  color: #be123c;
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.16);
  transform: translateY(-1px);
}

/* Modern & Attractive Status Badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.25px;
  line-height: 1;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  flex-shrink: 0;
}
.status.paid, .status.accepted {
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}
.status.paid:hover, .status.accepted:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.status.sent {
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.status.sent:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.status.partial {
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.status.partial:hover {
  background: #fef3c7;
  border-color: #fcd34d;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.status.overdue, .status.declined {
  color: #be123c;
  background: #fff1f2;
  border: 1px solid #fecdd3;
}
.status.overdue:hover, .status.declined:hover {
  background: #ffe4e6;
  border-color: #fda4af;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.2);
}
.status.overdue::before {
  animation: overduePulse 1.8s infinite ease-in-out;
}
@keyframes overduePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(225, 29, 72, 0); }
}
.activity-list { display: grid; }
.activity { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid #f0f1f5; }
.activity:last-child { border-bottom: 0; }
.activity-mark { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 auto; border-radius: 50%; background: #eaf7f1; color: var(--green); font-size: 12px; }
.activity strong { display: block; color: #384153; font-size: 10px; }
.activity small { display: block; margin-top: 4px; color: #9aa1af; font-size: 9px; }
.activity-amount { margin-left: auto; color: #30394a; font-size: 10px; font-weight: 700; white-space: nowrap; }
.empty-state { padding: 35px 18px; color: #9299a8; font-size: 11px; text-align: center; }
.empty-state strong { display: block; margin-bottom: 5px; color: #4b5566; font-size: 12px; }
.content-card { border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.search { width: 245px; max-width: 100%; height: 34px; padding: 0 11px; border: 1px solid #e9ecf2; border-radius: 6px; outline: 0; color: var(--ink); font-size: 10px; }
.search:focus, .field input:focus, .field select:focus, .field textarea:focus, .line-items input:focus, .line-items select:focus { border-color: #9d91ef; box-shadow: 0 0 0 3px #f0edff; outline: 0; }
.toolbar select { height: 34px; padding: 0 10px; border: 1px solid #e9ecf2; border-radius: 6px; background: white; color: #697284; font-size: 10px; }
.payment-history-filters { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)) minmax(160px, 1.4fr) auto; align-items: end; justify-content: stretch; }
.history-filter { display: grid; min-width: 0; gap: 5px; color: #626b7b; font-size: 9px; font-weight: 700; }
.history-filter input { width: 100%; min-width: 0; height: 34px; padding: 0 9px; border: 1px solid #e9ecf2; border-radius: 6px; background: white; color: #697284; font-size: 10px; }
.history-filter-actions { display: flex; gap: 7px; }
.payment-history-exports { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 0; color: var(--muted); font-size: 10px; }
.payment-history-summary { border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.payment-history-summary strong { color: var(--ink); font-size: 12px; }
.selected-user td { background: #faf9ff; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #626b7b; font-size: 10px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 37px; padding: 8px 10px; border: 1px solid #e5e8ef; border-radius: 6px; background: #fff; color: var(--ink); font-size: 11px; }
.field textarea { min-height: 68px; resize: vertical; }
.modal { width: min(750px, calc(100vw - 28px)); max-height: calc(100vh - 30px); padding: 0; border: 0; border-radius: 12px; box-shadow: 0 20px 80px #1b203533; }
.modal::backdrop { background: #1c243477; backdrop-filter: blur(2px); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 23px 15px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0 0 5px; font: 700 16px "Manrope", sans-serif; }
.modal-header p { margin: 0; color: var(--muted); font-size: 10px; }
.modal-close { border: 0; background: transparent; color: #8c94a3; font-size: 20px; }
.modal-body { max-height: calc(100vh - 180px); overflow: auto; padding: 19px 23px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 23px; border-top: 1px solid var(--line); }
.line-items-wrap { margin-top: 18px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.line-items { width: 100%; table-layout: fixed; border: 0; }
.line-items th, .line-items td { padding: 8px 6px; white-space: normal; vertical-align: top; }
.line-items th { padding-top: 10px; padding-bottom: 10px; white-space: nowrap; }
.line-items th:first-child, .line-items td:first-child { padding-left: 10px; }
.line-items th:last-child, .line-items td:last-child { padding-right: 8px; text-align: center; }
.line-items th:nth-child(2), .line-items td:nth-child(2) { width: 78px; }
.line-items th:nth-child(3), .line-items td:nth-child(3) { width: 110px; }
.line-items th:nth-child(4), .line-items td:nth-child(4) { width: 78px; }
.line-items th:nth-child(5), .line-items td:nth-child(5) { width: 38px; }
.line-item-main { display: grid; gap: 6px; }
.line-items input, .line-items select { width: 100%; min-width: 0; height: 32px; padding: 5px 8px; border: 1px solid #e5e8ef; border-radius: 5px; background: #fff; color: var(--ink); font-size: 11px; }
.line-items .remove-line { width: 28px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 5px; background: none; color: var(--red); font-size: 16px; line-height: 1; }
.line-items .remove-line:hover { background: #fff0f1; }
.line-controls { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.invoice-discount { max-width: 230px; margin: 18px 0 0 auto; }
.invoice-discount input { width: 100%; min-height: 37px; padding: 8px 10px; border: 1px solid #e5e8ef; border-radius: 6px; background: #fff; color: var(--ink); font-size: 11px; }
.totals { width: min(260px, 100%); margin: 17px 0 0 auto; }
.total-row { display: flex; justify-content: space-between; padding: 5px 0; color: #778092; font-size: 10px; }
.total-row.grand { margin-top: 6px; padding-top: 11px; border-top: 1px solid var(--line); color: var(--ink); font-size: 13px; font-weight: 700; }
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, .7fr); gap: 17px; align-items: start; }
.settings-stack { display: grid; gap: 17px; }
.settings-card { padding: 20px; }
.settings-card h2 { margin-bottom: 7px; font: 700 14px "Manrope", sans-serif; }
.settings-card > p { margin-bottom: 17px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.access-list { display: grid; border-top: 1px solid var(--line); }
.access-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 61px; padding: 10px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.access-row strong, .access-row small { display: block; }
.access-row strong { color: #384153; font-size: 11px; }
.access-row small { margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.access-row input { width: 17px; height: 17px; flex: 0 0 auto; accent-color: var(--purple); }
.access-row input:disabled { cursor: not-allowed; }
.notice { padding: 12px; border: 1px solid #f4e5bf; border-radius: 7px; background: #fffaf0; color: #806327; font-size: 10px; line-height: 1.55; }
.detail-total { display: flex; justify-content: flex-end; margin-top: 15px; font: 700 17px "Manrope", sans-serif; }
.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 20px; }
.detail-brand { margin-bottom: 15px; font: 800 17px "Manrope", sans-serif; }
.business-brand { display: flex; align-items: center; gap: 17px; min-width: 0; }
.document-logo { display: block; width: 175px; height: 116px; flex: 0 0 auto; object-fit: contain; }
.business-contact { color: #747d8d; font-size: 10px; line-height: 1.65; }
.document-title { flex: 0 0 auto; text-align: right; }
.document-title .eyebrow { margin-bottom: 6px; }
.document-title h2 { margin: 0 0 8px; font: 750 20px "Manrope", sans-serif; }
.detail-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; color: #747d8d; font-size: 10px; }
.detail-meta strong { color: #344052; }
.toast { position: fixed; z-index: 5; right: 22px; bottom: 22px; max-width: 380px; padding: 12px 16px; border-radius: 8px; background: #222b3b; color: #fff; font-size: 11px; box-shadow: 0 8px 25px #0002; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a73340; }
.muted-note { margin: 10px 0 0; color: #969eac; font-size: 9px; line-height: 1.5; }
.print-only { display: none; }
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 25px 16px; background: radial-gradient(ellipse at 15% 5%, #eeebff 0, transparent 35%), #f5f7fb; }
.auth-card { width: min(460px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 15px; background: #fff; box-shadow: 0 18px 60px #2630520e; }
.auth-demo-banner { margin-bottom: 24px; padding: 14px 16px; border: 1px solid #c7d2fe; border-radius: 10px; background: linear-gradient(135deg, #eff2fe 0%, #f5f3ff 100%); }
.auth-demo-badge { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: #4f46e5; font-size: 11px; }
.auth-demo-text { margin: 0; color: #374151; font-size: 12px; line-height: 1.55; }
.auth-demo-text strong { color: #1f2937; font-weight: 700; }
.auth-demo-link { color: #4f46e5; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.auth-demo-link:hover { color: #4338ca; }
.demo-card { border-color: #dcd7fa !important; background: #faf9ff !important; }
.demo-card h2 { color: var(--purple); }
.demo-card-actions { margin-top: 12px; }

/* Demo Alerts, Watermarks, and Disclaimers */
.demo-alert-strip { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 10px 14px; border: 1px solid #fed7aa; border-radius: 8px; background: #fff7ed; color: #9a3412; font-size: 11px; line-height: 1.45; }
.demo-strip-badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 4px; background: #ea580c; color: #ffffff; font-size: 9px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; flex: 0 0 auto; }
.demo-disclaimer-banner { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 7px 12px; border: 1px solid #fed7aa; border-radius: 6px; background: #fff7ed; color: #9a3412; font-size: 10px; font-weight: 600; }
.demo-pill-warning { padding: 2px 6px; border-radius: 4px; background: #ea580c; color: #fff; font-size: 8.5px; font-weight: 800; letter-spacing: .4px; }
.document-badge-row { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.watermark-tag { display: inline-flex; align-items: center; padding: 3px 8px; border: 1px solid #fed7aa; border-radius: 20px; background: #fffaf0; color: #c2410c; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; }
.demo-footer-disclaimer { margin-top: 24px; padding: 10px 14px; border: 1px dashed #fed7aa; border-radius: 7px; background: #fffaf0; color: #9a3412; font-size: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.watermark-pill-inline { display: inline-block; padding: 2px 7px; border-radius: 4px; background: #ffedd5; color: #c2410c; font-size: 8.5px; font-weight: 700; white-space: nowrap; }
.demo-form-banner { margin-bottom: 16px; padding: 9px 12px; border: 1px solid #fed7aa; border-radius: 7px; background: #fff7ed; color: #9a3412; font-size: 10.5px; line-height: 1.45; }

/* Watermark Background Pattern for Screen and Print */
.watermark-container { position: relative; }
.watermark-container::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: 0.07; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='340' height='200'><text x='50%' y='50%' fill='%236954e8' font-size='20' font-family='sans-serif' font-weight='800' transform='rotate(-28 170 100)' text-anchor='middle'>Demo Quotation/Invoices</text></svg>"); background-repeat: repeat; }
.watermark-container > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 18px; margin-bottom: 31px; }
.auth-brand .brand-mark { width: 43px; height: 43px; }
.auth-brand > span { display: grid; gap: 4px; }
.auth-brand strong { display: block; font: 700 14px "Manrope", sans-serif; }
.auth-brand small { display: block; margin: 0; color: var(--muted); font-size: 11px; }
.auth-card h1 { margin: 0 0 8px; font: 750 24px "Manrope", sans-serif; letter-spacing: -.7px; }
.auth-description { margin: 0 0 24px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.auth-form { display: grid; gap: 15px; }
.auth-form .button { width: 100%; min-height: 42px; margin-top: 4px; }
.auth-error { padding: 10px 12px; border: 1px solid #f1d1d4; border-radius: 7px; background: #fff3f4; color: #a73340; font-size: 11px; line-height: 1.5; }
.auth-role-card { display: flex; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 7px; color: #525c6f; font-size: 11px; }
.auth-role-card + .auth-role-card { margin-top: -7px; }
.auth-role-card span:last-child { color: var(--muted); font-size: 10px; }
.auth-footnote { margin: 19px 0 0; color: #959dad; font-size: 10px; line-height: 1.55; }

@media (max-width: 1050px) {
  .top-header-inner, .sub-bar-inner, .page-content { padding-left: 20px; padding-right: 20px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .top-header-inner { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .top-header-left { width: 100%; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
  .top-nav { width: 100%; overflow-x: auto; padding-bottom: 3px; }
  .top-header-right { margin-left: auto; }
  .today-label { display: none; }
  .sub-bar-inner { padding: 8px 16px; }
  .page-content { padding: 20px 16px 40px; }
  .dashboard-hero-card { flex-direction: column; align-items: flex-start; padding: 20px 18px; gap: 16px; }
  .hero-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .page-heading { align-items: flex-start; }
  h1 { font-size: 22px; }
  .page-heading > .button { flex: 0 0 auto; }
  .stats-grid { gap: 9px; }
  .stat-card { padding: 13px; }
  .stat-value { font-size: 20px; }
  .dashboard-grid, .dashboard-analytics-grid, .settings-layout { grid-template-columns: 1fr; }
  .payment-history-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-filter-actions { grid-column: 1 / -1; }
  .panel { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .modal-body { padding: 15px; }
  .modal-header, .modal-footer { padding-right: 15px; padding-left: 15px; }
  .line-items thead { display: none; }
  .line-items, .line-items tbody { display: block; width: 100%; }
  .line-items tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 8px; padding: 10px; border-top: 1px solid #f0f1f5; }
  .line-items tr:first-child, .line-items tbody tr:first-child { border-top: 0; }
  .line-items td, .line-items td:nth-child(n) { display: block; width: auto; padding: 0; border: 0; text-align: left; }
  .line-items td:first-child { grid-column: 1 / -1; }
  .line-items td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; color: #9aa1af; font-size: 9px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
  .line-items td.line-remove-cell { align-self: end; }
  .auth-card { padding: 25px 20px; }
}
@media print {
  @page { size: A4; margin: 0; }
  body { min-width: 0; margin: 0; background: #fff; }
  body > :not(#form-dialog) { display: none !important; }
  #form-dialog {
    position: static;
    display: block !important;
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #1c2434;
    background: #fff;
  }
  #form-dialog::backdrop, #form-dialog > :not(.modal-body) { display: none !important; }
  #form-dialog .modal-body {
    display: block;
    max-height: none;
    overflow: visible;
    padding: 14mm 16mm;
  }
  #form-dialog .modal-body > :not(#print-document) { display: none !important; }
  #print-document { width: 100%; margin: 0 auto; }
  #print-document .table-wrap { overflow: visible; }
  #print-document table { page-break-inside: auto; }
  #print-document tr { page-break-inside: avoid; page-break-after: auto; }
  #print-document thead { display: table-header-group; }
  #print-document .detail-header, #print-document .detail-meta, #print-document .totals {
    page-break-inside: avoid;
  }
  #print-document .print-only { display: block; }
  #print-document .muted-note, #print-document .business-contact { color: #555; }
  #print-document th { color: #555; background: #f7f7f8 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  #print-document.watermark-container::before {
    display: block !important;
    opacity: 0.08 !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  .demo-disclaimer-banner, .demo-footer-disclaimer, .watermark-tag {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
