/* Root
---------------- */

:root {
    /* Colors  */
    --white: #fff;
    --dark: #151d27;

    --text-lt: #a9aeb4;
    --text-lt-2: #8e949c;

    --blue: #3f8dee;
    --blue-lt: #a7d0ef;

    --gray: #ced4da;
    --gray-2: #dde1e5;
    --gray-3: #eff1f6;
    --gray-4: #e6e8ee;
    --gray-5: #c0c5cf;
    --gray-6: #a3acbd;
    --gray-7: #8591a8;

    --warning: #f59d59;
    --danger: #ee493f;
    --primary: #1a477f;
    --success: #6ac567;

    --danger-lt: #f6a29c;
    --success-lt: #b2e1b0;

    /* Sizes
    ---------

    --tablet (max): 991.98px;
    --small-tablet (max): 767.98px;
    --mobile (max): 575.98px;

    */
}

html, body {
    font-family: 'Inter', sans-serif;
    font-feature-settings: 'calt', 'dlig', 'ss01', 'ss02', 'ss03';
    -webkit-font-smoothing: antialiased;
    background: var(--white);

    @supports (font-variation-settings: normal) {
        font-family: InterVariable, sans-serif;
    }
}

/* Utils
---------------- */

.clearfix::after {
    content: '';
    clear: both;
    display: table;
}

.none {
    display: none;
}

/* Choices
---------------- */

.choices {
    margin-bottom: 0;

    .choices__inner {
        min-height: 0;
        padding: 4px 0px 0px 4px !important;

        .choices__list--multiple {
            .choices__item {
                border: 1px color-mix(in srgb, var(--blue) 90%, black) solid;
                line-height: inherit;
                color: var(--white);
                background: var(--blue);
                margin: 0 4px 2px 0;
            }

            .choices__button {
                margin: 0 0 0 6px;
                padding: 0 10px 0 12px;
                border-left: 1px color-mix(in srgb, var(--blue) 80%, black) dotted;
            }
        }

        .choices__list--single {
            .choices__item {
                margin: 0 0 2px 0;
            }
        }
    }

    select.choices__input {
        display: block !important;
        left: 0 !important;
        bottom: 0 !important;
        position: absolute !important;
        opacity: 0;
        pointer-events: none;
    }
}

/* Pagination
---------------- */

.pagination {
    --bs-pagination-color: var(--dark);
    --bs-pagination-hover-color: var(--dark);
    --bs-pagination-focus-color: var(--dark);
    --bs-pagination-active-bg: color-mix(in srgb, var(--blue) 90%, black);
    --bs-pagination-active-border-color: color-mix(in srgb, var(--blue) 90%, black);
}

/* Forms
---------------- */

form {
    .field-group,
    .form-check {
        margin: 0 0 15px 0;

        .readonly {
            font-size: 0.9375rem;
        }
    }

    .invalid-feedback {
        margin: 0px 0 12px 0px;
        color: var(--danger);

        .field-group & {
            margin-top: 3px;
        }

        .form-check & {
            margin-top: 7px;
        }
    }

    .submit-group {
        margin: 15px 0 0 0;
    }

    .form-control {
        border-radius: 4px;

        &::placeholder {
            color: var(--text-lt);
        }
    }

    .file-row-container {
        &:has(+ .file-row-container) {
            margin: 0 0 10px 0;
        }

        [data-file] {
            color: transparent;

            [data-has-verified-file] & {
                border-color: var(--success);
                background: var(--success-lt);
            }

            &.invalid {
                border-color: var(--danger);
                background: var(--danger-lt);
            }
        }

        .filename {
            width: calc(100% - 110px - 60px);
            left: 109px;
            top: 8px;
            position: absolute;
            overflow: hidden;
            z-index: 4096;
            text-overflow: ellipsis;
            text-wrap: nowrap;
            pointer-events: none;
        }
    }

    .formset {
        margin: 0 0 15px 0;

        .headline {
            margin: 0 0 10px 0;
            font-size: 1.2rem;
            font-weight: 500;
        }

        .inlines {
            .inline {
                margin: 0 0 15px 0;
                padding: 15px;
                border-radius: 3px;
                background: var(--gray-4);

                label strong {
                    font-weight: 600;
                }

                .controls {
                    .control {
                        float: right;
                    }
                }
            }
        }

        > .controls {
            float: right;

            .control {
                float: left;

                &:not(:last-child) {
                    margin: 0 10px 0 0;
                }

                .btn.secondary {
                    opacity: .75;
                }
            }
        }
    }
}

/* Container
---------------- */

.container {
    max-width: 1170px;
}

/* Header
---------------- */

header {
    background: var(--dark);

    .logo {
        float: left;

        a {
            width: 52px;
            height: 22px;
            margin: 13px 0;
            float: left;
            text-indent: -9000px;
            background: transparent url("../svg/logo.35788da42e73.svg") left top no-repeat;
            opacity: 0.85;

            &:hover {
                opacity: 1;
            }
        }
    }

    > .container > menu {
        margin: 0;
        padding: 0;
        float: right;

        > li {
            margin: 7px 0;
            float: left;
            font-size: 0.875rem;
            line-height: 1;
            list-style: none;

            &:not(:last-child) {
                margin-right: 10px;
            }

            > a {
                padding: 10px;
                border-radius: 4px;
                float: left;
                text-decoration: none;
                color: var(--gray-3);

                &:hover {
                    background: rgba(255, 255, 255, .05);
                }

                @media (max-width: 767.98px) {
                    padding: 10px 15px;
                }

                .active & {
                    color: var(--white);
                    background: rgba(255, 255, 255, .15);
                }

                &:not(.dropdown-trigger) > .icon {
                    margin: 0 7px 0 0;

                    @media (max-width: 767.98px) {
                        margin: 0;
                    }
                }

                > strong {
                    font-weight: normal;

                    @media (max-width: 767.98px) {
                        display: none;
                    }
                }
            }
        }
    }
}

/* Main Menu
---------------- */

nav.main {
    background: var(--primary);

    > .container > menu {
        margin: 0;
        padding: 0;
        float: left;

        &:empty {
            height: 5px;
        }

        > li {
            margin: 7px 0 0 0;
            float: left;
            font-size: 0.875rem;
            line-height: 1;
            list-style: none;

            &:not(:last-child) {
                margin-right: 5px;
            }

            > a {
                padding: 11px 10px 10px 10px;
                border-top-right-radius: 4px;
                border-top-left-radius: 4px;
                float: left;
                text-decoration: none;
                color: var(--white);
                background: rgba(255, 255, 255, .04);

                &:hover {
                    background: rgba(255, 255, 255, .10);
                }

                .active & {
                    color: var(--dark);
                    background: var(--white);

                    .extra & {
                        border-left: 4px var(--gray) solid;
                    }
                }

                @media (max-width: 767.98px) {
                    &:not(.extra &):is(:has(.extra) &) {
                        padding: 11px 13px 10px 13px;
                    }
                }

                .icon {
                    + strong {
                        margin: 0 0 0 7px;
                        font-weight: normal;

                        &:not(.extra &):is(:has(.extra) &) {
                            @media (max-width: 767.98px) {
                                display: none;
                            }
                        }
                    }

                    &.success {
                        color: var(--success);
                    }
                }
            }
        }
    }
}

/* Submenu
---------------- */

nav.sub {
    background: linear-gradient(var(--white), var(--gray-3));
    border-bottom: 1px var(--gray) solid;

    > .container > menu {
        margin: 0;
        padding: 0;
        float: left;

        &:empty {
            height: 5px;
        }

        > li {
            margin: 7px 0;
            float: left;
            font-size: 0.875rem;
            line-height: 1;
            list-style: none;

            &:not(:last-child) {
                margin-right: 5px;
            }

            &.separator {
                width: 0px;
                height: 1rem;
                margin: 11px 10px 7px 5px;
                border-right: 1px color-mix(in srgb, var(--dark) 10%, transparent) dotted;

                @media (max-width: 575.98px) {
                    display: none;
                }
            }

            > a {
                padding: 7px 10px;
                border-radius: 3px;
                float: left;
                text-decoration: none;
                color: var(--dark);

                &:hover {
                    background: color-mix(in srgb, var(--dark) 5%, transparent);
                }

                .active & {
                    background: color-mix(in srgb, var(--dark) 15%, transparent);
                }
            }
        }
    }
}

/* Dropdowns
---------------- */

menu.dropdown-menu > li {
    font-size: 0.875rem;

    .dropdown-item {
        padding: 7px 16px;
    }

    .dropdown-header .icon,
    .dropdown-item > .icon {
        display: inline-block;
        margin: 0 7px 0 0;
    }
}

/* Confirmation
---------------- */

.popover.confirmation {
    border-color: var(--gray-5);
    box-shadow: 1px 1px 3px 0 rgba(0, 0, 0, 0.1);

    .popover-header {
        padding: 9px 14px;
        border-bottom-color: var(--gray-4);
        font-size: 0.8125rem;
        font-weight: 500;
        background: var(--gray-3);
    }

    .popover-body {
        padding: 10px 14px;
        text-align: right;
        white-space: nowrap;

        .btn {
            padding: 3px 14px !important;
            font-size: 0.8125rem;

            &.cancel {
                margin: 0 0 0 5px;
            }
        }
    }
}

/* Text
---------------- */

.text {
    &.secondary {
        color: var(--gray);
    }

    &.info {
        color: var(--blue);
    }

    &.success {
        color: var(--success);
    }

    &.warning {
        color: var(--warning);
    }

    &.danger {
        color: var(--danger);
    }
}

/* Message
---------------- */

.message {
    margin: 20px 0;
    padding: 15px 20px;
    border-width: 1px;
    border-style: solid;
    border-radius: 4px;

    &.secondary {
        border-color: var(--gray);
        background: color-mix(in srgb, var(--gray) 25%, transparent);
    }

    &.success {
        border-color: var(--success);
        background: color-mix(in srgb, var(--success) 25%, transparent);
    }

    &.info {
        border-color: var(--blue);
        background: color-mix(in srgb, var(--blue) 10%, transparent);
    }

    &.warning {
        border-color: var(--warning);
        background: color-mix(in srgb, var(--warning) 10%, transparent);
    }

    &.danger {
        border-color: var(--danger);
        background: color-mix(in srgb, var(--danger) 10%, transparent);
    }
}

/* Noted
---------------- */

/* A message noted by an action, e.g., an Ajax response - it floats, since the
   action that raised it can be taken anywhere down the page */
.message.noted {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1090;
    max-width: 360px;
    margin: 0;
    cursor: pointer;
    background: var(--white);
    box-shadow: 1px 1px 6px 0 rgba(0, 0, 0, 0.15);

    &.success {
        background: color-mix(in srgb, var(--success) 25%, white);
    }

    &.danger {
        background: color-mix(in srgb, var(--danger) 10%, white);
    }

    @media (max-width: 575.98px) {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* HR
---------------- */

hr {
    border-color: var(--gray-5);
    color: var(--gray-5);
}

/* Button
---------------- */

.btn {
    padding: 6px 18px !important;
    border-radius: 3px;
    font-size: 0.875rem;

    &[type="submit"] {
        margin: 5px 0 0 0;
    }

    &.adjacent,
    &.cancel {
        margin: 5px 0 0 5px;
    }

    &.primary {
        border-color: var(--primary);
        color: var(--white);
        font-weight: 500;
        background: color-mix(in srgb, var(--primary) 90%, white);

        &:hover {
            border-color: color-mix(in srgb, var(--primary) 95%, black);
            background: color-mix(in srgb, var(--primary) 95%, white);
        }

        &:active {
            color: var(--white);
            border-color: color-mix(in srgb, var(--primary) 90%, black);
            background: var(--primary);
        }
    }

    &.secondary {
        border-color: color-mix(in srgb, var(--gray-7) 90%, black);
        color: var(--white);
        font-weight: 500;
        background: var(--gray-7);

        &:hover {
            border-color: color-mix(in srgb, var(--gray-7) 85%, black);
            background: color-mix(in srgb, var(--gray-7) 90%, black);
        }

        &:active {
            border-color: color-mix(in srgb, var(--gray-7) 80%, black);
            color: var(--white);
            background: color-mix(in srgb, var(--gray-7) 85%, black);
        }
    }

    &.success {
        border-color: color-mix(in srgb, var(--success) 90%, black);
        color: var(--white);
        font-weight: 500;
        background: var(--success);

        &:hover {
            border-color: color-mix(in srgb, var(--success) 85%, black);
            background: color-mix(in srgb, var(--success) 90%, black);
        }

        &:active {
            border-color: color-mix(in srgb, var(--success) 80%, black);
            color: var(--white);
            background: color-mix(in srgb, var(--success) 85%, black);
        }
    }

    &.danger {
        border-color: color-mix(in srgb, var(--danger) 90%, black);
        color: var(--white);
        font-weight: 500;
        background: var(--danger);

        &:hover {
            border-color: color-mix(in srgb, var(--danger) 85%, black);
            background: color-mix(in srgb, var(--danger) 90%, black);
        }

        &:active {
            border-color: color-mix(in srgb, var(--danger) 80%, black);
            color: var(--white);
            background: color-mix(in srgb, var(--danger) 85%, black);
        }
    }

    &.link {
        color: var(--text-lt-2);
        text-decoration: none;
        font-weight: 300;

        &:hover {
            color: var(--dark);
            text-decoration: underline;
        }
    }
}

/* Section
---------------- */

.section {
    margin: 15px 0 0 0;
}

/* Content
---------------- */

.content {
    font-size: 0.9375rem;

    ::selection {
        color: var(--dark);
        background: var(--blue-lt);
    }

    a {
        text-decoration: none;

        &:hover:not(.btn):not(.dropdown-item):not(.list-toggle) {
            text-decoration: underline;
        }
    }

    /* A minor control, e.g., edit, archive, etc., as a link or a submit */
    .control {
        color: var(--gray-6);

        &:hover {
            color: var(--gray-7);
        }

        &:not(:last-child) {
            margin: 0 10px 0 0;
        }
    }

    button.control {
        padding: 0;
        border: 0;
        line-height: 1;
        cursor: pointer;
        background: none;
    }

    h1, h2, h3, h4, h5, h6 {
        margin: 0;

        .subtitle {
            margin: 0 0 0 4px;
            font-weight: 200;
            font-size: 1rem;

            &::before {
                content: '/ ';
            }
        }
    }

    h1 {
        font-size: 1.375rem;
        font-weight: 400;

        @media (max-width: 767.98px) {
            font-size: 1.25rem;
        }
    }

    h2 {
        margin: 20px 0 0 0;
        font-size: 1.125rem;
        font-weight: 500;

        @media (max-width: 767.98px) {
            font-size: 1.0625rem;
        }
    }

    h3 {
        margin: 2px 0 10px 0;
        font-size: 0.9375rem;
        font-weight: 700;
    }

    .headings {
        .info {
            float: left;

            @media (max-width: 575.98px) {
                float: none;
            }
        }

        .ctas {
            float: right;

            @media (max-width: 575.98px) {
                margin: 15px 0 5px 0;
                float: none;
            }

            .cta {
                float: left;

                @media (max-width: 575.98px) {
                    padding: 4px 16px !important;
                }

                &:not(:last-child) {
                    margin: 0 10px 0 0;
                }

                .icon:first-child {
                    margin: 0 7px 0 -2px;
                }

                .icon.closing {
                    margin: 0 -2px 0 7px;
                }
            }
        }
    }

    .text-success {
        color: var(--success) !important;
    }

    .text-danger {
        color: var(--danger) !important;
    }

    .subinfo {
        margin: 5px 0 0 0;

        &.deep {
            margin: 15px 0 0 0;
        }
    }

    .subtle {
        color: var(--text-lt-2);
        font-weight: 300;

        &.smaller {
            font-size: 0.8125rem;
        }
    }

    .before {
        margin: 0 7px 0 0;
    }

    .lighter {
        color: var(--text-lt-2);
    }

    .datum {
        margin: 0 0 10px 0;

        .icon:first-child {
            margin: 0 5px 0 0;
        }
    }

    address {
        margin: 10px 0 0 0;
        line-height: 1.214;

        .line {
            margin: 5px 0 0 0;
        }
    }
}

/* Shell
---------------- */

.shell {
    margin-top: 15px;
    padding: 17px 20px 20px 20px;
    border-radius: 4px;
    background: var(--gray-3);
    box-shadow: 1px 1px 0 0 rgba(0, 0, 0, 0.08);

    &.invalid {
        border-top: 5px var(--danger) solid;
    }

    &.kard {
        .action {
            margin: 0 0 0 10px;
            float: right;
            font-size: 0.8125rem;
            text-decoration: none;
            font-weight: 200;
            color: var(--gray);

            &:hover {
                color: var(--gray-6);
                text-decoration: underline;
            }
        }
    }

    &.less {
        background: color-mix(in srgb, var(--gray-3) 50%, white);
    }

    .minor {
        font-size: 0.875rem;

        .icon {
            font-size: 0.75rem;
        }
    }

    .last {
        margin-bottom: 0;
    }
}

/* Preview
---------------- */

/* A preview of what a form's input amounts to, e.g., when a schedule is next
   due - hidden until there is enough filled in to tell */
.preview {
    display: none;
    margin: 20px 0 5px 0;
    padding: 12px 15px;
    border-left: 3px var(--blue) solid;
    border-radius: 3px;
    background: color-mix(in srgb, var(--blue) 8%, white);

    .schedule {
        font-weight: 500;

        .icon {
            margin: 0 8px 0 0;
            color: var(--blue);
        }
    }

    .next {
        margin: 6px 0 0 0;
        font-size: 0.875rem;
        color: var(--text-lt-2);
    }
}

/* Listable
---------------- */

.list-buttons {
    float: right;

    @media (max-width: 575.98px) {
        margin: 15px 0 5px 0;
        float: none;
    }
}

/* A switch that stands for what the page is showing, e.g., a list that
   includes what has been completed - it takes no input of its own, so that it
   only ever reads as on as the page it arrived with, and is a link, so that
   the page it means is the one that turns it */
.list-toggle {
    margin: 20px 0 -10px 0;
    display: inline-block;

    .form-check {
        margin: 0;

        /* The switch is inert, since the link around it does the turning, so
           it is kept from reading as the disabled control that it is */
        .form-check-input:disabled {
            opacity: 1;
            filter: none;
            cursor: pointer;

            &:checked {
                border-color: var(--gray-7);
                background-color: var(--gray-7);
            }

            ~ .form-check-label {
                opacity: 1;
                color: var(--text-lt-2);
                font-size: 0.875rem;
                font-weight: 300;
                cursor: pointer;
            }
        }
    }
}

.listable {
    margin: 20px 0 0 0;
    overflow-x: scroll;

    > table:not(:has(tbody tr)) {
        display: none;
    }

    table tbody td.attachments {
        color: var(--text-lt-2);
    }

    .cs-box {
        display: block;
        margin-top: -5px;

        .cs {
            float: left;
            margin-top: 5px;
            padding: 2px 7px;
            border-radius: 2px;
            cursor: default;

            &:not(:last-child) {
                margin-right: 5px;
            }

            &.primary {
                color: var(--white);
                background: var(--primary);
            }

            &.secondary {
                color: var(--dark);
                background: var(--gray-3);
            }
        }
    }

    tr.inactive > td {
        background: var(--gray-3);
    }

    /* A cell of controls, e.g., edit, archive, deactivate, etc. */
    td.controls {
        white-space: nowrap;

        form {
            display: inline-block;
        }
    }

    /* Controls that only apply while the row is not inactive, e.g., editing
       a task that has since been completed */
    tr.inactive .editable {
        display: none;
    }

    /* A row the URL's fragment names, e.g., a message that was linked to from
       a dashboard, which is marked, so that it can be picked out */
    tr:target > td {
        background: color-mix(in srgb, var(--blue) 10%, white);
    }
}

/* A list under a heading of its own, e.g., the tasks due under one client, on
   a dashboard that covers them all */
.grouping {
    margin: 20px 0 0 0;

    h3 {
        margin: 0;

        /* The client the group is under reads as the heading it is, rather
           than as one more link among the list beneath it */
        a {
            color: var(--dark);
        }

        .icon {
            font-size: 0.8125rem;
        }
    }

    .listable {
        margin: 10px 0 0 0;
    }
}

/* A link out of a shortened list, e.g., to all that is due under a client,
   where a dashboard shows only the next few - it is kept quiet, so that it
   trails the list without competing with anything in it */
.trailing {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 300;

    a {
        color: var(--gray-7);

        &:hover {
            color: var(--dark);
        }
    }
}

/* Tasks
---------------- */

.tasks {
    td.check {
        width: 1%;

        .check:hover {
            color: var(--success);
        }
    }

    /* Marks a task that a routine scheduled, so it is left narrow, and only
       filled in for the tasks that came from one */
    .origin {
        width: 1%;
        color: var(--text-lt-2);
    }

    tr.overdue td.due {
        color: var(--danger);

        .icon {
            font-size: 0.8125rem;
        }
    }

    /* What a task involves, i.e., its description, which is hidden until it
       is expanded, the way a message's contents are */
    tr.details {
        display: none;

        .wrap {
            padding: 15px 20px;
            border-radius: 3px;
            color: var(--gray-7);
            background: var(--gray-3);
        }
    }
}

/* Comms
---------------- */

/* A brief list of messages, e.g., on a dashboard, where each can name the
   client it was said under */
.comms {
    /* The client reads as the heading of the row, rather than as one more
       link alongside what was said */
    .client {
        color: var(--dark);
    }
}

/* Marks an inbound message that has been replied to, so it is left narrow,
   and only filled in for the ones that are owed nothing further */
td.answered,
th.answered {
    width: 1%;

    .icon {
        color: var(--success);
    }
}

.communication {
    display: none;

    .wrap {
        padding: 20px;
        border-radius: 3px;
        background: var(--gray-3);

        .sender {
            color: var(--gray-7);
        }

        blockquote.contents {
            margin: 15px 0 0 0;
            padding: 0 0 0 20px;
            border-left: 5px var(--gray) solid;

            .subject {
                margin: 0 0 10px 0;
                font-weight: 700;
            }

            .body {
                margin: 10px 0 0 0;
            }

            .attachments {
                margin: 20px 0 0 0;

                h4 {
                    margin: 2px 0 10px 0;
                    font-size: 0.875rem;
                    color: var(--gray-7);
                    font-weight: 600;
                }

                ul {
                    margin: 0;
                    padding: 0;
                    list-style: inside square;

                    li {
                        margin: 0 0 5px 0;

                        &:last-child {
                            margin: 0;
                        }
                    }
                }
            }
        }

        .controls {
            margin: 15px 0 0 0;
            padding: 0;

            li {
                float: left;
                font-size: 0.875rem;
                list-style: none;

                a {
                    float: left;
                    padding: 6px 14px;
                    border-radius: 2px;
                    color: var(--dark);
                    background: var(--gray-2);

                    &:not(:last-child) {
                        border-top-right-radius: 0;
                        border-bottom-right-radius: 0;
                    }

                    &:hover {
                        text-decoration: none;
                        background: var(--gray);
                    }

                    .icon {
                        margin: 0 7px 0 0;
                    }
                }
            }
        }
    }
}

/* Handoff
-------------------------------------------------------------------------- */

/* Where an Admin waits while a task fetches the URL that hands them off to
   DocuSign - it stands alone on the page, so it is centred and given room */
.handoff {
    padding: 4rem 1rem;
    text-align: center;

    .icon {
        color: var(--text-lt-2);
        font-size: 3rem;
    }

    .note {
        margin: 1.5rem 0 0;
        color: var(--text-lt-2);
    }

    .btn {
        margin-top: 1.5rem;
    }

    /* The one that went wrong, which is the only state worth colouring */
    .failed .icon {
        color: var(--danger);
    }
}
