/* MyBillingApp — Premium GST Summary */

.content:has(.gst-summary-page) {
  padding: 24px;
  background: #f6f7f9;
}

.gst-summary-page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  min-width: 0;
  width: 100%;
  container-type: inline-size;
  container-name: gst;
}

.gst-summary-page .tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Page header */
.gst-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.gst-page-head h1 {
  margin: 0;
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text, #0f172a);
}

.gst-page-head-copy p {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted, #64748b);
  max-width: 560px;
  line-height: 1.5;
}

.gst-page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gst-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 600;
}

.gst-export-btn svg {
  width: 18px;
  height: 18px;
}

/* Filter bar */
.gst-filter-bar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 14px 16px;
  padding: 18px 20px;
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e8eaef);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(11, 15, 25, 0.04);
}

.gst-filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 9rem;
}

.gst-filter-field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted, #64748b);
  text-transform: none;
}

.gst-control {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line, #e8eaef);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--text, #0f172a);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gst-control:focus {
  outline: none;
  border-color: var(--primary, #ff6b00);
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.15);
}

.gst-filter-period {
  flex: 1 1 12rem;
  min-width: 0;
}

.gst-filter-period .gst-control {
  background: #f8fafc;
  color: var(--text-soft, #334155);
  cursor: default;
}

.gst-apply-btn {
  min-height: 42px;
  padding: 0 20px;
  border-radius: 10px;
  font-weight: 600;
}

/* Cards */
.gst-summary-page .card,
.gst-card {
  background: var(--surface, #fff);
  border: 1px solid var(--line, #e8eaef);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(11, 15, 25, 0.04);
}

.gst-card {
  padding: 22px 24px;
}

.gst-section-head {
  margin-bottom: 18px;
}

.gst-section-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text, #0f172a);
}

.gst-section-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted, #64748b);
  line-height: 1.45;
}

/* KPI grid */
.gst-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.gst-kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--line, #e8eaef);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(11, 15, 25, 0.04);
  min-height: 148px;
  min-width: 0;
  max-width: 100%;
}

.gst-kpi-card--highlight {
  border-color: rgba(255, 107, 0, 0.28);
  background: linear-gradient(180deg, #fff 0%, #fffaf5 100%);
  box-shadow: 0 4px 16px rgba(255, 107, 0, 0.08);
}

.gst-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  margin-bottom: 4px;
}

.gst-kpi-icon svg {
  width: 18px;
  height: 18px;
}

.gst-kpi-icon--sales { background: #eef2ff; color: #4338ca; }
.gst-kpi-icon--output { background: var(--primary-soft, #fff1e6); color: var(--primary, #ff6b00); }
.gst-kpi-icon--itc { background: #ecfdf5; color: #059669; }
.gst-kpi-icon--net { background: var(--primary-soft, #fff1e6); color: var(--primary-ink, #9a3d00); }

.gst-kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}

.gst-kpi-value {
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text, #0f172a);
  line-height: 1.15;
  min-width: 0;
  overflow-wrap: anywhere;
}

.gst-kpi-card--highlight .gst-kpi-value {
  color: var(--primary, #ff6b00);
}

.gst-kpi-muted {
  color: var(--muted, #94a3b8) !important;
  font-size: 24px !important;
}

.gst-kpi-hint {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  line-height: 1.35;
  margin-top: auto;
}

/* Main grid */
.gst-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  min-width: 0;
}

/* Liability */
.gst-liability-lines {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.gst-liability-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  min-width: 0;
}

.gst-liability-row dt {
  margin: 0;
  font-size: 14px;
  color: var(--text-soft, #334155);
  min-width: 0;
}

.gst-liability-row dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #0f172a);
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.gst-liability-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px solid #e8eaef;
}

.gst-liability-total span {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.gst-liability-total strong {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--primary, #ff6b00);
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

/* Breakdown */
.gst-breakdown-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.gst-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gst-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 88px) minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.gst-bar-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft, #334155);
}

.gst-bar-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}

.gst-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
  transition: width 0.4s ease;
}

.gst-bar--cgst { background: #6366f1; }
.gst-bar--sgst { background: #8b5cf6; }
.gst-bar--igst { background: var(--primary, #ff6b00); }
.gst-bar--cess { background: #64748b; }
.gst-bar--other { background: #94a3b8; }

.gst-bar-amt {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #0f172a);
  white-space: nowrap;
  min-width: 0;
  text-align: right;
}

/* Tables */
.gst-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}

.gst-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.gst-report-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted, #64748b);
  background: #f8fafc;
  border-bottom: 1px solid var(--line, #e8eaef);
  white-space: nowrap;
}

.gst-report-table thead th.num,
.gst-report-table td.num {
  text-align: right;
}

.gst-report-table tbody td {
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-soft, #334155);
  vertical-align: middle;
}

.gst-report-table tbody tr:hover td {
  background: rgba(255, 107, 0, 0.03);
}

.gst-report-table tfoot td {
  padding: 16px;
  background: #fafbfc;
  border-top: 1px solid var(--line, #e8eaef);
  font-size: 14px;
}

.gst-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--primary-soft, #fff1e6);
  color: var(--primary-ink, #9a3d00);
}

/* Return summary */
.gst-return-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
}

.gst-return-grid > div {
  padding: 16px;
  background: #fafbfc;
  border: 1px solid #f1f5f9;
  border-radius: 12px;
}

.gst-return-grid dt {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #64748b);
}

.gst-return-grid dd {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.gst-return-highlight {
  grid-column: span 1;
  background: linear-gradient(180deg, #fffaf5 0%, #fff 100%) !important;
  border-color: rgba(255, 107, 0, 0.22) !important;
}

.gst-return-highlight dd {
  color: var(--primary, #ff6b00);
  font-size: 22px;
}

.gst-muted {
  color: var(--muted, #94a3b8);
  font-weight: 600;
}

/* Related reports */
.gst-related {
  padding: 20px 24px;
}

.gst-related-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.gst-related-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.gst-related-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line, #e8eaef);
  border-radius: 12px;
  text-decoration: none;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gst-related-link:hover {
  border-color: rgba(255, 107, 0, 0.35);
  box-shadow: 0 4px 12px rgba(255, 107, 0, 0.08);
}

.gst-related-link strong {
  font-size: 14px;
  color: var(--text, #0f172a);
}

.gst-related-link span {
  font-size: 12px;
  color: var(--muted, #64748b);
  line-height: 1.4;
}

/* Empty state */
.gst-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
}

.gst-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--primary-soft, #fff1e6);
  color: var(--primary, #ff6b00);
  margin-bottom: 16px;
}

.gst-empty-icon svg {
  width: 32px;
  height: 32px;
}

.gst-empty h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text, #0f172a);
}

.gst-empty p {
  margin: 0;
  max-width: 420px;
  font-size: 14px;
  color: var(--muted, #64748b);
  line-height: 1.5;
}

.gst-empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

/* Gate page */
.gst-gate-card {
  max-width: 520px;
  padding: 28px;
}

.gst-gate-note {
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  font-size: 14px;
  color: var(--text-soft, #334155);
  line-height: 1.5;
}

.gst-gate-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gst-gate-form .gst-filter-field {
  min-width: 100%;
}

/* Responsive */
@container gst (max-width: 900px) {
  .gst-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gst-main-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .gst-return-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .gst-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gst-main-grid {
    grid-template-columns: 1fr;
  }

  .gst-return-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .content:has(.gst-summary-page) {
    padding: 16px;
  }

  .gst-kpi-grid {
    grid-template-columns: 1fr;
  }

  .gst-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .gst-filter-field,
  .gst-filter-period {
    min-width: 100%;
  }

  .gst-apply-btn {
    width: 100%;
  }

  .gst-bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .gst-bar-amt {
    justify-self: start;
  }

  .gst-return-grid {
    grid-template-columns: 1fr;
  }

  .gst-return-highlight {
    grid-column: span 1;
  }
}

/* Dark mode */
html[data-theme="dark"] .content:has(.gst-summary-page) {
  background: #0b0f19;
}

html[data-theme="dark"] .gst-summary-page .card,
html[data-theme="dark"] .gst-card,
html[data-theme="dark"] .gst-kpi-card,
html[data-theme="dark"] .gst-related-link {
  background: #111827;
  border-color: #1f2937;
}

html[data-theme="dark"] .gst-page-head h1,
html[data-theme="dark"] .gst-kpi-value,
html[data-theme="dark"] .gst-section-head h2,
html[data-theme="dark"] .gst-liability-row dd,
html[data-theme="dark"] .gst-bar-amt,
html[data-theme="dark"] .gst-return-grid dd,
html[data-theme="dark"] .gst-related-link strong,
html[data-theme="dark"] .gst-empty h2 {
  color: #f1f5f9;
}

html[data-theme="dark"] .gst-control {
  background: #0f172a;
  border-color: #334155;
  color: #f1f5f9;
}

html[data-theme="dark"] .gst-filter-period .gst-control {
  background: #1e293b;
}

html[data-theme="dark"] .gst-kpi-card--highlight {
  background: linear-gradient(180deg, #111827 0%, #1a1208 100%);
  border-color: rgba(255, 107, 0, 0.35);
}

html[data-theme="dark"] .gst-report-table thead th {
  background: #1e293b;
  border-color: #334155;
}

html[data-theme="dark"] .gst-report-table tbody td {
  border-color: #1f2937;
  color: #cbd5e1;
}

html[data-theme="dark"] .gst-report-table tbody tr:hover td {
  background: rgba(255, 107, 0, 0.06);
}

html[data-theme="dark"] .gst-report-table tfoot td,
html[data-theme="dark"] .gst-return-grid > div,
html[data-theme="dark"] .gst-gate-note {
  background: #0f172a;
  border-color: #1f2937;
}

html[data-theme="dark"] .gst-liability-row {
  border-color: #1f2937;
}

html[data-theme="dark"] .gst-bar-track {
  background: #1e293b;
}
