* { box-sizing: border-box; }

:root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    color: #172033;
    background: #f3f5f8;
}

body { margin: 0; }

.page {
    max-width: 1040px;
    margin: 42px auto;
    padding: 0 24px 56px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 22px;
}

.header h1 {
    margin: 0;
    font-size: 30px;
    letter-spacing: -0.5px;
}

.header p {
    margin: 7px 0 0;
    color: #667085;
}

.badge {
    border: 1px solid #dbe2ea;
    background: white;
    color: #475467;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 13px;
}

.card {
    background: #fff;
    border: 1px solid #e7ebf0;
    border-radius: 16px;
    padding: 26px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(16, 24, 40, .035);
}

.card h2 {
    margin: 0 0 18px;
    font-size: 18px;
}

.grid {
    display: grid;
    gap: 16px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

label > span:first-child {
    display: block;
    margin-bottom: 7px;
    color: #475467;
    font-size: 13px;
    font-weight: 600;
}

input[type="date"],
input[type="number"],
input[type="search"] {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: white;
    padding: 0 12px;
    font-size: 15px;
    outline: none;
}

input:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.segmented {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.segmented label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented label span {
    display: block;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    cursor: pointer;
    color: #344054;
    font-size: 14px;
    font-weight: 500;
}

.segmented label input:checked + span {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.selector {
    margin-top: 18px;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    padding: 15px;
}

.selector.hidden { display: none; }

.selector-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #475467;
}

.search { margin-bottom: 10px; }

.list {
    max-height: 290px;
    overflow-y: auto;
}

.item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 9px 3px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
}

.item:last-child { border-bottom: none; }

.item input {
    margin-top: 2px;
    width: 17px;
    height: 17px;
}

.item-main {
    line-height: 1.25;
}

.item-sub {
    margin-top: 3px;
    color: #98a2b3;
    font-size: 12px;
}

.check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.check input {
    width: 17px;
    height: 17px;
}

.check span {
    margin: 0 !important;
    font-size: 14px !important;
    color: #344054 !important;
    font-weight: 500 !important;
}

.top-gap { margin-top: 20px; }

.hint {
    margin: 12px 0 0;
    color: #667085;
    font-size: 13px;
}

.action-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}

.primary {
    border: 0;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    font-size: 15px;
    font-weight: 650;
    padding: 12px 19px;
    cursor: pointer;
}

.primary:hover { background: #1d4ed8; }

.primary:disabled {
    opacity: .55;
    cursor: wait;
}

.loader {
    display: none;
    width: 18px;
    height: 18px;
    margin-left: 10px;
    vertical-align: middle;
    border: 2px solid #d0d5dd;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.loader.visible { display: inline-block; }

.status {
    color: #667085;
    font-size: 14px;
    text-align: right;
}

.status.success { color: #067647; }
.status.error { color: #b42318; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 700px) {
    .page {
        margin-top: 22px;
        padding: 0 14px 40px;
    }

    .grid.two {
        grid-template-columns: 1fr;
    }

    .card { padding: 20px; }

    .action-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .status { text-align: left; }
}
/* History v3 */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.secondary-link {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: #fff;
    color: #344054;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.secondary-link:hover {
    background: #f8fafc;
}

.wide-page {
    max-width: 1440px;
}

.history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.history-summary {
    color: #667085;
    font-size: 14px;
}

.secondary-button {
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: white;
    color: #344054;
    padding: 9px 13px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.table-wrap {
    overflow-x: auto;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1180px;
    font-size: 13px;
}

.history-table th {
    text-align: left;
    padding: 10px 9px;
    color: #475467;
    font-weight: 650;
    border-bottom: 1px solid #dfe3e8;
    white-space: nowrap;
}

.history-table td {
    vertical-align: top;
    padding: 11px 9px;
    border-bottom: 1px solid #eef1f4;
    color: #344054;
}

.history-table tbody tr:hover {
    background: #fafbfc;
}

.table-sub {
    margin-top: 3px;
    color: #98a2b3;
    font-size: 11px;
}

.status-pill {
    display: inline-block;
    padding: 4px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.status-pill.success {
    background: #ecfdf3;
    color: #067647;
}

.status-pill.error {
    background: #fef3f2;
    color: #b42318;
}

.table-error {
    margin-top: 6px;
    max-width: 280px;
    color: #b42318;
    font-size: 11px;
    word-break: break-word;
}

.empty-cell {
    text-align: center;
    color: #98a2b3 !important;
    padding: 36px !important;
}

/* Calls Export v5 — SKK button */
.export-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.skk-button {
    min-height: 40px;
    padding-left: 16px;
    padding-right: 16px;
}

/* Calls Export v6 - application authentication */
.header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.inline-form {
    display: inline;
    margin: 0;
}

.logout-button {
    min-height: 34px;
    padding: 0 11px;
    border: 1px solid #f3c7c3;
    border-radius: 9px;
    background: #fff;
    color: #b42318;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.logout-button:hover {
    background: #fef3f2;
}

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

.auth-card {
    width: 100%;
    max-width: 420px;
    padding: 32px;
    border: 1px solid #e7ebf0;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 34px rgba(16, 24, 40, .08);
}

.auth-title {
    font-size: 27px;
    font-weight: 750;
    letter-spacing: -.4px;
}

.auth-subtitle {
    margin-top: 7px;
    color: #667085;
    font-size: 14px;
}

.auth-form,
.password-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.password-form input[type="password"] {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: white;
    padding: 0 12px;
    font-size: 15px;
    outline: none;
}

.auth-form input:focus,
.password-form input:focus {
    border-color: #84adff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.auth-submit {
    width: 100%;
    margin-top: 4px;
}

.auth-message {
    margin-top: 18px;
    padding: 11px 12px;
    border-radius: 9px;
    font-size: 13px;
}

.auth-message.error {
    background: #fef3f2;
    color: #b42318;
    border: 1px solid #fecdca;
}

.auth-message.success {
    background: #ecfdf3;
    color: #067647;
    border: 1px solid #abefc6;
}

.account-page {
    max-width: 760px;
}

.password-card {
    max-width: 560px;
}

@media (max-width: 700px) {
    .header {
        flex-direction: column;
    }

    .header-actions {
        justify-content: flex-start;
    }

    .auth-card {
        padding: 24px;
    }
}

.deal-filter {
    border-top: 1px solid #e7ebf0;
    padding-top: 20px;
}
#dealDateFields.is-disabled { opacity: .55; }
#dealDateFields input:disabled {
    background: #f3f5f8;
    color: #667085;
    cursor: not-allowed;
}
