:root {
    color-scheme: light;
}
body {
    margin: 0;
    font-family: "Times New Roman", Times, serif;
    color: #1b1b1b;
    background: #f7f7f7;
}
a {
    color: #2f6fed;
}
a:hover {
    color: #1b4fd6;
}
.page {
    min-height: 100vh;
    display: grid;
    place-items: start center;
    padding: 28px 20px 48px;
}
.dashboard-page {
    /* Override base .page layout so footer sits just below content. */
    display: block;
    min-height: auto;
    padding: 28px 20px 32px;
}
.card {
    max-width: 720px;
    width: 100%;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 48px 56px;
    margin-top: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}
h1 {
    margin: 0 0 12px;
    font-size: 34px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    text-align: center;
}
.subtitle {
    text-align: center;
    font-size: 16px;
    margin: 0 0 28px;
    color: #444;
}
.divider {
    height: 1px;
    background: #d9d9d9;
    margin: 24px 0;
}
.section-title {
    margin: 12px 0 0;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #1b1b1b;
}
.agreement-columns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    margin-top: 16px;
}
.agreement-column {
    display: grid;
    gap: 12px;
}
.agreement-column-title {
    margin: 0;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #1b1b1b;
}
@media (max-width: 900px) {
    .agreement-columns {
        grid-template-columns: 1fr;
    }
}
.message {
    font-size: 15px;
    line-height: 1.7;
    margin: 0;
}
.notice {
    margin-top: 24px;
    font-size: 14px;
    color: #555;
}
.link-button {
    background: #2f6fed;
    border: none;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}
.link-button:hover {
    background: #255cd0;
    color: #fff;
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-overlay.is-open {
    display: flex;
}
.modal-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 28px 32px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.modal-header h2 {
    margin: 0;
    font-size: 20px;
}
.modal-body {
    font-size: 14px;
    color: #444;
    margin: 8px 0 12px;
}
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #444;
}
.modal-status {
    margin: 12px 0;
    padding: 10px 12px;
    border: 1px solid #c9d7ff;
    background: #f2f6ff;
    border-radius: 6px;
    font-size: 13px;
}
.modal-card label {
    display: block;
    font-size: 14px;
    margin: 0 0 6px;
    width: 100%;
    white-space: nowrap;
}
.modal-card input[type="email"],
.modal-card input[type="password"],
.modal-card input[type="text"],
.modal-card select {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #c9c9c9;
    font-size: 14px;
    font-family: "Times New Roman", Times, serif;
    box-sizing: border-box;
    margin-bottom: 14px;
}
.form-section {
    margin-bottom: 28px;
    padding: 16px;
    border: 1px solid #e4e4e4;
    border-radius: 8px;
    background: #fbfbfb;
}
.form-section h2 {
    margin: 0 0 6px;
    font-size: 16px;
}
.section-hint {
    margin: 0 0 12px;
    font-size: 13px;
    color: #666;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 20px;
    row-gap: 20px;
    margin-bottom: 12px;
}
.form-grid > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-grid label {
    margin-top: 0;
}
.user-form {
    display: grid;
    gap: 20px;
}
.user-form .modal-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}
@media (max-width: 720px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}
.modal-actions {
    margin-top: 16px;
}
.modal-actions button {
    background: #2f6fed;
    border: none;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
}
.modal-actions button:hover {
    background: #255cd0;
}
.exhibit-actions .link-button {
    margin-right: 8px;
}
.exhibit-actions {
    margin-top: 12px;
    margin-bottom: 16px;
}
.exhibit-title {
    text-align: center;
    text-transform: uppercase;
    margin: 0 0 6px;
}
.exhibit-subtitle {
    text-align: center;
    margin: 0 0 16px;
}
.modal-actions .text-link {
    background: none;
    color: #2f6fed;
    padding: 0;
    border-radius: 0;
    text-decoration: underline;
}
.modal-actions .text-link:hover {
    background: none;
    color: #1b4fd6;
}
.password-criteria {
    margin: 12px 0 16px;
}
.criteria-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    display: grid;
    gap: 6px;
    font-size: 14px;
}
.criteria-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b6b6b;
}
.criteria-list li.is-met {
    color: #1e6f3d;
}
.criteria-list li.is-unmet {
    color: #9c2f2f;
}
.criteria-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid currentColor;
    font-weight: 700;
    font-size: 12px;
}
.criteria-status .icon-ok,
.criteria-status .icon-x {
    display: none;
    font-size: 12px;
}
.criteria-list li.is-met .criteria-status .icon-ok {
    display: inline-flex;
}
.criteria-list li.is-unmet .criteria-status .icon-x {
    display: inline-flex;
}
.list-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 14px;
}
.list-table.referral-table {
    table-layout: fixed;
}
.list-table.referral-table th:nth-child(1),
.list-table.referral-table td:nth-child(1) {
    width: 20%;
}
.list-table.referral-table th:nth-child(2),
.list-table.referral-table td:nth-child(2) {
    width: 45%;
}
.list-table.referral-table th:nth-child(3),
.list-table.referral-table td:nth-child(3) {
    width: 35%;
}
.list-table th,
.list-table td {
    border: 1px solid #e1e1e1;
    padding: 10px;
    text-align: left;
}
.list-table thead {
    background: #f3f3f3;
}
.footer {
    margin-top: 32px;
    text-align: center;
    font-size: 13px;
    color: #666;
}
.site-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: #666;
    padding: 16px 20px 24px;
}
.site-footer p {
    margin: 4px 0;
}
.site-footer a {
    color: #2f6fed;
    text-decoration: none;
}
.site-footer a:hover {
    text-decoration: underline;
    color: #1b4fd6;
}
.dashboard-page .card,
.dashboard-wide {
    max-width: 980px;
}
.dashboard-card {
    padding: 40px 48px;
}
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.dashboard-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}
.dashboard-header h1 {
    margin: 0 0 6px;
    font-size: 30px;
}
.dashboard-header .subtitle {
    margin-bottom: 0;
}
.link-button.secondary {
    background: #ffffff;
    color: #2f6fed;
    border: 1px solid #c9d7ff;
}
.link-button.secondary:hover {
    background: #eef3ff;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 24px;
}
.signature-section {
    margin-top: 24px;
}
.signature-pad {
    width: 100%;
    border: 1px dashed #c9c9c9;
    border-radius: 10px;
    background: #ffffff;
    padding: 8px;
}
#signature-canvas {
    width: 100%;
    height: 220px;
    display: block;
    background: #ffffff;
}
.signature-actions {
    margin-top: 12px;
}
.signature-meta {
    margin-top: 12px;
    font-size: 13px;
    color: #444;
    line-height: 1.5;
}
.signature-preview {
    border: 1px dashed #c9c9c9;
    border-radius: 10px;
    padding: 8px;
    background: #ffffff;
    max-width: 420px;
}
.signature-preview img {
    width: 100%;
    height: auto;
    display: block;
}
.agreement-party-label {
    display: block;
    margin-bottom: 8px;
}
.agreement-signature {
    margin: 12px 0 16px;
}
.dashboard-card .list-table {
    margin-top: 16px;
}
.dashboard-card .list-table thead {
    background: #f5f7fb;
}
.dashboard-card .list-table th,
.dashboard-card .list-table td {
    padding: 12px;
}
.table-wrapper {
    overflow-x: auto;
    overflow-y: visible;
}
.table-wrapper--no-horizontal-scroll {
    /* Default: allow horizontal scroll on small screens for responsiveness */
    overflow-x: auto;
}
@media (min-width: 1024px) {
    /* On desktop viewports, keep table within card without its own horizontal scrollbar */
    .table-wrapper--no-horizontal-scroll {
        overflow-x: visible;
    }
}
.table-wrapper .actions-cell {
    overflow: visible;
}
.table-toolbar {
    display: flex;
    justify-content: flex-end;
    margin: 12px 0 8px;
}
.table-search {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #5a5f6f;
}
.table-search input {
    width: 220px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #c9c9c9;
    font-size: 13px;
    font-family: "Times New Roman", Times, serif;
}
#territory-table td:nth-child(5),
#territory-table th:nth-child(5) {
    max-width: 240px;
    width: 240px;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 16px;
}
.sort-button {
    background: none;
    border: none;
    font: inherit;
    color: inherit;
    cursor: pointer;
    padding: 0;
}
.sort-button::after {
    content: "";
    display: inline-block;
    margin-left: 6px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid #9aa2b1;
    transform: translateY(-1px);
}
.sort-button[data-direction="desc"]::after {
    transform: translateY(-1px) rotate(180deg);
}
.muted {
    color: #9aa2b1;
}
.actions-cell {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    overflow: visible;
}
.action-link {
    color: #2f6fed;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}
.action-link:hover {
    text-decoration: underline;
    color: #1b4fd6;
}
.action-link-button {
    background: none;
    border: none;
    padding: 0;
    color: #2f6fed;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.action-link-button:hover {
    text-decoration: underline;
    color: #1b4fd6;
    background: none;
}
/* Custom tooltip styles */
.action-link[data-tooltip],
.action-link-button[data-tooltip],
button.action-link[data-tooltip] {
    position: relative;
}
.action-link[data-tooltip]:hover::before,
.action-link-button[data-tooltip]:hover::before,
button.action-link[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 8px;
    padding: 6px 10px;
    background: #333;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    white-space: normal;
    border-radius: 4px;
    pointer-events: none;
    z-index: 1000;
    font-family: inherit;
    max-width: 180px;
    min-width: 120px;
    word-wrap: break-word;
    text-align: left;
    line-height: 1.4;
    /* Ensure tooltip doesn't extend beyond table */
    transform: translateX(0);
    left: auto;
}
.action-link[data-tooltip]:hover::after,
.action-link-button[data-tooltip]:hover::after,
button.action-link[data-tooltip]:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 8px;
    margin-bottom: 2px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #333;
    pointer-events: none;
    z-index: 1000;
}
.action-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
.action-menu-toggle {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}
.action-menu-dropdown {
    position: absolute;
    top: 28px;
    right: 0;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
    padding: 6px 0;
    display: none;
    z-index: 20;
}
.action-menu.is-open .action-menu-dropdown {
    display: block;
}
.action-menu-dropdown a {
    display: block;
    padding: 8px 12px;
    color: #1b1b1b;
    text-decoration: none;
    font-size: 13px;
}
.action-menu-dropdown a:hover {
    background: #f2f6ff;
    color: #1b4fd6;
}
.inline-form {
    margin: 0;
}
.dashboard-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px;
    border-radius: 10px;
    border: 1px solid #e2e4ea;
    background: #ffffff;
    color: #1b1b1b;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.dashboard-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    border-color: #2f6fed;
    background: #f0f5ff;
}
.tile-title {
    font-size: 16px;
    font-weight: 600;
}
.tile-subtitle {
    font-size: 13px;
    color: #5a5f6f;
}
@media (max-width: 820px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}
