/* ABOUTME: Shared tables, controls, forms, and page-specific MJS v3 components. */

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  font-size: 13px;
}

th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--hair);
  vertical-align: middle;
}

tbody tr:hover {
  background: #f6f6f4;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th.n,
td.n {
  text-align: right;
}

td.date,
td.n {
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

td a {
  font-weight: 600;
}

table.plain th:first-child,
table.plain td:first-child {
  padding-left: 0;
}

table.plain th:last-child,
table.plain td:last-child {
  padding-right: 0;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.panel > .table-scroll {
  margin-top: 12px;
}

.table-panel {
  padding: 0 20px;
}

.table-panel > .table-scroll {
  margin-top: 0;
}

.vac-table {
  min-width: 1080px;
}

.vac-table th:last-child,
.vac-table td:last-child {
  padding-right: 0;
}

.filetag {
  display: inline-block;
  margin-right: 5px;
  padding: 1px 7px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
}

.filetag:hover {
  border-color: var(--ink);
  text-decoration: none;
}

.proof-preview {
  display: inline-block;
  position: relative;
  margin-right: 5px;
  vertical-align: middle;
}

.proof-preview > summary {
  margin-right: 0;
  cursor: pointer;
  list-style: none;
}

.proof-preview > summary::-webkit-details-marker {
  display: none;
}

.proof-preview[open] > summary {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.proof-preview-panel {
  position: fixed;
  z-index: 50;
  top: 50%;
  left: 50%;
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  padding: 12px;
  overflow: auto;
  transform: translate(-50%, -50%);
  border: 1px solid var(--ink);
  background: var(--paper);
  box-shadow: 0 12px 40px rgb(0 0 0 / 24%);
}

.proof-preview-panel img {
  display: block;
  width: 100%;
  height: auto;
}

.proof-download,
.proof-close {
  position: absolute;
  top: 18px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 18px;
  line-height: 1;
}

.proof-download {
  right: 18px;
}

.proof-close {
  left: 18px;
  cursor: pointer;
}

.proof-download:hover,
.proof-close:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.cell-sub {
  display: block;
  margin-top: 3px;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.location-main {
  display: block;
}

.salary {
  font-family: var(--mono);
  font-size: 11.5px;
  white-space: nowrap;
}

.salary-main {
  font-weight: 500;
}

.applied-ledger .lrow {
  align-items: flex-start;
}

.applied-ledger strong,
.applied-ledger small {
  display: block;
}

.applied-ledger strong {
  font-size: 12.5px;
}

.applied-ledger small {
  margin-top: 3px;
  color: var(--mute);
  font-size: 11px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag i {
  width: 8px;
  height: 8px;
  flex: none;
}

.tag.found i {
  background: var(--c-found);
}

.tag.applied i {
  background: var(--c-applied);
}

.tag.escalated i {
  background: var(--c-escalated);
}

.tag.error i {
  background: var(--c-error);
}

.tag.not_suitable i {
  background: var(--c-gray);
}

.tag.closed i {
  background: var(--c-closed);
}

.badge {
  min-width: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 6px;
  border: 1px solid currentColor;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 18px;
}

.rail-sec {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.rail-sec:last-child {
  border-bottom: 0;
}

.summary-text {
  margin: 6px 0 0;
  font-size: 14px;
  line-height: 1.75;
}

.numchip {
  display: inline-block;
  border: 1px solid var(--ink);
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}

.kv {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 13px;
  line-height: 1.5;
}

.kv:last-of-type {
  border-bottom: 0;
}

.kv .k {
  width: 88px;
  flex: none;
  padding-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.kv .v {
  min-width: 0;
  overflow-wrap: anywhere;
}

.rail-link {
  margin-top: 14px;
}

.need {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 13px;
  line-height: 1.55;
}

.need:last-child {
  border-bottom: 0;
}

.need .idx {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 1px;
  border: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
}

.need .idx.warn {
  background: var(--ink);
  color: var(--paper);
}

.need a {
  font-weight: 600;
  text-decoration: underline;
}

.need small {
  display: block;
  margin: 3px 0;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 10px;
}

.encoding .lv {
  color: var(--mute);
}

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
}

.btn:hover {
  background: #f4f4f2;
  text-decoration: none;
}

.btn.primary {
  background: var(--ink);
  color: var(--paper);
}

.btn.primary:hover {
  background: #333331;
}

.btn.sm {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 10px;
}

.btn.danger:hover {
  border-color: var(--c-error);
  color: var(--c-error);
}

.btn.muted {
  color: var(--mute);
}

.btn[disabled] {
  border-color: var(--line);
  color: var(--line);
  cursor: default;
}

.icon-btn {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: none;
  padding: 0;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: #f4f4f2;
}

.icon-btn.primary {
  background: var(--ink);
  color: var(--paper);
}

.icon-btn.danger:hover {
  border-color: var(--c-error);
  color: var(--c-error);
}

.icon-btn.muted {
  color: var(--mute);
}

.vac-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  min-width: 0;
}

.chips {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border-left: 1px solid var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.chip-btn:first-child {
  border-left: 0;
}

.chip-btn:hover {
  background: #f4f4f2;
  text-decoration: none;
}

.chip-btn.active {
  background: var(--ink);
  color: var(--paper);
}

.chip-btn .cnt {
  color: var(--mute);
  font-family: var(--mono);
  font-weight: 500;
}

.chip-btn.active .cnt {
  color: #b5b5b3;
}

.vac-tools {
  margin-left: auto;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.search {
  position: relative;
  display: block;
}

.search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  pointer-events: none;
  transform: translateY(-50%);
}

.search input {
  width: 220px;
}

select,
input[type="text"],
input[type="number"],
textarea {
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
}

select,
input[type="text"],
input[type="number"] {
  min-height: 36px;
  padding: 7px 11px;
}

.search input[type="text"] {
  padding-left: 32px;
}

select:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: -1px;
}

.status-legend {
  display: flex;
  gap: 7px;
  margin: 12px 0;
  overflow-x: auto;
}

.tfoot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 0;
  border-top: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
}

.actions {
  white-space: nowrap;
}

.actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

.action-state {
  color: var(--mute);
  font-family: var(--mono);
}

textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.6;
}

textarea.yaml,
textarea.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.panel textarea {
  margin-top: 12px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.flash {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  text-transform: uppercase;
}

.flash.ok {
  color: var(--c-applied);
}

.flash.err {
  color: var(--c-error);
}

.hint {
  color: var(--mute);
  font-size: 12.5px;
}

.empty {
  margin: 12px 0 0;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 12px;
  font-style: normal;
  text-transform: uppercase;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

input[type="file"] {
  max-width: 100%;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 11px;
}

details {
  margin-top: 12px;
}

details summary {
  margin-bottom: 12px;
  color: var(--mute);
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
}

.qa-open {
  padding: 14px 0;
  border-bottom: 1px solid var(--hair);
}

.qa-open:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.qa-q {
  max-width: 780px;
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.6;
}

.qa-row {
  display: flex;
  gap: 10px;
}

.qa-row input {
  flex: 1;
}

dl.kb {
  margin: 8px 0 0;
}

dl.kb dt {
  padding: 12px 0 3px;
  font-weight: 600;
}

dl.kb dt:not(:first-child) {
  margin-top: 8px;
  border-top: 1px solid var(--hair);
}

dl.kb dd {
  margin: 0;
  padding-bottom: 3px;
  color: var(--mute);
}

.mono-link {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--page);
}

.login-panel {
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid var(--ink);
  background: var(--paper);
}

.login-panel h1 {
  margin: 0 0 22px;
  font-size: 26px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--ink);
}

.login-brand strong,
.login-brand small {
  display: block;
}

.login-brand strong {
  font-size: 18px;
}

.login-brand small,
.login-note {
  color: var(--mute);
  font-family: var(--mono);
  font-size: 10px;
}

.login-action {
  width: 100%;
  margin-top: 8px;
}

.login-note {
  margin: 20px 0 0;
  text-align: center;
}
