:root {
    --fg: #222;
    --bg: #f6f7fb;
    --muted: #666;
    --card: #fff;
    --border: #ddd;
    --link: #031070;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, Arial, sans-serif;
    color: var(--fg);
    background: var(--bg);
    margin: 0;
}

body.resizing-column {
    cursor: col-resize;
    user-select: none;
}

section > p:first-child {
    margin: 0;
}
section > p:first-child > a {
    display: inline-block;
    margin: 10px 0;
    width: auto !important;
}

h1 {
    margin: 4px 0 8px 0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px;
}

.container.wide { max-width: none; width: min(96vw, 1600px); }

.topbar {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    z-index: 100;
}

.topbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar .brand {
    display: flex;
    align-items: center;
    gap: 16px;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
}

.brand-link { text-decoration: none; color: inherit; }

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.2;
}

.brand-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
}

.brand-subtitle {
    font-size: 17px;
    font-weight: 600;
}

.brand-subtitle strong { color: var(--fg); }

.topbar .right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar .logo {
    height: 28px;
}

.topbar .brand-logo {
    height: 36px;
    width: auto;
}

@media (max-width: 600px) {
    .topbar .brand {
        gap: 10px;
    }

    .brand-subtitle {
        display: none;
    }
}

nav form button {
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
}

.btn-ghost.big {
    padding: 12px 14px;
    border-radius: 10px;
}

.btn-ghost:hover {
    border-color: #bfc7d4;
    background: rgba(0,0,0,0.03);
}

a.btn-ghost {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.02s ease-in-out, filter 0.15s ease-in-out;
    margin-top: 6px;
    text-align: center;
    font-size: 13.333px;
}

.btn-header {
    background: #031070;
    color: #fff;
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
}

.btn-header:hover {
    background: #3D74C2;
    border-color: #3D74C2;
}

button.btn-header {
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.02s ease-in-out, filter 0.15s ease-in-out;
    margin-top: 6px;
    text-align: center;
    font-size: 13.333px;
}

.card {
    background: var(--card);
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.form label {
    display: block;
    margin: 10px 0;
}

.form label span {
    display: inline-block;
    width: 70px;
}

input,
select,
button {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

button {
    color: #fff;
    background: #031070;
    border: none;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(3, 16, 112, 0.08);
    color: #031070;
    font-weight: 600;
    border: 1px solid rgba(3, 16, 112, 0.14);
    cursor: pointer;
    transition: filter 0.2s ease, transform 0.1s ease;
    text-decoration: none;
    font-size: 13.333px;
}

.btn-secondary:hover { filter: brightness(0.94); }
.btn-secondary:active { transform: translateY(1px); }

.alert {
    background: #ffe8e8;
    border: 1px solid #ffb3b3;
    padding: 1px;
    border-radius: 6px;
    margin-bottom: 10px;
}

.alert ul {
    margin-block-start: 6px;
    margin-block-end: 6px;
}

.muted {
    color: var(--muted);
    font-size: 14px;
}

.list {
    list-style: none;
    padding: 0;
}

.list li {
    background: #fff;
    border: 1px solid var(--border);
    margin: 8px 0;
    padding: 10px;
    border-radius: 6px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table-wrap {
    overflow-x: visible;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.table-modern {
    table-layout: fixed;
}

.table-modern thead th {
    position: sticky;
    top: 0;
    background: #f8f9fc;
    z-index: 1;
}

th,
td {
    border: 1px solid var(--border);
    padding: 8px;
    vertical-align: middle;
}

th {
    background: #f1f3f8;
    text-align: left;
}

.table-modern tbody tr:nth-child(even) { background: #fcfdff; }
.table-modern tbody tr:hover { background: #f6f9ff; }

.resizable-table {
    width: 100%;
    table-layout: fixed;
}

.resizable-table th {
    position: relative;
    white-space: nowrap;
}

.resizable-table th .col-resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    user-select: none;
}

.resizable-table th .col-resize-handle::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    background: transparent;
    transition: background 0.2s ease;
}

.resizable-table th .col-resize-handle:hover::after,
.resizable-table th .col-resize-handle.active::after {
    background: var(--border);
}

.job-table th,
.job-table td {
    vertical-align: top;
}

.additional label {
    display: block;
    margin: 0 0 10px 0;
}

.additional label .expand-panel {
    background-color: transparent;
}

.additional label .expand-panel:hover {
    border-color: #bfc7d4;
    background: rgba(0, 0, 0, 0.03);
}

.additional label .expand-panel[open] {
    border-color: #bfc7d4;
    background: #fff;
}

.additional label details p {
    display: flex;
    flex-direction: column;
}
.additional label details p .btn-secondary {
    margin-top: 6px;
}

.additional label span {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--muted);
}

.candidates td select,
.candidates td input[type="text"],
.candidates td textarea {
    width: 100%;
    box-sizing: border-box;
}

.comment-field {
    display: flex;
    align-items: flex-start;
    gap: 2px;
}

.comment-field textarea {
    flex: 1;
    padding: 6px 8px;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.4;
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: height 0.2s ease;
    resize: none;
}

.comment-field[data-expanded="false"] textarea {
    height: 34px;
}

.comment-field[data-expanded="true"] textarea {
    height: 220px;
    resize: vertical;
}

.comment-toggle {
    color: #000;
    background: transparent;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    line-height: 1;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-toggle span {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 20px;
}

.comment-field[data-expanded="true"] .comment-toggle span {
    transform: rotate(90deg);
}

.candidates td.col-contact div {
    word-wrap: break-word;
}

.col-interest .icon {
    margin: 0;
}

@media (max-width: 768px) {
  .container.wide { width: 100%; max-width: 100%; }
  .table-wrap { overflow-x: auto; }
  .table-modern { font-size: 14px; min-width: 793px; }
}

.candidates {
    font-size: small;
}

.candidates details summary {
    cursor: pointer;
    color: var(--link);
}

.preview {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    margin-top: 32px;
    padding: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 80%;
    height: 80%;
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.15);
}

.preview h2 {
    display: inline-block;
    margin-top: 0;
    margin-right: 6px;
    margin-bottom: 6px;
}

.preview p {
    margin: 0 0 12px 0;
    color: var(--muted);
}

.preview .close {
    float: right;
    width: auto !important;
    margin: 0;
}

.preview iframe {
    margin-top: 8px;
}

.preview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    color: var(--muted);
    font-weight: 600;
    z-index: 20;
}

.preview-loading__spinner {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--link);
    animation: preview-spin 0.9s linear infinite;
}

@keyframes preview-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

a.icon {
    text-decoration: none;
    margin-right: 4px;
    position: relative;
    top: -1px;
}

.modal-download img {
    height: 16px;
}

.comments-modal__candidate {
    margin: 0;
    color: var(--muted);
}

.comments-modal__history {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--bg);
    min-height: 300px;
    height: calc(100% - 152px);
}

.comments-modal__entry {
    margin-bottom: 8px;
    line-height: 1.4;
    display: grid;
    grid-template-columns: auto auto 1fr;
    grid-template-rows: auto auto;
    font-size: 18px;
}

.comments-modal__entry:last-child {
    margin-bottom: 0;
}

.comments-modal__empty {
    margin: 0;
    color: var(--muted);
}

.comments-modal__input {
    display: flex;
    gap: 8px;
    align-items: center;
}

.comments-modal__input textarea {
    margin-top: 6px;
    font-family: system-ui, Arial, sans-serif;
}

.comments-modal__input .btn-primary {
    width: auto;
}

.comments-modal__text {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 72px;
}

.comments-modal__date {
    font-size: 12px;
    color: var(--muted);
    grid-row: 1;
    grid-column: 1 / span 3;
    margin-bottom: -5px;
}

.comments-modal__author {
    font-weight: 600;
    grid-row: 2;
    grid-column: 1;
    margin-right: 4px;
}

.comments-modal__message {
    white-space: pre-line;
    grid-row: 2;
    grid-column: 2 / span 2;
}

a.icon img {
    height: 13px;
    vertical-align: text-bottom;
    margin-right: 0;
    margin-top: 2px;
}

span.icon  {
    display: inline-block;
    width: 16px;
    height: 16px;
    vertical-align: text-bottom;
    margin-right: 2px;
    margin-top: 0px;
}

.col-application .resume-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: row;
    gap: 0;
}

.col-application .resume-container > div:nth-child(1) { grid-column: 1; grid-row: 1; } /* Resume */
.col-application .resume-container > div:nth-child(2) { grid-column: 1; grid-row: 2; } /* Cover Letter */
.col-application .resume-container > div:nth-child(3) { grid-column: 2; grid-row: 1; } /* Attachment 1 */
.col-application .resume-container > div:nth-child(4) { grid-column: 2; grid-row: 2; } /* Attachment 2 */
.col-application .resume-container > div:nth-child(n+5) {
    grid-column: 2;
}

.resume {
    padding: 4px 8px;
}

.resume div {
    font-size: small;
}

.resume img{
    height: 16px;
    vertical-align: text-bottom;
    margin-right: 4px;
    margin-top: 3px;
}

.resume pre {
    max-height: 200px;
    overflow: auto;
    background: #fafafa;
    border: 1px solid var(--border);
    padding: 8px;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 999px;
}

.user-chip .avatar {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #031070;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.user-chip .name { font-size: 13px; color: var(--fg); }

/* ---- Auth (Login) ---- */
.auth {
    min-height: calc(100vh - 64px);
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    padding: 28px;
}

.auth-header {
    text-align: center;
    margin-bottom: 18px;
}

.auth-logo {
    height: 40px;
    margin-bottom: 8px;
}

.auth-header h1 {
    font-size: 22px;
    margin: 0 0 6px 0;
}

.subtitle {
    margin: 0;
    color: var(--muted);
}

.auth-form {
    margin-top: 8px;
}

.auth-form label {
    display: block;
    margin: 14px 0;
}

.auth-form label span {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--muted);
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
}

.auth-form input:focus {
    outline: none;
    border-color: #6aa9ff;
    box-shadow: 0 0 0 4px rgba(106, 169, 255, 0.2);
}

.auth-form .assignment-field {
    margin: 14px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-form .assignment-field > label {
    margin: 0;
}

.auth-form .assignment-list {
    display: grid;
    gap: 10px;
}

.auth-form .assignment-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-form .assignment-row .assignment-input {
    flex: 0 1 200px;
    max-width: 240px;
    width: 100%;
}

.assignment-add {
    align-self: flex-start;
    margin-top: 4px;
}

.assignment-action {
    border-radius: 8px;
    background: rgba(3, 16, 112, 0.08);
    border: 1px solid rgba(3, 16, 112, 0.14);
    color: #031070;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.05s ease;
}

.assignment-action span {
    line-height: 1;
}

.assignment-action:hover:not(:disabled) {
    filter: brightness(1.05);
}

.assignment-action:active:not(:disabled) {
    transform: translateY(1px);
}

.assignment-action:disabled {
    opacity: 0.45;
    cursor: default;
}

.assignment-remove {
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 18px;
}

.inline-title-group label {
    margin: 0;
}
.inline-title-group input {
    padding: 3px;
}

.btn-primary {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: #031070;
    border: none;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: transform 0.02s ease-in-out, filter 0.15s ease-in-out;
    margin-top: 6px;
}

.btn-primary:hover { filter: brightness(2.05); }
.btn-primary:active { transform: translateY(1px); }

a.btn-primary {
    text-decoration: none;
    display: inline-block;
    text-align: center;
    max-width: 25%;
}

td a.btn-secondary {
    padding: 6px 14px;
    display: inline-block;
}

td a.email-open {
    padding: 10px 13px;
    margin: 0px 0;
    display: inline-block;
    font-family: Arial, sans-serif;
}

td.text-center {
    text-align: center;
}

td.vert-center {
    vertical-align: middle;
}

.expand-panel {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    position: relative;
}

.expand-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    font-size: 14px;
    color: var(--fg);
}

.expand-panel > summary::marker { display: none; }
.expand-panel > summary::after {
    content: "›";
    display: inline-block;
    transform: rotate(0deg);
    transition: transform 0.2s ease;
    font-size: 18px;
    line-height: 1;
    color: var(--muted);
}

.expand-panel[open] > summary::after { transform: rotate(90deg); }

.expand-note {
    margin: 12px 0 16px;
    font-size: 13px;
}

.expand-fields-toggle {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    top: 0;
    left: 0;
}

.expand-toggle {
    margin-top: 6px;
    width: fit-content;
}

.expand-fields {
    display: none;
    margin-top: 18px;
}

.expand-fields label {
    margin: 0;
}

.expand-fields label span {
    color: var(--muted);
    font-size: 13px;
}

.expand-fields-toggle:checked ~ .expand-fields {
    display: grid;
    gap: 14px;
}

.danger {
    border-color: #ff1a1a;
    background: #ff4d4d;
    color: #fff;
    font-weight: 700;
}

.expired {
    color: #ff1a1a;
}

.disabled {
    pointer-events: none;
    opacity: 0.6;
}

.hidden {
    display: none !important;
}

.alert.modern {
    border: none;
    color: #7a1111;
    background: linear-gradient(0deg, #ffe8e8, #ffe8e8), #fff;
    box-shadow: inset 0 0 0 1px #ffb3b3;
    border-radius: 10px;
    padding: 4px 14px;
}
.alert.success-message {
    background: #e8fff2;
    border-color: #8fe4b7;
    color: #1e6a3d;
    padding: 4px 14px;
}
.alert.modern.success-message {
    background: linear-gradient(0deg, #e8fff2, #e8fff2), #fff;
    box-shadow: inset 0 0 0 1px #8fe4b7;
    color: #1e6a3d;
    padding: 4px 14px;
}
.email_template_custom {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin-top: 6px;
    margin-bottom: 20px;
    font-family: Arial, Helvetica, sans-serif;
}
.keyword-card {
    margin-top: 10px;
}

.tip { text-align: center; margin-top: 10px; }
