:root {
    font-family:
        Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
    color: #20231f;
    background: #f4f3ef;
    line-height: 1.45;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    border: 0;
    border-radius: 8px;
    background: #26362d;
    color: white;
    padding: 0.75rem 1.1rem;
    cursor: pointer;
    font-weight: 650;
}

input,
select,
textarea {
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.72rem;
    border: 1px solid #d1d3cc;
    border-radius: 7px;
    background: white;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 650;
}

.topbar {
    min-height: 66px;
    padding: 0 4vw;
    background: #1f2b24;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar strong {
    margin-right: 0.7rem;
}

.topbar span {
    opacity: 0.75;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.link-button {
    background: transparent;
    padding: 0;
}

.container {
    width: min(1180px, 92vw);
    margin: 2.6rem auto;
}

.page-heading,
.panel-heading,
.dialog-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.page-heading {
    margin-bottom: 1.5rem;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0.3rem;
}

.eyebrow {
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    font-size: 0.72rem;
    font-weight: 750;
    color: #667068;
}

.muted {
    color: #6c736e;
}

.panel,
.summary-card,
.login-card {
    background: white;
    border: 1px solid #dedfd9;
    border-radius: 12px;
    box-shadow: 0 5px 18px rgb(34 45 38 / 5%);
}

.panel {
    padding: 1.35rem;
}

.login-card {
    width: min(430px, 100%);
    margin: 8vh auto;
    padding: 2rem;
}

.stack {
    display: grid;
    gap: 1rem;
}

.transaction-list,
.document-list {
    display: grid;
}

.transaction-row,
.document-row {
    color: inherit;
    text-decoration: none;
    padding: 1rem;
    border-bottom: 1px solid #e8e9e4;
}

.transaction-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.4fr auto;
    align-items: center;
    gap: 1rem;
}

.document-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.transaction-row:hover,
.document-row:hover {
    background: #f7f8f5;
}

.transaction-row:last-child,
.document-row:last-child {
    border-bottom: 0;
}

.transaction-row div:first-child,
.document-row div {
    display: grid;
}

.transaction-row span,
.document-row span,
.document-row small {
    color: #747b76;
}

.status {
    display: inline-block;
    width: fit-content;
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    background: #e7eee8;
    color: #31513c;
    font-size: 0.78rem;
    font-weight: 750;
}

.status.large {
    font-size: 0.9rem;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.summary-card {
    padding: 1rem;
    display: grid;
    gap: 0.3rem;
}

.summary-card span {
    color: #737a75;
    font-size: 0.8rem;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr);
    gap: 1rem;
}

.empty {
    padding: 4rem 1rem;
    text-align: center;
    color: #727973;
}

.empty.compact {
    padding: 2rem 1rem;
}

.alert {
    margin-bottom: 1rem;
    padding: 0.85rem;
    border-radius: 7px;
    background: #fae6e5;
    color: #862d29;
}

dialog {
    width: min(560px, 92vw);
    border: 0;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 24px 80px rgb(0 0 0 / 25%);
}

dialog::backdrop {
    background: rgb(20 27 22 / 55%);
}

.close-button {
    background: transparent;
    color: #313631;
    font-size: 1.5rem;
    padding: 0.25rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: #355c42;
    text-decoration: none;
    font-weight: 650;
}

.notes-panel {
    margin-top: 1rem;
}

@media (max-width: 800px) {
    .transaction-row {
        grid-template-columns: 1fr;
    }

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

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


.folder-row {
    border-bottom: 1px solid #e8e9e4;
}

.folder-row:last-child {
    border-bottom: 0;
}

.folder-row summary {
    padding: 1rem;
    cursor: pointer;
    list-style: none;
}

.folder-row summary::-webkit-details-marker {
    display: none;
}

.folder-row summary div {
    display: grid;
}

.folder-row summary span {
    color: #747b76;
    font-size: 0.85rem;
}

.folder-row[open] summary {
    background: #f7f8f5;
    border-bottom: 1px solid #e8e9e4;
}

.folder-contents {
    padding-left: 1.25rem;
    background: #fbfcfa;
}

.document-row.nested {
    padding-left: 1.25rem;
}


.document-entry {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #e8e9e4;
}

.document-entry:last-child {
    border-bottom: 0;
}

.document-entry .document-row {
    flex: 1;
    border-bottom: 0;
}

.document-entry form {
    display: flex;
    align-items: center;
    padding-right: 0.75rem;
}

.delete-button {
    background: transparent;
    color: #a12f2a;
    border: 1px solid #dfb9b6;
    padding: 0.42rem 0.65rem;
    font-size: 0.78rem;
}

.delete-button:hover {
    background: #fae9e7;
    color: #7e211d;
}

.folder-contents .document-entry {
    margin-left: 0;
}


/* Consistent transaction document rows */

.transaction-files-panel {
    min-width: 0;
    overflow: hidden;
}

.transaction-files-panel .document-list {
    margin: 0 -1.35rem -1.35rem;
}

.document-entry {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    border-bottom: 1px solid #e8e9e4;
}

.document-entry:last-child {
    border-bottom: 0;
}

.document-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-width: 0;
    padding: 1rem 0.75rem 1rem 1.35rem;
    color: inherit;
    text-decoration: none;
}

.document-main:hover {
    background: #f7f8f5;
}

.document-main.nested {
    padding-left: 2.5rem;
}

.document-text {
    display: grid;
    min-width: 0;
}

.document-text strong {
    overflow-wrap: anywhere;
}

.document-text small,
.document-date {
    color: #747b76;
}

.document-date {
    flex: 0 0 auto;
    font-size: 0.78rem;
    white-space: nowrap;
}

.document-delete-form {
    display: flex;
    align-items: center;
    padding: 0 1rem 0 0.5rem;
    margin: 0;
    background: white;
}

.delete-button {
    display: inline-block;
    flex: 0 0 auto;
    background: transparent;
    color: #a12f2a;
    border: 1px solid #dfb9b6;
    border-radius: 7px;
    padding: 0.42rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.2;
    white-space: nowrap;
}

.delete-button:hover {
    background: #fae9e7;
    color: #7e211d;
}

.folder-row {
    width: 100%;
}

.folder-row summary {
    width: 100%;
}

.folder-summary-text {
    display: grid;
    min-width: 0;
}

.folder-contents {
    width: 100%;
    padding-left: 0;
}

@media (max-width: 650px) {
    .document-main {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.25rem;
    }

    .document-delete-form {
        padding-right: 0.65rem;
    }

    .document-date {
        white-space: normal;
    }
}


.document-rename-form,
.document-delete-form {
    display: flex;
    align-items: center;
    margin: 0;
}

.document-rename-form {
    padding: 0 0.35rem 0 0.5rem;
    background: white;
}

.document-delete-form {
    padding-left: 0.25rem;
}

.rename-button {
    display: inline-block;
    background: transparent;
    color: #435b4d;
    border: 1px solid #b9c8be;
    border-radius: 7px;
    padding: 0.42rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.2;
    white-space: nowrap;
}

.rename-button:hover {
    background: #edf3ef;
    color: #273d31;
}

.closing-date-panel {
    margin-top: 1.25rem;
}

.closing-date-form {
    display: flex;
    align-items: end;
    gap: 1rem;
    flex-wrap: wrap;
}

.closing-date-form label {
    flex: 1 1 240px;
    margin: 0;
}

.closing-date-form input[type="date"] {
    width: 100%;
}

.closing-date-form button {
    flex: 0 0 auto;
}

@media (max-width: 700px) {
    .document-entry {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .document-rename-form {
        padding-left: 0.25rem;
    }

    .rename-button,
    .delete-button {
        padding: 0.4rem 0.5rem;
    }
}


/* Reliable no-JavaScript document rename controls */

.document-entry {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 280px) auto;
}

.document-rename-form {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.55rem 0.25rem 0.55rem 0.5rem;
    margin: 0;
    background: white;
}

.rename-input {
    width: 100%;
    min-width: 0;
    height: 2rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid #cfd5d0;
    border-radius: 6px;
    background: white;
    font-size: 0.78rem;
}

.rename-input:focus {
    outline: 2px solid rgba(67, 91, 77, 0.2);
    border-color: #718579;
}

.document-delete-form {
    padding-right: 0.75rem;
}

@media (max-width: 900px) {
    .document-entry {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .document-rename-form {
        grid-column: 1 / -1;
        padding: 0.5rem 0.75rem 0.75rem 1.35rem;
        border-top: 1px solid #f0f1ee;
    }

    .document-main.nested + .document-rename-form {
        padding-left: 2.5rem;
    }
}


/* ========================================================
   Transaction media gallery
   ======================================================== */

.media-panel {
    min-width: 0;
}

.media-panel-heading {
    align-items: center;
}

.media-count {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.25rem 0.65rem;
    border: 1px solid #d9ded9;
    border-radius: 999px;
    background: #f5f7f4;
    color: #687069;
    font-size: 0.78rem;
    white-space: nowrap;
}

.media-folder {
    margin-top: 1rem;
    border: 1px solid #e1e5e1;
    border-radius: 10px;
    overflow: hidden;
    background: #fafbfa;
}

.media-folder-heading {
    display: flex;
    align-items: center;
    min-height: 3.5rem;
    padding: 0.8rem 1rem;
    cursor: pointer;
    background: #f4f6f3;
    border-bottom: 1px solid #e1e5e1;
}

.media-folder:not([open]) .media-folder-heading {
    border-bottom: 0;
}

.media-folder-heading span {
    display: grid;
    gap: 0.1rem;
}

.media-folder-heading small {
    color: #747b76;
    font-size: 0.78rem;
}

.media-folder-heading.standalone {
    margin-top: 1rem;
    cursor: default;
    border: 1px solid #e1e5e1;
    border-radius: 10px 10px 0 0;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fill,
        minmax(190px, 1fr)
    );
    gap: 1rem;
    padding: 1rem;
}

.media-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #dfe4df;
    border-radius: 10px;
    background: white;
    box-shadow: 0 1px 2px rgba(24, 34, 28, 0.05);
}

.media-preview {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #e9ece9;
}

.media-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 160ms ease;
}

.media-preview:hover img {
    transform: scale(1.025);
}

.media-placeholder {
    display: grid;
    place-content: center;
    gap: 0.25rem;
    width: 100%;
    height: 100%;
    color: #59635c;
    text-align: center;
}

.media-placeholder strong {
    font-size: 1.1rem;
}

.media-placeholder small {
    color: #747b76;
}

.media-card-body {
    padding: 0.75rem;
}

.media-filename {
    display: block;
    overflow: hidden;
    margin-bottom: 0.65rem;
    color: #26332b;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-filename:hover {
    text-decoration: underline;
}

.media-actions {
    display: grid;
    gap: 0.5rem;
}

.media-rename-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}

.media-rename-form input {
    width: 100%;
    min-width: 0;
    height: 2rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid #cfd5d0;
    border-radius: 6px;
    font-size: 0.75rem;
}

.media-delete-form {
    display: flex;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
}

.media-actions .rename-button,
.media-actions .delete-button {
    min-height: 2rem;
}

.media-ungrouped > .media-grid {
    border: 1px solid #e1e5e1;
    border-top: 0;
    border-radius: 0 0 10px 10px;
    background: #fafbfa;
}

@media (max-width: 700px) {
    .media-grid {
        grid-template-columns: repeat(
            auto-fill,
            minmax(145px, 1fr)
        );
        gap: 0.65rem;
        padding: 0.65rem;
    }

    .media-card-body {
        padding: 0.6rem;
    }

    .media-rename-form {
        grid-template-columns: 1fr;
    }

    .media-rename-form .rename-button {
        width: 100%;
    }

    .media-delete-form .delete-button {
        width: 100%;
    }
}


/* Transaction checklist */

.transaction-checklist-panel {
    margin-top: 1.25rem;
    min-width: 0;
}

.checklist-heading {
    align-items: center;
    gap: 1rem;
}

.checklist-progress {
    display: inline-flex;
    align-items: center;
    min-height: 1.8rem;
    padding: 0.25rem 0.7rem;
    border: 1px solid #d7ded8;
    border-radius: 999px;
    background: #f5f7f4;
    color: #5f6962;
    font-size: 0.78rem;
    white-space: nowrap;
}

.checklist-progress-track {
    width: 100%;
    height: 7px;
    margin: 0.25rem 0 1rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e8ece8;
}

.checklist-progress-bar {
    height: 100%;
    min-width: 0;
    border-radius: inherit;
    background: #496c57;
    transition: width 180ms ease;
}

.transaction-checklist-form {
    margin: 0;
}

.checklist-items {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(260px, 1fr)
    );
    gap: 0.65rem;
}

.checklist-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    min-height: 4rem;
    margin: 0;
    padding: 0.75rem;
    border: 1px solid #dfe4df;
    border-radius: 9px;
    background: white;
    cursor: pointer;
    transition:
        border-color 140ms ease,
        background 140ms ease;
}

.checklist-item:hover {
    border-color: #b8c7bc;
    background: #fafcf9;
}

.checklist-item input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.checklist-checkbox,
.checklist-status-icon {
    display: grid;
    place-items: center;
    flex: 0 0 1.35rem;
    width: 1.35rem;
    height: 1.35rem;
    border: 1px solid #aeb9b1;
    border-radius: 5px;
    background: white;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
}

.checklist-item input[type="checkbox"]:checked
+ .checklist-checkbox {
    border-color: #496c57;
    background: #496c57;
}

.checklist-item input[type="checkbox"]:checked
+ .checklist-checkbox::after {
    content: "✓";
}

.checklist-item.is-complete {
    border-color: #cad8cd;
    background: #f4f8f4;
}

.checklist-item.is-complete
.checklist-status-icon {
    border-color: #496c57;
    background: #496c57;
}

.checklist-item-content {
    display: grid;
    min-width: 0;
    gap: 0.12rem;
}

.checklist-item-content strong {
    overflow-wrap: anywhere;
    color: #28342c;
    font-size: 0.88rem;
}

.checklist-item-content small {
    color: #778078;
    font-size: 0.74rem;
}

.checklist-item.is-complete
.checklist-item-content strong {
    color: #526258;
}

.checklist-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e8e5;
}

.checklist-items.read-only
.checklist-item {
    cursor: default;
}

@media (max-width: 700px) {
    .checklist-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .checklist-items {
        grid-template-columns: 1fr;
    }

    .checklist-progress {
        white-space: normal;
    }

    .checklist-footer button {
        width: 100%;
    }
}


/* Broker dashboard */

.broker-dashboard {
    display: grid;
    gap: 1.25rem;
}

.broker-dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.broker-dashboard-header h1 {
    margin-bottom: 0.25rem;
}

.broker-scorecards {
    display: grid;
    grid-template-columns: repeat(
        auto-fit,
        minmax(165px, 1fr)
    );
    gap: 0.75rem;
}

.broker-scorecard {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
    border: 1px solid #dfe5e0;
    border-radius: 10px;
    background: white;
}

.broker-scorecard span {
    color: #69736c;
    font-size: 0.78rem;
    font-weight: 600;
}

.broker-scorecard strong {
    color: #27352d;
    font-size: 1.8rem;
    line-height: 1;
}

.broker-scorecard.warning {
    border-color: #dacb9e;
    background: #fffaf0;
}

.broker-scorecard.danger {
    border-color: #ddb8b3;
    background: #fff6f4;
}

.broker-alert-list {
    display: grid;
    gap: 0.5rem;
}

.broker-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
}

.broker-alert.warning {
    background: #fff7df;
}

.broker-alert.danger {
    background: #fff0ee;
}

.broker-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.broker-table {
    width: 100%;
    border-collapse: collapse;
}

.broker-table th,
.broker-table td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e9e5;
    text-align: left;
    vertical-align: middle;
}

.broker-table th {
    color: #657068;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.assignment-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.assignment-control form:first-child {
    display: flex;
    gap: 0.4rem;
}

.assignment-control select {
    min-width: 175px;
}

.link-button {
    padding: 0.4rem;
    border: 0;
    background: transparent;
}

.danger-text {
    color: #9c3d34;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
}

.status-badge.success {
    color: #345c42;
    background: #e9f4eb;
}

.status-badge.warning {
    color: #765d1a;
    background: #fff1c7;
}

.status-badge.muted {
    color: #68716b;
    background: #ecefed;
}

.broker-add-person {
    margin-bottom: 1rem;
    border: 1px solid #dfe5e0;
    border-radius: 9px;
    background: #fafcf9;
}

.broker-add-person > summary,
.salesperson-card > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem;
    cursor: pointer;
}

.broker-add-person > summary {
    font-weight: 700;
}

.broker-person-form {
    display: grid;
    grid-template-columns: repeat(
        3,
        minmax(0, 1fr)
    );
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid #e4e8e4;
}

.broker-person-form label {
    display: grid;
    gap: 0.3rem;
    color: #59635c;
    font-size: 0.78rem;
    font-weight: 600;
}

.broker-person-form input,
.broker-person-form select,
.broker-person-form textarea {
    width: 100%;
}

.full-width {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex !important;
    justify-content: flex-end;
}

.salesperson-grid {
    display: grid;
    gap: 0.65rem;
}

.salesperson-card {
    border: 1px solid #dfe5e0;
    border-radius: 9px;
    background: white;
}

.salesperson-card.inactive {
    opacity: 0.72;
    background: #f6f7f6;
}

.salesperson-card summary strong,
.salesperson-card summary small {
    display: block;
}

.salesperson-card summary small {
    margin-top: 0.15rem;
    color: #79817b;
}

.salesperson-toggle-form {
    display: flex;
    justify-content: flex-end;
    padding: 0 1rem 1rem;
}

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

    .broker-person-form {
        grid-template-columns: 1fr 1fr;
    }

    .assignment-control {
        align-items: stretch;
        flex-direction: column;
    }

    .assignment-control form:first-child {
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .broker-person-form {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: auto;
    }

    .broker-alert {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Broker navigation */
.user-menu {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-link {
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    opacity: 0.85;
}

.topbar-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Broker transaction deletion */
.broker-danger-zone {
    margin-top: 28px;
    border: 1px solid rgba(180, 40, 40, 0.35);
}

.broker-delete-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.broker-delete-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(127, 127, 127, 0.2);
}

.broker-delete-row:last-child {
    border-bottom: 0;
}

.broker-delete-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.broker-delete-form input {
    width: 130px;
}

.danger-button {
    background: #a52a2a;
    border-color: #a52a2a;
    color: white;
}

.danger-button:hover {
    background: #7f1d1d;
}

@media (max-width: 700px) {
    .broker-delete-row {
        align-items: stretch;
        flex-direction: column;
    }

    .broker-delete-form {
        width: 100%;
    }
}

/* PULSE CE integration */
.pulse-panel {
    margin: 16px 0;
    padding: 14px;
    border: 1px solid rgba(127, 127, 127, .25);
    border-radius: 8px;
}

.pulse-panel > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.pulse-panel small {
    display: block;
}

.pulse-refresh-form {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.pulse-refresh-form input {
    flex: 1;
    min-width: 180px;
}

.pulse-result {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: rgba(127, 127, 127, .12);
    font-size: .9rem;
}

/* Backup status */
.backup-status-panel {
    margin-top: 20px;
}

.backup-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 12px;
}

.backup-status-grid > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.backup-status-grid strong {
    font-size: 1rem;
}

.broker-scorecard.success {
    border-color: rgba(40, 140, 80, .35);
}

.broker-scorecard.warning {
    border-color: rgba(200, 140, 20, .45);
}

.broker-scorecard.danger {
    border-color: rgba(180, 40, 40, .45);
}

@media (max-width: 700px) {
    .backup-status-grid {
        grid-template-columns: 1fr;
    }
}

.agent-account-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.agent-account-actions form {
    margin: 0;
}


/* ============================================================
   LINDUM REALTY UI
   ============================================================ */

:root {
    --lindum-black: #090909;
    --lindum-black-soft: #111111;
    --lindum-panel: #171717;
    --lindum-panel-raised: #1d1d1d;

    --lindum-orange: #f67a19;
    --lindum-orange-hover: #ff8c2f;
    --lindum-gold: #f1c752;

    --lindum-silver: #d6d5d6;
    --lindum-muted: #989898;

    --lindum-border: rgba(246, 122, 25, 0.22);
    --lindum-soft-border: rgba(255,255,255,0.10);

    --lindum-danger: #cf4545;
    --lindum-success: #67b97d;
    --lindum-warning: #e7ad3d;

    --shadow-soft:
        0 10px 35px rgba(0,0,0,.28);

    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
}


/* PAGE */

html {
    background: var(--lindum-black);
}

body {
    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(
            circle at 50% -180px,
            rgba(246, 122, 25, .13),
            transparent 480px
        ),
        var(--lindum-black);

    color: var(--lindum-silver);

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Helvetica,
        Arial,
        sans-serif;
}

.container {
    width: min(1400px, calc(100% - 48px));
    margin: 0 auto;
    padding: 34px 0 70px;
}


/* HEADER */

.topbar {
    min-height: 86px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 30px;

    padding: 12px 28px;

    background:
        rgba(9, 9, 9, .94);

    border-bottom:
        1px solid var(--lindum-border);

    box-shadow:
        0 8px 30px rgba(0,0,0,.28);

    position: sticky;
    top: 0;
    z-index: 100;

    backdrop-filter: blur(14px);
}


/* BRAND */

.brand {
    display: flex;
    align-items: center;

    gap: 14px;

    color: inherit;
    text-decoration: none;
}

.brand-logo {
    width: 62px;
    height: 62px;

    object-fit: contain;

    filter:
        drop-shadow(
            0 0 11px rgba(246,122,25,.18)
        );
}

.brand-copy {
    display: flex;
    flex-direction: column;

    gap: 1px;
}

.brand-copy strong {
    color: var(--lindum-gold);

    letter-spacing: .09em;

    font-size: 17px;
    font-weight: 800;
}

.brand-copy span {
    color: var(--lindum-silver);

    font-size: 13px;

    letter-spacing: .04em;
}


/* USER / NAVIGATION */

.user-menu {
    display: flex;
    align-items: center;

    gap: 18px;
}

.topbar-nav {
    display: flex;
    align-items: center;

    gap: 5px;

    padding-right: 12px;

    border-right:
        1px solid var(--lindum-soft-border);
}

.topbar-nav a,
.topbar-link {
    display: inline-flex;
    align-items: center;

    min-height: 38px;

    padding: 0 13px;

    border-radius: 9px;

    color: var(--lindum-silver);

    text-decoration: none;

    font-size: 14px;
    font-weight: 650;

    transition:
        background .15s ease,
        color .15s ease;
}

.topbar-nav a:hover,
.topbar-link:hover {
    background:
        rgba(246,122,25,.12);

    color: var(--lindum-gold);

    text-decoration: none;
}

.signed-in-user {
    display: flex;
    align-items: center;

    gap: 9px;
}

.user-avatar {
    width: 36px;
    height: 36px;

    display: grid;
    place-items: center;

    border:
        1px solid rgba(246,122,25,.48);

    border-radius: 50%;

    background:
        rgba(246,122,25,.11);

    color: var(--lindum-gold);

    font-weight: 800;
}

.user-details {
    display: flex;
    flex-direction: column;

    min-width: 105px;
}

.user-details strong {
    color: #fff;

    font-size: 13px;
}

.user-details small {
    color: var(--lindum-muted);

    font-size: 11px;
}

.logout-button,
.link-button {
    background: transparent;

    border:
        1px solid var(--lindum-soft-border);

    color: var(--lindum-muted);

    padding: 9px 13px;

    border-radius: 9px;

    cursor: pointer;
}

.logout-button:hover,
.link-button:hover {
    border-color:
        rgba(246,122,25,.5);

    color: var(--lindum-gold);
}


/* HEADINGS */

h1,
h2,
h3 {
    color: #fff;

    letter-spacing: -.025em;
}

h1 {
    font-size: clamp(30px, 4vw, 46px);
}

h2 {
    font-size: 23px;
}

.eyebrow {
    margin-bottom: 5px;

    color: var(--lindum-orange);

    font-size: 11px;

    font-weight: 800;

    letter-spacing: .14em;

    text-transform: uppercase;
}

.muted {
    color: var(--lindum-muted) !important;
}


/* PANELS */

.panel,
.salesperson-card,
.broker-scorecard,
details {
    background:
        linear-gradient(
            145deg,
            rgba(255,255,255,.035),
            rgba(255,255,255,.012)
        ),
        var(--lindum-panel);

    border:
        1px solid var(--lindum-soft-border);

    border-radius: var(--radius-lg);

    box-shadow: var(--shadow-soft);
}

.panel {
    padding: 24px;
}

.panel-heading {
    margin-bottom: 20px;
}

.broker-scorecards {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(185px,1fr));

    gap: 14px;
}

.broker-scorecard {
    min-height: 108px;

    padding: 18px;

    display: flex;
    flex-direction: column;

    justify-content: space-between;

    border-top:
        2px solid rgba(246,122,25,.7);
}

.broker-scorecard span {
    color: var(--lindum-muted);

    font-size: 12px;

    text-transform: uppercase;

    letter-spacing: .06em;
}

.broker-scorecard strong {
    color: var(--lindum-gold);

    font-size: 28px;

    line-height: 1;
}


/* TABLES */

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

    border:
        1px solid var(--lindum-soft-border);

    border-radius: var(--radius-md);
}

table,
.broker-table {
    width: 100%;

    border-collapse: collapse;

    background: transparent;
}

th {
    padding: 12px 14px;

    color: var(--lindum-orange);

    font-size: 11px;

    text-transform: uppercase;

    letter-spacing: .08em;

    text-align: left;

    background:
        rgba(246,122,25,.055);
}

td {
    padding: 13px 14px;

    color: var(--lindum-silver);

    border-top:
        1px solid var(--lindum-soft-border);
}

tr:hover td {
    background:
        rgba(255,255,255,.018);
}

a {
    color: var(--lindum-gold);
}

a:hover {
    color: var(--lindum-orange);
}


/* FORMS */

label {
    color: var(--lindum-silver);

    font-size: 13px;

    font-weight: 600;
}

input,
select,
textarea {
    box-sizing: border-box;

    background:
        #0c0c0c;

    border:
        1px solid rgba(255,255,255,.14);

    border-radius: var(--radius-sm);

    color: #fff;

    padding: 11px 12px;

    outline: none;

    transition:
        border-color .15s ease,
        box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color:
        var(--lindum-orange);

    box-shadow:
        0 0 0 3px rgba(246,122,25,.12);
}

input::placeholder,
textarea::placeholder {
    color: #686868;
}


/* BUTTONS */

button,
.button,
input[type="submit"] {
    border: 1px solid var(--lindum-orange);

    border-radius: var(--radius-sm);

    background:
        linear-gradient(
            180deg,
            #fb8a2d,
            var(--lindum-orange)
        );

    color: #0a0a0a;

    padding: 10px 15px;

    font-weight: 800;

    cursor: pointer;

    box-shadow:
        0 5px 15px rgba(246,122,25,.16);

    transition:
        transform .12s ease,
        filter .12s ease;
}

button:hover,
.button:hover,
input[type="submit"]:hover {
    filter: brightness(1.08);

    transform: translateY(-1px);
}

button.secondary,
.button.secondary {
    background: transparent;

    color: var(--lindum-gold);

    border-color:
        rgba(241,199,82,.42);

    box-shadow: none;
}

.danger-button {
    background: #a93636 !important;

    border-color: #d04c4c !important;

    color: white !important;
}


/* STATUS */

.status-badge {
    display: inline-flex;

    padding: 5px 9px;

    border-radius: 100px;

    font-size: 11px;

    font-weight: 750;

    border:
        1px solid var(--lindum-soft-border);
}

.status-badge.success,
.broker-scorecard.success {
    color: #83d397;

    border-color:
        rgba(103,185,125,.38);
}

.status-badge.warning,
.broker-scorecard.warning {
    color: #f3c45f;

    border-color:
        rgba(231,173,61,.4);
}

.status-badge.danger,
.broker-scorecard.danger {
    color: #ef7979;

    border-color:
        rgba(207,69,69,.45);
}


/* DETAILS / PEOPLE */

.salesperson-card,
.broker-add-person {
    overflow: hidden;
}

.salesperson-card summary,
.broker-add-person summary {
    cursor: pointer;

    padding: 16px 18px;

    color: #fff;
}

.salesperson-card[open] summary,
.broker-add-person[open] summary {
    border-bottom:
        1px solid var(--lindum-soft-border);
}

.broker-person-form {
    padding: 18px;
}


/* LOGIN */

.login-card,
.login-panel {
    max-width: 440px;

    margin:
        8vh auto;

    padding: 32px;

    background:
        linear-gradient(
            160deg,
            rgba(246,122,25,.055),
            rgba(255,255,255,.01)
        ),
        var(--lindum-panel);

    border:
        1px solid var(--lindum-border);

    border-radius: 22px;

    box-shadow:
        0 25px 70px rgba(0,0,0,.45);
}


/* FOOTER */

.site-footer {
    min-height: 90px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 10px;

    color: #626262;

    font-size: 11px;

    border-top:
        1px solid rgba(255,255,255,.055);
}

.site-footer img {
    width: 34px;
    height: 34px;

    object-fit: contain;

    opacity: .6;
}


/* MOBILE */

@media (max-width: 800px) {

    .topbar {
        align-items: flex-start;

        padding: 11px 14px;
    }

    .brand-copy {
        display: none;
    }

    .brand-logo {
        width: 52px;
        height: 52px;
    }

    .user-menu {
        gap: 7px;
    }

    .topbar-nav {
        border-right: 0;
        padding-right: 0;
    }

    .topbar-nav a {
        padding: 8px;

        font-size: 12px;
    }

    .user-details {
        display: none;
    }

    .container {
        width: min(100% - 24px, 1400px);

        padding-top: 20px;
    }

    .panel {
        padding: 17px;
    }

}

/* ============================================================
   LINDUM DARK UI FIXES
   Prevent light legacy surfaces with light text
   ============================================================ */

main,
section,
article,
.card,
.panel,
.transaction-card,
.salesperson-card,
.broker-scorecard,
.broker-alert,
.broker-delete-row,
.backup-status-panel,
.pulse-panel,
details,
summary,
form {
    color: var(--lindum-silver);
}

.panel,
.card,
.transaction-card,
.salesperson-card,
.broker-scorecard,
.broker-alert,
.backup-status-panel,
.pulse-panel,
details {
    background-color: var(--lindum-panel) !important;
    color: var(--lindum-silver) !important;
}

/* Legacy white wrappers */
.content,
.content-card,
.form-card,
.transaction-detail,
.document-card,
.upload-panel,
.checklist,
.checklist-panel,
.empty,
.empty-state {
    background: var(--lindum-panel) !important;
    color: var(--lindum-silver) !important;
    border-color: var(--lindum-soft-border) !important;
}

/* Make absolutely sure form controls stay dark */
input,
select,
textarea,
option {
    background-color: #0c0c0c !important;
    color: #ffffff !important;
    border-color: rgba(255,255,255,.16) !important;
}

select option {
    background: #111111 !important;
    color: #ffffff !important;
}

/* Text inherited from old light theme */
p,
li,
dd,
dt,
small,
span,
label {
    color: inherit;
}

.panel p,
.panel li,
.panel small,
.panel span,
.transaction-card p,
.transaction-card span,
.salesperson-card p,
.salesperson-card span {
    color: var(--lindum-silver);
}

/* Keep intentionally muted text muted */
.muted,
small.muted {
    color: var(--lindum-muted) !important;
}

/* Table fixes */
table,
thead,
tbody,
tr,
td,
th {
    background-color: transparent;
}

td {
    color: var(--lindum-silver) !important;
}

th {
    color: var(--lindum-orange) !important;
}

/* White legacy buttons */
button.secondary,
.secondary,
a.secondary {
    background: transparent !important;
    color: var(--lindum-gold) !important;
}

/* Generic legacy white background classes */
.bg-white,
.white,
.white-panel {
    background: var(--lindum-panel) !important;
    color: var(--lindum-silver) !important;
}
