:root {
    --primary: #16a34a;
    --primary-hover: #15803d;
    --accent-yellow: #fef08a;
    --accent-yellow-strong: #facc15;
    --secondary: #f1f5f9;
    --secondary-hover: #e2e8f0;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --sidebar-bg: #fdfdfd;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

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

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: normal;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Buttons */
button { font-family: inherit; cursor: pointer; border: none; background: none; }
.btn-primary, .btn-secondary, .btn-danger {
    display: inline-flex; justify-content: center; align-items: center;
    padding: 10px 16px; font-size: 14px; font-weight: 500;
    border-radius: var(--radius-md); transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--secondary); color: var(--text-main); }
.btn-secondary:hover { background: var(--secondary-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }

form { display: flex; flex-direction: column; gap: 12px; }
input[type="text"], input[type="password"], textarea {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    font-size: 14px; font-family: inherit; background: var(--surface-color);
    transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

/* Authentication layout */
body.auth-mode {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; background: var(--bg-color);
}
.auth-container { width: 100%; max-width: 400px; padding: 20px; }
.auth-card {
    background: var(--surface-color); padding: 32px;
    border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}
.auth-header { margin-bottom: 24px; text-align: center; }
.auth-header h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.auth-header p { color: var(--text-muted); font-size: 14px; }
.auth-footer { margin-top: 24px; text-align: center; font-size: 13px; }

/* Application Layout */
body.app-mode { overflow: hidden; position: relative; }
.app-layout {
    display: flex; height: 100vh; overflow: hidden;
    position: relative;
}

/* 귀여운 거북이 배경 장식 (앱 모드) */
.turtle-bg-layer {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}
.turtle-bg-layer img {
    position: absolute;
    width: clamp(56px, 12vw, 100px);
    height: auto;
    opacity: 0.3;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(15, 23, 42, 0.06));
}
.turtle-bg-layer .tbg-1 { bottom: 8%; left: 4%; transform: rotate(-8deg); }
.turtle-bg-layer .tbg-2 { top: 18%; right: 6%; transform: rotate(12deg); width: clamp(48px, 10vw, 84px); }
.turtle-bg-layer .tbg-3 { bottom: 22%; right: 12%; transform: rotate(5deg); opacity: 0.22; }
.turtle-bg-layer .tbg-4 { top: 42%; left: 2%; opacity: 0.2; width: clamp(40px, 8vw, 72px); }

.app-layout > .sidebar,
.app-layout > .main-content {
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    width: 260px; background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column;
    flex-shrink: 0; z-index: 100; transition: transform 0.3s ease;
}
.sidebar-backdrop {
    display: none;
}
.sidebar-header {
    padding: 24px 20px; display: flex; align-items: center; justify-content: space-between;
}
.logo {
    font-size: 18px; font-weight: 700; letter-spacing: -0.5px;
    display: flex; align-items: center; gap: 10px;
}
.logo-mark {
    width: 36px; height: 36px; aspect-ratio: 1;
    border-radius: 10px;
    object-fit: contain; box-shadow: none;
    border: 1px solid rgba(22, 163, 74, 0.2);
    background: transparent;
    filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.12));
}
.user-badge {
    background: var(--secondary); font-size: 12px; font-weight: 600;
    padding: 4px 8px; border-radius: 12px; color: var(--text-muted);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 12px; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px;
    color: var(--text-muted); font-weight: 500; font-size: 14px;
    border-radius: var(--radius-md); margin-bottom: 4px; transition: all 0.2s;
}
.nav-item:hover { background: var(--secondary); color: var(--text-main); text-decoration: none; }
.nav-item.active { background: var(--primary); color: white; box-shadow: 0 2px 8px rgba(22, 163, 74, 0.35); }
.nav-divider { height: 1px; background: var(--border-color); margin: 16px 8px; }
.nav-title { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; padding: 0 12px; margin-bottom: 8px; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border-color); }
.btn-logout {
    width: 100%; text-align: left; padding: 10px 12px; color: var(--text-muted); font-size: 14px; font-weight: 500; border-radius: var(--radius-md);
}
.btn-logout:hover { background: #fee2e2; color: var(--danger); }

/* Main Content */
.main-content {
    flex: 1; overflow-y: auto; background: var(--bg-color); position: relative;
}
.mobile-header {
    display: none; align-items: center; gap: 0; padding: 16px 20px;
    background: var(--surface-color); border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 90;
}
.menu-toggle { font-size: 20px; margin-right: 16px; color: var(--text-main); }
.mobile-title { font-weight: 600; font-size: 16px; }

/* 비활성화된 섹션은 아예 흔적도 없이 소멸시키기 (!important 추가) */
.view-section { display: none !important; padding: 40px; max-width: 1000px; margin: 0 auto; min-height: 100%; }
.view-gallery-section { max-width: none; margin: 0; padding: 32px 28px 40px; }
/* 활성화된 섹션만 확실하게 보여주기 */
.view-section.active { display: block !important; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.section-header { margin-bottom: 32px; }
.section-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.5px; }
.section-header p { color: var(--text-muted); font-size: 15px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }

.section-header-with-mascot {
    display: flex; align-items: flex-start; gap: 14px;
}
.section-header-with-mascot .header-mascot {
    width: 52px; height: 52px; object-fit: contain; flex-shrink: 0;
    border-radius: 14px; background: transparent;
    padding: 0; box-shadow: none;
    filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.1));
}
.auth-mascot-wrap {
    position: relative;
    text-align: center;
    margin-bottom: 12px;
}
.auth-mascot {
    width: 72px; height: 72px; object-fit: contain;
    border-radius: 18px;
    background: transparent;
    padding: 0;
    box-shadow: none;
    filter: drop-shadow(0 4px 12px rgba(15, 23, 42, 0.15));
}
.file-mascot-inline {
    width: 64px;
    height: 64px;
    object-fit: contain;
    opacity: 0.95;
    border-radius: 14px;
    background: transparent;
    padding: 0;
    box-shadow: none;
    filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.12));
    flex-shrink: 0;
}
.board-mascot {
    width: 44px; height: 44px; object-fit: contain;
    vertical-align: middle;
    margin-right: 10px;
    border-radius: 12px;
    background: transparent;
    padding: 0;
    filter: drop-shadow(0 1px 3px rgba(15, 23, 42, 0.1));
}
.section-header h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.section-header-with-mascot h1 {
    display: block;
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.section-header-with-mascot p { margin: 0; color: var(--text-muted); font-size: 15px; }

/* Cards & Components */
.card {
    background: var(--surface-color); border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 16px;
}

/* Board specific */
.board-composer { background: #fff; padding: 16px; border-radius: var(--radius-lg); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.board-composer textarea { border: none; padding: 8px; font-size: 15px; resize: none; background: transparent; }
.board-composer textarea:focus { box-shadow: none; }
.composer-actions { display: flex; justify-content: flex-end; margin-top: 8px; border-top: 1px solid var(--border-color); padding-top: 12px; }
.board-item { padding: 20px; border-bottom: 1px solid var(--border-color); background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); margin-bottom: 12px; }
.board-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.board-author { font-weight: 600; font-size: 14px; }
.board-time { font-size: 13px; color: var(--text-muted); }
.board-content { font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; margin-bottom: 16px; }
.board-actions { display: flex; justify-content: flex-end; }

/* Files specific */
.upload-zone {
    border: 2px dashed #cbd5e1; border-radius: var(--radius-lg); padding: 40px 20px;
    text-align: center; cursor: pointer; transition: all 0.2s; background: #f8fafc; margin-bottom: 24px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--primary); background: #f0fdf4; }
.upload-zone.is-disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.upload-zone.is-disabled:hover { border-color: #cbd5e1; background: #f8fafc; }

/* 자료실: 좌 폴더 리스트 + 우 카드 목록 */
.view-files-section { max-width: none; margin: 0; padding: 32px 28px 40px; }
.files-split {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: min(65vh, 560px);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.files-folder-sidebar {
    width: 240px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    background: linear-gradient(180deg, #fefce8 0%, #f8fafc 45%);
    display: flex;
    flex-direction: column;
    min-height: 280px;
}
.files-folder-toolbar {
    padding: 12px;
    border-bottom: 1px solid rgba(234, 179, 8, 0.22);
}
.file-folder-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.file-folder-empty {
    padding: 16px 12px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}
.file-folder-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: #fff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
    position: relative;
}
.file-folder-row:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}
.file-folder-row.active {
    background: #ecfdf5;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.2);
}
.file-folder-icon { font-size: 18px; flex-shrink: 0; opacity: 0.85; }
.file-folder-text { flex: 1; min-width: 0; }
.file-folder-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-folder-meta { font-size: 11px; color: var(--text-muted); }
.file-folder-delete {
    flex-shrink: 0;
    padding: 4px 6px;
    border-radius: 6px;
    color: #cbd5e1;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.file-folder-row:hover .file-folder-delete,
.file-folder-row:hover .file-folder-rename { opacity: 1; }
.file-folder-delete:hover { color: var(--danger); background: #fee2e2; }
.file-folder-rename {
    flex-shrink: 0;
    padding: 4px 6px;
    border-radius: 6px;
    color: #cbd5e1;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.file-folder-rename:hover { color: var(--primary); background: #dcfce7; }

.files-main-panel {
    flex: 1;
    min-width: 0;
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.files-main-head {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.files-folder-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
}
.files-main-panel .upload-zone { margin-bottom: 16px; }
.files-main-panel .file-list { flex: 1; min-height: 40px; }
.upload-icon { font-size: 32px; margin-bottom: 12px; }
.upload-zone p { color: var(--text-muted); font-size: 14px; }
.upload-zone span { color: var(--primary); font-weight: 500; }

.file-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px;
    padding: 16px; background: #fff; border-radius: var(--radius-lg);
    border: 1px solid var(--border-color); margin-bottom: 8px; transition: box-shadow 0.2s;
    position: relative;
}
.file-item:hover { box-shadow: var(--shadow-md); }
.file-info {
    flex: 1;
    min-width: 0;
}
.file-info h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.file-meta { font-size: 13px; color: var(--text-muted); }
.file-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
    position: relative;
    z-index: 2;
}
.file-actions .btn-primary,
.file-actions .btn-danger {
    position: relative;
    z-index: 3;
    pointer-events: auto;
    cursor: pointer;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Gallery: 좌측 앨범 목록 + 우측 사진 (항상 분할) */
.gallery-split {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: min(70vh, 640px);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.gallery-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    background: linear-gradient(180deg, #fefce8 0%, #f8fafc 45%);
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 320px;
}
.gallery-sidebar-title {
    padding: 16px 16px 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #65a30d;
}
.gallery-folder-toolbar {
    padding: 0 12px 12px;
    border-bottom: 1px solid rgba(234, 179, 8, 0.22);
}
.gallery-folder-toolbar .btn-sm {
    width: 100%;
    justify-content: center;
}
.files-folder-toolbar .btn-sm {
    width: 100%;
    justify-content: center;
}
.gallery-folder-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 72px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.gallery-folder-empty {
    padding: 20px 14px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}
.gallery-sidebar-mascot {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: auto;
    opacity: 0.55;
    pointer-events: none;
}
.folder-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 12px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    position: relative;
}
.folder-row:hover {
    background: #fff;
    border-color: #d9f99d;
    box-shadow: var(--shadow-sm);
}
.folder-row.active {
    background: #dcfce7;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}
.folder-row-icon { font-size: 22px; flex-shrink: 0; }
.folder-row-text { flex: 1; min-width: 0; }
.folder-row-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.folder-row-meta { font-size: 11px; color: var(--text-muted); }
.folder-row-delete {
    flex-shrink: 0;
    padding: 6px 8px;
    border-radius: 8px;
    color: #cbd5e1;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.folder-row:hover .folder-row-delete,
.folder-row:hover .folder-row-rename { opacity: 1; }
.folder-row-delete:hover { color: var(--danger); background: #fee2e2; }
.folder-row-rename {
    flex-shrink: 0;
    padding: 6px 8px;
    border-radius: 8px;
    color: #cbd5e1;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.folder-row-rename:hover { color: var(--primary); background: #dcfce7; }

.gallery-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 20px 24px 24px;
    background: #fff;
}
.gallery-photos-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-muted);
    text-align: center;
    padding: 32px 16px;
}
.gallery-photos-empty .empty-mascot {
    width: 120px;
    height: auto;
    object-fit: contain;
    border-radius: 20px;
    background: transparent;
    padding: 0;
    box-shadow: none;
    filter: drop-shadow(0 6px 16px rgba(15, 23, 42, 0.12));
}
.gallery-photos-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.gallery-photos-panel[hidden] { display: none !important; }
.gallery-photos-empty[hidden] { display: none !important; }

.gallery-main-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.folder-title-display {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-main);
}
.gallery-photos-panel .upload-zone { margin-bottom: 16px; }
.gallery-photos-panel .photo-grid { flex: 1; overflow-y: auto; min-height: 120px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.photo-item { aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; background: #e2e8f0; position: relative; cursor: pointer; border: 1px solid var(--border-color); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.photo-item:hover img { transform: scale(1.05); }

/* Progress bar */
.progress-wrap { margin-bottom: 24px; }
.progress-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; text-align: right; }
.progress-bar { height: 6px; background: #e2e8f0; border-radius: 3px; overflow: hidden; }
.progress-bar div { height: 100%; background: var(--primary); transition: width 0.2s ease-out; }

/* Admin table */
.user-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.user-table th, .user-table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
.user-table th { font-weight: 600; color: var(--text-muted); background: #fdfdfd; }
.user-table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 4px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.badge.pending { background: #fef9c3; color: #854d0e; }
.badge.approved { background: #dcfce3; color: #166534; }
.badge.role-superadmin { background: #e0e7ff; color: #3730a3; }
.badge.role-subadmin { background: #f3e8ff; color: #6b21a8; }
.badge.role-user { background: #f1f5f9; color: #475569; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; z-index: 9999; align-items: center; justify-content: center; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(4px); }
.modal-content { position: relative; z-index: 10000; max-width: 90vw; max-height: 90vh; }
.photo-modal-content { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.photo-modal-content img { max-width: 100%; max-height: 75vh; object-fit: contain; border-radius: var(--radius-md); box-shadow: var(--shadow-xl); }
.modal-close { position: absolute; top: -40px; right: 0; color: white; font-size: 32px; background: none; border: none; cursor: pointer; opacity: 0.8; }
.modal-close:hover { opacity: 1; }
.modal-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.modal-photo-move {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 360px;
    text-align: center;
}
.modal-photo-move label {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    margin-bottom: 8px;
}
.modal-photo-move-row {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.modal-photo-move-row select {
    min-width: 160px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-size: 14px;
}

.file-folder-move-select {
    max-width: 140px;
    padding: 6px 8px;
    font-size: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* Mobile Reponsive */
@media (max-width: 768px) {
    /* 모바일에서는 전체 컨테이너가 블록 형태가 되도록 설정 (플렉스 레이아웃이 사이드바를 밀어내는 현상 방지) */
    html, body.app-mode {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        min-height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        position: static !important;
    }
    
    .app-layout {
        display: block !important; /* 사이드바를 문서 흐름에서 완전히 빼기 위해 block으로 변경 */
        position: static !important;
        height: auto !important;
        min-height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* * [핵심 수정] 사이드바를 무조건 본문 위에 떠 있는 고정 레이어(Overlay)로 만듭니다.
     * 스크롤 시 딸려 올라가거나 본문의 자리를 차지하지 못하게 강력하게 제어합니다.
     */
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        height: 100vh !important;
        width: min(260px, 88vw) !important;
        z-index: 9999 !important; /* 모든 요소 중 가장 위에 오도록 설정 */
        background: var(--sidebar-bg) !important;
        transform: translateX(-100%);
        box-shadow: none;
    }
    
    .sidebar.open {
        transform: translateX(0) !important;
        box-shadow: 10px 0 25px rgba(0,0,0,0.2) !important; /* 열렸을 때 그림자 줘서 붕 떠있는 느낌 강조 */
    }

    .main-content {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .app-layout > .main-content > :not(.mobile-header):first-child:empty {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .view-section { padding: 10px 12px 20px; }
    .view-files-section,
    .view-gallery-section { padding: 10px 12px 20px; }
    .view-files-section .section-header,
    .view-gallery-section .section-header { margin-bottom: 10px; }
    
    /* 배경 레이어가 공간 차지 방지 */
    .turtle-bg-layer {
        display: none !important;
    }
    
    .mobile-header {
        display: flex !important;
        align-items: center !important;
        margin: 0 !important;
        padding: max(12px, env(safe-area-inset-top, 0px)) 16px 12px !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 190 !important;
        background: var(--surface-color) !important;
        border-bottom: 1px solid var(--border-color) !important;
    }
    
    /* 오직 '활성화된(active)' 섹션에만 상단 헤더 공간 + 추가 16px 여백 */
    .main-content > .view-section.active {
        margin-top: 0 !important;
        padding-top: calc(58px + env(safe-area-inset-top, 0px) + 16px) !important;
    }
    
    /* 비활성 탭 공간 완벽 차단 */
    .main-content > .view-section:not(.active) {
        padding: 0 !important;
        margin: 0 !important;
        height: 0 !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .view-files-section .section-header h1,
    .view-gallery-section .section-header h1 {
        font-size: 24px;
    }
    
    .view-files-section .section-header .board-mascot,
    .view-gallery-section .section-header .header-mascot,
    .view-files-section .section-header .file-mascot-inline,
    .view-gallery-section .section-header .file-mascot-inline {
        width: 42px !important;
        height: 42px !important;
    }
    
    .view-section,
    .view-files-section,
    .view-gallery-section {
        max-width: 100%;
        box-sizing: border-box;
        min-height: 0 !important;
    }
    
    .files-split,
    .gallery-split {
        flex-direction: column;
        min-height: 0;
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        overflow: visible;
    }
    
    .gallery-main {
        flex: 0 1 auto;
        min-height: 0;
        justify-content: flex-start;
    }
    
    .gallery-photos-empty {
        flex: 0 1 auto;
        justify-content: flex-start !important;
        align-items: center;
        padding: 20px 16px 32px;
    }
    
    .gallery-photos-panel {
        flex: 0 1 auto;
        min-height: 0;
    }
    
    .gallery-photos-panel .photo-grid {
        flex: 0 1 auto;
        overflow: visible;
    }
    
    .gallery-sidebar {
        width: 100%;
        min-height: 0;
        max-height: none;
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .gallery-folder-list {
        flex: 0 1 auto;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        padding: 8px 10px 56px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .folder-row {
        min-width: min(260px, 78vw);
        max-width: min(280px, 85vw);
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .folder-row-text {
        flex: 1;
        min-width: 0;
    }
    
    .folder-row-delete,
    .folder-row-rename { opacity: 1; flex-shrink: 0; }
    
    .photo-grid { grid-template-columns: repeat(3, 1fr); }
    
    .turtle-bg-layer .tbg-3, .turtle-bg-layer .tbg-4 { display: none; }
    
    .view-files-section { padding: 16px 12px 24px; }
    
    .files-main-panel {
        flex: 0 1 auto;
        min-height: 0;
    }
    
    .files-folder-sidebar {
        width: 100%;
        min-height: 0;
        max-height: none;
        flex: 0 0 auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .file-folder-list {
        flex: 0 1 auto;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: visible;
        gap: 8px;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
    
    .file-folder-row {
        min-width: min(240px, 78vw);
        max-width: min(260px, 85vw);
        flex-direction: row;
        align-items: center;
        flex-wrap: nowrap;
    }
    
    .file-folder-text {
        flex: 1;
        min-width: 0;
    }
    
    .file-folder-delete,
    .file-folder-rename { opacity: 1; flex-shrink: 0; }

    /* 자료실 파일 카드: 모바일에서 세로 3줄(파일명/메타/버튼)로 정리 */
    .file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .file-info {
        width: 100%;
        min-width: 0;
    }
    .file-info h4 {
        margin-bottom: 6px;
        line-height: 1.35;
        /* 버튼 영역에 눌려 한 글자씩 세로로 깨지는 현상 방지 */
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .file-meta {
        display: block;
        line-height: 1.35;
        word-break: keep-all;
    }
    .file-actions {
        width: 100%;
        justify-content: flex-start;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    .file-actions .file-folder-move-select {
        max-width: 160px;
    }

    /* 사이드바 외부 클릭 닫기용 오버레이: sidebar > backdrop > content */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(1.5px);
        -webkit-backdrop-filter: blur(1.5px);
        z-index: 9998;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    .sidebar-backdrop.open {
        opacity: 1;
        pointer-events: auto !important;
        touch-action: none !important;
        overscroll-behavior: none !important;
    }
    .app-layout.sidebar-open .main-content {
        pointer-events: none;
        user-select: none;
        -webkit-user-select: none;
    }
    .app-layout.sidebar-open .sidebar-backdrop {
        pointer-events: auto;
    }
    .app-layout.sidebar-open .sidebar {
        pointer-events: auto;
    }

    /* 테이블 모바일뷰 (사용자 관리) */
    .user-table th {
        display: none;
    }
    .user-table, .user-table tbody, .user-table tr, .user-table td {
        display: block;
        width: 100%;
    }
    .user-table tr {
        margin-bottom: 12px;
        background: #fff;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 12px;
        box-sizing: border-box;
    }
    .user-table td {
        padding: 8px 0;
        border-bottom: 1px solid #f1f5f9;
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        gap: 12px;
    }
    .user-table td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    .user-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-align: left;
        flex-shrink: 0;
    }
    .user-table td[data-label="액션"] {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-end;
    }
}