/* ====================================================================
    ACCOUNTING WEB PORTAL - STYLESHEET
   ==================================================================== */

:root {
  --primary: #1a365d;
  --primary-light: #2b6cb0;
  --primary-dark: #0f2442;
  --secondary: #2d3748;
  --accent: #3182ce;
  --success: #22543d;
  --success-bg: #c6f6d5;
  --success-text: #22543d;
  --danger: #9b2c2c;
  --danger-bg: #fed7d7;
  --danger-text: #9b2c2c;
  --warning: #c05621;
  --warning-bg: #feebc8;
  --bg-main: #f7fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text-main: #2d3748;
  --text-muted: #718096;
  --sidebar-w: 260px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
}

/* ================= APP LAYOUT ================= */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

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

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.brand-text h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin: 0;
}

.brand-text p {
  font-size: 11px;
  color: #cbd5e0;
  margin: 2px 0 0;
}

.nav-links {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-links li {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: #e2e8f0;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: translateX(3px);
}

.nav-link.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(49, 130, 206, 0.4);
}

.nav-icon {
  font-size: 18px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  color: #a0aec0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Main Content */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* Top Navbar */
.top-navbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
}

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

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--secondary);
}

.page-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--primary);
}

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

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #edf2f7;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}

.btn-logout {
  background: #edf2f7;
  border: 1px solid var(--border);
  color: #e53e3e;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: #fed7d7;
  border-color: #feb2b2;
}

/* Page Content Viewport */
.content-area {
  padding: 24px 28px;
  flex: 1;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.25s ease-in;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ================= METRIC CARDS ================= */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: flex-start;
  gap: 18px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.icon-cash {
  background: #e6fffa;
  color: #234e52;
}

.icon-bank {
  background: #ebf8ff;
  color: #2b6cb0;
}

.icon-customer {
  background: #fefcbf;
  color: #744210;
}

.icon-supplier {
  background: #feebc8;
  color: #7b341e;
}

.card-info {
  flex: 1;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin: 4px 0 2px;
}

.card-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.card-breakdown {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11.5px;
  line-height: 1.4;
  padding: 2px 0;
}

.breakdown-name {
  color: #4a5568;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 135px;
}

.breakdown-val {
  font-weight: 600;
  color: var(--primary);
  margin-left: 8px;
  white-space: nowrap;
}

/* ================= CARDS & TABLES ================= */
.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: #fff;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Category Pills */
.category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.pill-btn {
  background: #edf2f7;
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.pill-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(26, 54, 93, 0.3);
}

/* Controls */
.input-control,
.select-control {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s;
}

.input-control:focus,
.select-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.15);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

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

.btn-secondary {
  background: #edf2f7;
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* Data Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.data-table th {
  background: #edf2f7;
  color: var(--secondary);
  font-weight: 700;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table .text-right {
  text-align: right;
}

.data-table .text-center {
  text-align: center;
}

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

.badge-dr {
  background: #feebc8;
  color: #7b341e;
}

.badge-cr {
  background: #c6f6d5;
  color: #22543d;
}

.badge-tag {
  background: #e2e8f0;
  color: #4a5568;
}

/* Report Header Box */
.report-header-banner {
  background: linear-gradient(135deg, #1a365d, #2b6cb0);
  color: #fff;
  padding: 20px 24px;
  border-radius: 8px;
  margin-bottom: 20px;
  text-align: center;
}

.report-header-banner h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.report-header-banner p {
  font-size: 13px;
  color: #e2e8f0;
}

/* Summary Cards inside reports */
.summary-strip {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.summary-box {
  flex: 1;
  min-width: 160px;
  background: #f7fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: center;
}

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

.summary-box .s-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0;
  }

  .mobile-toggle {
    display: block;
  }

  .content-area {
    padding: 16px;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* ====================================================================
   SEARCHABLE ACCOUNT SELECTOR (LEDGER)
   ==================================================================== */
.account-search-wrapper {
  position: relative;
  min-width: 320px;
  max-width: 440px;
  flex: 1 1 320px;
}

.account-search-input-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.account-search-input-box .search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
  z-index: 2;
}

.account-search-input-box input {
  width: 100%;
  padding-left: 32px !important;
  padding-right: 32px !important;
  font-size: 13.5px;
  height: 38px;
  background-color: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.account-search-input-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

.account-search-input-box .btn-clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: #edf2f7;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.account-search-input-box .btn-clear-search:hover {
  background: #cbd5e0;
  color: var(--text-main);
}

.account-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  overscroll-behavior: contain;
}

.account-search-list {
  padding: 4px 0;
}

.account-search-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  border-bottom: 1px solid #f7fafc;
  transition: background-color 0.1s ease;
}

.account-search-item:last-child {
  border-bottom: none;
}

.account-search-item:hover,
.account-search-item.highlighted {
  background: #ebf8ff;
}

.account-search-item.selected {
  background: #e6fffa;
  font-weight: 600;
}

.acc-search-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background: #edf2f7;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: #2d3748;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.acc-search-name {
  flex: 1;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.acc-search-type {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #f0f4f8;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.account-search-empty {
  padding: 18px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.account-search-count {
  padding: 6px 12px;
  font-size: 11px;
  color: var(--text-muted);
  background: #f7fafc;
  border-top: 1px solid var(--border);
  text-align: right;
}

/* Print Styling */
@media print {

  .sidebar,
  .top-navbar,
  .filter-bar,
  .btn-primary,
  .btn-secondary,
  .pill-btn,
  .category-pills,
  .btn-logout {
    display: none !important;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }

  .content-area {
    padding: 0 !important;
  }

  .panel-card {
    border: none !important;
    box-shadow: none !important;
  }

  .report-header-banner {
    color: #000 !important;
    background: #fff !important;
    border-bottom: 2px solid #000 !important;
    padding: 10px 0 !important;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }
}