:root {
  --ink: #123b75;
  --heading: #203f83;
  --accent: #4d7cff;
  --line: #c7d7ec;
  --panel: rgba(255, 255, 255, .88);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html.portal-login-locked { overflow: hidden; }
body.portal-locked > :not(#portalLoginView) { display: none; }
body.portal-locked { overflow: hidden; }

.portal-login-view { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; min-width: 320px; padding: 24px; background: linear-gradient(125deg, #103b73, #2c78bd 48%, #9dd4f2); font-family: "Segoe UI", Arial, sans-serif; }
.portal-login-view::before, .portal-login-view::after { content: ''; position: absolute; pointer-events: none; border-radius: 50%; background: rgba(255,255,255,.12); }
.portal-login-view::before { width: 48vw; height: 48vw; top: -24vw; left: -12vw; }
.portal-login-view::after { width: 42vw; height: 42vw; right: -16vw; bottom: -18vw; }
.portal-login-card { position: relative; z-index: 1; width: min(100%, 560px); padding: 34px; border: 1px solid rgba(255,255,255,.38); border-radius: 20px; color: #173b69; background: rgba(255,255,255,.94); box-shadow: 0 20px 55px rgba(13,54,105,.24); }
.portal-login-logo { display: block; width: 150px; max-width: 100%; margin: 0 auto 20px; }
.portal-login-card h1 { margin: 0; color: #1f4fa3; font-size: 30px; text-align: center; }
.portal-login-card h1 em { color: #4d7cff; font-style: normal; }
.portal-login-card > p { margin: 8px 0 24px; color: #54729b; text-align: center; }
.portal-login-card label { display: block; margin: 14px 0 6px; color: #234d85; font-size: 13px; font-weight: 600; }
.portal-login-card input { width: 100%; min-height: 44px; padding: 0 13px; border: 1px solid #bfd4ee; border-radius: 9px; color: #173b69; background: #fff; font: inherit; outline: 0; }
.portal-login-card input:focus { border-color: #4d7cff; box-shadow: 0 0 0 3px rgba(77,124,255,.14); }
.portal-login-submit { width: 100%; min-height: 44px; margin-top: 22px; border: 0; border-radius: 8px; color: #fff; background: #397ef4; font-weight: 700; cursor: pointer; }
.portal-login-submit:hover { background: #1f62dd; }
.portal-reset-password { display: block; margin: 13px auto 0; border: 0; color: #3970ba; background: transparent; font: inherit; font-size: 12px; cursor: pointer; }
#portalLoginMessage { min-height: 18px; margin: 14px 0 0; color: #b33e4b; font-size: 12px; text-align: center; }
.admin-logout-link { display: inline-block; margin-top: 5px; color: #1f4fa3; font-size: 12px; text-decoration: underline; cursor: pointer; }

html, body { min-width: 320px; min-height: 100%; margin: 0; }

body {
  padding-top: 0;
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(135deg, transparent 0 23%, rgba(55, 137, 222, .17) 23% 35%, transparent 35% 72%, rgba(255, 255, 255, .22) 72% 82%, transparent 82%),
    linear-gradient(90deg, rgba(42, 133, 226, .09) 1px, transparent 1px),
    linear-gradient(0deg, rgba(42, 133, 226, .09) 1px, transparent 1px),
    linear-gradient(135deg, #80bdf0 0%, #c6e3fa 46%, #9dbff3 100%);
  background-size: auto, 42px 42px, 42px 42px, cover;
  background-attachment: fixed;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 170px;
  align-items: center;
  gap: 18px;
  min-height: 176px;
  padding: 18px 18px 16px 24px;
  border-bottom: 1px solid rgba(129, 176, 220, .42);
  background: rgba(203, 230, 253, .62);
  box-shadow: 0 4px 12px rgba(62, 109, 170, .08);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand img { display: block; width: 170px; max-width: 100%; height: auto; }

.intro {
  min-width: 0;
  padding: 12px 18px 10px;
  border: 1px solid rgba(143, 196, 243, .72);
  border-radius: 15px;
  background: rgba(201, 228, 255, .48);
}

.intro h1 {
  margin: 0 0 6px;
  color: #1f4fa3;
  font: 900 24px/1.08 "Arial Black", Arial, sans-serif;
  letter-spacing: .2px;
}

.intro h1 span { color: var(--accent); }
.intro p { margin: 0; }
.intro .notice { color: #14589b; font-size: 12px; font-style: italic; }
.intro .credit { margin-top: 5px; color: var(--accent); font-size: 15px; }

.header-actions { display: grid; gap: 9px; }
.header-actions button, .header-actions select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(77, 124, 255, .28);
  border-radius: 11px;
  color: var(--ink);
  font: 600 13px "Segoe UI", Arial, sans-serif;
}
.header-actions button { cursor: pointer; }
.logout { background: rgba(255, 255, 255, .82); }
.resources { background: #d8eeff; }
.resources-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 14px 14px 0 0;
  background: rgba(90, 134, 180, .12);
}
.resources-overlay[hidden] { display: none; }
.resources-modal {
  width: min(420px, calc(100vw - 36px));
  margin-top: 6px;
  border: 1px solid rgba(136, 179, 219, .95);
  border-radius: 14px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 18px 45px rgba(10, 55, 98, .18);
  backdrop-filter: blur(12px);
}
.resources-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  color: var(--heading);
}
.resources-header h3 { margin: 0; font-size: 18px; font-weight: 700; }
.resources-close {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(77, 124, 255, .2);
  border-radius: 8px;
  color: #2c5e9d;
  background: #edf6ff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.resources-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px 12px;
}
.resources-option {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(146, 194, 233, .8);
  border-radius: 10px;
  color: var(--ink);
  background: rgba(214, 235, 255, .58);
  font: 600 13px "Segoe UI", Arial, sans-serif;
  text-align: left;
  cursor: pointer;
}
.resources-option:hover { border-color: rgba(77, 124, 255, .32); background: rgba(206, 229, 255, .88); }
.header-actions select { padding: 0 12px; background: rgba(255, 255, 255, .88); text-align: center; text-align-last: center; }
.header-actions button:hover { color: var(--accent); background: #f8fafd; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px;
  max-width: 1800px;
  min-height: 0;
  margin: 0 auto;
  padding: 55px 60px 22px;
}

.panel {
  min-height: 0;
  padding: 24px 30px;
  border: 1px solid rgba(218, 229, 241, .9);
  border-radius: 21px;
  background: var(--panel);
  box-shadow: 0 7px 18px rgba(47, 89, 142, .08);
}

.panel-title { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.panel-title svg, .field-label svg { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; }
.panel-title svg { width: 24px; height: 24px; stroke-width: 2; }
.panel-title h2 { margin: 0; color: var(--heading); font-size: 21px; font-weight: 500; }

.candidate-panel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 30px; }
.candidate-panel .panel-title { grid-column: 1 / -1; }
.assessment-level-panel { padding-bottom: 8px; }
.assessment-level-panel { order: 2; }
.assessment-selection-fields { display: grid; grid-template-columns: minmax(180px, 0.7fr) minmax(0, 2fr) minmax(0, 2fr); column-gap: 30px; align-items: end; }
.assessment-name-field, .assessment-email-field { min-width: 0; }
.level-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 30px; }
.level-fields .field { min-height: 86px; }
.level-paste-field { resize: vertical; padding-top: 12px; }
.retake-field { border-color: #d8b4b4; background: #fffafa; }
.retake-label { color: #8a3d3d; }
.run-message { margin: 8px 0 0; color: #31557f; font-size: 14px; text-align: right; }
.run-message.run-success { color: #218a45; font-weight: 600; }
.level-actions { display: flex; justify-content: flex-end; padding-top: 2px; }
.run-button { min-width: 92px; min-height: 40px; border: 1px solid #2b6cf6; border-radius: 8px; color: #fff; background: #397ef4; box-shadow: 0 4px 9px rgba(50, 112, 232, .2); font: 600 13px "Segoe UI", Arial, sans-serif; cursor: pointer; }
.run-button:hover { background: #1f62dd; }
.form-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; padding-top: 3px; }
.submit-message { flex-basis: 100%; }
.submit-button, .export-button, .select-all-button, .delete-button, .view-button { border: 1px solid transparent; border-radius: 8px; font: 600 13px "Segoe UI", Arial, sans-serif; cursor: pointer; }
.submit-button { min-width: 118px; min-height: 42px; border-color: #2b6cf6; color: #fff; background: #397ef4; box-shadow: 0 4px 9px rgba(50, 112, 232, .2); }
.submit-button:hover { background: #1f62dd; }
.form-field { min-width: 0; }
.searchable-select-container { position: relative; }
.searchable-select-input { padding-right: 42px; cursor: text; }
.searchable-select-clear { position: absolute; top: 35px; right: 10px; z-index: 2; width: 26px; height: 26px; padding: 0; border: 0; color: #4774b0; background: transparent; font-size: 20px; font-weight: 700; line-height: 22px; cursor: pointer; }
.searchable-select-clear:hover { color: #1f4fa3; }
.searchable-select-options { position: absolute; z-index: 5; top: 70px; right: 0; left: 0; max-height: 220px; overflow-y: auto; padding: 5px; border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: 0 10px 22px rgba(32, 63, 131, .16); }
.searchable-select-option { display: block; width: 100%; padding: 9px 11px; border: 0; border-radius: 7px; color: var(--ink); background: transparent; font: 14px "Segoe UI", Arial, sans-serif; text-align: left; cursor: pointer; }
.searchable-select-option:hover { color: var(--heading); background: #edf5ff; }

.field-label { display: flex; align-items: center; gap: 7px; margin: 0 0 6px 3px; color: var(--heading); font-size: 13px; font-weight: 600; }
.field-label svg { width: 17px; height: 17px; stroke-width: 2; }
.field { display: block; width: 100%; min-height: 48px; margin: 0 0 16px; padding: 0 14px; border: 2px solid var(--line); border-radius: 11px; outline: 0; color: #23426d; background: rgba(255, 255, 255, .86); font: 14px "Segoe UI", Arial, sans-serif; }
.field::placeholder { color: #b6b8bb; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77, 124, 255, .12); }
.select-field { appearance: auto; }

.history-panel { order: 1; overflow: hidden; }
.history-filters { display: grid; grid-template-columns: 1.1fr 1.1fr 1.1fr 1.1fr auto 1fr; gap: 16px; align-items: center; margin-bottom: 14px; }
.history-filter, .date-range input { min-width: 0; height: 36px; padding: 0 11px; border: 1px solid #c9d9ed; border-radius: 8px; outline: 0; color: #23426d; background: rgba(255,255,255,.9); font: 12px "Segoe UI", Arial, sans-serif; }
.history-filter:focus, .date-range input:focus { border-color: var(--accent); }
.history-date-label { color: var(--heading); font-size: 12px; font-weight: 600; white-space: nowrap; }
.table-frame { max-height: 700px; overflow: auto; border: 1px solid #c8d8ea; border-radius: 8px; background: rgba(255,255,255,.46); }
.history-table { width: 1500px; min-width: 100%; border-collapse: separate; border-spacing: 0; color: #1f3554; font-size: 11px; }
.history-table th, .history-table td { height: 44px; padding: 6px 9px; border-right: 1px solid #c8d8ea; border-bottom: 1px solid #c8d8ea; text-align: left; white-space: nowrap; }
.history-table th { position: sticky; top: 0; z-index: 1; color: #123567; background: #d9ebfc; font-size: 11px; font-weight: 700; text-align: center; }
.history-table thead .column-letter-row th { top: 0; height: 24px; padding: 3px 4px; color: #fff; background: #126782; font-size: 10px; line-height: 1; }
.history-table thead tr:not(.column-letter-row) th { top: 24px; }
.history-table th:first-child, .history-table td:first-child { position: sticky; left: 0; z-index: 5; width: 40px; min-width: 40px; max-width: 40px; background: #d9ebfc; }
.history-table th:nth-child(2), .history-table td:nth-child(2) { position: sticky; left: 40px; z-index: 4; width: 32px; min-width: 32px; max-width: 32px; background: #d9ebfc; }
.history-table th:nth-child(3), .history-table td:nth-child(3) { position: sticky; left: 72px; z-index: 4; width: 260px; min-width: 260px; max-width: 260px; background: #fff; }
.history-table th:nth-child(4), .history-table td:nth-child(4) { position: sticky; left: 332px; z-index: 4; width: 105px; min-width: 105px; max-width: 105px; background: #fff; }
.history-table th:nth-child(5), .history-table td:nth-child(5) { position: sticky; left: 437px; z-index: 4; width: 105px; min-width: 105px; max-width: 105px; background: #fff; }
.history-table th:nth-child(6), .history-table td:nth-child(6) { position: sticky; left: 542px; z-index: 4; width: 120px; min-width: 120px; max-width: 120px; background: #fff; }
.history-table th:nth-child(7), .history-table td:nth-child(7) { position: sticky; left: 662px; z-index: 4; width: 220px; min-width: 220px; max-width: 220px; background: #fff; }
.history-table thead .column-letter-row th:first-child, .history-table thead .column-letter-row th:nth-child(2), .history-table thead .column-letter-row th:nth-child(3), .history-table thead .column-letter-row th:nth-child(4), .history-table thead .column-letter-row th:nth-child(5), .history-table thead .column-letter-row th:nth-child(6), .history-table thead .column-letter-row th:nth-child(7) { top: 0; z-index: 7; color: #fff; background: #126782; }
.history-table thead tr:not(.column-letter-row) th:first-child, .history-table thead tr:not(.column-letter-row) th:nth-child(2), .history-table thead tr:not(.column-letter-row) th:nth-child(3), .history-table thead tr:not(.column-letter-row) th:nth-child(4), .history-table thead tr:not(.column-letter-row) th:nth-child(5), .history-table thead tr:not(.column-letter-row) th:nth-child(6), .history-table thead tr:not(.column-letter-row) th:nth-child(7) { top: 24px; z-index: 6; color: #123567; background: #d9ebfc; }
.history-table td:first-child, .history-table td:nth-child(2), .history-table td:nth-child(3) { text-align: center; }
.history-table td:first-child { cursor: pointer; }
.history-table td:first-child input[type="checkbox"] { position: relative; z-index: 8; width: 15px; height: 15px; margin: 0; cursor: pointer; pointer-events: auto; }
.history-table tr:last-child td { border-bottom: 0; }
.history-table th:last-child, .history-table td:last-child { border-right: 0; }
.history-table tbody tr:hover { background: #f3f8ff; }
.history-table tbody tr.history-row-selected td { background: #d9ebfc !important; }
.history-table th:nth-child(n+15):nth-child(-n+16) { color: #fff; background: #126782; }
.history-table th:nth-child(n+17):nth-child(-n+27) { color: #fff; background: #084b2a; }
.history-table th:nth-child(n+28):nth-child(-n+43) { color: #fff; background: #7a2e0b; }
.history-table th:nth-child(n+44) { color: #fff; background: #75206f; }
.history-table thead .column-letter-row th:nth-child(n+44) { color: #fff !important; background: #75206f !important; }
.history-table th:nth-child(14), .history-table th:nth-child(15), .history-table th:nth-child(16) { color: #123567 !important; background: #d9ebfc !important; }
.history-table thead .column-letter-row th:nth-child(14), .history-table thead .column-letter-row th:nth-child(15), .history-table thead .column-letter-row th:nth-child(16) { color: #fff !important; background: #126782 !important; }
.history-table th:nth-child(17), .history-table th:nth-child(18) { color: #fff !important; background: #126782 !important; }
.history-table th:nth-child(28), .history-table th:nth-child(29) { color: #fff !important; background: #084b2a !important; }
.history-table th:nth-child(14), .history-table td:nth-child(14) { width: 120px !important; min-width: 120px !important; max-width: 120px !important; }
.history-table th:nth-child(15), .history-table td:nth-child(15) { width: 280px !important; min-width: 280px !important; max-width: 280px !important; }
.history-table th:nth-child(15), .history-table td:nth-child(15) { width: 220px; min-width: 220px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.history-table th:nth-child(16), .history-table td:nth-child(16) { width: 180px; min-width: 180px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.history-table td:nth-child(n+15) { background: #fff; }
.history-table th:nth-child(n+15), .history-table td:nth-child(n+15) { width: 82px; min-width: 82px; max-width: 82px; }
.history-table th:nth-child(n+15) { height: 48px; padding: 5px 4px; white-space: normal; line-height: 1.15; overflow-wrap: anywhere; }
.history-table td:nth-child(n+15) { padding: 6px 4px; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.history-table th:nth-child(16), .history-table td:nth-child(16) { width: 180px !important; min-width: 180px !important; max-width: 180px !important; overflow: hidden; text-overflow: ellipsis; }
.view-button { min-width: 64px; min-height: 30px; border-color: #396fff; color: #1444a4; background: #edf4ff; }
.view-button:hover { color: #fff; background: #397ef4; }
.date-seat-input { width: 80px; min-height: 28px; padding: 0 5px; border: 1px solid #b9cde5; border-radius: 5px; outline: 0; color: #23426d; background: #fff; font: 11px "Segoe UI", Arial, sans-serif; text-align: center; }
.date-seat-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(77, 124, 255, .12); }
.date-seat-input.seat-entry { border-color: #d7a900; background: #fff2a8; }
.candidate-id-table-input { width: 92px; min-height: 28px; padding: 0 5px; border: 1px solid #b9cde5; border-radius: 5px; outline: 0; color: #23426d; background: #fff; font: 11px "Segoe UI", Arial, sans-serif; text-align: center; }
.candidate-id-table-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(77, 124, 255, .12); }
.assessment-remarks-input { width: 260px; min-width: 260px; min-height: 32px; height: 32px; resize: vertical; padding: 5px; border: 1px solid #b9cde5; border-radius: 5px; outline: 0; color: #23426d; background: #fff; font: 11px "Segoe UI", Arial, sans-serif; }
.assessment-remarks-input:read-only { cursor: default; background: #f4f8fc; }
.assessment-remarks-cell { white-space: normal !important; overflow-wrap: anywhere; }
.assessment-remarks-cell.remarks-passed { color: #2f6f42; background: #e1f1e4 !important; font-style: italic; }
.assessment-remarks-cell.remarks-pending { color: #846b28; background: #fff4d6 !important; font-style: italic; }
.assessment-remarks-cell.remarks-failed { color: #9a4c55; background: #f8e1e3 !important; font-style: italic; }
.assessment-remarks-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(77, 124, 255, .12); }
.workday-status-cell { min-width: 150px; padding: 4px !important; }
.workday-status-select { width: 100%; min-height: 30px; padding: 0 4px; border: 1px solid #b9cde5; border-radius: 4px; color: #23426d; background: #fff; font: 11px "Segoe UI", Arial, sans-serif; }
.workday-status-cell[data-status="hiring manager"] { background: #2f75b5; }
.workday-status-cell[data-status="assessment stage"] { background: #c6efce; }
.workday-status-cell[data-status="declined"] { background: #f4cccc; }
.workday-status-cell[data-status="review stage"] { background: #cfe2f3; }
.workday-status-cell[data-status="recruiter stage"] { background: #fff2cc; }
.workday-status-cell[data-status="offer stage"], .workday-status-cell[data-status="internal assessment"], .workday-status-cell[data-status="fitment/offer"], .workday-status-cell[data-status="eit movement issue"] { background: #d9d2e9; }
.history-table td.mode-onsite { background: #e4f3df; }
.history-table td.mode-virtual { background: #f1e2f4; }
.history-table td.mode-remote { background: #e0effa; }
.history-table td:nth-child(9) { text-align: center; }
.history-footer { display: flex; justify-content: flex-start; gap: 18px; align-items: center; padding-top: 14px; }
.date-range, .history-actions { display: flex; align-items: center; gap: 8px; }
.history-pagination { display: flex; align-items: center; gap: 10px; margin-left: auto; color: var(--heading); font-size: 12px; }
.history-pagination button { min-height: 30px; padding: 0 12px; border: 1px solid #b8cfe8; border-radius: 6px; color: #20589f; background: #eef6ff; cursor: pointer; font: 600 12px "Segoe UI", Arial, sans-serif; }
.history-pagination button:disabled { opacity: .5; cursor: not-allowed; }
.history-actions { order: -1; }
.date-range label { color: var(--heading); font-size: 12px; font-weight: 600; }
.date-range input { width: 135px; }
.export-button { min-height: 38px; padding: 0 14px; border-color: #5c99ef; color: #20589f; background: #dceeff; }
.select-all-button { min-height: 30px; padding: 0 13px; color: #fff; background: #438cf0; }
.delete-button { min-height: 30px; padding: 0 16px; border-color: #ff9da9; color: #d85b69; background: #fff7f8; }
.delete-button:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 160px minmax(0, 1fr) 140px; min-height: 245px; gap: 16px; padding-left: 28px; }
  .brand img { width: 150px; }
  .intro h1 { font-size: 26px; }
  .layout { padding: 35px 28px 22px; gap: 18px; }
  .panel { padding: 26px 24px; }
  .panel-title h2 { font-size: 20px; }
}

@media (max-width: 760px) {
  body { padding-top: 0; }
  .topbar { position: relative; grid-template-columns: 1fr; min-height: 0; padding: 22px; gap: 16px; }
  .brand img { width: 150px; margin: auto; }
  .intro h1 { font-size: clamp(22px, 6vw, 28px); }
  .intro .notice { font-size: 12px; }
  .intro .credit { font-size: 16px; }
  .header-actions { grid-template-columns: 1fr 1fr; }
  .header-actions select { grid-column: 1 / -1; }
  .layout { grid-template-columns: 1fr; padding: 24px 16px; }
  .panel { min-height: 360px; }
  .candidate-panel { grid-template-columns: 1fr; }
  .candidate-panel .panel-title { grid-column: auto; }
  .level-fields { grid-template-columns: 1fr; }
  .assessment-selection-fields { grid-template-columns: 1fr; }
  .history-filters { grid-template-columns: 1fr 1fr; }
  .history-date-label { display: none; }
  .history-footer { align-items: stretch; flex-direction: column; }
  .date-range { flex-wrap: wrap; }
}
