/* Product overrides. Replace brand colors in .env; replace assets under static/brand. */
a {
  color: var(--brand-primary);
}
.sidebar,
.stat.emphasis {
  background: var(--brand-secondary);
}
.btn-primary {
  --bs-btn-bg: var(--brand-primary);
  --bs-btn-border-color: var(--brand-primary);
  --bs-btn-hover-bg: var(--brand-primary);
  --bs-btn-hover-border-color: var(--brand-primary);
}
.btn-primary:hover {
  filter: brightness(0.92);
}
.bar {
  background: var(--brand-primary);
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}
.data-card {
  padding: 21px;
  min-width: 0;
}
.data-card h2 {
  font-size: 16px;
  margin: 0;
  overflow-wrap: anywhere;
}
.data-card-header {
  display: flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
  margin-bottom: 17px;
}
.record-details {
  margin: 0;
}
.record-details > div {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 9px 0;
  border-bottom: 1px solid #edf1f6;
}
.record-details dt {
  font-size: 13px;
  color: #7d8d9f;
  font-weight: 400;
  flex: 1;
}
.record-details dd {
  font-size: 14px;
  text-align: right;
  margin: 0;
  flex: 1.3;
  overflow-wrap: anywhere;
}
.record-details .key dd {
  font-weight: 650;
  font-size: 17px;
}
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 18px;
}
.record-actions .btn {
  flex: 1;
  font-size: 13px;
}
.list-pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  padding: 24px;
  font-size: 13px;
  color: #788b9f;
}
.page-batch + .page-batch {
  margin-top: 17px;
}
.filterbar {
  flex-wrap: wrap;
}
.filterbar > input[type="search"] {
  max-width: 360px;
}
.filterbar .form-select {
  max-width: 200px;
}
.custom-dates {
  display: flex;
  gap: 12px;
}
.custom-dates[hidden] {
  display: none;
}
.custom-dates label {
  font-size: 12px;
}
.filter-party {
  min-width: 230px;
  max-width: 400px;
}
.lookup-results {
  position: absolute;
  z-index: 20;
  background: white;
  box-shadow: 0 12px 30px #243c5625;
  border: 1px solid #d9e2ee;
  border-radius: 7px;
  max-height: 280px;
  overflow: auto;
  width: 100%;
  padding: 6px;
}
.lookup-results button {
  display: block;
  width: 100%;
  background: white;
  border: 0;
  text-align: left;
  padding: 12px;
  font-size: 14px;
  color: #344f69;
  border-radius: 5px;
}
.lookup-results button:hover,
.lookup-results button:focus {
  background: #edf3ff;
}
.remote-field {
  position: relative;
  min-width: 0;
}
.remote-search {
  margin-bottom: 7px;
}
.remote-field select {
  width: 100%;
  max-width: none !important;
}
.line-editor {
  padding: 21px;
  border-bottom: 1px solid #e5eaf0;
}
.line-editor.line-removed {
  opacity: 0.5;
}
.line-delete {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: #ad4e42;
}
.line-delete input {
  width: 17px;
  height: 17px;
}
.record-form {
  max-width: 1100px;
}
.confirmation {
  max-width: 700px;
}
.chart-live {
  padding-top: 25px;
  height: 270px;
  overflow: auto;
}
.chart-live .bars {
  min-width: 420px;
}
.bar-month {
  font-size: 10px;
  white-space: nowrap;
}
.dashboard-section {
  margin: 32px 0;
}
.dashboard-section > h2 {
  margin-bottom: 20px;
}
.stat-value {
  overflow-wrap: anywhere;
  font-size: 1.55rem;
}
.stat {
  color: var(--ink);
}
.auth-shell .row > div {
  width: 100%;
}
.scrim {
  border: 0;
}
.errorlist {
  padding-left: 18px;
  font-size: 13px;
  color: #ab3e3e;
}
.surface-body .form-control,
.surface-body .form-select {
  max-width: 100%;
}
@media (max-width: 1200px) {
  .records-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 767px) {
  .records-grid {
    grid-template-columns: 1fr;
  }
  .data-card {
    padding: 18px;
  }
  .record-actions .btn {
    min-height: 44px;
  }
  .filterbar > input[type="search"],
  .filter-party {
    max-width: none;
    width: 100%;
  }
  .filterbar .form-select {
    max-width: none;
  }
  .custom-dates {
    width: 100%;
  }
  .custom-dates label {
    flex: 1;
    min-width: 0;
  }
  .topbar .user-link {
    display: none;
  }
  .topbar form .btn {
    font-size: 12px;
  }
  .main .stat-value {
    font-size: 1.3rem;
  }
  .list-pagination {
    padding: 20px 8px;
  }
  .record-details dd {
    font-size: 14px;
  }
  .auth-shell {
    margin: 20px 15px;
  }
  .content {
    padding: 23px 16px;
  }
}
@media print {
  .record-actions,
  .list-pagination,
  .filterbar {
    display: none;
  }
  .records-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 991px) {
  .nav-open .sidebar {
    transform: translateX(0);
  }
  .nav-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: #10223875;
    z-index: 35;
  }
}

/* Approved HTML parity: only progressive controls require extra styling. */
.remote-field [data-native-select] {
  position: absolute;
  width: 1px !important;
  height: 1px;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  padding: 0;
  border: 0;
}
.remote-toggle {
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  min-height: 43px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.remote-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 5px);
  width: 100%;
  min-width: 200px;
  z-index: 50;
  background: #fff;
  border: 1px solid #d9e2ee;
  border-radius: 7px;
  box-shadow: 0 12px 30px #243c5625;
  padding: 8px;
}
.remote-panel [data-lookup-results] {
  max-height: 240px;
  overflow: auto;
}
.remote-panel .remote-search {
  margin-bottom: 5px;
}
.remote-panel .lookup-option,
.remote-panel .lookup-more,
.remote-clear {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  background: white;
  color: var(--ink);
  font-size: 14px;
  border-radius: 4px;
}
.remote-panel .lookup-option:hover,
.remote-panel .lookup-option:focus {
  background: #edf3ff;
}
.remote-clear {
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  margin-top: 5px;
}
.remote-panel[hidden],
[data-line-row][hidden],
[data-local-tax][hidden],
[data-interstate-tax][hidden] {
  display: none !important;
}
.line-card .remote-toggle {
  min-height: 43px;
  padding: 9px 26px 9px 10px;
}
.line-card .errorlist {
  margin: 4px 0 0;
  padding-left: 14px;
}
.sidebar-footer {
  display: flex;
  gap: 12px;
  align-items: center;
}
.sidebar-footer svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.sidebar-footer small {
  display: block;
  font-size: 10px;
  opacity: 0.6;
}
.icon-btn svg {
  width: 19px;
  height: 19px;
}
@media (max-width: 767px) {
  .line-card .remote-panel {
    min-width: 0;
  }
  .line-fields .line-desc {
    min-width: 0;
  }
}

.sidebar-footer > span {
  font-size: 12px;
}
.icon-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 5px;
  border-radius: 5px;
}

/* Desktop rows and mobile cards use the same paginated records. */
.responsive-cards {
  display: none;
}
.responsive-table {
  min-width: 0;
}
.responsive-table table {
  width: 100%;
}
.responsive-table td {
  overflow-wrap: anywhere;
  max-width: 300px;
}
.responsive-table .record-actions {
  margin: 0;
  justify-content: flex-end;
  gap: 6px;
}
.responsive-table .record-actions .btn {
  padding: 5px 8px;
  font-size: 12px;
}
.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}
.page-batch + .page-batch {
  margin-top: 12px;
}
@media screen and (max-width: 767px) {
  .responsive-table {
    display: none;
  }
  .responsive-cards {
    display: grid;
  }
}
@media print {
  .responsive-table {
    display: block;
  }
  .responsive-cards {
    display: none;
  }
}

.spec-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px;
  gap: 14px;
  align-items: end;
  margin-bottom: 12px;
}
.spec-row label {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.spec-row input {
  margin-top: 6px;
}
.spec-suggestions-more {
  font-size: 11px;
  padding: 3px;
}
.material-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
}
.material-facts dt {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.material-facts dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}
.movement-balances {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
@media (max-width: 767px) {
  .material-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .spec-row {
    gap: 8px;
  }
}
.master-form {
  max-width: 650px;
}
.responsive-table .record-actions .btn {
  flex: 0 0 auto;
}
.responsive-table th {
  text-transform: uppercase;
}
.master-values .responsive-table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.material-filters .form-select {
  max-width: none;
}

/* Compact list filters; keep touch controls comfortable on mobile. */
.compact-filters {
  padding: 12px 14px;
  gap: 8px;
}
.compact-filters .form-control,
.compact-filters .form-select {
  min-height: 36px;
  font-size: 13px;
  padding-top: 6px;
  padding-bottom: 6px;
}
.compact-filters > .btn {
  min-height: 36px;
  font-size: 13px;
  padding: 6px 12px;
}
.compact-filters .search-wrap svg {
  top: 10px;
}
.material-filterbar .search-wrap {
  flex: 1 1 190px;
  min-width: 170px;
  max-width: 250px;
}
.material-filters {
  display: contents;
}
.material-filters > div {
  flex: 1 1 115px;
  min-width: 100px;
  max-width: 160px;
}
.material-filters .form-select {
  width: 100%;
  max-width: none;
}
@media (max-width: 767px) {
  .compact-filters .form-control,
  .compact-filters .form-select,
  .compact-filters > .btn {
    min-height: 44px;
  }
  .compact-filters .search-wrap svg {
    top: 14px;
  }
  .material-filterbar .search-wrap {
    flex-basis: 100%;
    max-width: none;
  }
  .material-filters > div {
    flex: 1 1 calc(50% - 8px);
    max-width: none;
    min-width: 0;
  }
}

.compact-filters .filter-party {
  min-width: 200px;
  max-width: 260px;
  flex: 0 1 240px;
}
.compact-filters .filter-party .form-select {
  max-width: none;
}
.compact-filters .custom-dates {
  gap: 8px;
}
@media (max-width: 767px) {
  .compact-filters .filter-party {
    flex-basis: 100%;
    max-width: none;
  }
}
