/**
 * PIXEL DISTRIBUTION SUITE — ENTERPRISE LIGHT DESIGN SYSTEM
 * Developer: Pixel by Maliya
 * Product: Pixel Distribution Suite
 * Tagline: Smarter Distribution. Complete Business Control.
 */

:root {
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-dark: #94a3b8;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* Primary Brand - Deep Enterprise Sapphire */
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;

  /* Accent - High-Trust Emerald */
  --emerald: #059669;
  --emerald-hover: #047857;
  --emerald-light: #ecfdf5;
  --emerald-border: #a7f3d0;

  /* Functional Accents */
  --amber: #d97706;
  --amber-light: #fffbeb;
  --amber-border: #fde68a;

  --rose: #e11d48;
  --rose-light: #fff1f2;
  --rose-border: #fecdd3;

  --indigo: #4f46e5;
  --indigo-light: #eef2ff;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* App Layout Grid */
.dms-app-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* ==========================================================================
   SIDEBAR NAVIGATION
   ========================================================================== */
.dms-sidebar {
  width: 270px;
  min-width: 270px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  transition: transform 0.25s ease;
}

.dms-brand-header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-light);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon-box {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.28);
  border: 1px solid rgba(16, 185, 129, 0.35);
  padding: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-icon-box .brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-by {
  font-size: 11px;
  font-weight: 600;
  color: var(--emerald);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hub-status-pill {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  background-color: var(--emerald-light);
  border: 1px solid var(--emerald-border);
  color: var(--emerald);
  font-size: 11px;
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

/* Sidebar Mobile Close Button & Backdrop */
.sidebar-close-btn {
  display: none;
}

.dms-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.dms-sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* Responsive Sidebar for Mobile & Tablets */
@media (max-width: 1024px) {
  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .sidebar-close-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
  }
  .dms-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    transform: translateX(-100%);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
    z-index: 60;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .dms-sidebar.open {
    transform: translateX(0) !important;
  }
  .mobile-menu-btn {
    display: inline-flex !important;
  }
  .topbar-search-wrap {
    width: 200px;
  }
  .topbar-pill-info {
    display: none;
  }
}

@media (max-width: 640px) {
  .dms-topbar {
    padding: 0 12px;
  }
  .topbar-search-wrap {
    display: none;
  }
  .dms-content-area {
    padding: 14px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .page-action-group {
    width: 100%;
    justify-content: flex-start;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 24px;
}

.dms-nav-container::-webkit-scrollbar {
  width: 5px;
}
.dms-nav-container::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.8px;
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-color: var(--primary-border);
}

.nav-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.nav-item:hover svg {
  color: var(--text-primary);
}

.nav-item.active svg {
  color: var(--primary);
}

.nav-badge-count {
  margin-left: auto;
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 9999px;
}

.nav-badge-count.warn {
  background-color: var(--amber-light);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.nav-badge-count.danger {
  background-color: var(--rose-light);
  color: var(--rose);
  border: 1px solid var(--rose-border);
}

/* Sidebar Footer */
.dms-sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-light);
  background-color: #fbfcfe;
}

.sidebar-user-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: #0284c7;
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   TOPBAR HEADER
   ========================================================================== */
.dms-main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dms-topbar {
  height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text-secondary);
}

.topbar-search-wrap {
  position: relative;
  width: 320px;
}

.topbar-search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.topbar-search-input {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background-color: var(--bg-subtle);
  padding: 0 12px 0 36px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.15s ease;
}

.topbar-search-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-pill-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  text-decoration: none;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 2px rgba(30, 64, 175, 0.2);
}

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

.btn-emerald {
  background-color: var(--emerald);
  color: #ffffff;
  border-color: var(--emerald);
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}

.btn-emerald:hover {
  background-color: var(--emerald-hover);
  border-color: var(--emerald-hover);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border-color: var(--border-light);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-danger {
  background-color: var(--rose-light);
  color: var(--rose);
  border-color: var(--rose-border);
}

.btn-danger:hover {
  background-color: var(--rose);
  color: #fff;
}

/* ==========================================================================
   MAIN CONTENT & MODULE VIEWS
   ========================================================================== */
.dms-content-area {
  flex: 1;
  padding: 24px;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
}

.module-view {
  display: none;
  animation: fadeIn 0.2s ease;
}

.module-view.active {
  display: block;
}

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

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

.page-title-group h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.page-title-group p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.page-action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ==========================================================================
   METRIC KPI CARDS
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon-wrap.primary { background-color: var(--primary-light); color: var(--primary); }
.kpi-icon-wrap.emerald { background-color: var(--emerald-light); color: var(--emerald); }
.kpi-icon-wrap.amber   { background-color: var(--amber-light); color: var(--amber); }
.kpi-icon-wrap.rose    { background-color: var(--rose-light); color: var(--rose); }

.kpi-value {
  font-size: 23px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.kpi-bottom {
  margin-top: 8px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.kpi-trend-positive {
  color: var(--emerald);
  font-weight: 600;
}

.kpi-trend-negative {
  color: var(--rose);
  font-weight: 600;
}

/* ==========================================================================
   CHARTS & GRIDS
   ========================================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

.card-body {
  padding: 20px;
}

.chart-canvas-container {
  position: relative;
  width: 100%;
  height: 260px;
}

.chart-canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Actionable Alerts Panel */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  border: 1px solid;
}

.alert-item.warning {
  background-color: var(--amber-light);
  border-color: var(--amber-border);
  color: #78350f;
}

.alert-item.danger {
  background-color: var(--rose-light);
  border-color: var(--rose-border);
  color: #881337;
}

.alert-item.info {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
  color: #1e3a8a;
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-content strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-content span {
  font-size: 12px;
  opacity: 0.9;
}

/* ==========================================================================
   DATA TABLES & FILTERS
   ========================================================================== */
.table-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 280px;
}

.table-search-input {
  max-width: 300px;
  width: 100%;
  height: 36px;
  padding: 0 12px;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  outline: none;
}

.table-search-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--primary);
}

.table-select {
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  outline: none;
}

.table-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.dms-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.dms-table th {
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.dms-table th.num, .dms-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dms-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  white-space: nowrap;
}

.dms-table tbody tr {
  transition: background-color 0.1s ease;
}

.dms-table tbody tr:hover {
  background-color: #f8fafc;
}

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

.cell-bold {
  font-weight: 600;
  color: var(--text-primary);
}

.cell-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 9999px;
  text-transform: capitalize;
  line-height: 1.2;
}

.badge-paid, .badge-active, .badge-cleared, .badge-success {
  background-color: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.badge-partial, .badge-inhand, .badge-warning {
  background-color: var(--amber-light);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.badge-overdue, .badge-hold, .badge-returned, .badge-danger {
  background-color: var(--rose-light);
  color: var(--rose);
  border: 1px solid var(--rose-border);
}

.badge-unpaid, .badge-deposited, .badge-info {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-neutral {
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* Utilization Progress Bar */
.util-bar-wrap {
  width: 120px;
  height: 6px;
  background-color: var(--bg-subtle);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 4px;
}

.util-bar-fill {
  height: 100%;
  border-radius: 9999px;
}

.util-safe { background-color: var(--emerald); }
.util-warning { background-color: var(--amber); }
.util-danger { background-color: var(--rose); }

/* Table Actions Button */
.action-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

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

/* ==========================================================================
   MODAL WINDOWS & DIALOGS
   ========================================================================== */
.dms-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dms-modal-backdrop.open {
  display: flex;
}

.dms-modal-box {
  background-color: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-light);
  animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.dms-modal-box.modal-lg {
  max-width: 860px;
}

.dms-modal-box.modal-xl {
  max-width: 1050px;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close-btn {
  background: none;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text-primary);
}

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: #fafbfc;
}

/* Form Layout Styles */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  font-size: 13px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-textarea {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-helper {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

/* Invoice Line Items Table inside Modal */
.items-builder-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 12px;
}

.items-builder-table th {
  background-color: var(--bg-subtle);
  padding: 8px 10px;
  font-weight: 600;
  text-align: left;
  border: 1px solid var(--border-light);
}

.items-builder-table td {
  padding: 8px 10px;
  border: 1px solid var(--border-light);
}

.items-builder-table input, .items-builder-table select {
  width: 100%;
  height: 32px;
  padding: 0 6px;
  font-size: 12px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
}

.invoice-summary-box {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}

.summary-row.total {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  border-top: 1px solid var(--border-medium);
  padding-top: 8px;
  margin-top: 8px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.dms-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dms-toast {
  background-color: #0f172a;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideToast 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 280px;
}

.dms-toast.success { border-left: 4px solid var(--emerald); }
.dms-toast.warning { border-left: 4px solid var(--amber); }
.dms-toast.error   { border-left: 4px solid var(--rose); }

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

/* ==========================================================================
   PRINT INVOICE TEMPLATE
   ========================================================================== */
@media print {
  body * {
    visibility: hidden;
  }
  .printable-area, .printable-area * {
    visibility: visible;
  }
  .printable-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 20px;
  }
  .no-print {
    display: none !important;
  }
}
