/* The Aviyaan | Dashboard layout refinement | 2026-10-25
   CSS-only: no API, record, permission, report, or workflow changes.
   Loaded last so it refines the current production theme safely. */

/* Navigation: consistent labels, icon sizes and visible focus. */
.user-light .sidebar .brand { display:flex; align-items:center; gap:9px; min-height:58px; margin-bottom:20px; }
.user-light .sidebar .brand > span { min-width:0; line-height:1.25; white-space:normal; }
.user-light .sidebar .brand img { flex:0 0 auto; object-fit:contain; }
.user-light .sidebar .nav { display:flex; flex-direction:column; gap:3px; min-width:0; }
.user-light .sidebar .nav button { box-sizing:border-box; display:flex; align-items:center; gap:12px; width:100%; min-height:43px; margin:0; padding:10px 13px; border-radius:9px; line-height:1.25; font-size:13px; font-weight:500; text-align:left; }
.user-light .sidebar .nav button svg { width:19px; height:19px; flex:0 0 19px; }
.user-light .sidebar .nav button > span { flex:1; min-width:0; overflow-wrap:break-word; }
.user-light .sidebar .nav button.active { font-weight:700; }
.user-light .sidebar .nav-divider { margin:12px 8px; }
.user-light .sidebar .nav button:focus-visible,
.user-light .metric:focus-visible,
.user-light .detail-tabs button:focus-visible,
.user-light .vm-tabs button:focus-visible { outline:3px solid #fb9a36; outline-offset:2px; }

/* Topbar: preserve space for username and controls at laptop sizes. */
.user-light .topbar { box-sizing:border-box; gap:16px; padding-left:24px; padding-right:24px; }
.user-light .topbar .global-search { min-width:0; flex:0 1 510px; }
.user-light .topbar .profile { flex-shrink:0; min-width:0; }
.user-light .topbar .profile b,
.user-light .topbar .profile small { overflow-wrap:anywhere; }

/* Dashboard: breathe without affecting other CRM pages. */
.user-light .content:has(.welcome-banner) { max-width:1920px; padding:0 24px 32px; }
.user-light .content:has(.welcome-banner) .welcome-banner { min-height:140px; padding:24px 30px; margin:0 0 18px; }
.user-light .content:has(.welcome-banner) .welcome-banner:before { inset:0 -24px; }
.user-light .welcome-banner > div { min-width:0; }
.user-light .welcome-banner h1 { font-size:clamp(25px,2.3vw,36px); line-height:1.2; }
.user-light .welcome-banner small { max-width:670px; line-height:1.5; }
.user-light .welcome-banner > .btn { flex-shrink:0; min-height:43px; }

/* 8 admin KPIs: 4 columns x 2 rows; no cropped INR values. */
.user-light .metric-grid,
.user-light .metric-grid.admin-metrics {
  display:grid; grid-template-columns:repeat(4,minmax(0,1fr));
  gap:16px; margin:0 0 18px; align-items:stretch;
}
.user-light .metric-grid .metric {
  box-sizing:border-box; display:grid; grid-template-columns:36px minmax(0,1fr);
  align-content:start; align-items:start; gap:12px; width:100%; min-width:0;
  min-height:136px; padding:18px 16px 17px; border-radius:13px;
  text-align:left; box-shadow:0 5px 17px #184c7b12;
  transition:transform .15s ease, box-shadow .15s ease;
}
.user-light .metric-grid .metric:hover { transform:translateY(-2px); box-shadow:0 9px 24px #184c7b22; }
.user-light .metric-grid .metric > div:last-child { min-width:0; max-width:100%; }
.user-light .metric-grid .metric-icon { box-sizing:border-box; width:36px; height:36px;
  padding:7px; display:grid; place-items:center; border-radius:10px;
  background:#dff0ff; color:#116cbb; }
.user-light .metric-grid .metric-icon svg { width:21px; height:21px; }
.user-light .metric-grid .metric span { display:block; min-height:18px; margin:0 0 8px;
  font-size:13px; line-height:1.35; font-weight:650; }
.user-light .metric-grid .metric strong { display:block; max-width:100%; margin:0;
  font-family:Inter,system-ui,-apple-system,'Segoe UI',sans-serif;
  font-size:clamp(19px,1.7vw,28px); line-height:1.2;
  font-weight:800; letter-spacing:-.035em;
  font-variant-numeric:tabular-nums;
  white-space:normal; overflow-wrap:anywhere; word-break:normal;
}
.user-light .metric-grid .metric small { display:block; max-width:100%; margin-top:8px;
  font-size:12px; line-height:1.4; white-space:normal; }
.user-light .metric-grid .metric:nth-child(even) .metric-icon { background:#ffffff24; color:#fff; }

/* Roomy, consistently sized chart panels (2 x 2 on desktops). */
.user-light .dashboard-charts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; align-items:stretch; }
.user-light .dashboard-charts > .panel { box-sizing:border-box; min-width:0; min-height:295px; height:100%;
  margin:0; padding:19px 21px 17px; border-radius:13px; display:flex; flex-direction:column; }
.user-light .dashboard-charts > .panel .panel-head { min-height:27px; margin-bottom:15px; }
.user-light .dashboard-charts > .panel .panel-head h2 { margin:0; font-size:17px; line-height:1.3; font-weight:700; }
.user-light .dashboard-charts .chart-caption { display:flex; flex-wrap:wrap; gap:12px 18px; justify-content:center; }
.user-light .dashboard-charts .bars-chart { width:100%; box-sizing:border-box; min-height:168px; flex:1; }
.user-light .dashboard-charts .ring-layout { flex:1; justify-content:center; gap:clamp(14px,4vw,48px); }
.user-light .dashboard-charts .ring { width:clamp(145px,13vw,196px); height:clamp(145px,13vw,196px); }
.user-light .dashboard-charts .chart-legend { flex:0 1 205px; min-width:0; }
.user-light .dashboard-charts .chart-legend > div { display:grid; grid-template-columns:10px minmax(0,1fr) auto;
  gap:9px; margin:11px 0; font-size:12px; white-space:normal; align-items:center; }
.user-light .dashboard-charts .chart-legend span { min-width:0; overflow-wrap:anywhere; }
.user-light .dashboard-charts .chart-legend b { white-space:nowrap; }
.user-light .dashboard-charts .conversion { flex:1; justify-content:center; gap:28px; }
.user-light .dashboard-charts .conversion-ring { flex-shrink:0; }
.user-light .dashboard-charts .conversion dl { min-width:0; }
.user-light .dashboard-charts .chart-note { margin-top:10px; }

/* Tables are all aligned and the third admin table gets a wide readable row. */
.user-light .dashboard-tables { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:16px; align-items:stretch; }
.user-light .dashboard-tables > .panel { margin:0; min-width:0; padding:19px 20px; border-radius:13px; }
.user-light .dashboard-tables > .panel:nth-child(3):last-child { grid-column:1/-1; }
.user-light .dashboard-bottom { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin-top:16px; }
.user-light .dashboard-bottom > .panel { min-width:0; margin:0; padding:19px 20px; border-radius:13px; }
.user-light .dashboard-tables .panel-head,
.user-light .dashboard-bottom .panel-head { align-items:center; gap:12px; }
.user-light .dashboard-tables .panel-head h2,
.user-light .dashboard-bottom .panel-head h2 { font-size:16px; font-weight:700; line-height:1.35; }
.user-light .dashboard-tables table,
.user-light .dashboard-bottom table { width:100%; }
.user-light .dashboard-tables td,
.user-light .dashboard-bottom td { overflow-wrap:anywhere; }

/* Detail tabs: maintain equal-height click areas, wrapping only when needed. */
.user-light .detail-tabs,
.user-light .vm-tabs { align-items:center; gap:8px; min-width:0; overflow-x:auto; scroll-behavior:smooth; }
.user-light .detail-tabs button,
.user-light .vm-tabs button { box-sizing:border-box; flex:0 0 auto; min-height:42px; display:inline-flex;
  align-items:center; justify-content:center; text-align:center; line-height:1.25; white-space:nowrap; }

@media (max-width:1350px) {
  .user-light .metric-grid,
  .user-light .metric-grid.admin-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .user-light .content:has(.welcome-banner) { padding-left:18px; padding-right:18px; }
  .user-light .content:has(.welcome-banner) .welcome-banner:before { inset:0 -18px; }
}
@media (max-width:1050px) {
  .user-light .metric-grid,
  .user-light .metric-grid.admin-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .user-light .dashboard-charts { grid-template-columns:1fr; }
  .user-light .dashboard-tables { grid-template-columns:1fr; }
  .user-light .dashboard-tables > .panel:nth-child(3):last-child { grid-column:auto; }
  .user-light .dashboard-bottom { grid-template-columns:1fr; }
  .user-light .dashboard-charts .ring { width:160px; height:160px; }
  .user-light .topbar { gap:10px; padding-left:14px; padding-right:14px; }
}
@media (max-width:760px) {
  .user-light .content:has(.welcome-banner) { padding:0 12px 25px; }
  .user-light .content:has(.welcome-banner) .welcome-banner { min-height:130px; padding:22px 12px; gap:10px; }
  .user-light .content:has(.welcome-banner) .welcome-banner:before { inset:0 -12px; }
  .user-light .welcome-banner h1 { font-size:24px; }
  .user-light .metric-grid,.user-light .metric-grid.admin-metrics { gap:10px; }
  .user-light .metric-grid .metric { grid-template-columns:1fr; gap:8px; min-height:154px; padding:14px 12px; }
  .user-light .metric-grid .metric-icon { width:32px; height:32px; padding:6px; }
  .user-light .metric-grid .metric strong { font-size:clamp(17px,4vw,24px); }
  .user-light .metric-grid .metric span { font-size:12px; }
  .user-light .metric-grid .metric small { font-size:11px; }
  .user-light .dashboard-charts .panel { min-height:275px; padding:16px; }
  .user-light .dashboard-charts .ring-layout { gap:14px; }
  .user-light .dashboard-charts .ring { width:126px; height:126px; }
  .user-light .dashboard-charts .conversion { gap:12px; }
  .user-light .dashboard-charts .conversion-ring { width:115px; height:115px; }
  .user-light .dashboard-charts .chart-legend>div { font-size:11px; }
  .user-light .dashboard-tables > .panel,
  .user-light .dashboard-bottom > .panel { padding:16px 13px; }
}
@media (max-width:390px) {
  .user-light .metric-grid,.user-light .metric-grid.admin-metrics { grid-template-columns:1fr; }
  .user-light .metric-grid .metric { grid-template-columns:36px minmax(0,1fr); min-height:112px; }
  .user-light .dashboard-charts .ring-layout { flex-wrap:wrap; }
}
@media (prefers-reduced-motion:reduce) {
  .user-light .metric-grid .metric { transition:none; }
  .user-light .metric-grid .metric:hover { transform:none; }
}
