:root {
    --bg: #f4f1ec;
    --bg-soft: #eef4f0;
    --panel: rgba(255, 251, 245, 0.82);
    --panel-strong: #fffaf2;
    --line: rgba(19, 50, 44, 0.1);
    --line-strong: rgba(19, 50, 44, 0.2);
    --text: #13322c;
    --muted: #5f716d;
    --accent: #1f5f52;
    --accent-strong: #143d34;
    --accent-soft: rgba(31, 95, 82, 0.08);
    --secondary: #d6b36a;
    --secondary-soft: rgba(214, 179, 106, 0.16);
    --shadow: 0 18px 50px rgba(22, 53, 47, 0.1);
    --danger-soft: #f6e3dd;
    --danger-text: #8c3f32;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Sora", sans-serif;
    color: var(--text);
    background: #f3ede3;
}

body::before {
    display: none;
}

a,
button,
input,
summary {
    font: inherit;
}

button {
    border: 0;
    cursor: pointer;
}

.shell {
    position: relative;
    z-index: 1;
    width: min(1240px, calc(100% - 28px));
    margin: 0 auto;
    padding: 18px 0 48px;
}

.page-shell {
    display: grid;
    gap: 16px;
    margin-top: 16px;
}

.topbar,
.panel,
.project-card,
.office-card,
.report-summary-card {
    display: flex;
    flex-direction: column;
    background: rgba(255, 250, 242, 0.96);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.topbar {
    display: grid;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 22px;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(214, 179, 106, 0.22);
    color: var(--accent-strong);
    border: 1px solid rgba(214, 179, 106, 0.28);
    font-size: 13px;
    font-weight: 700;
}

.eyebrow,
.section-kicker {
    margin: 0;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

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

.menu-link,
.brand-filter-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 13px;
    border-radius: 999px;
    background: rgba(255, 250, 242, 0.72);
    border: 1px solid var(--line);
    color: var(--accent-strong);
    text-decoration: none;
    font-size: 12px;
    transition: transform 180ms ease, background 180ms ease;
}

.menu-link:hover,
.brand-filter-button:hover {
    transform: translateY(-1px);
    background: rgba(214, 179, 106, 0.22);
}

.menu-link.active {
    background: var(--accent);
    color: #f9f6ef;
    border-color: rgba(20, 61, 52, 0.26);
}

.brand-filter-button.active {
    background: var(--accent);
    color: #f9f6ef;
    border-color: rgba(20, 61, 52, 0.26);
}

.brand-filter-button.clear {
    background: rgba(255, 250, 242, 0.94);
}

.panel {
    padding: 18px;
    border-radius: 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
}

.page-copy h1 {
    margin: 6px 0 0;
    font-family: "Outfit", sans-serif;
    font-size: clamp(28px, 3.2vw, 36px);
    letter-spacing: -0.04em;
    line-height: 1;
}

.page-copy p:last-child {
    margin: 10px 0 0;
    max-width: 760px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
}

.page-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 14px;
    background: rgba(255, 250, 242, 0.78);
    color: var(--accent-strong);
    border: 1px solid var(--line);
    font-size: 12px;
    font-weight: 600;
    transition: transform 180ms ease, background 180ms ease;
}

.action-button:hover {
    transform: translateY(-1px);
}

.action-button.primary {
    background: var(--accent);
    color: #f9f6ef;
}

.action-button.secondary {
    background: var(--secondary-soft);
}

.action-button.danger {
    background: var(--danger-soft);
    color: var(--danger-text);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 12px;
    margin-bottom: 14px;
}

.section-head h2 {
    margin: 4px 0 0;
    font-family: "Outfit", sans-serif;
    font-size: clamp(18px, 2vw, 24px);
    line-height: 1;
}

.section-head span {
    max-width: 380px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    text-align: right;
}

.project-grid,
.office-grid,
.report-summary,
.filters-grid {
    display: grid;
    gap: 12px;
}

.compact-project-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.compact-project-card {
    min-height: 82px;
    padding: 12px;
    border-radius: 20px;
    aspect-ratio: auto;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 248, 238, 0.98);
}

.project-card strong {
    font-family: "Outfit", sans-serif;
    font-size: 16px;
    line-height: 1;
    letter-spacing: -0.03em;
}

.brand-stack {
    display: grid;
    gap: 12px;
}

.brand-card {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 250, 242, 0.94);
}

.brand-card[open] {
    border-color: var(--line-strong);
}

.brand-top {
    list-style: none;
    padding: 14px 16px;
    cursor: pointer;
}

.brand-top::-webkit-details-marker {
    display: none;
}

.brand-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-top strong {
    display: block;
    font-size: 15px;
}

.brand-top p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.detail-toggle {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    flex-shrink: 0;
}

.detail-toggle::before {
    content: "+";
    font-size: 16px;
    line-height: 1;
}

.brand-card[open] .detail-toggle::before {
    content: "-";
}

.office-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 16px;
}

.office-pills span {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(214, 179, 106, 0.1);
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.office-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.selection-placeholder {
    display: block;
    padding: 18px;
    border-radius: 18px;
    background: rgba(255, 250, 242, 0.76);
    border: 1px dashed rgba(214, 179, 106, 0.42);
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

.compact-office-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compact-office-card {
    min-height: 82px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(255, 248, 238, 0.98);
}

.office-card > span {
    display: block;
    color: var(--accent);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
}

.office-card strong {
    display: block;
    margin-top: 8px;
    font-size: 15px;
}

.interactive-card {
    width: 100%;
    text-align: left;
    align-items: stretch;
}

.entity-card-copy {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.entity-card-copy span {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(214, 179, 106, 0.18);
    color: var(--accent-strong);
    border: 1px solid rgba(214, 179, 106, 0.3);
    font-family: "Outfit", sans-serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.logo-badge-large {
    align-self: flex-end;
    min-width: 52px;
    min-height: 52px;
    padding: 0 14px;
    font-size: 14px;
}

.logo-badge-side {
    min-width: 52px;
    min-height: 52px;
    margin-bottom: 10px;
    font-size: 14px;
}

.office-detail-card {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
}

.entity-modal {
    position: fixed;
    inset: 0;
    z-index: 30;
}

.entity-modal[hidden] {
    display: none;
}

.entity-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(19, 50, 44, 0.34);
}

.entity-modal-panel {
    position: relative;
    z-index: 1;
    width: min(560px, calc(100% - 24px));
    margin: 60px auto;
    padding: 20px;
    border-radius: 24px;
    background: #fffaf2;
    border: 1px solid var(--line);
    box-shadow: 0 24px 54px rgba(19, 50, 44, 0.16);
}

.entity-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 16px;
    margin-bottom: 18px;
}

.entity-modal-head h2 {
    margin: 6px 0 0;
    font-family: "Outfit", sans-serif;
    font-size: 24px;
    line-height: 1;
}

.icon-button {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: rgba(214, 179, 106, 0.14);
    color: var(--accent-strong);
    font-size: 20px;
    line-height: 1;
}

.entity-form {
    display: grid;
    gap: 12px;
}

.entity-field {
    display: grid;
    gap: 6px;
}

.entity-field span {
    color: var(--muted);
    font-size: 11px;
}

.entity-field input,
.entity-field select {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 12px;
    outline: 0;
}

.entity-field input[readonly],
.entity-field select:disabled {
    background: rgba(250, 244, 236, 0.9);
    color: var(--text);
}

.entity-modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 18px;
}

.consultant-name-cell {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.expanded-report-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 14px;
}

.report-summary-card {
    padding: 14px;
    border-radius: 18px;
}

.report-summary-card span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.report-summary-card strong {
    display: block;
    margin-top: 10px;
    font-size: 18px;
    font-family: "Outfit", sans-serif;
}

.filters-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 12px;
}

.filter-field {
    display: grid;
    gap: 6px;
}

.filter-field span {
    color: var(--muted);
    font-size: 11px;
}

.filter-input-wrap {
    position: relative;
}

.filter-field input {
    width: 100%;
    min-height: 40px;
    padding: 0 38px 0 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 250, 242, 0.96);
    color: var(--text);
    font-size: 12px;
    outline: 0;
}

.filter-field input:focus {
    border-color: rgba(31, 95, 82, 0.28);
    box-shadow: 0 0 0 4px rgba(214, 179, 106, 0.16);
}

.clear-filter-button {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: rgba(214, 179, 106, 0.18);
    color: var(--accent-strong);
    font-size: 14px;
    line-height: 1;
}

.clear-filter-button[hidden] {
    display: none;
}

.sales-count-bar {
    margin-bottom: 10px;
}

.sales-count-bar strong {
    color: var(--muted);
    font-size: 11px;
}

.table-wrap,
.nested-table-wrap {
    overflow-x: auto;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 250, 242, 0.96);
}

.nested-table-wrap {
    margin-top: 6px;
}

.sales-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
}

.sales-table th,
.sales-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
}

.sales-table th {
    background: rgba(214, 179, 106, 0.12);
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.sales-table td {
    font-size: 12px;
}

.summary-row td {
    background: rgba(255, 250, 242, 0.86);
}

.nested-level td {
    background: rgba(248, 244, 236, 0.92);
}

.nested-level.deeper td {
    background: rgba(240, 245, 239, 0.92);
}

.expand-button {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid rgba(214, 179, 106, 0.32);
    color: var(--accent);
    font-size: 16px;
    transition: transform 180ms ease, background 180ms ease;
}

.expand-button:hover {
    transform: translateY(-1px);
    background: rgba(214, 179, 106, 0.24);
}

.detail-row td {
    padding-top: 0;
    background: rgba(255, 250, 242, 0.9);
}

.empty-state {
    color: var(--muted);
    text-align: center;
}

@media (max-width: 1100px) {
    .compact-project-grid,
    .compact-office-grid,
    .expanded-report-summary,
    .filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .page-header {
        flex-direction: column;
        align-items: start;
    }

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

    .section-head {
        flex-direction: column;
        align-items: start;
    }

    .section-head span {
        max-width: none;
        text-align: left;
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100% - 20px, 100%);
        padding-top: 14px;
    }

    .topbar,
    .panel,
    .project-card,
    .office-card {
        border-radius: 18px;
    }

    .compact-project-grid,
    .compact-office-grid,
    .expanded-report-summary,
    .filters-grid {
        grid-template-columns: 1fr;
    }

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

    .logo-badge-side {
        margin-bottom: 0;
    }

    .entity-modal-panel {
        margin: 20px auto;
        padding: 16px;
    }
}
