/* Public landing page */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --primary: #2e7d32;
  --primary-light: #4caf50;
  --secondary: #f57c00;
  --dark: #212121;
  --light: #f9f9f9;
  --white: #ffffff;
}

body {
  background-color: var(--light);
  color: var(--dark);
  line-height: 1.6;
}

header {
  background: var(--white);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.logo-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 24px;
  font-weight: bold;
  color: var(--primary);
  text-decoration: none;
}

.logo-link img {
  height: 70px;
}

.logo-link span {
  color: var(--secondary);
}

.nav-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  list-style: none;
  gap: 12px 20px;
  min-width: 0;
}

.nav-menu li {
  white-space: nowrap;
}

.nav-menu a {
  text-decoration: none;
  color: var(--dark);
  font-weight: 600;
  transition: color 0.3s;
}

.nav-menu a:hover,
.nav-button:hover {
  color: var(--primary);
}

.nav-menu li form {
  margin: 0;
}

.nav-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--dark);
  cursor: pointer;
}

.org-switcher {
  max-width: 100%;
}

.org-switcher select {
  border: 1px solid #c8e6c9;
  border-radius: 6px;
  padding: 6px 10px;
  max-width: 100%;
  font: inherit;
  font-weight: 600;
  color: var(--dark);
  background: var(--white);
  cursor: pointer;
}

.flash {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
}

.flash-notice {
  background: #e8f5e9;
  color: #1b5e20;
}

.flash-alert {
  background: #ffebee;
  color: #b71c1c;
}

.auth-page {
  padding: 40px 20px 80px;
}

.auth-card .section-title {
  margin-bottom: 24px;
}

.auth-card .contact-form {
  margin-bottom: 8px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.remember-me input {
  width: auto;
}

.field-hint {
  color: #666;
  font-size: 14px;
  margin-bottom: 6px;
}

.form-errors {
  background: #ffebee;
  color: #b71c1c;
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.form-errors ul {
  margin: 8px 0 0 18px;
}

.auth-links {
  text-align: center;
  margin-top: 16px;
}

.auth-links a {
  color: var(--primary);
  font-weight: 600;
}

.hero {
  background: linear-gradient(rgba(46, 125, 50, 0.8), rgba(0, 0, 0, 0.6)),
    url("https://unsplash.com") no-repeat center center / cover;
  height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--white);
  padding: 20px;
}

.hero-content h1 {
  font-size: 48px;
  margin-bottom: 20px;
}

.hero-content p {
  font-size: 18px;
  max-width: 600px;
  margin: 0 auto 30px auto;
}

.btn {
  background: var(--secondary);
  color: var(--white);
  padding: 12px 30px;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  transition: background 0.3s;
  border: none;
  cursor: pointer;
}

.btn:hover {
  background: #e65100;
}

.btn-block {
  width: 100%;
}

section {
  padding: 60px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 40px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.card {
  background: var(--white);
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  text-align: center;
  border-top: 4px solid var(--primary);
}

.card h3 {
  margin: 15px 0;
  color: var(--primary);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

.product-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  text-align: center;
  border-top: 4px solid var(--primary);
}

.product-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  background: #eee;
}

.product-card h3 {
  margin: 0;
  padding: 16px;
  color: var(--primary);
  font-size: 18px;
}

.about {
  background-color: var(--white);
  max-width: 100%;
  padding: 60px 0;
}

.about-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.about-container {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: center;
}

.about-text {
  flex: 1;
  min-width: 300px;
}

.about-text p {
  margin-top: 15px;
}

.about-img {
  flex: 1;
  min-width: 300px;
  width: 100%;
  height: 350px;
  object-fit: cover;
  border-radius: 8px;
}

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

.contact-form {
  max-width: 600px;
  margin: 0 auto;
  background: var(--white);
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.form-group {
  margin-bottom: 20px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.data-table th {
  background: #f1f8f2;
  color: var(--primary);
  font-size: 14px;
}

.data-table a {
  color: var(--dark);
  font-weight: 600;
  text-decoration: none;
}

.data-table a:hover,
.row-actions a {
  color: var(--primary);
}

.inventory-import {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 8px;
  flex-wrap: wrap;
}

.inventory-import label {
  font-weight: 600;
}

.inventory-import select {
  min-width: 240px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.stock-item-search {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stock-item-search label {
  font-weight: 600;
}

.stock-item-search input[type="text"] {
  flex: 1;
  max-width: 420px;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
}

.pagination a {
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-actions-start {
  justify-content: flex-start;
  margin-top: 24px;
}

.page-actions form {
  margin: 0;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.row-actions form {
  margin: 0;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #c62828;
  cursor: pointer;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.badge-active {
  background: #e8f5e9;
  color: #1b5e20;
}

.badge-inactive {
  background: #eeeeee;
  color: #616161;
}

.inventory-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 24px;
}

.inventory-nav a {
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--dark);
  text-decoration: none;
  font-weight: 600;
  border: 1px solid #c8e6c9;
}

.inventory-nav a.is-current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.summary-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--dark);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.summary-card strong {
  font-size: 20px;
  color: var(--primary);
}

.summary-card span {
  color: #555;
}

.inventory-form {
  max-width: 860px;
}

.invoice-voucher-form {
  max-width: 80%;
}

section:has(.invoice-voucher-form) {
  max-width: none;
}

.invoice-block {
  margin: 20px 0;
  padding: 16px 16px 4px;
  background: #f7fbf7;
  border: 1px solid #c8e6c9;
  border-radius: 8px;
}

.invoice-block h2 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #c8e6c9;
  font-size: 16px;
}

.invoice-block-total {
  margin: 4px 0 12px;
}

.gst-duty-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 140px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.gst-duty-row label {
  margin: 0;
  font-weight: 600;
}

.bill-party-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 8px;
  font-weight: 700;
}

.bill-ref-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px 120px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.bill-ref-row select,
.bill-ref-row input {
  width: 100%;
  min-width: 0;
}

.gst-duty-row .ledger-combo {
  min-width: 0;
}

.qty-negative {
  color: #c62828;
  font-weight: 600;
}

.detail-card {
  max-width: 600px;
  margin: 0 auto;
  background: var(--white);
  padding: 32px 40px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.detail-card p {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.detail-card p:last-child {
  border-bottom: none;
}

.empty-state {
  text-align: center;
  color: #666;
}

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

.btn-secondary:hover {
  background: #1b5e20;
}

.btn-danger {
  background: #c62828;
}

.btn-danger:hover {
  background: #b71c1c;
}

footer {
  background: var(--primary);
  color: var(--white);
  text-align: center;
  padding: 20px;
  margin-top: 40px;
}

@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px;
  }

  .logo-link {
    justify-content: center;
  }

  .logo-link img {
    height: 52px;
  }

  .nav-menu {
    justify-content: center;
    gap: 10px 16px;
  }

  .org-switcher {
    flex: 1 1 100%;
    display: flex;
    justify-content: center;
  }

  .org-switcher form,
  .org-switcher select {
    width: 100%;
    max-width: 280px;
  }

  .hero-content h1 {
    font-size: 32px;
  }

  .hero-content p {
    font-size: 16px;
  }

  section {
    padding: 40px 15px;
  }

  section.about {
    padding: 60px 0;
  }

  .contact-form {
    padding: 16px;
  }

  .invoice-voucher-form {
    max-width: none;
  }

  .table-wrap {
    overflow-x: visible;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table {
    background: transparent;
    box-shadow: none;
  }

  .data-table thead,
  .data-table tr[hidden],
  .data-table td[hidden],
  .data-table th[hidden] {
    display: none !important;
  }

  .data-table tr {
    margin-bottom: 16px;
    background: var(--white);
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
  }

  .data-table td {
    border-bottom: 1px solid #eee;
    padding: 10px 12px;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
  }

  .data-table td .ledger-combo,
  .data-table td input,
  .data-table td select,
  .data-table td textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .data-table td .ledger-combo {
    min-width: 0;
  }

  .data-table td:not([data-label]) {
    text-align: right;
  }

  .gst-duty-row,
  .bill-ref-row {
    grid-template-columns: 1fr;
  }
}

.ledger-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ledger-combo {
  position: relative;
  min-width: 12rem;
}

.ledger-combo-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: var(--white);
}

.ledger-combo-menu {
  z-index: 40;
  max-height: 220px;
  overflow: auto;
  background: var(--white);
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.ledger-option,
.ledger-add {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.ledger-option.is-active,
.ledger-add.is-active,
.ledger-option:hover,
.ledger-add:hover {
  background: #e8f5e9;
}

.ledger-add {
  color: var(--primary);
  font-weight: 600;
  border-top: 1px solid #eee;
}

.ledger-dialog {
  width: min(480px, calc(100% - 32px));
  border: 0;
  border-radius: 8px;
  padding: 24px;
}

.ledger-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.ledger-dialog h2 {
  margin-bottom: 16px;
}

.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  margin: 0 0 20px;
}

.report-filters label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
}

.data-table tr.bill-settlement td {
  background: #f7fbf7;
}

.year-report {
  margin-top: 32px;
}

.year-report h2,
.year-report h3 {
  margin-bottom: 8px;
}
