/* AAA HOUSE Material Control v2.5.0 compatibility layer */
.secure-password-input.is-masked {
  -webkit-text-security: none;
  text-security: none;
  letter-spacing: .08em;
}
.secure-password-input:not(.is-masked) {
  -webkit-text-security: none;
  text-security: none;
  letter-spacing: normal;
}

.v24-package-action-panel {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(300px, 1.2fr);
  gap: 14px;
  padding: 16px;
  margin: 0 0 16px;
  border: 1px solid var(--border, #d9e2dc);
  border-radius: 16px;
  background: #f8fbf9;
}
.v24-package-action-panel .info-banner { grid-column: 1 / -1; margin: 0; }
.v24-target-project-summary {
  padding: 14px 16px;
  border-radius: 12px;
  background: #eef7f0;
  border: 1px solid #cfe3d4;
}

.v24-management-grid { display: grid; gap: 18px; }
.v24-batch-section { min-width: 0; }
.v24-input-table { min-width: 980px; }
.v24-input-table input { min-width: 120px; width: 100%; }
.v24-input-table td:nth-child(2) input,
.v24-input-table td:nth-child(3) input { min-width: 220px; }
.v24-approved-bills { border-color: #b9d9bf; background: linear-gradient(180deg, #f8fff9, #fff); }

.v24-pdf-host {
  position: fixed;
  z-index: -9999;
  left: -20000px;
  top: 0;
  background: #fff;
  color: #111;
  font-family: "Noto Sans Thai", "Tahoma", "Arial", sans-serif;
}
.v24-pdf-host.v24-pdf-portrait { width: 196mm; }
.v24-pdf-host.v24-pdf-landscape { width: 283mm; }
.v24-pdf-host *, .v24-pdf-host *::before, .v24-pdf-host *::after { box-sizing: border-box; }
.v24-pdf-host table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.v24-pdf-host th, .v24-pdf-host td { border: 1px solid #9aa69e; padding: 7px 8px; vertical-align: top; font-size: 11px; word-break: break-word; }
.v24-pdf-host th { background: #eaf3ec; font-weight: 800; }
.v24-pdf-host .number { text-align: right; }
.v24-pdf-host .total-row td { background: #edf5ef; font-weight: 800; }
.v24-pdf-host .status-badge { display: inline-block; padding: 3px 8px; border-radius: 99px; border: 1px solid #a8b9ac; background: #fff; }

.v24-withdrawal-pdf { width: 100%; padding: 4mm; background: #fff; }
.v24-withdrawal-pdf > header {
  display: grid;
  grid-template-columns: 28mm 1fr;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 3px solid #164d28;
}
.v24-withdrawal-pdf > header img { width: 25mm; max-height: 25mm; object-fit: contain; }
.v24-withdrawal-pdf > header p { margin: 0 0 2px; font-size: 10px; letter-spacing: .08em; }
.v24-withdrawal-pdf > header h1 { margin: 0 0 3px; font-size: 22px; }
.v24-withdrawal-pdf > header strong { font-size: 13px; }
.v24-pdf-meta { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px 14px; margin: 14px 0; }
.v24-pdf-meta > div { padding: 8px 10px; border: 1px solid #c9d2cc; border-radius: 6px; }
.v24-pdf-meta span { display: block; color: #58645c; font-size: 9px; margin-bottom: 2px; }
.v24-pdf-meta strong { font-size: 11px; }
.v24-pdf-note { margin-top: 12px; padding: 10px; border: 1px solid #c9d2cc; min-height: 18mm; font-size: 11px; }
.v24-withdrawal-pdf footer, .v24-report-footer { margin-top: 12px; padding-top: 7px; border-top: 1px solid #bcc8c0; text-align: center; color: #58645c; font-size: 9px; }

.v24-pdf-host .project-report-document { width: 100%; padding: 3mm; box-shadow: none; border: 0; background: #fff; }
.v24-pdf-host .project-report-header { display: grid; grid-template-columns: 28mm 1fr auto; align-items: center; gap: 12px; border-bottom: 3px solid #164d28; padding-bottom: 10px; }
.v24-pdf-host .project-report-header img { width: 24mm; max-height: 24mm; object-fit: contain; }
.v24-pdf-host .project-report-header p { margin: 0; font-size: 9px; }
.v24-pdf-host .project-report-header h1 { margin: 2px 0; font-size: 20px; }
.v24-pdf-host .project-report-status { text-align: right; }
.v24-pdf-host .project-report-status small { display: block; margin-top: 5px; font-size: 8px; }
.v24-pdf-host .project-report-section { margin-top: 12px; break-inside: avoid; }
.v24-pdf-host .project-report-section h2 { margin: 0 0 7px; font-size: 14px; }
.v24-project-summary-table th:nth-child(1) { width: 7%; }
.v24-project-summary-table th:nth-child(2) { width: 27%; }
.v24-project-summary-table th:nth-child(3) { width: 9%; }
.v24-project-summary-table th:nth-child(7) { width: 8%; }

@media (max-width: 760px) {
  .v24-package-action-panel { grid-template-columns: 1fr; padding: 12px; }
  .v24-package-action-panel .info-banner { grid-column: auto; }
  .package-source-actions { display: grid !important; grid-template-columns: 1fr !important; }
  .package-source-actions .button { width: 100%; }
  .v24-management-grid { display: block; }
  .v24-batch-section + .v24-batch-section { margin-top: 16px; }

  .table-wrap:has(> table.v24-mobile-card-table) {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  table.v24-mobile-card-table {
    min-width: 0 !important;
    width: 100%;
    border: 0;
    background: transparent;
  }
  table.v24-mobile-card-table > thead { display: none; }
  table.v24-mobile-card-table > tbody { display: grid; gap: 12px; }
  table.v24-mobile-card-table > tbody > tr:not(.total-row) {
    display: block;
    border: 1px solid #d8e2db;
    border-radius: 14px;
    padding: 8px 12px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(22, 77, 40, .06);
  }
  table.v24-mobile-card-table > tbody > tr:not(.total-row) > td {
    display: grid;
    grid-template-columns: minmax(104px, 42%) 1fr;
    gap: 10px;
    align-items: start;
    width: 100% !important;
    min-height: 36px;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px dashed #e1e8e3;
    text-align: left !important;
    overflow-wrap: anywhere;
  }
  table.v24-mobile-card-table > tbody > tr:not(.total-row) > td:last-child { border-bottom: 0; }
  table.v24-mobile-card-table > tbody > tr:not(.total-row) > td::before {
    content: attr(data-label);
    color: #647168;
    font-size: 12px;
    font-weight: 700;
  }
  table.v24-mobile-card-table > tbody > tr.total-row {
    display: grid;
    padding: 12px;
    border: 1px solid #bcd2c1;
    border-radius: 14px;
    background: #edf7ef;
  }
  table.v24-mobile-card-table > tbody > tr.total-row > td { display: block; padding: 4px 0; border: 0; text-align: left !important; }
  table.v24-mobile-card-table .row-actions { display: grid; grid-template-columns: 1fr; gap: 7px; }
  table.v24-mobile-card-table .row-actions .button { width: 100%; }

  /* Editable batch tables remain horizontally scrollable to preserve input relationships. */
  .v24-input-table, .project-package-table { min-width: 900px !important; }
  .v24-input-table input { min-height: 42px; }
  .v24-approved-bills .table-wrap { overflow: visible; }

  .project-report-document .table-wrap { overflow-x: auto; }
  .project-report-document table { min-width: 720px; }
}

@media print {
  .v24-pdf-host { position: static; left: auto; }
}
