@import url('detail-dl.css');

.flow-hint {
  padding: var(--space-md) var(--space-lg);
  background: #e8f4f6;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xl);
  font-size: var(--text-sm);
}
.flow-hint code { font-size: 0.85em; }

.flow-pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-gray-300);
}
.flow-step {
  flex: 1;
  min-width: 140px;
  padding: var(--space-md);
  text-align: center;
  border-radius: var(--radius-md);
  background: var(--color-gray-100);
  font-size: var(--text-sm);
}
.flow-step.is-done { background: #e8f5ee; border: 1px solid var(--color-success); }
.flow-step__num {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  background: var(--color-navy);
  color: var(--color-white);
  border-radius: 50%;
  font-weight: 700;
  margin-bottom: var(--space-sm);
}
.flow-step code { display: block; color: var(--color-teal); font-weight: 600; }
.flow-arrow { color: var(--color-gray-500); font-weight: 700; }

.booking-tracker { margin-top: var(--space-md); }
.booking-tracker__steps {
  display: flex;
  gap: 4px;
  margin: var(--space-md) 0;
}
.booking-tracker__steps span {
  flex: 1;
  height: 6px;
  background: var(--color-gray-300);
  border-radius: 3px;
}
.booking-tracker__steps span.is-done { background: var(--color-success); }
.booking-tracker__steps span.is-current { background: var(--color-teal); }
.booking-tracker__labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-gray-500);
}
.booking-tracker__actions {
  margin: var(--space-md) 0;
}
.booking-tracker__action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-sm) 0 0;
}

.client-zone-user {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  padding: var(--space-md) var(--space-lg);
  background: var(--color-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-gray-300);
  font-size: var(--text-sm);
}
.client-zone-user a { font-weight: 600; }

.my-estimates-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-2xl);
}
.my-estimates-list li {
  margin-bottom: var(--space-sm);
}
.my-estimates-list button {
  width: 100%;
  text-align: left;
  padding: var(--space-md);
  background: var(--color-white);
  border: 1px solid var(--color-gray-300);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
}
.my-estimates-list button:hover { border-color: var(--color-teal); }

.estimate-card {
  margin-bottom: var(--space-lg);
}
.estimate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-gray-100);
}
.doc-list li:last-child { border-bottom: none; }

.booking-status-track {
  display: flex;
  gap: var(--space-xs);
  margin-top: var(--space-md);
}
.booking-status-track span {
  flex: 1;
  height: 4px;
  background: var(--color-gray-300);
  border-radius: 2px;
}
.booking-status-track span.is-done { background: var(--color-success); }
.booking-status-track span.is-current { background: var(--color-teal); }

/* List + pagination */
.cz-list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.cz-list-header__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  color: var(--color-navy);
}
.cz-list-header__meta {
  margin: 0.25rem 0 0;
  font-size: var(--text-sm);
  color: var(--color-gray-600);
}
.cz-list-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-gray-200);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

/* Full-width data tables (Client Zone does not load admin.css) */
.table-responsive.cz-list-card,
.cz-detail-card > .table-responsive {
  width: 100%;
  max-width: 100%;
  margin-bottom: var(--space-md);
  box-shadow: none;
  border-radius: 0;
}

.cz-list-card .admin-table,
.cz-detail-card .admin-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  background: var(--color-white);
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 100%;
}

.cz-list-card .admin-table th,
.cz-list-card .admin-table td,
.cz-detail-card .admin-table th,
.cz-detail-card .admin-table td {
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-gray-200, #deebf2);
  font-size: var(--text-sm);
  color: #21475b;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cz-list-card .admin-table th,
.cz-detail-card .admin-table th {
  background: #ecf5fa;
  font-weight: 700;
  color: #153040;
}

.cz-list-card .admin-table tbody tr:last-child td,
.cz-detail-card .admin-table tbody tr:last-child td {
  border-bottom: none;
}

.cz-list-card .admin-table th:last-child,
.cz-list-card .admin-table td:last-child,
.cz-detail-card .admin-table th:last-child,
.cz-detail-card .admin-table td:last-child {
  text-align: right;
}

/* Bookings list — fixed columns so action buttons stay right, not over status */
.cz-bookings-table {
  table-layout: fixed;
}

.cz-bookings-table th:nth-child(1),
.cz-bookings-table td:nth-child(1) {
  width: 14%;
  white-space: nowrap;
}

.cz-bookings-table th:nth-child(2),
.cz-bookings-table td:nth-child(2) {
  width: 14%;
}

.cz-bookings-table th:nth-child(3),
.cz-bookings-table td:nth-child(3) {
  width: 26%;
}

.cz-bookings-table th:nth-child(4),
.cz-bookings-table td:nth-child(4) {
  width: 16%;
}

.cz-bookings-table th:nth-child(5),
.cz-bookings-table td:nth-child(5) {
  width: 30%;
  min-width: 9.5rem;
  text-align: right;
  white-space: nowrap;
}

.cz-bookings-table td:nth-child(3) .badge {
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  text-align: left;
  line-height: 1.35;
}

/* 4 columns (e.g. estimates on enquiry view) */
.cz-list-table--4 th:nth-child(1),
.cz-list-table--4 td:nth-child(1) { width: 26%; }
.cz-list-table--4 th:nth-child(2),
.cz-list-table--4 td:nth-child(2) { width: 22%; }
.cz-list-table--4 th:nth-child(3),
.cz-list-table--4 td:nth-child(3) { width: 18%; }
.cz-list-table--4 th:nth-child(4),
.cz-list-table--4 td:nth-child(4) { width: 34%; }

.cz-bookings-table__actions-head {
  text-align: right;
}

.cz-bookings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-xs);
  white-space: nowrap;
  margin-left: auto;
}

.cz-list-card .admin-table td.cz-bookings-actions {
  text-align: right;
}

@media (max-width: 639px) {
  .cz-list-card .admin-table,
  .cz-detail-card .admin-table {
    table-layout: auto;
    min-width: 36rem;
  }
}
.cz-empty-state {
  padding: var(--space-2xl);
  text-align: center;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-gray-300);
  color: var(--color-gray-600);
  margin-bottom: var(--space-xl);
}
.cz-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin: var(--space-lg) 0 var(--space-2xl);
  font-size: var(--text-sm);
}
.cz-pager__summary { margin: 0; color: var(--color-gray-600); }
.cz-pager__controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.cz-pager__pages { color: var(--color-navy); font-weight: 600; }
.btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.cz-detail-panel {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-gray-200);
}

.track-booking-btn.is-active {
  background: var(--color-ocean);
  color: var(--color-white);
  border-color: var(--color-ocean);
}

.cz-form-section-title {
  margin: 0 0 var(--space-md);
  font-size: var(--text-lg);
  color: var(--color-navy);
}
.cz-form-hint { font-size: var(--text-sm); color: var(--color-gray-600); }

.cz-invoice-actions {
  margin: var(--space-md) 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.cz-detail-header {
  margin: var(--space-xl) 0 var(--space-lg);
}
.cz-detail-header__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}
.cz-detail-header h2 {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-2xl);
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}
.cz-detail-card {
  margin-bottom: var(--space-xl);
  padding: var(--space-lg) var(--space-xl);
  background: var(--color-white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-gray-200);
  box-shadow: 0 1px 2px rgba(15, 40, 60, 0.04);
}
.cz-detail-card h3 {
  margin: 0 0 var(--space-lg);
  padding-bottom: var(--space-sm);
  font-size: var(--text-lg);
  color: var(--color-navy);
  border-bottom: 1px solid var(--color-gray-200);
}
/* Definition list grid: see detail-dl.css */
.cz-danger-zone {
  margin-top: var(--space-2xl);
  padding: var(--space-lg);
  border: 1px solid #e8c4c4;
  border-radius: var(--radius-md);
  background: #fdf8f8;
}
.cz-danger-zone h3 {
  margin: 0 0 var(--space-sm);
  color: #8b2e2e;
}
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
  font-size: var(--text-sm);
  cursor: pointer;
}
.enquiry-desc-fields .radio-group {
  margin: 0 0 var(--space-lg);
  padding: 0;
  border: 0;
}
.enquiry-desc-fields .radio-group legend {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-charcoal, #2c3e50);
  margin-bottom: var(--space-sm);
  padding: 0;
}
.enquiry-desc-fields .radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.4rem 0;
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-charcoal, #2c3e50);
  cursor: pointer;
  line-height: 1.4;
}
.enquiry-desc-fields .radio-label input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  min-width: 1.125rem;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  border: none;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  accent-color: var(--color-ocean, #29abe2);
  cursor: pointer;
}
.enquiry-desc-fields .radio-label input[type="radio"]:focus {
  outline: 2px solid var(--color-ocean, #29abe2);
  outline-offset: 2px;
}
.enquiry-desc-fields .radio-label span {
  flex: 1 1 auto;
}
.enquiry-desc-extra {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border, #e5e0d8);
}
.btn--danger {
  border-color: #c44 !important;
  color: #8b2e2e !important;
}
.btn--danger:hover {
  background: #8b2e2e !important;
  border-color: #8b2e2e !important;
  color: var(--color-white) !important;
}

/* Modals */
body.cz-modal-open { overflow: hidden; }
.cz-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-lg);
  overflow-y: auto;
}
.cz-modal[hidden] { display: none !important; }
.cz-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.55);
}
.cz-modal__panel {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 2rem);
  margin: auto 0;
  display: flex;
  flex-direction: column;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.cz-modal__panel--track {
  width: min(860px, 100%);
}
.cz-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
}
.cz-modal__header h2 {
  margin: 0;
  font-size: var(--text-xl);
  color: var(--color-navy);
}
.cz-modal__subtitle {
  margin: 0.25rem 0 0;
  font-size: var(--text-sm);
  color: var(--color-gray-600);
}
.cz-modal__close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--color-gray-600);
  cursor: pointer;
  border-radius: var(--radius-md);
}
.cz-modal__close:hover { background: var(--color-gray-200); color: var(--color-navy); }
.cz-modal__body {
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
  overflow-y: auto;
}
#booking-track-result {
  min-height: 12rem;
}

.invoice-banking {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: var(--color-gray-100, #f4f7f9);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-teal);
}
.invoice-banking__title {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-base);
}
.invoice-banking__account + .invoice-banking__account {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-gray-300);
}
.invoice-banking__label { margin: 0 0 var(--space-xs); }
.invoice-banking__type { font-weight: 400; color: var(--color-gray-600); font-size: var(--text-sm); }
.invoice-banking__dl {
  display: grid;
  grid-template-columns: minmax(7rem, 9rem) 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0;
  font-size: var(--text-sm);
}
.invoice-banking__dl dt { margin: 0; color: var(--color-gray-600); }
.invoice-banking__dl dd { margin: 0; }
.form-shell--modal {
  border: none;
  box-shadow: none;
  padding: 0;
}
.form-shell--modal .form-shell__body { padding: 0; }

@media (max-width: 640px) {
  .cz-modal { padding: 0; align-items: stretch; }
  .cz-modal__panel {
    width: 100%;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  .cz-list-header { flex-direction: column; align-items: stretch; }
  .cz-list-header .btn { width: 100%; }
}
