/* ===== CSS Variables ===== */
:root {
  --primary: #F97316;
  --nav-hover: #6366F1;
  --nav-active: #6366F1;
  --btn-primary: #6366F1;
  --btn-primary-hover: #4F46E5;
  --sidebar: #1E293B;
  --sidebar-width: 250px;
  --sidebar-collapsed: 60px;
  --navbar-height: 56px;
  --alerts-width: 280px;
  --page-bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --border: #E2E8F0;
  --text-1: #1E293B;
  --text-2: #64748B;
  --input-bg: #FFFFFF;
  --form-surface: #FFFFFF;
  --form-surface-muted: #F8FAFC;
  --dropdown-bg: #FFFFFF;
  --dropdown-hover: #EFF6FF;
  --dropdown-border-light: #F1F5F9;
  --file-browse-bg: #E2E8F0;
  --file-browse-hover: #CBD5E1;
  --placeholder: #94A3B8;
  --group-header-bg: #E2E8F0;
  --info-banner-bg: #EEF2FF;
  --info-banner-text: #6366F1;
  --panel-header-bg: #64748B;
  --section-header-bg: #F1F5F9;
  --section-header-text: #1E293B;
  --nav-main-size: 13px;
  --nav-sub-size: 11px;
  --nav-subsub-size: 10px;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

html {
  font-size: 14px;
}

body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--text-1);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

table {
  width: 100%;
  border-collapse: collapse;
}

img {
  display: block;
  max-width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: width 0.3s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 64px;
}

.logo-icon {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}

.logo-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  white-space: nowrap;
}

.logo-title {
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.3px;
}

.logo-tagline {
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  margin-top: 1px;
}

.sidebar.collapsed .logo-text {
  opacity: 0;
  width: 0;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 9px 24px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.nav-group {
  margin-top: 16px;
}

.nav-group-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 10px 8px;
  white-space: nowrap;
}

.sidebar.collapsed .nav-group-label {
  opacity: 0;
  height: 0;
  padding: 0;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--nav-main-size);
  font-weight: 500;
  line-height: 1.35;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 2px;
  white-space: nowrap;
}

.nav-item > span:not(.nav-bullet) {
  font-size: var(--nav-main-size);
}

.nav-item .nav-chevron {
  margin-left: auto;
  width: 14px;
  height: 14px;
  opacity: 0.4;
  flex-shrink: 0;
}

.nav-item.active .nav-chevron {
  opacity: 0.85;
}

.sidebar.collapsed .nav-chevron {
  display: none;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--nav-hover);
  color: #fff;
}

.nav-item:hover .nav-chevron {
  opacity: 0.85;
  color: #fff;
}

.nav-item.active {
  background: var(--nav-active);
  color: #fff;
}

/* Expandable nav folders (Finance / Bills submenus) */
.nav-folder {
  margin-bottom: 2px;
}

.nav-folder-toggle {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: var(--nav-main-size);
  font-weight: 500;
}

.nav-folder .nav-chevron-down {
  transition: transform 0.2s ease;
}

.nav-folder.open .nav-chevron-down {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  padding: 4px 0 6px 10px;
  margin-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-folder.open .nav-submenu {
  display: block;
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.55);
  font-size: var(--nav-sub-size);
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: 2px;
  transition: background 0.2s, color 0.2s;
}

.nav-subitem > span:not(.nav-bullet) {
  font-size: var(--nav-sub-size);
}

.nav-bullet {
  width: 6px;
  height: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-subitem:hover {
  background: var(--nav-hover);
  color: #fff;
}

.nav-subitem:hover .nav-bullet {
  border-color: rgba(255, 255, 255, 0.7);
}

.nav-subitem.active {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
}

.nav-subitem.active .nav-bullet {
  border-color: #fff;
  background: #fff;
}

.nav-subfolder {
  margin-bottom: 2px;
}

.nav-subfolder-toggle {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: var(--nav-sub-size);
  font-weight: 500;
}

.nav-subfolder .nav-chevron-down {
  margin-left: auto;
  width: 12px;
  height: 12px;
  opacity: 0.5;
  transition: transform 0.2s ease;
}

.nav-subfolder.open .nav-chevron-down {
  transform: rotate(180deg);
}

.nav-subsubmenu {
  display: none;
  padding: 2px 0 4px 10px;
  margin-left: 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-subfolder.open .nav-subsubmenu {
  display: block;
}

.nav-subsubitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 14px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.48);
  font-size: var(--nav-subsub-size);
  font-weight: 400;
  line-height: 1.35;
  margin-bottom: 2px;
  transition: background 0.2s, color 0.2s;
}

.nav-subsubitem > span:not(.nav-bullet) {
  font-size: var(--nav-subsub-size);
}

.nav-subsubitem:hover {
  background: var(--nav-hover);
  color: #fff;
}

.nav-subsubitem.active {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
}

.sidebar.collapsed .nav-submenu {
  display: none !important;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

.sidebar.collapsed .nav-item span {
  display: none;
}

/* ===== App Wrapper ===== */
.app-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.app-wrapper.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed);
}

/* ===== Navbar ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-height);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--text-2);
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--page-bg);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
  max-width: 320px;
  flex: 1;
}

.search-box svg {
  width: 16px;
  height: 16px;
  color: var(--text-2);
  flex-shrink: 0;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
  width: 100%;
}

.search-box input::placeholder {
  color: var(--text-2);
}

.navbar-date {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
}

.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

.badge-red {
  background: var(--danger);
}

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

/* Notification Dropdown */
.notification-wrapper {
  position: relative;
}

.notification-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
  z-index: 300;
  overflow: hidden;
}

.notification-dropdown.show {
  display: block;
}

.dropdown-header {
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
}

.dropdown-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background: var(--page-bg);
}

.dropdown-item strong {
  display: block;
  font-size: 12.5px;
  color: var(--text-1);
}

.dropdown-item p {
  font-size: 11.5px;
  color: var(--text-2);
  margin-top: 2px;
}

.dropdown-time {
  font-size: 10.5px;
  color: var(--text-2);
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.alert-dot-red { background: var(--danger); }
.alert-dot-orange { background: var(--primary); }
.alert-dot-yellow { background: var(--warning); }
.alert-dot-blue { background: var(--info); }

/* User Profile */
.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 4px 10px 4px 4px;
  border-radius: 10px;
  transition: background 0.2s, border-color 0.2s;
  border: 1px solid var(--border);
  background: #FAFBFC;
  font-family: inherit;
  color: inherit;
}

.user-profile:hover {
  background: var(--page-bg);
  border-color: #CBD5E1;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1.2;
}

.user-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}

/* Profile Dropdown */
.profile-wrapper {
  position: relative;
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border);
  z-index: 300;
  overflow: hidden;
}

.profile-dropdown.show {
  display: block;
}

.profile-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-dropdown-header img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-dropdown-header strong {
  display: block;
  font-size: 13px;
  color: var(--text-1);
}

.profile-dropdown-header span {
  font-size: 11px;
  color: var(--text-2);
}

.profile-dropdown-menu {
  padding: 6px;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-1);
  transition: background 0.15s;
  cursor: pointer;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font-family: inherit;
}

.profile-dropdown-item:hover {
  background: var(--page-bg);
}

.profile-dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}

.profile-dropdown-item.danger {
  color: var(--danger);
}

.profile-dropdown-item.danger svg {
  color: var(--danger);
}

.profile-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}

/* ===== Content Area ===== */
.content-area {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--navbar-height));
}

.dashboard-main {
  flex: 1;
  padding: 16px 20px;
  min-width: 0;
}

.dashboard-role-welcome {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
  border: 1px solid #BFDBFE;
}

.dashboard-role-welcome-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dashboard-role-welcome-icon svg {
  width: 22px;
  height: 22px;
}

.dashboard-role-welcome-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 4px;
}

.dashboard-role-welcome-text {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
}

.content-area-no-alerts .dashboard-main {
  max-width: none;
}

.content-area-no-alerts .alerts-panel {
  display: none !important;
}

.content-area-no-alerts .alerts-panel-reopen {
  display: none !important;
}

.content-area.alerts-panel-hidden .alerts-panel {
  width: 0;
  min-width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  overflow: hidden;
  border-left: none;
  pointer-events: none;
}

.alerts-panel {
  transition: width 0.25s ease, opacity 0.25s ease, padding 0.25s ease, border-color 0.25s ease;
}

.alerts-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.alerts-panel-hide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-2);
  transition: background 0.2s, color 0.2s;
}

.alerts-panel-hide svg {
  width: 18px;
  height: 18px;
}

.alerts-panel-hide:hover {
  background: var(--page-bg);
  color: var(--text-1);
}

.alerts-panel-reopen {
  display: none !important;
}

.alerts-panel-reopen:hover {
  background: #F8FAFC;
  color: var(--nav-active);
  box-shadow: -3px 0 14px rgba(99, 102, 241, 0.12);
}

.alerts-panel-reopen svg {
  width: 18px;
  height: 18px;
}

.alerts-panel-reopen-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}

.alerts-panel-reopen-badge {
  position: absolute;
  top: 8px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.2;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-2);
}

.breadcrumb svg {
  width: 12px;
  height: 12px;
}

.breadcrumb-active {
  color: var(--primary);
  font-weight: 500;
}

.page-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--btn-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary svg {
  width: 16px;
  height: 16px;
}

.btn-primary:hover {
  background: var(--btn-primary-hover);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  color: var(--text-1);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s;
}

.btn-outline svg {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}

.btn-outline:hover {
  border-color: var(--primary);
  background: #fff7ed;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.6);
}

/* ===== KPI Grid ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(226, 232, 240, 0.6);
  padding: 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.kpi-icon-blue { background: #3B82F6; }
.kpi-icon-green { background: #22C55E; }
.kpi-icon-orange { background: #F97316; }
.kpi-icon-purple { background: #8B5CF6; }
.kpi-icon-yellow { background: #EAB308; }
.kpi-icon-red { background: #EF4444; }

.kpi-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.kpi-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 10.5px;
  font-weight: 500;
  margin-top: 2px;
}

.kpi-sub-green { color: var(--success); }
.kpi-sub-orange { color: var(--primary); }
.kpi-sub-gray { color: var(--text-2); }
.kpi-sub-red { color: var(--danger); }

/* ===== Panel Grid ===== */
.panel-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.panel-grid-2 {
  grid-template-columns: 3fr 2fr;
}

/* Dashboard: Material Stock (left) + Project Financial Summary (right) */
.panel-grid-2.dash-stock-finance-row {
  grid-template-columns: minmax(260px, 2fr) minmax(340px, 3fr);
}

.dash-stock-finance-row .dash-panel-material {
  grid-column: 1;
  order: 1;
}

.dash-stock-finance-row .dash-panel-finance {
  grid-column: 2;
  order: 2;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-header {
  margin-bottom: 14px;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

/* ===== Tables ===== */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  font-size: 12px;
}

.data-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-1);
}

.data-table tbody td.text-green {
  color: #16A34A !important;
  font-weight: 700;
}

.data-table tbody td.text-red {
  color: #DC2626 !important;
  font-weight: 700;
}

.data-table tbody td.text-orange {
  color: #D97706 !important;
  font-weight: 700;
}

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

.data-table tbody tr:hover {
  background: #F1F5F9;
}

/* Cross-linked row highlight (arrives via ?invoice= param) */
.data-table tbody tr.row-linked-highlight {
  background: #EFF6FF;
  outline: 2px solid #3B82F6;
  outline-offset: -2px;
  animation: linked-pulse 1.8s ease-out forwards;
}

@keyframes linked-pulse {
  0%   { background: #DBEAFE; }
  60%  { background: #EFF6FF; }
  100% { background: transparent; outline-color: transparent; }
}

/* Progress Bar */
.progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #E2E8F0;
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.progress-fill {
  height: 100%;
  background: var(--info);
  border-radius: 3px;
  transition: width 0.3s;
}

.progress-cell span {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 30px;
}

/* Status Badges */
.badge-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-on-track {
  background: #DCFCE7;
  color: #16A34A;
}

.badge-at-risk {
  background: #FFEDD5;
  color: #EA580C;
}

.badge-delayed {
  background: #FEE2E2;
  color: #DC2626;
}

.badge-purple {
  background: #EDE9FE;
  color: #7C3AED;
}

/* Text Colors */
.text-green { color: var(--success); font-weight: 600; }
.text-orange { color: var(--warning); font-weight: 600; }
.text-red { color: var(--danger); font-weight: 600; }

/* ===== Charts ===== */
.chart-container {
  position: relative;
  height: 220px;
}

.attendance-chart-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 220px;
}

.doughnut-container {
  position: relative;
  width: 160px;
  height: 160px;
  flex-shrink: 0;
}

.attendance-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-label {
  font-size: 12px;
  color: var(--text-1);
  font-weight: 500;
  min-width: 50px;
}

.legend-value {
  font-size: 11.5px;
  color: var(--text-2);
  margin-left: auto;
}

/* ===== Sales Funnel ===== */
.funnel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
}

.funnel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  background: var(--funnel-color);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 0 16px;
  position: relative;
}

.funnel-bar-1 {
  width: 100%;
  clip-path: polygon(0 0, 100% 0, 96% 100%, 4% 100%);
  border-radius: 6px 6px 0 0;
}

.funnel-bar-2 {
  width: 82%;
  clip-path: polygon(2% 0, 98% 0, 94% 100%, 6% 100%);
}

.funnel-bar-3 {
  width: 64%;
  clip-path: polygon(3% 0, 97% 0, 93% 100%, 7% 100%);
}

.funnel-bar-4 {
  width: 48%;
  clip-path: polygon(4% 0, 96% 0, 92% 100%, 8% 100%);
}

.funnel-bar-5 {
  width: 34%;
  clip-path: polygon(5% 0, 95% 0, 90% 100%, 10% 100%);
  border-radius: 0 0 6px 6px;
}

.funnel-label {
  font-weight: 500;
}

.funnel-value {
  font-weight: 700;
}

/* ===== Pending Approvals ===== */
.approvals-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.approval-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow 0.2s;
}

.approval-card:hover {
  box-shadow: var(--shadow);
}

.approval-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.approval-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.approval-icon-red { background: #FEE2E2; }
.approval-icon-red svg { color: var(--danger); }
.approval-icon-orange { background: #FFEDD5; }
.approval-icon-orange svg { color: var(--primary); }
.approval-icon-blue { background: #DBEAFE; }
.approval-icon-blue svg { color: var(--info); }
.approval-icon-purple { background: #EDE9FE; }
.approval-icon-purple svg { color: #8B5CF6; }
.approval-icon-green { background: #DCFCE7; }
.approval-icon-green svg { color: var(--success); }

.approval-count {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-top: 4px;
}

.approval-pending {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
}

.approval-label {
  font-size: 11px;
  color: var(--text-2);
  font-weight: 500;
  margin-top: 4px;
  line-height: 1.3;
}

/* ===== Quick Actions ===== */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
  min-height: 80px;
}

.quick-action-btn svg {
  width: 22px;
  height: 22px;
  color: var(--info);
}

.quick-action-btn span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-1);
  text-align: center;
  line-height: 1.3;
}

.quick-action-btn:hover {
  border-color: var(--primary);
  background: #FFF7ED;
}

.quick-action-btn:hover svg {
  color: var(--primary);
}

.quick-action-menu-wrapper {
  position: relative;
}

.quick-action-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
  z-index: 200;
}

.quick-action-menu.show {
  display: block;
}

.quick-action-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  text-align: left;
  transition: background 0.15s;
}

.quick-action-menu-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-2);
  flex-shrink: 0;
}

.quick-action-menu-item:hover {
  background: var(--page-bg);
}

.quick-action-menu-item:hover svg {
  color: var(--primary);
}

.quick-action-menu-empty {
  padding: 12px;
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
}

/* ===== Alerts Panel ===== */
.alerts-panel {
  width: var(--alerts-width);
  flex-shrink: 0;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  padding: 24px 16px;
  overflow-y: auto;
  max-height: calc(100vh - var(--navbar-height));
  position: sticky;
  top: var(--navbar-height);
}

.alerts-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
}

.alerts-panel-header .panel-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
  margin: 0;
}

.alerts-panel-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--page-bg);
  border-radius: 10px;
}

.alerts-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.alerts-tab svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.alerts-tab.active {
  background: var(--card-bg);
  color: var(--text-1);
  box-shadow: var(--shadow);
}

.alerts-tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #FEE2E2;
  color: var(--danger);
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.alerts-tab-count-blue {
  background: #DBEAFE;
  color: var(--info);
}

.alerts-panel-body {
  min-height: 0;
}

.alerts-tab-panel {
  display: none;
}

.alerts-tab-panel.active {
  display: block;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alerts-clear-all {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.alerts-clear-all:hover {
  color: var(--danger);
  background: #FEE2E2;
}

.notification-wrapper,
.message-btn-wrapper {
  position: relative;
}

.message-dropdown {
  right: 0;
}

.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  padding-right: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: box-shadow 0.2s, opacity 0.25s, transform 0.25s;
}

.alert-item-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

a.alert-item-link:hover strong {
  color: var(--info, #2563eb);
}

.alert-item-link {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

a.alert-item-link:hover strong {
  color: var(--info);
}

.alert-item.dismissing {
  opacity: 0;
  transform: translateX(12px);
  pointer-events: none;
}

.alert-item.is-hidden {
  display: none !important;
}

.alert-item.is-unread {
  background: rgba(37, 99, 235, 0.06);
  border-left: 3px solid #2563EB;
}

.alert-item.is-unread strong {
  font-weight: 700;
}

.alert-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--text-2);
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.alert-dismiss svg,
.alert-dismiss i {
  pointer-events: none;
  width: 14px;
  height: 14px;
}

.alert-item:hover .alert-dismiss,
.alert-dismiss:focus {
  opacity: 1;
}

.alert-dismiss:hover {
  background: #FEE2E2;
  color: var(--danger);
  opacity: 1;
}

.alert-item:hover {
  box-shadow: var(--shadow);
}

.alert-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.alert-icon svg {
  width: 18px;
  height: 18px;
}

.alert-icon-red {
  background: #FEE2E2;
  color: var(--danger);
}

.alert-icon-orange {
  background: #FFEDD5;
  color: var(--primary);
}

.alert-icon-yellow {
  background: #FEF3C7;
  color: var(--warning);
}

.alert-icon-blue {
  background: #DBEAFE;
  color: var(--info);
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-content-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding-right: 18px;
}

.alert-content strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  flex: 1;
}

.alert-content p {
  font-size: 11px;
  color: var(--text-2);
  margin-top: 3px;
  line-height: 1.4;
}

.alert-time {
  font-size: 10px;
  color: var(--text-2);
  white-space: nowrap;
  flex-shrink: 0;
}

.alerts-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 16px;
  color: var(--text-2);
}

.alerts-empty[hidden] {
  display: none;
}

.alerts-empty svg {
  width: 40px;
  height: 40px;
  color: #CBD5E1;
  margin-bottom: 10px;
}

.alerts-empty p {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
}

.alerts-empty span {
  font-size: 12px;
  margin-top: 4px;
}

/* ===== Footer ===== */
.dashboard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-2);
}

/* ===== Responsive ===== */
@media (max-width: 1400px) {
  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1200px) {
  .panel-grid-3 {
    grid-template-columns: 1fr 1fr;
  }

  .panel-grid-3 .panel:last-child {
    grid-column: 1 / -1;
  }

  .approvals-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .alerts-panel {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-grid-3,
  .panel-grid-2 {
    grid-template-columns: 1fr;
  }

  .panel-grid-2.dash-stock-finance-row {
    grid-template-columns: 1fr;
  }

  .dash-stock-finance-row .dash-panel-material,
  .dash-stock-finance-row .dash-panel-finance {
    grid-column: 1;
  }

  .approvals-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-actions-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-collapsed);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    width: 250px;
  }

  .sidebar.mobile-open.collapsed {
    width: 250px;
  }

  .app-wrapper {
    margin-left: 0;
  }

  .app-wrapper.sidebar-collapsed {
    margin-left: 0;
  }

  .navbar-date,
  .user-info,
  .user-chevron {
    display: none;
  }

  .search-box {
    max-width: 180px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .approvals-grid {
    grid-template-columns: 1fr 1fr;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-header {
    flex-direction: column;
  }
}
