/**
 * Utility Seva — EMI Calculator Styles
 * File: css/emi-calculator.css
 */

/* ==========================================================================
   1. BREADCRUMBS & PAGE WRAPPER
   ========================================================================== */
.breadcrumb-nav-compact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary, #64748b);
  margin-top: 0.75rem;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.breadcrumb-nav-compact a {
  color: var(--text-secondary, #64748b);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
  display: inline-flex;
  align-items: center;
}

.breadcrumb-nav-compact a:hover {
  color: var(--primary-color, #2563eb);
}

.breadcrumb-nav-compact .breadcrumb-sep {
  color: var(--text-tertiary, #94a3b8);
  font-size: 0.8rem;
  user-select: none;
  opacity: 0.7;
}

.breadcrumb-nav-compact .breadcrumb-current {
  color: var(--text-primary, #0f172a);
  font-weight: 600;
}

[data-theme="dark"] .breadcrumb-nav-compact .breadcrumb-current {
  color: #f8fafc;
}

.emi-page-wrapper {
  padding: 1rem 0 3.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.emi-header-section {
  text-align: center;
  margin-bottom: 1.75rem;
}

.emi-page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

[data-theme="dark"] .emi-page-title {
  color: #f8fafc;
}

.emi-page-subtitle {
  font-size: 0.98rem;
  color: var(--text-secondary, #64748b);
  max-width: 720px;
  margin: 0 auto;
  line-height: 1.5;
}

[data-theme="dark"] .emi-page-subtitle {
  color: #94a3b8;
}

/* ==========================================================================
   2. TWO-COLUMN STAGE CONTAINER
   ========================================================================== */
.emi-stage-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 2.5rem;
}

@media (max-width: 900px) {
  .emi-stage-container {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

.emi-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .emi-card {
  background: var(--bg-card, #1e293b);
  border-color: var(--border-color, #334155);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.25);
}

.emi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .emi-card-header {
  border-bottom-color: var(--border-color, #334155);
}

.emi-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

[data-theme="dark"] .emi-card-title {
  color: #f8fafc;
}

.emi-card-title svg {
  color: #10b981;
}

/* ==========================================================================
   3. FORM INPUTS & TENURE UNIT SWITCHER
   ========================================================================== */
.emi-form-group {
  margin-bottom: 1.15rem;
}

.emi-field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.4rem;
}

[data-theme="dark"] .emi-field-label {
  color: #e2e8f0;
}

.emi-field-label .optional-tag {
  font-weight: 400;
  color: var(--text-tertiary, #94a3b8);
  font-size: 0.78rem;
  margin-left: 0.25rem;
}

.emi-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.emi-input-prefix,
.emi-input-suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-tertiary, #94a3b8);
  pointer-events: none;
}

.emi-input-prefix {
  left: 0.85rem;
}

.emi-input-suffix {
  right: 0.85rem;
}

.emi-input {
  width: 100%;
  padding: 0.68rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary, #0f172a);
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #cbd5e1);
  border-radius: 0.5rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .emi-input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

.emi-input.has-prefix {
  padding-left: 2rem;
}

.emi-input.has-suffix {
  padding-right: 2rem;
}

.emi-input:focus {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.emi-input.is-invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.emi-field-note {
  font-size: 0.76rem;
  color: var(--text-secondary, #64748b);
  margin-top: 0.3rem;
  line-height: 1.35;
}

[data-theme="dark"] .emi-field-note {
  color: #94a3b8;
}

.emi-error-msg {
  display: block;
  font-size: 0.76rem;
  color: #ef4444;
  margin-top: 0.25rem;
  font-weight: 500;
  min-height: 1.1rem;
}

/* Tenure Unit Selector Pills */
.emi-tenure-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.emi-tenure-pills {
  display: inline-flex;
  background: var(--bg-secondary, #f1f5f9);
  padding: 0.25rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .emi-tenure-pills {
  background: #0f172a;
  border-color: #334155;
}

.unit-pill-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

[data-theme="dark"] .unit-pill-btn {
  color: #94a3b8;
}

.unit-pill-btn.active {
  background: #ffffff;
  color: #059669;
  border-color: #10b981;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .unit-pill-btn.active {
  background: #1e293b;
  color: #34d399;
  border-color: #059669;
}

/* Hidden radio inputs */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Form Action Buttons */
.emi-form-actions {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.65rem;
  margin-top: 1rem;
}

@media (max-width: 480px) {
  .emi-form-actions {
    grid-template-columns: 1fr;
  }
}

.emi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.emi-btn-primary {
  background: #10b981;
  color: #ffffff;
}

.emi-btn-primary:hover {
  background: #059669;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.emi-btn-secondary {
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-primary, #0f172a);
  border-color: var(--border-color, #cbd5e1);
}

[data-theme="dark"] .emi-btn-secondary {
  background: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

.emi-btn-secondary:hover {
  background: var(--border-color, #e2e8f0);
}

[data-theme="dark"] .emi-btn-secondary:hover {
  background: #334155;
}

/* ==========================================================================
   4. EXPECTED RESULT SECTION & DONUT CHART
   ========================================================================== */
.emi-result-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-tertiary, #94a3b8);
}

.emi-result-empty-icon {
  margin-bottom: 1rem;
  color: #cbd5e1;
}

[data-theme="dark"] .emi-result-empty-icon {
  color: #475569;
}

.emi-result-empty-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.4rem;
}

[data-theme="dark"] .emi-result-empty-title {
  color: #f8fafc;
}

.emi-result-empty-desc {
  font-size: 0.86rem;
  max-width: 320px;
  line-height: 1.45;
}

/* Active Result Content */
.emi-result-content {
  display: none;
}

/* Borrower Banner */
.emi-borrower-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #065f46;
  margin-bottom: 1rem;
}

[data-theme="dark"] .emi-borrower-banner {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.3);
  color: #6ee7b7;
}

/* Hero EMI Box */
.emi-hero-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.03));
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 0.75rem;
  padding: 1.15rem;
  text-align: center;
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .emi-hero-box {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(16, 185, 129, 0.05));
  border-color: rgba(16, 185, 129, 0.4);
}

.emi-hero-lbl {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #059669;
  display: block;
  margin-bottom: 0.35rem;
}

[data-theme="dark"] .emi-hero-lbl {
  color: #34d399;
}

.emi-hero-val {
  font-size: 2.2rem;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace, sans-serif;
  color: #047857;
  line-height: 1.2;
}

[data-theme="dark"] .emi-hero-val {
  color: #10b981;
}

/* Donut Chart Visual Section */
.emi-chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1.25rem;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

[data-theme="dark"] .emi-chart-wrapper {
  background: #0f172a;
  border-color: #334155;
}

.donut-svg-container {
  width: 130px;
  height: 130px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.donut-bg {
  fill: none;
  stroke: var(--border-color, #e2e8f0);
  stroke-width: 14;
}

[data-theme="dark"] .donut-bg {
  stroke: #1e293b;
}

.donut-segment-principal {
  fill: none;
  stroke: #10b981;
  stroke-width: 14;
  transition: stroke-dasharray 0.3s ease;
}

.donut-segment-interest {
  fill: none;
  stroke: #6366f1;
  stroke-width: 14;
  transition: stroke-dasharray 0.3s ease, stroke-dashoffset 0.3s ease;
}

.donut-center-text {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.donut-center-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-tertiary, #94a3b8);
}

.donut-center-val {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace, sans-serif;
  color: var(--text-primary, #0f172a);
}

[data-theme="dark"] .donut-center-val {
  color: #f8fafc;
}

/* Donut Legends */
.donut-legends {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1;
  min-width: 180px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.legend-info {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

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

.legend-color-dot.dot-principal {
  background: #10b981;
}

.legend-color-dot.dot-interest {
  background: #6366f1;
}

.legend-name {
  color: var(--text-secondary, #64748b);
  font-weight: 500;
}

[data-theme="dark"] .legend-name {
  color: #94a3b8;
}

.legend-stats {
  text-align: right;
  font-family: 'JetBrains Mono', monospace, sans-serif;
}

.legend-val {
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

[data-theme="dark"] .legend-val {
  color: #f8fafc;
}

.legend-pct {
  font-size: 0.72rem;
  color: var(--text-tertiary, #94a3b8);
  margin-left: 0.25rem;
}

/* Breakdown List */
.emi-breakdown-card {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.65rem;
  padding: 0.85rem 1rem;
  margin-bottom: 1.15rem;
}

[data-theme="dark"] .emi-breakdown-card {
  background: #0f172a;
  border-color: #334155;
}

.emi-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  font-size: 0.88rem;
  border-bottom: 1px dashed var(--border-color, #e2e8f0);
}

[data-theme="dark"] .emi-breakdown-row {
  border-bottom-color: #334155;
}

.emi-breakdown-row:last-child {
  border-bottom: none;
}

.emi-breakdown-lbl {
  color: var(--text-secondary, #64748b);
  font-weight: 500;
}

[data-theme="dark"] .emi-breakdown-lbl {
  color: #94a3b8;
}

.emi-breakdown-val {
  color: var(--text-primary, #0f172a);
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace, sans-serif;
}

[data-theme="dark"] .emi-breakdown-val {
  color: #f8fafc;
}

/* Formula Callout */
.emi-formula-callout {
  background: var(--bg-primary, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-left: 4px solid #10b981;
  border-radius: 0.5rem;
  padding: 0.75rem 0.85rem;
  margin-bottom: 1.15rem;
  font-size: 0.82rem;
}

[data-theme="dark"] .emi-formula-callout {
  background: #1e293b;
  border-color: #334155;
  border-left-color: #10b981;
}

.emi-formula-title {
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

[data-theme="dark"] .emi-formula-title {
  color: #f8fafc;
}

.emi-formula-math {
  font-family: 'JetBrains Mono', monospace, sans-serif;
  color: var(--text-secondary, #64748b);
  word-break: break-all;
  line-height: 1.45;
}

[data-theme="dark"] .emi-formula-math {
  color: #cbd5e1;
}

/* Timestamp strip */
.emi-timestamp-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--text-tertiary, #94a3b8);
  margin-bottom: 1.15rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .emi-timestamp-strip {
  border-top-color: #334155;
}

/* Result action buttons */
.emi-result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

@media (max-width: 480px) {
  .emi-result-actions {
    grid-template-columns: 1fr;
  }
}

.emi-res-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

[data-theme="dark"] .emi-res-btn {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

.emi-res-btn:hover {
  background: var(--border-color, #e2e8f0);
  border-color: #94a3b8;
}

[data-theme="dark"] .emi-res-btn:hover {
  background: #1e293b;
  border-color: #475569;
}

/* ==========================================================================
   5. MONTHLY AMORTIZATION SCHEDULE
   ========================================================================== */
.emi-schedule-section {
  display: none;
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
}

.emi-schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.emi-schedule-search {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.emi-schedule-search input {
  width: 100%;
  padding: 0.5rem 0.85rem 0.5rem 2.25rem;
  font-size: 0.86rem;
  font-family: inherit;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-primary, #ffffff);
  color: var(--text-primary, #0f172a);
  outline: none;
}

[data-theme="dark"] .emi-schedule-search input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

.emi-schedule-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary, #94a3b8);
  pointer-events: none;
}

.emi-schedule-table-container {
  overflow-x: auto;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color, #e2e8f0);
  margin-bottom: 1rem;
}

[data-theme="dark"] .emi-schedule-table-container {
  border-color: #334155;
}

.emi-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: right;
  min-width: 650px;
}

.emi-schedule-table th {
  background: var(--bg-secondary, #f1f5f9);
  color: var(--text-primary, #0f172a);
  font-weight: 700;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  white-space: nowrap;
}

[data-theme="dark"] .emi-schedule-table th {
  background: #0f172a;
  border-bottom-color: #334155;
  color: #f8fafc;
}

.emi-schedule-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-color, #f1f5f9);
  color: var(--text-primary, #0f172a);
  font-family: 'JetBrains Mono', monospace, sans-serif;
  white-space: nowrap;
}

[data-theme="dark"] .emi-schedule-table td {
  border-bottom-color: #1e293b;
  color: #f8fafc;
}

.emi-schedule-table tr:hover td {
  background: rgba(16, 185, 129, 0.04);
}

[data-theme="dark"] .emi-schedule-table tr:hover td {
  background: rgba(16, 185, 129, 0.08);
}

.emi-schedule-table .col-num {
  text-align: center;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
}

.emi-schedule-table .col-date {
  text-align: left;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-secondary, #64748b);
}

[data-theme="dark"] .emi-schedule-table .col-date,
[data-theme="dark"] .emi-schedule-table .col-num {
  color: #94a3b8;
}

.text-emerald {
  color: #059669 !important;
}

[data-theme="dark"] .text-emerald {
  color: #34d399 !important;
}

.text-indigo {
  color: #4f46e5 !important;
}

[data-theme="dark"] .text-indigo {
  color: #818cf8 !important;
}

.emi-schedule-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.5rem;
}

/* ==========================================================================
   6. CALCULATION HISTORY SECTION
   ========================================================================== */
.emi-history-section {
  margin-top: 1.5rem;
  margin-bottom: 2.5rem;
}

.emi-hist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.emi-search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.emi-search-input {
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 2.25rem;
  font-size: 0.88rem;
  font-family: inherit;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-primary, #ffffff);
  color: var(--text-primary, #0f172a);
  outline: none;
}

[data-theme="dark"] .emi-search-input {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

.emi-search-input:focus {
  border-color: #10b981;
}

.emi-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary, #94a3b8);
  pointer-events: none;
}

.emi-bulk-actions {
  display: flex;
  gap: 0.5rem;
}

.emi-bulk-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 0.375rem;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-primary, #ffffff);
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

[data-theme="dark"] .emi-bulk-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.emi-bulk-btn:hover {
  background: var(--bg-secondary, #f1f5f9);
}

[data-theme="dark"] .emi-bulk-btn:hover {
  background: #334155;
}

.emi-bulk-btn.btn-clear-danger {
  color: #dc2626;
  border-color: #fca5a5;
}

[data-theme="dark"] .emi-bulk-btn.btn-clear-danger {
  color: #f87171;
  border-color: #7f1d1d;
}

.emi-bulk-btn.btn-clear-danger:hover {
  background: #fef2f2;
}

[data-theme="dark"] .emi-bulk-btn.btn-clear-danger:hover {
  background: #450a0a;
}

/* History Items */
.emi-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.emi-history-item {
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  padding: 0.95rem 1.15rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

[data-theme="dark"] .emi-history-item {
  background: #0f172a;
  border-color: #334155;
}

.emi-history-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .emi-history-item:hover {
  border-color: #475569;
}

.emi-hist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}

[data-theme="dark"] .emi-hist-header {
  border-bottom-color: #1e293b;
}

.emi-hist-borrower {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
}

.emi-hist-user-icon {
  color: #10b981;
}

.emi-hist-name {
  color: var(--text-primary, #0f172a);
}

[data-theme="dark"] .emi-hist-name {
  color: #f8fafc;
}

.emi-hist-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  background: #dcfce7;
  color: #15803d;
}

[data-theme="dark"] .emi-hist-badge {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.emi-hist-datetime {
  font-size: 0.78rem;
  color: var(--text-tertiary, #94a3b8);
  display: flex;
  gap: 0.4rem;
}

.emi-hist-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 680px) {
  .emi-hist-metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
}

.emi-hist-metric {
  display: flex;
  flex-direction: column;
}

.emi-metric-lbl {
  font-size: 0.72rem;
  color: var(--text-secondary, #64748b);
  margin-bottom: 0.15rem;
}

[data-theme="dark"] .emi-metric-lbl {
  color: #94a3b8;
}

.emi-metric-val {
  font-size: 0.92rem;
  font-family: 'JetBrains Mono', monospace, sans-serif;
  color: var(--text-primary, #0f172a);
}

[data-theme="dark"] .emi-metric-val {
  color: #f8fafc;
}

.emi-hist-metric.highlight-emi .emi-metric-val {
  color: #059669;
  font-weight: 700;
}

[data-theme="dark"] .emi-hist-metric.highlight-emi .emi-metric-val {
  color: #34d399;
}

.emi-hist-metric.highlight-total .emi-metric-val {
  color: #4f46e5;
  font-weight: 700;
}

[data-theme="dark"] .emi-hist-metric.highlight-total .emi-metric-val {
  color: #818cf8;
}

/* History Actions inside Item */
.emi-hist-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.emi-hist-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 0.35rem;
  border: 1px solid var(--border-color, #cbd5e1);
  background: var(--bg-primary, #ffffff);
  color: var(--text-primary, #0f172a);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

[data-theme="dark"] .emi-hist-btn {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

.emi-hist-btn:hover {
  background: var(--border-color, #e2e8f0);
}

[data-theme="dark"] .emi-hist-btn:hover {
  background: #334155;
}

.emi-hist-btn.btn-delete {
  color: #dc2626;
  border-color: #fca5a5;
}

[data-theme="dark"] .emi-hist-btn.btn-delete {
  color: #f87171;
  border-color: #7f1d1d;
}

.emi-hist-btn.btn-delete:hover {
  background: #fef2f2;
}

[data-theme="dark"] .emi-hist-btn.btn-delete:hover {
  background: #450a0a;
}

/* History Empty State */
.emi-history-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-tertiary, #94a3b8);
}

.history-empty-icon {
  margin-bottom: 0.75rem;
  color: #cbd5e1;
}

[data-theme="dark"] .history-empty-icon {
  color: #475569;
}

.history-empty-text {
  font-size: 0.9rem;
  max-width: 360px;
  margin: 0 auto;
}

/* ==========================================================================
   7. EDUCATIONAL GUIDES & FAQ
   ========================================================================== */
.emi-edu-section {
  margin-bottom: 3rem;
}

.emi-edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 820px) {
  .emi-edu-grid {
    grid-template-columns: 1fr;
  }
}

.emi-edu-card {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.75rem;
  padding: 1.5rem;
}

[data-theme="dark"] .emi-edu-card {
  background: var(--bg-card, #1e293b);
  border-color: #334155;
}

.emi-edu-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

[data-theme="dark"] .emi-edu-title {
  color: #f8fafc;
}

.emi-edu-card p,
.emi-edu-card li {
  font-size: 0.9rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.6;
}

[data-theme="dark"] .emi-edu-card p,
[data-theme="dark"] .emi-edu-card li {
  color: #94a3b8;
}

.emi-edu-card ul {
  padding-left: 1.25rem;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.emi-faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.emi-faq-item {
  background: var(--bg-card, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0.65rem;
  padding: 1.15rem 1.25rem;
}

[data-theme="dark"] .emi-faq-item {
  background: #1e293b;
  border-color: #334155;
}

.emi-faq-q {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  margin-bottom: 0.4rem;
}

[data-theme="dark"] .emi-faq-q {
  color: #f8fafc;
}

.emi-faq-a {
  font-size: 0.88rem;
  color: var(--text-secondary, #64748b);
  line-height: 1.55;
  margin: 0;
}

[data-theme="dark"] .emi-faq-a {
  color: #94a3b8;
}

/* ==========================================================================
   8. TOAST NOTIFICATION
   ========================================================================== */
.emi-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #f8fafc;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

[data-theme="dark"] .emi-toast {
  background: #1e293b;
  color: #ffffff;
  border: 1px solid #334155;
}

.emi-toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   9. PRINT STYLES
   ========================================================================== */
@media print {
  .site-header,
  .footer,
  .breadcrumb-nav-compact,
  .emi-header-section,
  .emi-form-actions,
  .emi-history-section,
  .emi-edu-section,
  .emi-toast,
  .emi-result-actions,
  .emi-schedule-toolbar,
  .emi-schedule-footer,
  .emi-card:first-child {
    display: none !important;
  }

  body,
  .main-content,
  .emi-page-wrapper,
  .emi-stage-container {
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #000000 !important;
    display: block !important;
  }

  .emi-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .emi-hero-box {
    border: 1px solid #000000 !important;
    background: none !important;
  }

  .emi-hero-val {
    color: #000000 !important;
  }

  .emi-schedule-section {
    display: block !important;
  }

  .emi-schedule-table-container {
    overflow: visible !important;
    border: none !important;
  }
}

