body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f9;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 1450px;
    margin: 0 auto;
    padding: 20px;
}

h1,
h2,
h3 {
    text-align: center;
    color: #444;
}

.page-header {
    margin-bottom: 18px;
}

.page-header h2 {
    margin: 0 0 8px;
}

.page-title-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.page-title-row h3 {
    grid-column: 2;
    margin: 0;
}

.page-title-row form {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    margin: 0;
}

.main-nav {
    display: flex;
    align-items: center;
    min-height: 46px;
    margin: 18px 0 12px;
    padding: 0 8px;
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: 5px;
    color: #2f5f8f;
    font-weight: 600;
    text-decoration: none;
}

.main-nav a:hover,
.main-nav a:focus-visible {
    background: #eaf2fb;
    color: #164a7a;
    outline: none;
}

.region-filter {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 16px 0 10px;
    padding: 8px 12px;
    border: 1px solid #e2e5ea;
    border-radius: 6px;
    background: #fff;
}

.region-filter-label {
    font-weight: 600;
}

.region-filter label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.profile-share-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 16px 0 10px;
}

.profile-share-filter label {
    font-weight: 600;
}

.profile-share-filter input {
    padding: 6px 8px;
    border: 1px solid #aaa;
    border-radius: 4px;
    font: inherit;
}

.profile-share-form {
    display: grid;
    gap: 8px;
    max-width: 1180px;
    margin: 20px auto;
}

.profile-share-form label {
    font-weight: 600;
}

.profile-share-comboboxes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.combobox-field {
    display: grid;
    gap: 8px;
    position: relative;
    align-content: start;
}

.combobox-input-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.combobox-input-control input {
    flex: 1 1 auto;
    min-width: 0;
}

.combobox-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    max-height: 280px;
    overflow-y: auto;
    margin: 2px 0 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.combobox-list [role="option"] {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 10px;
    cursor: pointer;
}

.combobox-list [role="option"]:hover,
.combobox-list [role="option"].active {
    background: #e8f0fe;
}

.combobox-list [role="option"][hidden] {
    display: none;
}

.combobox-hint {
    color: #666;
    font-size: 0.9em;
}

.profile-share-form input {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #aaa;
    border-radius: 4px;
    font: inherit;
    padding: 8px;
}

.clear-candidate-filter {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #aaa;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}

.clear-candidate-filter:hover,
.clear-candidate-filter:focus-visible {
    background: #eaf2fb;
    outline: none;
}

.clear-candidate-filter svg {
    width: 20px;
    height: 20px;
}

.clear-candidate-filter path:first-child {
    fill: none;
    stroke: #444;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.clear-candidate-filter .filter-strike {
    fill: none;
    stroke: #dc3545;
    stroke-linecap: round;
    stroke-width: 2.4;
}

@media (max-width: 780px) {
    .profile-share-comboboxes {
        grid-template-columns: 1fr;
    }
}

.profile-share-form .btn {
    justify-self: start;
    margin-top: 8px;
}

.share-result,
.share-message {
    max-width: 900px;
    margin: 20px auto;
}

.share-result {
    position: relative;
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 8px;
    min-height: 180px;
    margin-top: 30vh;
    padding: 28px;
}

.share-result-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #555;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.share-result-close:hover,
.share-result-close:focus-visible {
    background: #eaf2fb;
    color: #000;
    outline: none;
}

.share-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

#mailtoSection .btn {
    display: inline-block;
}

.share-error {
    border-left: 4px solid #dc3545;
    padding-left: 10px;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
}

th,
td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
    cursor: pointer;
}

th a {
    text-decoration: none;
    color: #333;
    display: block;
}

th a:hover {
    color: #007bff;
}

tr:hover {
    background-color: #f1f1f1;
}

/* Candidates: two table rows per candidate */
.candidates-table tbody.candidate tr:hover {
    background-color: transparent;
}

.candidates-table tbody.candidate:hover {
    background-color: #f1f1f1;
}

.candidates-table tbody.candidate:not(:last-of-type) tr:last-child td,
.candidates-table tbody.candidate:not(:last-of-type) tr:last-child th {
    border-bottom: 2px solid #c9ced6;
}

.candidates-table .candidate-personalia td,
.candidates-table .candidate-personalia th {
    border-bottom: 0;
    padding-bottom: 2px;
}

.candidates-table .candidate-administration td,
.candidates-table .candidate-administration th {
    padding-top: 2px;
    font-size: 14px;
}

.candidates-table .candidate-label {
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    cursor: default;
    white-space: nowrap;
}

.candidates-table .candidate-document {
    vertical-align: middle;
}

.candidates-table .candidate-name {
    font-weight: 600;
}

.candidates-table .candidate-role {
    white-space: nowrap;
}

.candidates-table .candidate-status {
    vertical-align: top;
}

.candidates-table .candidate-nowrap {
    white-space: nowrap;
}

.candidates-table .candidate-email {
    padding-left: 20px;
}

.candidate-field-label {
    background: transparent;
    cursor: default;
    font-weight: 400;
    margin-right: 4px;
}

.profile-share-date,
.profile-share-notes {
    white-space: nowrap;
}

.profile-share-notes {
    min-width: 260px;
    white-space: pre-wrap;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    background: #eaf2fb;
    color: #164a7a;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.registration-check,
.registration-cross {
    font-size: 18px;
    font-weight: 700;
}

.registration-check {
    color: #198754;
}

.registration-cross {
    color: #dc3545;
}

.btn {
    display: inline-block;
    padding: 6px 12px;
    border: 0;
    background-color: #ccc;
    color: #000;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.btn:hover {
    background-color: #0056b3;
    color: #fff;
}

.missing-details-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 14px;
    margin-left: 6px;
    background-color: #ffc107;
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
    color: #000;
    font-size: 0;
    vertical-align: middle;
}

.missing-details-warning::before {
    content: "!";
    margin-top: 5px;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

.details-dialog {
    width: min(420px, calc(100vw - 40px));
    border: 0;
    border-radius: 6px;
    padding: 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.details-dialog::backdrop {
    background: rgba(0, 0, 0, 0.25);
}

.details-dialog form {
    margin: 0;
    padding: 18px;
}

.details-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.details-dialog h2 {
    margin: 0;
    color: #444;
    font-size: 20px;
}

.dialog-close {
    border: 0;
    background: transparent;
    color: #555;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.dialog-close:hover {
    color: #000;
}

.details-company {
    font-weight: 600;
    margin: 0 0 10px;
}

.details-content {
    white-space: pre-wrap;
    line-height: 1.5;
}

.details-editor {
    box-sizing: border-box;
    width: 100%;
    min-height: 140px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    padding: 10px;
    resize: vertical;
}

.details-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.btn:disabled,
.btn:disabled:hover {
    background-color: #e5e5e5;
    color: #888;
    cursor: not-allowed;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.login-form {
    width: min(360px, 100%);
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    box-sizing: border-box;
    padding: 24px;
}

.login-form h1 {
    margin: 0 0 24px;
    font-size: 26px;
}

.login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.login-form input {
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 4px;
    font: inherit;
    margin-bottom: 16px;
    padding: 9px 10px;
}

.login-submit {
    width: 100%;
}

.login-error {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    margin: 0 0 16px;
    padding: 10px;
}

/* Chat view styles */
.chat-container {
    max-width: 1600px;
    margin: 0 auto;
    background: #fff;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-top: 20px;
}

.chat-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message {
    width: 70%;
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 8px;
    line-height: 1.6;
}

/* User messages are right-aligned. */
.message.user {
    background-color: #f0f7ff;
    border-left: 4px solid #007bff;
    margin-left: 29%;
}

.message.assistant {
    background-color: #f9f9f9;
    border-left: 4px solid #444;
    margin-right: 30%;
}

.message.system {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    font-size: 0.9em;
}

.message-role {
    font-weight: bold;
    margin-bottom: 5px;
    text-transform: capitalize;
    display: flex;
    justify-content: space-between;
}

.timestamp-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.timestamp {
    font-weight: normal;
    font-size: 0.8em;
    padding-bottom: 10px;
    color: #888;
}

.back-link:hover {
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-arrows {
    display: flex;
    gap: 5px;
}

.nav-arrows button {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0 6px;
    cursor: pointer;
    font-size: 18px;
    color: #555;
    transition: all 0.2s;
    line-height: 1;
}

.nav-arrows button:hover {
    background: #e9ecef;
    border-color: #ccc;
    color: #007bff;
}

.nav-arrows button:active {
    background: #dee2e6;
}
