/* Handmade / legacy forms modernizer
   - Covers old hand-written forms without changing PHP logic
   - Applied via js/me/handmade-forms-modern.v1.js
*/

:root{
  --hf-surface: rgba(255,255,255,.90);
  --hf-surface-2: rgba(248,250,252,.96);
  --hf-border: rgba(15,23,42,.10);
  --hf-border-strong: rgba(15,23,42,.16);
  --hf-text: #0f172a;
  --hf-muted: rgba(15,23,42,.64);
  --hf-primary: #2563eb;
  --hf-primary-soft: rgba(37,99,235,.12);
  --hf-shadow: 0 14px 36px rgba(15,23,42,.08);
  --hf-shadow-sm: 0 8px 22px rgba(15,23,42,.06);
  --hf-radius: 18px;
  --hf-radius-sm: 14px;
}

body[data-site-theme="dark"]{
  --hf-surface: rgba(15,23,42,.88);
  --hf-surface-2: rgba(20,31,52,.94);
  --hf-border: rgba(148,163,184,.22);
  --hf-border-strong: rgba(148,163,184,.30);
  --hf-text: #edf2ff;
  --hf-muted: rgba(226,232,240,.72);
  --hf-primary: #7aa2ff;
  --hf-primary-soft: rgba(122,162,255,.16);
  --hf-shadow: 0 18px 42px rgba(2,6,23,.34);
  --hf-shadow-sm: 0 12px 26px rgba(2,6,23,.22);
}

/* ---------- Form shell ---------- */
form.ntt-legacy-form{
  display:block;
  width:100%;
  max-width:100%;
  margin:0 0 18px;
  padding:18px 20px;
  border:1px solid var(--hf-border);
  border-radius:var(--hf-radius);
  background:linear-gradient(180deg, var(--hf-surface), var(--hf-surface-2));
  box-shadow:var(--hf-shadow-sm);
}

.panel-body > form.ntt-legacy-form:first-child:last-child,
.list-group > form.ntt-legacy-form:first-child:last-child,
.table-responsive + form.ntt-legacy-form{
  margin-top:14px;
}

form.ntt-legacy-form.ntt-form-compact{
  padding:14px 16px;
  border-radius:16px;
}

form.ntt-legacy-form .form-control,
form.ntt-legacy-form input[type="text"],
form.ntt-legacy-form input[type="password"],
form.ntt-legacy-form input[type="email"],
form.ntt-legacy-form input[type="number"],
form.ntt-legacy-form input[type="date"],
form.ntt-legacy-form input[type="time"],
form.ntt-legacy-form input[type="search"],
form.ntt-legacy-form input[type="url"],
form.ntt-legacy-form select,
form.ntt-legacy-form textarea{
  min-height:42px;
  border-radius:14px;
  border:1px solid var(--hf-border);
  background:#fff;
  color:var(--hf-text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
  transition:border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}

body[data-site-theme="dark"] form.ntt-legacy-form .form-control,
body[data-site-theme="dark"] form.ntt-legacy-form input[type="text"],
body[data-site-theme="dark"] form.ntt-legacy-form input[type="password"],
body[data-site-theme="dark"] form.ntt-legacy-form input[type="email"],
body[data-site-theme="dark"] form.ntt-legacy-form input[type="number"],
body[data-site-theme="dark"] form.ntt-legacy-form input[type="date"],
body[data-site-theme="dark"] form.ntt-legacy-form input[type="time"],
body[data-site-theme="dark"] form.ntt-legacy-form input[type="search"],
body[data-site-theme="dark"] form.ntt-legacy-form input[type="url"],
body[data-site-theme="dark"] form.ntt-legacy-form select,
body[data-site-theme="dark"] form.ntt-legacy-form textarea{
  background:var(--hf-surface-2);
  color:var(--hf-text);
  box-shadow:none;
}

form.ntt-legacy-form input::placeholder,
form.ntt-legacy-form textarea::placeholder{ color:var(--hf-muted); }

form.ntt-legacy-form .form-control:focus,
form.ntt-legacy-form input[type="text"]:focus,
form.ntt-legacy-form input[type="password"]:focus,
form.ntt-legacy-form input[type="email"]:focus,
form.ntt-legacy-form input[type="number"]:focus,
form.ntt-legacy-form input[type="date"]:focus,
form.ntt-legacy-form input[type="time"]:focus,
form.ntt-legacy-form input[type="search"]:focus,
form.ntt-legacy-form input[type="url"]:focus,
form.ntt-legacy-form select:focus,
form.ntt-legacy-form textarea:focus{
  border-color:var(--hf-primary);
  box-shadow:0 0 0 4px var(--hf-primary-soft);
  outline:none;
}

form.ntt-legacy-form textarea{
  min-height:110px;
  resize:vertical;
  line-height:1.55;
}

form.ntt-legacy-form select[multiple]{
  min-height:180px;
}

/* ---------- File input ---------- */
form.ntt-legacy-form .ntt-file-control,
form.ntt-legacy-form input[type="file"]{
  display:block;
  width:100%;
  max-width:100%;
  padding:10px 12px;
  border:1px dashed var(--hf-border-strong);
  border-radius:16px;
  background:rgba(255,255,255,.72);
  color:var(--hf-text);
}
body[data-site-theme="dark"] form.ntt-legacy-form .ntt-file-control,
body[data-site-theme="dark"] form.ntt-legacy-form input[type="file"]{
  background:rgba(15,23,42,.46);
}
form.ntt-legacy-form input[type="file"]::file-selector-button{
  margin-right:12px;
  padding:9px 14px;
  border:0;
  border-radius:12px;
  background:var(--hf-primary-soft);
  color:var(--hf-primary);
  font-weight:700;
  cursor:pointer;
}

/* ---------- Choice controls ---------- */
form.ntt-legacy-form input[type="checkbox"],
form.ntt-legacy-form input[type="radio"]{
  accent-color:var(--hf-primary);
  width:16px;
  height:16px;
  vertical-align:-2px;
}
form.ntt-legacy-form label{
  color:var(--hf-text);
  font-weight:600;
}
form.ntt-legacy-form .cb-inline,
form.ntt-legacy-form .ntt-choice-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin:0 10px 10px 0;
  padding:8px 12px;
  border:1px solid var(--hf-border);
  border-radius:999px;
  background:rgba(255,255,255,.66);
}
body[data-site-theme="dark"] form.ntt-legacy-form .cb-inline,
body[data-site-theme="dark"] form.ntt-legacy-form .ntt-choice-chip{
  background:rgba(30,41,59,.64);
}

/* ---------- Buttons ---------- */
form.ntt-legacy-form .btn,
form.ntt-legacy-form button,
form.ntt-legacy-form input[type="submit"],
form.ntt-legacy-form input[type="button"],
form.ntt-legacy-form input[type="reset"]{
  min-height:40px;
  border-radius:14px;
  font-weight:700;
}

form.ntt-legacy-form .ntt-form-actions,
form.ntt-legacy-form p.ntt-form-actions,
form.ntt-legacy-form .ntt-actions-inline{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:center;
  gap:10px;
  margin:16px 0 4px !important;
  text-align:center !important;
}

form.ntt-legacy-form p[align="center"]{
  text-align:center !important;
}

/* ---------- Small grid / setting tables ---------- */
form.ntt-legacy-form .ntt-form-grid-table,
.ntt-legacy-form-shell .ntt-form-grid-table{
  width:100% !important;
  max-width:100% !important;
  margin:0;
  border-collapse:separate !important;
  border-spacing:0 12px !important;
}

form.ntt-legacy-form .ntt-form-grid-table[width],
.ntt-legacy-form-shell .ntt-form-grid-table[width]{
  width:100% !important;
  max-width:100% !important;
}

form.ntt-legacy-form table[width="200%"],
form.ntt-legacy-form table[width='200%'],
.ntt-legacy-form-shell table[width="200%"],
.ntt-legacy-form-shell table[width='200%']{
  width:100% !important;
  max-width:100% !important;
}

form.ntt-legacy-form .ntt-form-grid-table tr,
.ntt-legacy-form-shell .ntt-form-grid-table tr{
  background:transparent;
}

form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td,
form.ntt-legacy-form .ntt-form-grid-table > tr > td,
form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th,
form.ntt-legacy-form .ntt-form-grid-table > tr > th,
.ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > td,
.ntt-legacy-form-shell .ntt-form-grid-table > tr > td,
.ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > th,
.ntt-legacy-form-shell .ntt-form-grid-table > tr > th{
  padding:0 8px;
  border:0 !important;
  vertical-align:top;
}

form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th:first-child,
form.ntt-legacy-form .ntt-form-grid-table > tr > th:first-child,
.ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > td:first-child,
.ntt-legacy-form-shell .ntt-form-grid-table > tr > td:first-child,
.ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > th:first-child,
.ntt-legacy-form-shell .ntt-form-grid-table > tr > th:first-child{
  width:clamp(120px, 20%, 170px) !important;
  min-width:120px !important;
  max-width:170px !important;
  padding-top:10px;
  color:var(--hf-text);
  font-weight:700;
}

form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th:last-child,
form.ntt-legacy-form .ntt-form-grid-table > tr > th:last-child,
.ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > td:last-child,
.ntt-legacy-form-shell .ntt-form-grid-table > tr > td:last-child,
.ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > th:last-child,
.ntt-legacy-form-shell .ntt-form-grid-table > tr > th:last-child{
  padding:12px 14px;
  border:1px solid var(--hf-border) !important;
  border-radius:16px;
  background:rgba(255,255,255,.62);
  box-shadow:0 1px 0 rgba(255,255,255,.7) inset;
}

body[data-site-theme="dark"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body[data-site-theme="dark"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
body[data-site-theme="dark"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th:last-child,
body[data-site-theme="dark"] form.ntt-legacy-form .ntt-form-grid-table > tr > th:last-child,
body[data-site-theme="dark"] .ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > td:last-child,
body[data-site-theme="dark"] .ntt-legacy-form-shell .ntt-form-grid-table > tr > td:last-child,
body[data-site-theme="dark"] .ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > th:last-child,
body[data-site-theme="dark"] .ntt-legacy-form-shell .ntt-form-grid-table > tr > th:last-child{
  background:rgba(15,23,42,.54);
  box-shadow:none;
}

form.ntt-legacy-form .ntt-form-grid-table .form-control,
form.ntt-legacy-form .ntt-form-grid-table input[type="text"],
form.ntt-legacy-form .ntt-form-grid-table input[type="number"],
form.ntt-legacy-form .ntt-form-grid-table input[type="email"],
form.ntt-legacy-form .ntt-form-grid-table input[type="password"],
form.ntt-legacy-form .ntt-form-grid-table select,
form.ntt-legacy-form .ntt-form-grid-table textarea,
form.ntt-legacy-form .ntt-form-grid-table input[type="file"],
.ntt-legacy-form-shell .ntt-form-grid-table .form-control,
.ntt-legacy-form-shell .ntt-form-grid-table input[type="text"],
.ntt-legacy-form-shell .ntt-form-grid-table input[type="number"],
.ntt-legacy-form-shell .ntt-form-grid-table input[type="email"],
.ntt-legacy-form-shell .ntt-form-grid-table input[type="password"],
.ntt-legacy-form-shell .ntt-form-grid-table select,
.ntt-legacy-form-shell .ntt-form-grid-table textarea,
.ntt-legacy-form-shell .ntt-form-grid-table input[type="file"]{
  width:100% !important;
}

/* ---------- Generic tables inside forms ---------- */
form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table){
  width:100%;
  max-width:100%;
}

form.ntt-legacy-form .table-responsive{
  border-radius:16px;
  border:1px solid var(--hf-border);
  background:rgba(255,255,255,.55);
}
body[data-site-theme="dark"] form.ntt-legacy-form .table-responsive{
  background:rgba(15,23,42,.42);
}

/* ---------- Text / notes ---------- */
form.ntt-legacy-form small,
form.ntt-legacy-form .help-block,
form.ntt-legacy-form .text-muted,
form.ntt-legacy-form font[color="darkred"],
form.ntt-legacy-form font[color="red"],
form.ntt-legacy-form font[color="blue"],
form.ntt-legacy-form h4,
form.ntt-legacy-form h5{
  color:var(--hf-muted) !important;
}

body[data-site-theme="dark"] form.ntt-legacy-form font[color="red"]{ color:#fca5a5 !important; }
body[data-site-theme="dark"] form.ntt-legacy-form font[color="blue"]{ color:#93c5fd !important; }

form.ntt-legacy-form hr{
  border-top:1px solid var(--hf-border);
}

/* ---------- Responsive ---------- */
@media (max-width: 991px){
  form.ntt-legacy-form{
    padding:16px;
    border-radius:16px;
  }
  form.ntt-legacy-form .ntt-form-grid-table,
  form.ntt-legacy-form .ntt-form-grid-table > tbody,
  form.ntt-legacy-form .ntt-form-grid-table > tbody > tr,
  form.ntt-legacy-form .ntt-form-grid-table > tr,
  .ntt-legacy-form-shell .ntt-form-grid-table,
  .ntt-legacy-form-shell .ntt-form-grid-table > tbody,
  .ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr,
  .ntt-legacy-form-shell .ntt-form-grid-table > tr{
    display:block;
    width:100%;
  }
  form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td,
  form.ntt-legacy-form .ntt-form-grid-table > tr > td,
  form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th,
  form.ntt-legacy-form .ntt-form-grid-table > tr > th,
  .ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > td,
  .ntt-legacy-form-shell .ntt-form-grid-table > tr > td,
  .ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > th,
  .ntt-legacy-form-shell .ntt-form-grid-table > tr > th{
    display:block;
    width:100% !important;
    min-width:0 !important;
    padding:0 0 10px !important;
  }
  form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
  form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
  form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th:last-child,
  form.ntt-legacy-form .ntt-form-grid-table > tr > th:last-child,
  .ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > td:last-child,
  .ntt-legacy-form-shell .ntt-form-grid-table > tr > td:last-child,
  .ntt-legacy-form-shell .ntt-form-grid-table > tbody > tr > th:last-child,
  .ntt-legacy-form-shell .ntt-form-grid-table > tr > th:last-child{
    padding:12px !important;
  }
}

@media (max-width: 640px){
  form.ntt-legacy-form{
    padding:14px;
  }
  form.ntt-legacy-form .ntt-form-actions,
  form.ntt-legacy-form p.ntt-form-actions,
  form.ntt-legacy-form .ntt-actions-inline{
    justify-content:stretch;
  }
  form.ntt-legacy-form .ntt-form-actions > .btn,
  form.ntt-legacy-form .ntt-form-actions > button,
  form.ntt-legacy-form .ntt-form-actions > input[type="submit"],
  form.ntt-legacy-form .ntt-form-actions > input[type="button"],
  form.ntt-legacy-form .ntt-form-actions > input[type="reset"]{
    flex:1 1 100%;
  }
}


/* ---------- Focused row highlight ---------- */
form.ntt-legacy-form .ntt-form-grid-table > tbody > tr,
form.ntt-legacy-form .ntt-form-grid-table > tr,
form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tbody > tr,
form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tr{
  transition:background-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

form.ntt-legacy-form .ntt-form-grid-table > tbody > tr.ntt-form-row-active > td:first-child,
form.ntt-legacy-form .ntt-form-grid-table > tr.ntt-form-row-active > td:first-child,
form.ntt-legacy-form .ntt-form-grid-table > tbody > tr.ntt-form-row-active > th:first-child,
form.ntt-legacy-form .ntt-form-grid-table > tr.ntt-form-row-active > th:first-child{
  color:var(--hf-primary);
}

form.ntt-legacy-form .ntt-form-grid-table > tbody > tr.ntt-form-row-active > td:last-child,
form.ntt-legacy-form .ntt-form-grid-table > tr.ntt-form-row-active > td:last-child,
form.ntt-legacy-form .ntt-form-grid-table > tbody > tr.ntt-form-row-active > th:last-child,
form.ntt-legacy-form .ntt-form-grid-table > tr.ntt-form-row-active > th:last-child{
  border-color:rgba(37,99,235,.38) !important;
  background:rgba(37,99,235,.08) !important;
  box-shadow:0 0 0 3px rgba(37,99,235,.08), 0 0 0 1px rgba(37,99,235,.18) inset;
}

form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > td,
form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > td,
form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > th,
form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > th{
  background:rgba(37,99,235,.08) !important;
}

form.ntt-legacy-form .ntt-form-row-active .form-control,
form.ntt-legacy-form .ntt-form-row-active input[type="text"],
form.ntt-legacy-form .ntt-form-row-active input[type="password"],
form.ntt-legacy-form .ntt-form-row-active input[type="email"],
form.ntt-legacy-form .ntt-form-row-active input[type="number"],
form.ntt-legacy-form .ntt-form-row-active input[type="date"],
form.ntt-legacy-form .ntt-form-row-active input[type="time"],
form.ntt-legacy-form .ntt-form-row-active input[type="search"],
form.ntt-legacy-form .ntt-form-row-active input[type="url"],
form.ntt-legacy-form .ntt-form-row-active select,
form.ntt-legacy-form .ntt-form-row-active textarea{
  border-color:rgba(37,99,235,.42);
  box-shadow:0 0 0 3px rgba(37,99,235,.08);
}

body[data-site-theme="dark"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr.ntt-form-row-active > td:last-child,
body[data-site-theme="dark"] form.ntt-legacy-form .ntt-form-grid-table > tr.ntt-form-row-active > td:last-child,
body[data-site-theme="dark"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr.ntt-form-row-active > th:last-child,
body[data-site-theme="dark"] form.ntt-legacy-form .ntt-form-grid-table > tr.ntt-form-row-active > th:last-child,
body.dark-mode form.ntt-legacy-form .ntt-form-grid-table > tbody > tr.ntt-form-row-active > td:last-child,
body.dark-mode form.ntt-legacy-form .ntt-form-grid-table > tr.ntt-form-row-active > td:last-child,
body.dark-mode form.ntt-legacy-form .ntt-form-grid-table > tbody > tr.ntt-form-row-active > th:last-child,
body.dark-mode form.ntt-legacy-form .ntt-form-grid-table > tr.ntt-form-row-active > th:last-child{
  background:rgba(37,99,235,.16) !important;
  border-color:rgba(96,165,250,.4) !important;
  box-shadow:0 0 0 3px rgba(59,130,246,.14), 0 0 0 1px rgba(96,165,250,.14) inset;
}

body[data-site-theme="dark"] form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > td,
body[data-site-theme="dark"] form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > td,
body[data-site-theme="dark"] form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > th,
body[data-site-theme="dark"] form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > th,
body.dark-mode form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > td,
body.dark-mode form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > td,
body.dark-mode form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > th,
body.dark-mode form.ntt-legacy-form table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > th{
  background:rgba(37,99,235,.14) !important;
}



/* ---------- Generic active row highlight for legacy scopes ---------- */
form.ntt-legacy-form .form-group,
form.ntt-legacy-form .control-group,
form.ntt-legacy-form .row,
form.ntt-legacy-form p,
form.ntt-legacy-form li,
form.ntt-legacy-form fieldset,
form.ntt-legacy-form .input-group,
.ntt-legacy-form-shell .form-group,
.ntt-legacy-form-shell .control-group,
.ntt-legacy-form-shell .row,
.ntt-legacy-form-shell p,
.ntt-legacy-form-shell li,
.ntt-legacy-form-shell fieldset,
.ntt-legacy-form-shell .input-group,
.ntt-legacy-form-shell tr{
  transition:background-color .16s ease, box-shadow .16s ease, border-color .16s ease;
}

form.ntt-legacy-form .form-group.ntt-form-row-active,
form.ntt-legacy-form .control-group.ntt-form-row-active,
form.ntt-legacy-form .row.ntt-form-row-active,
form.ntt-legacy-form p.ntt-form-row-active,
form.ntt-legacy-form li.ntt-form-row-active,
form.ntt-legacy-form fieldset.ntt-form-row-active,
form.ntt-legacy-form .input-group.ntt-form-row-active,
.ntt-legacy-form-shell .form-group.ntt-form-row-active,
.ntt-legacy-form-shell .control-group.ntt-form-row-active,
.ntt-legacy-form-shell .row.ntt-form-row-active,
.ntt-legacy-form-shell p.ntt-form-row-active,
.ntt-legacy-form-shell li.ntt-form-row-active,
.ntt-legacy-form-shell fieldset.ntt-form-row-active,
.ntt-legacy-form-shell .input-group.ntt-form-row-active{
  background:rgba(37,99,235,.08) !important;
  box-shadow:0 0 0 1px rgba(37,99,235,.12) inset;
  border-radius:14px;
}

body[data-site-theme="dark"] form.ntt-legacy-form .form-group.ntt-form-row-active,
body[data-site-theme="dark"] form.ntt-legacy-form .control-group.ntt-form-row-active,
body[data-site-theme="dark"] form.ntt-legacy-form .row.ntt-form-row-active,
body[data-site-theme="dark"] form.ntt-legacy-form p.ntt-form-row-active,
body[data-site-theme="dark"] form.ntt-legacy-form li.ntt-form-row-active,
body[data-site-theme="dark"] form.ntt-legacy-form fieldset.ntt-form-row-active,
body[data-site-theme="dark"] form.ntt-legacy-form .input-group.ntt-form-row-active,
body[data-site-theme="dark"] .ntt-legacy-form-shell .form-group.ntt-form-row-active,
body[data-site-theme="dark"] .ntt-legacy-form-shell .control-group.ntt-form-row-active,
body[data-site-theme="dark"] .ntt-legacy-form-shell .row.ntt-form-row-active,
body[data-site-theme="dark"] .ntt-legacy-form-shell p.ntt-form-row-active,
body[data-site-theme="dark"] .ntt-legacy-form-shell li.ntt-form-row-active,
body[data-site-theme="dark"] .ntt-legacy-form-shell fieldset.ntt-form-row-active,
body[data-site-theme="dark"] .ntt-legacy-form-shell .input-group.ntt-form-row-active,
body.dark-mode form.ntt-legacy-form .form-group.ntt-form-row-active,
body.dark-mode form.ntt-legacy-form .control-group.ntt-form-row-active,
body.dark-mode form.ntt-legacy-form .row.ntt-form-row-active,
body.dark-mode form.ntt-legacy-form p.ntt-form-row-active,
body.dark-mode form.ntt-legacy-form li.ntt-form-row-active,
body.dark-mode form.ntt-legacy-form fieldset.ntt-form-row-active,
body.dark-mode form.ntt-legacy-form .input-group.ntt-form-row-active,
body.dark-mode .ntt-legacy-form-shell .form-group.ntt-form-row-active,
body.dark-mode .ntt-legacy-form-shell .control-group.ntt-form-row-active,
body.dark-mode .ntt-legacy-form-shell .row.ntt-form-row-active,
body.dark-mode .ntt-legacy-form-shell p.ntt-form-row-active,
body.dark-mode .ntt-legacy-form-shell li.ntt-form-row-active,
body.dark-mode .ntt-legacy-form-shell fieldset.ntt-form-row-active,
body.dark-mode .ntt-legacy-form-shell .input-group.ntt-form-row-active{
  background:rgba(37,99,235,.14) !important;
  box-shadow:0 0 0 1px rgba(96,165,250,.18) inset;
}

.ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > td,
.ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > td,
.ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > th,
.ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > th{
  background:rgba(37,99,235,.08) !important;
}

body[data-site-theme="dark"] .ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > td,
body[data-site-theme="dark"] .ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > td,
body[data-site-theme="dark"] .ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > th,
body[data-site-theme="dark"] .ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > th,
body.dark-mode .ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > td,
body.dark-mode .ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > td,
body.dark-mode .ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tbody > tr.ntt-form-row-active > th,
body.dark-mode .ntt-legacy-form-shell table:not(.table):not(.ntt-form-grid-table) > tr.ntt-form-row-active > th{
  background:rgba(37,99,235,.14) !important;
}

form.ntt-legacy-form .ntt-form-row-active .form-control,
form.ntt-legacy-form .ntt-form-row-active input[type="text"],
form.ntt-legacy-form .ntt-form-row-active input[type="password"],
form.ntt-legacy-form .ntt-form-row-active input[type="email"],
form.ntt-legacy-form .ntt-form-row-active input[type="number"],
form.ntt-legacy-form .ntt-form-row-active input[type="date"],
form.ntt-legacy-form .ntt-form-row-active input[type="time"],
form.ntt-legacy-form .ntt-form-row-active input[type="search"],
form.ntt-legacy-form .ntt-form-row-active input[type="url"],
form.ntt-legacy-form .ntt-form-row-active select,
form.ntt-legacy-form .ntt-form-row-active textarea,
.ntt-legacy-form-shell .ntt-form-row-active .form-control,
.ntt-legacy-form-shell .ntt-form-row-active input[type="text"],
.ntt-legacy-form-shell .ntt-form-row-active input[type="password"],
.ntt-legacy-form-shell .ntt-form-row-active input[type="email"],
.ntt-legacy-form-shell .ntt-form-row-active input[type="number"],
.ntt-legacy-form-shell .ntt-form-row-active input[type="date"],
.ntt-legacy-form-shell .ntt-form-row-active input[type="time"],
.ntt-legacy-form-shell .ntt-form-row-active input[type="search"],
.ntt-legacy-form-shell .ntt-form-row-active input[type="url"],
.ntt-legacy-form-shell .ntt-form-row-active select,
.ntt-legacy-form-shell .ntt-form-row-active textarea{
  border-color:rgba(37,99,235,.42);
  box-shadow:0 0 0 3px rgba(37,99,235,.08);
}

/* ---------- Denser label/control spacing on key admin forms ---------- */
body[data-code="register"] form.ntt-legacy-form,
body[data-code="dsadmin"] form.ntt-legacy-form{
  max-width:1100px;
  margin-left:auto;
  margin-right:auto;
}

body[data-code="register"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
body[data-code="register"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
body[data-code="register"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th:first-child,
body[data-code="register"] form.ntt-legacy-form .ntt-form-grid-table > tr > th:first-child,
body[data-code="dsadmin"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
body[data-code="dsadmin"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
body[data-code="dsadmin"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th:first-child,
body[data-code="dsadmin"] form.ntt-legacy-form .ntt-form-grid-table > tr > th:first-child{
  width:min(220px, 24%);
  min-width:150px;
  padding-right:8px;
}

body[data-code="register"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body[data-code="register"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
body[data-code="register"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th:last-child,
body[data-code="register"] form.ntt-legacy-form .ntt-form-grid-table > tr > th:last-child,
body[data-code="dsadmin"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body[data-code="dsadmin"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
body[data-code="dsadmin"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > th:last-child,
body[data-code="dsadmin"] form.ntt-legacy-form .ntt-form-grid-table > tr > th:last-child{
  padding:10px 12px;
}


/* v317: tighten label/input spacing on addtvroom + addtvmn */
body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table,
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table,
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table,
body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table,
body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table,
body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table{
  width:100% !important;
  max-width:980px;
  margin:0 auto;
  table-layout:fixed;
}

body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child{
  width:168px;
  min-width:168px;
  padding-right:6px;
}

body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:nth-child(2),
body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:nth-child(2),
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:nth-child(2),
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:nth-child(2),
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:nth-child(2),
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:nth-child(2){
  width:88px;
  min-width:88px;
  padding:10px 6px 0 0 !important;
  text-align:center;
  white-space:nowrap;
  color:var(--hf-text);
  font-weight:600;
}

body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child{
  padding:10px 12px !important;
}

body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td[colspan],
body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td[colspan],
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td[colspan],
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td[colspan],
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td[colspan],
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td[colspan]{
  padding-left:0 !important;
  border:0 !important;
  background:transparent !important;
  box-shadow:none !important;
}

body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child{
  width:180px;
  min-width:180px;
  padding-right:8px;
}

body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child,
body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:last-child,
body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:last-child{
  padding:10px 12px !important;
}

body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table .form-control,
body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table .form-control,
body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table .form-control,
body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table .form-control,
body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table .form-control,
body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table .form-control{
  margin:0;
}

@media (max-width: 991px){
  body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table,
  body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table,
  body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table,
  body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table,
  body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table,
  body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table{
    max-width:100%;
    table-layout:auto;
  }
  body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
  body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
  body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:nth-child(2),
  body[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:nth-child(2),
  body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
  body[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
  body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
  body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
  body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:nth-child(2),
  body.dark-mode[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:nth-child(2),
  body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
  body.dark-mode[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
  body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
  body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child,
  body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:nth-child(2),
  body.dark[data-code="addtvroom"] #myTK form.ntt-legacy-form .ntt-form-grid-table > tr > td:nth-child(2),
  body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tbody > tr > td:first-child,
  body.dark[data-code="addtvmn"] form.ntt-legacy-form .ntt-form-grid-table > tr > td:first-child{
    width:100% !important;
    min-width:0 !important;
    padding-right:0 !important;
  }
}


/* ---------- Search rows / compact legacy lookup layout ---------- */
#data-search table#table1 > tbody > tr > td:first-child,
#data-search table#table1 > tr > td:first-child,
#data-search table[id^="table"] > tbody > tr > td:first-child,
#data-search table[id^="table"] > tr > td:first-child{
  width:130px !important;
  min-width:130px !important;
  white-space:nowrap;
}

#data-search table#table1 > tbody > tr > td:nth-child(2),
#data-search table#table1 > tr > td:nth-child(2),
#data-search table[id^="table"] > tbody > tr > td:nth-child(2),
#data-search table[id^="table"] > tr > td:nth-child(2){
  width:56px !important;
  min-width:56px !important;
  white-space:nowrap;
}

#data-search select[name="timbai_col"],
#data-search select[name="timtl_col"],
#data-search select[name="timde_col"]{
  width:180px !important;
  min-width:180px !important;
}

#data-search select[name="timbai_col"] + input.form-control,
#data-search select[name="timtl_col"] + input.form-control,
#data-search select[name="timde_col"] + input.form-control{
  width:calc(100% - 190px) !important;
  min-width:260px;
}

#data-search td > select[name="timbai_col"],
#data-search td > select[name="timtl_col"],
#data-search td > select[name="timde_col"]{
  margin-right:8px;
}

@media (max-width: 767px){
  #data-search select[name="timbai_col"],
  #data-search select[name="timtl_col"],
  #data-search select[name="timde_col"]{
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    margin:0 0 10px !important;
  }

  #data-search select[name="timbai_col"] + input.form-control,
  #data-search select[name="timtl_col"] + input.form-control,
  #data-search select[name="timde_col"] + input.form-control{
    width:100% !important;
    min-width:0 !important;
  }
}


/* v321: force wider search dropdowns and tighter label spacing even when pages use inline widths */
#data-search table#table1 td[width="150"],
#data-search table#table1 td[width="200"],
#data-search table[id^="table"] td[width="150"],
#data-search table[id^="table"] td[width="200"]{
  width:130px !important;
  min-width:130px !important;
}

#data-search table#table1 td[width="72"],
#data-search table#table1 td[width="50"],
#data-search table[id^="table"] td[width="72"],
#data-search table[id^="table"] td[width="50"]{
  width:56px !important;
  min-width:56px !important;
}

#data-search td > select[name="timbai_col"][style],
#data-search td > select[name="timtl_col"][style],
#data-search td > select[name="timde_col"][style]{
  width:180px !important;
  min-width:180px !important;
}

#data-search td > select[name="timbai_col"][style] + input[style],
#data-search td > select[name="timtl_col"][style] + input[style],
#data-search td > select[name="timde_col"][style] + input[style]{
  width:calc(100% - 190px) !important;
}


/* ---------- Search/filter form compacting across list modules ---------- */
#data-dsqtweb .ntt-form-grid-table > tbody > tr > td:first-child,
#data-dsqtweb .ntt-form-grid-table > tr > td:first-child,
#data-dsiproom .ntt-form-grid-table > tbody > tr > td:first-child,
#data-dsiproom .ntt-form-grid-table > tr > td:first-child,
#data-updateusers .ntt-form-grid-table > tbody > tr > td:first-child,
#data-updateusers .ntt-form-grid-table > tr > td:first-child,
#data-updateusersroom .ntt-form-grid-table > tbody > tr > td:first-child,
#data-updateusersroom .ntt-form-grid-table > tr > td:first-child,
#data-resetpass .ntt-form-grid-table > tbody > tr > td:first-child,
#data-resetpass .ntt-form-grid-table > tr > td:first-child,
#data-resetpassroom .ntt-form-grid-table > tbody > tr > td:first-child,
#data-resetpassroom .ntt-form-grid-table > tr > td:first-child,
#data-addremoveuser .ntt-form-grid-table > tbody > tr > td:first-child,
#data-addremoveuser .ntt-form-grid-table > tr > td:first-child{
  width:clamp(118px, 18%, 156px) !important;
  min-width:118px !important;
  max-width:156px !important;
}

#data-dsqtweb .ntt-form-grid-table,
#data-dsiproom .ntt-form-grid-table,
#data-updateusers .ntt-form-grid-table,
#data-updateusersroom .ntt-form-grid-table,
#data-resetpass .ntt-form-grid-table,
#data-resetpassroom .ntt-form-grid-table,
#data-addremoveuser .ntt-form-grid-table{
  width:100% !important;
  max-width:100% !important;
}

/* Safety: never reveal legacy hidden inputs */
form.ntt-legacy-form input[hidden],
form.ntt-legacy-form input[type="hidden"],
.ntt-legacy-form-shell input[hidden],
.ntt-legacy-form-shell input[type="hidden"]{
  display:none !important;
  width:0 !important;
  min-width:0 !important;
  max-width:0 !important;
  height:0 !important;
  min-height:0 !important;
  padding:0 !important;
  margin:0 !important;
  border:0 !important;
  box-shadow:none !important;
}
