:root {
    --bg: #f6f3ee;
    --bg-soft: #fbfaf7;
    --surface: #ffffff;
    --surface-warm: #f4f0eb;
    --line: #e7ded6;
    --line-strong: #d8ccc2;
    --text: #241f1c;
    --muted: #7a716a;
    --muted-strong: #5f5751;
    --red: #c92a2a;
    --red-deep: #9f1d1d;
    --red-soft: #fff0ef;
    --accent: #c92a2a;
    --accent-soft: #fff0ef;
    --amber: #b7791f;
    --amber-soft: #fff6de;
    --blue: #2f6fb2;
    --blue-soft: #ecf4ff;
    --shadow: 0 14px 34px rgba(67, 54, 43, 0.08);
    --sidebar-width: 318px;
    --overlay-top-z-index: 2147483000;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--bg);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    letter-spacing: 0;
}

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

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

button {
    cursor: pointer;
}

svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #eee8e1;
}

::-webkit-scrollbar-thumb {
    background: #cfc2b7;
    border-radius: 999px;
}

.app-frame {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100vh;
    padding: 22px 18px;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(10px);
    overflow: hidden;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    overflow: hidden;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.brand-title {
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.brand-subtitle {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.side-nav {
    display: grid;
    gap: 6px;
    margin-bottom: 0;
}

.side-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    border: 1px solid transparent;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff5f2;
    color: #9b4545;
    font-weight: 650;
    text-align: left;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.side-nav-item:hover {
    background: #ffecea;
    border-color: #d8a0a0;
    color: #873636;
    transform: translateX(1px);
}

.side-nav-item.is-active {
    background: var(--red);
    border-color: var(--red);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(210, 43, 47, 0.18);
}

.side-nav-primary {
    border-color: #d8a0a0;
    background: #fff5f2;
    color: #9b4545;
    box-shadow: none;
}

.side-nav-primary:hover {
    background: #ffecea;
    border-color: #cf8c8c;
    color: #873636;
}

.side-nav-primary.side-nav-item.is-active {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
}

.side-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 6px;
    background: rgba(201, 42, 42, 0.08);
}

.side-nav-primary .side-nav-icon,
.side-nav-item.is-active .side-nav-icon {
    background: rgba(255, 255, 255, 0.18);
}

.sidebar-top {
    flex: 0 0 auto;
}

.sidebar-date-field {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.sidebar-date-field label {
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 800;
}

.sidebar-date-field input {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 7px 9px;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.review-date-input {
    position: relative;
    cursor: pointer;
    border-color: #ead1cc !important;
    border-radius: 8px !important;
    padding-right: 42px !important;
    background-color: #fffdfc !important;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23c92a2a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3C/svg%3E"),
        linear-gradient(180deg, #ffffff 0%, #fff8f6 100%) !important;
    background-repeat: no-repeat, no-repeat !important;
    background-position: right 12px center, center !important;
    background-size: 18px 18px, 100% 100% !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 18px rgba(139, 69, 56, 0.06);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.review-date-input:hover {
    border-color: #d8a0a0 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 10px 22px rgba(139, 69, 56, 0.1);
}

.review-date-input:focus {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px rgba(201, 42, 42, 0.12), 0 12px 24px rgba(139, 69, 56, 0.12) !important;
}

.review-date-input::-webkit-calendar-picker-indicator {
    display: none;
}

.sidebar-date-field input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(210, 43, 47, 0.1);
}

.sidebar-date-field p {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
}

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

.sidebar-config-modal {
    position: fixed;
    inset: 0;
    z-index: var(--overlay-top-z-index);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(42, 31, 27, 0.38);
    backdrop-filter: blur(6px);
}

body.config-modal-open {
    overflow: hidden;
}

.sidebar-config-panel {
    display: flex;
    flex: 0 1 auto;
    width: min(720px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    min-height: 0;
    flex-direction: column;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 24px 70px rgba(67, 54, 43, 0.18);
}

.sidebar-config-head {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.sidebar-config-head > div {
    min-width: 0;
}

.sidebar-config-head h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 900;
}

.sidebar-config-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.config-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff5f2;
    color: #9b4545;
    font-size: 20px;
    line-height: 1;
}

.config-modal-close:hover {
    border-color: #d8a0a0;
    background: #ffecea;
    color: #873636;
}

.sidebar-config-scroll {
    flex: 1 1 auto;
    min-height: 0;
    margin: 10px -4px 10px 0;
    padding-right: 4px;
    overflow-y: auto;
}

.sidebar-plan-panel {
    flex: 0 0 auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.sidebar-plan-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.sidebar-plan-status {
    min-height: 16px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.sidebar-plan-status.is-error {
    color: var(--red);
}

.sidebar-strategy-config {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.sidebar-strategy-config + .sidebar-strategy-config {
    margin-top: 10px;
}

.sidebar-config-note {
    margin-bottom: 10px;
    padding: 8px 10px;
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 12px;
}

.sidebar-field {
    display: grid;
    gap: 5px;
    margin-top: 9px;
}

.sidebar-field label {
    color: var(--muted-strong);
    font-size: 12px;
    font-weight: 800;
}

.sidebar-field input,
.sidebar-field select,
.sidebar-field textarea,
.form-field input,
.form-field select,
.form-field textarea,
.toolbar-input {
    width: 100%;
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    background: #ffffff;
    color: var(--text);
    outline: none;
}

.sidebar-field input:focus,
.sidebar-field select:focus,
.sidebar-field textarea:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.toolbar-input:focus {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(210, 43, 47, 0.1);
}

.sidebar-apply-btn,
.sidebar-reset-btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff5f2;
    color: #9b4545;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.sidebar-apply-btn {
    flex: 0 0 auto;
    width: 100%;
    border-color: #d8a0a0;
    background: #fff5f2;
    color: #9b4545;
}

.sidebar-config-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
}

.sidebar-reset-btn {
    border-color: var(--line);
    background: #fff5f2;
    color: #9b4545;
}

.sidebar-reset-btn:hover {
    border-color: var(--line-strong);
    color: var(--text);
}

.btn:hover {
    border-color: #d8a0a0;
    background: #ffecea;
}

.sidebar-apply-btn:hover,
.btn-primary:hover,
.btn-danger:hover {
    border-color: #d8a0a0;
    background: #ffecea;
    color: #873636;
}

.sidebar-bottom {
    flex: 0 0 auto;
}

.mask-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.mask-btn,
.logout-btn {
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff5f2;
    color: #9b4545;
    font-weight: 800;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.mask-btn:hover,
.btn-mask:hover {
    border-color: var(--red);
    background: var(--red-soft);
    color: var(--red-deep);
}

.mask-btn.is-active,
.btn-mask.is-active,
.btn.is-active {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(201, 42, 42, 0.16);
}

.logout-btn {
    width: 100%;
    color: var(--muted-strong);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.sidebar-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--red-soft);
    color: var(--red-deep);
    font-weight: 900;
}

.sidebar-user-meta {
    min-width: 0;
}

.sidebar-user-name {
    overflow: hidden;
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-user-role {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.app-main {
    min-width: 0;
    padding: 32px 36px 56px;
}

.disclaimer-banner {
    width: min(100%, 1164px);
    margin: 0 auto 18px;
    padding: 12px 16px;
    border: 2px solid #d83b2d;
    border-left-width: 6px;
    border-radius: 8px;
    background: #fff1ed;
    box-shadow: 0 8px 22px rgba(184, 35, 24, 0.14);
    color: #8f1d16;
    font-size: 14px;
    line-height: 1.55;
    font-weight: 850;
    text-align: center;
}

.content-shell {
    width: min(100%, 1164px);
    margin: 0 auto;
}

.top-action-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.page-title {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.18;
    font-weight: 850;
}

.page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    color: var(--muted);
    font-size: 13px;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.btn-primary {
    border-color: #d8a0a0;
    background: #fff5f2;
    color: #9b4545;
}

.btn-danger,
.btn-mask {
    border-color: var(--red);
    background: #fff5f2;
    color: #9b4545;
}

.btn-primary.is-active,
.btn-danger.is-active,
.sidebar-apply-btn.is-active {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.section {
    margin-top: 22px;
}

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

.section-title {
    margin: 0;
    font-size: 21px;
    line-height: 1.28;
    font-weight: 850;
}

.section-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 13px;
}

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

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    color: var(--muted-strong);
    font-size: 13px;
    font-weight: 750;
}

.sidebar-field-help {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.35;
}

.fupan-date-popover {
    position: fixed;
    z-index: 10050;
    display: none;
    padding: 12px;
    border: 1px solid #ead1cc;
    border-radius: 10px;
    background: rgba(255, 253, 252, 0.98);
    box-shadow: 0 24px 60px rgba(74, 45, 37, 0.18), 0 4px 14px rgba(74, 45, 37, 0.08);
    backdrop-filter: blur(12px);
}

.fupan-date-popover.is-open {
    display: block;
}

.date-picker-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.date-picker-title {
    color: var(--text);
    font-size: 15px;
    font-weight: 900;
    text-align: center;
}

.date-picker-nav {
    width: 34px;
    height: 34px;
    border: 1px solid #efd6d0;
    border-radius: 8px;
    background: #fff5f2;
    color: var(--red);
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
}

.date-picker-nav:hover {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
}

.date-picker-weekdays,
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.date-picker-weekdays {
    margin-bottom: 6px;
}

.date-picker-weekdays span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
    text-align: center;
}

.date-picker-day {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    min-height: 34px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
    transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.14s ease;
}

.date-picker-day:hover:not(:disabled) {
    border-color: #d8a0a0;
    background: #fff5f2;
    color: var(--red-deep);
    transform: translateY(-1px);
}

.date-picker-day.is-today:not(.is-selected) {
    border-color: #f0beb9;
    color: var(--red);
}

.date-picker-day.is-selected {
    border-color: var(--red);
    background: var(--red);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(201, 42, 42, 0.2);
}

.date-picker-day.is-outside,
.date-picker-day.is-disabled {
    background: #faf5f2;
    color: #c6b7ad;
    cursor: not-allowed;
    opacity: 0.68;
}

.date-picker-foot {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.form-field textarea {
    min-height: 108px;
    resize: vertical;
}

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

.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #f6f3ee 0%, #fff8f7 100%);
}

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

.login-card {
    width: min(100%, 430px);
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-brand {
    margin-bottom: 20px;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    line-height: 1.2;
}

.login-muted {
    margin: 0 0 18px;
    color: var(--muted);
}

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

.login-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 750;
}

.login-divider::before,
.login-divider::after {
    content: "";
    height: 1px;
    flex: 1 1 auto;
    background: var(--line);
}

.login-submit {
    width: 100%;
}

.login-disclaimer {
    width: 100%;
    margin: 18px 0 0;
    font-size: 12px;
}

.membership-page {
    min-height: 100vh;
    background: var(--bg);
}

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

.membership-card {
    width: min(100%, 980px);
    padding: 26px;
}

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

.membership-head h1 {
    margin: 0 0 8px;
    font-size: 28px;
    line-height: 1.2;
}

.membership-head p,
.membership-panel p {
    margin: 0;
    color: var(--muted);
}

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

.membership-status {
    margin: 20px 0;
}

.membership-state {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg-soft);
}

.membership-state > div {
    min-width: 0;
}

.membership-state span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
}

.membership-state strong {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
    font-size: 16px;
}

.membership-state.is-active {
    border-color: #b7dfcd;
    background: #f1fbf5;
}

.membership-state.is-expired {
    border-color: #f0c8c8;
    background: #fff5f5;
}

.membership-message {
    margin-top: 10px;
    font-weight: 800;
}

.membership-message.is-active {
    color: #237245;
}

.membership-message.is-expired {
    color: var(--red);
}

.membership-grid {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 16px;
}

.membership-panel {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.membership-panel h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.wechat-qr,
.wechat-qr-placeholder {
    width: 210px;
    height: 210px;
    margin-top: 18px;
    border-radius: 8px;
}

.wechat-qr {
    display: block;
    object-fit: cover;
    border: 1px solid var(--line);
}

.wechat-qr-placeholder {
    display: grid;
    place-items: center;
    padding: 16px;
    border: 1px dashed var(--line-strong);
    background: var(--bg-soft);
    color: var(--muted);
    text-align: center;
}

.wechat-qr-placeholder strong {
    display: block;
    margin-top: 6px;
    color: var(--text);
}

.membership-purchase {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--muted-strong);
}

.membership-buy-btn {
    flex: 0 0 auto;
}

.redeem-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 18px;
}

.redeem-form input {
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
}

.code-note-field {
    margin-top: 14px;
}

.generated-code-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.generated-code,
.code-copy-btn {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff5f2;
    color: #9b4545;
    font-family: Consolas, "Courier New", monospace;
    font-weight: 850;
}

.generated-code {
    min-height: 36px;
    padding: 7px 10px;
}

.code-copy-btn {
    padding: 4px 8px;
}

.redemption-filter-panel {
    padding: 18px;
}

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

.redemption-filter-actions {
    margin-top: 14px;
}

.redemption-result-meta {
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 820px) {
    .membership-head,
    .top-action-bar {
        flex-direction: column;
    }

    .membership-state,
    .membership-grid {
        grid-template-columns: 1fr;
    }

    .redeem-form {
        grid-template-columns: 1fr;
    }

    .membership-purchase {
        align-items: stretch;
        flex-direction: column;
    }

    .redemption-filter-grid {
        grid-template-columns: 1fr;
    }
}

.help-text {
    color: var(--muted);
    font-size: 12px;
}

.empty-state,
.loading-state,
.error-state {
    padding: 26px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: var(--bg-soft);
    color: var(--muted);
    text-align: center;
}

.error-state {
    color: var(--red);
    border-color: #e9b6b6;
    background: #fff5f5;
}

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

.table th,
.table td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.table th {
    color: var(--muted);
    font-weight: 750;
}

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

.negative {
    color: var(--muted-strong);
}

@media (max-width: 1040px) {
    .app-frame {
        grid-template-columns: 1fr;
    }

    .app-sidebar {
        position: static;
        height: auto;
        padding: 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .app-sidebar {
        overflow: visible;
    }

    .side-nav {
        grid-template-columns: repeat(5, minmax(156px, 1fr));
        overflow-x: auto;
    }

    .sidebar-config-modal {
        align-items: stretch;
        padding: 0;
        background: var(--bg);
        backdrop-filter: none;
    }

    .sidebar-config-panel {
        width: 100%;
        max-height: none;
        height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .sidebar-config-actions {
        grid-template-columns: 1fr;
    }

    .app-main {
        padding: 24px 18px 44px;
    }
}

@media (max-width: 760px) {
    .side-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .top-action-bar {
        flex-direction: column;
    }

    .action-row {
        justify-content: flex-start;
    }

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

@media (max-width: 520px) {
    .app-main {
        padding: 18px 12px 36px;
    }

    .page-title {
        font-size: 23px;
    }

    .btn,
    .action-row {
        width: 100%;
    }
}
