/* 7S IQ PRIVATE LIMITED - Billing & Invoicing Desktop System Styling */

:root {
  --primary: #0B6E4F;
  --primary-hover: #08533C;
  --primary-light: #E8F5E9;
  --primary-border: #A7F3D0;
  
  --dark: #0F172A;
  --dark-surface: #1E293B;
  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  --bg-app: #F8FAFC;
  --bg-card: #FFFFFF;
  --border: #E2E8F0;
  --border-subtle: #F1F5F9;

  --success: #10B981;
  --success-bg: #ECFDF5;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --info: #3B82F6;
  --info-bg: #EFF6FF;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "Arial Unicode MS", Arial, Helvetica, sans-serif;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* App Layout */
.app-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--dark-surface);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid #334155;
  user-select: none;
}

.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #334155;
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  background: #FFFFFF;
  border-radius: 8px;
  padding: 2px;
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #FFFFFF;
  line-height: 1.2;
}

.brand-text p {
  font-size: 11px;
  color: #94A3B8;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #CBD5E1;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-item:hover {
  background-color: #334155;
  color: #FFFFFF;
}

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

.nav-icon {
  font-size: 17px;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid #334155;
  font-size: 11px;
  color: #94A3B8;
}

.sidebar-footer .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #34D399;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #34D399;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-app);
}

/* Top App Header */
.top-header {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  flex-shrink: 0;
}

.top-header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
}

.top-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.company-badge-header {
  font-size: 12px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid var(--primary-border);
}

/* Content Views */
.content-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

.view-panel {
  display: none;
}

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

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

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.kpi-card.warning::before { background: var(--warning); }
.kpi-card.danger::before { background: var(--danger); }
.kpi-card.info::before { background: var(--info); }

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

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
}

.kpi-subtext {
  font-size: 11.5px;
  color: var(--text-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background-color: var(--primary);
  color: #FFFFFF;
}

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

.btn-secondary {
  background-color: #FFFFFF;
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover {
  background-color: #F8FAFC;
  border-color: #CBD5E1;
}

.btn-success {
  background-color: var(--success);
  color: #FFFFFF;
}

.btn-danger {
  background-color: var(--danger);
  color: #FFFFFF;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Card Containers */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

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

.card-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
}

.card-body {
  padding: 20px;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  width: 100%;
}

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

.data-table th {
  background-color: #F8FAFC;
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: #F8FAFC;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* Status Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-paid { background: var(--success-bg); color: var(--success); border: 1px solid #A7F3D0; }
.badge-issued { background: var(--info-bg); color: var(--info); border: 1px solid #BFDBFE; }
.badge-pending { background: var(--warning-bg); color: var(--warning); border: 1px solid #FDE68A; }
.badge-overdue { background: var(--danger-bg); color: var(--danger); border: 1px solid #FECACA; }
.badge-draft { background: #F1F5F9; color: #64748B; border: 1px solid #CBD5E1; }

/* Forms & Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s ease;
  background: #FFFFFF;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(11, 110, 79, 0.15);
}

textarea.form-control {
  resize: vertical;
  min-height: 70px;
}

/* Line Items Table in Invoice Form */
.items-entry-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  margin-bottom: 16px;
}

.items-entry-table th {
  background: #F1F5F9;
  padding: 10px 10px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.items-entry-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.items-entry-table input,
.items-entry-table select {
  width: 100%;
  padding: 7px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Invoice Calculations Box */
.invoice-summary-box {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  width: 380px;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.summary-row.bold {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

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

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: #F8FAFC;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Printable A4 Preview Container */
.a4-preview-sheet {
  position: relative;
  overflow: hidden;
  background: #FFFFFF;
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 14mm 16mm;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  font-size: 12px;
  color: #1E293B;
  box-sizing: border-box;
}

.a4-preview-sheet > *:not(.a4-logo-watermark):not(.a4-festival-bg) {
  position: relative;
  z-index: 2;
}

.a4-logo-watermark {
  position: absolute;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  width: 270px;
  height: auto;
  opacity: 0.065;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

.a4-festival-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.14;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}

.a4-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.a4-logo-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.a4-logo-img {
  width: 70px;
  height: 70px;
  object-fit: contain;
}

.a4-meta-title h2 {
  font-size: 20px;
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 4px;
}

.a4-badge {
  text-align: right;
}

.a4-badge h1 {
  font-size: 18px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.a4-two-col {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.a4-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
}

.a4-box-title {
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  font-size: 11px;
  margin-bottom: 6px;
  border-bottom: 1px solid #CBD5E1;
  padding-bottom: 3px;
}

.a4-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 14px;
}

.a4-table th {
  background-color: var(--primary);
  color: #FFFFFF;
  padding: 7px 6px;
  text-align: center;
  font-weight: 700;
  border: 1px solid var(--primary);
}

.a4-table td {
  padding: 6px 6px;
  border: 1px solid #CBD5E1;
}

.a4-bank-and-totals {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.a4-footer {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid #E2E8F0;
}

.signatory-box {
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 85px;
}

/* Domain & Payment Badges */
.badge-domain-it {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.badge-domain-dm {
  background: #FFF7ED;
  color: #C2410C;
  border: 1px solid #FFEDD5;
}

.badge-advance {
  background: #FAF5FF;
  color: #7E22CE;
  border: 1px solid #E9D5FF;
}

/* Payment Progress Bar */
.pay-progress-wrap {
  width: 100%;
  background: #E2E8F0;
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-top: 4px;
}

.pay-progress-bar {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.pay-progress-bar.partial {
  background: var(--warning);
}

/* Advance / Milestone Payment Box */
.advance-config-box {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 10px;
}

.quick-pct-btn {
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #FFFFFF;
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* Print Specific */
@media print {
  @page {
    size: A4;
    margin: 8mm;
  }
  body * { visibility: hidden; }

  #printModal {
    display: block !important;
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
  }

  #printModal .modal-box,
  #printModal .modal-body {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  #a4PreviewContainer,
  #a4PreviewContainer * {
    visibility: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #a4PreviewContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    box-shadow: none;
    border-left: none;
    border-right: none;
    margin: 0;
    padding: 6mm 8mm;
    font-size: 11px;
  }

  .modal-header,
  .modal-footer,
  .sidebar,
  .top-header,
  .toast-container {
    display: none !important;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: var(--dark-surface);
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  border-left: 4px solid var(--primary);
  animation: slideIn 0.3s ease;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Project Management & Payment Tracking Styles ───────────────────────── */
.filter-tabs {
  display: flex;
  background: var(--bg-app);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  gap: 4px;
}

.filter-tab {
  background: transparent;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-tab:hover {
  color: var(--dark);
}

.filter-tab.active {
  background: #FFFFFF;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Progress Bars */
.prj-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prj-progress-bar {
  width: 100%;
  height: 7px;
  background: #E2E8F0;
  border-radius: 10px;
  overflow: hidden;
}

.prj-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10B981, #059669);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.prj-progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Project Status Badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-status-progress {
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}

.badge-status-completed {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.badge-status-pending {
  background: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.badge-status-hold {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.badge-domain {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  background: #F1F5F9;
  color: #475569;
}

/* Project Details Modal Navigation Tabs */
.detail-tabs-header {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 4px;
  margin-bottom: 18px;
  background: #FFFFFF;
}

.detail-tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-tab-btn:hover {
  color: var(--primary);
}

.detail-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--primary-light);
  border-radius: 4px 4px 0 0;
}

.detail-tab-pane {
  display: none;
}

.detail-tab-pane.active {
  display: block;
}

/* Metrics Summary Strip */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  background: #F8FAFC;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-item-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.metric-item-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
}

/* Milestone Schedule Builder Table */
.milestone-builder-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.milestone-builder-table th {
  background: #F1F5F9;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  text-align: left;
  border: 1px solid var(--border);
}

.milestone-builder-table td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: #FFFFFF;
}

.preset-chip {
  background: #F1F5F9;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* ITCMS Sub-navigation Section Headers */
.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #64748B;
  padding: 12px 14px 4px 14px;
  text-transform: uppercase;
}

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

.sidebar-nav::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

/* Dynamic ITCMS Badges */
.badge-stage-new { background: #DBEAFE; color: #1E40AF; }
.badge-stage-contacted { background: #E0E7FF; color: #3730A3; }
.badge-stage-qualified { background: #FEF3C7; color: #92400E; }
.badge-stage-proposal { background: #F3E8FF; color: #6B21A8; }
.badge-stage-won { background: #DEF7EC; color: #03543F; font-weight: 700; }
.badge-stage-lost { background: #FDE8E8; color: #9B1C1C; }

.badge-priority-low { background: #F3F4F6; color: #4B5563; }
.badge-priority-medium { background: #DBEAFE; color: #1E40AF; }
.badge-priority-high { background: #FEF3C7; color: #92400E; font-weight: 700; }
.badge-priority-urgent { background: #FDE8E8; color: #9B1C1C; font-weight: 800; }

.badge-asset-ok { background: #DEF7EC; color: #03543F; }
.badge-asset-duesoon { background: #FEF3C7; color: #B45309; font-weight: 700; }
.badge-asset-expired { background: #FDE8E8; color: #9B1C1C; font-weight: 800; }

.badge-channel-seo { background: #E0F2FE; color: #0369A1; }
.badge-channel-ads { background: #FEF08A; color: #854D0E; }
.badge-channel-social { background: #FCE7F3; color: #9D174D; }
.badge-channel-content { background: #DCFCE7; color: #166534; }

.badge-ticket-new { background: #DBEAFE; color: #1E40AF; }
.badge-ticket-progress { background: #FEF3C7; color: #92400E; }
.badge-ticket-waiting { background: #F3E8FF; color: #6B21A8; }
.badge-ticket-resolved { background: #DEF7EC; color: #03543F; }
.badge-ticket-closed { background: #F3F4F6; color: #6B7280; }

/* Dynamic Task Cards */
.task-item-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  transition: all 0.15s ease;
}

.task-item-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-sm);
}

/* Monthly Financials & Net Profit Section */
.profit-hero-container {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.profit-hero-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}
.profit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) {
  .profit-grid {
    grid-template-columns: 1fr;
  }
}
.profit-card {
  padding: 18px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.profit-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.profit-card.income-card {
  background: #F0FDF4;
  border-color: #BBF7D0;
}
.profit-card.expense-card {
  background: #FEF2F2;
  border-color: #FECACA;
}
.profit-card.net-profit-card.profit-positive {
  background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
  border-color: #6EE7B7;
  border-width: 1.5px;
}
.profit-card.net-profit-card.profit-negative {
  background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
  border-color: #FCA5A5;
  border-width: 1.5px;
}
.profit-card.net-profit-card.profit-zero {
  background: #F1F5F9;
  border-color: #CBD5E1;
}
.profit-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.profit-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.profit-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.profit-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
}
.profit-bar-container {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profit-bar-track {
  height: 8px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}
.profit-bar-fill-income {
  background: #10B981;
  height: 100%;
}
.profit-bar-fill-expense {
  background: #EF4444;
  height: 100%;
}
.profit-chips-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}
.profit-chip-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.profit-chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}



/* ================= ERP ROLE-BASED LOGIN OVERLAY ================= */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #064E3B 0%, #0B6E4F 50%, #1E293B 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  height: 54px;
  width: auto;
  margin-bottom: 10px;
  object-fit: contain;
}

.login-brand h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 4px;
}

.login-brand p {
  font-size: 12px;
  color: #64748B;
  margin: 0;
}

.login-error {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
  text-align: center;
}

.login-footer-hint {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #E2E8F0;
  text-align: center;
  font-size: 11.5px;
  color: #64748B;
}

.login-footer-hint code {
  background: #F1F5F9;
  padding: 2px 6px;
  border-radius: 4px;
  color: #0F172A;
  font-weight: 600;
}

.header-user-pill {
  display: inline-flex;
  align-items: center;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  padding: 3px 6px 3px 12px;
  font-size: 12px;
  color: #1E293B;
}

/* ================= INVOICE-ONLY TAMIL NADU & INDIAN FESTIVAL THEMES ================= */
.theme-select {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.invoice-festival-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px dashed var(--primary);
}

#a4PreviewContainer[data-invoice-theme] .a4-table thead th {
  background-color: var(--primary);
  color: #FFFFFF;
}

#a4PreviewContainer[data-invoice-theme] .a4-box {
  background: var(--inv-box-bg, #F8FAFC);
  border-color: var(--inv-box-border, #E2E8F0);
}

/* 1. Thai Pongal (பொங்கல்) — Harvest Gold, Sugarcane Green & Terracotta + Sunburst Kolam BG */
#a4PreviewContainer[data-invoice-theme="pongal"] {
  --primary: #B45309;
  --primary-light: #FEF3C7;
  --inv-box-bg: rgba(255, 251, 235, 0.92);
  --inv-box-border: #FCD34D;
  border-top: 6px solid #15803D;
  border-bottom: 6px solid #D97706;
}
#a4PreviewContainer[data-invoice-theme="pongal"] .a4-festival-bg {
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 92% 8%, rgba(245, 158, 11, 0.38) 0%, rgba(254, 243, 199, 0.15) 28%, transparent 55%),
    radial-gradient(circle at 8% 92%, rgba(21, 128, 61, 0.22) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='%23D97706' stroke-width='1.2' opacity='0.45'%3E%3Ccircle cx='110' cy='110' r='85' stroke-dasharray='6 6'/%3E%3Ccircle cx='110' cy='110' r='55'/%3E%3Cpath d='M110 15 L125 95 L205 110 L125 125 L110 205 L95 125 L15 110 L95 95 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, cover, 220px 220px;
  background-repeat: no-repeat, no-repeat, repeat;
}

/* 2. Tamil Puthandu (தமிழ் புத்தாண்டு) — Mango Gold, Neem Green & Vermilion + Kolam Mandala BG */
#a4PreviewContainer[data-invoice-theme="puthandu"] {
  --primary: #C2410C;
  --primary-light: #FFEDD5;
  --inv-box-bg: rgba(254, 252, 232, 0.92);
  --inv-box-border: #FDBA74;
  border-top: 6px solid #166534;
  border-bottom: 6px solid #CA8A04;
}
#a4PreviewContainer[data-invoice-theme="puthandu"] .a4-festival-bg {
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 10% 10%, rgba(22, 101, 52, 0.22) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, rgba(202, 138, 4, 0.28) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'%3E%3Cg fill='none' stroke='%23CA8A04' stroke-width='1.2' opacity='0.45'%3E%3Ccircle cx='100' cy='100' r='70'/%3E%3Ccircle cx='100' cy='100' r='40' stroke-dasharray='4 4'/%3E%3Crect x='50' y='50' width='100' height='100' transform='rotate(45 100 100)'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, cover, 200px 200px;
  background-repeat: no-repeat, no-repeat, repeat;
}

/* 3. Deepavali / Diwali (தீபாவளி) — Royal Purple, Diya Gold & Crimson + Sparkle Diya BG */
#a4PreviewContainer[data-invoice-theme="deepavali"] {
  --primary: #6D28D9;
  --primary-light: #F3E8FF;
  --inv-box-bg: rgba(250, 245, 255, 0.92);
  --inv-box-border: #D8B4FE;
  border-top: 6px solid #F59E0B;
  border-bottom: 6px solid #BE123C;
}
#a4PreviewContainer[data-invoice-theme="deepavali"] .a4-festival-bg {
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 88% 12%, rgba(245, 158, 11, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 12% 88%, rgba(109, 40, 217, 0.25) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%239333EA' stroke-width='1.1' opacity='0.4'%3E%3Ccircle cx='90' cy='90' r='60' stroke-dasharray='5 5'/%3E%3Cpath d='M90 25 Q110 65 90 90 Q70 65 90 25 Z'/%3E%3Cpath d='M90 155 Q110 115 90 90 Q70 115 90 155 Z'/%3E%3Cpath d='M25 90 Q65 110 90 90 Q65 70 25 90 Z'/%3E%3Cpath d='M155 90 Q115 110 90 90 Q115 70 155 90 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, cover, 180px 180px;
  background-repeat: no-repeat, no-repeat, repeat;
}

/* 4. Vinayagar Chaturthi (விநாயகர் சதுர்த்தி) — Saffron & Temple Maroon + Lotus Temple BG */
#a4PreviewContainer[data-invoice-theme="vinayagar"] {
  --primary: #EA580C;
  --primary-light: #FFEDD5;
  --inv-box-bg: rgba(255, 247, 237, 0.92);
  --inv-box-border: #FED7AA;
  border-top: 6px solid #881337;
  border-bottom: 6px solid #EA580C;
}
#a4PreviewContainer[data-invoice-theme="vinayagar"] .a4-festival-bg {
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 50% 0%, rgba(234, 88, 12, 0.22) 0%, transparent 50%),
    radial-gradient(circle at 50% 100%, rgba(136, 19, 55, 0.18) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'%3E%3Cg fill='none' stroke='%23EA580C' stroke-width='1.1' opacity='0.4'%3E%3Ccircle cx='100' cy='100' r='75'/%3E%3Cpath d='M100 35 C120 65 120 85 100 100 C80 85 80 65 100 35 Z'/%3E%3Cpath d='M100 165 C120 135 120 115 100 100 C80 115 80 135 100 165 Z'/%3E%3Cpath d='M35 100 C65 80 85 80 100 100 C85 120 65 120 35 100 Z'/%3E%3Cpath d='M165 100 C135 80 115 80 100 100 C115 120 135 120 165 100 Z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, cover, 200px 200px;
  background-repeat: no-repeat, no-repeat, repeat;
}

/* 5. Navaratri / Ayudha Pooja (நவராத்திரி / ஆயுத பூஜை) — Magenta, Kumkum & Marigold + Floral Rangoli BG */
#a4PreviewContainer[data-invoice-theme="navaratri"] {
  --primary: #A21CAF;
  --primary-light: #FAE8FF;
  --inv-box-bg: rgba(253, 244, 255, 0.92);
  --inv-box-border: #F0ABFC;
  border-top: 6px solid #E11D48;
  border-bottom: 6px solid #F59E0B;
}
#a4PreviewContainer[data-invoice-theme="navaratri"] .a4-festival-bg {
  opacity: 0.22;
  background-image:
    radial-gradient(circle at 90% 10%, rgba(225, 29, 72, 0.22) 0%, transparent 45%),
    radial-gradient(circle at 10% 90%, rgba(245, 158, 11, 0.25) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23A21CAF' stroke-width='1.1' opacity='0.4'%3E%3Cpolygon points='90,20 155,90 90,160 25,90'/%3E%3Ccircle cx='90' cy='90' r='45' stroke-dasharray='4 4'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, cover, 180px 180px;
  background-repeat: no-repeat, no-repeat, repeat;
}

/* 6. Karthigai Deepam (கார்த்திகை தீபம்) — Temple Bronze, Flame Amber & Gold + Deepam Halo BG */
#a4PreviewContainer[data-invoice-theme="karthigai"] {
  --primary: #B45309;
  --primary-light: #FEF3C7;
  --inv-box-bg: rgba(255, 251, 235, 0.92);
  --inv-box-border: #FCD34D;
  border-top: 6px solid #7C2D12;
  border-bottom: 6px solid #F97316;
}
#a4PreviewContainer[data-invoice-theme="karthigai"] .a4-festival-bg {
  opacity: 0.24;
  background-image:
    radial-gradient(circle at 85% 15%, rgba(249, 115, 22, 0.35) 0%, rgba(254, 243, 199, 0.12) 30%, transparent 55%),
    radial-gradient(circle at 15% 85%, rgba(124, 45, 18, 0.22) 0%, transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='190' height='190' viewBox='0 0 190 190'%3E%3Cg fill='none' stroke='%23D97706' stroke-width='1.2' opacity='0.45'%3E%3Ccircle cx='95' cy='95' r='70' stroke-dasharray='6 5'/%3E%3Cpath d='M95 45 C115 75 115 100 95 115 C75 100 75 75 95 45 Z'/%3E%3Cpath d='M65 115 Q95 135 125 115'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, cover, 190px 190px;
  background-repeat: no-repeat, no-repeat, repeat;
}

/* 7. National Tricolour (Republic Day / Independence Day) */
#a4PreviewContainer[data-invoice-theme="republic"] {
  --primary: #138808;
  --primary-light: #DCFCE7;
  --inv-box-bg: rgba(248, 250, 252, 0.92);
  --inv-box-border: #86EFAC;
  border-top: 6px solid #FF9933;
  border-bottom: 6px solid #138808;
}
#a4PreviewContainer[data-invoice-theme="republic"] .a4-festival-bg {
  opacity: 0.2;
  background-image:
    linear-gradient(135deg, rgba(255, 153, 51, 0.22) 0%, transparent 35%, rgba(19, 136, 8, 0.2) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'%3E%3Cg fill='none' stroke='%23000080' stroke-width='1.1' opacity='0.35'%3E%3Ccircle cx='100' cy='100' r='60'/%3E%3Ccircle cx='100' cy='100' r='12'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover, 200px 200px;
  background-repeat: no-repeat, repeat;
}
