/* ==========================================================
   SME FINANCE — UNIFIED THEME
========================================================== */

:root {
  --navy-950: #07142f;
  --navy-900: #0b1a3a;
  --navy-800: #10224a;
  --navy-700: #16305f;

  --gold-400: #f6c453;
  --gold-500: #f0b429;
  --gold-600: #d99a12;

  --bg-app: #f5f7fb;
  --white: #ffffff;

  --text-main: #1f2937;
  --text-dark: #111827;
  --text-muted: #6b7280;

  --border-soft: #e5e7eb;
  --border-light: #eef1f5;

  --green-600: #16a34a;
  --red-600: #dc2626;
  --blue-600: #2563eb;
  --orange-600: #ea580c;

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;

  --shadow-card: 0 4px 14px rgba(15, 23, 42, 0.05);

  --shadow-hover: 0 10px 25px rgba(15, 23, 42, 0.09);
}

/* ==========================================================
   GLOBAL
========================================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-app);
  font-family:
    "Segoe UI",
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;

  color: var(--text-main);
  font-size: 14px;
}

a {
  text-decoration: none;
}

img {
  max-width: 100%;
}

/* ==========================================================
   APP LAYOUT
========================================================== */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-content {
  flex: 1;
  min-width: 0;
  padding: 30px 34px 60px;
}

/* ==========================================================
   SIDEBAR
========================================================== */

.sidebar {
  width: 250px;
  flex-shrink: 0;

  background: linear-gradient(180deg, var(--navy-950) 0%, var(--navy-900) 100%);

  color: #cbd5e1;

  min-height: 100vh;

  padding: 22px 16px 30px;

  position: sticky;
  top: 0;

  align-self: flex-start;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;

  padding: 4px 8px 20px;
  margin-bottom: 12px;

  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
  width: 38px;
  height: 38px;

  border-radius: 11px;

  object-fit: cover;

  background: var(--gold-500);
}

.sidebar-brand .brand-name {
  font-weight: 800;
  font-size: 16px;

  color: var(--gold-500);

  line-height: 1.1;
}

.sidebar-brand .brand-sub {
  font-size: 10px;

  letter-spacing: 0.06em;

  color: #94a3b8;

  text-transform: uppercase;

  margin-top: 3px;
}

.sidebar-section-label {
  font-size: 10.5px;

  font-weight: 700;

  letter-spacing: 0.09em;

  color: #64748b;

  text-transform: uppercase;

  padding: 17px 12px 7px;
}

.sidebar a.nav-link {
  display: flex;

  align-items: center;

  gap: 11px;

  color: #cbd5e1;

  padding: 10px 12px;

  border-radius: 10px;

  margin-bottom: 3px;

  font-size: 14px;

  font-weight: 500;

  transition: all 0.18s ease;
}

.sidebar a.nav-link i {
  width: 19px;

  text-align: center;

  font-size: 15px;

  opacity: 0.8;
}

.sidebar a.nav-link:hover {
  background: rgba(255, 255, 255, 0.07);

  color: #ffffff;

  transform: translateX(2px);
}

.sidebar a.nav-link.active {
  background: var(--gold-500);

  color: var(--navy-900);

  font-weight: 700;

  box-shadow: 0 4px 12px rgba(240, 180, 41, 0.2);
}

.sidebar a.nav-link.active i {
  opacity: 1;
}

.sidebar a.nav-link.logout {
  color: #f87171;
}

.sidebar a.nav-link.logout:hover {
  background: rgba(248, 113, 113, 0.1);

  color: #fca5a5;
}

.sidebar hr {
  border-color: rgba(255, 255, 255, 0.08);

  margin: 15px 0;
}

/* ==========================================================
   PAGE HEADER
========================================================== */

.topbar {
  display: flex;

  align-items: center;

  justify-content: space-between;

  margin-bottom: 25px;

  flex-wrap: wrap;

  gap: 14px;
}

.topbar h1,
.page-title {
  font-size: 25px;

  font-weight: 800;

  color: var(--navy-900);

  margin: 0;
}

.page-subtitle {
  color: var(--text-muted);

  font-size: 13.5px;

  margin-top: 4px;
}

/* ==========================================================
   CARDS
========================================================== */

.card,
.kpi-card,
.panel {
  border: 1px solid var(--border-light);

  border-radius: var(--radius-lg);

  box-shadow: var(--shadow-card);

  background: var(--white);

  overflow: hidden;
}

.card {
  transition:
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.panel {
  padding: 22px;
}

/* ==========================================================
   KPI CARDS
========================================================== */

.kpi-card {
  padding: 20px 22px;

  position: relative;

  overflow: hidden;
}

.kpi-card::after {
  content: "";

  position: absolute;

  width: 75px;
  height: 75px;

  right: -25px;
  bottom: -25px;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.35);
}

.kpi-card .kpi-label {
  font-size: 11.5px;

  font-weight: 700;

  letter-spacing: 0.05em;

  text-transform: uppercase;

  color: var(--text-muted);
}

.kpi-card .kpi-value {
  font-size: 26px;

  font-weight: 800;

  color: var(--navy-900);

  margin: 6px 0 4px;
}

.kpi-card .kpi-trend {
  font-size: 12px;

  font-weight: 600;
}

.kpi-card .kpi-trend.up {
  color: var(--green-600);
}

.kpi-card .kpi-trend.down {
  color: var(--red-600);
}

.kpi-icon {
  width: 46px;
  height: 46px;

  border-radius: 13px;

  display: flex;

  align-items: center;
  justify-content: center;

  font-size: 18px;
}

.kpi-card.tone-green {
  background: #f0fbf4;
}

.kpi-card.tone-red {
  background: #fff3f3;
}

.kpi-card.tone-blue {
  background: #f1f6ff;
}

.kpi-card.tone-gold {
  background: #fffaf0;
}

.kpi-icon.tone-green {
  background: #d9f6e3;
  color: var(--green-600);
}

.kpi-icon.tone-red {
  background: #fee2e2;
  color: var(--red-600);
}

.kpi-icon.tone-blue {
  background: #dbeafe;
  color: var(--blue-600);
}

.kpi-icon.tone-gold {
  background: #fef3c7;
  color: var(--gold-600);
}

/* ==========================================================
   PANELS
========================================================== */

.panel-title {
  font-size: 13px;

  font-weight: 800;

  letter-spacing: 0.03em;

  text-transform: uppercase;

  color: #374151;

  margin-bottom: 17px;
}

/* ==========================================================
   TABLE
========================================================== */

.table-clean {
  margin-bottom: 0;
}

.table-clean thead th {
  font-size: 11px;

  text-transform: uppercase;

  letter-spacing: 0.05em;

  color: var(--text-muted);

  background: #fafbfc;

  border-bottom: 1px solid var(--border-soft);

  font-weight: 700;

  padding: 12px 10px;
}

.table-clean td {
  padding: 13px 10px;

  border-bottom: 1px solid #f0f2f5;

  vertical-align: middle;

  font-size: 13.5px;
}

.table-clean tbody tr {
  transition: background 0.15s ease;
}

.table-clean tbody tr:hover {
  background: #fafbff;
}

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

/* ==========================================================
   STATUS BADGES
========================================================== */

.badge-status {
  display: inline-flex;

  align-items: center;

  padding: 5px 11px;

  border-radius: 999px;

  font-size: 11.5px;

  font-weight: 700;
}

.badge-status.paid,
.badge-status.completed,
.badge-status.approved {
  background: #dcfce7;
  color: #15803d;
}

.badge-status.pending,
.badge-status.draft {
  background: #fef3c7;
  color: #92400e;
}

.badge-status.overdue,
.badge-status.rejected,
.badge-status.cancelled {
  background: #fee2e2;
  color: #b91c1c;
}

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

/* ==========================================================
   BUTTONS
========================================================== */

.btn {
  border-radius: 9px;

  font-size: 13.5px;

  font-weight: 600;

  transition: all 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--gold-500);

  border: 1px solid var(--gold-500);

  color: var(--navy-900);

  font-weight: 700;
}

.btn-gold:hover {
  background: var(--gold-600);

  border-color: var(--gold-600);

  color: var(--navy-900);
}

.btn-navy {
  background: var(--navy-900);

  border: 1px solid var(--navy-900);

  color: #ffffff;

  font-weight: 600;
}

.btn-navy:hover {
  background: var(--navy-800);

  border-color: var(--navy-800);

  color: #ffffff;
}

.btn-outline-secondary {
  border-color: #d1d5db;

  color: #4b5563;

  background: #ffffff;
}

.btn-outline-secondary:hover {
  background: #f8fafc;

  border-color: #9ca3af;

  color: #1f2937;
}

/* ==========================================================
   FORMS
========================================================== */

.form-label {
  font-weight: 600;

  font-size: 13px;

  color: #374151;

  margin-bottom: 7px;
}

.form-control,
.form-select {
  border-radius: 10px;

  border: 1px solid var(--border-soft);

  padding: 10px 12px;

  font-size: 14px;

  color: var(--text-main);

  background: #ffffff;

  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease;
}

.form-control::placeholder {
  color: #9ca3af;
}

.form-control:hover,
.form-select:hover {
  border-color: #cbd5e1;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--gold-500);

  box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.16);
}

textarea.form-control {
  resize: vertical;
}

.input-group-text {
  border-color: var(--border-soft);

  background: #f8fafc;

  color: #64748b;

  font-weight: 600;
}

.form-text {
  font-size: 12px;

  color: var(--text-muted);
}

/* ==========================================================
   ALERT
========================================================== */

.alert {
  border-radius: 11px;

  border: 1px solid transparent;

  font-size: 13.5px;
}

.alert-danger {
  background: #fff1f2;

  border-color: #fecdd3;

  color: #be123c;
}

.alert-success {
  background: #f0fdf4;

  border-color: #bbf7d0;

  color: #15803d;
}

/* ==========================================================
   PAYMENT PAGE
========================================================== */

.payment-card {
  border-radius: 18px;

  border: 1px solid var(--border-light);

  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.06);
}

.payment-summary-card {
  border-radius: 18px;

  border: 1px solid var(--border-light);

  box-shadow: 0 8px 25px rgba(15, 23, 42, 0.06);

  position: sticky;

  top: 25px;
}

.section-heading {
  display: flex;

  align-items: center;

  gap: 12px;
}

.section-heading h5 {
  font-weight: 800;

  color: var(--navy-900);
}

.section-icon {
  width: 43px;
  height: 43px;

  border-radius: 12px;

  display: flex;

  align-items: center;
  justify-content: center;

  background: #fff4d6;

  color: var(--gold-600);

  font-size: 19px;
}

.summary-label {
  font-size: 11px;

  text-transform: uppercase;

  letter-spacing: 0.07em;

  color: var(--text-muted);

  font-weight: 700;
}

.summary-invoice {
  color: var(--navy-900);

  font-weight: 800;

  margin-top: 4px;

  margin-bottom: 10px;
}

.summary-customer {
  color: #4b5563;

  font-size: 13.5px;

  display: flex;

  align-items: center;

  gap: 7px;
}

.summary-row {
  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 15px;

  padding: 9px 0;

  color: #6b7280;

  font-size: 13.5px;
}

.summary-row strong {
  color: var(--text-main);
}

.balance-box {
  margin-top: 14px;

  padding: 18px;

  border-radius: 14px;

  background: linear-gradient(135deg, #fff9e9, #fffdf7);

  border: 1px solid #f6df9c;
}

.balance-box > span {
  font-size: 11px;

  font-weight: 700;

  color: #92701b;

  text-transform: uppercase;

  letter-spacing: 0.05em;
}

.balance {
  font-size: 28px;

  font-weight: 800;

  color: var(--navy-900);

  margin-top: 4px;
}

/* ==========================================================
   AUTH PAGE
========================================================== */

body.auth-page {
  background: linear-gradient(
    145deg,
    var(--navy-950) 0%,
    var(--navy-700) 55%,
    var(--navy-900) 100%
  );
}

.auth-card {
  border-radius: 20px !important;

  padding: 40px 36px !important;

  border: 1px solid rgba(255, 255, 255, 0.1) !important;

  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.22) !important;
}

.auth-logo {
  width: 60px;
  height: 60px;

  margin: 0 auto;

  border-radius: 16px;

  background: var(--gold-500);

  color: var(--navy-900);

  display: flex;

  align-items: center;
  justify-content: center;

  font-size: 26px;

  box-shadow: 0 8px 20px rgba(240, 180, 41, 0.2);
}

/* ==========================================================
   EMPTY STATE
========================================================== */

.empty-state {
  text-align: center;

  padding: 45px 20px;

  color: var(--text-muted);
}

.empty-state i {
  font-size: 42px;

  color: #cbd5e1;

  display: block;

  margin-bottom: 12px;
}

.empty-state h5 {
  color: #374151;

  font-weight: 700;

  margin-bottom: 5px;
}

/* ==========================================================
   DIVIDER
========================================================== */

hr {
  border-color: var(--border-soft);

  opacity: 1;
}

/* ==========================================================
   RESPONSIVE
========================================================== */

@media (max-width: 991px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;

    min-height: auto;

    position: relative;
  }

  .app-content {
    padding: 22px 17px 45px;
  }

  .payment-summary-card {
    position: relative;

    top: auto;
  }
}

@media (max-width: 576px) {
  .app-content {
    padding: 18px 13px 35px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar h1,
  .page-title {
    font-size: 21px;
  }

  .kpi-card {
    padding: 17px;
  }

  .panel {
    padding: 16px;
  }

  .auth-card {
    padding: 28px 22px !important;
  }

  .balance {
    font-size: 24px;
  }
}

/* ==========================================================
   FINAL UI CONSISTENCY — DOCUMENTS & FORMS
========================================================== */

.page-header,
.quotation-card,
.invoice-card,
.quotation-container .quotation-card,
.invoice-wrapper .invoice-card {
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-card) !important;
  background: var(--white) !important;
}

.page-header {
  padding: 22px 24px !important;
  margin-bottom: 20px !important;
}

.quotation-card,
.invoice-card {
  overflow: hidden !important;
}

.quotation-container,
.invoice-wrapper,
.action-bar {
  width: min(100%, 900px) !important;
  max-width: 900px !important;
}

.quotation-container,
.invoice-wrapper {
  margin: 20px auto 40px !important;
}

.action-bar {
  margin: 20px auto !important;
}

.quotation-container .quotation-card,
.invoice-wrapper .invoice-card {
  padding: 42px !important;
}

.quotation-container .company-logo,
.invoice-wrapper .company-logo {
  width: 76px !important;
  height: 76px !important;
  object-fit: contain !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-soft) !important;
  background: #fff !important;
  padding: 5px !important;
}

.quotation-container .summary,
.invoice-wrapper .summary {
  width: 350px !important;
  max-width: 100% !important;
}

.quotation-container table,
.invoice-wrapper table {
  width: 100%;
}

.quotation-container .table > :not(caption) > * > *,
.invoice-wrapper .table > :not(caption) > * > * {
  border-color: var(--border-light);
}

.quotation-container .table thead th,
.invoice-wrapper .table thead th {
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.status,
.status-badge {
  border-radius: 999px !important;
  padding: 7px 12px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center;
  line-height: 1;
}

.convert-box,
.source-box {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-light);
}

.card.shadow-sm.border-0,
form .card.shadow-sm.border-0 {
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-card) !important;
}

.is-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .10) !important;
}

.form-control.is-invalid,
.form-select.is-invalid {
  background-image: none !important;
}

@media (max-width: 768px) {
  .app-content {
    padding: 20px 16px 40px;
  }

  .page-header {
    padding: 18px !important;
    gap: 15px;
  }

  .quotation-container .quotation-card,
  .invoice-wrapper .invoice-card {
    padding: 24px !important;
  }

  .quotation-container .summary,
  .invoice-wrapper .summary {
    width: 100% !important;
  }
}
