:root {
    --bg: linear-gradient(180deg, #fff7e8 0%, #f7fbff 45%, #eef9ff 100%);
    --panel: rgba(255, 255, 255, 0.92);
    --panel-border: rgba(255, 183, 76, 0.26);
    --text: #243248;
    --subtext: #6f7c92;
    --brand: #ff8c42;
    --brand-strong: #f46f16;
    --accent: #18b2a3;
    --danger: #d65252;
    --warning: #d59a15;
    --shadow: 0 20px 48px rgba(31, 48, 79, 0.12);
    --radius: 22px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background: var(--bg);
    font-family: "Segoe UI", "PingFang SC", sans-serif;
}

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

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

.layout-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 20px 16px 100px;
}

body.mobile-body .layout-shell {
    max-width: 540px;
    padding: 12px 12px 108px;
}

.topbar,
.panel,
.stat-card,
.chart-card,
.list-card,
.detail-card,
.auth-card,
.mobile-record-card {
    background: var(--panel);
    backdrop-filter: blur(18px);
    border: 1px solid var(--panel-border);
    box-shadow: var(--shadow);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border-radius: 24px;
    margin-bottom: 16px;
}

.topbar-mobile {
    position: sticky;
    top: 8px;
    z-index: 10;
    padding: 14px 16px;
    border-radius: 20px;
}

.topbar h1,
h2,
h3,
h4,
p {
    margin: 0;
}

.eyebrow {
    margin-bottom: 6px;
    color: var(--brand-strong);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-content {
    display: grid;
    gap: 14px;
}

.panel,
.detail-card,
.list-card,
.chart-card,
.stat-card,
.auth-card {
    border-radius: var(--radius);
    padding: 16px;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.flash {
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
}

.flash-success {
    background: rgba(24, 178, 163, 0.14);
    color: #0d7269;
}

.flash-error {
    background: rgba(214, 82, 82, 0.14);
    color: #9c2f2f;
}

.primary-btn,
.ghost-btn,
.link-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
}

.primary-btn:disabled,
.ghost-btn:disabled,
.link-btn:disabled,
.danger-btn:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.is-loading {
    position: relative;
    pointer-events: none;
}

.is-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-right-color: transparent;
    animation: button-spin 0.7s linear infinite;
}

.primary-btn {
    background: linear-gradient(120deg, var(--brand), var(--brand-strong));
    color: #fff;
}

.ghost-btn {
    background: rgba(255, 140, 66, 0.12);
    color: var(--brand-strong);
}

.link-btn {
    background: rgba(24, 178, 163, 0.12);
    color: var(--accent);
}

.danger-btn {
    background: rgba(214, 82, 82, 0.12);
    color: var(--danger);
}

.auth-card {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 20px;
    max-width: 900px;
    margin: 8vh auto;
    padding: 26px;
}

.auth-copy {
    min-height: 280px;
    padding: 22px;
    border-radius: 20px;
    background:
        radial-gradient(circle at top left, rgba(255, 140, 66, 0.18), transparent 58%),
        radial-gradient(circle at bottom right, rgba(24, 178, 163, 0.18), transparent 44%);
}

.form-grid {
    display: grid;
    gap: 14px;
}

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

.form-grid label {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: var(--subtext);
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(90, 118, 164, 0.18);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
}

textarea {
    min-height: 96px;
    resize: vertical;
}

.field-hidden {
    display: none !important;
}

.stat-grid,
.card-grid,
.admin-grid,
.mobile-card-stack,
.split-card {
    display: grid;
    gap: 14px;
}

.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.card-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.admin-grid {
    grid-template-columns: 1.3fr 0.7fr;
    align-items: start;
}

.split-card {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

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

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.toolbar .actions,
.inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.inline-actions form {
    margin: 0;
}

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

.sticky-panel {
    position: sticky;
    top: 12px;
    z-index: 8;
}

.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(79, 96, 120, 0.1);
    color: #4f6078;
}

.mobile-record-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border-radius: 20px;
}

.record-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.record-head-main {
    min-width: 0;
}

.record-head-main h3 {
    font-size: 18px;
}

.record-amount {
    text-align: right;
}

.record-amount span {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--subtext);
}

.record-amount strong {
    font-size: 18px;
    color: var(--brand-strong);
}

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

.record-item {
    padding: 12px;
    border-radius: 14px;
    background: rgba(247, 250, 255, 0.88);
}

.record-item span {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--subtext);
}

.record-item strong,
.record-item a {
    word-break: break-word;
}

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

.filter-panel details {
    border-radius: 18px;
    background: rgba(248, 250, 255, 0.9);
}

.filter-panel summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    font-weight: 600;
}

.filter-panel summary::-webkit-details-marker {
    display: none;
}

.filter-content {
    padding: 0 16px 16px;
}

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

.choice-card {
    display: block;
    cursor: pointer;
}

.choice-card input {
    display: none;
}

.choice-card span {
    display: grid;
    gap: 6px;
    min-height: 88px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(102, 130, 170, 0.14);
    background: rgba(247, 250, 255, 0.9);
}

.choice-card input:checked + span {
    border-color: rgba(244, 111, 22, 0.35);
    background: rgba(255, 140, 66, 0.12);
}

.flow-panels {
    display: grid;
    gap: 14px;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.list-table th,
.list-table td {
    padding: 12px 8px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(102, 130, 170, 0.12);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(24, 178, 163, 0.12);
    color: #0d7269;
    font-size: 12px;
}

.status-pending {
    background: rgba(213, 154, 21, 0.14);
    color: #9b6c05;
}

.status-rejected,
.status-deleted {
    background: rgba(214, 82, 82, 0.14);
    color: #9c2f2f;
}

.status-withdrawn {
    background: rgba(90, 118, 164, 0.14);
    color: #4f6078;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.detail-item {
    padding: 14px;
    border-radius: 16px;
    background: rgba(247, 250, 255, 0.88);
}

.detail-item span {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--subtext);
}

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

.image-card {
    display: block;
    overflow: hidden;
    border-radius: 16px;
    background: rgba(247, 250, 255, 0.9);
    border: 1px solid rgba(102, 130, 170, 0.12);
}

.image-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.image-card span {
    display: block;
    padding: 10px 12px;
    font-size: 12px;
    color: var(--subtext);
}

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

.preview-item {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    background: rgba(247, 250, 255, 0.9);
    border: 1px solid rgba(102, 130, 170, 0.12);
}

.preview-item.is-uploading::after {
    content: "";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(36, 50, 72, 0.55);
    border-right-color: transparent;
    animation: button-spin 0.7s linear infinite;
}

.preview-item img {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.preview-item span {
    display: block;
    padding: 8px 10px;
    font-size: 12px;
    color: var(--subtext);
}

.preview-remove {
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    padding: 8px 10px;
    border: none;
    border-radius: 10px;
    background: rgba(214, 82, 82, 0.12);
    color: var(--danger);
    cursor: pointer;
}

.upload-success {
    color: #0d7269;
}

.upload-error {
    color: #9c2f2f;
}

.chart-row {
    display: grid;
    gap: 12px;
}

.chart-bars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: end;
    gap: 10px;
    min-height: 160px;
}

.bar {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 20px;
    padding-bottom: 8px;
    border-radius: 16px 16px 6px 6px;
    color: #fff;
    font-size: 12px;
}

.bar-payment {
    background: linear-gradient(180deg, #ffb067, #ff7c3a);
}

.bar-offset {
    background: linear-gradient(180deg, #46d9ca, #14aa9b);
}

.bar-delegate {
    background: linear-gradient(180deg, #81a7ff, #4f73d9);
}

.mobile-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 40px rgba(23, 33, 59, 0.18);
}

.mobile-nav-finance {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.mobile-nav a {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 52px;
    padding: 8px 4px;
    border-radius: 16px;
    font-size: 12px;
    text-align: center;
}

.mobile-nav a.active {
    background: rgba(255, 140, 66, 0.12);
    color: var(--brand-strong);
}

.badge {
    position: absolute;
    top: 6px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
}

.muted {
    color: var(--subtext);
}

.amount-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--brand-strong);
}

.pre-wrap {
    white-space: pre-wrap;
}

@keyframes button-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .auth-card,
    .admin-grid,
    .form-grid.two-cols,
    .mobile-actions,
    .split-card {
        grid-template-columns: 1fr;
    }

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

    .list-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
