/* Stictr Build Contractor brand. The logo is the Stictr Build lockup with a third row, CONTRACTOR, added under BUILD
   (apps/contractor/public/brand/stictr-contractor-logo-aqua*.svg; markup from apps/contractor/scripts/mirror-gc-pages.mjs).
   Brand colors: aqua #15B5CD (the icon) and navy #0F2545 (Stictr Build); amber #F2A33A marks "Contractor". */

/* The Contractor lockup is a little taller than the Stictr Build one (it has the extra row), so it gets a little more
   height to keep "stictr" the same size as on Stictr Build. */
.auth-login-bg .auth-visual .brand-mark .brand-logo[src*="stictr-contractor-logo"],
.auth-register-bg .auth-visual .brand-mark .brand-logo[src*="stictr-contractor-logo"] { height: 51px; width: auto; }
.auth-login-bg .brand-mark .brand-logo[src*="stictr-contractor-logo"],
.auth-register-bg .brand-mark .brand-logo[src*="stictr-contractor-logo"] { height: 44px; width: auto; }
img.brand-logo[src*="stictr-contractor-logo"] { width: auto; }

/* Page-header action buttons styled like the white account chip, so they
   stay readable whether they sit on the dark header band or wrap below it
   (main.css turns outline/light buttons white-on-dark in project pages). */
body .page-header .btn.sb-chip-btn {
  background-color: #fff;
  color: #1e293b;
  border-color: #e5e7eb;
}
/* Pay applications billed as one line (no schedule of values): only the
   columns that matter for "% complete of the job"; the rest come back with
   "Show all columns". */
.billing-simple .adv,
.billing-simple tfoot { display: none; }
/* The editable "% to date" box needs room for e.g. 100.00. */
td[data-col="pct"] .input-group { min-width: 7rem; }

body .page-header .btn.sb-chip-btn:hover,
body .page-header .btn.sb-chip-btn:focus {
  background-color: #eef2f7;
  color: #1e293b;
}

/* The footer pins to the bottom of the screen on short pages (e.g. Time
   Management's tabs) through the shared styles' `.app-shell.has-sidenav` flex
   column (assets/scss/components/_footer.scss), the same in both products. */

/* Time Management. Weeks: zero hours are a quiet dash. Multi-entry: the
   worker pick list scrolls within its box; day chips. */
.tm-weeks .tm-zero { color: #cbd5e1; }
/* The tabs card takes the height left above the footer — no gap below it and
   no overflow, however tall the header and week bar are (card-fill's fixed
   viewport offset overshot here because of the week bar). */
body[data-page="time-management"] .sb-main { display: flex; flex-direction: column; }
body[data-page="time-management"] .tm-card.card-fill { flex: 1 0 auto; min-height: 0; }
/* ...and inside it, the open tab stretches too, so each tab's bordered box
   (table-shell, Multi-entry's panels) runs to the bottom of the card, as on
   Drawings, instead of stopping under its last row. */
body[data-page="time-management"] .tm-card .tab-content > .tab-pane.active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
body[data-page="time-management"] .tm-card .tab-pane > .table-responsive.table-shell { flex: 1 1 auto; }
/* Multi-entry's two panels stretch only side by side (lg up); stacked on a
   tablet or phone they keep their own height. */
@media (min-width: 992px) {
  body[data-page="time-management"] .tm-card .tab-pane > .tm-fill { flex: 1 1 auto; }
  body[data-page="time-management"] .tm-panel { height: 100%; }
}
.tm-pick-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  padding: .25rem .5rem;
}
.tm-pick-list .form-check { padding-top: .3rem; padding-bottom: .3rem; margin-bottom: 0; }
.tm-day.active { color: #fff; }
.tm-day.tm-today { text-decoration: underline; text-underline-offset: 3px; }
.tm-hours { width: 4.75rem; }
/* Classifications: an inactive classification reads as set aside. */
.tm-classes .tm-class-inactive td { opacity: .6; }
.tm-classes input[data-f="name"] { min-width: 11rem; }
.tm-line-error { box-shadow: inset 3px 0 0 var(--bs-danger); background-color: #fff5f5; }

/* My Timecard — one column at every width, filling the screen like the
   Projects Portal (same 1500px cap and side padding). */
.tc-main { max-width: 1500px; padding-inline: clamp(1rem, 2.2vw, 2rem); }

/* Sortable table headers (Inventory, Purchasing, Assemblies): the column being
   sorted shows its direction. */
th.sortable { white-space: nowrap; user-select: none; }
th.sortable.sorted-asc::after { content: " \25B2"; font-size: .65em; opacity: .7; }
th.sortable.sorted-desc::after { content: " \25BC"; font-size: .65em; opacity: .7; }

/* Phone widths (under 576px) ------------------------------------------------ */
/* The status picker in a list row never shrinks to a sliver (the footer's side gutter is in the shared styles). */
td > select[data-action="status"] { min-width: 8.5rem; }
@media (max-width: 575.98px) {
  /* Lists show the columns you act on; the rest are one tap away on the details page. */
  .lean-contracts th:nth-child(3), .lean-contracts td:nth-child(3),   /* Customer */
  .lean-contracts th:nth-child(4), .lean-contracts td:nth-child(4),   /* Type */
  .lean-contracts th:nth-child(6), .lean-contracts td:nth-child(6),   /* Original */
  .lean-subs th:nth-child(3), .lean-subs td:nth-child(3),             /* Title */
  .lean-subs th:nth-child(4), .lean-subs td:nth-child(4),             /* Cost code */
  .lean-subs th:nth-child(7), .lean-subs td:nth-child(7),             /* Original */
  .lean-subs th:nth-child(8), .lean-subs td:nth-child(8),             /* COs */
  .lean-cos th:nth-child(3), .lean-cos td:nth-child(3),               /* Contract */
  .lean-cos th:nth-child(4), .lean-cos td:nth-child(4),               /* Customer ref */
  .lean-cos th:nth-child(6), .lean-cos td:nth-child(6),               /* Days */
  .lean-cos th:nth-child(7), .lean-cos td:nth-child(7) { display: none; } /* Cost */

  /* The status card's buttons sit two to a row instead of wrapping one by one. */
  #scActions { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  #scActions .btn { width: 100%; white-space: normal; }
  #scActions .dropdown { display: block; }
  #scActions .dropdown .btn { width: 100%; }
  #scActions .dropdown-menu { width: 100%; }
}

/* Document-control lists and the drawing viewer on a phone ------------------ */
/* A phone is for looking things up and opening them: the lists keep the columns you
   read, and the edit / delete buttons stay on the desktop and iPad layouts. */
@media (max-width: 575.98px) {
  .lean-drawings th:nth-child(3), .lean-drawings td:nth-child(3),      /* Discipline */
  .lean-drawings th:nth-child(5), .lean-drawings td:nth-child(5),      /* Set */
  .lean-drawings th:nth-child(6), .lean-drawings td:nth-child(6),      /* Date */
  .lean-drawings th:nth-child(7), .lean-drawings td:nth-child(7),      /* Files */
  .lean-specs th:nth-child(3), .lean-specs td:nth-child(3),            /* Division */
  .lean-specs th:nth-child(4), .lean-specs td:nth-child(4),            /* Issue Date */
  .lean-specs th:nth-child(5), .lean-specs td:nth-child(5),            /* Files */
  .lean-submittals th:nth-child(3), .lean-submittals td:nth-child(3),  /* Spec Section */
  .lean-submittals th:nth-child(6), .lean-submittals td:nth-child(6),  /* Revision */
  .lean-submittals th:nth-child(7), .lean-submittals td:nth-child(7),  /* Due Date */
  .lean-rfis th:nth-child(3), .lean-rfis td:nth-child(3),              /* Reference */
  .lean-rfis th:nth-child(4), .lean-rfis td:nth-child(4),              /* Priority */
  .lean-rfis th:nth-child(6), .lean-rfis td:nth-child(6) { display: none; } /* Ball in Court */

  .lean-drawings .draw-del, .lean-specs .spec-del, .lean-specs .spec-edit,
  .lean-submittals .sub-del, .lean-submittals .sub-edit, .lean-rfis .rfi-del { display: none; }
  /* Drawings: Edit and Versions shrink to their icons. */
  .lean-drawings td:last-child .btn { font-size: 0; padding: .3rem .5rem; }
  .lean-drawings td:last-child .btn i { font-size: .85rem; margin: 0 !important; }
}

/* Drawing viewer: no thumbnail strip eating the width of a phone or small tablet,
   and the markup toolbar wraps instead of running off the screen. */
@media (max-width: 767.98px) {
  #pdfViewerModal #pdfSidebar { display: none; }
  #pdfViewerModal .annot-tools { flex-wrap: wrap; }
}
@media (max-width: 575.98px) {
  /* The fixed column widths set for a desktop screen are what pushed Actions off the right edge. */
  .lean-drawings th, .lean-specs th, .lean-submittals th, .lean-rfis th { width: auto !important; min-width: 0 !important; }
  .lean-drawings td, .lean-submittals td { padding-left: .4rem; padding-right: .4rem; }
}
@media (max-width: 575.98px) {
  /* The submittal number already opens it, so the Open button column goes on a phone. */
  .lean-submittals th:nth-child(8), .lean-submittals td:nth-child(8) { display: none; }
}

/* Phone widths, document control and field lists (under 576px) --------------- */
@media (max-width: 575.98px) {
  .lean-meetings th:nth-child(3), .lean-meetings td:nth-child(3),     /* Type */
  .lean-meetings th:nth-child(4), .lean-meetings td:nth-child(4),     /* Location */
  .lean-tasks th:nth-child(3), .lean-tasks td:nth-child(3),           /* Assignee */
  .lean-tasks th:nth-child(5), .lean-tasks td:nth-child(5),           /* Priority */
  .lean-docs th:nth-child(2), .lean-docs td:nth-child(2),             /* Type */
  .lean-docs th:nth-child(3), .lean-docs td:nth-child(3),             /* Size */
  .lean-logs th:nth-child(5), .lean-logs td:nth-child(5),             /* Weather */
  .lean-logs th:nth-child(6), .lean-logs td:nth-child(6),             /* Manpower */
  .lean-logs th:nth-child(7), .lean-logs td:nth-child(7),             /* Work performed */
  .lean-logs th:nth-child(8), .lean-logs td:nth-child(8),             /* Attachments */
  .lean-material th:nth-child(2), .lean-material td:nth-child(2),     /* # */
  .lean-material th:nth-child(4), .lean-material td:nth-child(4),     /* Qty */
  .lean-material th:nth-child(5), .lean-material td:nth-child(5),     /* Spec */
  .lean-material th:nth-child(6), .lean-material td:nth-child(6),     /* Company */
  .lean-material th:nth-child(7), .lean-material td:nth-child(7),     /* Release */
  .lean-material th:nth-child(8), .lean-material td:nth-child(8),     /* Lead */
  .lean-material th:nth-child(9), .lean-material td:nth-child(9),     /* Delivery (the status shows Overdue / Arrives late) */
  .lean-material th:nth-child(10), .lean-material td:nth-child(10),   /* Required on site */
  .lean-punch th:nth-child(4), .lean-punch td:nth-child(4),           /* Location */
  .lean-punch th:nth-child(5), .lean-punch td:nth-child(5),           /* Trade */
  .lean-punch th:nth-child(6), .lean-punch td:nth-child(6),           /* Company */
  .lean-punch th:nth-child(7), .lean-punch td:nth-child(7),           /* Assigned to */
  .lean-punch th:nth-child(9), .lean-punch td:nth-child(9),           /* Due */
  .lean-insp th:nth-child(4), .lean-insp td:nth-child(4),             /* Type */
  .lean-insp th:nth-child(5), .lean-insp td:nth-child(5),             /* Location */
  .lean-insp th:nth-child(6), .lean-insp td:nth-child(6),             /* Trade */
  .lean-insp th:nth-child(7), .lean-insp td:nth-child(7),             /* Company */
  .lean-insp th:nth-child(8), .lean-insp td:nth-child(8),             /* Assigned to */
  .lean-insp th:nth-child(10), .lean-insp td:nth-child(10),           /* Result */
  .lean-insp th:nth-child(11), .lean-insp td:nth-child(11),           /* Due */
  .lean-insp th:nth-child(12), .lean-insp td:nth-child(12) { display: none; } /* Attachments */
}

/* On a phone the row's buttons stack, so the Actions column stays narrow. */
@media (max-width: 575.98px) {
  :is(.lean-meetings, .lean-tasks, .lean-docs, .lean-logs, .lean-material, .lean-punch, .lean-insp) td:last-child { white-space: normal !important; }
  :is(.lean-meetings, .lean-tasks, .lean-docs, .lean-logs, .lean-material, .lean-punch, .lean-insp) td:last-child .btn,
  :is(.lean-meetings, .lean-tasks, .lean-docs, .lean-logs, .lean-material, .lean-punch, .lean-insp) td:last-child .btn-group {
    display: block; width: 100%; margin: 0 0 .25rem 0 !important;
  }
}
@media (max-width: 575.98px) {
  :is(.lean-meetings, .lean-tasks, .lean-docs, .lean-logs, .lean-material, .lean-punch, .lean-insp) :is(th, td) { padding-left: .3rem; padding-right: .3rem; }
}
@media (max-width: 575.98px) {
  /* Numbers like INSP-002 may wrap at the dash rather than force the list wider. */
  :is(.lean-insp, .lean-punch, .lean-logs) td:nth-child(2) { white-space: normal !important; }
}
@media (max-width: 575.98px) {
  /* Material Tracking: the status badges stack so the column stays narrow. */
  .lean-material td:nth-child(11) .badge { display: block; width: fit-content; white-space: normal; margin: 0 0 .2rem 0 !important; }
}
@media (max-width: 575.98px) {
  .lean-tasks td:nth-child(4), .lean-meetings td:nth-child(5) { font-size: .78rem; }
}
@media (max-width: 575.98px) {
  /* The fixed header widths are for wide screens; on a phone the columns size to what they hold. */
  :is(.lean-meetings, .lean-tasks, .lean-docs, .lean-logs, .lean-material, .lean-punch, .lean-insp) th { width: auto !important; }
  .lean-meetings td:first-child { white-space: normal !important; }
}

/* A button that can't be used right now looks like it. */
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }

/* Project Billing log on a phone: number, billed, balance and status; the rest is on the pay application. */
@media (max-width: 575.98px) {
  .lean-billing th:nth-child(2), .lean-billing td:nth-child(2) { display: none; }
  .lean-billing th, .lean-billing td { padding-left: .3rem; padding-right: .3rem; }
}
