/* ============================================================
   monday.com-style table styling
   ============================================================ */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

table#mainTable {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 12px;
  background: #fff;
}
#mainTable th, #mainTable td {
  border-bottom: 1px solid #e8ecf1;
  text-align: center;
  padding: 6px 8px;
  vertical-align: middle;
}
#mainTable tbody tr:last-child td { border-bottom: none; }

/* ---------- header ---------- */
#mainTable thead th {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.03em;
  border-bottom: 2px solid #e2e8f0;
  padding: 8px 6px;
}
#mainTable thead tr:first-child th { border-bottom: 2px solid #e2e8f0; }

/* fixed leading columns */
#mainTable thead th.fixed-hdr { background: #f1f5f9; color: #475569; }
#mainTable td.fixed-cell { font-weight: 600; color: #334155; background: #fafbfc; }
/* plain column-label row (r3) */
#mainTable thead tr:nth-child(3) th { background: #f8fafc; color: #334155; }

/* group headers — pastel palette, assigned by JS */
#mainTable .group-hdr { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 2px solid rgba(0,0,0,0.06); }

/* sub-headers */
#mainTable .sub-plan   { background: #fef3c7 !important; color: #92400e; }
#mainTable .sub-actual { background: #ffe4e6 !important; color: #9f1239; }
#mainTable .sub-neutral{ background: #f8fafc !important; color: #475569; }

/* ---------- body ---------- */
#mainTable tbody tr:hover td { background: #f4f7fb; }
#mainTable tbody tr:hover td.fixed-cell { background: #eef3f9; }

/* ---------- inputs ---------- */
td input, td select, td textarea {
  width: 100%;
  border: none;
  font-size: 12px;
  padding: 4px 6px;
  background: transparent;
  outline: none;
  border-radius: 6px;
}
td.text-left-cell input { text-align: left; }
td.text-left-cell textarea { text-align: left; }
td input:focus, td select:focus, td textarea:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
}

/* From/To dropdown: small font so P-1..P-100 fit the narrow column.
   min-width on the header prevents auto table layout from collapsing it. */
#mainTable thead tr:nth-child(3) th.w-14 { min-width: 64px; }
td select.loc-select {
  font-size: 10px;
  padding: 2px 2px;
  letter-spacing: -0.2px;
  text-align-last: center;
  cursor: pointer;
}
td select.loc-select:hover { background: #f1f5f9; }

/* Brief Description: auto-growing textarea */
td textarea {
  display: block;
  text-align: left;
  font-family: inherit;
  line-height: 1.35;
  resize: none;
  overflow: hidden;
}

/* Remarks */
td.remarks-cell textarea { text-align: left; }

/* signatures (paper-form style: label only above the signature line) */
.sig-label {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.1;
}
td .signature {
  display: block;
  width: 170px;
  max-width: 90%;
  border: none;
  border-bottom: 1px dashed #94a3b8;
  font-size: 12px;
  background: transparent;
  outline: none;
  padding: 2px 4px;
  margin: 0 auto;
}

/* ---------- print: A4 landscape, keep colors ---------- */
@page { size: A4 landscape; margin: 10mm; }
@media print {
  /* force browsers (Chrome/Edge) to print background colors */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: white; }
  .no-print { display: none !important; }
  th, td { border-bottom-color: #cbd5e1; }
  td input, td select, td textarea { box-shadow: none !important; background: transparent !important; }
  /* print selects as plain text so P-1..P-100 show fully */
  td select { -webkit-appearance: none; appearance: none; border: none !important; }
  td select.loc-select { font-size: 10px; padding: 0; letter-spacing: 0; }
  #mainTable thead tr:nth-child(3) th.w-14 { min-width: 46px; }
  td .signature { width: 140px; border-bottom: 1px solid #94a3b8; }
  .overflow-x-auto { overflow: visible; }
  #appScreen { padding: 0; }
}
