: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:
        radial-gradient(circle at top left, rgba(214, 179, 106, 0.26), transparent 24rem),
        linear-gradient(180deg, #f5efe4 0%, var(--bg) 38%, var(--bg-soft) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(19, 50, 44, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(19, 50, 44, 0.025) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(circle at center, #000 48%, transparent 96%);
    pointer-events: 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: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.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: linear-gradient(135deg, rgba(214, 179, 106, 0.22), rgba(255, 250, 242, 0.72));
    color: var(--accent-strong);
    border: 1px solid rgba(214, 179, 106, 0.34);
    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,
.brand-filter-button.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    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: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #f9f6ef;
}

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

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

.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: center;
    gap: 6px;
    background: linear-gradient(180deg, rgba(214, 179, 106, 0.18) 0%, rgba(255, 250, 242, 0.98) 100%);
}

.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: linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(240, 245, 239, 0.92));
}

.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;
}

.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;
    }
}

@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;
    }
}
