:root {
    --bg: #f6f4fb;
    --bg-deep: #ece8f7;
    --surface: #ffffff;
    --panel: #ffffff;
    --panel-strong: #f8f7fc;
    --ink: #171321;
    --ink-soft: #5f596b;
    --muted: #827b91;
    --line: rgba(89, 78, 116, 0.12);
    --line-strong: rgba(89, 78, 116, 0.22);
    --accent: #7c3aed;
    --accent-strong: #5b21b6;
    --accent-contrast: #ffffff;
    --accent-soft: rgba(124, 58, 237, 0.1);
    --teal: #0f766e;
    --teal-soft: rgba(15, 118, 110, 0.1);
    --gold: #a16207;
    --gold-soft: rgba(245, 158, 11, 0.12);
    --danger: #be123c;
    --danger-soft: rgba(225, 29, 72, 0.1);
    --positive: #047857;
    --negative: #be123c;
    --shadow: 0 18px 38px rgba(35, 23, 63, 0.08);
    --shadow-soft: 0 10px 24px rgba(35, 23, 63, 0.06);
    --radius: 10px;
    --radius-sm: 8px;
    --font-sans: "Alexandria", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
    --font-display: "Alexandria", "Noto Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    color: var(--ink);
    font-family: var(--font-sans);
    background:
        linear-gradient(180deg, #fbfaff 0, var(--bg) 360px),
        var(--bg);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(124, 58, 237, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(124, 58, 237, 0.035) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.28), transparent 64%);
}

a {
    color: inherit;
    text-decoration: none;
}

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

.app-shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(100%, 460px);
    padding: 28px;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.compact-brand {
    margin-bottom: 24px;
}

.compact-brand h1 {
    margin: 2px 0 0;
    font-size: 1.6rem;
}

.login-form {
    display: grid;
    gap: 16px;
}

.login-form label {
    display: grid;
    gap: 8px;
}

.login-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 13px 14px;
    background: #ffffff;
    color: var(--ink);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow-y: auto;
    background: linear-gradient(180deg, #ffffff, #f7f4ff);
    color: var(--ink);
    border-left: 1px solid var(--line);
    box-shadow: 10px 0 30px rgba(35, 23, 63, 0.06);
}

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

.brand-mark {
    width: 70px;
    height: 70px;
    flex: 0 0 70px;
    position: relative;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 8px;
    border-radius: 14px;
    background:
        linear-gradient(145deg, rgba(124, 58, 237, 0.14), rgba(15, 118, 110, 0.06)),
        #ffffff;
    border: 1px solid var(--line-strong);
    box-shadow: var(--shadow-soft);
}

.brand-mark img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 10px;
}

.brand-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 5px 8px 4px;
    border-radius: 8px;
    background: var(--accent-strong);
    color: #ffffff;
    border: 1px solid var(--line-strong);
    box-shadow: 0 8px 18px rgba(91, 33, 182, 0.2);
    font-family: var(--font-sans);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.brand-kicker,
.sidebar-eyebrow,
.eyebrow {
    margin: 0;
    font-size: 0.79rem;
    letter-spacing: 0;
    text-transform: uppercase;
}

.brand-kicker {
    color: var(--ink-soft);
}

.brand h2,
.panel h3,
.member-head h3,
.hero-panel h2,
.topbar h1 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
}

.brand h2 {
    font-size: 1.25rem;
    line-height: 1.1;
}

.nav-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.nav-section-title {
    margin: 12px 6px 4px;
    color: var(--muted);
    font-size: 0.73rem;
    font-weight: 700;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    border: 1px solid transparent;
    transition: 150ms ease;
}

.nav-link span {
    display: inline-grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 7px;
    background: #f1eefb;
    font-size: 0.92rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent-strong);
    background: #f4f0ff;
    border-color: rgba(124, 58, 237, 0.18);
    box-shadow: inset 3px 0 0 var(--accent);
    transform: translateX(-2px);
}

.nav-link:hover span,
.nav-link.active span {
    background: #ede7ff;
}

.sidebar-card {
    padding: 16px;
    border-radius: var(--radius);
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.sidebar-card h3,
.sidebar-card p {
    margin: 0;
}

.sidebar-card h3 {
    margin-top: 8px;
    font-size: 1.15rem;
}

.sidebar-card p {
    margin-top: 6px;
    color: var(--ink-soft);
    line-height: 1.7;
}

.ghost-link {
    margin-top: auto;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--line);
    color: var(--accent-strong);
    background: #f4f0ff;
    font-weight: 700;
}

.content {
    padding: 32px;
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.topbar h1 {
    color: #171321;
    font-size: clamp(1.75rem, 3vw, 2.45rem);
    line-height: 1.18;
}

.subtitle {
    max-width: 720px;
    margin: 10px 0 0;
    color: var(--ink-soft);
    line-height: 1.8;
}

.topbar-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}

.brand > div,
.topbar > div,
.panel-heading > div {
    min-width: 0;
}

.meta-chip {
    flex: 0 1 104px;
    min-width: 96px;
    padding: 9px 12px;
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.meta-label {
    display: block;
    margin-bottom: 3px;
    color: var(--ink-soft);
    font-size: 0.76rem;
}

.meta-chip strong {
    display: block;
    font-size: 0.9rem;
    line-height: 1.25;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    box-shadow: var(--shadow);
}

.flash-success {
    background: var(--teal-soft);
    border-color: rgba(45, 212, 191, 0.28);
}

.flash-error {
    background: var(--danger-soft);
    border-color: rgba(255, 122, 148, 0.22);
}

.flash button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 1.4rem;
    color: inherit;
}

.hero-panel,
.panel,
.member-card,
.wallet-card,
.period-card,
.metric-card,
.empty-state {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero-panel {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 26px 28px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    background:
        linear-gradient(135deg, rgba(124, 58, 237, 0.1), rgba(15, 118, 110, 0.05)),
        #ffffff;
    border-color: rgba(124, 58, 237, 0.16);
    animation: rise-in 420ms ease;
}

.hero-copy {
    margin: 8px 0 0;
    color: var(--ink-soft);
    line-height: 1.9;
}

.hero-actions,
.button-row,
.pagination-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: stretch;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
    text-align: center;
}

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

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.button-primary {
    color: var(--accent-contrast);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    box-shadow: 0 14px 24px rgba(91, 33, 182, 0.18);
}

.button-muted {
    color: var(--accent-strong);
    background: #ffffff;
    border: 1px solid var(--line);
}

.button-muted:hover {
    border-color: rgba(124, 58, 237, 0.3);
    background: #f8f5ff;
}

.text-link {
    color: var(--accent);
    font-weight: 600;
}

.metric-grid,
.card-grid,
.dashboard-grid {
    display: grid;
    gap: 18px;
}

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

.small-gap {
    gap: 14px;
}

.metric-card {
    padding: 22px;
    border-radius: var(--radius);
    animation: rise-in 420ms ease;
}

.metric-card p,
.metric-card span {
    margin: 0;
    color: var(--ink-soft);
}

.metric-card h3 {
    margin: 12px 0 8px;
    font-size: clamp(1.55rem, 2.4vw, 2.1rem);
}

.metric-card.accent {
    background:
        linear-gradient(145deg, rgba(124, 58, 237, 0.12), rgba(15, 118, 110, 0.06)),
        var(--panel);
    border-color: rgba(124, 58, 237, 0.2);
}

.split-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.split-layout.dense {
    align-items: start;
}

.dashboard-grid {
    grid-template-columns: 1.25fr 0.95fr;
    margin-bottom: 24px;
}

.dashboard-grid > *,
.split-layout > *,
.metric-grid > *,
.card-grid > * {
    min-width: 0;
    overflow: hidden;
}

.panel,
.member-card,
.wallet-card,
.period-card,
.empty-state {
    padding: 22px;
    border-radius: var(--radius);
}

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

.panel-heading form,
.button-row form,
.pagination-row form {
    flex: 0 0 auto;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid label,
.inline-form label {
    display: grid;
    gap: 8px;
    color: var(--ink-soft);
}

.compact-form {
    gap: 10px;
}

.field-span-2 {
    grid-column: 1 / -1;
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 14px;
    flex-wrap: wrap;
}

.top-gap {
    margin-top: 16px;
}

input,
textarea,
select {
    width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: #ffffff;
    padding: 0 14px;
    color: var(--ink);
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

input,
select {
    min-height: 48px;
}

textarea {
    min-height: 140px;
    padding: 14px;
    resize: vertical;
}

select[multiple] {
    min-height: 180px;
    padding: 14px;
}

input:focus,
textarea:focus,
select:focus {
    border-color: rgba(124, 58, 237, 0.56);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.12);
}

.table-shell {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #ffffff;
    max-width: 100%;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

th,
td {
    padding: 14px 16px;
    text-align: right;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    color: var(--ink-soft);
    font-size: 0.88rem;
    background: #f8f7fc;
}

tbody tr:hover {
    background: rgba(124, 58, 237, 0.045);
}

tr:last-child td {
    border-bottom: 0;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.84rem;
}

.pill-positive {
    background: var(--teal-soft);
    color: var(--positive);
}

.pill-negative {
    background: var(--danger-soft);
    color: var(--negative);
}

.pill-soft {
    background: #f1eefb;
    color: var(--ink);
}

.member-head,
.activity-row,
.timeline-item,
.spotlight-row,
.sub-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.member-head-actions {
    display: grid;
    justify-items: end;
    gap: 10px;
}

.table-link {
    color: var(--accent);
    font-weight: 600;
}

.table-link:hover,
.text-link:hover {
    text-decoration: underline;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
}

.checkbox-field input {
    width: 18px;
    min-height: auto;
    margin: 0;
}

.notes-grid {
    align-items: start;
}

.note-card-large {
    display: grid;
    gap: 14px;
    padding: 20px;
}

.note-card-pinned {
    background:
        linear-gradient(145deg, rgba(246, 217, 141, 0.12), rgba(139, 92, 246, 0.1)),
        var(--panel);
}

.note-body {
    margin: 0;
    color: var(--ink);
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.note-meta {
    background: #f8f7fc;
}

.member-head p,
.activity-row p,
.timeline-item p,
.spotlight-row p {
    margin: 6px 0 0;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.member-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.member-metrics span {
    display: block;
    margin-bottom: 8px;
    color: var(--ink-soft);
    font-size: 0.88rem;
}

.member-metrics strong {
    display: block;
    line-height: 1.7;
}

.mini-divider {
    height: 1px;
    margin: 16px 0;
    background: linear-gradient(to left, transparent, var(--line), transparent);
}

.stack-list,
.activity-list,
.timeline-list,
.note-list,
.sub-list,
.member-spotlight {
    display: grid;
    gap: 12px;
}

.stack-list.compact,
.activity-list,
.timeline-list,
.member-spotlight,
.sub-list {
    gap: 10px;
}

.stack-item,
.activity-row,
.timeline-item,
.spotlight-row,
.note-card {
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: #faf9fd;
    border: 1px solid var(--line);
}

.stack-item,
.activity-row,
.spotlight-row,
.sub-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.action-stack-item {
    flex-wrap: wrap;
}

.inline-select {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-soft);
}

.inline-select select {
    min-width: 150px;
}

.logout-form {
    display: flex;
}

.stack-item > *,
.activity-row > *,
.spotlight-row > *,
.sub-row > *,
.member-head > *,
.timeline-item > * {
    min-width: 0;
}

.stack-item strong,
.activity-row strong,
.spotlight-row strong,
.sub-row strong,
.member-head strong,
.timeline-item strong,
.stack-item span,
.activity-row span,
.spotlight-row span,
.sub-row span {
    overflow-wrap: anywhere;
}

.salary-due-value {
    display: grid;
    justify-items: end;
    gap: 3px;
    flex: 0 0 auto;
    min-width: max-content;
    font-weight: 800;
    white-space: nowrap;
}

.salary-due-value small {
    color: var(--ink-soft);
    font-size: 0.74rem;
    font-weight: 600;
}

.timeline-item {
    align-items: start;
}

.timeline-stats {
    display: grid;
    gap: 6px;
    color: var(--ink-soft);
    text-align: left;
}

.note-card h4 {
    margin: 0 0 8px;
}

.note-card p,
.sub-list-title,
.empty-text {
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.8;
}

.sub-list-title {
    font-size: 0.88rem;
}

.empty-cell {
    text-align: center;
    color: var(--ink-soft);
}

.is-positive {
    color: var(--positive);
}

.is-negative {
    color: var(--negative);
}

.pagination-row {
    justify-content: space-between;
    margin-top: 16px;
}

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

.muted-card {
    opacity: 0.78;
}

.open-period {
    background:
        linear-gradient(145deg, rgba(124, 58, 237, 0.1), rgba(15, 118, 110, 0.05)),
        var(--panel);
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.empty-state h2 {
    margin: 10px 0;
    font-family: var(--font-display);
    font-size: 2rem;
}

.empty-state p {
    margin: 0;
    max-width: 640px;
    color: var(--ink-soft);
    line-height: 1.9;
    overflow-wrap: anywhere;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Hamburger Menu Button ===== */
.menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1100;
    width: 48px;
    height: 48px;
    padding: 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--panel-strong);
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 250ms ease, opacity 250ms ease;
}

.sidebar-open .menu-toggle span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.sidebar-open .menu-toggle span:nth-child(2) {
    opacity: 0;
}

.sidebar-open .menu-toggle span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== Sidebar Overlay ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(2, 6, 23, 0.68);
    opacity: 0;
    transition: opacity 300ms ease;
}

.sidebar-open .sidebar-overlay {
    display: block;
    opacity: 1;
}

/* ===== Desktop ≤1200px ===== */
@media (max-width: 1200px) {
    .metric-grid,
    .member-metrics,
    .card-grid,
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .content {
        padding: 24px;
    }
}

/* ===== ≤980px — Sidebar becomes slide-out drawer ===== */
@media (max-width: 980px) {
    .menu-toggle {
        display: flex;
    }

    .sidebar-overlay {
        display: none;
    }

    .sidebar-open .sidebar-overlay {
        display: block;
    }

    .app-shell {
        grid-template-columns: 1fr;
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 280px;
        height: 100vh;
        height: 100dvh;
        z-index: 1000;
        border-left: 1px solid rgba(255, 255, 255, 0.08);
        transform: translateX(100%);
        transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-open .sidebar {
        transform: translateX(0);
    }

    .content {
        padding: 20px;
        padding-top: 72px;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .topbar,
    .hero-panel,
    .empty-state {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-meta {
        justify-content: flex-start;
    }

    .split-layout,
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .metric-grid,
    .member-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .hero-panel {
        padding: 20px;
    }

    .hero-actions {
        flex-direction: column;
    }

    .hero-actions .button {
        width: 100%;
    }

    .button-row,
    .pagination-row {
        justify-content: flex-start;
    }
}

/* ===== ≤640px — Phone layout ===== */
@media (max-width: 640px) {
    .content {
        padding: 14px;
        padding-top: 66px;
        word-break: break-word;
    }

    .sidebar {
        width: 270px;
        padding: 16px 14px;
        gap: 16px;
    }

    .brand-mark {
        width: 48px;
        height: 48px;
        border-radius: var(--radius);
        font-size: 0.9rem;
    }

    .brand-badge {
        left: 4px;
        bottom: 4px;
        padding: 3px 6px;
        font-size: 0.48rem;
        letter-spacing: 0.12em;
    }

    .brand h2 {
        font-size: 1.15rem;
    }

    .nav-list {
        flex-direction: column;
        gap: 6px;
    }

    .nav-link {
        padding: 11px 14px;
        border-radius: var(--radius-sm);
        font-size: 0.92rem;
    }

    .sidebar-card {
        padding: 14px;
        border-radius: var(--radius);
    }

    .sidebar-card h3 {
        font-size: 1rem;
    }

    .topbar {
        margin-bottom: 16px;
        gap: 12px;
    }

    .topbar h1 {
        font-size: 1.5rem;
    }

    .topbar-meta {
        flex-direction: column;
        gap: 8px;
    }

    .meta-chip {
        flex: 0 1 auto;
        padding: 8px 10px;
        border-radius: var(--radius);
    }

    .panel,
    .member-card,
    .wallet-card,
    .period-card,
        .metric-card,
        .empty-state,
        .hero-panel {
        padding: 16px;
        border-radius: var(--radius);
    }

    .metric-grid,
    .member-metrics {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .metric-card h3 {
        font-size: 1.4rem;
        margin: 8px 0 4px;
    }

    .panel-heading {
        gap: 10px;
    }

    .hero-panel {
        padding: 16px;
        gap: 14px;
    }

    .hero-copy {
        font-size: 0.92rem;
        line-height: 1.7;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .field-span-2 {
        grid-column: auto;
    }

    .inline-form {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    input, select {
        min-height: 46px;
        border-radius: var(--radius-sm);
    }

    textarea {
        min-height: 120px;
        border-radius: var(--radius-sm);
    }

    .button {
        width: 100%;
        padding: 12px 16px;
        border-radius: var(--radius-sm);
        font-size: 0.92rem;
    }

    .button-row {
        flex-direction: column;
        gap: 8px;
    }

    .button-row > *,
    .pagination-row > * {
        width: 100%;
    }

    .member-head,
    .activity-row,
    .timeline-item,
    .spotlight-row,
    .sub-row,
    .stack-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .member-head-actions {
        justify-items: start;
    }

    .stack-item,
    .activity-row,
    .timeline-item,
        .spotlight-row,
        .note-card {
        padding: 12px 14px;
        border-radius: var(--radius-sm);
    }

    .table-shell {
        border-radius: var(--radius);
        max-width: calc(100vw - 28px);
    }

    th, td {
        padding: 10px;
        font-size: 0.88rem;
    }

    table {
        min-width: 420px;
    }

    .subtitle {
        font-size: 0.9rem;
        line-height: 1.7;
    }

    select[multiple] {
        min-height: 140px;
    }

    .flash {
        padding: 14px;
        border-radius: var(--radius);
        font-size: 0.92rem;
    }

    .empty-state h2 {
        font-size: 1.4rem;
    }

    .pill {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
}

/* ===== ≤480px — Small phone ===== */
@media (max-width: 480px) {
    .content {
        padding: 10px;
        padding-top: 60px;
    }

    .sidebar {
        width: 250px;
        padding: 14px 12px;
    }

    .menu-toggle {
        top: 10px;
        right: 10px;
        width: 42px;
        height: 42px;
        border-radius: var(--radius);
    }

    .brand-mark {
        width: 42px;
        height: 42px;
        border-radius: var(--radius);
        font-size: 0.85rem;
    }

    .brand-badge {
        display: none;
    }

    .brand h2 {
        font-size: 1.05rem;
    }

    .topbar h1 {
        font-size: 1.3rem;
    }

    .panel h3,
    .member-head h3,
    .hero-panel h2 {
        font-size: 1rem;
    }

    .panel,
    .member-card,
    .wallet-card,
    .period-card,
        .metric-card,
        .empty-state,
        .hero-panel {
        padding: 12px;
        border-radius: var(--radius);
    }

    .metric-card h3 {
        font-size: 1.2rem;
    }

    .meta-chip {
        padding: 10px 12px;
        border-radius: var(--radius);
    }

    .stack-item,
    .activity-row,
    .timeline-item,
        .spotlight-row,
        .note-card {
        padding: 10px 12px;
        border-radius: var(--radius-sm);
    }

    input, select {
        min-height: 42px;
        border-radius: var(--radius-sm);
    }

    .button {
        padding: 10px 14px;
        font-size: 0.88rem;
        border-radius: var(--radius-sm);
    }

    table {
        min-width: 380px;
    }

    th, td {
        padding: 8px;
        font-size: 0.84rem;
    }
}
