/* Task → report → acceptance → acts workflow. */

.workflow-heading h1 {
  font-size: clamp(46px, 6vw, 88px);
}

.workflow-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(190px, 260px);
  gap: 14px;
  margin-bottom: 22px;
}

.workflow-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.workflow-field > span,
.workflow-label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.workflow-field input,
.workflow-field select,
.workflow-field textarea,
.workflow-input {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080809;
  color: var(--text);
}

.workflow-field textarea {
  min-height: 110px;
  resize: vertical;
}

.workflow-field input:focus,
.workflow-field select:focus,
.workflow-field textarea:focus,
.workflow-input:focus {
  border-color: var(--blue);
  outline: 0;
}

.workflow-field input:focus-visible,
.workflow-field select:focus-visible,
.workflow-field textarea:focus-visible,
.workflow-input:focus-visible,
.photo-preview__fields input:focus-visible,
.photo-preview__fields select:focus-visible,
.report-photo__copy input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.workflow-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.workflow-card {
  display: grid;
  min-height: 255px;
  align-content: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(102,129,255,.045), transparent 42%), var(--surface);
}

.workflow-card.is-overdue {
  border-color: rgba(226,185,95,.42);
}

.workflow-card__overdue {
  width: fit-content;
  padding: 5px 8px;
  border-radius: 99px;
  background: rgba(226,185,95,.13);
  color: #e2c679;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.workflow-card__top,
.workflow-dialog__header,
.workflow-section__heading,
.act-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.workflow-card h2,
.workflow-card h3 {
  margin: 28px 0 9px;
  font-size: 23px;
  font-weight: 350;
  line-height: 1.08;
}

.workflow-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.workflow-card__meta {
  display: grid;
  gap: 7px;
  margin: 22px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: #c7c7ca;
  font-size: 10px;
}

.workflow-card__remark {
  margin-top: 12px !important;
  padding: 10px 12px;
  border-left: 2px solid var(--yellow);
  background: rgba(226,185,95,.08);
  color: #e6cc91 !important;
}

.workflow-card__open,
.workflow-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-decoration: none;
  text-transform: uppercase;
}

.workflow-card__open {
  align-self: end;
  margin-top: auto;
}

.workflow-button--ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: #b9c2ff;
}

.workflow-button--danger {
  border: 1px solid rgba(255,48,37,.35);
  background: transparent;
  color: #ff827b;
}

.workflow-button:disabled,
.workflow-card__open:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.workflow-status {
  display: inline-flex;
  width: fit-content;
  padding: 7px 9px;
  border-radius: 99px;
  background: rgba(102,129,255,.13);
  color: #aab7ff;
  font-size: 8px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.workflow-status[data-status="REPORT_SUBMITTED"],
.workflow-status[data-status="AWAITING_SIGNED_COPY"] {
  background: rgba(226,185,95,.13);
  color: #e2c679;
}

.workflow-status[data-status="TECHNICALLY_ACCEPTED"],
.workflow-status[data-status="APPROVED"],
.workflow-status[data-status="VERIFIED"],
.workflow-status[data-status="COMPLETED"] {
  background: rgba(95,200,138,.13);
  color: #71d49a;
}

.workflow-status[data-status="REVISION_REQUIRED"],
.workflow-status[data-status="REWORK_REQUIRED"],
.workflow-status[data-status="REJECTED"],
.workflow-status[data-status="REPLACEMENT_REQUIRED"],
.workflow-status[data-status="VOID"] {
  background: rgba(255,48,37,.13);
  color: #ff827b;
}

.workflow-dialog {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b0b0c;
  color: var(--text);
}

.workflow-dialog--wide {
  width: min(1120px, calc(100vw - 32px));
}

.workflow-dialog::backdrop,
.photo-lightbox::backdrop {
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(6px);
}

.workflow-dialog__close {
  position: sticky;
  z-index: 4;
  top: 18px;
  float: right;
  width: 40px;
  height: 40px;
  margin: 18px 18px -58px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(11,11,12,.92);
  font-size: 22px;
}

.workflow-dialog > div {
  padding: clamp(24px, 4vw, 48px);
}

.workflow-dialog__header {
  padding-right: 52px;
}

.workflow-dialog__header h2 {
  max-width: 760px;
  margin: 14px 0 9px;
  font-size: clamp(32px, 4vw, 54px);
  font-weight: 270;
  line-height: 1;
}

.workflow-dialog__header p:last-child {
  color: var(--muted);
  font-size: 12px;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.workflow-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 30px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.workflow-summary article {
  min-width: 0;
  padding: 17px;
  border-right: 1px solid var(--line);
}

.workflow-summary article:last-child {
  border-right: 0;
}

.workflow-summary span,
.workflow-summary small {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.workflow-summary b {
  display: block;
  margin-top: 12px;
  overflow-wrap: anywhere;
  font-size: 15px;
  font-weight: 450;
}

.workflow-section {
  margin-top: 28px;
  padding-top: 25px;
  border-top: 1px solid var(--line);
}

.workflow-section__heading h3,
.workflow-section > h3 {
  margin: 9px 0 18px;
  font-size: 24px;
  font-weight: 350;
}

.allocation-list,
.event-list,
.report-version-list,
.act-line-list {
  border-top: 1px solid var(--line);
}

.allocation-row,
.claim-row,
.act-line {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) repeat(3, minmax(105px, .7fr));
  gap: 14px;
  align-items: center;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.allocation-row strong,
.claim-row strong,
.act-line strong {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.allocation-row small,
.claim-row small,
.act-line small {
  color: var(--muted);
  font-size: 9px;
}

.claim-row input,
.act-line input[type="number"] {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #070708;
}

.event-row,
.report-version-row,
.notification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.event-row p,
.report-version-row p,
.notification-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.event-row time,
.report-version-row time,
.notification-row time {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.workflow-form {
  display: grid;
  gap: 20px;
  margin-top: 28px;
}

.task-editor__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.task-editor__grid > .workflow-field:nth-child(5) {
  grid-column: 1 / -1;
}

.workflow-checkbox {
  display: flex;
  min-height: 46px;
  align-items: center;
  align-self: end;
  gap: 10px;
  color: #d4d4d7;
  font-size: 11px;
}

.workflow-checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.photo-picker {
  display: grid;
  min-height: 112px;
  place-items: center;
  padding: 20px;
  border: 1px dashed rgba(102,129,255,.45);
  border-radius: 10px;
  background: rgba(102,129,255,.04);
  text-align: center;
}

.photo-picker input {
  max-width: 100%;
}

.photo-picker small {
  display: block;
  margin-top: 9px;
  color: var(--muted);
}

.photo-preview-list,
.report-photo-grid,
.customer-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.photo-preview,
.report-photo,
.customer-photo {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #080809;
}

.photo-preview__open,
.report-photo__open,
.customer-photo__open {
  display: block;
  width: 100%;
  padding: 0;
  background: #050505;
}

.photo-preview img,
.report-photo img,
.customer-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.photo-preview__fields,
.report-photo__copy,
.customer-photo__copy {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.customer-photo__copy time {
  color: var(--muted);
  font-size: 9px;
}

.photo-preview__fields input,
.photo-preview__fields select,
.report-photo__copy input {
  width: 100%;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0c0c0e;
  font-size: 10px;
}

.photo-preview__actions {
  display: flex;
  gap: 6px;
}

.photo-preview__actions button {
  min-height: 34px;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: #b9c2ff;
  font-size: 9px;
}

.photo-preview__actions button:last-child {
  color: #ff827b;
}

.upload-progress {
  display: grid;
  gap: 7px;
}

.upload-progress progress {
  width: 100%;
  height: 7px;
  accent-color: var(--red);
}

.upload-progress span {
  color: var(--muted);
  font-size: 10px;
}

.review-decision {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: end;
  margin-top: 24px;
}

.review-decision > .workflow-confirmation {
  grid-column: 1 / -1;
}

.workflow-confirmation {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(226,185,95,.28);
  border-radius: 8px;
  background: rgba(226,185,95,.055);
  color: #d8c89e;
  font-size: 10px;
  line-height: 1.5;
}

.workflow-confirmation input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--red);
}

.workflow-confirm-action {
  display: grid;
  flex: 1 1 100%;
  gap: 10px;
}

.workflow-confirm-action .workflow-button {
  width: fit-content;
}

.workflow-review-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  margin: 24px 0;
  padding: 16px 18px;
  border: 1px solid rgba(95,200,138,.35);
  border-radius: 9px;
  background: rgba(95,200,138,.08);
  color: #92ddb0;
  font-size: 11px;
}

.workflow-review-result:focus {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.publication-control {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.publication-control button {
  min-height: 38px;
}

.project-workflow,
.project-acts {
  margin-top: 32px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.project-workflow h3,
.project-acts h3 {
  margin: 10px 0 0;
  font-size: 28px;
  font-weight: 320;
}

.project-task-list,
.act-list {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.project-task-row,
.act-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 16px;
  align-items: center;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #080809;
}

.project-task-row p,
.act-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.project-task-row button,
.act-card button {
  min-height: 38px;
}

.act-create-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.act-volume-list {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.act-volume-row {
  display: grid;
  grid-template-columns: 24px minmax(220px, 1.5fr) minmax(110px, .7fr) minmax(110px, .7fr);
  gap: 12px;
  align-items: center;
  min-height: 66px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.act-total {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  margin-top: 20px;
  font-size: 15px;
}

.act-total b {
  font-size: 22px;
  font-weight: 450;
}

.signed-copy-form,
.danger-zone {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #080809;
}

.signed-file-preview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d0d0f;
}

.signed-file-preview img {
  width: 78px;
  height: 58px;
  border-radius: 6px;
  object-fit: cover;
}

.signed-file-preview > div {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.signed-file-preview strong,
.signed-file-preview span {
  overflow-wrap: anywhere;
}

.signed-file-preview strong {
  font-size: 11px;
}

.signed-file-preview span {
  color: var(--muted);
  font-size: 9px;
}

.signed-file-preview .workflow-button {
  min-height: 38px;
}

.danger-zone {
  border-color: rgba(255,48,37,.3);
}

.danger-zone summary {
  cursor: pointer;
  color: #ff827b;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.notification-list {
  border-top: 1px solid var(--line);
}

.notification-row {
  padding: 18px;
}

.notification-row.is-unread {
  background: rgba(102,129,255,.045);
  border-left: 2px solid var(--blue);
}

.notification-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-lightbox {
  width: min(1200px, 100vw);
  height: min(900px, 100dvh);
  padding: 0;
  border: 0;
  background: #050505;
  color: #fff;
}

.photo-lightbox > button {
  position: fixed;
  z-index: 2;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 50%;
  background: rgba(0,0,0,.7);
  font-size: 24px;
}

.photo-lightbox figure {
  display: grid;
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
  margin: 0;
}

.photo-lightbox img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.photo-lightbox figcaption {
  min-height: 48px;
  padding: 14px 20px;
  color: #d0d0d3;
  font-size: 12px;
  text-align: center;
}

.workflow-empty,
.workflow-error {
  margin: 0;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.workflow-error {
  border-color: rgba(255,48,37,.32);
  color: #ff827b;
}

@media (max-width: 1100px) {
  .workflow-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-preview-list,
  .report-photo-grid,
  .customer-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .workflow-card-grid,
  .workflow-filters,
  .task-editor__grid,
  .photo-preview-list,
  .report-photo-grid,
  .customer-photo-grid,
  .workflow-summary,
  .review-decision {
    grid-template-columns: 1fr;
  }

  .task-editor__grid > .workflow-field:nth-child(5) {
    grid-column: auto;
  }

  .workflow-summary article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workflow-summary article:last-child {
    border-bottom: 0;
  }

  .allocation-row,
  .claim-row,
  .act-line {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 14px 0;
  }

  .act-volume-row {
    min-width: 0;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px 12px;
    padding: 14px 0;
  }

  .act-volume-row > :nth-child(n + 3) {
    grid-column: 2;
  }

  .allocation-row > *,
  .claim-row > *,
  .act-line > *,
  .act-volume-row > * {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .project-task-row,
  .act-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .project-task-row .workflow-status,
  .act-card .workflow-status {
    grid-column: 1;
  }

  .workflow-dialog {
    width: 100vw;
    max-width: none;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .workflow-dialog > div {
    padding: 22px 16px 90px;
  }

  .workflow-dialog__close {
    top: 12px;
    margin: 12px 12px -52px 0;
  }

  .workflow-dialog__header {
    display: block;
  }

  .workflow-actions .workflow-button,
  .review-decision .workflow-button {
    width: 100%;
  }

  .workflow-confirm-action .workflow-button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .workflow-heading {
    display: block;
  }

  .workflow-heading .refresh-button {
    margin-top: 16px;
  }

  .workflow-card-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-card {
    min-height: 235px;
  }

  .project-workflow,
  .project-acts {
    padding: 16px;
  }

  .project-task-row,
  .act-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .project-task-row button,
  .act-card button {
    width: 100%;
  }

  .event-row,
  .report-version-row,
  .notification-row {
    grid-template-columns: 1fr;
  }

  .notification-row__actions {
    justify-content: flex-start;
  }

  .signed-file-preview {
    grid-template-columns: 1fr;
  }

  .signed-file-preview img {
    width: 100%;
    height: auto;
    max-height: 220px;
  }
}
