/* Documents screen styles. Own classes only (dc-*). */
.dc-rail {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.dc-rail::-webkit-scrollbar {
  display: none;
}
.dc-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  flex-shrink: 0;
  padding: 5px 12px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-left: 4px solid var(--hair);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  white-space: nowrap;
}
.dc-chip b {
  font-size: 12.5px;
  font-weight: 600;
}
.dc-chip span {
  font-size: 10.5px;
  color: var(--muted);
}
.dc-chip.ok {
  border-left-color: var(--ok);
}
.dc-chip.warn {
  border-left-color: var(--warn);
}
.dc-chip.all.on {
  border-left-color: var(--accent);
}
.dc-chip.on {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.dc-fbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.dc .card-head .right {
  flex: 1 1 100%;
  margin-left: 0;
  justify-content: flex-end;
}
.dc-fbar {
  width: 100%;
}
.dc-fbar .dc-q {
  flex: 1 1 200px;
  width: auto;
  min-width: 150px;
  max-width: 340px;
  min-height: 30px;
}
.dc-fbar .sel,
.dc-fbar .btn {
  min-height: 30px;
}
.dc-fbar .btn {
  white-space: nowrap;
}
.dc-fbar .sel {
  width: auto;
  min-width: 128px;
}
.dc-fbar .dc-sub {
  padding: 0;
}
.dc-alert {
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--warn);
  border-left-width: 4px;
  border-radius: 4px;
  background: var(--warn-bg);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.5;
}
.dc-alert.risk {
  border-color: var(--risk);
  background: var(--risk-bg);
}
.dc-chip:hover {
  background: var(--sunk);
}
.dc-tabs a {
  cursor: pointer;
  white-space: nowrap;
}
.dc-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.dc-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--hair);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.dc-tile span {
  font-size: 12px;
  color: var(--muted);
}
.dc-tile.on {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.dc-sub {
  margin: 0;
  padding: 0 16px;
}
.dc-foot {
  margin: 14px 2px 0;
  line-height: 1.5;
}
.dc-src {
  color: var(--muted);
  font-size: 12px;
}
.dc-link {
  color: var(--info-fg);
  cursor: pointer;
  font-size: 12px;
  margin-right: 4px;
}
.dc-ico {
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
}
.dc-ib {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--hair);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.dc-ib:hover:not(:disabled) {
  background: var(--sunk);
}
.dc-ib:disabled {
  opacity: 0.4;
  cursor: default;
}
.dc .tbl td {
  vertical-align: top;
}
.dc .tbl td .small {
  line-height: 1.4;
}
.dc-banner {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13px;
}
.dc-banner span {
  flex: 1;
}
.dc-modal {
  position: relative;
}
.dc-pencil {
  position: absolute;
  right: 0;
  top: -4px;
}
.dc-drop {
  border: 2px dashed var(--hair);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}
.dc-tick,
.field .dc-tick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  margin: 0;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text);
}
.field .dc-tick input {
  width: auto;
  flex: 0 0 auto;
  padding: 0;
  margin: 0;
}
.dc-sub2 {
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--hair);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dc-gap {
  height: 2px;
}
.dc-answer {
  padding: 10px 12px;
  margin: 10px 0;
  border-radius: 8px;
  background: var(--ok-bg);
  color: var(--text);
  font-size: 13.5px;
}
.dc-noterow {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.dc-noterow .mini {
  flex: 1;
}
.dc-modal .meta-row {
  align-items: flex-start;
  gap: 12px;
}
.dc-modal .meta-row b {
  font-weight: 500;
  text-align: right;
}
@media (max-width: 700px) {
  .dc-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
  .dc .tbl-wrap {
    overflow-x: auto;
  }
  .dc-pencil {
    position: static;
    margin-bottom: 8px;
  }
}
.dc-preview h3 {
  margin: 0 0 10px;
}
.dc-preview p {
  line-height: 1.5;
  font-size: 13.5px;
}
.dc-file {
  cursor: pointer;
}

/* phone: documents lists are cards, filters stack, chips stay thumb-size */
@media (max-width: 768px) {
  .dc .tbl-cards td {
    align-items: flex-start;
  }
  .dc .tbl-cards td:first-child .small,
  .dc .tbl-cards td:first-child .dc-src {
    display: block;
    font-weight: 400;
    margin-top: 3px;
  }
  .dc-chip,
  .dc-tile {
    min-height: 48px;
  }
  .dc-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
  }
  .dc-ib {
    width: 44px;
    height: 44px;
  }
  .dc .btn,
  .dc .tabs a,
  .dc .tabs button,
  .dc .tabs .tab {
    min-height: 44px;
  }
  .dc .mini,
  .dc .sel,
  .dc input {
    font-size: 16px;
    min-height: 44px;
  }
  .dc-tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dc-noterow {
    flex-direction: column;
  }
  .dc-drop {
    padding: 22px 12px;
  }
  .dc-tick {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .dc-tick input,
  .field .dc-tick input {
    width: 22px;
    height: 22px;
  }
  .dcm .modal-body .meta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .dcm .meta-row b {
    text-align: left;
  }
}

/* phone: dcm modals fill the sheet with 16px inputs and thumb-size actions */
@media (max-width: 768px) {
  .modal.dcm {
    max-height: 94vh;
  }
  .modal.dcm .mini,
  .modal.dcm .field input,
  .modal.dcm .field textarea,
  .modal.dcm .sel,
  .modal.dcm input[type='text'],
  .modal.dcm textarea {
    font-size: 16px;
    min-height: 44px;
  }
  .modal.dcm .modal-foot {
    position: sticky;
    bottom: 0;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  .modal.dcm .modal-foot .btn,
  .modal.dcm .modal-head .btn {
    min-height: 44px;
    min-width: 44px;
  }
  .modal.dcm .modal-foot {
    flex-wrap: wrap;
  }
  .modal.dcm .modal-foot .btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    white-space: normal;
  }
  .modal.dcm input[type='checkbox'] {
    width: 22px;
    height: 22px;
  }
  .modal.dcm .modal-body {
    -webkit-overflow-scrolling: touch;
  }
}

/* phone: the filter bar stacks under the title, rows become two-line list rows (name, vendor, status, amount) */
@media (max-width: 768px) {
  .dc-chip {
    min-height: 44px;
    padding: 5px 10px;
  }
  .dc .card-head .right {
    width: 100%;
    margin-left: 0;
  }
  .dc-fbar {
    justify-content: stretch;
    width: 100%;
  }
  .dc-fbar .dc-q {
    flex: 1 1 100%;
    width: auto;
    min-height: 44px;
  }
  .dc-fbar .sel {
    flex: 1 1 calc(50% - 8px);
    min-width: 0;
    min-height: 44px;
  }
  .dc-fbar .btn {
    min-height: 44px;
  }
  .dc .tbl-cards tbody {
    display: block;
  }
  .dc .tbl-cards tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    margin: 0;
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--hair);
    border-radius: 0;
    background: transparent;
  }
  .dc .tbl-cards td {
    display: none;
    width: auto;
    padding: 0;
    text-align: left;
    border: 0;
    margin: 0;
  }
  .dc .tbl-cards td::before {
    content: none;
  }
  .dc .tbl-cards td:first-child {
    display: block;
    grid-column: 1;
    grid-row: 1;
    order: 0;
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 14px;
  }
  .dc .tbl-cards td[data-label='Amount'] {
    display: block;
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }
  .dc .tbl-cards td[data-label='Vendor'],
  .dc .tbl-cards td[data-label='Job'] {
    display: block;
    grid-column: 1;
    grid-row: 2;
    font-size: 12.5px;
    color: var(--muted);
  }
  .dc .tbl-cards tr:has(td[data-label='Vendor']) td[data-label='Job'] {
    display: none;
  }
  .dc .tbl-cards td[data-label='Description'] {
    display: block;
    grid-column: 1;
    grid-row: 2;
    font-size: 12.5px;
    color: var(--muted);
  }
  .dc .tbl-cards tr:has(td[data-label='Description']) td[data-label='Job'] {
    display: block;
    grid-column: 1 / -1;
    grid-row: 3;
    margin-top: 4px;
  }
  .dc .tbl-cards td[data-label='Status'] {
    display: block;
    grid-column: 2;
    grid-row: 2;
    text-align: right;
  }
  .dc .tbl-cards td:first-child .tiny,
  .dc .tbl-cards td:first-child .small {
    display: none;
  }
}
/* Print of an RFI preview: printOpenModal() sets body.print-sheet; docsheet.css lays the sheet out for .ds-modal, so the RFI preview (.dcm) gets the same: no height cap, nothing scrolls, so a long RFI prints in full. */
@media print {
  body.print-sheet .modal.dcm {
    max-height: none;
    overflow: visible;
  }
  body.print-sheet .dcm .modal-body {
    max-height: none;
    overflow: visible;
  }
}
.dc-code {
  font-family: var(--mono, ui-monospace, monospace);
  font-size: 12.5px;
}
.dc-read {
  margin-left: 6px;
  vertical-align: middle;
}
/* PO and CO lists on desktop: the real app's cardless, full-bleed table (no side borders or corners, runs edge to edge of the page). */
@media (min-width: 861px) {
  .dc-bleed {
    margin: 0 -28px 20px;
  }
  .dc-bleed > .card {
    background: transparent;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin-bottom: 0;
  }
  .dc-bleed > .card > .card-head {
    padding-left: 28px;
    padding-right: 28px;
  }
  .dc-bleed .tbl th:first-child,
  .dc-bleed .tbl td:first-child {
    padding-left: 28px;
  }
  .dc-bleed .tbl th:last-child,
  .dc-bleed .tbl td:last-child {
    padding-right: 28px;
  }
}
/* 769 to 900: the real app shows its desktop table here (it scrolls sideways); the demo keeps the table and, as a fit guard, drops Added by and Source so the amount and status never clip (the row still opens its sheet) */
@media (min-width: 769px) and (max-width: 900px) {
  .dc-bleed .tbl th:nth-last-child(-n + 2),
  .dc-bleed .tbl td:nth-last-child(-n + 2) {
    display: none;
  }
  .dc-bleed .tbl th,
  .dc-bleed .tbl td {
    padding-left: 10px;
    padding-right: 10px;
  }
}
@media (max-width: 900px) {
  .dc-fbar .btn,
  .dc-fbar .sel,
  .dc-fbar input.mini {
    min-height: 44px;
  }
}
