html {
  font-size: 16px;
}

@media (min-width: 768px) {
  html {
    font-size: 18px;
  }
}

.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 {
  margin-bottom: 60px;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f6fb 100%);
  color: #13233c;
}

.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;
}

.metric-card {
  border: 0;
  border-left: 4px solid #2b66f6;
  border-radius: 12px;
}

.metric-label {
  color: #57606a;
  font-size: 0.9rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
}

.app-nav {
  background: linear-gradient(90deg, #0b2e70 0%, #1243a8 100%);
}

.app-nav > .container {
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
}

.app-navbar-brand {
  gap: 0.65rem;
  max-width: min(100%, 52vw);
}

.app-navbar-business-name {
  color: #ffffff;
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-brand {
  font-weight: 700;
}

.app-nav .nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
}

.app-nav .nav-link:hover {
  color: #ffffff !important;
}

.app-card {
  border: none;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(15, 43, 92, 0.08);
}

.app-card .card-header {
  background: #ffffff;
  font-weight: 600;
  border-bottom: 1px solid #e8edf5;
}

.btn-primary {
  background-color: #2b66f6;
  border-color: #2b66f6;
}

.table > :not(caption) > * > * {
  padding: 0.8rem;
}

/* -------------------------------------------------------------------------
   App-wide alternating row tint for every data table (grids).
   - Plain .table: even rows get a light blue wash.
   - .table-striped: odd rows only (Bootstrap); do not also tint even rows or
     every row ends up blue.
   - Skips Bootstrap contextual rows used as section headers.
   ------------------------------------------------------------------------- */
:root {
  --app-table-row-alt-bg: rgba(228, 238, 252, 0.82);
  --app-table-striped-bg: rgba(228, 238, 252, 0.82);
}

.table:not(.table-striped) > tbody > tr:nth-child(even):not(.table-light):not(.table-primary):not(.table-secondary):not(.table-success):not(.table-danger):not(.table-warning):not(.table-info) > th,
.table:not(.table-striped) > tbody > tr:nth-child(even):not(.table-light):not(.table-primary):not(.table-secondary):not(.table-success):not(.table-danger):not(.table-warning):not(.table-info) > td {
  background-color: var(--app-table-row-alt-bg);
}

.table.table-striped > tbody > tr:nth-of-type(odd):not(.table-light):not(.table-primary):not(.table-secondary):not(.table-success):not(.table-danger):not(.table-warning):not(.table-info) > th,
.table.table-striped > tbody > tr:nth-of-type(odd):not(.table-light):not(.table-primary):not(.table-secondary):not(.table-success):not(.table-danger):not(.table-warning):not(.table-info) > td {
  --bs-table-bg-type: transparent;
  --bs-table-accent-bg: var(--app-table-striped-bg);
  background-color: var(--app-table-striped-bg) !important;
}

.list-group-flush > .list-group-item:nth-child(odd) {
  background-color: #fff;
}

.list-group-flush > .list-group-item:nth-child(even) {
  background-color: var(--app-table-row-alt-bg);
}

.lane {
  min-height: 120px;
  background: #f8fbff;
  border: 1px dashed #c7d5ee;
  border-radius: 8px;
  padding: 8px;
}

.dispatch-card {
  background: #ffffff;
  border: 1px solid #dbe5f5;
  border-radius: 8px;
  padding: 0;
  margin-bottom: 8px;
  overflow: hidden;
}

.dispatch-card-drag {
  padding: 8px;
  cursor: grab;
}

.dispatch-card .dispatch-open-detail {
  cursor: pointer;
}

.dispatch-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 8px 8px;
}

.dispatch-card-meta {
  color: #1f2f4a;
  font-size: 0.95rem;
  line-height: 1.2;
  min-width: 0;
}

.dispatch-card-footer .dispatch-open-detail {
  flex-shrink: 0;
  --bs-btn-padding-y: 0.25rem;
  --bs-btn-padding-x: 0.85rem;
}

.calendar-pill {
  background: #e9f1ff;
  border-left: 3px solid #2b66f6;
  border-radius: 8px;
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
  padding: 0.35rem 0.5rem;
}

a.calendar-pill {
  color: inherit;
}

a.calendar-pill:hover {
  background: #d9e8ff;
}

.portal-item {
  cursor: pointer;
}

.portal-item:hover {
  background-color: #f3f8ff;
}

.portal-side-panel {
  position: fixed;
  top: 84px;
  right: -360px;
  width: 340px;
  max-width: 90vw;
  background: #fff;
  border-left: 1px solid #d9e3f3;
  box-shadow: -8px 0 24px rgba(15, 43, 92, 0.12);
  border-radius: 12px 0 0 12px;
  padding: 14px;
  transition: right 0.2s ease-in-out;
  z-index: 1050;
}

.portal-side-panel.open {
  right: 0;
}

/* Scrollable data tables / lists (optional client pagination via app-tables.js) */
.app-table-scroll-inner {
  max-height: min(65vh, 28rem);
  overflow: auto;
  border-radius: 0 0 10px 10px;
}

.app-table-scroll-inner .table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: var(--bs-body-bg, #fff);
  box-shadow: inset 0 -1px 0 #dee2e6;
}

.app-table-scroll-inner ul.list-group {
  margin-bottom: 0;
}

/* Client pagination (app-tables.js): stronger control labels */
.app-table-page-nav .btn-outline-dark {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: rgba(0, 0, 0, 0.35);
}

/* Customer search modal pager */
.customer-search-pager .page-link {
  color: var(--bs-body-color);
  font-weight: 600;
}

.customer-search-pager .page-item.disabled .page-link {
  color: var(--bs-secondary-color);
  font-weight: 600;
}

/* Submit controls styled as badges (if used) */
button.badge {
  cursor: pointer;
  font-weight: 500;
  line-height: 1;
}
a.badge {
  font-weight: 500;
}

/* Estimates list: compact equal-width actions (~25% smaller than previous step) */
.estimate-row-actions > form.estimate-actions-form {
  display: contents;
  margin: 0;
  padding: 0;
}

.estimate-row-actions .btn.btn-sm.btn-estimate-action {
  min-width: 5.65rem; /* ~75% of 7.53rem */
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  --bs-btn-padding-y: 0.125rem;
  --bs-btn-padding-x: 0.3rem;
  margin: 0;
  box-sizing: border-box;
}

/* Navbar logo (custom upload or demo vertical asset) — 50% larger than original 36px / 220px */
.app-navbar-logo {
  height: 54px;
  width: auto;
  max-width: min(330px, 48vw);
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.app-navbar-logo-preview {
  height: 60px;
  width: auto;
  max-width: 360px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.app-navbar-preview {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.85rem;
  background: linear-gradient(90deg, #0b2e70 0%, #1243a8 100%);
  border-radius: 0.375rem;
}

.app-navbar-preview .app-navbar-business-name {
  font-size: 1.2rem;
}

@media (max-width: 575.98px) {
  .app-navbar-business-name {
    font-size: 1rem;
    max-width: 38vw;
  }
}

/* <app-grid>: on small viewports, stack each row as a labeled “card” (data-label from app-tables.js). */
@media (max-width: 767.98px) {
  .app-grid .app-table-scroll-inner {
    max-height: none;
    overflow: visible;
  }

  .app-grid .app-table-scroll-inner .table-responsive {
    overflow: visible;
  }

  .app-grid .app-grid-table {
    min-width: 0 !important;
  }

  .app-grid .app-grid-table > thead {
    display: none;
  }

  .app-grid .app-grid-table > tbody,
  .app-grid .app-grid-table > tfoot {
    display: block;
    width: 100%;
  }

  .app-grid .app-grid-table > tbody > tr,
  .app-grid .app-grid-table > tfoot > tr {
    display: block;
    width: 100%;
    border: 1px solid #d0dceb;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 43, 92, 0.08);
  }

  .app-grid .app-grid-table > tbody > tr > th,
  .app-grid .app-grid-table > tbody > tr > td,
  .app-grid .app-grid-table > tfoot > tr > th,
  .app-grid .app-grid-table > tfoot > tr > td {
    display: block;
    position: relative;
    width: 100% !important;
    min-height: 2.35rem;
    box-sizing: border-box;
    padding: 0.4rem 0.6rem 0.4rem 45% !important;
    text-align: right;
    line-height: 1.4;
    background: transparent !important;
    border: 0;
    border-bottom: 1px solid #e4ecf7;
  }

  .app-grid .app-grid-table > tbody > tr > th::before,
  .app-grid .app-grid-table > tbody > tr > td::before,
  .app-grid .app-grid-table > tfoot > tr > th::before,
  .app-grid .app-grid-table > tfoot > tr > td::before {
    content: attr(data-label) ":";
    position: absolute;
    left: 0.6rem;
    right: 55%;
    top: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    color: #3d4d66;
    white-space: normal;
    word-wrap: break-word;
  }

  .app-grid .app-grid-table > tbody > tr > th:last-of-type,
  .app-grid .app-grid-table > tbody > tr > td:last-of-type,
  .app-grid .app-grid-table > tfoot > tr > th:last-of-type,
  .app-grid .app-grid-table > tfoot > tr > td:last-of-type {
    border-bottom: 0;
  }

  .app-grid .app-grid-table > tbody > tr.app-grid-section-row,
  .app-grid .app-grid-table > tfoot > tr.app-grid-section-row {
    background: #eef3fc;
    border: 1px solid #b8c8e2;
  }

  .app-grid .app-grid-table tr.app-grid-section-row > th,
  .app-grid .app-grid-table tr.app-grid-section-row > td {
    padding: 0.5rem 0.65rem !important;
    text-align: center !important;
    font-weight: 600;
    color: #13233c;
    border: 0;
  }

  .app-grid .app-grid-table tr.app-grid-section-row > th::before,
  .app-grid .app-grid-table tr.app-grid-section-row > td::before {
    content: none;
  }

  .app-grid .app-grid-table > tbody > tr:hover > th,
  .app-grid .app-grid-table > tbody > tr:hover > td {
    background: rgba(43, 102, 246, 0.04) !important;
  }
}