/* THC-owned form controls. Native inputs remain in the document as no-JS fallbacks. */
.thc-select,
.thc-datetime {
  position: relative;
  width: 100%;
  min-width: 0;
}

select.thc-native-select,
input.thc-native-datetime {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
}

.thc-select-button,
.thc-date-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 42px 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(8, 12, 29, .98), rgba(5, 7, 19, .98));
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.thc-select-button:hover,
.thc-date-button:hover {
  border-color: rgba(123, 255, 78, .46);
  background: linear-gradient(135deg, rgba(12, 20, 36, .99), rgba(8, 9, 25, .99));
}

.thc-select-button:focus-visible,
.thc-date-button:focus-visible {
  outline: none;
  border-color: rgba(123, 255, 78, .82);
  box-shadow: 0 0 0 3px rgba(82, 255, 24, .12), 0 0 28px rgba(82, 255, 24, .08);
}

.thc-select-button:disabled,
.thc-date-button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.thc-select-value,
.thc-date-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thc-select-button::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid var(--green-soft);
  border-bottom: 2px solid var(--green-soft);
  transform: rotate(45deg);
  transition: transform .18s ease, margin .18s ease;
}

.thc-select.is-open .thc-select-button::after {
  margin-top: -2px;
  transform: rotate(225deg);
}

.thc-select.is-pill {
  display: inline-flex;
  width: auto;
}

.thc-select.is-pill .thc-select-button {
  width: auto;
  min-height: 32px;
  padding: 6px 31px 6px 12px;
  border-color: rgba(102, 255, 51, .34);
  border-radius: 999px;
  background: rgba(82, 255, 24, .14);
  color: var(--green-soft);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.thc-select.is-pill .thc-select-button::after {
  right: 12px;
  width: 7px;
  height: 7px;
}

.thc-select-menu {
  position: fixed;
  z-index: 12000;
  display: grid;
  gap: 4px;
  max-height: min(330px, calc(100vh - 24px));
  padding: 7px;
  overflow: auto;
  border: 1px solid rgba(123, 255, 78, .32);
  border-radius: 15px;
  background: linear-gradient(155deg, #10162b, #080b1b 62%, #110923);
  box-shadow: 0 20px 48px rgba(0, 0, 0, .66), 0 0 0 1px rgba(142, 34, 255, .08) inset;
  scrollbar-width: thin;
  scrollbar-color: rgba(123, 255, 78, .45) rgba(255, 255, 255, .04);
}

.thc-select-menu[hidden] { display: none !important; }

.thc-select-option {
  position: relative;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 9px 38px 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 600 .79rem var(--body, Manrope, sans-serif);
  text-align: left;
  cursor: pointer;
}

.thc-select-option:hover,
.thc-select-option:focus-visible {
  outline: none;
  border-color: rgba(123, 255, 78, .25);
  background: rgba(82, 255, 24, .075);
  color: var(--ink);
}

.thc-select-option[aria-selected="true"] {
  border-color: rgba(123, 255, 78, .36);
  background: linear-gradient(120deg, rgba(82, 255, 24, .13), rgba(142, 34, 255, .09));
  color: var(--green-soft);
}

.thc-select-option[aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 10px;
  height: 5px;
  border-left: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  transform: translateY(-65%) rotate(-45deg);
}

.thc-select-option:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.thc-select-option.is-status-option { padding-left: 31px; }
.thc-select-option.is-status-option::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ba3c3;
  box-shadow: 0 0 10px rgba(155, 163, 195, .45);
  transform: translateY(-50%);
}
.thc-select-option.is-status-option.is-open::before { background: var(--green); box-shadow: 0 0 11px rgba(82, 255, 24, .68); }
.thc-select-option.is-status-option.is-resolved::before { background: #b16cff; box-shadow: 0 0 11px rgba(177, 108, 255, .62); }

.thc-date-button {
  position: relative;
  padding-left: 50px;
}

.thc-date-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 23px;
  height: 22px;
  border: 1px solid rgba(123, 255, 78, .4);
  border-radius: 7px;
  background: rgba(82, 255, 24, .08);
  transform: translateY(-50%);
  pointer-events: none;
}

.thc-date-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 6px;
  border-top: 1px solid rgba(123, 255, 78, .5);
}

.thc-date-icon::after {
  content: "";
  position: absolute;
  left: 6px;
  top: -3px;
  width: 7px;
  height: 5px;
  border-left: 2px solid var(--green-soft);
  border-right: 2px solid var(--green-soft);
}

.thc-date-value.is-placeholder { color: var(--muted); }

.thc-control-tooltip {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: min(250px, calc(100vw - 28px));
  padding: 8px 10px;
  border: 1px solid rgba(123, 255, 78, .25);
  border-radius: 9px;
  background: #11162a;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
  color: #dce3ff;
  font: 600 .68rem/1.35 var(--body, Manrope, sans-serif);
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 5px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
  pointer-events: none;
}

.thc-date-button:hover .thc-control-tooltip,
.thc-date-button:focus-visible .thc-control-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

dialog.thc-date-dialog {
  box-sizing: border-box;
  width: min(380px, calc(100vw - 20px));
  max-height: calc(100dvh - 20px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(123, 255, 78, .34);
  border-radius: 18px;
  background: linear-gradient(155deg, #11162d, #080b1b 62%, #150a27);
  color: var(--ink);
  box-shadow: 0 28px 70px rgba(0, 0, 0, .74), 0 0 42px rgba(82, 255, 24, .07);
}

dialog.thc-date-dialog::backdrop {
  background: rgba(1, 3, 11, .9) !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

.thc-calendar {
  position: relative;
  padding: 14px;
}

.thc-calendar-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 6px;
  margin-bottom: 9px;
}

.thc-calendar-title {
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.thc-calendar-picker { position: relative; }
.thc-calendar-picker > button {
  position: relative;
  min-height: 34px;
  padding: 6px 25px 6px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(207, 218, 255, .045);
  color: var(--ink);
  font: 700 .78rem var(--display, Syne, sans-serif);
  cursor: pointer;
}
.thc-calendar-picker > button::after {
  content: "";
  position: absolute;
  right: 9px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -5px;
  border-right: 1.5px solid var(--green-soft);
  border-bottom: 1.5px solid var(--green-soft);
  transform: rotate(45deg);
}
.thc-calendar-picker > button:hover,
.thc-calendar-picker > button:focus-visible,
.thc-calendar-picker > button[aria-expanded="true"] {
  outline: none;
  border-color: rgba(123, 255, 78, .5);
  background: rgba(82, 255, 24, .075);
  color: var(--green-soft);
}
.thc-calendar-picker-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  max-height: min(224px, calc(100dvh - 120px));
  padding: 6px;
  overflow: auto;
  border: 1px solid rgba(123, 255, 78, .32);
  border-radius: 12px;
  background: linear-gradient(155deg, #11162d, #080b1b 70%, #130a24);
  box-shadow: 0 16px 36px rgba(0, 0, 0, .68);
  scrollbar-width: thin;
  scrollbar-color: rgba(123, 255, 78, .45) rgba(255, 255, 255, .04);
}
.thc-calendar-picker-menu[hidden] { display: none !important; }
.thc-calendar-picker-menu.is-months {
  left: 50%;
  width: 230px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  transform: translateX(-50%);
}
.thc-calendar-picker-menu.is-months:not([hidden]) { display: grid; }
.thc-calendar-picker-menu.is-years { right: 0; width: 102px; }
.thc-calendar-picker-menu button {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: 700 .7rem var(--body, Manrope, sans-serif);
  cursor: pointer;
}
.thc-calendar-picker-menu button:hover,
.thc-calendar-picker-menu button:focus-visible {
  outline: none;
  border-color: rgba(123, 255, 78, .3);
  background: rgba(82, 255, 24, .075);
  color: var(--ink);
}
.thc-calendar-picker-menu button[aria-selected="true"] {
  border-color: rgba(123, 255, 78, .42);
  background: linear-gradient(120deg, rgba(82, 255, 24, .13), rgba(142, 34, 255, .09));
  color: var(--green-soft);
}
.thc-calendar-picker-menu button:disabled { opacity: .3; cursor: not-allowed; }

.thc-calendar-nav,
.thc-calendar-close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(207, 218, 255, .045);
  color: var(--ink);
  font: 700 1.05rem var(--body, Manrope, sans-serif);
  cursor: pointer;
}

.thc-calendar-nav:hover,
.thc-calendar-nav:focus-visible,
.thc-calendar-close:hover,
.thc-calendar-close:focus-visible {
  outline: none;
  border-color: rgba(123, 255, 78, .55);
  color: var(--green-soft);
}
.thc-calendar-nav:disabled { opacity: .28; cursor: not-allowed; }

.thc-calendar-weekdays,
.thc-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}

.thc-calendar-weekdays {
  margin-bottom: 3px;
  color: var(--dim);
  font-size: .65rem;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.thc-calendar-weekdays span { padding: 3px 0; }

.thc-calendar-day {
  height: 35px;
  min-width: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: 700 .76rem var(--body, Manrope, sans-serif);
  cursor: pointer;
}

.thc-calendar-day:hover,
.thc-calendar-day:focus-visible {
  outline: none;
  border-color: rgba(123, 255, 78, .35);
  background: rgba(82, 255, 24, .07);
  color: var(--ink);
}

.thc-calendar-day.is-outside { color: rgba(177, 184, 213, .36); }
.thc-calendar-day.is-today { border-color: rgba(193, 92, 255, .48); color: #eadcff; }
.thc-calendar-day.is-selected {
  border-color: rgba(123, 255, 78, .75);
  background: linear-gradient(135deg, rgba(82, 255, 24, .22), rgba(142, 34, 255, .15));
  color: #edffe8;
  box-shadow: 0 0 22px rgba(82, 255, 24, .09);
}
.thc-calendar-day:disabled { opacity: .2; cursor: not-allowed; }

.thc-time-panel {
  display: grid;
  grid-template-columns:minmax(0, 1fr) auto minmax(0, 1fr) minmax(90px, .9fr);
  align-items: end;
  gap: 7px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(4, 6, 17, .5);
}

.thc-time-field {
  display: grid;
  gap: 6px;
  color: var(--green-soft);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.thc-time-field input {
  width: 100%;
  min-height: 36px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #090d1e;
  color: var(--ink);
  font: 700 .86rem var(--body, Manrope, sans-serif);
  text-align: center;
  appearance: textfield;
}

.thc-time-field input::-webkit-inner-spin-button,
.thc-time-field input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.thc-time-field input:focus { outline: none; border-color: rgba(123, 255, 78, .68); box-shadow: 0 0 0 3px rgba(82, 255, 24, .1); }
.thc-time-colon { padding-bottom: 10px; color: var(--dim); font-weight: 800; }

.thc-period {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.thc-period button {
  min-height: 36px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #090d1e;
  color: var(--muted);
  font: 800 .71rem var(--body, Manrope, sans-serif);
  cursor: pointer;
}

.thc-period button[aria-pressed="true"] {
  border-color: rgba(123, 255, 78, .52);
  background: rgba(82, 255, 24, .13);
  color: var(--green-soft);
}

.thc-date-error {
  min-height: 14px;
  margin: 6px 2px 0;
  color: #ffc7c7;
  font-size: .72rem;
}

.thc-calendar-actions {
  display: flex;
  justify-content: space-between;
  gap: 9px;
  margin-top: 6px;
}

.thc-calendar-actions > div { display: flex; gap: 8px; }
.thc-calendar-actions button {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(207, 218, 255, .045);
  color: var(--ink);
  font: 700 .73rem var(--body, Manrope, sans-serif);
  cursor: pointer;
}
.thc-calendar-actions button:hover,
.thc-calendar-actions button:focus-visible { outline: none; border-color: rgba(123, 255, 78, .5); }
.thc-calendar-actions .thc-date-apply { border-color: rgba(123, 255, 78, .42); background: rgba(82, 255, 24, .12); color: var(--green-soft); }

html body .field input[type="file"]::file-selector-button,
html body .field input[type="file"]::-webkit-file-upload-button {
  margin: 5px 12px 5px 5px;
  min-height: 36px;
  border: 1px solid rgba(123, 255, 78, .28);
  border-radius: 10px;
}

@media (max-width: 360px) {
  dialog.thc-date-dialog { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .thc-calendar { padding: 10px; }
  .thc-calendar-day { border-radius: 9px; font-size: .72rem; }
  .thc-time-panel { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .thc-period { grid-column: 1 / -1; }
  .thc-calendar-actions { align-items: stretch; flex-direction: column; }
  .thc-calendar-actions > div { display: grid; grid-template-columns: 1fr 1fr; }
  .thc-calendar-actions button { width: 100%; }
}

@media (max-width: 520px), (pointer: coarse) {
  .thc-control-tooltip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .thc-select-button,
  .thc-date-button,
  .thc-select-button::after,
  .thc-control-tooltip { transition: none; }
}
