:root {
  --primary: #111827;
  --accent-green: #00C49A;
  --accent-yellow: #FFC93C;
  --bg-light: #F1F1F1;
  --text-dark: #2C2C2C;
  --highlight-orange: #FB9C00;
}

/* Global Reset: Helps ensure content aligns correctly by removing browser default margins */
*, *::before, *::after {
    box-sizing: border-box;
    /* Define variables for easy, consistent control over layout */
    --content-gutter: 0rem;
    --max-content-width: 1400px;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh; 
  padding: 0; 
  overflow-x: hidden; /* CRITICAL: Prevents horizontal scrolling caused by overly wide children */
}

/* ==== Dark Mode === */
body.dark {
  background-color: #121212;
  color: #e0e0e0;
}

body.dark .card,
body.dark .modal {
  background-color: #1f2937;
  color: #f1f1f1;
}

body.dark .modal input,
body.dark .modal select,
body.dark .modal textarea {
  background-color: #2c2c2c;
  color: #fff;
  border: 1px solid #444;
}

body.dark .transaction-table th {
  background-color: #2a2a2a;
  color: #fff;
}

body.dark .transaction-table td {
  background-color: #1c1c1c;
  color: #ccc;
}

body.dark .filter-bar input,
body.dark .filter-bar select,
body.dark .filter-bar button,
body.dark .pagination-controls button {
  background-color: #2c2c2c;
  color: #fff;
  border: 1px solid #555;
}

body.dark .page-header button,
body.dark .modal button {
  background-color: #FFC93C;
  color: #1e1e1e;
}

body.dark h1,
body.dark h2, 
body.dark h3 {
  color: white;
}

body.dark .card p {
  color: #00C49A;
}

body.dark .employee-card,
body.dark .summary-box,
body.dark #accountList .card,
body.dark .payslip-preview {
  background-color: #1f1f1f;
  color: #f1f1f1;
}

body.dark .transaction-table th {
  background-color: #333;
}

/* ------------------------------------
   App Disabled Overlay & Activation Form
   ------------------------------------ */

#app-disabled-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(17, 24, 39, 0.95); /* bg-gray-900 with 95% opacity */
  z-index: 9999;
  color: white;
  padding: 2rem;
  text-align: center;
}

#app-disabled-overlay > div {
  padding: 2.5rem;
  background-color: #1f2937; /* bg-gray-800 */
  border-radius: 1rem; /* rounded-2xl */
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); /* shadow-2xl */
  width: 100%;
  max-width: 32rem; /* max-w-lg */
  margin: 0 1rem;
  animation: fadeIn 0.5s ease-out forwards;
}

#app-disabled-overlay h1 {
  font-size: 2.25rem; /* text-4xl */
  font-weight: 800; /* font-extrabold */
  margin-bottom: 1rem;
  color: #fca5a5; /* text-red-400 */
}

#app-disabled-overlay p {
  font-size: 1.125rem; /* text-lg */
  color: #e5e7eb; /* text-gray-200 */
  margin-bottom: 1.5rem;
}

#app-disabled-overlay p.text-gray-400 {
  font-size: 1rem; /* text-base */
  color: #9ca3af; /* text-gray-400 */
  margin-bottom: 2rem;
}

#activation-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* space-y-6 */
}

#activation-form input {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background-color: #374151; /* bg-gray-700 */
  color: #e5e7eb; /* text-gray-200 */
  border: 1px solid #4b5563; /* border-gray-600 */
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
  transition-duration: 0.2s;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

#activation-form input:focus {
  outline: none;
  border-color: #3b82f6; /* focus:border-blue-500 */
}

#activation-form button {
  padding: 0.75rem 1.5rem;
  background-color: #dc2626; /* bg-red-600 */
  color: white;
  font-weight: 600;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-lg */
  transition-property: all;
  transition-duration: 0.2s;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transform: scale(1);
}

#activation-form button:hover {
  background-color: #b91c1c; /* hover:bg-red-700 */
  transform: scale(1.05);
}

#activation-form button:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #dc2626, 0 0 0 4px rgba(220, 38, 38, 0.5); /* focus:ring-2 focus:ring-red-500 focus:ring-offset-2 */
}

#activation-status-message {
  font-size: 0.75rem; /* text-xs */
  color: #9ca3af; /* text-gray-400 */
  margin-top: 1rem;
}

@keyframes fadeIn { 
  from { opacity: 0; } to { opacity: 1; } 
}

.animate-fade-in-up { 
  animation: fadeIn 0.5s ease-out forwards; 
}


header {
  background-color: var(--primary);
  color: white;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Makes the H1 and P elements align horizontally */
.header-title-container {
  display: flex;
  align-items: baseline; /* Keeps text aligned nicely */
  gap: 1rem; /* Adds space between the title and the expiry status */
}

/* Optional: Clean up the margin on the p tag as well, since Flexbox handles spacing */
#license-expiry-display {
  margin-top: 0; /* Remove the mt-2 class effect if it's styled in CSS */
  color: var(--accent-green);
}

header nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

header nav button {
  background: transparent;
  border: 1px solid white;
  padding: 6px 12px;
  color: white;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

header nav button:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Reusable container for centering content and providing gutters.
   Use this class INSIDE a full-width element (like a header or footer) 
   whose background should span the entire screen. */
.content-wrapper {
    max-width: var(--max-content-width);
    width: 100%;
    margin: 0;
    padding: 0 var(--content-gutter); /* Applies horizontal gutter ONLY */
}

/* Core App Layout Fix: Center content and provide responsive padding */
main {
    /* Applies the max width and centers the entire main content block */
    max-width: var(--max-content-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--content-gutter); /* Vertical padding + horizontal gutter */
}

/* ==== Navigation ==== */
nav button {
  background-color: transparent;
  border: none;
  color: white;
  margin: 0 0.5rem;
  font-size: 1rem;
  cursor: pointer;
}

nav button:hover {
  color: var(--accent-green);
}

nav button.active {
  border-bottom: 2px solid var(--accent-green);
  font-weight: bold;
}

nav details {
  position: relative;
}

nav summary {
  cursor: pointer;
  list-style: none;
  background-color: transparent;
  color: white;
  font-weight: bold;
  border: 1px solid white;
  padding: 6px 12px;
  border-radius: 6px;
}

nav summary:hover {
  background: rgba(255, 255, 255, 0.2);
}

nav .dropdown {
  display: flex;
  flex-direction: column;
  background: var(--primary);
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  border: 1px solid #ccc;
  padding: 0.5rem;
  border-radius: 8px;
}

nav .dropdown button {
  background: transparent;
  color: white;
  border: none;
  padding: 6px;
  text-align: left;
  cursor: pointer;
}

nav .dropdown button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}


/* ==== Auth Tabs ==== */
#authTabs button {
  margin-right: 1rem;
}

/* ==== Logout Button ==== */
#logoutBtn {
  background-color: var(--accent-yellow);
  color: var(--text-dark);
  border: none;
  padding: 0.4rem 0.8rem;
  margin-left: auto;
  cursor: pointer;
  border-radius: 6px;
  font-weight: bold;
}

#logoutBtn:hover {
  background-color: #fdd95f;
}

/* ==== Page Header ==== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.page-header h1 {
  font-size: 1.8rem;
  color: var(--primary);
}

.page-header button {
  background-color: var(--highlight-orange);
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.page-header button:hover {
  background-color: #e68900;
}

.pagination button {
  background-color: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.budget-actions button,
.report-actions button,
.settings-section button,
.filter-bar button,
.tb-controls button,
.btn-primary,
.btn-secondary {
  background-color: var(--highlight-orange);
  color: #fff;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

/* ==== Filter Bar ==== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-bottom: 1em;
  align-items: center;
}

.filter-bar input,
.filter-bar select {
  padding: 6px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

/* ==== Table Controls ==== */
/* === FIXED: Transactions Page Layout === */
.transactions-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 0;
  max-width: 100%;
}

.transactions-wrapper h1 {
  font-size: 1.8rem;
  color: var(--primary);
  margin: 0 0 1rem 0;
  padding-left: 0.5rem;
}

.transaction-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
  width: 100%;
}

.transaction-controls input[type="date"],
.transaction-controls input[type="text"],
.transaction-controls button {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: white;
}

.transaction-controls button {
  background-color: var(--highlight-orange);
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.transaction-controls button:hover {
  background-color: #e68f00;
}

#transactionsTable {
  width: 100%;
  padding-left: 0.5rem;
}

#paginationControls {
  padding-left: 0.5rem;
}

.pagination {
  margin-top: 1rem;
  text-align: center;
}

.pagination button {
  margin: 0 5px;
  padding: 6px 12px;
}

.pagination-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.pagination-controls button {
  background-color: #d9d9d9;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
}

/* ==== Transaction Table ==== */
.transaction-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1em;
}

.transaction-table th,
.transaction-table td {
  border: 1px solid #ccc;
  padding: 8px;
  font-size: 14px;
  text-align: left;
}

.transaction-table th {
  background: #102A43;
  color: white;
}

.transaction-table tr:hover {
  background-color: #f9f9f9;
  background: #f3f3f3;
  cursor: pointer;
}

.transaction-table td {
  cursor: pointer;
}

/* ==== Dashboard Grid ==== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  padding: 1rem;
}

/* ==== Card Styles ==== */
.card {
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  padding: 1rem;
  transition: 0.3s ease-in-out;
}
.card h3 {
  font-size: 1rem;
  color: #102A43;
  margin-bottom: 0.5rem;
}
.card p {
  font-size: 1.25rem;
  color: #000;
}
.card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.card-actions button {
  padding: 4px 10px;
  font-size: 0.8rem;
  background-color: #d9d9d9;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

/* ==== Summary Card ==== */
.summary-card {
  background-color: var(--highlight-orange);
  color: #102A43;
  font-weight: bold;
  text-align: center;
}

/* ==== Chart Card ==== */
.chart-card canvas {
  max-width: 100%;
  height: 200px;
}

/* ==== List Card ==== */
.list-card ul {
  list-style: none;
  padding-left: 0;
  font-size: 0.95rem;
}
.list-card li {
  margin-bottom: 0.5em;
}

/* ==== Modal System (Standardized) ==== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(16, 42, 67, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal {
  background-color: white;
  color: var(--text-dark);
  width: 95%;
  max-width: 500px;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: fadeIn 0.3s ease-in-out;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-size: 1.5rem;
  color: var(--primary);
  text-align: center;
}

.modal h5 {
  opacity: 0;
  transform: translateY(10px);
  animation: fadeUp 0.6s ease-out forwards;
  animation-delay: 0.3s;  
  font-style: italic;
  text-align: center;
  font-size: 0.95rem;
  color: #555;
  margin-top: 0;          /* Remove top space */
  margin-bottom: 1rem;    /* Keep bottom space for separation */
}

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


.modal form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal input,
.modal select,
.modal textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

.modal button {
  background-color: #E6AC00;
  color: #102A43;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}

.modal button:hover {
  background-color: #d99b00;
}

.modal .close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 1.4rem;
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
}

.modal .close-btn:hover {
  color: #000;
}

.modal.hidden,
.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal.wide {
  max-width: 700px;
}

.modal ul {
  list-style: none;
  padding: 0;
}

.modal li {
  margin-bottom: 8px;
}


#clientForm input {
  width: 100%;
  padding: 10px;
  margin-bottom: 1rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

#clientForm button {
  background-color: #FB9C00;
  color: #102A43;
  padding: 10px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
}

#clientForm button:hover {
  background-color: #e6ac00;
}

#vendorList .card h3 {
  margin-bottom: 0.4rem;
}

textarea {
  width: 100%;
  min-height: 60px;
  font-family: inherit;
  padding: 0.6rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-bottom: 1rem;
}

nav {
  display: flex;
  flex: 1;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-left: 2rem;
}

.nav-left button,
.nav-right button {
  margin-right: 0.5rem;
}

.line-item {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.line-item input, .line-item select {
  flex: 1;
}

.recon-form {
  background: #fff;
  padding: 1rem;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.recon-form label {
  font-weight: bold;
  color: var(--text-dark);
}

.recon-form input,
.recon-form select {
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 1rem;
}

.recon-form button {
  background-color: var(--highlight-orange);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

/* ===== EMPLOYEE & PAYROLL PAGE STYLES ===== */
.employee-card {
  background-color: #fff;
  border-left: 5px solid var(--highlight-orange);
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#employeeList {
  margin: 1rem 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.export-buttons button {
  background-color: var(--highlight-orange);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
}

.export-buttons button:hover {
  background-color: #e68f00;
}

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
  align-items: center;
}

.filter-bar label {
  font-weight: bold;
  color: var(--primary);
  display: flex;
  flex-direction: column;
}

.filter-bar input[type="month"] {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

/* ===== TRANSACTION TABLE ===== */
.transaction-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
  background-color: white;
  border-radius: 10px;
  overflow: hidden;
}
.transaction-table th,
.transaction-table td {
  border: 1px solid #ddd;
  padding: 10px;
  font-size: 0.95rem;
  text-align: left;
}

.transaction-table th {
  background-color: var(--primary);
  color: white;
}

.transaction-table td button {
  background-color: var(--accent-yellow);
  color: var(--text-dark);
  padding: 5px 10px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.transaction-table td button:hover {
  background-color: #fcd24d;
}

/* ===== MODAL FORM FIELDS ===== */
.modal form label {
  font-weight: bold;
  color: var(--primary);
}
.modal form label input,
.modal form label select {
  margin-top: 4px;
}

/* ===== COA PAGE ===== */
#accountList {
  margin-top: 1.5rem;
}
#accountList .card {
  background: white;
  padding: 1rem;
  border-left: 4px solid var(--accent-green);
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
#accountList .card h3 {
  margin: 0;
  color: var(--primary);
}

/* ===== SUMMARY BOXES ===== */
.summary-box {
  background-color: var(--accent-green);
  color: white;
  padding: 1rem;
  text-align: center;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: bold;
}

/* ===== PAYSLIP PREVIEW (Optional if displaying in browser before PDF) ===== */
.payslip-preview {
  background: white;
  padding: 2rem;
  margin: 2rem auto;
  max-width: 600px;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  color: var(--text-dark);
}
.payslip-preview h2 {
  text-align: center;
  color: var(--primary);
  margin-bottom: 1.5rem;
}
.payslip-preview p {
  font-size: 1rem;
  margin-bottom: 0.8rem;
}
.payslip-preview .amount {
  font-weight: bold;
  font-size: 1.1rem;
}

.icon-btn {
  background: #f1f1f1;
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  font-size: 14px;
}
.icon-btn i {
  font-size: 16px;
  color: #102A43;
}
.icon-btn:hover {
  background: #ddd;
}

.icon-btn.danger i {
  color: #d72638;
}
.icon-btn.danger:hover {
  background: #fce8e8;
}

.icon-btn.info i {
  color: #008cba;
}
.icon-btn.info:hover {
  background: #e0f0ff;
}

/* ==== Dropdown Navigation Fixes ==== */
nav .nav-left details {
  position: relative;
}

nav .nav-left summary {
  cursor: pointer;
  list-style: none;
  background-color: transparent;
  color: white;
  font-weight: bold;
  border: 1px solid white;
  padding: 6px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

nav .nav-left summary::marker {
  display: none;
}

nav .nav-left summary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Keep header height fixed even when dropdown opens */
header {
  position: relative;
  z-index: 999;
}

nav .nav-left .dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--primary);
  border: 1px solid white;
  border-radius: 8px;
  padding: 0.5rem 0;
  min-width: 180px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

nav .nav-left .dropdown button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: white;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.95rem;
}

nav .nav-left .dropdown button:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Optional: adjust spacing */
.nav-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav-left,
.nav-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.nav-left details,
.nav-left button,
.nav-right button {
  margin: 0;
}

/* ==== Journal Page Layout ==== */
.journal-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 1rem 0;
  max-width: 100%;
}

.journal-wrapper h1 {
  font-size: 1.8rem;
  color: var(--primary);
  margin: 0 0 1rem 0;
  padding-left: 0.5rem;
}

.journal-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
  width: 100%;
}

.journal-controls button {
  background-color: var(--highlight-orange);
  color: white;
  font-weight: bold;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.journal-controls button:hover {
  background-color: #e68f00;
}

#journalTable {
  width: 100%;
  padding-left: 0.5rem;
}

.modal.journal-modal {
  max-width: 900px;
  width: 95%;
}

.journal-lines {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.journal-lines .line-item {
  display: grid;
  grid-template-columns: 1.2fr 2.5fr 1fr 1fr auto;
  gap: 0.5rem;
  align-items: center;
}

.journal-lines .line-item input,
.journal-lines .line-item select {
  padding: 8px;
  font-size: 0.95rem;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.journal-lines .line-item button {
  background-color: #ff4d4d;
  border: none;
  border-radius: 6px;
  color: white;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.journal-lines .line-item button:hover {
  background-color: #e03333;
}

.journal-totals {
  display: flex;
  justify-content: flex-end;
  gap: 2rem;
  margin-top: 1rem;
  font-weight: bold;
  color: var(--primary);
}

.wide-modal {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}
.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row label {
  flex: 1 1 200px;
}
.invoice-item {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.invoice-item input {
  flex: 1;
}
.invoice-item button {
  background: #ccc;
  border: none;
  padding: 0.3rem;
  cursor: pointer;
}

.wide-modal {
  width: 95vw;
  max-width: 1000px;
  background: #fff;
  padding: 1.5rem;
  border-radius: 8px;
}

.invoice-view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.invoice-logo {
  height: 50px;
  margin-bottom: 0.5rem;
}

.invoice-addresses {
  display: flex;
  justify-content: space-between;
  margin-top: 1rem;
}

.invoice-summary p {
  margin: 0.25rem 0;
  text-align: right;
}

.invoice-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

form#systemAccountsForm {
  max-width: 400px;
  margin-top: 20px;
}

form#systemAccountsForm label {
  display: block;
  margin-top: 10px;
  font-weight: bold;
}

form#systemAccountsForm select {
  width: 100%;
  padding: 5px;
  margin-bottom: 10px;
}

.highlight-system {
  background-color: #f9f9f9;
}

.auth-modal {
  max-width: 400px;
  text-align: center;
}

.auth-form input {
  width: 100%;
  padding: 10px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.auth-form button {
  width: 100%;
  padding: 10px;
  background: #0077cc;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 10px;
  font-weight: bold;
}

.auth-form button:hover {
  background: #005fa3;
}

.tabs {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: #f5f5f5;
  border: none;
  font-weight: bold;
  cursor: pointer;
}

.tab-btn.active {
  background: #0077cc;
  color: white;
}

.subheading {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
}

#trialBalanceTable {
    width: 80%;
    border-collapse: collapse;
    font-size: 14px;
}

#trialBalanceTable th, 
#trialBalanceTable td {
    border: 1px solid #ddd;
    padding: 6px 10px;
    text-align: right;
}

#trialBalanceTable th:first-child, 
#trialBalanceTable td:first-child {
    text-align: left;
}

#trialBalanceTable a {
    color: blue;
    text-decoration: underline;
    cursor: pointer;
}

/* Table container */
.invoice-table-container {
  margin: 20px auto;
  max-width: 1200px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Table styles */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 14px;
  color: #333;
}

/* Header */
.invoice-table thead {
  background: #f8f9fa;
  border-bottom: 2px solid #e3e6ea;
}

.invoice-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Rows */
.invoice-table tbody tr {
  border-bottom: 1px solid #e9ecef;
  transition: background-color 0.2s ease;
}

.invoice-table tbody tr:hover {
  background-color: #f1f3f5;
}

/* Cells */
.invoice-table td {
  padding: 12px 16px;
  vertical-align: middle;
}

/* Status badge */
.invoice-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.invoice-status.paid {
  background-color: #d4edda;
  color: #155724;
}

.invoice-status.unpaid {
  background-color: #fff3cd;
  color: #856404;
}

.invoice-status.overdue {
  background-color: #f8d7da;
  color: #721c24;
}

/* Action buttons */
.table-actions {
  display: flex;
  gap: 6px;
}

.table-actions button {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s;
}

.table-actions .view-btn {
  background: #e7f1ff;
  color: #0056b3;
}

.table-actions .view-btn:hover {
  background: #d0e4ff;
}

.table-actions .edit-btn {
  background: #f8f9fa;
  color: #495057;
}

.table-actions .edit-btn:hover {
  background: #e9ecef;
}

.table-actions .delete-btn {
  background: #f8d7da;
  color: #721c24;
}

.table-actions .delete-btn:hover {
  background: #f5c6cb;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */

/* ===========================
   Banking Forms
   =========================== */
form#receivePaymentForm,
form#payVendorForm {
  max-width: 700px;
  margin: 20px 0;
  padding: 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

form#receivePaymentForm h1,
form#payVendorForm h1 {
  font-size: 1.4rem;
  margin-bottom: 15px;
  color: #333;
}

/* Group spacing */
.form-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

/* Labels */
.form-group label {
  font-weight: 600;
  margin-bottom: 6px;
  color: #444;
}

/* Inputs, Selects, Textareas */
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  font-size: 0.95rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #007bff;
  outline: none;
}

/* Document lists (Invoices, Bills, Notes) */
#clientDocumentList,
#vendorDocumentList {
  background: #fafafa;
  border-radius: 6px;
  padding: 10px;
}

#clientDocumentList div,
#vendorDocumentList div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

#clientDocumentList label,
#vendorDocumentList label {
  font-size: 0.9rem;
  color: #333;
  margin-right: 10px;
  flex: 1;
}

.partial-payment-input {
  width: 120px;
  padding: 6px 8px;
  font-size: 0.9rem;
}

/* Buttons inside forms */
form#receivePaymentForm button[type="submit"],
form#payVendorForm button[type="submit"] {
  margin-top: 15px;
  padding: 10px 16px;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
}

/* ===========================
   Invoice / Credit Note Forms
   =========================== */

#invoiceForm {
  max-width: 800px;         /* keeps form from stretching too wide */
  margin: 20px 0 20px 40px; /* left-aligned with some indent */
  padding: 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

#invoiceForm h3 {
  margin-top: 20px;
  font-size: 1.2em;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

/* Form groups */
#invoiceForm .form-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

#invoiceForm .form-group label {
  font-weight: 600;
  margin-bottom: 5px;
}

#invoiceForm input[type="text"],
#invoiceForm input[type="number"],
#invoiceForm input[type="date"],
#invoiceForm select,
#invoiceForm textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}

#invoiceForm textarea {
  resize: vertical;
}

/* Invoice Items */
#invoiceItemsContainer {
  margin-top: 10px;
}

.invoice-item-row {
  display: grid;
  grid-template-columns: 2.5fr 0.3fr 0.8fr 0.8fr 0.5fr 0.2fr;
  gap: 10px;
  margin-bottom: 10px;
}

.invoice-item-row input {
  padding: 6px 8px;
}

.invoice-item-row .btn-danger {
  align-self: center;
  height: 36px;
  padding: 0 12px;
  color: red;
}

/* Summary section */
#invoiceForm .summary {
  margin: 15px 0;
  font-weight: 600;
}

/* Checkbox group */
#invoiceForm .checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Button group */
#invoiceForm .button-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ===========================
   Bill / Debit Note Forms
   =========================== */

#billForm {
  max-width: 800px;         /* keeps form from stretching too wide */
  margin: 20px 0 20px 40px; /* left-aligned with some indent */
  padding: 20px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

#billForm h3 {
  margin-top: 20px;
  font-size: 1.2em;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

/* Form groups */
#billForm .form-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

#billForm .form-group label {
  font-weight: 600;
  margin-bottom: 5px;
}

#billForm input[type="text"],
#billForm input[type="number"],
#billForm input[type="date"],
#billForm select,
#billForm textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}

#billForm textarea {
  resize: vertical;
}

/* Bill Items */
#invoiceItemsContainer {
  margin-top: 10px;
}

.bill-item-row {
  display: grid;
  grid-template-columns: 2.5fr 0.3fr 0.8fr 0.8fr 0.5fr 0.2fr;
  gap: 10px;
  margin-bottom: 10px;
}

.bill-item-row input {
  padding: 6px 8px;
}

.bill-item-row .btn-danger {
  align-self: center;
  height: 36px;
  padding: 0 12px;
  color: red;
}

/* Summary section */
#billForm .summary {
  margin: 15px 0;
  font-weight: 600;
}

/* Checkbox group */
#billForm .checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Button group */
#billForm .button-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* invoice-styles.css */
/* This stylesheet provides a clean, professional look for invoices,
   specifically designed for PDF and print exports. */

.invoice-pdf-container {
    font-family: 'Inter', Arial, sans-serif;
    padding: 2.5rem;
    color: #333;
    line-height: 1.6;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1rem;
}

.invoice-logo img {
    max-height: 80px;
    max-width: 200px;
    object-fit: contain;
}

.invoice-title {
    font-size: 2.0rem;
    font-weight: 700;
    color: #4f46e5;
    margin: 0;
    text-align: right;
}

.invoice-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.invoice-info div {
    flex-basis: 48%;
}

.invoice-info strong {
    color: #1e293b;
    font-weight: 600;
}

.invoice-info pre {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 1rem;
    margin: 0.5rem 0 0 0;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

.invoice-table th,
.invoice-table td {
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    text-align: left;
}

.invoice-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: #475569;
}

.invoice-table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

.invoice-summary {
    margin-top: 2rem;
    text-align: right;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    font-size: 1.1rem;
}

.invoice-summary p {
    margin: 0.5rem 0;
}

.invoice-summary .grand-total {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
    border-top: 2px solid #1e293b;
    padding-top: 0.5rem;
    margin-top: 1rem;
}

.invoice-notes {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: #64748b;
}

.invoice-notes strong {
    color: #334155;
}

/* Print-specific adjustments */
@media print {
    body {
        margin: 0;
        padding: 0;
        -webkit-print-color-adjust: exact;
    }
    .invoice-pdf-container {
        box-shadow: none;
    }
}

#balanceOutput {
  max-width: 900px;
  margin: 0;
  padding-left: 0.5rem; /* optional: adjust as needed */
}


