:root {
  --primary-blue: #004c8f;
  --primary-dark: #002d5a;
  --accent-red: #ed1c24;
  --accent-red-hover: #c8102e;
  --accent-gold: #f59e0b;
  --accent-green: #10b981;
  --accent-purple: #8b5cf6;
  --bg-main: #f4f7fb;
  --bg-card: #ffffff;
  --bg-sidebar: #0a192f;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.55;
  overflow-x: hidden;
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #091e3a 0%, #001224 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 4px 0 12px rgba(0,0,0,0.15);
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  background: var(--accent-red);
  color: white;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(237, 28, 36, 0.4);
}

.logo-title h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #ffffff;
}

.logo-title p {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-menu {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.menu-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 1px;
  padding: 12px 14px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition);
  margin-bottom: 3px;
  cursor: pointer;
}

.nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: #94a3b8;
  transition: var(--transition);
}

.nav-link:hover {
  background-color: rgba(255,255,255,0.08);
  color: #ffffff;
}

.nav-link:hover i {
  color: #ffffff;
}

.nav-link.active {
  background: linear-gradient(90deg, var(--accent-red) 0%, #c8102e 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(237, 28, 36, 0.35);
}

.nav-link.active i {
  color: #ffffff;
}

.nav-badge {
  margin-left: auto;
  font-size: 10px;
  background: rgba(255,255,255,0.2);
  padding: 2px 7px;
  border-radius: 10px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.2);
  font-size: 11.5px;
  color: #94a3b8;
}

.sidebar-footer .status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  color: #e2e8f0;
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

/* Main Content Area */
.main-wrapper {
  margin-left: 280px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Navbar */
.top-nav {
  height: 70px;
  background-color: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.search-box-wrapper {
  position: relative;
  width: 420px;
}

.search-box-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-main);
  font-size: 13.5px;
  color: var(--text-main);
  transition: var(--transition);
  outline: none;
}

.search-input:focus {
  background-color: #ffffff;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0,76,143,0.15);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--text-main);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}

.quick-pill:hover {
  background: #e2e8f0;
}

.quick-pill.accent {
  background: #eff6ff;
  color: var(--primary-blue);
  border: 1px solid #bfdbfe;
}

.agent-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  border-left: 1px solid var(--border-color);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-blue), #1e3a8a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.agent-info {
  line-height: 1.2;
}

.agent-info .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

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

/* Page Content */
.content-body {
  padding: 30px 36px;
  flex: 1;
}

.section-panel {
  display: none;
  animation: fadeIn 0.3s ease-in-out forwards;
}

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

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

/* Hero Header Banner */
.portal-hero {
  background: linear-gradient(120deg, #002d5a 0%, #004c8f 70%, #0066b2 100%);
  color: white;
  padding: 30px 32px;
  border-radius: var(--radius-lg);
  margin-bottom: 30px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.portal-hero::after {
  content: '';
  position: absolute;
  top: -60px;
  right: -40px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(237,28,36,0.3) 0%, rgba(237,28,36,0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.portal-hero h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}

.portal-hero p {
  color: #e2e8f0;
  font-size: 14.5px;
  max-width: 750px;
  line-height: 1.6;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.hero-stat-card {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.15);
}

.hero-stat-card .stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
}

.hero-stat-card .stat-label {
  font-size: 12px;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Section Header */
.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Cards & Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

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

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

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

.card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-body {
  padding: 20px 22px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
}

.badge-red {
  background-color: #fee2e2;
  color: #dc2626;
}

.badge-blue {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.badge-green {
  background-color: #dcfce7;
  color: #15803d;
}

.badge-amber {
  background-color: #fef3c7;
  color: #b45309;
}

.badge-purple {
  background-color: #f3e8ff;
  color: #7e22ce;
}

/* Product Cards Grid */
.product-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #93c5fd;
}

.product-card-top {
  padding: 22px 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #eff6ff 100%);
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.product-tag {
  position: absolute;
  top: 18px;
  right: 20px;
}

.product-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

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

.product-features-list {
  padding: 20px 24px;
  flex: 1;
}

.product-feat-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #334155;
}

.product-feat-item i {
  color: var(--primary-blue);
  margin-top: 3px;
  font-size: 13px;
}

.product-feat-item strong {
  color: var(--primary-dark);
}

.product-card-footer {
  padding: 14px 24px;
  background-color: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}

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

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

.btn-danger {
  background: var(--accent-red);
  color: white;
}

.btn-danger:hover {
  background: var(--accent-red-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

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

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

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

.data-table th {
  background-color: #f8fafc;
  color: var(--primary-dark);
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: #334155;
}

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

.data-table tr.highlight-row {
  background-color: #eff6ff;
  font-weight: 600;
}

/* Call Flow Visual Diagram */
.call-flow-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  padding: 20px 0;
}

.flow-step {
  display: flex;
  align-items: stretch;
  gap: 20px;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  position: relative;
  transition: var(--transition);
}

.flow-step:hover {
  border-color: var(--primary-blue);
  box-shadow: var(--shadow-md);
}

.step-number-box {
  min-width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-blue), #1e3a8a);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 4px 8px rgba(0,76,143,0.3);
}

.step-details {
  flex: 1;
}

.step-details h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.step-details p {
  font-size: 13.5px;
  color: #475569;
  line-height: 1.5;
}

.step-badges {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.flow-connector {
  width: 3px;
  height: 24px;
  background: #cbd5e1;
  margin-left: 42px;
  margin-top: -10px;
  margin-bottom: -10px;
}

/* Dual Script Box */
.script-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.script-tab-btns {
  display: flex;
  gap: 6px;
}

.script-tab-btn {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.script-tab-btn.active {
  background: white;
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}

.script-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-blue);
  padding: 18px 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 14px;
  color: #1e293b;
  position: relative;
  line-height: 1.65;
}

.script-box.hinglish {
  border-left-color: var(--accent-red);
}

.script-box .copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.script-box .copy-btn:hover {
  background: #f1f5f9;
  color: var(--primary-dark);
}

.script-highlight {
  background-color: #fef08a;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}

/* Audit Parameter & Scorecard */
.audit-category-header {
  background: #f8fafc;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.audit-category-header h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
}

.audit-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
  transition: var(--transition);
}

.audit-item-row:hover {
  background-color: #fafbfc;
}

.audit-item-info {
  flex: 1;
}

.audit-item-id {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: 2px;
}

.audit-item-title {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.5;
}

.audit-item-weight {
  min-width: 90px;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.fatal-badge {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #f87171;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  animation: pulseFatal 2s infinite;
}

@keyframes pulseFatal {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Calculator Form Elements */
.calc-field-group {
  margin-bottom: 18px;
}

.calc-field-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.calc-select, .calc-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 13.5px;
  color: var(--text-main);
  background-color: white;
  outline: none;
  transition: var(--transition);
}

.calc-select:focus, .calc-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0,76,143,0.12);
}

.calc-result-box {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  margin-top: 20px;
  text-align: center;
}

.calc-result-box .result-amount {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary-dark);
  margin: 6px 0;
}

.calc-result-box .result-sub {
  font-size: 13px;
  color: #1e40af;
}

/* Moratorium Box Special */
.moratorium-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-left: 6px solid #f59e0b;
  padding: 24px;
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}

.moratorium-card h3 {
  color: #92400e;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Modal View */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 850px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

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

.close-modal {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

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

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  display: none;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease;
}

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

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .content-body {
    padding: 20px 16px;
  }
  .search-box-wrapper {
    width: 220px;
  }
}
