.page-hero {
    margin-bottom: 24px;
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
}

.page-hero-copy { display: flex; align-items: center; gap: 14px; }
.date-label {
    color: #8b97a8;
    font-size: .67rem;
    font-weight: 700;
    text-transform: capitalize;
}

.page-hero h1 {
    margin: 4px 0 4px;
    color: var(--navy);
    font-size: clamp(1.55rem, 2.2vw, 2.15rem);
    letter-spacing: -.045em;
}

.page-hero p { margin: 0; color: var(--muted); font-size: .78rem; }
.hero-actions { display: flex; align-items: center; gap: 8px; }
.filter-control { position: relative; }
.filter-count {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font-size: .55rem;
}

.filter-popover {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 50;
    width: 290px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 20px 48px rgba(27,43,70,.14);
}

.filter-popover-head {
    margin-bottom: 11px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.filter-popover-head > div { display: grid; gap: 3px; }
.filter-popover-head strong { font-size: .74rem; }
.filter-popover-head small { color: var(--muted); font-size: .6rem; }
.filter-options { display: grid; gap: 5px; }

.filter-option {
    min-height: 38px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #526178;
    cursor: pointer;
    font-size: .68rem;
    font-weight: 650;
}

.filter-option:hover { background: var(--soft); }
.filter-option.active { border-color: #d7e3ff; background: var(--accent-soft); color: var(--accent); }
.filter-option b {
    min-width: 23px;
    padding: 3px 6px;
    border-radius: 999px;
    background: #eef2f7;
    color: #728095;
    font-size: .56rem;
    text-align: center;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(310px, .86fr) minmax(0, 1.55fr);
    grid-template-areas:
        "summary activity"
        "leftstats history";
    gap: 14px;
}

.dashboard-card,
.small-stat-card,
.management-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--soft);
}

.dashboard-card { padding: 18px; }
.summary-card { position: relative; grid-area: summary; }
.activity-card { grid-area: activity; }
.history-card { grid-area: history; }
.left-stats {
    grid-area: leftstats;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-content: start;
}

.management-card { grid-column: 1 / -1; }

.card-heading {
    margin-bottom: 16px;
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
}

.card-heading h2 { margin: 0; color: var(--navy); font-size: .88rem; letter-spacing: -.02em; }
.card-heading p { margin: 4px 0 0; color: var(--muted); font-size: .65rem; }

.period-button {
    min-height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: #5c687b;
    font-size: .66rem;
    font-weight: 700;
    cursor: pointer;
}

.period-button svg { width: 14px; height: 14px; }
.period-menu {
    position: absolute;
    top: 59px;
    right: 18px;
    z-index: 20;
    width: 145px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(27,43,70,.13);
}

.period-menu button {
    width: 100%;
    min-height: 34px;
    padding: 0 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #647087;
    text-align: left;
    cursor: pointer;
    font-size: .64rem;
}

.period-menu button:hover { background: var(--soft); }
.period-menu button.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.summary-metrics {
    padding: 14px 14px 12px;
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 15px 15px 0 0;
    background: #fff;
}

.summary-divider { width: 1px; height: 48px; background: var(--border); }

.summary-metric {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
}

.metric-button {
    padding: 5px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.metric-button:hover { background: var(--soft); }
.metric-icon,
.mini-icon,
.small-stat-label span {
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #eef3fa;
}

.metric-icon { width: 30px; height: 30px; color: var(--accent); }
.metric-icon svg, .small-stat-label svg { width: 15px; height: 15px; }
.summary-metric > span:last-child { display: grid; gap: 2px; }
.summary-metric small { color: #8d99aa; font-size: .59rem; }
.summary-metric strong { color: var(--navy); font-size: 1.15rem; letter-spacing: -.04em; }

.volume-chart {
    height: 174px;
    padding: 18px 12px 10px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    align-items: end;
    gap: 8px;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 15px 15px;
    background: #fff;
}

.bar-column {
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    gap: 7px;
}

.chart-bar {
    width: 100%;
    min-height: 25px;
    height: var(--bar-height);
    border-radius: 999px 999px 5px 5px;
    background: #dfe5ee;
    transition: .16s ease;
}

.chart-bar.active { background: linear-gradient(180deg, #5b86ee, var(--accent)); }
.chart-bar:hover { transform: translateY(-2px); filter: brightness(.98); }
.bar-column small { color: #96a1b1; font-size: .54rem; text-align: center; }

.heading-actions { display: flex; gap: 6px; }

.activity-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.activity-mini-card {
    min-height: 240px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 17px;
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: .18s ease;
}

.activity-mini-card:hover {
    border-color: #cfd9e7;
    box-shadow: 0 10px 26px rgba(27,43,70,.08);
    transform: translateY(-2px);
}

.activity-mini-card.attention {
    border-color: var(--navy);
    background: linear-gradient(145deg, var(--navy), var(--navy-2));
    color: #fff;
}

.mini-icon { width: 30px; height: 30px; margin-bottom: 18px; color: var(--accent); }
.mini-icon.warning { color: var(--amber); background: var(--amber-soft); }
.mini-icon.info { color: var(--accent); background: var(--accent-soft); }
.mini-icon svg { width: 15px; height: 15px; }
.attention .mini-icon { color: #ffcf72; background: rgba(255,255,255,.10); }

.activity-title { font-size: .76rem; font-weight: 750; letter-spacing: -.02em; }
.activity-mini-card small { margin-top: 3px; color: #8d99aa; font-size: .58rem; }
.activity-mini-card.attention small { color: rgba(255,255,255,.60); }
.activity-mini-card strong { margin-top: 12px; color: var(--navy); font-size: 1.25rem; letter-spacing: -.05em; }
.activity-mini-card.attention strong { color: #fff; }

.sparkline {
    height: 52px;
    margin-top: auto;
    display: flex;
    align-items: end;
    gap: 5px;
}

.sparkline span { flex: 1; border-radius: 999px; background: #cbd8f5; }
.sparkline.warning span { background: #f2dcb7; }
.sparkline.info span { background: #cbd8f5; }
.attention .sparkline span { background: rgba(255,201,103,.44); }

.card-action {
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent);
    font-size: .56rem;
    font-weight: 750;
}

.card-action svg { width: 12px; height: 12px; }
.attention .card-action { color: #ffd887; }

.small-stat-card {
    min-height: 118px;
    padding: 14px;
    border: 1px solid var(--border);
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: .16s ease;
}

.small-stat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(27,43,70,.07); }
.small-stat-label { display: flex; align-items: center; gap: 6px; color: #526078; font-size: .62rem; font-weight: 700; }
.small-stat-label span { width: 24px; height: 24px; }
.stat-success .small-stat-label span { color: var(--green); background: var(--green-soft); }
.stat-neutral .small-stat-label span { color: #728096; background: #eef2f7; }
.small-stat-card > strong { display: block; margin-top: 14px; color: var(--navy); font-size: 1.12rem; letter-spacing: -.04em; }
.small-stat-card > small { display: block; margin-top: 3px; color: #8e99aa; font-size: .55rem; line-height: 1.35; }

.management-card {
    min-height: 73px;
    padding: 14px 15px;
    display: grid;
    grid-template-columns: 34px minmax(0,1fr) 34px;
    align-items: center;
    gap: 11px;
    background: linear-gradient(90deg, #fff7e8, #fff);
}

.management-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--amber);
    background: var(--amber-soft);
}

.management-icon svg { width: 16px; height: 16px; }
.management-card > div:nth-child(2) { display: grid; gap: 3px; }
.management-card strong { color: #6c511d; font-size: .7rem; }
.management-card small { color: #9a855d; font-size: .56rem; }
.management-card a {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff2d8;
    color: #8a681f;
}
.management-card a:hover { background: #ffe9bd; }

.history-card { min-width: 0; }
.history-heading { align-items: center; }
.history-tools { display: flex; align-items: center; gap: 7px; }

.table-search {
    min-width: 210px;
    height: 38px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
}

.table-search svg { width: 14px; height: 14px; color: #8e99aa; }
.table-search input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: .62rem;
}
.table-search input::placeholder { color: #99a4b4; }

.active-filter {
    margin: -4px 0 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #d9e4fb;
    border-radius: 10px;
    background: var(--accent-soft);
    color: #46628e;
    font-size: .59rem;
}

.active-filter button {
    border: 0;
    background: transparent;
    color: var(--accent);
    cursor: pointer;
    font-size: .58rem;
    font-weight: 750;
}

.history-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #fff;
}

.history-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 13px 14px;
    border-bottom: 1px solid #edf1f6;
    text-align: left;
    white-space: nowrap;
}

.history-table th { color: #939faf; font-size: .55rem; font-weight: 700; text-transform: uppercase; }
.history-table td { color: #59667a; font-size: .64rem; }
.history-table td strong { color: var(--navy); }
.history-table tbody tr { transition: background .12s ease; }
.history-table tbody tr:hover { background: #f8faff; }
.history-table tr:last-child td { border-bottom: 0; }

.status-pill {
    padding: 4px 8px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px;
    font-size: .55rem;
    font-weight: 700;
}

.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pending { color: #a36f12; background: var(--amber-soft); }
.status-progress { color: #356ae6; background: var(--accent-soft); }
.status-received { color: #2f8e68; background: var(--green-soft); }
.status-archived { color: #718096; background: #eef2f7; }

.table-empty {
    min-height: 180px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 6px;
    color: #8e99aa;
    text-align: center;
}

.table-empty svg { width: 24px; height: 24px; }
.table-empty strong { color: #536176; font-size: .72rem; }
.table-empty span { font-size: .6rem; }

@media (max-width: 1120px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        grid-template-areas: "summary" "activity" "leftstats" "history";
    }
    .activity-mini-card { min-height: 200px; }
}

@media (max-width: 760px) {
    .page-hero { align-items: stretch; flex-direction: column; }
    .hero-actions { overflow-x: auto; padding-bottom: 2px; }
    .hero-actions > * { flex: 0 0 auto; }
    .filter-popover { position: fixed; left: 16px; right: 16px; top: 82px; width: auto; }
    .activity-grid { grid-template-columns: 1fr; }
    .activity-mini-card { min-height: 175px; }
    .history-heading { align-items: stretch; flex-direction: column; }
    .history-tools { width: 100%; }
    .table-search { min-width: 0; flex: 1; }
}

@media (max-width: 460px) {
    .left-stats { grid-template-columns: 1fr; }
    .management-card { grid-column: auto; }
    .summary-metrics { grid-template-columns: 1fr; }
    .summary-divider { width: 100%; height: 1px; }
    .volume-chart { gap: 5px; }
}
