:root {
    --bg: #f4f1e8;
    --bg-deep: #ece7db;
    --surface: #fffdf8;
    --surface-soft: #faf7ef;
    --ink: #2d2b25;
    --ink-soft: #565249;
    --muted: #8c877c;
    --line: #e7e1d4;
    --line-strong: #d8d1c2;
    --primary: #337e6f;
    --primary-dark: #226154;
    --primary-soft: #e3f1ed;
    --primary-wash: #f2faf7;
    --coral: #e98564;
    --coral-dark: #c76243;
    --coral-soft: #fdece5;
    --amber: #c68a2e;
    --amber-soft: #fbf1dc;
    --blue: #4c74c9;
    --blue-soft: #eaf0fb;
    --green: #3f8b65;
    --green-soft: #e8f5ec;
    --red: #c75e52;
    --red-soft: #fbeae6;
    --shadow-sm: 0 2px 8px rgba(58, 50, 36, .05);
    --shadow-md: 0 12px 32px rgba(58, 50, 36, .09);
    --shadow-lg: 0 26px 70px rgba(58, 50, 36, .16);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 26px;
    --radius-xl: 34px;
    --header-height: 68px;
    --bottom-nav-height: 72px;
    --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    margin: 0;
    color: var(--ink);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    background:
        radial-gradient(circle at 8% 3%, rgba(230, 162, 91, .13), transparent 28rem),
        radial-gradient(circle at 92% 12%, rgba(51, 126, 111, .12), transparent 32rem),
        linear-gradient(180deg, #f8f5ed 0%, var(--bg) 55%, #f1ede3 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.no-scroll {
    overflow: hidden;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    color: var(--primary);
}

h1, h2, h3, h4, p {
    margin: 0;
}

ul {
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.muted {
    color: var(--muted);
}

.money {
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}

.eyebrow {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}

/* ---------- brand ---------- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    background: linear-gradient(145deg, #fffdf7, #ede7d9);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7), var(--shadow-sm);
    font-size: 22px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text strong {
    font-size: 19px;
    letter-spacing: .02em;
}

.brand-text small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .05em;
}

/* ---------- buttons & fields ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    font-weight: 700;
    line-height: 1.2;
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease, border-color .16s ease, opacity .16s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0) scale(.99);
}

.btn:disabled {
    cursor: not-allowed;
    opacity: .55;
    transform: none;
}

.btn-primary {
    background: linear-gradient(145deg, #3a8b7b, var(--primary));
    color: #fff;
    box-shadow: 0 8px 20px rgba(51, 126, 111, .22);
}

.btn-primary:hover {
    background: linear-gradient(145deg, #469889, #2d7567);
}

.btn-coral {
    background: linear-gradient(145deg, #f09778, var(--coral));
    color: #fff;
    box-shadow: 0 8px 20px rgba(233, 133, 100, .2);
}

.btn-ghost {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, .55);
    color: var(--ink-soft);
}

.btn-ghost:hover {
    background: #fff;
    border-color: #c9c1b1;
}

.btn-soft {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.btn-danger-soft {
    background: var(--red-soft);
    color: var(--red);
}

.btn-sm {
    min-height: 36px;
    padding: 7px 14px;
    font-size: 13px;
}

.btn-lg {
    min-height: 52px;
    padding: 13px 24px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn .btn-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

.btn-ghost .btn-spinner,
.btn-soft .btn-spinner,
.btn-danger-soft .btn-spinner {
    border-color: rgba(45, 43, 37, .18);
    border-top-color: currentColor;
}

.text-button {
    padding: 3px 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    text-decoration: underline;
    text-decoration-color: rgba(51, 126, 111, .3);
    text-underline-offset: 3px;
}

.text-button:hover {
    color: var(--primary-dark);
}

.text-button.danger {
    color: var(--red);
    text-decoration-color: rgba(199, 94, 82, .3);
}

.icon-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-soft);
    font-size: 19px;
    transition: background .16s ease, border-color .16s ease;
}

.icon-button:hover {
    background: rgba(255, 255, 255, .65);
    border-color: var(--line);
}

.icon-ghost {
    display: inline-grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
}

.field-label {
    display: block;
    margin: 0 0 7px 2px;
    color: var(--ink-soft);
    font-size: 13px;
    font-weight: 700;
}

.text-input,
.select-input,
.textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1.5px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .75);
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.text-input::placeholder,
.textarea::placeholder {
    color: #b2ac9f;
}

.text-input:focus,
.select-input:focus,
.textarea:focus {
    border-color: rgba(51, 126, 111, .55);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(51, 126, 111, .1);
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.select-input {
    appearance: none;
    padding-right: 38px;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

.input-suffix-wrap {
    position: relative;
}

.input-suffix {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 13px;
    pointer-events: none;
}

.input-with-suffix {
    padding-right: 42px;
}

.field-hint {
    margin-top: 7px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.form-error {
    min-height: 20px;
    margin: 6px 2px;
    color: var(--red);
    font-size: 13px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

/* ---------- boot ---------- */
.boot-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--bg);
}

.boot-mark {
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 24px;
    background: linear-gradient(145deg, #fffdf8, #ebe4d6);
    box-shadow: var(--shadow-md);
    font-size: 38px;
    animation: float 2.4s ease-in-out infinite;
}

.boot-name {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: .08em;
}

.boot-loader {
    width: 52px;
    height: 3px;
    overflow: hidden;
    border-radius: 99px;
    background: #e5dfd2;
}

.boot-loader span {
    display: block;
    width: 45%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    animation: loading 1.2s ease-in-out infinite;
}

/* ---------- login ---------- */
.login-view {
    position: relative;
    min-height: 100dvh;
    overflow: hidden;
    padding: clamp(20px, 4vw, 48px);
}

.login-decor {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    display: block;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .9), rgba(183, 219, 207, .32) 42%, rgba(51, 126, 111, .08));
    border: 1px solid rgba(255, 255, 255, .75);
    box-shadow: inset 0 0 18px rgba(255, 255, 255, .45);
    animation: float 8s ease-in-out infinite;
}

.bubble-1 { width: 190px; height: 190px; top: -50px; left: 4%; opacity: .55; }
.bubble-2 { width: 100px; height: 100px; top: 18%; right: 6%; opacity: .48; animation-delay: -2s; }
.bubble-3 { width: 54px; height: 54px; bottom: 10%; left: 44%; opacity: .5; animation-delay: -4s; }
.bubble-4 { width: 130px; height: 130px; bottom: -30px; right: 28%; opacity: .35; animation-delay: -1s; }

.sparkle {
    position: absolute;
    color: var(--amber);
    opacity: .55;
    font-size: 24px;
    animation: twinkle 3.4s ease-in-out infinite;
}

.sparkle-1 { top: 12%; left: 42%; }
.sparkle-2 { bottom: 18%; right: 9%; font-size: 16px; animation-delay: -1.7s; }

.login-layout {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(380px, .95fr);
    align-items: center;
    gap: clamp(32px, 6vw, 92px);
    width: min(1120px, 100%);
    min-height: calc(100dvh - clamp(40px, 8vw, 96px));
    margin: 0 auto;
}

.login-story {
    padding: 20px 0;
}

.brand-large .brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 19px;
    font-size: 30px;
}

.brand-large .brand-text strong {
    font-size: 27px;
}

.brand-large .brand-text small {
    font-size: 12px;
    margin-top: 4px;
}

.login-story h1 {
    margin-top: clamp(34px, 6vh, 70px);
    max-width: 600px;
    font-size: clamp(40px, 5.2vw, 67px);
    line-height: 1.13;
    letter-spacing: -.045em;
    font-weight: 800;
}

.login-story h1 em {
    color: var(--primary);
    font-style: normal;
    position: relative;
    white-space: nowrap;
}

.login-story h1 em::after {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    bottom: 2px;
    height: 9px;
    border-radius: 99px;
    background: rgba(230, 176, 91, .3);
    z-index: -1;
}

.login-story > p {
    max-width: 470px;
    margin-top: 22px;
    color: var(--ink-soft);
    font-size: 16px;
    line-height: 1.85;
}

.story-points {
    display: flex;
    flex-direction: column;
    gap: 13px;
    margin-top: 32px;
    list-style: none;
}

.story-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 500;
}

.story-points span {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 13px;
    background: rgba(255, 255, 255, .55);
    box-shadow: var(--shadow-sm);
    font-size: 18px;
}

.story-note {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 38px;
    padding: 8px 14px;
    border: 1px dashed var(--line-strong);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
}

.login-card {
    width: 100%;
    padding: clamp(24px, 3.4vw, 38px);
    border: 1px solid rgba(255, 255, 255, .85);
    border-radius: var(--radius-xl);
    background: rgba(255, 253, 248, .88);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.login-mobile-brand {
    display: none;
}

.login-heading {
    margin-bottom: 22px;
}

.login-heading h2 {
    margin-top: 5px;
    font-size: clamp(25px, 3vw, 31px);
    line-height: 1.25;
    letter-spacing: -.03em;
}

.role-picker {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
}

.role-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-height: 116px;
    padding: 14px 8px 12px;
    border: 1.5px solid var(--line);
    border-radius: 19px;
    background: rgba(255, 255, 255, .55);
    color: var(--ink);
    transition: border-color .17s ease, background .17s ease, transform .17s ease, box-shadow .17s ease;
}

.role-card:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
    background: #fff;
}

.role-card.is-active {
    border-color: rgba(51, 126, 111, .75);
    background: var(--primary-wash);
    box-shadow: 0 8px 22px rgba(51, 126, 111, .12);
}

.role-card.is-active .role-avatar {
    transform: scale(1.04);
}

.role-avatar {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 17px;
    font-size: 27px;
    transition: transform .17s ease;
}

.role-brother { background: var(--blue-soft); }
.role-sister { background: var(--coral-soft); }
.role-mom { background: var(--amber-soft); }
.role-dad { background: var(--green-soft); }

.role-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.25;
}

.role-copy strong {
    font-size: 15px;
}

.role-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .02em;
}

.role-check {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    place-items: center;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    opacity: 0;
    transform: scale(.65);
    transition: opacity .16s ease, transform .16s ease;
}

.role-card.is-active .role-check {
    opacity: 1;
    transform: scale(1);
}

.login-form {
    margin-top: 22px;
}

.pin-wrap {
    position: relative;
}

.pin-input {
    height: 54px;
    padding-right: 52px;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: .28em;
}

.pin-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 42px;
    height: 38px;
    border-radius: 50%;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.pin-toggle:hover {
    background: var(--surface-soft);
}

.login-form .btn {
    margin-top: 4px;
}

.default-pins {
    margin-top: 16px;
    padding: 11px 13px;
    border-radius: 13px;
    background: var(--amber-soft);
    color: #7a5921;
    font-size: 12px;
    line-height: 1.8;
}

.default-pins strong {
    font-weight: 800;
}

.default-pins .pin-chip {
    display: inline-block;
    margin: 2px 3px 2px 0;
    padding: 1px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .7);
    font-weight: 700;
    letter-spacing: .06em;
}

.login-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 20px;
    color: var(--muted);
    font-size: 11px;
}

.login-footer .text-button {
    font-size: 12px;
}

/* ---------- app shell ---------- */
.app-view {
    min-height: 100dvh;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid rgba(216, 209, 194, .7);
    background: rgba(248, 245, 237, .82);
    backdrop-filter: blur(18px) saturate(1.15);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 18px;
    width: min(1180px, calc(100% - 40px));
    height: var(--header-height);
    margin: 0 auto;
}

.brand-small .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 20px;
}

.brand-small .brand-text strong {
    font-size: 17px;
}

.cycle-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    padding: 5px 11px;
    border: 1px solid rgba(51, 126, 111, .16);
    border-radius: 999px;
    background: rgba(227, 241, 237, .7);
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.top-nav {
    display: flex;
    align-items: center;
    gap: 3px;
    margin: 0 auto;
}

.nav-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .16s ease, color .16s ease;
}

.nav-button:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, .6);
}

.nav-button.is-active {
    color: var(--primary-dark);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.nav-button svg {
    width: 17px;
    height: 17px;
}

.nav-badge {
    display: inline-grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 99px;
    background: var(--coral);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.bell-button {
    font-size: 17px;
}

.bell-icon {
    filter: grayscale(.2);
}

.badge-dot {
    position: absolute;
    top: 5px;
    right: 4px;
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border: 2px solid #f8f5ed;
    border-radius: 99px;
    background: var(--coral);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 4px 10px 4px 5px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
}

.user-chip:hover {
    border-color: var(--line);
    background: rgba(255, 255, 255, .65);
}

.user-avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--amber-soft);
    font-size: 18px;
}

.user-name {
    font-size: 13px;
    font-weight: 700;
}

.logout-button {
    font-size: 17px;
}

.module-bar {
    display: flex;
    justify-content: center;
    padding: 14px 20px 0;
}

.module-switch {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(235, 229, 217, .72);
    box-shadow: inset 0 1px 2px rgba(58, 50, 36, .04);
}

.module-button {
    min-height: 36px;
    padding: 6px 18px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}

.module-button.is-active {
    background: var(--surface);
    color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

.app-main {
    width: 100%;
    padding: 22px 0 72px;
}

.content {
    width: min(1120px, calc(100% - 40px));
    margin: 0 auto;
    outline: none;
}

.page {
    animation: fade-up .32s ease both;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.page-head h1 {
    font-size: clamp(25px, 3vw, 34px);
    line-height: 1.25;
    letter-spacing: -.035em;
}

.page-head p {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.page-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- bottom nav ---------- */
.bottom-nav {
    display: none;
}

/* ---------- hero ---------- */
.hero-card {
    position: relative;
    overflow: hidden;
    padding: clamp(22px, 3.4vw, 34px);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #357f70, #245f53 62%, #1d5046);
    color: #fff;
    box-shadow: 0 20px 45px rgba(36, 95, 83, .22);
}

.hero-card::before,
.hero-card::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.hero-card::before {
    width: 280px;
    height: 280px;
    top: -160px;
    right: 8%;
    background: radial-gradient(circle, rgba(255, 255, 255, .16), transparent 65%);
}

.hero-card::after {
    width: 160px;
    height: 160px;
    right: -50px;
    bottom: -100px;
    border: 1px solid rgba(255, 255, 255, .12);
}

.hero-card.hero-mom {
    background: linear-gradient(135deg, #b77744, #9a5e32 70%, #7f4b27);
    box-shadow: 0 20px 45px rgba(154, 94, 50, .2);
}

.hero-card.hero-brother {
    background: linear-gradient(135deg, #4d6eaa, #395589 66%, #2e4775);
    box-shadow: 0 20px 45px rgba(57, 85, 137, .2);
}

.hero-card.hero-sister {
    background: linear-gradient(135deg, #357f70, #245f53 62%, #1d5046);
}

.hero-card.hero-profile {
    background: linear-gradient(135deg, #756e5e, #554f43 68%, #423d34);
    box-shadow: 0 20px 45px rgba(85, 79, 67, .17);
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 26px;
}

.hero-copy {
    min-width: 0;
    flex: 1;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, .17);
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .82);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .05em;
}

.hero-copy h1,
.hero-copy h2 {
    margin-top: 13px;
    font-size: clamp(25px, 3.2vw, 36px);
    line-height: 1.25;
    letter-spacing: -.035em;
    font-weight: 800;
}

.hero-copy p {
    max-width: 560px;
    margin-top: 8px;
    color: rgba(255, 255, 255, .72);
    font-size: 13px;
}

.hero-money {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: none;
    min-width: 188px;
    padding: 16px 20px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 20px;
    background: rgba(255, 255, 255, .09);
    backdrop-filter: blur(4px);
}

.hero-money > span {
    color: rgba(255, 255, 255, .65);
    font-size: 11px;
    font-weight: 600;
}

.hero-money > strong {
    margin-top: 2px;
    font-size: clamp(28px, 3.8vw, 40px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -.045em;
    font-variant-numeric: tabular-nums;
}

.hero-money > small {
    margin-top: 4px;
    color: rgba(255, 255, 255, .62);
    font-size: 10px;
    line-height: 1.5;
}

.hero-progress {
    margin-top: 23px;
}

.hero-progress-labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: rgba(255, 255, 255, .7);
    font-size: 11px;
    font-weight: 600;
}

.hero-progress-labels strong {
    color: #fff;
}

.hero-progress-track {
    height: 7px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: rgba(255, 255, 255, .16);
}

.hero-progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f4d79f, #f7ead1);
    transition: width .5s cubic-bezier(.22, 1, .36, 1);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 18px;
}

.hero-actions .btn {
    background: rgba(255, 255, 255, .13);
    border-color: rgba(255, 255, 255, .17);
    color: #fff;
    box-shadow: none;
}

.hero-actions .btn:hover {
    background: rgba(255, 255, 255, .21);
}

.hero-actions .btn-light {
    background: #fff;
    border-color: #fff;
    color: var(--primary-dark);
}

/* ---------- sections & stats ---------- */
.section {
    margin-top: 26px;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 13px;
}

.section-head h2 {
    font-size: 19px;
    letter-spacing: -.02em;
}

.section-head p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.section-head-actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 11px;
    margin-top: 14px;
}

.stat-card {
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .78);
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.stat-card .stat-value {
    margin-top: 4px;
    font-size: 23px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.035em;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-sub {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.stat-card.accent {
    border-color: rgba(51, 126, 111, .18);
    background: var(--primary-wash);
}

.stat-card.accent .stat-value {
    color: var(--primary-dark);
}

.stat-card.warn {
    border-color: rgba(198, 138, 46, .2);
    background: var(--amber-soft);
}

.stat-card.warn .stat-value {
    color: #8d5e16;
}

.surface {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 248, .82);
    box-shadow: var(--shadow-sm);
}

.surface.flush {
    padding: 0;
    overflow: hidden;
}

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--primary-wash);
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.65;
}

.notice.warn {
    background: var(--amber-soft);
    color: #785821;
}

.notice.danger {
    background: var(--red-soft);
    color: #8c3d35;
}

.notice.info {
    background: var(--blue-soft);
    color: #36558e;
}

.notice .notice-icon {
    flex: none;
    font-size: 15px;
    line-height: 1.5;
}

.notice strong {
    font-weight: 800;
}

.modal-body .notice {
    margin-top: 14px;
}

.confirm-message {
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.8;
}

.two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
    gap: 14px;
    align-items: start;
}

.two-col > .card,
.two-col > .chart-card {
    min-width: 0;
}

.kv-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kv-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--line);
    font-size: 12px;
}

.kv-row:last-child {
    border-bottom: 0;
}

.kv-row span {
    color: var(--muted);
}

.kv-row strong {
    font-weight: 800;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.detail-list {
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.7;
}

.detail-list summary {
    cursor: pointer;
    color: var(--primary);
    font-weight: 700;
}

@media (max-width: 860px) {
    .two-col {
        grid-template-columns: 1fr;
    }

    .module-bar {
        padding: 10px 12px 0;
    }

    .module-button {
        min-height: 34px;
        padding: 5px 16px;
        font-size: 12px;
    }
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 9px;
    color: var(--muted);
    font-size: 11px;
}

.legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.legend i.gray { background: #c4beb0; }
.legend i.amber { background: var(--amber); }
.legend i.blue { background: var(--blue); }
.legend i.done { background: #a58f6c; }
.legend i.disallowed { background: #c9c2b5; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65); }

/* ---------- grade module ---------- */
.hero-card.hero-grades {
    background: linear-gradient(135deg, #4b718c, #355a72 62%, #29495c);
    box-shadow: 0 20px 45px rgba(53, 90, 114, .2);
}

.grade-subject-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 13px;
}

.grade-subject {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .84);
    box-shadow: var(--shadow-sm);
}

.grade-subject.is-below {
    border-color: rgba(198, 138, 46, .22);
    background: #fdfaf2;
}

.grade-subject.is-pending {
    background: rgba(250, 247, 239, .7);
}

.grade-subject-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.grade-subject-name {
    font-size: 13px;
    font-weight: 800;
}

.grade-score {
    color: var(--ink);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.035em;
    font-variant-numeric: tabular-nums;
}

.grade-score small {
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0;
}

.grade-score-line {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.grade-score-line .up { color: var(--green); font-weight: 800; }
.grade-score-line .down { color: var(--red); font-weight: 800; }

.grade-reward {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px dashed var(--line);
    color: var(--primary-dark);
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.grade-reward small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
}

.grade-reason {
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.grade-double-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fdf0d8;
    color: #8b5c14;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.subject-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.subject-chip {
    min-height: 30px;
    padding: 4px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .55);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

.subject-chip.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.grade-chart-wrap {
    overflow-x: auto;
    padding-bottom: 4px;
}

.grade-chart {
    display: block;
    width: 100%;
    min-width: 520px;
    height: auto;
}

.grade-chart text {
    fill: var(--muted);
    font-size: 10px;
    font-family: var(--font);
}

.grade-chart .chart-grid {
    stroke: var(--line);
    stroke-width: 1;
}

.grade-chart .chart-threshold {
    stroke: rgba(198, 138, 46, .65);
    stroke-width: 1.2;
    stroke-dasharray: 5 5;
}

.grade-chart .chart-threshold-label {
    fill: #9b6c25;
    font-size: 9px;
    font-weight: 700;
}

.grade-chart .chart-line {
    fill: none;
    stroke: var(--primary);
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.grade-chart .chart-area {
    fill: rgba(51, 126, 111, .08);
}

.grade-chart .chart-point {
    fill: #fff;
    stroke: var(--primary);
    stroke-width: 2;
}

.grade-chart .chart-value {
    fill: var(--primary-dark);
    font-size: 9px;
    font-weight: 700;
}

.grade-exam-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grade-exam-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .45);
    text-align: left;
    transition: border-color .16s ease, background .16s ease;
}

button.grade-exam-row:hover {
    border-color: var(--line-strong);
    background: #fff;
}

.grade-exam-row.is-active {
    border-color: rgba(51, 126, 111, .35);
    background: var(--primary-wash);
}

.grade-exam-info {
    flex: 1;
    min-width: 0;
}

.grade-exam-info strong {
    display: block;
    font-size: 13px;
}

.grade-exam-info span {
    color: var(--muted);
    font-size: 10px;
}

.grade-exam-score {
    flex: none;
    color: var(--ink);
    font-size: 15px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.grade-exam-score small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
}

.payer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.payer-card {
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, .5);
}

.payer-card.is-required {
    border-color: rgba(51, 126, 111, .24);
    background: var(--primary-wash);
}

.payer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 800;
}

.payer-head span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
}

.payer-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.payer-amount {
    color: var(--ink);
    font-size: 19px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.payer-note {
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.payer-actions {
    flex: none;
}

.payer-state {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.payer-state.green { background: var(--green-soft); color: var(--green); }
.payer-state.amber { background: var(--amber-soft); color: #8a5c16; }
.payer-state.blue { background: var(--blue-soft); color: #3c5c9a; }

.grade-review-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .84);
    box-shadow: var(--shadow-sm);
}

.grade-review-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.grade-review-head h3 {
    font-size: 15px;
}

.grade-review-head p {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.grade-mini-scores {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.grade-mini-score {
    padding: 4px 8px;
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--ink-soft);
    font-size: 10px;
}

.grade-mini-score strong {
    color: var(--ink);
}

.grade-entry-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.grade-entry-item {
    min-width: 0;
}

.grade-entry-item label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.grade-entry-item label small {
    color: var(--muted);
    font-size: 9px;
    font-weight: 500;
}

.grade-receipt-card {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .84);
}

.grade-receipt-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--amber-soft);
    font-size: 22px;
}

.grade-receipt-copy {
    flex: 1;
    min-width: 0;
}

.grade-receipt-copy strong {
    display: block;
    font-size: 13px;
}

.grade-receipt-copy span {
    color: var(--muted);
    font-size: 10px;
}

.grade-receipt-amount {
    flex: none;
    color: var(--primary-dark);
    font-size: 19px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.grade-empty-hint {
    margin-top: 9px;
    color: var(--muted);
    font-size: 10px;
}

@media (max-width: 1020px) {
    .grade-subject-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .grade-subject-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .payer-grid,
    .grade-entry-grid {
        grid-template-columns: 1fr;
    }

    .grade-score {
        font-size: 20px;
    }

    .grade-subject {
        padding: 12px;
    }

    .grade-review-card {
        padding: 13px;
    }

    .grade-receipt-card {
        flex-wrap: wrap;
        gap: 10px;
    }

    .grade-receipt-amount {
        margin-left: auto;
    }
}

/* ---------- room grid ---------- */
.room-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 11px;
}

.room-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-height: 145px;
    padding: 15px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .84);
    text-align: left;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
    -webkit-tap-highlight-color: transparent;
}

button.room-card:not(:disabled):hover {
    transform: translateY(-2px);
    border-color: rgba(51, 126, 111, .38);
    box-shadow: var(--shadow-md);
}

.room-card.is-selectable {
    cursor: pointer;
    border-color: rgba(51, 126, 111, .23);
    background: #fffefb;
}

.room-card.is-selectable .room-icon {
    background: var(--primary-soft);
}

.room-card.is-selectable .room-check {
    border-color: rgba(51, 126, 111, .35);
    background: var(--primary-wash);
}

.room-card.is-selected {
    border-color: var(--primary);
    background: var(--primary-wash);
    box-shadow: 0 0 0 3px rgba(51, 126, 111, .08), var(--shadow-sm);
}

.room-card.is-selected .room-check {
    opacity: 1;
    transform: scale(1);
    background: var(--primary);
    color: #fff;
}

.room-card:disabled {
    cursor: not-allowed;
    color: var(--muted);
    background: rgba(244, 241, 233, .66);
}

.room-card:disabled .room-check {
    display: none;
}

.room-card.is-locked .room-icon {
    filter: grayscale(.65);
    opacity: .62;
}

.room-card.is-done {
    border-color: #ded7c8;
    background: rgba(249, 246, 238, .9);
}

.room-card.is-disallowed {
    border-color: #ddd6c9;
    border-style: dashed;
    background: rgba(250, 248, 243, .52);
}

.room-card.is-disallowed .room-icon {
    opacity: .45;
}

.room-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.room-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--surface-soft);
    font-size: 24px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8);
}

.room-check {
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    border: 1.5px solid var(--line-strong);
    border-radius: 50%;
    background: rgba(255, 255, 255, .7);
    color: transparent;
    font-size: 12px;
    font-weight: 800;
    opacity: .75;
    transform: scale(.94);
    transition: all .16s ease;
}

.room-name {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.room-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    margin-top: auto;
}

.room-price {
    color: var(--primary-dark);
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.room-card:disabled .room-price {
    color: var(--muted);
}

.room-price small {
    margin-right: 1px;
    font-size: 10px;
    font-weight: 600;
}

.room-status {
    padding: 3px 7px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.room-status.available { background: var(--primary-soft); color: var(--primary-dark); }
.room-status.pending { background: var(--amber-soft); color: #8a5c16; }
.room-status.accepted { background: var(--blue-soft); color: #3c5c9a; }
.room-status.done { background: #f1ece1; color: #76694f; }
.room-status.disallowed { background: #f7f4ee; color: #9b9488; border: 1px dashed #d9d2c5; }

.room-lock-note {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.select-bar {
    position: sticky;
    bottom: 16px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding: 12px 14px 12px 18px;
    border: 1px solid rgba(51, 126, 111, .18);
    border-radius: 20px;
    background: rgba(255, 253, 248, .94);
    box-shadow: 0 14px 40px rgba(58, 50, 36, .15);
    backdrop-filter: blur(12px);
}

.select-bar-copy {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-width: 0;
}

.select-bar-copy strong {
    font-size: 14px;
    white-space: nowrap;
}

.select-bar-copy span {
    color: var(--primary-dark);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
}

.select-bar .btn {
    flex: none;
    min-height: 46px;
    padding-inline: 22px;
}

/* ---------- task list ---------- */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.task-card {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .84);
    box-shadow: var(--shadow-sm);
    transition: border-color .16s ease;
}

.task-card:hover {
    border-color: var(--line-strong);
}

.task-card.is-pending {
    border-left: 3px solid var(--amber);
}

.task-card.is-accepted {
    border-left: 3px solid var(--blue);
}

.task-card.is-paid {
    border-left: 3px solid var(--green);
}

.task-card.is-rejected {
    border-left: 3px solid var(--red);
}

.task-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.task-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--surface-soft);
    font-size: 23px;
}

.task-copy {
    flex: 1;
    min-width: 0;
}

.task-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
}

.task-title {
    font-size: 15px;
    font-weight: 800;
}

.task-sub {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}

.task-amount {
    flex: none;
    color: var(--ink);
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.task-amount small {
    display: block;
    color: var(--muted);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0;
}

.task-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px dashed var(--line);
}

.task-times {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    color: var(--muted);
    font-size: 10px;
}

.task-times span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.task-actions .btn {
    min-height: 35px;
    padding: 6px 14px;
    font-size: 12px;
}

.task-note {
    margin-top: 10px;
    padding: 9px 11px;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.6;
}

.task-note strong {
    color: var(--ink);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.status-badge.pending { background: var(--amber-soft); color: #8a5c16; }
.status-badge.accepted { background: var(--blue-soft); color: #3c5c9a; }
.status-badge.paid { background: var(--green-soft); color: #2e7150; }
.status-badge.rejected { background: var(--red-soft); color: var(--red); }

.timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 12px;
    padding-top: 4px;
}

.timeline-item {
    position: relative;
    display: flex;
    gap: 10px;
    padding: 3px 0 10px 18px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--line-strong);
}

.timeline-item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 5.5px;
    top: 16px;
    bottom: 0;
    width: 1px;
    background: var(--line);
}

.timeline-item.done::before { background: var(--green); }
.timeline-item.warn::before { background: var(--amber); }
.timeline-item.bad::before { background: var(--red); }
.timeline-item strong { color: var(--ink-soft); font-weight: 700; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 30px 20px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 248, .45);
    text-align: center;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    margin-bottom: 11px;
    border-radius: 20px;
    background: var(--surface-soft);
    font-size: 30px;
    box-shadow: var(--shadow-sm);
}

.empty-state h3 {
    font-size: 16px;
}

.empty-state p {
    max-width: 380px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.65;
}

.empty-state .btn {
    margin-top: 13px;
}

/* ---------- filters / history ---------- */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .7);
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.filter-chip {
    min-height: 32px;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, .55);
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    transition: all .16s ease;
}

.filter-chip:hover {
    border-color: var(--line-strong);
    color: var(--ink);
}

.filter-chip.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.toolbar-spacer {
    flex: 1;
}

.toolbar-field {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 11px;
}

.toolbar-field .select-input,
.toolbar-field .text-input {
    width: auto;
    min-width: 120px;
    min-height: 34px;
    padding: 5px 10px;
    border-radius: 9px;
    font-size: 11px;
}

.toolbar-field .select-input {
    padding-right: 30px;
    background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.history-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 12px 2px 0;
    color: var(--muted);
    font-size: 11px;
}

.history-summary strong {
    color: var(--ink);
    font-weight: 800;
}

.load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.history-loading {
    padding: 26px;
    color: var(--muted);
    text-align: center;
    font-size: 12px;
}

/* ---------- payment ---------- */
.pay-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pay-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .84);
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.pay-card.is-selected {
    border-color: var(--primary);
    background: var(--primary-wash);
    box-shadow: 0 0 0 3px rgba(51, 126, 111, .07);
}

.pay-check {
    flex: none;
    padding-top: 9px;
}

.custom-check {
    position: relative;
    display: block;
    width: 21px;
    height: 21px;
    cursor: pointer;
}

.custom-check input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.custom-check span {
    display: grid;
    place-items: center;
    width: 21px;
    height: 21px;
    border: 1.5px solid var(--line-strong);
    border-radius: 7px;
    background: #fff;
    color: transparent;
    font-size: 11px;
    font-weight: 800;
    transition: all .16s ease;
}

.custom-check input:checked + span {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.pay-card-body {
    flex: 1;
    min-width: 0;
}

.pay-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.pay-room {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    font-weight: 800;
}

.pay-room .mini-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--surface-soft);
    font-size: 18px;
}

.pay-meta {
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.pay-note {
    margin-top: 7px;
    color: var(--ink-soft);
    font-size: 10px;
}

.pay-amount {
    flex: none;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
}

.payment-bar {
    position: sticky;
    bottom: 16px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
    padding: 12px 14px 12px 18px;
    border: 1px solid rgba(77, 110, 170, .2);
    border-radius: 20px;
    background: rgba(255, 253, 248, .95);
    box-shadow: 0 14px 40px rgba(58, 50, 36, .15);
    backdrop-filter: blur(12px);
}

.payment-bar-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.payment-bar-copy span {
    color: var(--muted);
    font-size: 10px;
}

.payment-bar-copy strong {
    color: var(--primary-dark);
    font-size: 22px;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
}

.payment-bar .btn {
    flex: none;
}

.alipay-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(77, 116, 201, .16);
    border-radius: var(--radius-md);
    background: var(--blue-soft);
}

.alipay-copy {
    min-width: 0;
}

.alipay-copy span {
    display: block;
    color: #5a6f9b;
    font-size: 10px;
    font-weight: 600;
}

.alipay-copy strong {
    display: block;
    margin-top: 2px;
    overflow-wrap: anywhere;
    color: #2f4b7f;
    font-size: 14px;
    letter-spacing: .01em;
}

.alipay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.chart-card {
    padding: 18px 20px 12px;
}

.chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 17px;
}

.chart-head h3 {
    font-size: 14px;
}

.chart-head span {
    color: var(--muted);
    font-size: 10px;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
    height: 104px;
}

.bar-column {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    height: 100%;
    min-width: 0;
}

.bar-value {
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.bar-track {
    display: flex;
    align-items: flex-end;
    width: 100%;
    max-width: 34px;
    height: 70px;
    border-radius: 7px;
    background: #f1ede4;
    overflow: hidden;
}

.bar-fill {
    width: 100%;
    min-height: 2px;
    border-radius: 7px;
    background: linear-gradient(180deg, #6aa193, var(--primary));
    transition: height .4s ease;
}

.bar-column.today .bar-fill {
    background: linear-gradient(180deg, #f0b36f, var(--coral));
}

.bar-label {
    color: var(--muted);
    font-size: 9px;
}

.bar-column.today .bar-label {
    color: var(--ink);
    font-weight: 700;
}

/* ---------- settings / profile ---------- */
.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr);
    gap: 16px;
    align-items: start;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 253, 248, .84);
    box-shadow: var(--shadow-sm);
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.card-head h3 {
    font-size: 16px;
    letter-spacing: -.02em;
}

.card-head p {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.card-head .head-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--surface-soft);
    font-size: 18px;
}

.avatar-line {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 18px;
}

.avatar-large {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    border-radius: 21px;
    background: var(--surface-soft);
    font-size: 34px;
    box-shadow: var(--shadow-sm);
}

.avatar-line h3 {
    font-size: 20px;
}

.avatar-line p {
    color: var(--muted);
    font-size: 11px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    white-space: nowrap;
}

.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }

.divider {
    height: 1px;
    margin: 17px 0;
    background: var(--line);
}

.family-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.family-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: rgba(255, 255, 255, .45);
}

.family-avatar {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: var(--surface-soft);
    font-size: 23px;
}

.family-info {
    flex: 1;
    min-width: 0;
}

.family-info strong {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.family-info p {
    margin-top: 2px;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 10px;
}

.family-actions {
    flex: none;
}

.path-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.path-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 11px;
    border-radius: 11px;
    background: var(--surface-soft);
    font-size: 10px;
    line-height: 1.6;
}

.path-row span {
    color: var(--muted);
    flex: none;
}

.path-row code {
    overflow-wrap: anywhere;
    color: var(--ink-soft);
    text-align: right;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 9px;
}

.access-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fff;
    border: 1px solid var(--line);
    font-size: 11px;
}

.access-row code {
    overflow-wrap: anywhere;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 10px;
}

.help-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.7;
}

.help-list li {
    position: relative;
    padding-left: 16px;
    list-style: none;
}

.help-list li::before {
    content: "·";
    position: absolute;
    left: 3px;
    top: -1px;
    color: var(--primary);
    font-size: 19px;
    font-weight: 800;
}

.setting-switch {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.switch {
    position: relative;
    display: inline-block;
    flex: none;
    width: 38px;
    height: 22px;
}

.switch input {
    width: 0;
    height: 0;
    opacity: 0;
}

.switch span {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #d6d0c4;
    transition: background .18s ease;
}

.switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
    transition: transform .18s ease;
}

.switch input:checked + span {
    background: var(--primary);
}

.switch input:checked + span::after {
    transform: translateX(16px);
}

.room-config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.room-config {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, .84);
    transition: opacity .16s ease, border-color .16s ease;
}

.room-config.is-off {
    opacity: .72;
    background: rgba(244, 241, 233, .6);
}

.room-config-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.room-config-head .room-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 21px;
}

.room-config-title {
    flex: 1;
    min-width: 0;
}

.room-config-title strong {
    display: block;
    font-size: 13px;
}

.room-config-title span {
    color: var(--muted);
    font-size: 9px;
}

.price-editor {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-editor .text-input {
    min-height: 38px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 700;
}

.price-editor .btn {
    flex: none;
    min-height: 38px;
    padding: 6px 13px;
    font-size: 11px;
}

.room-config-note {
    min-height: 17px;
    margin-top: 7px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

/* ---------- notification drawer ---------- */
.notification-layer {
    position: fixed;
    inset: 0;
    z-index: 110;
}

.drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(34, 31, 25, .28);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .2s ease;
}

.notification-drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    width: min(390px, 94vw);
    background: var(--surface);
    box-shadow: -20px 0 60px rgba(40, 35, 26, .16);
    transform: translateX(102%);
    transition: transform .26s cubic-bezier(.22, 1, .36, 1);
}

.notification-layer.is-open .drawer-backdrop {
    opacity: 1;
}

.notification-layer.is-open .notification-drawer {
    transform: translateX(0);
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 24px 22px 16px;
    border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
    font-size: 23px;
}

.drawer-head .text-button {
    flex: none;
}

.drawer-head-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: none;
}

.drawer-back {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
}

.drawer-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 30px;
    overscroll-behavior: contain;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    width: 100%;
    padding: 12px 10px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    text-align: left;
    transition: background .16s ease;
}

.notification-item:hover {
    background: var(--surface-soft);
}

.notification-item.unread {
    background: var(--primary-wash);
}

.notification-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--surface-soft);
    font-size: 18px;
}

.notification-item.unread .notification-icon {
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.notification-copy {
    flex: 1;
    min-width: 0;
}

.notification-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.notification-title {
    font-size: 12px;
    font-weight: 800;
    line-height: 1.45;
}

.notification-dot {
    flex: none;
    width: 7px;
    height: 7px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--coral);
}

.notification-body {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.6;
}

.notification-time {
    margin-top: 4px;
    color: #aaa396;
    font-size: 9px;
}

/* ---------- modal ---------- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(34, 31, 25, .36);
    backdrop-filter: blur(4px);
    animation: fade-in .18s ease both;
}

.modal-card {
    width: min(480px, 100%);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: modal-in .24s cubic-bezier(.22, 1, .36, 1) both;
}

.modal-card.wide {
    width: min(580px, 100%);
}

.modal-head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 22px 0;
}

.modal-head-copy {
    flex: 1;
    min-width: 0;
}

.modal-head h2 {
    font-size: 21px;
    line-height: 1.3;
    letter-spacing: -.025em;
}

.modal-head p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.6;
}

.modal-close {
    flex: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 17px;
    line-height: 1;
}

.modal-body {
    padding: 18px 22px 4px;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 22px 22px;
}

.modal-foot .btn {
    min-width: 96px;
}

.modal-foot-center {
    justify-content: center;
    padding-top: 4px;
    padding-bottom: 28px;
}

.modal-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 13px 14px;
    border-radius: 14px;
    background: var(--surface-soft);
}

.modal-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.modal-summary-row span {
    color: var(--muted);
}

.modal-summary-row strong {
    font-weight: 800;
    text-align: right;
}

.modal-room-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 3px;
}

.modal-room-chip {
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 10px;
    font-weight: 700;
}

.modal-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 15px;
    background: var(--surface-soft);
    font-size: 23px;
}

.celebration {
    position: relative;
    overflow: hidden;
    padding: 30px 22px 24px;
    text-align: center;
}

.celebration::before {
    content: "";
    position: absolute;
    inset: -80px -80px auto;
    height: 250px;
    background:
        radial-gradient(circle at 18% 30%, rgba(230, 176, 91, .22), transparent 18%),
        radial-gradient(circle at 80% 20%, rgba(51, 126, 111, .16), transparent 22%);
    pointer-events: none;
}

.celebration-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 82px;
    height: 82px;
    margin: 0 auto 13px;
    border-radius: 27px;
    background: linear-gradient(145deg, #fffdf8, #f1eadb);
    box-shadow: var(--shadow-md);
    font-size: 42px;
    animation: pop .5s cubic-bezier(.22, 1.4, .36, 1) both;
}

.celebration h2 {
    position: relative;
    font-size: 24px;
    letter-spacing: -.03em;
}

.celebration p {
    position: relative;
    max-width: 340px;
    margin: 8px auto 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.7;
}

.celebration .btn {
    position: relative;
    margin-top: 20px;
}

/* ---------- toast ---------- */
.toast-root {
    position: fixed;
    top: calc(var(--header-height) + 70px);
    left: 50%;
    z-index: 150;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(420px, calc(100vw - 32px));
    pointer-events: none;
    transform: translateX(-50%);
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    width: max-content;
    max-width: 100%;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 13px;
    background: rgba(45, 43, 37, .94);
    color: #fff;
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    line-height: 1.55;
    animation: toast-in .25s cubic-bezier(.22, 1, .36, 1) both;
}

.toast.success {
    background: rgba(34, 97, 84, .96);
}

.toast.error {
    background: rgba(159, 65, 54, .96);
}

.toast.warn {
    background: rgba(135, 92, 27, .96);
}

.toast .toast-icon {
    flex: none;
    line-height: 1.45;
}

.toast.leaving {
    animation: toast-out .22s ease both;
}

/* ---------- login / misc motion ---------- */
.noscript {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 30px;
    background: var(--bg);
    text-align: center;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes loading {
    0% { transform: translateX(-120%); }
    50% { transform: translateX(80%); }
    100% { transform: translateX(240%); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes twinkle {
    0%, 100% { opacity: .3; transform: scale(.8); }
    50% { opacity: .8; transform: scale(1.1); }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(9px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(16px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pop {
    from { opacity: 0; transform: scale(.5) rotate(-8deg); }
    to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-8px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateY(-6px) scale(.98); }
}

@keyframes pulse-soft {
    0%, 100% { box-shadow: 0 0 0 0 rgba(51, 126, 111, .16); }
    50% { box-shadow: 0 0 0 6px rgba(51, 126, 111, 0); }
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
    .login-layout {
        grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr);
        gap: 36px;
    }

    .login-story h1 {
        font-size: clamp(36px, 5vw, 53px);
    }

    .room-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .login-story {
        display: none;
    }

    .login-layout {
        display: block;
        width: min(480px, 100%);
        min-height: auto;
        margin-top: 5vh;
    }

    .login-mobile-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 28px;
    }

    .login-mobile-brand .brand-mark {
        width: 48px;
        height: 48px;
        border-radius: 16px;
        font-size: 26px;
    }

    .login-mobile-brand .brand-text strong {
        font-size: 23px;
    }

    .login-view {
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding: 18px 16px 30px;
    }

    .login-card {
        border-radius: 28px;
    }

    .app-header {
        position: sticky;
    }

    .header-inner {
        width: calc(100% - 24px);
        gap: 9px;
        height: 60px;
    }

    .top-nav {
        display: none;
    }

    .brand-small .brand-text {
        display: none;
    }

    .cycle-chip {
        padding: 4px 9px;
        font-size: 10px;
    }

    .user-chip {
        padding: 3px;
    }

    .user-name {
        display: none;
    }

    .logout-button {
        display: none;
    }

    .app-main {
        padding: 18px 0 calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 30px);
    }

    .content {
        width: calc(100% - 24px);
    }

    .bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 60;
        display: flex;
        align-items: stretch;
        justify-content: space-around;
        min-height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
        border-top: 1px solid rgba(216, 209, 194, .75);
        background: rgba(255, 253, 248, .93);
        box-shadow: 0 -8px 28px rgba(58, 50, 36, .07);
        backdrop-filter: blur(18px);
    }

    .bottom-nav-button {
        position: relative;
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        padding: 5px 2px;
        border: 0;
        border-radius: 14px;
        background: transparent;
        color: var(--muted);
        font-size: 9px;
        font-weight: 700;
        -webkit-tap-highlight-color: transparent;
    }

    .bottom-nav-button svg {
        width: 21px;
        height: 21px;
    }

    .bottom-nav-button.is-active {
        color: var(--primary-dark);
        background: var(--primary-wash);
    }

    .bottom-nav-button .nav-badge {
        position: absolute;
        top: 3px;
        left: calc(50% + 5px);
        height: 15px;
        min-width: 15px;
        font-size: 8px;
    }

    .hero-inner {
        flex-direction: column;
        gap: 16px;
    }

    .hero-money {
        min-width: 0;
        padding: 12px 16px;
        flex-direction: row;
        align-items: baseline;
        flex-wrap: wrap;
        gap: 4px 10px;
    }

    .hero-money > strong {
        font-size: 28px;
    }

    .hero-money > small {
        margin-top: 0;
    }

    .hero-progress {
        margin-top: 17px;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-grid.three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .room-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .select-bar,
    .payment-bar {
        bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom) + 8px);
    }

    .modal-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .modal-card,
    .modal-card.wide {
        width: 100%;
        max-height: calc(100dvh - 36px);
        border-radius: 24px 24px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
        animation-name: sheet-in;
    }

    .notification-drawer {
        width: min(100%, 430px);
    }
}

@media (max-width: 620px) {
    .role-picker {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-head {
        flex-wrap: wrap;
    }

    .section-head-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .login-card {
        padding: 22px 18px;
    }

    .login-heading h2 {
        font-size: 24px;
    }

    .role-card {
        min-height: 108px;
        padding: 12px 6px 10px;
    }

    .role-avatar {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    .login-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .page-head-actions {
        width: 100%;
    }

    .hero-card {
        padding: 20px 17px;
        border-radius: 22px;
    }

    .hero-copy h1,
    .hero-copy h2 {
        font-size: 25px;
    }

    .room-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .room-card {
        min-height: 138px;
        padding: 13px;
    }

    .room-icon {
        width: 38px;
        height: 38px;
        font-size: 22px;
        border-radius: 12px;
    }

    .room-name {
        font-size: 12px;
    }

    .room-price {
        font-size: 15px;
    }

    .room-status {
        font-size: 8px;
        padding: 2px 6px;
    }

    .section-head {
        align-items: flex-start;
    }

    .section-head h2 {
        font-size: 17px;
    }

    .stat-card {
        padding: 13px;
    }

    .stat-card .stat-value {
        font-size: 21px;
    }

    .stat-card .stat-sub {
        display: none;
    }

    .select-bar {
        gap: 8px;
        padding: 10px 10px 10px 14px;
    }

    .select-bar-copy {
        flex-direction: column;
        gap: 0;
    }

    .select-bar-copy strong {
        font-size: 11px;
        color: var(--muted);
    }

    .select-bar-copy span {
        font-size: 18px;
    }

    .select-bar .btn {
        padding-inline: 16px;
        font-size: 13px;
    }

    .payment-bar {
        gap: 8px;
        padding: 10px 10px 10px 14px;
    }

    .payment-bar .btn {
        padding-inline: 16px;
        font-size: 12px;
    }

    .room-config-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .task-main {
        gap: 9px;
    }

    .task-icon {
        width: 39px;
        height: 39px;
        font-size: 21px;
    }

    .task-amount {
        font-size: 17px;
    }

    .task-meta-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .task-actions {
        width: 100%;
    }

    .task-actions .btn {
        flex: 1;
    }

    .toolbar {
        padding: 11px;
    }

    .toolbar-spacer {
        display: none;
    }

    .toolbar-field {
        flex: 1;
    }

    .toolbar-field .select-input,
    .toolbar-field .text-input {
        flex: 1;
        width: 100%;
    }

    .chart-card {
        padding: 15px 14px 10px;
    }

    .bar-chart {
        height: 94px;
        gap: 5px;
    }

    .bar-track {
        height: 64px;
    }

    .card {
        padding: 17px;
    }

    .modal-head {
        padding: 20px 18px 0;
    }

    .modal-body {
        padding: 16px 18px 4px;
    }

    .modal-foot {
        padding: 14px 18px 20px;
    }

    .modal-foot .btn {
        flex: 1;
        min-width: 80px;
    }

    .toast-root {
        top: 120px;
    }

    .profile-grid {
        gap: 12px;
    }
}

@media (max-width: 390px) {
    .role-copy small {
        display: none;
    }

    .role-card {
        min-height: 90px;
    }

    .hero-money > strong {
        font-size: 25px;
    }

    .stat-grid {
        gap: 8px;
    }

    .stat-card .stat-value {
        font-size: 19px;
    }

    .room-grid {
        gap: 8px;
    }

    .room-card {
        min-height: 130px;
        padding: 12px;
    }
}

@media (min-width: 861px) {
    .bottom-nav {
        display: none !important;
    }
}

@keyframes sheet-in {
    from { opacity: 0; transform: translateY(26px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
