:root {
  --sidebar-width: 260px;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f9;
}

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 0;
  background: linear-gradient(135deg, var(--marsaw-primary, #0d6efd) 0%, #1a1a2e 100%);
}

.auth-page-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 2rem 1rem 1rem;
}

.auth-login-center {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: center;
}

.auth-page .brand-logo {
  width: auto;
  max-width: min(280px, 85vw);
  max-height: 120px;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  display: block;
}

.app-footer-copyright--auth {
  width: 100%;
  margin-top: auto;
  text-align: center;
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.12);
}

.app-footer-copyright--auth .footer-link {
  color: #fff;
}

.app-footer-copyright--auth .footer-link:hover {
  color: #fff;
  opacity: 0.85;
  text-decoration: underline;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: 1rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
}

.sidebar-brand {
  width: 100%;
  padding: 0 0.35rem;
}

.brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: var(--sidebar-logo-width, 180px);
  margin: 0 auto 0.65rem;
  overflow: hidden;
}

.brand-logo {
  display: block;
  width: var(--sidebar-logo-width, 180px);
  max-width: 100%;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

.brand-text {
  font-size: calc(0.9rem - 4px);
  font-weight: 600;
  line-height: 1.3;
  margin-top: 15px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  padding: 0 0.15rem;
}

.sidebar-divider {
  margin: 0 0 0.75rem;
  opacity: 0.2;
}

.app-wrapper {
  min-height: 100vh;
  width: 100%;
}

.sidebar-desktop {
  width: var(--sidebar-width);
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  flex-shrink: 0;
}

.sidebar-dark .sidebar-desktop,
.sidebar-offcanvas-dark {
  background: #1e293b;
  color: #e2e8f0;
}

.sidebar-dark .sidebar-desktop .nav-link,
.sidebar-offcanvas-dark .nav-link {
  color: #cbd5e1;
}

.sidebar-dark .sidebar-desktop .nav-link.active,
.sidebar-dark .sidebar-desktop .nav-link:hover,
.sidebar-offcanvas-dark .nav-link.active,
.sidebar-offcanvas-dark .nav-link:hover {
  background: var(--marsaw-primary, #0d6efd);
  color: #fff;
}

.sidebar-light .sidebar-desktop,
.sidebar-offcanvas-light {
  background: #fff;
}

.sidebar-light .sidebar-desktop {
  border-right: 1px solid #dee2e6;
}

.sidebar-light .sidebar-desktop .nav-link.active,
.sidebar-offcanvas-light .nav-link.active {
  background: var(--marsaw-primary, #0d6efd);
  color: #fff;
}

.sidebar-offcanvas {
  width: min(300px, 88vw);
}

.sidebar-offcanvas-light .offcanvas-header {
  background: #fff;
}

.sidebar-offcanvas-dark .offcanvas-header {
  background: #1e293b;
  color: #e2e8f0;
}

.mobile-user-block {
  margin-top: auto;
  padding-top: 0.5rem;
}

.sidebar-offcanvas-light .mobile-user-block .btn-outline-light {
  color: #212529;
  border-color: #dee2e6;
}

.brand-link,
.brand-text {
  color: inherit;
}

.main-content {
  min-width: 0;
  min-height: 100vh;
  background: #f4f6f9;
}

.app-footer-copyright {
  margin-top: auto;
  line-height: 1.6;
}

.app-footer-copyright .footer-link {
  color: inherit;
  text-decoration: none;
}

.app-footer-copyright .footer-link:hover {
  color: var(--marsaw-primary, #0d6efd);
  text-decoration: underline;
}

@media (max-width: 576px) {
  .app-footer-copyright {
    font-size: 0.75rem;
  }
}

.btn-primary,
.nav-pills .nav-link.active {
  background-color: var(--marsaw-primary, #0d6efd) !important;
  border-color: var(--marsaw-primary, #0d6efd) !important;
}

.btn-outline-primary {
  color: var(--marsaw-primary, #0d6efd);
  border-color: var(--marsaw-primary, #0d6efd);
}

.btn-outline-primary:hover {
  background: var(--marsaw-primary, #0d6efd);
  border-color: var(--marsaw-primary, #0d6efd);
}

.stat-card {
  border: none;
  border-radius: 0.75rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card-link {
  display: block;
  color: inherit;
}

.stat-card-link:hover {
  color: inherit;
}

.stat-card-link:hover .stat-card {
  transform: translateY(-2px);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

.quote-line-card {
  border-color: rgba(0, 0, 0, 0.08);
}

.quote-line-card .quote-line-title {
  font-weight: 600;
}

.stat-card-primary {
  background-color: color-mix(in srgb, var(--marsaw-primary, #0d6efd) 20%, #fff);
}

.stat-card-success {
  background-color: rgba(var(--bs-success-rgb), 0.2);
}

.stat-card-warning {
  background-color: rgba(var(--bs-warning-rgb), 0.2);
}

.stat-card-danger {
  background-color: rgba(var(--bs-danger-rgb), 0.2);
}

.card-value-cost {
  background-color: color-mix(in srgb, var(--marsaw-primary, #0d6efd) 10%, #fff);
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.06);
}

.card-value-sale {
  background-color: color-mix(in srgb, var(--bs-warning, #ffc107) 10%, #fff);
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.06);
}

.card-net-profit {
  background-color: color-mix(in srgb, var(--bs-success, #198754) 10%, #fff);
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.06);
}

.stat-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.table-products th {
  white-space: nowrap;
  font-size: 0.85rem;
}

.table-products td {
  vertical-align: middle;
  font-size: 0.9rem;
}

.product-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 0.25rem;
  background: #e9ecef;
}

.filter-panel {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.04);
}

.filter-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-weight: 500;
}

.filter-toggle-btn:not(.collapsed) .filter-toggle-icon {
  transform: rotate(180deg);
}

.filter-toggle-icon {
  transition: transform 0.2s ease;
}

.filter-panel-collapse {
  width: 100%;
}

.filter-panel-form {
  margin-top: 0.75rem;
  grid-template-columns: 1fr 1fr;
  align-items: end;
}

.filter-field-search,
.filter-field-actions {
  grid-column: 1 / -1;
}

.filter-field-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 10px;
}

.filter-field-actions .btn {
  flex: 1 1 0;
}

.filter-panel-form .form-label {
  margin-bottom: 0.2rem;
  white-space: nowrap;
}

@media (min-width: 992px) {
  .filter-panel-collapse {
    display: block !important;
    height: auto !important;
    visibility: visible;
  }

  .filter-panel-form {
    margin-top: 0;
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: flex-end !important;
    grid-template-columns: none !important;
    width: 100%;
  }

  .filter-panel-form .filter-field {
    width: auto;
    grid-column: auto !important;
  }

  .filter-field-search {
    flex: 1 1 8rem;
    min-width: 6rem;
    max-width: 14rem;
  }

  .filter-field-select {
    flex: 0 0 6.75rem;
    min-width: 6.75rem;
  }

  .filter-field-sort {
    flex: 0 0 8.25rem;
    min-width: 8.25rem;
  }

  .filter-field-actions {
    flex: 0 0 auto;
    display: flex !important;
    flex-direction: row;
    gap: 0.35rem;
    margin-top: 0;
  }

  .filter-field-actions .btn {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .filter-panel-form .form-control-sm,
  .filter-panel-form .form-select-sm {
    width: 100%;
  }
}

.product-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 0.5rem;
}

.product-toolbar-main {
  flex: 1 1 100%;
}

.product-toolbar-form {
  display: contents;
}

.product-toolbar-main > .product-toolbar-btn,
.product-toolbar-form .product-toolbar-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  font-size: 0.8125rem;
}

@media (min-width: 768px) {
  .product-toolbar-main {
    flex: 1 1 auto;
    max-width: 42rem;
  }

  .product-toolbar-main > .product-toolbar-btn,
  .product-toolbar-form .product-toolbar-btn {
    font-size: 0.875rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

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

  .main-content {
    width: 100%;
    max-width: 100%;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
  }

  .content-area {
    padding: 1rem !important;
  }
}
