:root {
    --bg: #f4efe6;
    --bg-deep: #e8ddd0;
    --surface: rgba(255, 251, 245, 0.92);
    --surface-strong: #fffaf2;
    --surface-muted: #f2eadf;
    --ink: #1f2a30;
    --muted: #66737a;
    --line: rgba(77, 63, 48, 0.16);
    --line-strong: rgba(77, 63, 48, 0.28);
    --accent: #1f5c5d;
    --accent-strong: #123f40;
    --accent-soft: rgba(31, 92, 93, 0.12);
    --gold: #af7b34;
    --danger: #9f4032;
    --danger-soft: #fff0eb;
    --success: #2f6a4a;
    --success-soft: #edf8f0;
    --shadow-soft: 0 24px 60px rgba(45, 36, 28, 0.08);
    --shadow-card: 0 18px 40px rgba(34, 27, 22, 0.08);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(175, 123, 52, 0.2), transparent 28%),
        radial-gradient(circle at top right, rgba(31, 92, 93, 0.14), transparent 26%),
        linear-gradient(180deg, #f8f4ed 0%, var(--bg) 45%, #efe5d8 100%);
}

body.auth-page {
    background:
        radial-gradient(circle at left top, rgba(175, 123, 52, 0.3), transparent 32%),
        radial-gradient(circle at right center, rgba(31, 92, 93, 0.24), transparent 28%),
        linear-gradient(145deg, #efe3d1 0%, #f8f3ec 38%, #eadbca 100%);
}

body.member-shell {
    background:
        radial-gradient(circle at top left, rgba(31, 92, 93, 0.12), transparent 26%),
        radial-gradient(circle at top right, rgba(175, 123, 52, 0.18), transparent 30%),
        linear-gradient(180deg, #f7f2ea 0%, #f4eee6 52%, #eee1d0 100%);
}

body.admin-shell {
    padding-left: 280px;
}

a {
    color: var(--accent-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.16em;
}

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

button {
    cursor: pointer;
}

.shell {
    width: min(1160px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 80px;
}

body.admin-shell .shell.admin-main-shell {
    width: min(1240px, calc(100% - 40px));
    margin: 0 20px 0 0;
}

.narrow {
    width: min(560px, calc(100% - 32px));
}

.page-shell {
    position: relative;
}

.page-shell::before,
.page-shell::after {
    content: "";
    position: fixed;
    z-index: -1;
    border-radius: 999px;
    filter: blur(24px);
    opacity: 0.7;
}

.page-shell::before {
    top: 96px;
    left: -80px;
    width: 260px;
    height: 260px;
    background: rgba(175, 123, 52, 0.18);
}

.page-shell::after {
    right: -40px;
    bottom: 80px;
    width: 240px;
    height: 240px;
    background: rgba(31, 92, 93, 0.12);
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: linear-gradient(135deg, rgba(255, 250, 242, 0.96), rgba(249, 242, 232, 0.9));
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(10px);
}

.hero::after {
    content: "";
    position: absolute;
    inset: auto -80px -80px auto;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(31, 92, 93, 0.14), transparent 64%);
}

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

.hero-grid {
    display: grid;
    grid-template-columns: 1.45fr 0.85fr;
    gap: 28px;
    align-items: end;
}

.hero-badge,
.eyebrow {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero-title,
.hero h1,
.auth-title,
.card h2,
.stat-card strong,
.section-title {
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
    letter-spacing: -0.02em;
}

.hero-title,
.hero h1 {
    margin: 0;
    font-size: clamp(2.35rem, 4vw, 4rem);
    line-height: 0.98;
}

.hero h1 {
    font-size: clamp(2rem, 3.4vw, 3.4rem);
}

.lead {
    max-width: 62ch;
    margin: 14px 0 0;
    color: #425158;
    font-size: 1.02rem;
    line-height: 1.72;
}

.hero-summary {
    display: grid;
    gap: 14px;
}

.hero-summary-card {
    padding: 18px 20px;
    border: 1px solid rgba(18, 63, 64, 0.14);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.58);
}

.hero-summary-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.hero-summary-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

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

.metric-chip {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.66);
}

.metric-chip strong {
    display: block;
    font-size: 1.6rem;
    line-height: 1;
}

.metric-chip span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.92rem;
}

.hero-actions,
.actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 16px 0 24px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 252, 247, 0.84);
    box-shadow: var(--shadow-card);
}

.member-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0 24px;
}

.member-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    color: var(--ink);
    text-decoration: none;
    font-size: 0.93rem;
}

.member-nav-link.is-active {
    background: linear-gradient(135deg, rgba(31, 92, 93, 0.14), rgba(175, 123, 52, 0.12));
    border-color: rgba(31, 92, 93, 0.2);
    color: var(--accent-strong);
    font-weight: 700;
}

.admin-nav-toggle {
    position: fixed;
    opacity: 0;
    pointer-events: none;
}

.admin-nav-button {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1200;
    display: none;
    width: 52px;
    height: 52px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 251, 245, 0.96);
    box-shadow: var(--shadow-card);
    cursor: pointer;
}

.admin-nav-button span {
    display: block;
    width: 100%;
    height: 2px;
    margin: 7px 0;
    border-radius: 999px;
    background: var(--ink);
}

.admin-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: none;
    background: rgba(18, 27, 30, 0.36);
    backdrop-filter: blur(3px);
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1100;
    width: 280px;
    padding: 22px 18px 18px;
    border-right: 1px solid var(--line);
    background:
        linear-gradient(180deg, rgba(255, 250, 242, 0.98), rgba(246, 237, 225, 0.96));
    box-shadow: 16px 0 40px rgba(34, 27, 22, 0.08);
    overflow-y: auto;
}

.admin-sidebar-brand {
    padding: 12px 10px 20px;
    border-bottom: 1px solid var(--line);
}

.admin-sidebar-brand p {
    margin: 0 0 6px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.admin-sidebar-brand strong {
    font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
    font-size: 1.4rem;
}

.admin-sidebar-user {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
    padding: 14px 12px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.64);
}

.admin-sidebar-user-badge,
.admin-sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.admin-sidebar-user-badge {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(31, 92, 93, 0.18), rgba(175, 123, 52, 0.22));
    color: var(--accent-strong);
}

.admin-sidebar-user-meta strong {
    display: block;
    font-size: 0.98rem;
}

.admin-sidebar-user-meta p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: capitalize;
}

.admin-sidebar-nav,
.admin-sidebar-footer {
    display: grid;
    gap: 8px;
    margin-top: 18px;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 14px;
    color: var(--ink);
    text-decoration: none;
    transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.admin-sidebar-link:hover {
    transform: translateX(1px);
    background: rgba(255, 255, 255, 0.72);
    border-color: var(--line);
}

.admin-sidebar-link.is-active {
    background: linear-gradient(135deg, rgba(31, 92, 93, 0.14), rgba(175, 123, 52, 0.12));
    border-color: rgba(31, 92, 93, 0.18);
    color: var(--accent-strong);
    font-weight: 700;
}

.admin-sidebar-icon {
    width: 34px;
    min-width: 34px;
    height: 34px;
    background: rgba(31, 92, 93, 0.1);
    color: var(--accent-strong);
}

.breadcrumb-trail {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.94rem;
}

.breadcrumb-trail a,
.breadcrumb-trail span {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.breadcrumb-trail a:not(:last-child)::after,
.breadcrumb-trail span:not(:last-child)::after {
    content: "/";
    color: rgba(102, 115, 122, 0.5);
}

.breadcrumb-trail span:last-child {
    color: var(--ink);
    font-weight: 700;
}

.page-nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.page-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 9px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    text-decoration: none;
    font-size: 0.92rem;
}

.button-link,
.primary-link,
.secondary-link,
.ghost-link,
.danger-button,
.panel button,
.match-form button,
.match-actions button,
.subtle-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 18px;
    border-radius: 999px;
    text-decoration: none;
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.primary-link,
.panel button,
.match-form button,
.match-actions button {
    border: 1px solid transparent;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    box-shadow: 0 14px 26px rgba(18, 63, 64, 0.18);
}

.secondary-link,
.button-link,
.subtle-button {
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
}

.inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ghost-link {
    color: var(--accent-strong);
}

.button-link:hover,
.primary-link:hover,
.secondary-link:hover,
.ghost-link:hover,
.panel button:hover,
.danger-button:hover,
.subtle-button:hover {
    transform: translateY(-1px);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

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

.card,
.panel,
.surface-panel {
    padding: 24px;
}

.module-card {
    position: relative;
    overflow: hidden;
}

.dashboard-card-head {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.module-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
}

.card h2,
.panel h1,
.panel h2,
.section-title {
    margin: 0 0 10px;
    font-size: 1.45rem;
}

.card p,
.panel p {
    color: var(--muted);
    line-height: 1.64;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 18px;
    margin-top: 24px;
}

.dashboard-stack {
    display: grid;
    gap: 18px;
}

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

.stat-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 237, 225, 0.92));
}

.stat-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.85rem;
}

.stat-card span {
    color: var(--muted);
    font-size: 0.94rem;
    display: block;
}

.stat-card .status-badge {
    display: inline-flex;
    font-size: 0.92rem;
}

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

.section-header p {
    margin: 0;
    color: var(--muted);
}

.section-tools {
    display: flex;
    justify-content: flex-end;
    margin: 0 0 12px;
}

.module-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.stat-card .module-actions {
    margin-top: 14px;
}

.stat-card .module-actions .subtle-button {
    min-height: 38px;
    padding: 8px 14px;
}

.preset-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.activity-list {
    display: grid;
    gap: 12px;
}

.activity-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.activity-item.is-danger {
    padding: 16px;
    border: 1px solid rgba(159, 64, 50, 0.18);
    border-radius: 18px;
    background: var(--danger-soft);
}

.activity-item.is-warning {
    padding: 16px;
    border: 1px solid rgba(175, 123, 52, 0.2);
    border-radius: 18px;
    background: rgba(255, 247, 232, 0.9);
}

.activity-item.is-success {
    padding: 16px;
    border: 1px solid rgba(47, 106, 74, 0.16);
    border-radius: 18px;
    background: var(--success-soft);
}

.activity-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.activity-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 700;
}

.activity-item.is-danger .activity-icon {
    background: rgba(159, 64, 50, 0.14);
    color: var(--danger);
}

.activity-item.is-warning .activity-icon {
    background: rgba(175, 123, 52, 0.16);
    color: var(--gold);
}

.activity-item.is-success .activity-icon {
    background: rgba(47, 106, 74, 0.14);
    color: var(--success);
}

.activity-item strong {
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
}

.activity-item p,
.activity-item span {
    margin: 0;
    color: var(--muted);
}

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

.auth-layout {
    width: min(1120px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
    align-items: stretch;
}

.auth-stage,
.auth-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 30px;
    box-shadow: var(--shadow-soft);
}

.auth-stage {
    padding: 40px;
    background:
        linear-gradient(160deg, rgba(18, 63, 64, 0.94), rgba(24, 87, 88, 0.86)),
        linear-gradient(180deg, #244f50 0%, #1a3939 100%);
    color: #f4eee6;
}

.auth-stage::after {
    content: "";
    position: absolute;
    inset: auto -70px -90px auto;
    width: 250px;
    height: 250px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 216, 160, 0.22), transparent 64%);
}

.auth-stage .hero-badge {
    color: rgba(255, 239, 211, 0.76);
}

.auth-stage .lead {
    color: rgba(244, 238, 230, 0.82);
}

.auth-highlights {
    display: grid;
    gap: 12px;
    margin-top: 28px;
}

.auth-highlight {
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.08);
}

.auth-highlight strong {
    display: block;
    margin-bottom: 6px;
    font-size: 1rem;
}

.auth-highlight p {
    margin: 0;
    color: rgba(244, 238, 230, 0.78);
    line-height: 1.55;
}

.auth-panel {
    padding: 34px;
    background: rgba(255, 251, 245, 0.94);
}

.auth-title {
    margin: 0 0 8px;
    font-size: 2.2rem;
}

.auth-copy {
    margin: 0 0 24px;
    color: var(--muted);
    line-height: 1.65;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.92rem;
    font-weight: 700;
    color: #415158;
}

.form-section-label {
    margin-top: 18px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    background: #f7f3ea;
    color: var(--text);
    font-weight: 800;
}

.panel input,
.panel select,
.panel textarea,
.filter-form input,
.filter-form select,
.member-form input,
.member-form select,
.member-form textarea,
.match-form select,
.match-form input {
    width: 100%;
    padding: 13px 15px;
    border: 1px solid rgba(69, 56, 41, 0.16);
    border-radius: 12px;
    background: #fff;
    outline: none;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(31, 92, 93, 0.46);
    box-shadow: 0 0 0 4px rgba(31, 92, 93, 0.12);
}

.alert,
.notice {
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid transparent;
}

.alert {
    border-color: rgba(159, 64, 50, 0.22);
    background: var(--danger-soft);
    color: #8a2d21;
}

.notice {
    border-color: rgba(47, 106, 74, 0.22);
    background: var(--success-soft);
    color: var(--success);
}

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

.form-status-panel {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid rgba(31, 92, 93, 0.14);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(31, 92, 93, 0.08), rgba(230, 190, 126, 0.12));
}

.form-status-label {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.status-active,
.status-present,
.status-completed,
.status-paid,
.status-attended,
.status-registered {
    background: var(--success-soft);
    border-color: rgba(47, 106, 74, 0.16);
    color: var(--success);
}

.status-in_progress,
.status-online,
.status-info {
    background: rgba(31, 92, 93, 0.1);
    border-color: rgba(31, 92, 93, 0.16);
    color: var(--accent-strong);
}

.status-warning {
    background: rgba(175, 123, 52, 0.14);
    border-color: rgba(175, 123, 52, 0.22);
    color: #8a5b19;
}

.status-unpaid,
.status-inactive,
.status-not_started,
.status-muted {
    background: rgba(102, 115, 122, 0.12);
    border-color: rgba(102, 115, 122, 0.12);
    color: #4a5860;
}

.status-cancelled,
.status-absent,
.status-deceased,
.status-transferred {
    background: var(--danger-soft);
    border-color: rgba(159, 64, 50, 0.14);
    color: var(--danger);
}

.auth-note {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 0.94rem;
    line-height: 1.65;
}

.filter-form,
.member-form {
    display: grid;
    gap: 12px;
}

.filter-form {
    grid-template-columns: 2fr 1fr auto;
    align-items: end;
}

.filter-form.stackable {
    grid-template-columns: 2fr 1fr auto;
}

.filter-actions {
    display: flex;
    gap: 12px;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.inline-form input {
    flex: 1 1 auto;
}

.stack-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.stacked-actions {
    display: grid;
    gap: 8px;
    min-width: 180px;
}

.attendance-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.muted-text {
    color: var(--muted);
    font-size: 0.92rem;
}

.danger-button {
    border: 1px solid transparent;
    background: var(--danger);
    color: #fff;
}

.table-panel {
    margin-top: 24px;
    overflow-x: auto;
}

.responsive-table {
    overflow: visible;
}

.responsive-table table {
    min-width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    font-size: 0.88rem;
    color: var(--muted);
}

.status-pill {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: #eee6d8;
}

.status-active {
    background: #e7f4e4;
    color: #2d6530;
}

.status-inactive,
.status-transferred,
.status-deceased {
    background: #f4ebe4;
    color: #7a4b36;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

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

.member-profile-card {
    min-height: 100%;
}

.profile-badge-row,
.care-check-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 16px;
}

.profile-mini-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.profile-mini-list div {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 10px;
    align-items: start;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.profile-mini-list dt {
    color: var(--muted);
    font-weight: 800;
}

.profile-mini-list dd {
    margin: 0;
}

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

.compact-grid .card p {
    margin: 0;
    font-size: 28px;
}

.detail-list {
    margin: 0;
}

.detail-list + .member-form {
    margin-top: 18px;
}

.detail-list div {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.detail-list dt {
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
}

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

.receipt-print-page {
    background: #f6f0e8;
}

.receipt-print-shell {
    padding-top: 24px;
}

.receipt-print-card {
    background: #fffdf9;
}

.report-print-card {
    width: min(1200px, 100%);
    margin: 0 auto;
}

.receipt-print-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.receipt-print-header {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}

.receipt-print-meta {
    margin-top: 20px;
}

.receipt-signature-block {
    text-align: right;
    line-height: 1.9;
}

.receipt-seal-row {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    min-height: 96px;
}

.receipt-seal-image {
    width: 88px;
    height: 88px;
    object-fit: contain;
}

.expense-resolution-paper {
    color: #111;
    background: #fff;
    font-size: 14px;
}

.expense-resolution-docno {
    margin-bottom: 8px;
    text-align: right;
    font-weight: 700;
}

.expense-resolution-head {
    display: grid;
    grid-template-columns: 1fr 280px;
    align-items: start;
    gap: 16px;
}

.expense-resolution-head h1 {
    margin: 18px 0 0;
    text-align: center;
    font-size: 28px;
    letter-spacing: 0;
}

.expense-approval-box,
.expense-resolution-form-table {
    width: 100%;
    border-collapse: collapse;
}

.expense-approval-box th,
.expense-approval-box td,
.expense-resolution-form-table th,
.expense-resolution-form-table td {
    border: 1px solid #111;
    padding: 8px 10px;
    vertical-align: middle;
}

.expense-approval-box th,
.expense-resolution-form-table th {
    background: #f2f2f2;
    font-weight: 800;
    text-align: center;
}

.expense-approval-box td {
    height: 34px;
    text-align: center;
}

.expense-resolution-draft-date {
    margin: 18px 0 10px;
    font-weight: 700;
}

.expense-resolution-form-table th {
    width: 150px;
}

.expense-resolution-guide td {
    text-align: center;
    font-weight: 700;
}

.expense-resolution-finance-note td {
    background: #fafafa;
    color: #444;
    font-weight: 700;
}

.expense-resolution-detail-cell {
    height: 140px;
    min-height: 120px;
    line-height: 1.7;
}

.checkbox-group {
    margin: 18px 0 0;
    padding: 0;
    border: 0;
}

.checkbox-group legend {
    margin-bottom: 12px;
    font-weight: 700;
}

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

.checkbox-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.72);
}

.checkbox-card strong,
.checkbox-card small {
    display: block;
}

.checkbox-card small {
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.45;
}

.checkbox-card input[type="checkbox"],
.checkbox-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 2px;
    accent-color: var(--accent-strong);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-card {
    cursor: pointer;
}

.checkbox-card:hover {
    border-color: var(--accent-strong);
}

.wide-form {
    width: min(720px, calc(100% - 32px));
}

.family-list {
    display: grid;
    gap: 12px;
}

.family-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.78);
}

.family-item p {
    margin: 0 0 8px;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.checkbox-row input {
    width: auto;
}

.bulk-member-list {
    display: grid;
    gap: 8px;
    max-height: 360px;
    overflow: auto;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.64);
}

.bulk-member-option {
    justify-content: flex-start;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(247, 243, 234, 0.72);
}

.bulk-member-option span {
    display: grid;
    gap: 2px;
}

.bulk-member-option small {
    color: var(--muted);
}

.match-form {
    display: grid;
    gap: 8px;
    min-width: 220px;
}

.match-actions {
    display: flex;
    gap: 8px;
}

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

.match-form button,
.match-actions button {
    margin-top: 0;
}

@media (max-width: 980px) {
    body.admin-shell {
        padding-left: 0;
    }

    body.admin-shell .shell.admin-main-shell {
        width: min(100% - 24px, 1240px);
        margin: 0 auto;
        padding-top: 84px;
    }

    .admin-nav-button {
        display: block;
    }

    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 220ms ease;
    }

    .admin-nav-toggle:checked ~ .admin-sidebar {
        transform: translateX(0);
    }

    .admin-nav-toggle:checked ~ .admin-nav-backdrop {
        display: block;
    }

    .hero-grid,
    .auth-layout,
    .dashboard-grid,
    .member-profile-grid {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 720px) {
    .shell {
        width: min(100% - 20px, 1160px);
        padding: 20px 0 56px;
    }

    .hero,
    .panel,
    .card,
    .surface-panel,
    .auth-stage,
    .auth-panel {
        padding: 22px;
        border-radius: 22px;
    }

    .hero-title,
    .hero h1,
    .auth-title {
        font-size: 2rem;
    }

    .hero-metrics,
    .stat-grid,
    .member-profile-grid,
    .card-grid {
        grid-template-columns: 1fr;
    }

    .hero-actions,
    .actions,
    .page-nav-links,
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-actions > a,
    .actions > a,
    .actions > form,
    .page-nav-link,
    .button-link,
    .primary-link,
    .secondary-link,
    .ghost-link,
    .danger-button,
    .panel button,
    .subtle-button {
        width: 100%;
    }

    .inline-form {
        display: flex;
        width: 100%;
    }

    .inline-form button {
        width: 100%;
    }

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

    .page-nav {
        padding: 14px;
    }

    .table-panel {
        overflow: visible;
    }

    .responsive-table {
        padding: 18px;
    }

    .responsive-table table,
    .responsive-table thead,
    .responsive-table tbody,
    .responsive-table th,
    .responsive-table td,
    .responsive-table tr {
        display: block;
        width: 100%;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody {
        display: grid;
        gap: 14px;
    }

    .responsive-table tr {
        padding: 14px;
        border: 1px solid var(--line);
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.78);
        box-shadow: 0 10px 22px rgba(34, 27, 22, 0.05);
    }

    .responsive-table td {
        display: grid;
        grid-template-columns: 92px 1fr;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px solid rgba(77, 63, 48, 0.08);
        text-align: left;
    }

    .responsive-table td:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.82rem;
        font-weight: 700;
    }

    .detail-list div {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .receipt-action-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    body.receipt-print-page {
        background: #fff;
    }

    .report-print-card .card,
    .report-print-card .panel,
    .report-print-card .table-panel {
        box-shadow: none;
        break-inside: avoid;
    }

    .receipt-print-toolbar {
        display: none;
    }

    .receipt-print-card {
        box-shadow: none;
        border-color: #d7cec1;
    }
}

/* 예산 집행률 막대 / 경고 */
.budget-bar {
    margin-top: 6px;
    width: 100%;
    max-width: 160px;
    height: 8px;
    border-radius: 999px;
    background: rgba(102, 115, 122, 0.16);
    overflow: hidden;
}

.budget-bar-fill {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--success, #2f6a4a);
}

.budget-bar-fill.status-warning {
    background: #c8881f;
}

.budget-bar-fill.status-absent {
    background: var(--danger, #9f4032);
}

.alert-text {
    color: var(--danger, #9f4032);
    font-weight: 600;
}

.budget-status-box {
    margin: 4px 0 12px;
    padding: 12px 14px;
    border: 1px solid var(--line, #e2dccf);
    border-radius: 12px;
    background: rgba(31, 92, 93, 0.05);
    font-size: 0.94rem;
    line-height: 1.6;
}

.budget-status-box.is-over {
    border-color: rgba(159, 64, 50, 0.4);
    background: var(--danger-soft, rgba(159, 64, 50, 0.08));
}

.budget-status-box .budget-bar {
    max-width: 100%;
}

/* EPUB 리더 */
.reader-body {
    margin: 0;
    background: #2b2b2b;
    --reader-toolbar-h: 56px;
}

.reader-shell {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--reader-toolbar-h));
    height: calc(100dvh - var(--reader-toolbar-h));
}

.reader-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #1f1f1f;
    color: #f3efe6;
}

.reader-bar .reader-title {
    flex: 1;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reader-back {
    color: #f3efe6;
    text-decoration: none;
    font-weight: 600;
}

.reader-controls {
    display: flex;
    gap: 6px;
}

.reader-stage {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    align-items: stretch;
    background: #f7f3ea;
    overflow: hidden;
}

.reader-viewer {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.reader-nav {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: #8a7f6a;
    font-size: 2.4rem;
    line-height: 1;
    width: 56px;
    cursor: pointer;
    z-index: 3;
}

.reader-nav:hover {
    color: #4a4334;
}

.reader-watermark {
    position: absolute;
    inset: 0;
    display: flex;
    flex-wrap: wrap;
    align-content: space-around;
    justify-content: space-around;
    pointer-events: none;
    opacity: 0.10;
    z-index: 2;
    overflow: hidden;
}

.reader-watermark span {
    transform: rotate(-30deg);
    font-size: 1.1rem;
    color: #000;
    white-space: nowrap;
    padding: 24px;
}

.reader-foot {
    padding: 6px 16px;
    background: #1f1f1f;
    color: #cabfa6;
    text-align: center;
    font-size: 0.85rem;
}

@media (max-width: 640px) {
    .reader-nav { width: 40px; font-size: 1.8rem; }
}

/* EPUB 리더 — 필기(펜) 오버레이 + 하단 도구 바 */
.reader-viewer-wrap {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.reader-viewer-wrap > .reader-viewer {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.reader-annot-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;   /* canvas는 replaced 요소 → inset:0로는 안 늘어나고 비트맵 크기로 폭주함 */
    height: 100%;
    z-index: 5;
    touch-action: pan-y;
    pointer-events: none; /* 기본: 통과(읽기/페이지넘김). 펜 모드일 때만 JS가 켬 */
}

.reader-annot-canvas.is-active {
    pointer-events: auto;
    cursor: crosshair;
    touch-action: none;
}

/* 펜 모드: 뷰어(epub iframe)의 포인터 입력을 꺼서 모든 입력이 캔버스로 가게 한다.
   (iframe이 캔버스 위로 적층되는 환경에서도 필기가 동작하도록) */
.reader-viewer-wrap.pen-on > .reader-viewer {
    pointer-events: none;
}

.rtoolbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: var(--reader-toolbar-h, 56px);
    padding: 6px 12px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    background: rgba(31, 31, 31, 0.96);
    border-top: 1px solid #000;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.rtoolbar-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.rtool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.06);
    color: #f3efe6;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.rtool-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.rtool-ico {
    font-size: 1.05rem;
    line-height: 1;
}

.rtool-toggle[aria-pressed="true"] {
    background: #1f5c5d;
    border-color: #1f5c5d;
    color: #fff;
}

.rtool-pop,
.rtool-memo {
    position: fixed;
    z-index: 70;
    right: 14px;
    bottom: calc(var(--reader-toolbar-h, 56px) + 12px);
    background: #fffaf2;
    border: 1px solid var(--line, #e2dccf);
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    padding: 14px;
}

.rtool-pop[hidden],
.rtool-memo[hidden] {
    display: none;
}

.rtool-pop {
    display: grid;
    gap: 12px;
    min-width: 240px;
    max-width: min(320px, calc(100vw - 24px));
}

.rtool-field {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #41504f;
}

.rtool-field input[type="range"] {
    flex: 1;
}

.rtool-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.rtool-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    padding: 0;
}

.rtool-memo {
    width: min(340px, calc(100vw - 28px));
    display: grid;
    gap: 10px;
}

.rtool-memo-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rtool-memo-x {
    border: none;
    background: transparent;
    font-size: 1.1rem;
    cursor: pointer;
    color: #66737a;
    min-height: auto;
    padding: 2px 6px;
}

.rtool-memo textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    padding: 10px 12px;
    border: 1px solid var(--line, #e2dccf);
    border-radius: 10px;
    font: inherit;
    outline: none;
}

.rtool-memo-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.rtool-memo-actions .subtle-button,
.rtool-memo-actions .primary-link {
    min-height: 40px;
    padding: 9px 16px;
}
