/* Visual refresh layered over app.css. Screen only, so printed reports and order PDFs keep their own styling. */
@media screen {
    html:root {
        --line: #E4E7EC;
        --soft-border: #D9DEE5;
        --soft: #F4F5F7;
        --neutral-gray: #F4F5F7;
        --muted: #6B7280;
        --orange-soft: #FFF3EC;
        --brand-hover: #D94816;
        --radius: 14px;
        --radius-small: 10px;
        --shadow-card: 0 1px 2px #0F1A2B0A, 0 8px 24px #0F1A2B0A;
        --shadow-raised: 0 2px 4px #0F1A2B0F, 0 16px 36px #0F1A2B14;
        --focus-ring: 0 0 0 3px #F15A2433;
        font-family: "DM Sans", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    }

    html body {
        background: radial-gradient(ellipse at 85% -10%, #FFE9DD 0, transparent 42%), radial-gradient(ellipse at 0 100%, #E9EEF6 0, transparent 40%), #F8F7F5;
        background-attachment: fixed;
        font-size: 14px;
        line-height: 1.45;
        -webkit-font-smoothing: antialiased;
    }

    ::selection {
        background: #F15A2433;
    }

    /* Top bar */
    html body .topbar {
        background: #FFFFFFD9;
        border-bottom-color: var(--line);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }

    html body .brand {
        font-size: 15px;
        letter-spacing: .04em;
    }

    html body .brand strong {
        font-weight: 800;
    }

    html body .top-context,
    html body .account-name {
        font-size: 13px;
    }

    html body .avatar {
        width: 34px;
        height: 34px;
        background: linear-gradient(135deg, #FF8A5B, var(--brand-primary));
        color: #fff;
        font-size: 13px;
    }

    html body .account-form .text-button {
        padding: 8px 14px;
        border: 1px solid var(--line);
        border-radius: 999px;
        background: #fff;
        color: var(--brand-dark);
        font-size: 12.5px;
        transition: background-color .15s ease, border-color .15s ease, color .15s ease;
    }

    html body .account-form .text-button:hover {
        border-color: var(--brand-primary);
        background: var(--orange-soft);
        color: var(--brand-hover);
    }

    /* Sidebar */
    html body .layout > .sidebar {
        border-right-color: var(--line);
    }

    html body .sidebar-label,
    html body .eyebrow {
        color: #9AA3AF;
        font-weight: 700; font-size: 10.5px; line-height: 1.2;
        font-family: inherit;
        letter-spacing: .1em;
    }

    html body .nav-item {
        min-height: 42px;
        padding: 9px 12px;
        border-radius: var(--radius-small);
        color: #4B5563;
        font-size: 13.5px;
        transition: background-color .15s ease, color .15s ease;
    }

    html body .nav-item:hover {
        background: var(--soft);
        color: var(--brand-dark);
    }

    html body .nav-item.active {
        background: var(--orange-soft);
        box-shadow: none;
        color: #B93E12;
        font-weight: 700;
    }

    html body .nav-mark {
        width: 26px;
        height: 26px;
        border: 0;
        border-radius: 8px;
        background: var(--soft);
        color: #6B7280;
        font-size: 11.5px;
        font-weight: 700;
        transition: background-color .15s ease, color .15s ease;
    }

    html body .nav-item.active .nav-mark {
        background: var(--brand-primary);
        color: #fff;
    }

    html body .nav-item small {
        padding: 2px 8px;
        border-radius: 999px;
        background: var(--brand-primary);
        color: #fff;
        font-weight: 700; font-size: 11px; line-height: 1.5;
        font-family: inherit;
    }

    html body .layout > .sidebar-footer {
        border-top-color: var(--line);
    }

    html body .sidebar-footer strong {
        font-size: 12.5px;
    }

    html body .sidebar-footer small {
        font-size: 11px;
    }

    html body .workspace-avatar {
        width: 34px;
        height: 34px;
        border-radius: var(--radius-small);
        background: linear-gradient(135deg, #1D2B45, var(--brand-dark));
        font-size: 12px;
    }

    /* Headings and text */
    html body .page-heading h1,
    html body .setup-panel h1,
    html body .login-panel h1 {
        font-weight: 700; font-size: 28px; line-height: 1.2;
        font-family: inherit;
        letter-spacing: -.02em;
        color: var(--brand-dark);
    }

    html body .muted {
        font-size: 13.5px;
    }

    html body .inline-link,
    html body .action-link {
        font-size: 13px;
    }

    html body .inline-link:hover,
    html body .action-link:hover {
        text-decoration: underline;
        text-underline-offset: 3px;
    }

    html body .empty,
    html body .empty-cell {
        font-size: 13px;
    }

    /* Cards */
    html body .panel {
        border-color: var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow-card);
    }

    html body .panel > .entry-form {
        padding: 10px;
    }

    html body .table-panel,
    html body .history-panel {
        overflow: hidden;
    }

    html body .panel-heading {
        padding: 18px 20px;
        border-bottom-color: var(--line);
    }

    html body .panel-heading h2,
    html body .alert-panel h2 {
        font-size: 15.5px;
        color: var(--brand-dark);
    }

    html body .panel-heading p {
        font-size: 12.5px;
    }

    html body .metric {
        min-height: 132px;
        padding: 20px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        box-shadow: var(--shadow-card);
        transition: transform .18s ease, box-shadow .18s ease;
    }

    html body .metric::before {
        content: "";
        display: block;
        width: 30px;
        height: 4px;
        margin-bottom: 14px;
        border-radius: 4px;
        background: linear-gradient(90deg, var(--brand-primary), #FF9A6E);
    }

    html body .metric:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-raised);
    }

    html body .metric-label {
        color: var(--muted);
        font-size: 12.5px;
        font-weight: 600;
    }

    html body .metric strong {
        margin-top: 10px;
        font-size: 26px;
        letter-spacing: -.02em;
        color: var(--brand-dark);
    }

    html body .metric small {
        font-size: 12px;
    }

    html body .alert-panel {
        border-color: #F8D2C0;
        background: #FFF8F4;
    }

    html body .alert-panel p {
        border-top-color: #F8E1D6;
        font-size: 13px;
    }

    html body .alert-panel p span {
        font-size: 12px;
    }

    /* Dashboard chart and stock list */
    html body .bar-track i {
        border-radius: 6px 6px 0 0;
        background: linear-gradient(to top, var(--brand-primary), #FF9A6E);
    }

    html body .bar-value,
    html body .bar-label {
        font-size: 10.5px; line-height: 1.4;
        font-family: inherit;
    }

    html body .stock-line {
        padding: 14px 20px;
        font-size: 13px;
    }

    html body .stock-line strong {
        font-size: 13px;
    }

    html body .stock-line i {
        width: 10px;
        height: 10px;
        border-radius: 50%;
    }

    html body .stock-panel .inline-link {
        margin: 16px 20px 0;
    }

    /* Tables */
    html body .table-panel th {
        padding: 13px 16px;
        background: #FAFAFB;
        border-bottom-color: var(--line);
        color: #6B7280;
        font-weight: 700; font-size: 11px; line-height: 1.4;
        font-family: inherit;
        letter-spacing: .05em;
    }

    html body .table-panel td {
        padding: 14px 16px;
        border-bottom-color: #EEF0F3;
        color: #374151;
        font-size: 13px;
    }

    html body .table-panel td:first-child {
        color: var(--brand-dark);
    }

    html body .table-panel tbody tr {
        transition: background-color .12s ease;
    }

    html body .table-panel tbody tr:hover {
        background: #FFF9F5;
    }

    html body .table-panel .record-time,
    html body .table-panel .record-note {
        font-size: 11.5px;
    }

    html body .status {
        padding: 4px 10px;
        border-radius: 999px;
        background: #E8F7EE;
        color: #17663A;
        font-weight: 600; font-size: 11.5px; line-height: 1.4;
        font-family: inherit;
    }

    html body .status.warning {
        background: #FFF0E6;
        color: #B93E12;
    }

    html body .record-count,
    html body .record-pagination {
        font-size: 12.5px; line-height: 1.4;
        font-family: inherit;
    }

    #activity .record-pagination > a:last-child {
        margin-right: 10px;
    }

    html body .history-row,
    html body .history-row time,
    html body .history-title span,
    html body .history-supplier,
    html body .history-expense,
    html body .usage-total {
        font-size: 12px;
    }

    html body .history-title strong {
        font-size: 13.5px;
    }

    html body .record-detail-item dt {
        font-size: 11px;
        letter-spacing: .04em;
    }

    html body .record-detail-item dd {
        font-size: 13.5px;
    }

    /* Buttons */
    html body .button {
        min-height: 40px;
        padding: 0 18px;
        border-radius: var(--radius-small);
        font-size: 13px;
        box-shadow: 0 1px 2px #F15A2433;
        transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .08s ease;
    }

    html body .button:hover {
        box-shadow: 0 6px 16px #F15A2440;
    }

    html body .button:active {
        transform: translateY(1px);
    }

    html body .button.secondary {
        border-color: var(--soft-border);
        box-shadow: 0 1px 2px #0F1A2B0A;
    }

    html body .button.secondary:hover {
        border-color: #C5CBD3;
        box-shadow: 0 4px 12px #0F1A2B12;
    }

    html body .button.small {
        min-height: 36px;
        padding: 0 14px;
        border-radius: 9px;
        font-size: 12.5px;
    }

    html body .inventory-save {
        background: var(--brand-primary);
        border-color: var(--brand-primary);
        color: #fff;
    }

    html body .inventory-save:hover,
    html body .order-product-save:hover {
        background: var(--brand-hover);
        border-color: var(--brand-hover);
    }

    html body .button:focus-visible,
    html body .nav-item:focus-visible,
    html body .text-button:focus-visible,
    html body .inline-link:focus-visible,
    html body .action-link:focus-visible {
        outline: 0;
        box-shadow: var(--focus-ring);
    }

    /* Fields */
    html body .entry-form label,
    html body .login-panel label,
    html body .report-filter-form label,
    html body .user-settings-form > label,
    html body .customer-combobox label {
        color: #4B5563;
        font-size: 12.5px;
        font-weight: 600;
    }

    html body .entry-form input:not([type="checkbox"]):not([type="radio"]),
    html body .entry-form select,
    html body .entry-form textarea,
    html body .login-panel input,
    html body .panel-heading select,
    html body .search-form input,
    html body .report-filter-form input,
    html body .user-settings-form select,
    html body .history-sort-form select {
        border-color: var(--soft-border);
        border-radius: var(--radius-small);
        background-color: #fff;
        color: var(--dark-text);
        font-size: 13.5px;
        transition: border-color .15s ease, box-shadow .15s ease;
    }

    html body .entry-form input:not([type="checkbox"]):not([type="radio"]):hover,
    html body .entry-form select:hover,
    html body .entry-form textarea:hover,
    html body .login-panel input:hover,
    html body .search-form input:hover {
        border-color: #BFC6D0;
    }

    html body .entry-form input:not([type="checkbox"]):not([type="radio"]):focus,
    html body .entry-form select:focus,
    html body .entry-form textarea:focus,
    html body .login-panel input:focus,
    html body .panel-heading select:focus,
    html body .search-form input:focus,
    html body .report-filter-form input:focus,
    html body .user-settings-form select:focus,
    html body .history-sort-form select:focus {
        border-color: var(--brand-primary);
        outline: 0;
        box-shadow: var(--focus-ring);
    }

    html body .entry-form input[readonly],
    html body .entry-form input.system-generated {
        background-color: var(--soft);
        color: #6B7280;
    }

    html body .search-form input {
        min-height: 40px;
        padding: 0 14px;
    }

    html body .panel-heading select,
    html body .history-sort-form select {
        min-height: 36px;
        font-size: 12.5px;
    }

    html body .field-meta {
        font-size: 10px;
    }

    html body .operator-roles {
        border-radius: var(--radius-small);
    }

    html body .operator-roles legend,
    html body .operator-role-options label {
        font-size: 12.5px;
    }

    html body .operator-role-options label small {
        font-size: 11px;
    }

    /* Customer form and order customer picker */
    html body .customer-entry-form .customer-row-label {
        font-size: 13px;
    }

    html body .customer-entry-form .customer-type-options label {
        font-size: 13px;
        font-weight: 500;
    }

    html body .customer-entry-form .customer-tabs button {
        font-size: 13px;
    }

    html body .customer-hint {
        font-size: 11.5px;
    }

    html body .customer-phone > span {
        border-color: var(--soft-border);
        border-radius: var(--radius-small) 0 0 var(--radius-small);
        font-size: 13px;
    }

    html body .customer-entry-form .customer-phone input {
        border-radius: 0 var(--radius-small) var(--radius-small) 0;
    }

    html body .customer-combobox-menu {
        border-radius: 12px;
        box-shadow: var(--shadow-raised);
    }

    html body .customer-combobox-menu li {
        padding: 10px 12px;
        border-radius: 8px;
        font-size: 13px;
    }

    html body .customer-combobox-menu li small {
        font-size: 11.5px;
    }

    html body .entry-form .customer-combobox-add {
        padding: 12px 14px;
        font-size: 13px;
    }

    /* Add-record button and pop-up forms */
    html body main.content details.form-panel:not([open]) > summary {
        background: linear-gradient(135deg, #FF8A5B, var(--brand-primary));
        box-shadow: 0 10px 26px #F15A2459;
    }

    html body main.content details.form-panel:not([open]) > summary:hover {
        box-shadow: 0 14px 32px #F15A2473;
    }

    html body main.content details.form-panel[open] {
        border: 0;
        border-radius: 16px;
        box-shadow: 0 0 0 100vmax #0F1A2B73, 0 24px 70px #0F1A2B4D;
    }

    html body main.content details.form-panel[open] > summary {
        border-bottom-color: var(--line);
    }

    html body main.content details.form-panel[open] .form-panel-title {
        color: var(--brand-dark);
        font-size: 17px;
    }

    html body .material-dialog-backdrop {
        background: #0F1A2B73;
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
    }

    html body .material-dialog {
        padding: 24px;
        border: 0;
        border-radius: 16px;
        box-shadow: 0 24px 70px #0F1A2B4D;
    }

    html body .material-dialog-heading {
        border-bottom-color: var(--line);
    }

    html body .material-dialog-heading .eyebrow {
        color: var(--brand-primary);
    }

    html body .material-dialog-heading h2 {
        color: var(--brand-dark);
        font-weight: 700;
    }

    html body .material-dialog-close {
        transition: background-color .15s ease, color .15s ease;
    }

    html body .material-dialog-close:hover {
        background: var(--orange-soft);
        color: var(--brand-hover);
    }

    html body .material-dialog-footnote {
        font-size: 12px;
    }

    /* Messages */
    html body .notice {
        margin: 0 0 16px;
        padding: 12px 16px;
        border-radius: 12px;
        font-size: 13.5px;
        font-weight: 500;
    }

    html body .notice.success {
        border-color: #BFE3CD;
        background: #EFFAF3;
        color: #17663A;
    }

    html body .notice.error {
        border-color: #F8D2C0;
        background: #FFF3EC;
        color: #A8371A;
    }

    /* Sign-in and setup screens */
    html body .setup-screen {
        background: radial-gradient(circle at 12% 8%, #FFE0CF 0, transparent 38%), radial-gradient(circle at 92% 92%, #DDE5F3 0, transparent 42%), #F8F7F5;
    }

    html body .login-panel,
    html body .setup-panel {
        padding: 40px;
        border: 0;
        border-radius: 20px;
        box-shadow: 0 2px 4px #0F1A2B0A, 0 28px 64px #0F1A2B1F;
    }

    html body .login-panel input {
        min-height: 44px;
        padding: 10px 14px;
    }

    html body .login-panel .button.full {
        min-height: 44px;
        margin-top: 12px;
        font-size: 14px;
    }

    /* Scrollbars */
    html {
        scrollbar-color: #C9CED6 transparent;
    }

    @media (max-width: 700px) {
        html body .nav-item {
            min-height: 36px;
            padding: 7px 12px;
            font-size: 12.5px;
        }

        html body .page-heading h1 {
            font-size: 23px;
        }

        html body .metric {
            min-height: 112px;
            padding: 14px;
        }

        html body .metric strong {
            font-size: 21px;
        }

        html body .table-panel th,
        html body .table-panel td {
            padding: 12px;
        }

        html body .login-panel,
        html body .setup-panel {
            padding: 28px;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        html body * {
            transition: none !important;
        }

        html body .metric:hover {
            transform: none;
        }
    }
}

/* Wider pop-ups for comfortable viewing. */
@media screen {
    html body main.content details.form-panel[open] {
        width: min(940px, calc(100vw - 32px));
    }

    html body main.content details.customer-form-panel[open] {
        width: min(1080px, calc(100vw - 32px));
    }

    html body main.content details.order-form-panel[open] {
        width: min(1280px, calc(100vw - 32px));
    }

    html body .material-dialog {
        width: min(640px, 100%);
    }

    html body .material-dialog.record-dialog {
        width: min(900px, 100%);
    }

    html body .material-dialog.customer-dialog {
        width: min(1080px, 100%);
    }

    html body .material-dialog.order-record-dialog {
        width: min(1280px, 100%);
    }

    html body .customer-row-field {
        max-width: 600px;
    }

    html body .customer-row-field.customer-row-field-wide {
        max-width: none;
    }

    @media (max-width: 600px) {
        html body .customer-row-field {
            max-width: none;
        }
    }
}
/* Individual customer page. */
.customer-profile-heading {
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.customer-profile-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.customer-profile {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.customer-profile-side,
.customer-profile-main {
    display: grid;
    gap: 16px;
    min-width: 0;
}

.customer-profile-main > .metric-grid,
.customer-profile-main > .panel {
    margin-bottom: 0;
}

.customer-profile .customer-metrics {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.customer-card {
    padding: 18px 20px;
}

.customer-card h2 {
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    color: var(--brand-dark);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.customer-card h3 {
    margin: 14px 0 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.customer-card .muted {
    margin: 0;
}

.customer-card-company {
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    color: var(--brand-dark);
    font-size: 14px;
    font-weight: 700;
}

.customer-contact {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.customer-contact-avatar {
    flex: 0 0 44px;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--orange-soft);
    color: var(--brand-primary);
    font-size: 16px;
    font-weight: 700;
}

.customer-contact > div {
    display: grid;
    gap: 4px;
    min-width: 0;
    font-size: 13.5px;
    overflow-wrap: anywhere;
}

.customer-contact strong {
    color: var(--brand-dark);
    font-size: 14.5px;
}

.customer-address {
    display: grid;
    gap: 3px;
    margin: 0;
    color: var(--dark-text);
    font-size: 13.5px;
}

.customer-facts {
    display: grid;
    gap: 10px;
    margin: 0;
}

.customer-facts > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 12px;
    font-size: 13px;
}

.customer-facts dt {
    color: var(--muted);
}

.customer-facts dd {
    margin: 0;
    color: var(--dark-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.customer-remarks {
    margin: 0;
    color: var(--dark-text);
    font-size: 13px;
    line-height: 1.55;
}

.customer-chart-total {
    color: var(--brand-dark);
    font-size: 16px;
    white-space: nowrap;
}

.customer-timeline {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 20px;
    list-style: none;
}

.customer-timeline li {
    position: relative;
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
}

.customer-timeline li::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: -14px;
    left: 163px;
    width: 2px;
    background: var(--line);
}

.customer-timeline li:last-child::before {
    bottom: 0;
}

.customer-timeline li::after {
    content: "";
    position: absolute;
    top: 14px;
    left: 158px;
    width: 12px;
    height: 12px;
    border: 2px solid var(--brand-primary);
    border-radius: 50%;
    background: #fff;
}

.customer-timeline time {
    padding-top: 10px;
    color: var(--muted);
    font-size: 12.5px;
    text-align: right;
}

.customer-timeline-card {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.customer-timeline-card strong {
    color: var(--brand-dark);
    font-size: 14px;
}

.customer-timeline-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.customer-timeline-card small {
    color: var(--muted);
    font-size: 12.5px;
}

.customer-timeline-card small b {
    color: var(--dark-text);
}

@media (max-width: 1050px) {
    .customer-profile {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .customer-timeline li {
        grid-template-columns: 1fr;
        gap: 6px;
        padding-left: 22px;
    }

    .customer-timeline li::before {
        left: 5px;
    }

    .customer-timeline li::after {
        top: 4px;
        left: 0;
    }

    .customer-timeline time {
        padding-top: 0;
        text-align: left;
    }
}
/* Customer page tabs and statement of accounts. */
.customer-profile-tabs {
    display: flex;
    gap: 26px;
    margin: -8px 0 20px;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
}

.customer-profile-tabs a {
    flex: 0 0 auto;
    margin-bottom: -1px;
    padding: 10px 0;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 600;
}

.customer-profile-tabs a:hover {
    color: var(--brand-dark);
}

.customer-profile-tabs a[aria-current="page"] {
    border-bottom-color: var(--brand-primary);
    color: var(--brand-dark);
}

.customer-statement-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.statement-caption {
    margin-bottom: 20px;
    text-align: center;
}

.statement-caption h2 {
    margin: 0 0 6px;
    color: var(--brand-dark);
    font-size: 18px;
    font-weight: 600;
}

.statement-caption p {
    margin: 0;
    color: var(--muted);
    font-size: 13.5px;
}

.statement-sheet {
    width: min(100%, 900px);
    margin: 0 auto;
    padding: clamp(20px, 5vw, 56px);
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 4px #0F1A2B0F, 0 16px 36px #0F1A2B14;
    color: #1F2937;
    font-size: 13.5px;
}

.statement-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 3px solid var(--brand-primary);
}

.statement-sheet-header img {
    width: 190px;
    max-height: 76px;
    object-fit: contain;
    object-position: left center;
}

.statement-sheet-header > div {
    display: grid;
    gap: 4px;
    text-align: right;
}

.statement-sheet-header strong {
    color: var(--brand-dark);
    font-size: 15px;
}

.statement-sheet-parties {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: 32px;
    align-items: end;
    margin: 32px 0 28px;
}

.statement-sheet-parties > div:first-child {
    display: grid;
    gap: 3px;
    align-content: start;
    align-self: start;
}

.statement-label {
    margin: 0 0 4px;
    font-weight: 700;
}

.statement-customer {
    color: var(--brand-primary);
    font-size: 14.5px;
    text-transform: uppercase;
}

.statement-summary h3 {
    margin: 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #1F2937;
    color: #111827;
    font-size: 22px;
    text-align: right;
}

.statement-range {
    margin: 0 0 18px;
    padding: 8px 0;
    border-bottom: 1px solid #1F2937;
    text-align: right;
}

.statement-summary-title {
    margin: 0;
    padding: 9px 10px;
    background: #ECEEF1;
    font-weight: 700;
}

.statement-summary dl {
    margin: 0;
}

.statement-summary dl > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 2px;
}

.statement-summary dd {
    margin: 0;
    white-space: nowrap;
}

.statement-summary .statement-balance-due {
    border-top: 1px solid #1F2937;
    font-weight: 700;
}

.statement-table {
    width: 100%;
    border-collapse: collapse;
}

.statement-table th {
    padding: 10px;
    background: var(--brand-dark);
    color: #fff;
    font-size: 12px;
    text-align: left;
}

.statement-table td {
    padding: 10px;
    border-bottom: 1px solid #E5E7EB;
    vertical-align: top;
}

.statement-table th:nth-child(n+4),
.statement-table td:nth-child(n+4) {
    text-align: right;
    white-space: nowrap;
}

.statement-table tfoot td {
    border-bottom: 0;
    font-weight: 700;
    text-align: right;
}

.statement-table .statement-empty {
    color: var(--muted);
    text-align: center;
}

@media (max-width: 700px) {
    .statement-sheet-parties {
        grid-template-columns: 1fr;
    }

    .statement-sheet {
        overflow-x: auto;
    }
}

@media print {
    body.statement-printing .topbar,
    body.statement-printing .mobile-title,
    body.statement-printing .layout > .sidebar,
    body.statement-printing .layout > .sidebar-footer,
    body.statement-printing .customer-statement-toolbar,
    body.statement-printing .statement-caption,
    body.statement-printing main.content > :not(.customer-statement) {
        display: none !important;
    }

    body.statement-printing .layout {
        display: block !important;
        min-height: 0 !important;
    }

    body.statement-printing main.content {
        display: block !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.statement-printing .statement-sheet {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 10pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.statement-printing .statement-table thead {
        display: table-header-group;
    }

    body.statement-printing .statement-table tr {
        break-inside: avoid;
    }
}
/* Customer page: transactions tab. */
.customer-transactions {
    display: grid;
    gap: 14px;
}

.customer-transaction-group {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 1px 2px #0F1A2B0A, 0 8px 24px #0F1A2B0A;
    overflow: hidden;
}

.customer-transaction-group > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: #FAFAFB;
    cursor: pointer;
    list-style: none;
}

.customer-transaction-group > summary::-webkit-details-marker {
    display: none;
}

.customer-transaction-group > summary::before {
    content: "";
    flex: 0 0 7px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg);
    transition: transform .15s ease;
}

.customer-transaction-group[open] > summary {
    border-bottom: 1px solid var(--line);
}

.customer-transaction-group[open] > summary::before {
    transform: rotate(45deg);
}

.customer-transaction-group > summary:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

.customer-transaction-title {
    color: var(--brand-dark);
    font-size: 15px;
    font-weight: 600;
}

.customer-transaction-count {
    padding: 2px 9px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.customer-transaction-group > summary .inline-link {
    margin-left: auto;
}

.customer-transaction-group table {
    width: 100%;
    border-collapse: collapse;
}

.customer-transaction-group th {
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.customer-transaction-group td {
    padding: 13px 20px;
    border-bottom: 1px solid #EEF0F3;
    color: #374151;
    font-size: 13px;
}

.customer-transaction-group tbody tr:last-child td {
    border-bottom: 0;
}
.customer-profile-actions form {
    margin: 0;
}

html body .button.customer-delete-button {
    border-color: #F3C7C0;
    color: #B42318;
}

html body .button.customer-delete-button:hover {
    border-color: #B42318;
    background: #FEF2F2;
}
/* Individual order page. */
.order-page-heading {
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.order-page-heading h1 .status {
    margin-left: 8px;
    vertical-align: middle;
}

.order-page-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.order-page-toolbar form {
    margin: 0;
}

.order-status-change-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.order-status-change-form select {
    min-height: 40px;
    padding: 8px 30px 8px 10px;
    border: 1px solid var(--soft-border);
    border-radius: var(--radius-small);
    background: var(--paper);
    color: var(--dark-text);
    font-size: 13px;
}

.order-print-sheet.order-sheet {
    display: block;
    width: min(100%, 940px);
    margin: 0 auto;
    padding: clamp(20px, 5vw, 56px);
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 2px 4px #0F1A2B0F, 0 16px 36px #0F1A2B14;
    color: #1F2937;
    font-size: 13.5px;
    overflow-x: auto;
}

.order-sheet .order-pdf-parties > div > span {
    display: block;
    margin-top: 3px;
}

.order-sheet .order-pdf-parties h2 a {
    color: var(--brand-primary);
}

.order-sheet .order-pdf-items th {
    background: var(--brand-dark);
    color: #fff;
}

.order-pdf-words {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin: 14px 0 0;
    text-align: right;
}

.order-pdf-words span {
    color: var(--muted);
}

.order-pdf-words em {
    max-width: 320px;
    font-weight: 700;
}

.order-sheet .order-pdf-terms {
    margin-top: 28px;
    padding-top: 0;
}

@media print {
    body.order-printing .order-print-sheet.order-sheet {
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    body.order-printing .order-sheet .order-pdf-items th {
        background: #0F1A2B !important;
        color: #fff !important;
    }

    body.order-printing .order-sheet .order-pdf-parties h2 a {
        color: inherit;
    }
}
/* Payment methods: settings form and order document block. */
.payment-settings-panel {
    margin-bottom: 15px;
}

html body .entry-form.payment-methods-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 18px 20px 20px !important;
}

.payment-methods-form h3 {
    margin: 4px 0 0;
    color: var(--brand-dark);
    font-size: 13px;
}

.payment-methods-form h3.wide,
.payment-methods-form .button.wide {
    grid-column: 1 / -1;
}

.payment-methods-form .button.wide {
    justify-self: start;
}

.order-pdf-payments {
    margin-top: 26px;
    break-inside: avoid;
}

.order-pdf-payments h2 {
    margin: 0 0 10px;
    color: var(--navy);
    font-size: 13px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.order-pdf-payments > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.order-pdf-payments dl {
    display: grid;
    gap: 5px;
    align-content: start;
    margin: 0;
}

.order-pdf-payments dl > div {
    display: flex;
    gap: 6px;
}

.order-pdf-payments dt {
    text-transform: uppercase;
}

.order-pdf-payments dd {
    margin: 0;
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.order-pdf-payments .order-pdf-payments-title dt {
    font-weight: 700;
    text-transform: none;
}

@media (max-width: 600px) {
    html body .entry-form.payment-methods-form,
    .order-pdf-payments > div {
        grid-template-columns: 1fr;
    }
}
/* Payment methods list and its edit dialog. */
.payment-method-row {
    position: relative;
    cursor: pointer;
}

.payment-method-link {
    color: var(--brand-dark);
    font-weight: 700;
}

/* Stretch the link over the whole row so any cell opens the editor. */
.payment-method-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.payment-method-link:focus-visible {
    outline: 0;
}

.payment-method-link:focus-visible::after {
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

html body .material-dialog .entry-form.payment-methods-form {
    padding: 16px 0 0;
}

.payment-methods-form .material-dialog-actions.wide {
    grid-column: 1 / -1;
}

.payment-method-delete {
    margin: 14px 0 0;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.payment-method-delete .action-link {
    padding: 0;
}

.order-pdf-payment-column {
    display: grid;
    gap: 14px;
    align-content: start;
}
/* Profile settings. */
.account-link {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 999px;
}

.account-link:hover .account-name {
    color: var(--brand-primary);
}

.avatar {
    overflow: hidden;
}

.avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

html body .avatar.profile-avatar {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    font-size: 26px;
}

.profile-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

html body .entry-form.profile-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 20px;
}

.profile-form > .button {
    grid-column: 1 / -1;
    justify-self: start;
}

.profile-picture-field {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-picture-field > div {
    display: grid;
    gap: 6px;
    min-width: 0;
}

html body .entry-form.profile-form input[type="file"] {
    height: auto;
    padding: 8px 10px;
}

.profile-picture-field .customer-hint {
    grid-column: auto;
}

html body .entry-form .profile-remove-picture {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

html body .entry-form .profile-remove-picture input {
    width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    accent-color: var(--brand-primary);
}

.profile-summary-panel {
    margin-bottom: 15px;
}

.profile-summary {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
}

.profile-summary > div {
    display: grid;
    gap: 3px;
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.profile-summary strong {
    color: var(--brand-dark);
    font-size: 15px;
}

@media (max-width: 900px) {
    .profile-settings {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    html body .entry-form.profile-form {
        grid-template-columns: 1fr;
    }

    html body .entry-form.profile-form .wide {
        grid-column: 1;
    }
}
/* Action buttons in panel headings: one line, never squeezed by the heading text. */
html body .button {
    white-space: nowrap;
}

html body .panel-heading .button.panel-action {
    flex: 0 0 auto;
    gap: 8px;
    min-height: 40px;
    padding: 0 18px 0 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .01em;
    line-height: 1;
}

html body .panel-heading .button.secondary.panel-action {
    padding: 0 18px;
}

.panel-action-icon {
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #FFFFFF33;
    font-size: 16px;
    font-weight: 500;
    line-height: 1;
}

@media (max-width: 600px) {
    html body .payment-settings-panel .panel-heading,
    html body .profile-summary-panel .panel-heading {
        flex-wrap: wrap;
    }
}
/* Draw the plus from two bars so it sits exactly in the centre of its circle. */
.panel-action-icon {
    position: relative;
    flex: 0 0 20px;
    font-size: 0;
}

.panel-action-icon::before,
.panel-action-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 2px;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.panel-action-icon::before {
    width: 10px;
    height: 2px;
}

.panel-action-icon::after {
    width: 2px;
    height: 10px;
}
/* Payment method choice on the order form. */
html body .order-payment-methods .operator-role-options {
    gap: 10px 22px;
}

html body .order-payment-methods .operator-role-options label {
    font-weight: 600;
}

html body .order-payment-methods .operator-role-options label small {
    font-weight: 400;
}

.order-payment-methods .field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}
/* Individual material page. */
.material-page {
    display: grid;
    gap: 16px;
}

.material-page > .page-heading,
.material-page > .metric-grid,
.material-page > .panel {
    margin-bottom: 0;
}

.material-page-heading {
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.material-page-heading h1 .status {
    margin-left: 8px;
    vertical-align: middle;
}

.material-facts {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px 32px;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: inherit;
}

.sort-link span {
    color: #B6BCC6;
    font-size: 12px;
}

.sort-link:hover,
.sort-link.active {
    color: var(--brand-dark);
}

.sort-link.active span {
    color: var(--brand-primary);
}

.material-page tfoot td {
    padding: 13px 16px;
    border-top: 1px solid var(--line);
    background: #FAFAFB;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
}

@media print {
    body.material-printing .topbar,
    body.material-printing .mobile-title,
    body.material-printing .layout > .sidebar,
    body.material-printing .layout > .sidebar-footer,
    body.material-printing .no-print,
    body.material-printing .sort-link span,
    body.material-printing main.content > :not(.material-page) {
        display: none !important;
    }

    body.material-printing .layout {
        display: block !important;
        min-height: 0 !important;
    }

    body.material-printing main.content {
        display: block !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.material-printing .material-page {
        display: block !important;
    }

    body.material-printing .material-page > * {
        margin-bottom: 12px !important;
    }

    body.material-printing .material-info {
        padding: 10px 12px !important;
    }
}
/* Faint block-wall pattern echoing the logo (solid navy and orange blocks, white joints), rising from the bottom of every page and fading out near the middle. */
@media screen {
    html:root {
        --block-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='176' height='80'%3E%3Cg fill='%231F3347' fill-opacity='.055'%3E%3Crect x='4' y='4' width='108' height='32'/%3E%3Crect x='92' y='44' width='108' height='32'/%3E%3Crect x='-84' y='44' width='108' height='32'/%3E%3C/g%3E%3Cg fill='%23F15A24' fill-opacity='.07'%3E%3Crect x='120' y='4' width='52' height='32'/%3E%3Crect x='32' y='44' width='52' height='32'/%3E%3C/g%3E%3C/svg%3E");
        --block-pattern-fade: linear-gradient(to top, #F8F7F500 0%, #F8F7F5 55%);
    }

    html body {
        background:
            radial-gradient(ellipse at 85% -10%, #FFE9DD 0, transparent 42%),
            var(--block-pattern-fade),
            var(--block-pattern) left bottom / 176px 80px repeat,
            #F8F7F5;
        background-attachment: fixed;
    }

    html body .setup-screen {
        background:
            radial-gradient(circle at 12% 8%, #FFE0CF 0, transparent 38%),
            var(--block-pattern-fade),
            var(--block-pattern) left bottom / 176px 80px repeat,
            #F8F7F5;
        background-attachment: fixed;
    }
}
.table-export-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}
/* Date-range filter above a record table. */
html body .report-filter-form.material-filter-form {
    align-items: end;
    margin: 0;
    padding: 14px 20px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: #FAFAFB;
}

.material-filter-form .button {
    min-height: 40px;
}

.material-filter-form .inline-link {
    align-self: center;
}

.material-filter-period {
    align-self: center;
    margin-left: auto;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

/* Company header on documents. */
.company-settings-panel {
    margin-bottom: 15px;
}

.order-pdf-header > .document-company {
    display: grid;
    gap: 3px;
    justify-items: start;
    text-align: left;
}

.order-pdf-header > .document-company img {
    margin-bottom: 8px;
}

.order-pdf-header > .document-company strong {
    color: var(--navy);
    font-size: 14px;
}

.order-pdf-header > .document-company span,
.statement-sheet-header > div span {
    color: #4B5563;
    font-size: 12px;
}

@media print {
    .report-print-header > div small {
        color: #52616B;
        font-size: 7.5pt;
    }

    body.order-printing .order-pdf-header > .document-company strong {
        font-size: 11pt;
    }

    body.order-printing .order-pdf-header > .document-company span {
        font-size: 8.5pt;
    }
}
/* Order workflow: status colours, accept and decline actions. */
html body .status.danger {
    background: #FDECEA;
    color: #B42318;
}

html body .button.order-accept-button {
    background: #17803D;
    border-color: #17803D;
    box-shadow: 0 1px 2px #17803D33;
}

html body .button.order-accept-button:hover {
    background: #126631;
    border-color: #126631;
    box-shadow: 0 6px 16px #17803D40;
}

.order-page-toolbar {
    align-items: center;
}

.order-status-note {
    flex: 1 1 100%;
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.metric-grid.revenue-metrics {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
/* Smaller avatar in the top bar. */
html body .topbar .avatar {
    width: 28px;
    height: 28px;
    font-size: 11.5px;
}
/* Invoice page. */
.order-pdf-header .invoice-balance-due {
    display: grid;
    gap: 2px;
    margin: 16px 0 0;
    color: var(--navy);
    letter-spacing: 0;
}

.order-pdf-header .invoice-balance-due span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.order-pdf-header .invoice-balance-due b {
    font-size: 19px;
}

.invoice-payments table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-payments th,
.invoice-payments td {
    padding: 8px 10px;
    border-bottom: 1px solid #E5E7EB;
    font-size: 12.5px;
    text-align: left;
}

.invoice-payments th {
    color: var(--muted);
    font-weight: 700;
}

.invoice-payments th:last-child,
.invoice-payments td:last-child {
    text-align: right;
    white-space: nowrap;
}

.record-payment {
    position: relative;
}

.record-payment > summary {
    list-style: none;
}

.record-payment > summary::-webkit-details-marker {
    display: none;
}

html body .record-payment .entry-form.record-payment-form {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: min(340px, calc(100vw - 48px));
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 4px #0F1A2B0F, 0 16px 36px #0F1A2B14;
}

/* Hover animations: small lifts and slides when the cursor is over something clickable. */
@media screen and (hover: hover) and (prefers-reduced-motion: no-preference) {
    @keyframes hover-pop {
        0% { transform: scale(1); }
        50% { transform: scale(1.14); }
        100% { transform: scale(1.06); }
    }

    /* Sidebar */
    html body .nav-item {
        transition: background-color .18s ease, color .18s ease, padding-left .18s ease;
    }

    html body .nav-item:hover {
        padding-left: 16px;
    }

    html body .nav-item:hover .nav-mark {
        background: var(--orange-soft);
        color: #B93E12;
        animation: hover-pop .28s ease forwards;
    }

    html body .nav-item.active:hover .nav-mark {
        background: var(--brand-primary);
        color: #fff;
    }

    /* Buttons */
    html body .button {
        transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
    }

    html body .button:hover {
        transform: translateY(-2px);
    }

    html body .button:active {
        transform: translateY(1px);
        transition-duration: .06s;
    }

    html body .button:hover .panel-action-icon {
        animation: hover-pop .28s ease forwards;
    }

    /* Cards */
    html body .metric:hover {
        transform: translateY(-4px);
    }

    html body .metric::before {
        transition: width .25s ease;
    }

    html body .metric:hover::before {
        width: 56px;
    }

    html body .payment-method-row {
        transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    }

    html body .payment-method-row:hover {
        transform: translateX(4px);
        border-color: #FFC9B0;
        box-shadow: 0 6px 16px #0F1A2B12;
    }

    /* Table rows */
    html body .table-panel tbody tr {
        transition: background-color .18s ease;
    }

    html body .table-panel tbody td:first-child {
        transition: box-shadow .18s ease;
    }

    html body .table-panel tbody tr:hover td:first-child {
        box-shadow: inset 3px 0 0 var(--brand-primary);
    }

    /* Links and tabs */
    html body .inline-link,
    html body .action-link,
    html body .sort-link {
        transition: color .18s ease;
    }

    html body .customer-profile-tabs a {
        transition: color .18s ease, background-color .18s ease, transform .18s ease;
    }

    html body .customer-profile-tabs a:hover {
        transform: translateY(-1px);
    }

    /* Header account */
    html body .account-link .avatar {
        transition: transform .2s ease, box-shadow .2s ease;
    }

    html body .account-link:hover .avatar {
        transform: scale(1.08);
        box-shadow: 0 0 0 3px var(--orange-soft);
    }
}

/* Footer on invoices, orders and statements: logo-style block strip, motto and contacts. */
.document-footer {
    margin-top: 36px;
    text-align: center;
    break-inside: avoid;
    page-break-inside: avoid;
}

.document-footer-blocks {
    height: 40px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='176' height='80'%3E%3Cg fill='%231F3347' fill-opacity='.2'%3E%3Crect x='4' y='4' width='108' height='32'/%3E%3Crect x='92' y='44' width='108' height='32'/%3E%3Crect x='-84' y='44' width='108' height='32'/%3E%3C/g%3E%3Cg fill='%23F15A24' fill-opacity='.6'%3E%3Crect x='120' y='4' width='52' height='32'/%3E%3Crect x='32' y='44' width='52' height='32'/%3E%3C/g%3E%3C/svg%3E") center bottom / 88px 40px repeat-x;
    border-bottom: 2px solid #F15A24;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

html body .document-footer-motto {
    margin: 12px 0 4px;
    color: #F15A24;
    font-size: 15px;
    font-style: italic;
    font-weight: 700;
    letter-spacing: .02em;
}

html body .document-footer-contact {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2px 14px;
    margin: 0;
    color: #6B7280;
    font-size: 11.5px;
}

html body .document-footer-contact strong {
    color: #1F3347;
    font-weight: 700;
}

/* Notifications and order production tracking. */
html body .notification-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    color: #4B5563;
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease;
}

html body .notification-link:hover {
    background: var(--soft);
    color: var(--brand-dark);
}

html body .notification-link.has-unread {
    background: var(--orange-soft);
    color: #B93E12;
}

html body .notification-link b {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 999px;
    background: var(--brand-primary);
    color: #fff;
    font-size: 11px;
    text-align: center;
}

html body .notification-panel {
    border-left: 4px solid var(--brand-primary);
}

.notification-list,
.order-tracker,
.order-tracker-log {
    margin: 0;
    padding: 0;
    list-style: none;
}

.notification-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.notification-list li > div:first-child {
    flex: 1 1 320px;
}

.notification-list strong {
    color: var(--brand-dark);
    font-size: 14px;
}

.notification-list p {
    margin: 4px 0;
    color: #4B5563;
    font-size: 13px;
}

.notification-list small,
.order-tracker-log small {
    color: var(--muted);
    font-size: 11.5px;
}

.notification-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

html body .order-tracker-panel {
    margin-bottom: 20px;
    padding: 10px;
    background: var(--paper);
}

html body .order-tracker-panel > .entry-form {
    padding: 0;
}

html body section.panel.order-production-authorization {
    padding-left: 10px;
    padding-right: 10px;
}

html body .order-confirm-form {
    display: none !important;
}

html body .order-tracker-panel:has(+ .order-production-authorization) .order-tracker-shortage > p:last-of-type {
    display: none;
}

html body section.panel.order-tracker-panel:has(.order-confirm-form) {
    padding-left: 10px;
    padding-right: 10px;
}

html body section.panel.order-production-authorization {
    padding-left: 10px;
    padding-right: 10px;
}

html body .order-confirm-form {
    display: none !important;
}

html body .order-tracker-panel:has(+ .order-production-authorization) .order-tracker-shortage > p:last-of-type {
    display: none;
}

.order-tracker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 4px 0 16px;
}

.order-tracker li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

.order-tracker li span {
    display: grid;
    place-items: center;
    flex: 0 0 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--soft);
    font-size: 11px;
}

.order-tracker li.done {
    border-color: #BFE5CD;
    background: #E8F7EE;
    color: #17663A;
}

.order-tracker li.done span {
    background: #17803D;
    color: #fff;
}

.order-tracker li.current {
    border-color: var(--brand-primary);
    background: var(--orange-soft);
    color: #B93E12;
}

.order-tracker li.current span {
    background: var(--brand-primary);
    color: #fff;
}

.order-tracker-shortage {
    position: relative;
    top: 10px;
    margin-bottom: 16px;
    margin-left: 5px;
    margin-right: 5px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #FFF0E6;
    color: #7A2E0E;
    font-size: 13px;
}

.order-tracker-shortage p {
    margin: 4px 0 0;
}

.order-tracker-covered {
    margin: 0 0 16px;
    color: #17663A;
    font-size: 13px;
    font-weight: 600;
}

html body .entry-form.order-tracker-form {
    display: grid;
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 16px;
}

html body .order-production-authorization button[name="decision"][value="return"] {
    position: relative;
    left: -5px;
}

html body .order-production-authorization .entry-form.order-tracker-form > label {
    margin-left: 5px;
}

.order-tracker-log li {
    display: grid;
    gap: 2px;
    padding: 10px 0 10px 14px;
    border-left: 2px solid var(--line);
    font-size: 13px;
}

.order-tracker-log li:first-child {
    border-left-color: var(--brand-primary);
}

@media (max-width: 700px) {
    .order-tracker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    html body .entry-form.order-tracker-form {
        grid-template-columns: 1fr;
    }
}

@media print {
    .order-tracker-panel,
    .notification-panel {
        display: none;
    }
}

html body .entry-form.order-tracker-form.order-confirm-form {
    grid-template-columns: minmax(0, 1fr) auto auto;
    margin: 0;
}

@media (max-width: 700px) {
    html body .entry-form.order-tracker-form.order-confirm-form {
        grid-template-columns: 1fr;
    }
}


.record-payment-hint {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

html body .invoice-edit-history {
    margin-top: 20px;
}

@media print {
    .invoice-edit-history {
        display: none;
    }
}


html body .notification-tag {
    margin-left: 6px;
    vertical-align: middle;
}


/* Notifications in the top bar: a bell only, with the unread count on it. */
html body .notification-link {
    position: relative;
    justify-content: center;
    gap: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

html body .notification-link svg {
    display: block;
}

html body .notification-link b {
    position: absolute;
    top: -3px;
    right: -5px;
    min-width: 18px;
    padding: 0 5px;
    border: 2px solid #fff;
    font-size: 10.5px;
    line-height: 16px;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    html body .notification-link svg {
        transform-origin: 50% 0;
        transition: transform .2s ease;
    }

    html body .notification-link:hover svg {
        transform: rotate(-12deg);
    }
}

/* Notification pop-up under the bell. */
html body .notification-menu {
    position: relative;
}

html body .notification-menu > summary {
    list-style: none;
    cursor: pointer;
}

html body .notification-menu > summary::-webkit-details-marker {
    display: none;
}

html body .notification-popup {
    position: absolute;
    top: calc(100% + 12px);
    right: -8px;
    z-index: 60;
    width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 480px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 4px #0F1A2B0F, 0 18px 44px #0F1A2B24;
    color: #1F2937;
    text-align: left;
}

html body .notification-popup::before {
    content: "";
    position: absolute;
    top: -7px;
    right: 19px;
    width: 12px;
    height: 12px;
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
    background: #fff;
    transform: rotate(45deg);
}

.notification-popup-heading {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    background: #fff;
    font-size: 14px;
}

.notification-popup-heading strong {
    color: var(--brand-dark);
}

.notification-popup-heading span {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--orange-soft);
    color: #B93E12;
    font-size: 11.5px;
    font-weight: 700;
}

.notification-popup-empty {
    margin: 0;
    padding: 30px 16px;
    color: var(--muted);
    font-size: 13.5px;
    text-align: center;
}

.notification-popup ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.notification-popup li {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    transition: background-color .18s ease;
}

.notification-popup li:last-child {
    border-bottom: 0;
}

.notification-popup li:hover {
    background: #FFF9F5;
}

.notification-popup li > strong {
    color: var(--brand-dark);
}

.notification-popup li p {
    margin: 4px 0;
    color: #4B5563;
    font-size: 12.5px;
    line-height: 1.45;
}

.notification-popup li small {
    color: var(--muted);
    font-size: 11px;
}

.notification-popup-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.notification-popup-actions a,
html body .notification-popup-actions button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand-primary);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

html body .notification-popup-actions button {
    color: var(--muted);
}

.notification-popup-actions a:hover,
html body .notification-popup-actions button:hover {
    text-decoration: underline;
}

@media (prefers-reduced-motion: no-preference) {
    @keyframes notification-pop {
        from { opacity: 0; transform: translateY(-6px) scale(.98); }
        to { opacity: 1; transform: none; }
    }

    html body .notification-menu[open] .notification-popup {
        transform-origin: top right;
        animation: notification-pop .16s ease-out;
    }
}

/* The bell sits on the right of the top bar, next to the account. */
html body .topbar .notification-menu {
    margin-left: auto;
}

html body .topbar .notification-menu + .account-form {
    margin-left: -36px;
}

@media (max-width: 760px) {
    html body .topbar .notification-menu + .account-form {
        margin-left: 0;
    }
}


/* Notifications panel on the overview pages. */
html body .notification-panel {
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-left: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #FFF8F3 0, #fff 120px);
}

.notification-panel-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

html body .notification-panel-heading h2 {
    margin: 0;
    color: var(--brand-dark);
    font-size: 16px;
}

.notification-panel-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 6px 14px #F15A2440;
}

.notification-panel-count {
    margin-left: auto;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--orange-soft);
    color: #B93E12;
    font-size: 12px;
    font-weight: 700;
}

html body .notification-panel .notification-list {
    display: grid;
    gap: 10px;
}

html body .notification-panel .notification-list li {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 14px 16px 14px 22px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 2px #0F1A2B0A;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

/* Coloured edge: orange while in progress, green when ready, red when returned. */
html body .notification-panel .notification-list li::before {
    content: "";
    position: absolute;
    top: 12px;
    bottom: 12px;
    left: 8px;
    width: 4px;
    border-radius: 4px;
    background: var(--brand-primary);
}

html body .notification-panel .notification-list li.is-ready::before {
    background: #17803D;
}

html body .notification-panel .notification-list li.is-returned::before {
    background: #C0392B;
}

html body .notification-panel .notification-list li:hover {
    border-color: #FFC9B0;
    box-shadow: 0 8px 20px #0F1A2B14;
    transform: translateY(-1px);
}

.notification-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

html body .notification-title .notification-tag {
    margin-left: 0;
}

html body .notification-panel .notification-list p {
    margin: 6px 0 4px;
    line-height: 1.5;
}

html body .notification-panel .notification-actions {
    align-items: center;
    gap: 14px;
}

html body .notification-read-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: color .18s ease;
}

html body .notification-read-button:hover {
    color: var(--brand-dark);
    text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
    html body .notification-panel .notification-list li:hover {
        transform: none;
    }
}

/* Breathing room between the notifications panel and what follows. */
html body .notification-panel {
    margin-bottom: 24px;
}


/* Production stages: a small, quiet step line instead of four boxes. */
html body .order-tracker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 0;
    margin: 0 0 14px;
}

html body .order-tracker li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: #9AA3AF;
    font-size: 11.5px;
    font-weight: 600;
}

/* Thin connector between one stage and the next. */
html body .order-tracker li + li::before {
    content: "";
    width: 22px;
    height: 1px;
    margin: 0 8px;
    background: var(--line);
}

html body .order-tracker li span {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    background: var(--soft);
    color: #9AA3AF;
    font-size: 9.5px;
    line-height: 1;
}

html body .order-tracker li.done {
    background: none;
    color: #17663A;
}

html body .order-tracker li.done + li::before {
    background: #17803D;
}

html body .order-tracker li.current {
    background: none;
    color: #B93E12;
}

@media (max-width: 700px) {
    html body .order-tracker li + li::before {
        width: 10px;
        margin: 0 5px;
    }
}

/* Production stages, remade as a stepper: circles joined by a progress line, labels underneath. */
html body .order-tracker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    max-width: 560px;
    margin: 6px 0 18px;
}

html body .order-tracker li {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 0 4px;
    border: 0;
    background: none;
    color: #9AA3AF;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
}

/* The line runs from the previous circle to this one, behind both. */
html body .order-tracker li + li::before {
    content: "";
    position: absolute;
    top: 12px;
    left: -50%;
    width: 100%;
    height: 2px;
    margin: 0;
    border-radius: 2px;
    background: #E5E7EB;
}

html body .order-tracker li.done + li::before {
    background: linear-gradient(90deg, #17803D, #4CAF73);
}

html body .order-tracker li span {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    flex: 0 0 26px;
    width: 26px;
    height: 26px;
    border: 2px solid #E5E7EB;
    border-radius: 50%;
    background: #fff;
    color: #9AA3AF;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    transition: transform .18s ease;
}

/* Finished stages show a tick in place of the number. */
html body .order-tracker li.done {
    color: #17663A;
}

html body .order-tracker li.done span {
    border-color: #17803D;
    background: #17803D;
    color: #fff;
    font-size: 0;
}

html body .order-tracker li.done span::after {
    content: "";
    width: 9px;
    height: 5px;
    margin-top: -2px;
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    transform: rotate(-45deg);
}

html body .order-tracker li.current {
    color: #B93E12;
    font-weight: 700;
}

html body .order-tracker li.current span {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: #fff;
    box-shadow: 0 0 0 4px #F15A2426;
}

html body .order-tracker li:hover span {
    transform: scale(1.08);
}

@media (prefers-reduced-motion: no-preference) {
    @keyframes tracker-pulse {
        0%, 100% { box-shadow: 0 0 0 4px #F15A2426; }
        50% { box-shadow: 0 0 0 7px #F15A240F; }
    }

    html body .order-tracker li.current span {
        animation: tracker-pulse 2.2s ease-in-out infinite;
    }
}

@media (max-width: 700px) {
    html body .order-tracker li + li::before {
        width: 100%;
        margin: 0;
    }

    html body .order-tracker li {
        font-size: 10.5px;
    }
}

/* Tick placed from the circle's exact centre, so it cannot drift with the hidden number. */
html body .order-tracker li.done span::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 5px;
    margin: 0;
    box-sizing: border-box;
    transform: translate(-50%, -65%) rotate(-45deg);
}

/* The stage stepper sits in the middle of its panel. */
html body .order-tracker {
    margin: 10px auto 22px;
}


/* Production progress collapses to its heading; the current stage stays visible there. */
html body details.order-tracker-collapse {
    display: block;
}

html body details.order-tracker-collapse > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

html body details.order-tracker-collapse > summary::-webkit-details-marker {
    display: none;
}

html body details.order-tracker-collapse:not([open]) > summary {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.collapse-chevron {
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--soft);
    transition: background-color .18s ease, transform .2s ease;
}

.collapse-chevron::before {
    content: "";
    width: 7px;
    height: 7px;
    margin-top: -3px;
    border-right: 2px solid #4B5563;
    border-bottom: 2px solid #4B5563;
    transform: rotate(45deg);
}

details.order-tracker-collapse[open] .collapse-chevron {
    transform: rotate(180deg);
}

details.order-tracker-collapse > summary:hover .collapse-chevron {
    background: var(--orange-soft);
}

/* Heading text and arrow sit in the vertical middle of the production progress bar. */
html body details.order-tracker-collapse > summary.panel-heading {
    align-items: center;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

html body details.order-tracker-collapse[open] > summary.panel-heading {
    margin-bottom: 18px;
}

html body details.order-tracker-collapse > summary h2 {
    margin: 0;
    line-height: 1.25;
}

html body details.order-tracker-collapse > summary p {
    margin: 3px 0 0;
    line-height: 1.3;
}

html body details.order-tracker-collapse .collapse-chevron {
    align-self: center;
    margin: 0;
}

/* A little space above and below the production progress heading. */
html body details.order-tracker-collapse > summary.panel-heading {
    padding: 10px 0;
}


html body details.order-tracker-collapse > summary.panel-heading {
    padding: 10px;
}


/* The update history scrolls inside its own box, so a long history does not stretch the page. */
html body .order-tracker-log {
    max-height: 260px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 8px;
    scrollbar-width: thin;
    scrollbar-color: #D1D5DB transparent;
}

html body .order-tracker-log::-webkit-scrollbar {
    width: 6px;
}

html body .order-tracker-log::-webkit-scrollbar-thumb {
    border-radius: 6px;
    background: #D1D5DB;
}

/* "Production is complete" message: centred, with room around it. */
html body .order-tracker-covered {
    margin: 0 auto 18px;
    padding: 12px 16px;
    background: none;
    text-align: center;
}

/* Unit column on order and invoice item tables. */
html body .order-pdf-items th:nth-child(4),
html body .order-pdf-items td.order-pdf-unit {
    text-align: left;
}

html body .order-pdf-items th:nth-child(6) {
    text-align: right;
}


/* Appearance setting: two cards, each with a small preview of the theme. */
.theme-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 280px));
    gap: 14px;
}

html body .theme-choice {
    display: grid;
    gap: 6px;
    padding: 14px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: var(--paper);
    color: var(--dark-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

html body .theme-choice:hover {
    border-color: #FFB08F;
    box-shadow: 0 8px 20px #0F1A2B14;
    transform: translateY(-2px);
}

html body .theme-choice.is-active {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px #F15A2426;
}

.theme-choice strong {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.theme-choice strong small {
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--brand-primary);
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
}

.theme-choice > span:last-child {
    color: var(--muted);
    font-size: 12.5px;
}

.theme-swatch {
    display: grid;
    grid-template-columns: 28% 1fr;
    grid-template-rows: 14px 1fr;
    gap: 5px;
    height: 84px;
    margin-bottom: 4px;
    padding: 8px;
    border-radius: 9px;
}

.theme-swatch i {
    border-radius: 4px;
}

.theme-swatch i:first-child {
    grid-column: 1 / -1;
}

.theme-swatch i:last-child {
    box-shadow: inset 0 8px 0 -4px #F15A24;
}

/* Smaller theme buttons, centred across the page. */
html body .theme-choices {
    grid-template-columns: repeat(auto-fit, minmax(150px, 180px));
    justify-content: center;
    gap: 12px;
}

html body .theme-choice {
    gap: 4px;
    padding: 10px 12px;
    border-radius: 12px;
    text-align: center;
}

html body .theme-choice strong {
    justify-content: center;
    font-size: 13px;
}

html body .theme-choice > span:last-child {
    font-size: 11.5px;
}

html body .theme-swatch {
    grid-template-rows: 9px 1fr;
    gap: 4px;
    height: 50px;
    margin-bottom: 2px;
    padding: 6px;
}

/* Theme buttons stretch across the panel, with 10px left clear on each side. */
html body .theme-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 10px;
}

@media (max-width: 520px) {
    html body .theme-choices {
        grid-template-columns: 1fr;
    }
}

/* 10px clear below the theme buttons as well. */
html body .theme-choices {
    padding: 0 10px 10px;
}


/* 10px clear on every side of the theme buttons, including under the heading line. */
html body .theme-choices {
    padding: 10px;
}


/* Copyright and version line, centred at the bottom of every page. */
html body .app-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 32px;
    padding: 16px 10px 6px;
    color: #9AA3AF;
    font-size: 12px;
    text-align: center;
}

html body .setup-screen .app-footer {
    margin-top: 18px;
}

@media print {
    .app-footer {
        display: none;
    }
}

/* Sign-in page: keep the form centred and the footer directly beneath it. */
html body .setup-screen {
    align-content: center;
}


/* Floating light/dark switch, bottom right of every signed-in page. */
.theme-fab-form {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 70;
    margin: 0;
}

html body .theme-fab {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--paper);
    color: var(--brand-dark);
    box-shadow: 0 6px 18px #0F1A2B26;
    cursor: pointer;
    transition: transform .2s ease, box-shadow .2s ease, color .2s ease;
}

html body .theme-fab:hover {
    color: var(--brand-primary);
    box-shadow: 0 10px 26px #0F1A2B33;
    transform: translateY(-2px) rotate(-12deg);
}

@media (max-width: 600px) {
    .theme-fab-form {
        right: 14px;
        bottom: 14px;
    }
}

@media print {
    .theme-fab-form {
        display: none;
    }
}

/* Sign-in: forgot-password link sits under the password, on the right. */
html body .login-panel .forgot-password-link {
    justify-self: end;
    margin-top: -6px;
    font-size: 12.5px;
}

/* Users dialog: temporary password section. */
html body .user-password-reset {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

html body .user-password-reset h3 {
    margin: 0;
    color: var(--brand-dark);
    font-size: 15px;
}

html body .user-password-reset p {
    margin: 0;
    font-size: 12.5px;
}

html body .login-panel .forgot-password-link {
    align-self: flex-end;
}


/* Floating theme switch: a bold brand button that opens out to show its label on hover. */
html body .theme-fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: auto;
    min-width: 52px;
    height: 52px;
    padding: 0 15px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #FF8A5B, #F15A24);
    color: #fff;
    box-shadow: 0 10px 26px #F15A2459, 0 2px 6px #0F1A2B26;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    transition: box-shadow .2s ease, transform .2s ease, gap .2s ease;
}

html body .theme-fab-label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: max-width .25s ease, opacity .2s ease;
}

html body .theme-fab:hover,
html body .theme-fab:focus-visible {
    gap: 8px;
    color: #fff;
    box-shadow: 0 14px 32px #F15A2473, 0 2px 6px #0F1A2B26;
    transform: translateY(-2px);
}

html body .theme-fab:hover .theme-fab-label,
html body .theme-fab:focus-visible .theme-fab-label {
    max-width: 60px;
    opacity: 1;
}

html body .theme-fab svg {
    flex: 0 0 auto;
    transition: transform .35s ease;
}

html body .theme-fab:hover svg {
    transform: rotate(-20deg);
}


/* ---------- Story boat: sails along the bottom of every page ---------- */
.story-boat {
    position: fixed;
    bottom: 10px;
    left: 24px;
    z-index: 65;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 240px;
    text-decoration: none;
    cursor: pointer;
    animation: story-sail 46s ease-in-out infinite alternate;
}

.story-boat-bob {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: -10px;
    animation: story-bob 3.4s ease-in-out infinite;
    transform-origin: 50% 90%;
}

.story-boat-flag {
    position: relative;
    margin-bottom: -4px;
    margin-left: 40px;
    padding: 6px 12px;
    border-radius: 999px 999px 999px 4px;
    background: #fff;
    color: #0F1A2B;
    box-shadow: 0 6px 16px #0F1A2B26;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    animation: story-flag 2.6s ease-in-out infinite;
    transform-origin: 0 100%;
}

.story-boat-flag::after {
    content: "";
    position: absolute;
    bottom: -6px;
    left: 6px;
    border: 6px solid transparent;
    border-top-color: #fff;
    border-left-color: #fff;
}

.story-boat-ship {
    display: block;
    filter: drop-shadow(0 6px 8px #0F1A2B33);
    transition: transform .25s ease;
}

.story-boat-waves {
    width: 200px;
    animation: story-waves 2.4s linear infinite;
}

.story-boat:hover .story-boat-ship {
    transform: scale(1.06);
}

.story-boat:hover .story-boat-flag {
    background: #F15A24;
    color: #fff;
}

.story-boat:hover .story-boat-flag::after {
    border-top-color: #F15A24;
    border-left-color: #F15A24;
}

@keyframes story-sail {
    0% { left: 24px; }
    100% { left: calc(100% - 330px); }
}

@keyframes story-bob {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-6px) rotate(2deg); }
}

@keyframes story-flag {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

@keyframes story-waves {
    from { transform: translateX(0); }
    to { transform: translateX(-40px); }
}

body.story-open .story-boat,
body.story-open .theme-fab-form {
    display: none;
}

body.story-open {
    overflow: hidden;
}

/* ---------- Story stage: full-screen storytelling ---------- */
.story-stage {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 120%, #5A1F0B 0, transparent 55%), radial-gradient(ellipse at 15% -10%, #1F3B5C 0, transparent 50%), #0B1220;
    color: #F3F4F6;
    animation: story-fade-in .6s ease both;
}

.story-stage:target,
.story-stage.is-open {
    display: block;
}

@keyframes story-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.story-sky {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Embers rise like sparks from a fire. */
.story-ember {
    position: absolute;
    bottom: -20px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FF9A4D;
    box-shadow: 0 0 10px 3px #F15A2499;
    opacity: 0;
    animation: story-ember 9s ease-in infinite;
}

.story-ember:nth-child(1) { left: 5%; animation-delay: 0s; }
.story-ember:nth-child(2) { left: 12%; animation-delay: 2.4s; animation-duration: 11s; }
.story-ember:nth-child(3) { left: 19%; animation-delay: 5s; width: 4px; height: 4px; }
.story-ember:nth-child(4) { left: 27%; animation-delay: 1.2s; animation-duration: 12s; }
.story-ember:nth-child(5) { left: 34%; animation-delay: 6.5s; width: 5px; height: 5px; }
.story-ember:nth-child(6) { left: 41%; animation-delay: 3.3s; animation-duration: 10s; }
.story-ember:nth-child(7) { left: 49%; animation-delay: 7.8s; width: 4px; height: 4px; }
.story-ember:nth-child(8) { left: 56%; animation-delay: .6s; animation-duration: 13s; }
.story-ember:nth-child(9) { left: 63%; animation-delay: 4.2s; }
.story-ember:nth-child(10) { left: 70%; animation-delay: 8.6s; animation-duration: 11s; width: 5px; height: 5px; }
.story-ember:nth-child(11) { left: 76%; animation-delay: 2s; }
.story-ember:nth-child(12) { left: 82%; animation-delay: 5.7s; animation-duration: 12s; width: 4px; height: 4px; }
.story-ember:nth-child(13) { left: 88%; animation-delay: 1.7s; }
.story-ember:nth-child(14) { left: 93%; animation-delay: 7s; animation-duration: 10s; }
.story-ember:nth-child(15) { left: 23%; animation-delay: 9.5s; animation-duration: 14s; width: 3px; height: 3px; }
.story-ember:nth-child(16) { left: 67%; animation-delay: 10.5s; animation-duration: 14s; width: 3px; height: 3px; }

@keyframes story-ember {
    0% { opacity: 0; transform: translate(0, 0) scale(1); }
    10% { opacity: 1; }
    50% { transform: translate(18px, -50vh) scale(.8); }
    85% { opacity: .7; }
    100% { opacity: 0; transform: translate(-12px, -105vh) scale(.3); }
}

/* Building blocks drift slowly across the sky, like the logo's bricks. */
.story-brick {
    position: absolute;
    top: 110%;
    width: 46px;
    height: 20px;
    border-radius: 4px;
    background: #F15A24;
    opacity: .14;
    animation: story-brick 30s linear infinite;
}

.story-brick:nth-of-type(even) {
    width: 70px;
    background: #4A6A8F;
}

.story-brick:nth-of-type(17) { left: 6%; animation-delay: 0s; }
.story-brick:nth-of-type(18) { left: 18%; animation-delay: -8s; animation-duration: 36s; }
.story-brick:nth-of-type(19) { left: 30%; animation-delay: -16s; }
.story-brick:nth-of-type(20) { left: 74%; animation-delay: -4s; animation-duration: 34s; }
.story-brick:nth-of-type(21) { left: 86%; animation-delay: -12s; }
.story-brick:nth-of-type(22) { left: 62%; animation-delay: -22s; animation-duration: 40s; }
.story-brick:nth-of-type(23) { left: 92%; animation-delay: -26s; }
.story-brick:nth-of-type(24) { left: 12%; animation-delay: -20s; animation-duration: 38s; }
.story-brick:nth-of-type(25) { left: 44%; animation-delay: -30s; animation-duration: 42s; }

@keyframes story-brick {
    from { transform: translateY(0) rotate(0deg); }
    to { transform: translateY(-130vh) rotate(160deg); }
}

.story-close {
    position: absolute;
    top: 20px;
    right: 24px;
    z-index: 3;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid #FFFFFF33;
    border-radius: 50%;
    background: #FFFFFF14;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    text-decoration: none;
    transition: background-color .2s ease, transform .2s ease;
}

.story-close:hover {
    background: #F15A24;
    transform: rotate(90deg);
}

/* The words rise slowly through a window that fades out at the top and bottom. */
.story-viewport {
    position: absolute;
    inset: 0;
    z-index: 2;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(transparent 0, #000 18%, #000 80%, transparent 100%);
    mask-image: linear-gradient(transparent 0, #000 18%, #000 80%, transparent 100%);
}

.story-roll {
    width: min(680px, calc(100% - 48px));
    margin: 0 auto;
    text-align: center;
    animation: story-roll var(--story-duration, 90s) linear forwards;
}

.story-stage.is-paused .story-roll {
    animation-play-state: paused;
}

@keyframes story-roll {
    from { transform: translateY(100vh); }
    to { transform: translateY(calc(-100% + 55vh)); }
}

.story-logo {
    width: 170px;
    margin: 0 auto 26px;
    padding: 10px 14px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 0 40px #F15A2466;
}

.story-kicker {
    margin: 0 0 10px;
    color: #FF9A6E;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .28em;
    text-transform: uppercase;
}

.story-roll h2 {
    margin: 0 0 30px;
    color: #fff;
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.15;
}

.story-text {
    margin: 0 0 26px;
    color: #E5E7EB;
    font-size: clamp(17px, 2.2vw, 21px);
    line-height: 1.75;
}

.story-statement {
    margin: 0;
    color: #fff;
    font-size: clamp(19px, 2.6vw, 25px);
    font-style: italic;
    line-height: 1.6;
}

.story-divider {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 54px auto;
}

.story-divider i {
    width: 26px;
    height: 10px;
    border-radius: 2px;
    background: #F15A24;
}

.story-divider i:nth-child(2) {
    width: 14px;
    background: #4A6A8F;
}

.story-values {
    display: grid;
    gap: 14px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}

.story-values li {
    display: grid;
    gap: 4px;
    padding: 16px 20px;
    border: 1px solid #FFFFFF1F;
    border-radius: 14px;
    background: #FFFFFF0D;
}

.story-values strong {
    color: #FF9A6E;
    font-size: 19px;
}

.story-values span {
    color: #E5E7EB;
    font-size: 16px;
    line-height: 1.55;
}

.story-motto {
    margin: 70px 0 0;
    color: #F15A24;
    font-size: clamp(26px, 4vw, 38px);
    font-style: italic;
    font-weight: 800;
    text-shadow: 0 0 30px #F15A2480;
}

.story-controls {
    position: absolute;
    bottom: 22px;
    left: 50%;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 14px;
    transform: translateX(-50%);
    color: #9CA3AF;
    font-size: 12px;
}

.story-controls button {
    padding: 8px 18px;
    border: 1px solid #FFFFFF33;
    border-radius: 999px;
    background: #FFFFFF14;
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s ease;
}

.story-controls button:hover {
    background: #F15A24;
}

@media (max-width: 700px) {
    .story-boat {
        left: 8px;
        transform: scale(.8);
        transform-origin: bottom left;
        animation-duration: 30s;
    }

    @keyframes story-sail {
        0% { left: 8px; }
        100% { left: calc(100% - 270px); }
    }
}

/* Without motion: the boat stays put and the story can simply be scrolled. */
@media (prefers-reduced-motion: reduce) {
    .story-boat,
    .story-boat-bob,
    .story-boat-flag,
    .story-boat-waves,
    .story-ember,
    .story-brick {
        animation: none;
    }

    .story-ember {
        display: none;
    }

    .story-viewport {
        overflow-y: auto;
        padding: 90px 0;
    }

    .story-roll {
        animation: none;
    }
}

@media print {
    .story-boat,
    .story-stage {
        display: none !important;
    }
}

/* Story close button: the cross is drawn from two bars placed at the exact centre of the circle,
   so it cannot drift the way a text glyph does with font metrics. */
.story-close {
    position: absolute;
    font-size: 0;
}

.story-close span {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
}

.story-close span::before,
.story-close span::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    margin: -1px 0 0 -9px;
    border-radius: 2px;
    background: #fff;
}

.story-close span::before {
    transform: rotate(45deg);
}

.story-close span::after {
    transform: rotate(-45deg);
}

/* Theme switch in the header, just left of the notification bell. */
html body .topbar .theme-header-form {
    margin: 0 0 0 auto;
}

html body .topbar .theme-header-form + .notification-menu {
    margin-left: -46px;
}

html body .theme-header-toggle {
    position: relative;
    display: block;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #4B5563;
    font-size: 0;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease;
}

/* The icon is placed from the circle's exact centre. */
html body .theme-header-toggle svg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    transition: transform .35s ease;
}

html body .theme-header-toggle:hover {
    background: var(--soft);
    color: var(--brand-primary);
}

html body .theme-header-toggle:hover svg {
    transform: translate(-50%, -50%) rotate(-20deg);
}

@media (max-width: 760px) {
    html body .topbar .theme-header-form + .notification-menu {
        margin-left: 0;
    }
}

/* Invoice edit pop-up: the same two-column registry layout as the new-record forms. */
html body .entry-form.invoice-edit-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
}

html body .entry-form.invoice-edit-form .wide {
    grid-column: 1 / -1;
}

html body .entry-form.mail-compose-form {
    padding: 10px;
}

html body .mail-folders {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
}

html body .mail-folder {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

html body .mail-folder:hover,
html body .mail-folder-active {
    background: var(--orange-soft);
    color: var(--brand-dark);
}

html body .mail-folder-active {
    font-weight: 700;
}

html body .mail-folder-has-unread small {
    background: var(--brand-primary);
    color: #fff;
}

html body .mail-detail-heading-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

html body .mail-folder small {
    display: grid;
    min-width: 22px;
    height: 22px;
    place-items: center;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-size: 10px;
}

html body .mail-message-list {
    display: grid;
}

html body .mail-bulk-toolbar {
    display: flex;
    min-height: 54px;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
}

html body .mail-select-all {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
}

html body .mail-select-all input,
html body .mail-message-select input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--brand-primary);
}

html body .mail-bulk-toolbar select {
    min-height: 34px;
    padding: 6px 28px 6px 9px;
    border: 1px solid var(--soft-border);
    border-radius: var(--radius-small);
    background: var(--paper);
    color: var(--dark-text);
    font-size: 11px;
}

html body .mail-message-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    color: var(--dark-text);
}

html body .mail-message-row:last-child {
    border-bottom: 0;
}

html body .mail-message-row:hover {
    background: var(--soft);
}

html body .mail-message-select {
    display: grid;
    place-items: center;
    cursor: pointer;
}

html body .mail-message-link {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    color: var(--dark-text);
}

html body .mail-message-main,
html body .mail-message-meta {
    display: grid;
    min-width: 0;
    gap: 4px;
}

html body .mail-message-main strong {
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html body .mail-message-main span,
html body .mail-message-meta small {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html body .mail-read-receipt {
    color: var(--brand-dark);
    font-weight: 700;
}

html body .mail-message-unread .mail-message-main strong,
html body .mail-message-unread .mail-message-main span {
    color: var(--brand-dark);
    font-weight: 700;
}

html body .mail-message-meta time {
    justify-self: end;
    color: var(--muted);
    font-size: 10px;
}

html body .mail-empty {
    margin: 0;
    padding: 28px 18px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

html body .mail-detail-panel,
html body .mail-compose-panel {
    margin-top: 14px;
}

html body .mail-message-addresses {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}

html body .mail-message-addresses div {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
}

html body .mail-message-addresses dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

html body .mail-message-addresses dd {
    margin: 0;
    color: var(--dark-text);
    font-size: 12px;
    overflow-wrap: anywhere;
}

html body .mail-message-body {
    min-height: 100px;
    padding: 20px;
    color: var(--dark-text);
    font-size: 13px;
    overflow-wrap: anywhere;
}

html body .mail-message-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
}

html body .mail-message-actions form {
    margin: 0;
}

html body .mail-recipient-picker {
    position: relative;
    min-width: 0;
}

html body .mail-recipient-fields {
    display: grid;
    gap: 8px;
}

html body .mail-recipient-field {
    display: grid;
    min-width: 0;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
}

html body .mail-recipient-kind {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

html body .mail-recipient-picker > summary {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid var(--soft-border);
    border-radius: var(--radius-small);
    background: var(--paper);
    color: var(--dark-text);
    cursor: pointer;
    list-style: none;
}

html body .mail-recipient-picker > summary::-webkit-details-marker {
    display: none;
}

html body .mail-recipient-picker > summary span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html body .mail-recipient-picker > summary::after {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    content: "";
    transform: rotate(45deg) translateY(-2px);
}

html body .mail-recipient-picker[open] > summary {
    border-color: var(--brand-primary);
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 0;
}

html body .mail-recipient-picker[open] > summary::after {
    transform: rotate(225deg) translate(-2px, -1px);
}

html body .mail-recipient-options {
    display: grid;
    max-height: 190px;
    gap: 2px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--brand-primary);
    border-top: 0;
    border-radius: 0 0 var(--radius-small) var(--radius-small);
    background: var(--paper);
}

html body .mail-recipient-options label {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    padding: 8px 9px;
    border-radius: 6px;
    cursor: pointer;
}

html body .mail-recipient-options label:hover {
    background: var(--soft);
}

html body .mail-recipient-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
    accent-color: var(--brand-primary);
}

html body .mail-recipient-options label span {
    min-width: 0;
    overflow-wrap: anywhere;
}

html body .material-dialog.mail-compose-dialog {
    width: min(720px, 100%);
}

html body .mail-compose-form textarea {
    min-height: 220px;
    resize: vertical;
}

html body .mail-compose-form .material-dialog-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

html body .mail-topbar {
    display: flex;
    min-width: 0;
    margin: 0 0 14px;
}

html body .mail-search-form {
    display: flex;
    width: min(100%, 820px);
    min-width: 0;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
    transition: border-color .15s ease, box-shadow .15s ease;
}

html body .mail-search-form:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 14%, transparent);
}

html body .mail-search-form input[type="search"] {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 38px;
    padding: 7px 4px;
    border: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: var(--dark-text);
    font: inherit;
}

html body .mail-search-form input[type="search"]:focus {
    border: 0;
    outline: 0;
    box-shadow: none;
}

html body .mail-search-clear {
    flex: 0 0 auto;
    padding: 0 8px;
    color: var(--muted);
    font-size: 12px;
}

html body .mail-workspace {
    display: grid;
    min-width: 0;
    grid-template-columns: minmax(168px, .45fr) minmax(330px, .95fr) minmax(400px, 1.6fr);
    height: min(78vh, 900px);
    min-height: 520px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--paper);
    box-shadow: var(--shadow-card);
}

html body .mail-sidebar {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 14px;
    padding: 18px 12px;
    border-right: 1px solid var(--line);
}

html body .mail-compose-button {
    min-height: 48px;
    justify-content: flex-start;
    padding: 0 18px;
}

html body .mail-folders {
    display: grid;
    flex-wrap: initial;
    gap: 3px;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
}

html[data-theme="dark"] body .mail-sidebar .mail-folders {
    border: 0;
    background: transparent;
}

html[data-theme="dark"] body .mail-search-form {
    background: #141B24;
}

html[data-theme="dark"] body .mail-search-form input[type="search"] {
    background: transparent;
}

html body .mail-folder {
    display: flex;
    width: 100%;
    min-height: 42px;
    justify-content: flex-start;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--dark-text);
}

html body .mail-folder-active {
    background: var(--orange-soft);
    color: var(--brand-dark);
}

html body .mail-folder small {
    margin-left: auto;
}

html body .mail-workspace > .mail-list-panel,
html body .mail-workspace > .mail-detail-panel,
html body .mail-workspace > .mail-reader-empty {
    min-width: 0;
    min-height: 0;
    margin: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

html body .mail-workspace > .mail-list-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
}

html body .mail-list-heading {
    flex: 0 0 auto;
    min-height: 72px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--line);
}

html body .mail-list-heading h1 {
    margin: 0 0 4px;
    color: var(--brand-dark);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

html body .mail-list-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

html body .mail-bulk-form {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
}

html body .mail-bulk-toolbar {
    flex: 0 0 auto;
    min-height: 48px;
    gap: 7px;
    padding: 7px 12px;
}

html body .mail-bulk-toolbar select {
    max-width: 155px;
}

html body .mail-message-list {
    min-height: 0;
    flex: 1 1 auto;
    align-content: start;
    overflow-y: auto;
}

html body .mail-message-row {
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    padding: 0;
}

html body .mail-message-select {
    padding-left: 12px;
}

html body .mail-message-link {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto auto;
    align-content: center;
    gap: 3px 8px;
    padding: 12px 14px 12px 0;
}

html body .mail-message-link.mail-message-selected {
    background: var(--orange-soft);
}

html body .mail-message-main,
html body .mail-message-meta {
    display: contents;
}

html body .mail-message-main strong {
    grid-column: 1;
    grid-row: 1;
    color: var(--dark-text);
}

html body .mail-message-main span {
    grid-column: 1 / -1;
    grid-row: 2;
    color: var(--dark-text);
    font-weight: 600;
}

html body .mail-message-meta time {
    grid-column: 2;
    grid-row: 1;
}

html body .mail-message-meta small:not(.mail-read-receipt) {
    grid-column: 1 / -1;
    grid-row: 3;
    white-space: normal;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

html body .mail-message-meta .mail-read-receipt {
    grid-column: 1 / -1;
    grid-row: 4;
}

html body .mail-message-unread .mail-message-main strong,
html body .mail-message-unread .mail-message-main span {
    color: var(--brand-dark);
}

html body .mail-workspace > .mail-detail-panel {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

html body .mail-reader-back {
    display: none;
}

html body .mail-detail-panel .panel-heading {
    align-items: flex-start;
    flex-wrap: wrap;
}

html body .mail-detail-heading-actions,
html body .mail-detail-heading-actions time {
    flex: 0 0 auto;
    white-space: nowrap;
}

html body .mail-detail-panel .mail-message-body {
    flex: 1 0 auto;
    padding: 24px;
    font-size: 14px;
    line-height: 1.7;
}

html body .mail-reader-empty {
    display: grid;
    align-content: center;
    justify-items: center;
    padding: 32px;
    text-align: center;
}

html body .mail-reader-empty h2 {
    margin: 8px 0;
    color: var(--brand-dark);
    font-size: 18px;
}

html body .mail-reader-empty p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1050px) {
    html body .mail-workspace {
        grid-template-columns: minmax(150px, .45fr) minmax(270px, .95fr) minmax(300px, 1.2fr);
    }
}

@media (max-width: 820px) {
    html body .mail-workspace {
        height: auto;
        min-height: 0;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    }

    html body .mail-sidebar {
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    html body .mail-compose-button {
        width: auto;
        flex: 0 0 auto;
        margin: 0;
    }

    html body .mail-folders {
        display: flex;
        flex: 1 1 auto;
        flex-wrap: wrap;
    }

    html body .mail-folder {
        width: auto;
    }

    html body .mail-workspace > .mail-list-panel,
    html body .mail-workspace > .mail-detail-panel,
    html body .mail-workspace > .mail-reader-empty {
        min-height: 520px;
    }
}

@media (max-width: 600px) {
    html body .mail-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    html body .mail-topbar-message-open {
        display: none;
    }

    html body .mail-workspace.mail-message-open {
        min-height: calc(100vh - 170px);
        grid-template-columns: minmax(0, 1fr);
    }

    html body .mail-workspace.mail-message-open > .mail-sidebar,
    html body .mail-workspace.mail-message-open > .mail-list-panel {
        display: none;
    }

    html body .mail-workspace.mail-message-open > .mail-detail-panel {
        min-height: calc(100vh - 170px);
    }

    html body .mail-reader-back {
        display: flex;
        min-height: 48px;
        align-items: center;
        padding: 0 16px;
        border-bottom: 1px solid var(--line);
        color: var(--brand-primary);
        font-size: 13px;
        font-weight: 700;
    }

    html body .mail-sidebar {
        display: block;
        padding: 12px;
    }

    html body .mail-compose-button {
        margin: 0 0 10px;
    }

    html body .mail-folders {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    html body .mail-folder {
        flex: 0 0 auto;
    }

    html body .mail-workspace > .mail-list-panel {
        min-height: 420px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    html body .mail-workspace > .mail-detail-panel,
    html body .mail-workspace > .mail-reader-empty {
        min-height: 360px;
    }
}

@media (max-width: 700px) {
    html body .mail-folders {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    html body .mail-folder {
        flex: 0 0 auto;
    }

    html body .mail-message-row {
        grid-template-columns: 30px minmax(0, 1fr);
        gap: 8px;
        padding: 0;
    }

    html body .mail-message-link {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 3px 8px;
    }

    html body .mail-bulk-toolbar select {
        flex: 1 1 130px;
    }

    html body .mail-message-meta time {
        justify-self: end;
    }

    html body .mail-message-addresses,
    html body .mail-message-body {
        padding: 14px;
    }
}

html body .invoice-edit-form input:disabled {
    background: var(--soft);
    color: var(--muted);
    cursor: not-allowed;
}

.invoice-edit-label {
    margin: 0 0 8px;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
}

html body .invoice-edit-items table {
    width: 100%;
    border-collapse: collapse;
}

html body .invoice-edit-items th {
    padding: 9px 10px;
    background: var(--soft);
    color: var(--muted);
    font-size: 11.5px;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: .04em;
}

html body .invoice-edit-items td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

html body .invoice-edit-items td input {
    width: 100%;
    min-width: 90px;
}

html body .invoice-edit-items small {
    display: block;
    margin-top: 6px;
}

@media (max-width: 700px) {
    html body .entry-form.invoice-edit-form {
        grid-template-columns: 1fr;
    }
}

/* Register payment: the invoice-or-credit choice. */
html body .payment-apply-choice {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
}

html body .payment-apply-choice legend {
    padding: 0 6px;
    color: var(--brand-dark);
    font-size: 13px;
    font-weight: 700;
}

html body .payment-apply-choice label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

html body .entry-form [hidden] {
    display: none !important;
}

html body .payment-tabs {
    margin-bottom: 4px;
}

/* Payment requests */
html body .status.info {
    background: #E6F0FB;
    color: #1D4E89;
}

.request-status-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.request-status-filter a {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

.request-status-filter a:hover {
    border-color: #FFC9B0;
    color: var(--brand-dark);
}

.request-status-filter a[aria-current="page"] {
    border-color: var(--brand-primary);
    background: var(--orange-soft);
    color: #B93E12;
}

html body .request-history {
    max-height: 200px;
    margin: 16px 0 0;
}

html body .request-action-form {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

html body .material-dialog-heading h2 .status {
    margin-left: 8px;
    vertical-align: middle;
}

/* Activity timeline: line and circles share one centre point, so every circle sits on the line. */
html body .customer-timeline li::before {
    left: 164px;
    width: 2px;
    transform: translateX(-50%);
}

html body .customer-timeline li::after {
    left: 164px;
    box-sizing: border-box;
    width: 14px;
    height: 14px;
    transform: translateX(-50%);
}

@media (max-width: 600px) {
    html body .customer-timeline li::before,
    html body .customer-timeline li::after {
        left: 7px;
    }
}

/* Production authorization on out-of-stock orders: three steps. */
html body .order-production-authorization .order-tracker {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 480px;
}

.order-authorization-note {
    margin: 0 0 14px;
    color: #4B5563;
    font-size: 13px;
    text-align: center;
}

.order-authorization-form {
    display: flex;
    justify-content: center;
    margin: 0;
}

/* Deliveries */
.delivery-status-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px 12px;
    margin: 0;
}

.delivery-status-form label {
    display: grid;
    gap: 5px;
    flex: 1 1 200px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

.delivery-status-form input {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid var(--soft-border);
    border-radius: var(--radius-small);
    background: var(--paper);
    color: var(--dark-text);
    font: inherit;
}

html body .delivery-update-panel {
    margin-bottom: 20px;
    padding: 10px;
}

.delivery-update-forms {
    display: grid;
    gap: 16px;
}

.delivery-update-forms .delivery-status-form + .delivery-status-form {
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

html body .delivery-items th:nth-child(3) {
    text-align: left;
}

html body .delivery-items th:nth-child(4) {
    text-align: right;
}

.delivery-signatures {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px;
    margin: 48px 0 10px;
}

.delivery-signatures div {
    display: grid;
    gap: 4px;
}

.delivery-signatures span {
    color: #6B7280;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.delivery-signatures strong {
    min-height: 34px;
    padding-top: 10px;
    border-bottom: 1.5px solid #1F2937;
    font-size: 14px;
}

.delivery-signatures i {
    color: #9AA3AF;
    font-size: 11.5px;
}

.delivery-received-note {
    margin: 0;
    color: #6B7280;
    font-size: 12.5px;
    font-style: italic;
}

@media (max-width: 600px) {
    .delivery-signatures {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

@media print {
    .delivery-update-panel {
        display: none;
    }
}

/* Delivery readiness while an order is still in production. */
html body .delivery-readiness {
    margin: 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #E8F7EE;
    color: #17663A;
    font-size: 13px;
}

html body .delivery-readiness.is-blocked {
    background: #FDECEA;
    color: #9B2C1F;
}


/* Delivery progress on order and invoice pages. */
html body .delivery-summary-panel {
    margin-bottom: 20px;
}

html body .delivery-summary-panel h2 .status {
    margin-left: 8px;
    vertical-align: middle;
}

@media print {
    .delivery-summary-panel {
        display: none;
    }
}


/* Delivery page: stock, notes and proof side by side. */
.delivery-side-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

html body .delivery-side-grid .panel {
    margin: 0;
}

html body .delivery-notes-panel .delivery-status-form,
html body .delivery-proof-panel .delivery-status-form {
    margin-bottom: 14px;
    padding: 10px;
}

.delivery-status-form input[type="file"] {
    padding: 8px 10px;
    height: auto;
}

.delivery-proof-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.delivery-proof-list li {
    display: grid;
    gap: 4px;
    font-size: 12px;
}

.delivery-proof-list a {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
    transition: transform .18s ease, box-shadow .18s ease;
}

.delivery-proof-list a:hover {
    box-shadow: 0 8px 20px #0F1A2B1F;
    transform: translateY(-2px);
}

.delivery-proof-list img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.delivery-proof-pdf {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    color: #B93E12;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .08em;
}

.delivery-proof-list small {
    color: var(--muted);
    font-size: 11px;
}

html body .delivery-items.has-returns th:nth-child(n+4) {
    text-align: right;
}

html body .vehicle-report-panel {
    margin-bottom: 20px;
}

@media print {
    .delivery-side-grid {
        display: none;
    }
}

/* Vehicle registry: the "In service" tick box sits on one line. */
html body .entry-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: end;
    min-height: 42px;
    font-weight: 600;
}

html body .entry-form .checkbox-label input {
    width: 18px;
    height: 18px;
    min-height: 0;
    accent-color: var(--brand-primary);
}


/* Reports: the report-type tabs sit above the date filter. */
html body .report-type-tabs {
    margin-bottom: 14px;
}

@media print {
    .report-type-tabs {
        display: none;
    }
}


/* Report chooser: a proper drop-down that matches the date boxes, with its own arrow. */
html body .report-filter-form select {
    height: 40px;
    min-width: 220px;
    padding: 0 40px 0 14px;
    border: 1px solid var(--soft-border);
    border-radius: var(--radius-small);
    background-color: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%23F15A24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    color: var(--brand-dark);
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 1px 2px #0F1A2B0A;
    transition: border-color .15s ease, box-shadow .15s ease;
}

html body .report-filter-form select:hover {
    border-color: #FFB08F;
    box-shadow: 0 4px 12px #0F1A2B12;
}

html body .report-filter-form select:focus {
    border-color: var(--brand-primary);
    outline: 0;
    box-shadow: var(--focus-ring);
}

html body .report-filter-form {
    gap: 12px 14px;
    padding: 16px 18px;
    border-radius: var(--radius);
}

/* "Clear dates": a quiet outlined button, the same height as the Run report button beside it. */
html body .report-filter-form .inline-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--soft-border);
    border-radius: var(--radius-small);
    background: #fff;
    color: var(--dark-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

html body .report-filter-form .inline-link:hover {
    border-color: #FFB08F;
    background: var(--orange-soft);
    color: #B93E12;
    text-decoration: none;
    box-shadow: 0 4px 12px #0F1A2B12;
}

html body .report-filter-form .inline-link:focus-visible {
    border-color: var(--brand-primary);
    outline: 0;
    box-shadow: var(--focus-ring);
}

/* Revenue page: profit card and the two finance tables side by side. */
html body .metric.finance-profit strong {
    color: #17803D;
}

html body .metric.finance-profit.is-loss strong {
    color: #C0392B;
}

html body .metric.finance-profit::before {
    background: linear-gradient(90deg, #17803D, #4CAF73);
}

html body .metric.finance-profit.is-loss::before {
    background: linear-gradient(90deg, #C0392B, #E57368);
}

.finance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

html body .finance-grid .panel {
    margin: 0;
}

html body .finance-total-row td {
    border-top: 2px solid var(--line);
    background: var(--soft);
}


/* Revenue page: the cost, account and invoice tables scroll inside their own boxes, with the headings kept in view. */
html body .finance-grid .table-scroll,
html body .revenue-records .table-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #D1D5DB transparent;
}

html body .finance-grid .table-scroll {
    max-height: 260px;
}

html body .revenue-records .table-scroll {
    max-height: 420px;
}

html body .finance-grid .table-scroll thead th,
html body .revenue-records .table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--paper);
    box-shadow: 0 1px 0 var(--line);
}

html body .finance-grid .table-scroll::-webkit-scrollbar,
html body .revenue-records .table-scroll::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

html body .finance-grid .table-scroll::-webkit-scrollbar-thumb,
html body .revenue-records .table-scroll::-webkit-scrollbar-thumb {
    border-radius: 6px;
    background: #D1D5DB;
}


/* Sign out: words on wide screens; on phones a round icon button the same size as the bell and theme switch. */
html body .account-form .text-button .signout-icon {
    display: none;
}

@media (max-width: 700px) {
    html body .account-form .text-button {
        position: relative;
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        font-size: 0;
    }

    html body .account-form .text-button .signout-label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    /* The icon is placed from the circle's exact centre. */
    html body .account-form .text-button .signout-icon {
        position: absolute;
        top: 50%;
        left: 50%;
        display: block;
        width: 18px;
        height: 18px;
        transform: translate(-50%, -50%);
    }

    html body .account-form .text-button:active {
        background: var(--orange-soft);
        border-color: var(--brand-primary);
        color: var(--brand-hover);
    }

    html body .topbar .notification-menu + .account-form,
    html body .topbar .theme-header-form + .notification-menu {
        margin-left: 0;
    }

    html body .account-form {
        gap: 8px;
    }
}


/* Product form: pay rules for production, curing and arrangement. */
html body .product-pay-rules {
    display: grid;
    gap: 12px;
    margin: 4px 0 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

html body .product-pay-rules legend {
    padding: 0 8px;
    color: var(--brand-dark);
    font-size: 13.5px;
    font-weight: 700;
}

.product-pay-rules-note {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
}

.product-pay-rule {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr);
    align-items: end;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.product-pay-rule > strong {
    align-self: center;
    color: #B93E12;
    font-size: 13px;
}

@media (max-width: 600px) {
    .product-pay-rule {
        grid-template-columns: 1fr;
    }
}


.product-spec {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.35;
}


/* Jump-to-top button: appears at the bottom right once the page has been scrolled. */
html body .jump-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 66;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF8A5B, #F15A24);
    color: #fff;
    box-shadow: 0 10px 26px #F15A2459, 0 2px 6px #0F1A2B26;
    font-size: 0;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease, box-shadow .2s ease;
}

html body .jump-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: none;
}

html body .jump-top:hover,
html body .jump-top:focus-visible {
    box-shadow: 0 14px 32px #F15A2473, 0 2px 6px #0F1A2B26;
    transform: translateY(-3px);
}

/* The arrow is placed from the circle's exact centre. */
html body .jump-top svg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
}

body.story-open .jump-top {
    display: none;
}

@media (max-width: 600px) {
    html body .jump-top {
        right: 14px;
        bottom: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html body .jump-top {
        transition: none;
    }
}

@media print {
    .jump-top {
        display: none;
    }
}


/* Jump-to-top button: small, and centred along the bottom of the screen. */
html body .jump-top {
    right: auto;
    left: 50%;
    bottom: 18px;
    width: 34px;
    height: 34px;
    box-shadow: 0 6px 16px #F15A244D, 0 1px 4px #0F1A2B26;
    transform: translate(-50%, 10px);
}

html body .jump-top.is-visible {
    transform: translate(-50%, 0);
}

html body .jump-top:hover,
html body .jump-top:focus-visible {
    box-shadow: 0 10px 22px #F15A2466, 0 1px 4px #0F1A2B26;
    transform: translate(-50%, -3px);
}

html body .jump-top svg {
    width: 15px;
    height: 15px;
}

@media (max-width: 600px) {
    html body .jump-top {
        right: auto;
        bottom: 12px;
    }
}


/* Customer portal */
.portal-line {
    display: block;
    line-height: 1.5;
}

.portal-confirm-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.portal-confirm-form input {
    flex: 1 1 140px;
    min-width: 0;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--soft-border);
    border-radius: 9px;
    background: var(--paper);
    color: var(--dark-text);
    font: inherit;
    font-size: 12.5px;
}

html body .invoice-edit-items td select {
    width: 100%;
    min-height: 40px;
}


/* Notification pop-up: "Clear all" sits at the right of the heading. */
html body .notification-popup-heading {
    justify-content: flex-start;
    gap: 8px;
}

html body .notification-popup-heading form {
    margin: 0 0 0 auto;
}

html body .notification-popup-heading button {
    min-height: 0;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: none;
    box-shadow: none;
    color: var(--muted);
    font: inherit;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.4;
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}

html body .notification-popup-heading button:hover,
html body .notification-popup-heading button:focus-visible {
    border-color: var(--brand-primary);
    background: var(--orange-soft);
    color: var(--brand-primary);
    transform: none;
}


/* Customer order form: running total and what it covers. */
html body .portal-order-total {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 6px 16px;
    padding: 14px 16px;
    border: 1px solid var(--soft-border);
    border-left: 4px solid var(--brand-primary);
    border-radius: 12px;
    background: var(--orange-soft);
}

html body .portal-order-total span {
    color: var(--dark-text);
    font-size: 13.5px;
    font-weight: 700;
}

html body .portal-order-total strong {
    color: var(--brand-primary);
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

html body .portal-order-total p {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}


/* Mail compose: recipients as a search box with chips. */
html body .mail-recipient-field {
    align-items: start;
}

html body .mail-recipient-kind {
    padding-top: 13px;
}

html body .mail-recipient-combo {
    position: relative;
    min-width: 0;
}

html body .mail-chip-box {
    display: flex;
    min-height: 44px;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid var(--soft-border);
    border-radius: 12px;
    background: var(--paper);
    cursor: text;
    transition: border-color .15s ease, box-shadow .15s ease;
}

html body .mail-chip-box:focus-within {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px #F15A2426;
}

html body .mail-chip-box .mail-chip-input {
    width: auto;
    min-width: 140px;
    min-height: 30px;
    flex: 1 1 140px;
    padding: 0 4px;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--dark-text);
    font: inherit;
    font-size: 13.5px;
    outline: none;
}

html body .mail-chip {
    display: inline-flex;
    max-width: 100%;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 3px;
    border-radius: 999px;
    background: var(--orange-soft);
    color: var(--dark-text);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
}

html body .mail-chip > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html body .mail-option-avatar {
    display: inline-flex;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--brand-primary);
    color: #fff;
    font-size: 11.5px;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
}

html body .mail-chip .mail-chip-remove {
    position: relative;
    width: 18px;
    height: 18px;
    min-height: 0;
    flex: 0 0 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #0F1A2B1F;
    box-shadow: none;
    cursor: pointer;
    transition: background-color .15s ease;
}

html body .mail-chip .mail-chip-remove::before,
html body .mail-chip .mail-chip-remove::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 1.5px;
    border-radius: 1px;
    background: var(--dark-text);
    content: "";
}

html body .mail-chip .mail-chip-remove::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

html body .mail-chip .mail-chip-remove::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

html body .mail-chip .mail-chip-remove:hover,
html body .mail-chip .mail-chip-remove:focus-visible {
    background: var(--brand-primary);
    transform: none;
}

html body .mail-chip .mail-chip-remove:hover::before,
html body .mail-chip .mail-chip-remove:hover::after,
html body .mail-chip .mail-chip-remove:focus-visible::before,
html body .mail-chip .mail-chip-remove:focus-visible::after {
    background: #fff;
}

html body .mail-recipient-picker.is-enhanced > summary {
    display: none;
}

html body .mail-recipient-picker.is-enhanced .mail-recipient-options {
    max-height: 220px;
    margin-top: 6px;
    border: 1px solid var(--soft-border);
    border-radius: 12px;
    box-shadow: 0 12px 28px #0F1A2B24;
}

html body .mail-recipient-picker.is-enhanced .mail-recipient-options label {
    position: relative;
    padding: 7px 34px 7px 8px;
    border-radius: 9px;
    font-size: 13.5px;
}

html body .mail-recipient-picker.is-enhanced .mail-recipient-options label.is-hidden {
    display: none;
}

html body .mail-recipient-picker.is-enhanced .mail-recipient-options input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

html body .mail-recipient-picker.is-enhanced .mail-recipient-options label:focus-within {
    background: var(--soft);
    outline: 2px solid var(--brand-primary);
    outline-offset: -2px;
}

html body .mail-recipient-picker.is-enhanced .mail-recipient-options label.is-picked {
    background: var(--orange-soft);
    font-weight: 600;
}

html body .mail-recipient-picker.is-enhanced .mail-recipient-options label.is-picked::after {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 6px;
    height: 11px;
    border-right: 2px solid var(--brand-primary);
    border-bottom: 2px solid var(--brand-primary);
    content: "";
    transform: translateY(-65%) rotate(45deg);
}

html body .mail-recipient-none {
    margin: 0;
    padding: 12px 8px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

html body .mail-recipient-none[hidden] {
    display: none;
}


/* The search box inside the chip field has no frame of its own, in either theme. */
html body .mail-chip-box input.mail-chip-input,
html body .mail-chip-box input.mail-chip-input:focus {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}


/* Dark theme paints every text field; the chip field's search box stays see-through. */
html[data-theme="dark"] body .mail-chip-box input.mail-chip-input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]) {
    background-color: transparent !important;
    box-shadow: none !important;
}


/* Customer "Make payment" page: space between the sections and inside them. */
html body .portal-pay-panel {
    margin-bottom: 20px;
}

html body .portal-pay-panel > .order-pdf-payments {
    margin: 0;
    padding: 16px 20px 20px;
    border: 0;
}

html body .portal-pay-panel > .order-pdf-payments h2 {
    margin-top: 0;
}

html body .portal-pay-panel > .entry-form {
    padding: 16px 20px 20px;
}

html body .portal-pay-panel > .empty {
    padding: 24px 20px;
}

html body .portal-pay-panel .material-dialog-actions {
    justify-content: flex-end;
    margin-top: 4px;
}


/* Order tracker: lanes of open orders on the overview, and the task icon in the header. */
html body .topbar .notification-menu + .notification-menu {
    margin-left: -46px;
}

@media (max-width: 760px) {
    html body .topbar .notification-menu + .notification-menu {
        margin-left: 0;
    }
}

html body .task-menu-foot {
    position: sticky;
    bottom: 0;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 14px 14px;
    background: #fff;
    text-align: center;
}

html body .task-menu-foot a {
    color: var(--brand-primary);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
}

html body .task-menu-foot a:hover {
    text-decoration: underline;
}

html body .task-board {
    margin-bottom: 20px;
    scroll-margin-top: 90px;
}

html body .task-board-counts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

html body .task-board > .empty {
    padding: 24px 20px;
}

html body .task-lanes {
    display: grid;
    grid-auto-columns: minmax(210px, 1fr);
    grid-auto-flow: column;
    gap: 12px;
    overflow-x: auto;
    padding: 16px 20px 20px;
    scrollbar-width: thin;
}

html body .task-lane {
    display: flex;
    min-width: 0;
    max-height: 420px;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--soft-border);
    border-radius: 12px;
    background: var(--soft);
    scrollbar-width: thin;
}

html body .task-lane.is-empty {
    opacity: .7;
}

html body .task-lane-heading {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 2px 8px;
    padding: 2px 2px 6px;
}

html body .task-lane-heading strong {
    color: var(--dark-text);
    font-size: 13px;
}

html body .task-lane-heading b {
    display: inline-flex;
    min-width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--paper);
    color: var(--dark-text);
    font-size: 11.5px;
    line-height: 1;
}

html body .task-lane-heading small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.35;
}

html body .task-lane-none {
    margin: 0;
    padding: 14px 4px;
    color: var(--muted);
    font-size: 12.5px;
    text-align: center;
}

html body .task-card {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--soft-border);
    border-left: 3px solid var(--soft-border);
    border-radius: 10px;
    background: var(--paper);
    color: var(--dark-text);
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

html body .task-card:hover,
html body .task-card:focus-visible {
    border-color: var(--brand-primary);
    box-shadow: 0 8px 18px #0F1A2B1A;
    transform: translateY(-2px);
}

html body .task-card.is-mine {
    border-left-color: var(--brand-primary);
}

html body .task-card strong {
    font-size: 12.5px;
    letter-spacing: .01em;
}

html body .task-card-customer {
    font-size: 13px;
    font-weight: 600;
}

html body .task-card-need {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

html body .task-card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 8px;
    margin-top: 4px;
}

html body .task-card-foot small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

html body .task-card.is-stale .task-card-age {
    color: #B42318;
}

html body .task-card.is-mine .task-card-turn {
    color: var(--brand-primary);
}

@media (prefers-reduced-motion: reduce) {
    html body .task-card {
        transition: none;
    }

    html body .task-card:hover,
    html body .task-card:focus-visible {
        transform: none;
    }
}


/* Accounts: finance tables, reports, expenses and bills, reconciliation. */
html body table.finance-table th.num,
html body table.finance-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

html body table.finance-table tr.finance-total td {
    border-top: 2px solid var(--soft-border);
    background: var(--soft);
}

html body .finance-scroll {
    max-height: 520px;
    overflow-y: auto;
}

html body .report-note {
    margin: 0 0 16px;
    padding: 10px 14px;
    border-left: 3px solid var(--brand-primary);
    border-radius: 8px;
    background: var(--orange-soft);
    color: var(--dark-text);
    font-size: 13px;
    line-height: 1.5;
}

html body td.actions form {
    display: inline;
    margin: 0;
}

html body button.action-link {
    min-height: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

html body button.action-link.danger-link {
    color: #B42318;
}

html body button.action-link:hover {
    text-decoration: underline;
    transform: none;
}

html body .reconcile-toggle {
    display: inline-flex;
    min-height: 0;
    align-items: center;
    gap: 7px;
    padding: 4px 10px 4px 6px;
    border: 1px solid var(--soft-border);
    border-radius: 999px;
    background: var(--paper);
    box-shadow: none;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}

html body .reconcile-toggle:hover,
html body .reconcile-toggle:focus-visible {
    border-color: var(--brand-primary);
    color: var(--dark-text);
    transform: none;
}

html body .reconcile-box {
    position: relative;
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
}

html body .reconcile-toggle.is-done {
    border-color: #1B7F4B;
    background: #E7F6EE;
    color: #14633A;
}

html body .reconcile-toggle.is-done .reconcile-box {
    border-color: #1B7F4B;
    background: #1B7F4B;
}

html body .reconcile-toggle.is-done .reconcile-box::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 8px;
    border-right: 1.5px solid #fff;
    border-bottom: 1.5px solid #fff;
    content: "";
    transform: translate(-50%, -60%) rotate(45deg);
}

html body .portal-confirm-form select {
    flex: 1 1 180px;
    min-width: 0;
    height: 36px;
}


/* Operator sign-ins, managed on the Operators page. */
html body .operator-accounts {
    margin-top: 20px;
}

html body .operator-account-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0;
}

html body .operator-account-form + .operator-account-form,
html body .operator-account-form + .operator-account-buttons {
    margin-top: 8px;
}

html body .operator-account-form input,
html body .operator-account-form select {
    width: auto;
    min-width: 0;
    height: 36px;
    flex: 1 1 150px;
    padding: 0 10px;
    border: 1px solid var(--soft-border);
    border-radius: 9px;
    background: var(--paper);
    color: var(--dark-text);
    font: inherit;
    font-size: 12.5px;
}

html body .operator-account-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
}

html body .operator-account-buttons form {
    margin: 0;
}


/* Sign-in section inside the operator's pop-up. */
html body .operator-sign-in {
    margin-top: 16px;
    padding: 14px 16px 16px;
    border: 1px solid var(--soft-border);
    border-radius: 12px;
    background: var(--soft);
}

html body .operator-sign-in-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 12px;
}

html body .operator-sign-in-heading h3 {
    margin: 0;
    color: var(--dark-text);
    font-size: 14px;
}

html body .operator-sign-in-heading p,
html body .operator-sign-in-hint {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
}

html body .operator-sign-in-hint {
    margin-top: 10px;
}


/* Edit and delete inside the operator's pop-up. */
html body .operator-edit {
    margin-top: 16px;
    border: 1px solid var(--soft-border);
    border-radius: 12px;
    background: var(--paper);
}

html body .operator-edit > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    color: var(--dark-text);
    font-size: 14px;
    font-weight: 700;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

html body .operator-edit > summary::-webkit-details-marker {
    display: none;
}

html body .operator-edit > summary .collapse-chevron {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .15s ease;
}

html body .operator-edit[open] > summary {
    border-bottom: 1px solid var(--soft-border);
}

html body .operator-edit[open] > summary .collapse-chevron {
    transform: rotate(225deg) translate(-2px, -1px);
}

html body .operator-edit > .entry-form {
    padding: 14px 16px 6px;
}

html body .operator-delete-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    margin: 0;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--soft-border);
}

html body .operator-delete-form small {
    color: var(--muted);
    font-size: 12px;
}


/* "Open" on a notification is a button now (it also marks the notification as read), styled as the link it replaced. */
html body .notification-popup-actions button.notification-open {
    color: var(--brand-primary);
}

html body .notification-popup-actions form,
html body .notification-actions form {
    margin: 0;
}


/* Searchable drop-down: a box to type in with the matching choices listed underneath. */
html body .search-select {
    position: relative;
    display: block;
    min-width: 0;
}

html body .search-select > input {
    width: 100%;
}

html body .search-select > select.search-select-native {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 1px;
    height: 1px;
    min-height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

html body .search-select-list {
    display: grid;
    max-height: 230px;
    gap: 2px;
    overflow-y: auto;
    margin-top: 6px;
    padding: 6px;
    border: 1px solid var(--soft-border);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 12px 28px #0F1A2B24;
    scrollbar-width: thin;
}

html body .search-select-list[hidden] {
    display: none;
}

html body .search-select-list .search-select-option {
    position: relative;
    display: block;
    width: 100%;
    min-height: 0;
    padding: 8px 34px 8px 10px;
    border: 0;
    border-radius: 9px;
    background: none;
    box-shadow: none;
    color: var(--dark-text);
    font: inherit;
    font-size: 13.5px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}

html body .search-select-list .search-select-option:hover,
html body .search-select-list .search-select-option.is-active {
    background: var(--soft);
    transform: none;
}

html body .search-select-list .search-select-option.is-chosen {
    background: var(--orange-soft);
    font-weight: 700;
}

html body .search-select-list .search-select-option.is-chosen::after {
    position: absolute;
    top: 50%;
    right: 14px;
    width: 6px;
    height: 11px;
    border-right: 2px solid var(--brand-primary);
    border-bottom: 2px solid var(--brand-primary);
    content: "";
    transform: translateY(-65%) rotate(45deg);
}

html body .search-select-none {
    padding: 12px 8px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}


/* Searchable drop-down, improved: the list floats over the form as a pop-up instead of pushing it down. */
html body .search-select > input {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A94A3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");
    background-position: right 13px center;
    background-repeat: no-repeat;
    background-size: 17px 17px;
}

html body .search-select-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 90;
    max-height: 264px;
    margin-top: 0;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 2px 4px #0F1A2B0F, 0 18px 44px #0F1A2B2E;
    transform-origin: top center;
}

html body .search-select-list .search-select-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 36px 7px 8px;
    border-radius: 10px;
    transition: background-color .12s ease;
}

html body .search-select-list .search-select-option > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html body .search-select-list .search-select-option .mail-option-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    font-size: 12.5px;
}

html body .search-select-list .search-select-option.is-active {
    background: var(--orange-soft);
    box-shadow: inset 3px 0 0 var(--brand-primary);
}

html body .search-select-count {
    position: sticky;
    bottom: -6px;
    margin: 4px -6px -6px;
    padding: 7px 14px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 14px 14px;
    background: var(--soft);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 700;
}

@media (prefers-reduced-motion: no-preference) {
    @keyframes search-select-pop {
        from {
            opacity: 0;
            transform: translateY(-6px) scale(.98);
        }

        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    html body .search-select-list:not([hidden]) {
        animation: search-select-pop .16s ease-out;
    }
}

/* A pop-up inside a dialog must not be cut off by it. */
html body .material-dialog:has(.search-select-list:not([hidden])) {
    overflow: visible;
}

/* A form's button placed on the same line as its last field, level with the input. */
html body .entry-form .form-inline-action {
    display: flex;
    align-items: flex-end;
    align-self: end;
    min-width: 0;
}

html body .entry-form .form-inline-action .button {
    min-height: 40px;
    white-space: nowrap;
}


/* Administrator tools in Settings: logo, brand colours, backup, clearing data. */
html body .logo-setting {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px 28px;
    padding: 18px 20px 20px !important;
}

html body .logo-setting-preview {
    display: flex;
    width: 240px;
    min-height: 120px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border: 1px dashed var(--soft-border);
    border-radius: 12px;
    background: #fff;
}

html body .logo-setting-preview img {
    max-width: 100%;
    max-height: 110px;
    object-fit: contain;
}

html body .logo-setting-forms {
    display: grid;
    min-width: 0;
    flex: 1 1 280px;
    gap: 10px;
}

html body .logo-setting-forms form {
    margin: 0;
}

html body .logo-setting-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

html body .logo-setting-form label {
    display: grid;
    min-width: 0;
    flex: 1 1 240px;
    gap: 6px;
    color: var(--dark-text);
    font-size: 13px;
    font-weight: 600;
}

html body .logo-setting-forms .muted {
    margin: 0;
    font-size: 12.5px;
}

html body .brand-swatches {
    display: inline-flex;
    gap: 6px;
}

html body .brand-swatch {
    width: 26px;
    height: 26px;
    border: 2px solid var(--paper);
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--soft-border);
}

html body .brand-swatch-primary {
    background: var(--brand-primary);
}

html body .brand-swatch-dark {
    background: var(--brand-dark);
}

html body .admin-tools-panel input[type="color"] {
    width: 100%;
    height: 44px;
    padding: 4px;
    cursor: pointer;
}

html body .admin-tools-reset {
    margin: 0;
    padding: 0 20px 18px;
}

html body .backup-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    padding: 18px 20px 20px !important;
}

html body .backup-choice {
    display: grid;
    align-content: start;
    justify-items: start;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--soft-border);
    border-radius: 12px;
    background: var(--soft);
}

html body .backup-choice strong {
    color: var(--dark-text);
    font-size: 14px;
}

html body .backup-choice p {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

/* Downloading the data asks for the password again: the field and the button side by side. */
html body .backup-download-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    width: 100%;
    padding: 0;
}
html body .backup-download-form label {
    flex: 1 1 170px;
}
html body .backup-download-form .button {
    flex: 0 0 auto;
}

html body .danger-zone {
    border-color: #F3B4AC;
}

html body .danger-zone .panel-heading h2 {
    color: #B42318;
}

html body .clear-data-form {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 18px 20px 20px !important;
}

html body .clear-data-list {
    display: grid;
    gap: 8px;
}

html body .clear-data-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border: 1px solid var(--soft-border);
    border-radius: 11px;
    background: var(--paper);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

html body .clear-data-item:hover {
    border-color: #E8958A;
}

html body .clear-data-item:has(input:checked) {
    border-color: #D92D20;
    background: #FEF3F2;
}

html body .clear-data-item input {
    width: 17px;
    height: 17px;
    accent-color: #D92D20;
}

html body .clear-data-item span {
    display: grid;
    min-width: 0;
    gap: 2px;
}

html body .clear-data-item strong {
    color: var(--dark-text);
    font-size: 13.5px;
}

html body .clear-data-item small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}

html body .clear-data-item b {
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

html body .clear-data-kept {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.5;
}

html body .clear-data-confirm {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
}

html body .clear-data-confirm label {
    display: grid;
    min-width: 0;
    flex: 1 1 200px;
    gap: 6px;
    color: var(--dark-text);
    font-size: 13px;
    font-weight: 600;
}

html body .clear-data-confirm input {
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--soft-border);
    border-radius: var(--radius-small);
    background: var(--paper);
    color: var(--dark-text);
    font: inherit;
}

html body .button.danger-button {
    border-color: #D92D20;
    background: #D92D20;
    color: #fff;
}

html body .button.danger-button:hover,
html body .button.danger-button:focus-visible {
    border-color: #B42318;
    background: #B42318;
}

/* Warning shown shortly before an idle sign-out. */
html body .idle-warning {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 200;
    display: flex;
    max-width: min(420px, calc(100vw - 40px));
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 14px 16px;
    border: 1px solid var(--soft-border);
    border-left: 4px solid var(--brand-primary);
    border-radius: 12px;
    background: var(--paper);
    box-shadow: 0 2px 4px #0F1A2B0F, 0 18px 44px #0F1A2B2E;
    color: var(--dark-text);
    font-size: 13.5px;
    line-height: 1.45;
}


/* Phones: the task and notification pop-ups open across the screen under the header,
   instead of hanging off their icon and running off the left edge. */
@media (max-width: 760px) {
    html body .notification-menu {
        position: static;
    }

    html body .notification-popup {
        position: fixed;
        top: 66px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: calc(100vh - 86px);
        max-height: calc(100dvh - 86px);
    }

    html body .notification-popup::before {
        display: none;
    }

    html body .notification-popup li {
        overflow-wrap: anywhere;
    }

    html body .notification-popup-heading {
        flex-wrap: wrap;
    }

    html body .notification-popup-actions {
        flex-wrap: wrap;
        gap: 10px 16px;
    }

    html body .notification-popup-actions a,
    html body .notification-popup-actions button {
        padding: 6px 0;
        font-size: 13px;
    }
}


/* Phone menu: a three-line button in the header opens the menu as a panel sliding in from the left. */
html body .nav-toggle,
html body .nav-drawer-head,
html body .nav-backdrop {
    display: none;
}

@media (max-width: 700px) {
    html.has-nav-drawer body .nav-toggle {
        position: relative;
        display: inline-flex;
        width: 40px;
        height: 40px;
        min-height: 0;
        flex: 0 0 40px;
        align-items: center;
        justify-content: center;
        margin: 0 2px 0 -4px;
        padding: 0;
        border: 1px solid var(--soft-border);
        border-radius: 12px;
        background: var(--paper);
        box-shadow: none;
        color: var(--dark-text);
        cursor: pointer;
    }

    /* The three lines, drawn and centred in the button. */
    html.has-nav-drawer body .nav-toggle span,
    html.has-nav-drawer body .nav-toggle span::before,
    html.has-nav-drawer body .nav-toggle span::after {
        position: absolute;
        left: 50%;
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
        content: "";
        transform: translateX(-50%);
        transition: transform .2s ease, opacity .2s ease;
    }

    html.has-nav-drawer body .nav-toggle span {
        top: 50%;
        margin-top: -1px;
    }

    html.has-nav-drawer body .nav-toggle span::before {
        top: -6px;
    }

    html.has-nav-drawer body .nav-toggle span::after {
        top: 6px;
    }

    html.has-nav-drawer body .topbar .brand img {
        display: none;
    }

    html.has-nav-drawer body .layout > .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 1300;
        display: flex;
        width: min(84vw, 300px);
        height: auto;
        flex-direction: column;
        gap: 6px;
        overflow-y: auto;
        padding: 14px 12px 20px;
        border-right: 1px solid var(--line);
        border-bottom: 0;
        background: var(--paper);
        box-shadow: 0 0 0 #0000;
        transform: translateX(-105%);
        transition: transform .24s ease, box-shadow .24s ease;
        visibility: hidden;
    }

    html.has-nav-drawer.nav-open body .layout > .sidebar {
        box-shadow: 12px 0 40px #0F1A2B3D;
        transform: translateX(0);
        visibility: visible;
    }

    html.has-nav-drawer body .nav-drawer-head {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: space-between;
        padding: 2px 4px 10px 8px;
        border-bottom: 1px solid var(--line);
    }

    html.has-nav-drawer body .nav-drawer-head strong {
        color: var(--dark-text);
        font-size: 15px;
    }

    html.has-nav-drawer body .nav-drawer-close {
        position: relative;
        width: 36px;
        height: 36px;
        min-height: 0;
        flex: 0 0 36px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: var(--soft);
        box-shadow: none;
        cursor: pointer;
    }

    /* The cross, drawn and centred in its circle. */
    html.has-nav-drawer body .nav-drawer-close::before,
    html.has-nav-drawer body .nav-drawer-close::after {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 15px;
        height: 2px;
        border-radius: 2px;
        background: var(--dark-text);
        content: "";
    }

    html.has-nav-drawer body .nav-drawer-close::before {
        transform: translate(-50%, -50%) rotate(45deg);
    }

    html.has-nav-drawer body .nav-drawer-close::after {
        transform: translate(-50%, -50%) rotate(-45deg);
    }

    html.has-nav-drawer body .layout > .sidebar .sidebar-label {
        display: block;
        margin: 8px 0 2px;
        padding: 0 10px;
    }

    html.has-nav-drawer body .layout > .sidebar nav {
        display: grid;
        flex: 0 0 auto;
        gap: 2px;
        overflow: visible;
        padding-bottom: 0;
    }

    html.has-nav-drawer body .layout > .sidebar .nav-item {
        display: flex;
        min-height: 46px;
        align-items: center;
        gap: 12px;
        padding: 9px 12px;
        font-size: 14.5px;
    }

    html.has-nav-drawer body .layout > .sidebar .nav-mark {
        display: inline-flex;
    }

    html.has-nav-drawer body .nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1250;
        display: block;
        background: #0F1A2B80;
        opacity: 0;
        pointer-events: none;
        transition: opacity .24s ease;
    }

    html.has-nav-drawer.nav-open body .nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    html.has-nav-drawer.nav-open,
    html.has-nav-drawer.nav-open body {
        overflow: hidden;
    }
}

@media (max-width: 700px) and (prefers-reduced-motion: reduce) {
    html.has-nav-drawer body .layout > .sidebar,
    html.has-nav-drawer body .nav-backdrop {
        transition: none;
    }
}


/* Phone menu, finishing touches. */
@media (max-width: 700px) {
    /* The letter sits in the middle of its square. */
    html.has-nav-drawer body .layout > .sidebar .nav-mark {
        width: 28px;
        height: 28px;
        flex: 0 0 28px;
        align-items: center;
        justify-content: center;
        padding: 0;
        line-height: 1;
        text-align: center;
    }

    /* The cross takes the text colour, so it shows in both themes. */
    html.has-nav-drawer body .nav-drawer-close {
        color: var(--dark-text);
    }

    html.has-nav-drawer body .nav-drawer-close::before,
    html.has-nav-drawer body .nav-drawer-close::after {
        background: currentColor;
    }

    html.has-nav-drawer body .nav-backdrop {
        background: rgba(15, 26, 43, .58);
    }

    /* Room in the header for the menu button beside the name and the icons. */
    html.has-nav-drawer body .topbar {
        gap: 6px;
    }

    html.has-nav-drawer body .topbar .brand {
        min-width: 0;
        flex: 0 1 auto;
        overflow: hidden;
    }

    html.has-nav-drawer body .topbar .brand strong {
        font-size: 13px;
        letter-spacing: .02em;
        white-space: nowrap;
    }
}

@media (max-width: 380px) {
    html.has-nav-drawer body .topbar .brand {
        display: none;
    }
}


/* Director: a view-and-export account. Everything that adds, changes or deletes is taken off the page.
   The server refuses those actions as well; this only keeps the pages clean. */
html body.read-only form[method="post"]:not(:has(input[name="action"]:is([value="logout"], [value="dismiss-notification"], [value="clear-notifications"], [value="save-theme"], [value="save-profile"], [value="change-password"], [value="send-internal-mail"], [value="save-mail-draft"], [value="move-mail-to-deleted"], [value="restore-mail"], [value="bulk-mail"]))):not(:has(button[name="action"]:is([value="send-internal-mail"], [value="save-mail-draft"]))) {
    display: none !important;
}

html body.read-only main.content > details.form-panel,
html body.read-only .panel-action:not([data-story-open]),
html body.read-only a[href*="edit="],
html body.read-only a[href*="edit_user="],
html body.read-only a[href*="register_payment"],
html body.read-only a[href*="record_payment"],
html body.read-only a[href*="loading_invoice"],
html body.read-only a[href*="new_request"],
html body.read-only a[href*="=new"],
html body.read-only a[href*="create_delivery"],
html body.read-only a[href*="new_delivery"],
html body.read-only .order-status-note,
html body.read-only .operator-edit,
html body.read-only .operator-sign-in {
    display: none !important;
}

html body .view-only-chip {
    flex: 0 0 auto;
    white-space: nowrap;
}

@media (max-width: 700px) {
    html body .view-only-chip {
        display: none;
    }
}

/* "What's new" window shown once after each release. */
html body .material-dialog.changelog-dialog {
    width: min(540px, 100%);
}

html body .changelog-date {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

html body .changelog-section {
    margin-top: 16px;
}

html body .changelog-section h3 {
    margin: 0 0 8px;
    font-size: 13px;
}

html body .changelog-section ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 18px;
}

html body .changelog-section li {
    font-size: 13.5px;
    line-height: 1.5;
}

html body .changelog-dialog .material-dialog-actions {
    margin-top: 20px;
}
html body .changelog-earlier {
    margin: 22px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--soft-border);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 700;
}
/* Compact notifications on the Overview: the newest few, with a way to the full list. */
html body .notification-panel-all {
    flex: 0 0 auto;
    font-size: 13px;
    font-weight: 600;
}

html body .notification-panel-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 13px;
}
html body .notification-page-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

html body .notification-page-actions form {
    margin: 0;
}
/* A round floating "+" that leads to a new record on another page (Invoices: new invoice). The cross is drawn from two bars. */
html body main.content a.page-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 90;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF8A5B, #F15A24);
    color: #fff;
    box-shadow: 0 10px 26px #F15A2459;
    font-size: 0;
    text-decoration: none;
    transition: transform .16s ease, box-shadow .16s ease;
}

html body main.content a.page-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px #F15A2473;
}

html body main.content a.page-fab:focus-visible {
    outline: 3px solid #0F1A2B;
    outline-offset: 3px;
}

html body main.content a.page-fab span {
    position: relative;
    display: block;
    width: 20px;
    height: 20px;
}

html body main.content a.page-fab span::before,
html body main.content a.page-fab span::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 2px;
    background: #fff;
    transform: translate(-50%, -50%);
}

html body main.content a.page-fab span::before {
    width: 20px;
    height: 3px;
}

html body main.content a.page-fab span::after {
    width: 3px;
    height: 20px;
}

@media print {
    html body main.content a.page-fab {
        display: none;
    }
}
/* Language switch: EN | SW. */
html body .language-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    padding: 2px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #FFFFFF;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1;
}

html body .language-toggle a {
    padding: 6px 8px;
    border-radius: 999px;
    color: #6B7280;
    text-decoration: none;
}

html body .language-toggle a:hover {
    color: #111827;
}

html body .language-toggle a[aria-current="true"] {
    background: #F15A24;
    color: #FFFFFF;
}

html body .language-toggle.is-floating {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 95;
    box-shadow: 0 4px 14px #0F1A2B1A;
}
/* The short explanation at the top of a pop-up form. */
html body main.content details.form-panel[open] > .form-panel-hint {
    margin: 14px 20px 0;
}
/* A form's ordinary save button, placed first but out of sight, so the Enter key saves rather than pressing another button in the form. */
html body .default-submit {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    overflow: hidden;
}

/* Adding and removing kinds of expense, under the "Kind of expense" box. */
html body .expense-kinds {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
}

html body .expense-kinds > summary {
    padding: 10px 14px;
    color: #B93E12;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

html body .expense-kinds-body {
    display: grid;
    gap: 12px;
    padding: 4px 14px 14px;
}

html body .expense-kinds-add {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}

html body .expense-kinds-add label {
    flex: 1 1 220px;
}

html body .expense-kinds-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

html body .expense-kinds-list li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #FFFFFF;
    font-size: 13px;
}
/* Ticking several records in a list to approve them together. */
html body .pick-cell {
    width: 1%;
    padding-right: 0;
    white-space: nowrap;
}
html body .pick-cell input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    vertical-align: middle;
    accent-color: var(--brand-primary);
    cursor: pointer;
}
html body .panel-heading:has(.bulk-approve) {
    flex-wrap: wrap;
    gap: 12px;
}
html body .panel-heading:has(.bulk-approve) > div {
    flex: 1 1 220px;
    min-width: 0;
}
html body .panel-heading .bulk-approve {
    flex: none;
    margin: 0;
}
html body .bulk-approve button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* Approve, Decline, Edit and Delete together are too wide for one line, so they fold onto two. */
html body .finance-table td.actions {
    min-width: 150px;
    white-space: normal;
}
/* The expenses list has few columns, so its actions stay on one line. */
html body .finance-table.expenses-list td.actions {
    white-space: nowrap;
}
/* The notice written under Today's Report, with its Send and Download buttons. */
html body main.content .panel > form.entry-form.report-notice-form {
    grid-template-columns: 1fr;
    padding: 18px 20px 20px !important;
}
html body .report-notice-form .wide {
    grid-column: 1 / -1;
}

/* Kiwanda Cloud inside a company's system: the reminder strip for administrators, and the sign-in page's way back to the list of companies. */
html body .notice.kc-banner {
    border: 1px solid #fbd9c9;
    background: #fff6f1;
    color: #8a3412;
}
html body .notice.kc-banner-overdue {
    border-color: #f3c4bd;
    background: #fef3f2;
    color: #b42318;
}
html body .notice.kc-banner a {
    margin-left: 6px;
}
html body .kc-switch {
    margin: 4px 0 0;
    text-align: center;
    font-size: 13px;
    color: #5c6f7c;
}

/* The sign-in code page: a large code field, a small tick box, and the two links below. */
html body .login-panel .two-factor-form {
    display: grid;
    gap: 14px;
    margin-top: 6px;
}
html body .login-panel .two-factor-form label {
    margin-top: 0;
}
html body .login-panel .two-factor-form input[name="code"] {
    font-size: 24px;
    letter-spacing: 8px;
    text-align: center;
}
html body .login-panel .two-factor-form .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}
html body .login-panel .two-factor-form .checkbox-label input {
    flex: none;
    width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    accent-color: var(--brand-primary);
}
html body .login-panel .two-factor-resend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    font-size: 13px;
}
html body .login-panel .two-factor-resend button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 700;
    color: var(--brand-primary);
    cursor: pointer;
}
