:root {
    --primary: #4F46E5;
    --primary-dark: #3730A3;
    --primary-light: #EEF2FF;
    --secondary: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --text: #1E293B;
    --text-muted: #64748B;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --radius: 8px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    min-height: 64px;
    gap: 1rem;
    flex-wrap: nowrap;
}
.nav-brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .5rem;
    white-space: nowrap;
    flex-shrink: 0;
}
/* 스크롤은 바깥만: ul 폭 = 항목 합( max-content )이라 라벨이 세로로 쪼개지지 않음 */
.nav-menu-outer {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
    margin-left: auto;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.nav-menu-outer::-webkit-scrollbar {
    height: 5px;
}
.nav-menu-outer::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}
.nav-menu {
    display: flex;
    align-items: center;
    list-style: none;
    gap: .25rem .35rem;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
    width: max-content;
    min-width: max-content;
    justify-content: flex-end;
}
/* 메뉴 항목이 줄어들며 한 글자씩 세로로 깨지는 현상 방지 */
.nav-menu > li {
    flex-shrink: 0;
    flex-grow: 0;
    list-style: none;
    width: max-content;
}
.nav-menu a {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: .4rem;
    padding: .5rem .9rem;
    border-radius: var(--radius);
    color: var(--text-muted);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: all .15s;
    white-space: nowrap;
    word-break: keep-all;
    width: max-content;
    min-width: max-content;
}
.nav-menu a:hover, .nav-menu a.active {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-divider { width: 1px; height: 24px; background: var(--border); margin: 0 .5rem; flex-shrink: 0; }
.nav-user {
    font-size: .85rem;
    color: var(--text-muted);
    padding: .5rem .75rem;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    white-space: nowrap;
    text-decoration: none;
    border-radius: var(--radius);
}
.nav-user:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-user.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}
.nav-user-block {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.nav-user-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    line-height: 1.2;
}
.nav-menu a.nav-dorung-inline {
    display: inline-flex;
    align-items: center;
    gap: .28rem;
    padding: 0 .75rem .45rem .75rem;
    margin-top: -0.1rem;
    font-size: .72rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    white-space: nowrap;
    border-radius: var(--radius);
    transition: background .15s, color .15s;
    width: max-content;
    min-width: max-content;
}
.nav-menu a.nav-dorung-inline .fa-coins { font-size: .65rem; opacity: .9; }
.nav-dorung-inline-label { font-weight: 500; opacity: .88; }
.nav-menu a.nav-dorung-inline:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-logout-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: .4rem .8rem;
    cursor: pointer;
    font-size: .85rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    transition: all .15s;
    font-family: inherit;
    white-space: nowrap;
}
.nav-logout-btn:hover { background: #FEF2F2; color: var(--danger); border-color: var(--danger); }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; font-size: 1.2rem; color: var(--text); flex-shrink: 0; }
.nav-menu > li > form {
    display: inline-flex;
    flex-shrink: 0;
    flex-grow: 0;
    margin: 0;
    width: max-content;
}

/* 메모 하위 메뉴 */
.nav-memo-group { position: relative; flex-shrink: 0; }
.nav-memo-root { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.nav-memo-group > .nav-submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    margin-top: .35rem;
    list-style: none;
    margin-left: 0;
    padding: .4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    flex-direction: column;
    gap: .15rem;
    z-index: 300;
}
.nav-memo-group:hover > .nav-submenu { display: flex; }
.nav-submenu li { list-style: none; margin: 0; padding: 0; }
.nav-submenu a {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    border-radius: var(--radius);
    font-size: .84rem;
    font-weight: 500;
    padding: .5rem .75rem;
    white-space: nowrap;
    color: var(--text);
    text-decoration: none;
    transition: background .12s, color .12s;
}
.nav-submenu a:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}
.nav-submenu a.active {
    background: linear-gradient(135deg, var(--primary-light), #EEF2FF);
    color: var(--primary-dark);
    font-weight: 600;
}
.nav-submenu a.active::before {
    content: '';
    width: 3px;
    height: 1rem;
    border-radius: 999px;
    background: var(--primary);
    flex-shrink: 0;
}
.nav-submenu a:not(.active)::before {
    content: '';
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--border);
    flex-shrink: 0;
    opacity: .85;
}

/* ===== MAIN ===== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ===== ALERTS ===== */
.alert {
    padding: .9rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: .9rem;
    transition: opacity .5s;
}
.alert-success { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }

/* ===== CARDS ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.card-body { padding: 1.5rem; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    transition: all .15s;
    font-family: inherit;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #CBD5E1; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-success { background: var(--secondary); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.6rem; font-size: 1rem; }
.btn-icon { padding: .5rem; min-width: 36px; justify-content: center; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: .875rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; }
.form-control {
    width: 100%;
    padding: .65rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border .15s, box-shadow .15s;
    outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
.form-control::placeholder { color: #94A3B8; }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: .3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-title { font-size: 1.75rem; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: .9rem; color: var(--text-muted); margin-top: .25rem; }

/* ===== TABLE ===== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: .75rem 1rem; text-align: left; font-size: .8rem; font-weight: 600; text-transform: uppercase; color: var(--text-muted); background: var(--bg); border-bottom: 2px solid var(--border); }
td { padding: .9rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
tr:hover td { background: #F8FAFC; }
tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .25rem .65rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-blue { background: #DBEAFE; color: #1D4ED8; }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-gray { background: #F1F5F9; color: #475569; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    margin-top: 2rem;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    font-size: .875rem;
    text-decoration: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all .15s;
}
.pagination a:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ===== GRID ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }

/* ===== HOME DASHBOARD ===== */
.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
}
.dashboard-welcome h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.dashboard-welcome p { opacity: .85; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    text-decoration: none;
    transition: all .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.stat-icon.blue { background: #DBEAFE; color: #2563EB; }
.stat-icon.green { background: #D1FAE5; color: #059669; }
.stat-icon.purple { background: #EDE9FE; color: #7C3AED; }
.stat-icon.orange { background: #FEF3C7; color: #D97706; }
.stat-label { font-size: .8rem; color: var(--text-muted); font-weight: 500; }
.stat-title { font-size: 1rem; font-weight: 700; color: var(--text); }

/* ===== READING ===== */
.reading-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; }
.reading-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: all .2s;
    display: flex;
    flex-direction: column;
}
.reading-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.reading-cover {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg);
}
.reading-cover-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.5);
    font-size: 3rem;
}
.reading-info { padding: 1rem; flex: 1; }
.reading-title { font-weight: 700; font-size: .95rem; margin-bottom: .25rem; }
.reading-author { font-size: .8rem; color: var(--text-muted); margin-bottom: .75rem; }
.stars { color: #F59E0B; font-size: .85rem; }

/* ===== BOARD ===== */
.search-bar { display: flex; gap: .75rem; margin-bottom: 1.5rem; }
.search-bar .form-control { flex: 1; }

/* ===== TODO ===== */
.todo-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    transition: all .15s;
}
.todo-item:hover { box-shadow: var(--shadow); }
.todo-item.completed { opacity: .6; }
.todo-item.completed .todo-content { text-decoration: line-through; color: var(--text-muted); }
.todo-checkbox { width: 20px; height: 20px; cursor: pointer; accent-color: var(--primary); }
.todo-content { flex: 1; font-size: .95rem; }
.todo-meta { font-size: .75rem; color: var(--text-muted); display: flex; align-items: center; gap: .5rem; }
.progress-bar-wrap { background: var(--border); border-radius: 999px; height: 8px; overflow: hidden; margin-top: .5rem; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 999px; transition: width .3s; }

/* ===== AUTH ===== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}
.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}
.auth-title { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: .5rem; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: .875rem; margin-bottom: 2rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: .875rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-logo { text-align: center; font-size: 2.5rem; margin-bottom: 1rem; color: var(--primary); }

/* ===== FILE UPLOAD ===== */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    color: var(--text-muted);
}
.file-upload-area:hover, .file-upload-area.dragover { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.file-upload-area i { font-size: 2rem; margin-bottom: .5rem; display: block; }
.file-preview { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }
.file-preview-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    width: 120px;
    height: 120px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .3rem;
}
.file-preview-item img, .file-preview-item video { width: 100%; height: 100%; object-fit: cover; }
.file-preview-item .file-name { font-size: .7rem; padding: .25rem; text-align: center; word-break: break-all; color: var(--text-muted); }
.file-preview-item .remove-file {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: .7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== SECRET POST ===== */
tr.secret-row td { background: #FFFBEB; }
tr.secret-row:hover td { background: #FEF3C7 !important; }
.secret-badge { display:inline-flex; align-items:center; gap:.3rem; padding:.2rem .6rem; border-radius:999px; font-size:.75rem; font-weight:600; background:#FEF3C7; color:#92400E; border:1px solid #FDE68A; }

/* ===== BOOK SEARCH ===== */
.book-search-result {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .75rem;
    cursor: pointer;
    transition: all .15s;
    background: var(--surface);
}
.book-search-result:hover { border-color: var(--primary); background: var(--primary-light); }
.book-thumb { width: 60px; height: 80px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.book-info-sm .book-title-sm { font-weight: 700; font-size: .9rem; margin-bottom: .2rem; }
.book-info-sm .book-author-sm { font-size: .8rem; color: var(--text-muted); }

/* ===== RATING STARS ===== */
.rating-input { display: flex; gap: .25rem; flex-direction: row-reverse; justify-content: flex-end; }
.rating-input input { display: none; }
.rating-input label { font-size: 1.5rem; color: #D1D5DB; cursor: pointer; transition: color .1s; }
.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label { color: #F59E0B; }

/* ===== CALENDAR PAGE ===== */
#calendar-container { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border); padding: 1.5rem; box-shadow: var(--shadow); }

/* ===== MODAL ===== */
.modal-overlay.gallery-modal-top {
    z-index: 2200;
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(.95);
    transition: transform .2s;
    box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-size: 1.1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-muted); padding: .25rem; }
.modal-footer { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: .5; display: block; }
.empty-state p { font-size: 1rem; }

/* ===== BOARD TABLE META (desktop-only columns) ===== */
.board-table td.td-meta { display: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    /* ── Navbar ── */
    .nav-menu-outer {
        position: static;
        flex: none;
        margin-left: 0;
        width: 100%;
        max-width: none;
        min-width: 0;
        overflow: visible;
    }
    .nav-menu {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: .25rem;
        display: none;
        box-shadow: var(--shadow-md);
        z-index: 99;
        max-height: calc(100vh - 64px);
        overflow-x: visible;
        overflow-y: auto;
        width: 100%;
        min-width: 0;
        max-width: none;
        justify-content: flex-start;
    }
    .nav-menu.open { display: flex; }
    .nav-menu.open > li {
        width: 100%;
        max-width: none;
    }
    .nav-menu.open > li > a {
        width: auto;
        min-width: 0;
        max-width: 100%;
        white-space: nowrap;
    }
    .nav-memo-group > .nav-submenu {
        display: flex;
        position: static;
        margin: .15rem 0 .5rem 0;
        padding: .45rem .5rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: none;
        background: var(--bg);
        gap: .2rem;
    }
    .nav-submenu a {
        padding: .55rem .75rem;
        border-radius: var(--radius);
    }
    .nav-submenu a:not(.active)::before {
        display: none;
    }
    .nav-submenu a.active::before {
        display: none;
    }
    .nav-menu a { justify-content: flex-start; padding: .7rem 1rem; }
    .nav-menu.open > li.nav-user-block > .nav-user-stack { width: 100%; }
    .nav-menu.open > li.nav-user-block .nav-user,
    .nav-menu.open > li.nav-user-block a.nav-dorung-inline {
        width: 100%;
        box-sizing: border-box;
    }
    .nav-menu.open > li.nav-user-block a.nav-dorung-inline {
        padding: .35rem 1rem .55rem 1rem;
        margin-top: -0.2rem;
        min-width: 0;
        width: 100%;
    }
    .nav-menu li .nav-logout-btn { width: 100%; justify-content: flex-start; }
    .nav-divider { width: 100%; height: 1px; margin: .5rem 0; }
    .nav-toggle { display: flex; }

    /* ── Layout ── */
    .main-content { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    /* ── Page header ── */
    .page-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .page-title { font-size: 1.35rem; }
    .page-header > div:last-child { width: 100%; }
    .page-header .btn { width: 100%; justify-content: center; }

    /* ── Dashboard ── */
    .dashboard-welcome { padding: 1.5rem; }
    .dashboard-welcome h1 { font-size: 1.3rem; }
    .stat-card { padding: 1rem; gap: .75rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.1rem; }
    .stat-title { font-size: .9rem; }

    /* ── Cards ── */
    .card-header { padding: 1rem; flex-wrap: wrap; gap: .5rem; }
    .card-body { padding: 1rem; }

    /* ── Buttons ── */
    .btn-lg { padding: .7rem 1.2rem; }

    /* ── Forms ── */
    .form-control { font-size: 1rem; }  /* 16px+ prevents iOS zoom */

    /* ── Board table → cards ── */
    .board-table thead { display: none; }
    .board-table tbody tr {
        display: block;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: .75rem;
        padding: .875rem 1rem;
        background: var(--surface);
    }
    .board-table tbody tr:hover { background: #F8FAFC; }
    .board-table td {
        display: none; /* 기본 숨김 */
        border-bottom: none;
        font-size: .875rem;
        padding: 0;
    }
    .board-table td.td-title { display: block; padding-bottom: .4rem; font-size: .95rem; }
    .board-table td.td-meta { display: flex; gap: 1rem; color: var(--text-muted); font-size: .8rem; flex-wrap: wrap; }

    /* ── Todo add form ── */
    .todo-add-row { flex-direction: column !important; }
    .todo-add-row input[type="text"] { width: 100% !important; }
    .todo-add-row input[type="date"] { width: 100% !important; }
    .todo-add-row select { width: 100% !important; }
    .todo-add-row .btn { width: 100%; justify-content: center; }

    /* ── Todo item ── */
    .todo-item { padding: .875rem 1rem; }

    /* ── Modal ── */
    .modal { padding: 1.25rem; margin: 0; max-height: 95vh; border-radius: var(--radius); }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; justify-content: center; }

    /* ── Calendar ── */
    #calendar-container { padding: .75rem; }
    .fc-toolbar { flex-wrap: wrap; gap: .5rem; }
    .fc-toolbar-title { font-size: 1rem !important; }
    .fc-button { padding: .3rem .6rem !important; font-size: .8rem !important; }

    /* ── Auth ── */
    .auth-card { padding: 1.75rem 1.25rem; }

    /* ── Pagination ── */
    .pagination { gap: .25rem; }
    .pagination a, .pagination span { width: 32px; height: 32px; font-size: .8rem; }

    /* ── Reading grid ── */
    .reading-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
    .reading-cover, .reading-cover-placeholder { height: 160px; }

    /* ── Board view ── */
    .board-meta-row { flex-wrap: wrap; gap: .5rem !important; }
    .board-action-row { flex-wrap: wrap; gap: .5rem; }
    .board-action-row .btn { flex: 1; justify-content: center; min-width: 100px; }

    /* ── Search bar ── */
    .search-bar { flex-wrap: wrap; }
    .search-bar .form-control { min-width: 0; }

    /* ── Form submit buttons ── */
    .form-submit-row { flex-direction: column-reverse !important; }
    .form-submit-row .btn { width: 100%; justify-content: center; }

    /* ── File upload ── */
    .file-preview-item { width: 100px; height: 100px; }

    /* ── Book search result ── */
    .book-search-result { flex-direction: row; }
}

@media (max-width: 480px) {
    .nav-container { padding: 0 1rem; }
    .main-content { padding: .75rem; }
    .dashboard-welcome { padding: 1.25rem; }
    .dashboard-welcome h1 { font-size: 1.15rem; }
    .dashboard-welcome p { font-size: .85rem; }
    .page-title { font-size: 1.2rem; }
    .reading-grid { grid-template-columns: repeat(2, 1fr); }
    .modal { max-width: 100%; }
}
