html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: #17202a;
  background: #f6f7f9;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: #0f6c68;
}

a:hover {
  color: #0a4e4a;
}

.app-shell {
  padding-bottom: 64px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e5e9ef;
  box-shadow: 0 8px 24px rgba(24, 37, 52, 0.06);
  backdrop-filter: blur(10px);
}

.app-navbar {
  padding: 0.75rem 0;
}

.app-navbar-container {
  gap: 1rem;
  max-width: 1240px;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: #17202a;
  font-weight: 750;
  letter-spacing: 0;
}

.app-brand:hover {
  color: #17202a;
}

.app-brand-mark {
  display: inline-grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  color: #fff;
  background: #0f6c68;
  border-radius: 0.5rem;
  box-shadow: 0 8px 18px rgba(15, 108, 104, 0.22);
}

.app-navbar-toggler {
  border: 1px solid #d9e0e8;
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
}

.app-nav {
  gap: 0.25rem;
}

.app-nav .nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.7rem;
  color: #536171;
  border-radius: 0.5rem;
  font-weight: 600;
}

.app-nav .nav-link:hover,
.app-nav .nav-link.active {
  color: #0f3f3d;
  background: #e8f3f2;
}

.app-user-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}

.app-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.35rem;
  max-width: 220px;
  padding: 0.25rem 0.7rem 0.25rem 0.25rem;
  color: #17202a;
  background: #fff;
  border: 1px solid #dfe5ec;
  border-radius: 999px;
  text-decoration: none;
}

.app-user-pill:hover {
  color: #17202a;
  border-color: #b9c8d4;
}

.app-user-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  color: #fff;
  background: #2b5f8a;
  border-radius: 50%;
  font-weight: 700;
}

.app-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.35rem;
}

.app-main-container {
  max-width: 1180px;
  padding-top: 1.25rem;
}

.app-main-container-wide {
  max-width: 1440px;
}

.app-form-card {
  width: 100%;
}

.app-form-fields {
  max-width: 860px;
  margin: 0 auto;
}

.app-form-fields-wide {
  max-width: 980px;
}

.app-footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  min-height: 48px;
  padding: 0.8rem 0;
  background: #fff;
  border-top: 1px solid #e5e9ef;
}

.page-kicker {
  margin-bottom: 0.25rem;
  color: #647587;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  margin: 0;
  color: #17202a;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 760;
  letter-spacing: 0;
}

.page-subtitle {
  max-width: 760px;
  margin: 0.5rem 0 0;
  color: #647587;
}

.app-surface {
  background: #fff;
  border: 1px solid #e5e9ef;
  border-radius: 0.5rem;
  box-shadow: 0 14px 35px rgba(24, 37, 52, 0.06);
}

.table.app-table {
  margin-bottom: 0;
  vertical-align: middle;
}

.table.app-table thead th {
  color: #536171;
  background: #f8fafb;
  border-bottom: 1px solid #e5e9ef;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table.app-table td,
.table.app-table th {
  padding: 0.85rem 0.9rem;
}

.table-action-buttons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-width: max-content;
}

.table-action-buttons .btn {
  display: inline-grid;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  place-items: center;
  padding: 0;
}

.record-detail-link {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  max-width: 100%;
  color: #0f6c68;
  font-weight: 720;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.record-detail-link:hover {
  color: #0a4e4a;
  text-decoration: underline;
}

.record-detail-link-mobile {
  min-height: 2.35rem;
  font-size: 0.98rem;
}

.table-utility-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.table-search-box {
  position: relative;
  width: min(100%, 360px);
}

.table-search-box i {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  color: #7a8794;
  transform: translateY(-50%);
  pointer-events: none;
}

.table-search-box .form-control {
  padding-left: 2.2rem;
}

.list-filter-panel {
  padding: 1rem;
  box-shadow: none;
}

.list-filter-actions {
  display: flex;
  gap: 0.5rem;
}

.list-filter-actions .btn-primary {
  flex: 1 1 auto;
}

.invoice-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid #dee2e6;
  padding-bottom: 0.5rem;
}

.invoice-section-heading h5 {
  margin: 0;
  color: #6c757d;
}

.invoice-section-heading .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.quick-line-item-tax {
  display: flex;
  align-items: end;
  padding-bottom: 0.45rem;
}

.empty-state {
  display: grid;
  gap: 0.4rem;
  place-items: center;
  padding: 2rem 1rem;
  color: #647587;
  text-align: center;
  background: #fff;
  border: 1px dashed #cfd8e3;
  border-radius: 0.5rem;
}

.empty-state i {
  color: #9aa8b6;
  font-size: 2rem;
}

.empty-state p {
  margin: 0;
}

.invoice-line-items {
  width: 100%;
}

.invoice-tax-marker {
  color: #c2410c;
  font-weight: 800;
}

.invoice-line-item-cards {
  display: grid;
  gap: 0.75rem;
}

.invoice-line-item-card {
  padding: 0.85rem;
  background: #fff;
  border: 1px solid #e5e9ef;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(24, 37, 52, 0.05);
}

.invoice-line-item-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.invoice-line-item-card-header h6 {
  margin: 0.2rem 0 0;
  font-size: 0.98rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.invoice-line-item-card-header strong {
  flex: 0 0 auto;
  color: #0f3f3d;
}

.invoice-line-item-count {
  color: #647587;
  font-size: 0.78rem;
  font-weight: 700;
}

.invoice-line-item-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 0.85rem;
}

.invoice-line-item-card-grid span,
.invoice-total-row span {
  display: block;
  color: #647587;
  font-size: 0.78rem;
  font-weight: 700;
}

.invoice-line-item-card-grid strong {
  display: block;
  margin-top: 0.15rem;
  overflow-wrap: anywhere;
}

.invoice-line-item-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.invoice-line-item-card-actions .btn {
  flex: 1 1 0;
}

.invoice-totals {
  padding: 0.85rem;
}

.invoice-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid #edf1f5;
}

.invoice-total-row:last-child {
  border-bottom: 0;
}

.invoice-total-row strong {
  color: #17202a;
  text-align: right;
}

.invoice-total-row-grand {
  padding-top: 0.7rem;
}

.invoice-total-row-grand span,
.invoice-total-row-grand strong {
  color: #0f3f3d;
  font-size: 1rem;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

@media (max-width: 1199.98px) {
  .app-navbar-container {
    align-items: flex-start;
  }

  .app-navbar .navbar-collapse {
    width: 100%;
    padding-top: 0.85rem;
  }

  .app-nav .nav-link {
    width: 100%;
  }

  .app-user-actions {
    align-items: stretch;
    flex-direction: column;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e9ef;
  }

  .app-user-pill,
  .app-logout-btn {
    justify-content: center;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 575.98px) {
  .app-main-container {
    padding-top: 0.85rem;
  }

  .page-title {
    font-size: 1.35rem;
  }

  .table-utility-bar,
  .list-filter-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .table-search-box {
    width: 100%;
  }

  .invoice-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-section-heading .btn {
    justify-content: center;
  }
}
