/* ── reset & base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* 다크 모드 (기본) */
:root,
[data-theme="dark"] {
    --bg:       #0f1117;
    --surface:  #1a1d27;
    --surface2: #22263a;
    --border:   #2e3350;
    --primary:  #6c63ff;
    --primary-h:#8b85ff;
    --danger:   #e05c5c;
    --success:  #4caf72;
    --text:     #e0e4f0;
    --muted:    #8892b0;
    --radius:   10px;
    --fab-bg:   #22263a;
    --fab-shadow: 0 4px 20px rgba(0,0,0,.5);
}

/* 라이트 모드 */
[data-theme="light"] {
    --bg:       #f0f3fa;
    --surface:  #ffffff;
    --surface2: #e8ecf5;
    --border:   #cdd3e8;
    --primary:  #5a52d5;
    --primary-h:#4840b8;
    --danger:   #cc3333;
    --success:  #2e8a50;
    --text:     #1a1d30;
    --muted:    #5a6080;
    --radius:   10px;
    --fab-bg:   #ffffff;
    --fab-shadow: 0 4px 20px rgba(0,0,0,.15);
}

/* 라이트 모드 세부 보정 */
[data-theme="light"] .topbar {
    background: #ffffff;
    border-bottom-color: #cdd3e8;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
[data-theme="light"] .auth-card,
[data-theme="light"] .upload-card,
[data-theme="light"] .file-list-card {
    box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
[data-theme="light"] .drop-zone { background: #f7f9ff; }
[data-theme="light"] .drop-zone:hover,
[data-theme="light"] .drop-zone.dragover { background: rgba(90,82,213,.06); }
[data-theme="light"] .bulk-toolbar {
    background: rgba(90,82,213,.06);
    border-color: rgba(90,82,213,.2);
}
[data-theme="light"] .q-item  { background: #f0f3fa; }
[data-theme="light"] .folder-card { background: #f7f9ff; }
[data-theme="light"] .folder-meta { background: rgba(0,0,0,.04); }
[data-theme="light"] code { background: #e8ecf5; color: #1a1d30; }

/* ── 플로팅 테마 토글 버튼 ────────────────────────── */
.theme-fab {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--fab-bg);
    box-shadow: var(--fab-shadow);
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
    line-height: 1;
}
.theme-fab:hover {
    transform: scale(1.12);
    box-shadow: 0 6px 24px rgba(108,99,255,.3);
}
.theme-fab.spin {
    animation: fab-spin .35s ease;
}
@keyframes fab-spin {
    0%   { transform: rotate(0deg)   scale(1); }
    50%  { transform: rotate(180deg) scale(1.15); }
    100% { transform: rotate(360deg) scale(1); }
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
}

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

/* ── auth page ────────────────────────────────────── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1.5rem;
    justify-content: center;
}

/* tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}
.tab {
    padding: .5rem 1.2rem;
    color: var(--muted);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: .2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* form fields */
.field { margin-bottom: 1rem; }
.field label {
    display: block;
    font-size: .8rem;
    color: var(--muted);
    margin-bottom: .35rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.field input,
.field textarea,
.field select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: .6rem .85rem;
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .2s;
    outline: none;
    box-sizing: border-box;
}
.field textarea { resize: vertical; min-height: 5rem; line-height: 1.45; }
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--primary); }

/* 체크박스·라디오는 100% 확대에서 제외 */
.field input[type="checkbox"],
.field input[type="radio"] {
    width: auto;
    flex: 0 0 auto;
    padding: 0;
    margin: 0;
    accent-color: var(--primary);
    transform: scale(1.15);
    cursor: pointer;
}
/* 체크박스 감싼 label 은 한 줄 유지 */
.field label:has(input[type="checkbox"]),
.field label:has(input[type="radio"]) {
    text-transform: none;
    letter-spacing: normal;
    font-size: .92rem;
    color: var(--text);
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}

.hint { color: var(--muted); font-size: .78rem; display: block; margin-top: .3rem; }

/* ── buttons ──────────────────────────────────────── */
.btn-primary {
    display: block;
    width: 100%;
    padding: .7rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
    margin-top: 1rem;
}
.btn-primary:hover { background: var(--primary-h); }

.btn-outline-sm {
    padding: .35rem .8rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    font-size: .85rem;
    transition: .2s;
}
.btn-outline-sm:hover { border-color: var(--primary); color: var(--primary); }

/* 새 폴더 버튼 — 아웃라인이지만 primary 색으로 눈에 띄게 */
.btn-outline-primary {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    font-weight: 600;
}
.btn-outline-primary:hover {
    background: var(--primary);
    color: #fff !important;
}

.btn-action {
    padding: .3rem .7rem;
    border: none;
    border-radius: 5px;
    font-size: .8rem;
    cursor: pointer;
    font-weight: 600;
}
.btn-action.dl {
    background: rgba(108,99,255,.15);
    color: var(--primary-h);
}
.btn-action.dl:hover { background: rgba(108,99,255,.3); }
.btn-action.view {
    background: rgba(76,175,114,.15);
    color: #4caf72;
    text-decoration: none;
    display: inline-block;
}
.btn-action.view:hover { background: rgba(76,175,114,.3); }
.btn-action.disabled {
    background: transparent;
    color: var(--muted);
    cursor: default;
    font-weight: 400;
    font-size: .78rem;
}
.btn-action.rename-btn {
    background: rgba(255,200,60,.1);
    color: #e0b840;
    border: none;
    cursor: pointer;
}
.btn-action.rename-btn:hover { background: rgba(255,200,60,.25); }
.btn-action.del {
    background: rgba(224,92,92,.12);
    color: var(--danger);
}
.btn-action.del:hover { background: rgba(224,92,92,.25); }

/* ── alerts ───────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: 6px;
    font-size: .9rem;
    margin-bottom: 1rem;
}
.alert-error   { background: rgba(224,92,92,.15);  border: 1px solid rgba(224,92,92,.4);  color: #f28b8b; }
.alert-success { background: rgba(76,175,114,.12); border: 1px solid rgba(76,175,114,.35); color: #7dd4a0; }

/* ── topbar ───────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .75rem 1.25rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}
.topbar-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 0;
    white-space: nowrap;
}
.topbar-brand a {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
    padding: .1rem .3rem;
    margin: -.1rem -.3rem;
    transition: opacity .15s;
}
.topbar-brand a:hover { opacity: .75; }
.topbar-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 0;
}
.topbar-user {
    color: var(--muted);
    font-size: .9rem;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: .3rem .5rem;
    border-radius: 5px;
    transition: background .15s, color .15s;
}
a.topbar-user { color: var(--muted); }
a.topbar-user:hover { color: var(--primary); background: rgba(108,99,255,.08); }
.topbar-actions .btn-outline-sm { white-space: nowrap; }
.topbar-actions .admin-link { color:#a89cff; border-color:#6c63ff; }
.topbar-actions .files-link { color:#f0c060; border-color:#c8963e; }
.hide-sm  { display: inline; }
.brand-text { display: inline; } /* 브랜드 텍스트: 소형 화면에서 숨김 */

/* ── profile page ─────────────────────────────────── */
.profile-container { max-width: 620px; }
.profile-meta {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .9rem 1rem;
}
.profile-meta > div {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
}
.profile-label {
    font-size: .75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    min-width: 64px;
    font-weight: 600;
}
.profile-form .btn-primary { width: auto; padding: .55rem 1.5rem; }
code {
    background: rgba(255,255,255,.08);
    color: var(--primary-h);
    padding: .1rem .35rem;
    border-radius: 4px;
    font-size: .85em;
}

/* ── main container ───────────────────────────────── */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── upload card ──────────────────────────────────── */
.upload-card, .file-list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.upload-card h2, .file-list-card h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: .2s;
    color: var(--muted);
}
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(108,99,255,.06);
    color: var(--text);
}
.drop-zone svg { display: block; margin: 0 auto .75rem; opacity: .6; }
.drop-zone input[type=file] { display: none; }
.drop-zone small { font-size: .78rem; }

.drop-zone-btns {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-top: .6rem;
    font-size: .82rem;
    color: var(--muted);
}
.drop-btn-sep { opacity: .35; }
.drop-folder-btn {
    background: rgba(108,99,255,.12);
    color: var(--primary-h);
    border: 1px solid rgba(108,99,255,.3);
    border-radius: 5px;
    padding: .25rem .7rem;
    font-size: .82rem;
    cursor: pointer;
    transition: background .15s;
    line-height: 1.4;
}
.drop-folder-btn:hover { background: rgba(108,99,255,.25); }

.file-preview-list { margin-top: .75rem; display: flex; flex-direction: column; gap: .4rem; }
.preview-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: .4rem .75rem;
    font-size: .85rem;
    color: var(--muted);
}

/* ── file list card ───────────────────────────────── */
.file-list-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.file-list-header h2 { margin-bottom: 0; }
.badge {
    background: var(--primary);
    color: #fff;
    border-radius: 99px;
    padding: .1rem .5rem;
    font-size: .75rem;
    font-weight: 700;
}
.search-form { display: flex; gap: .4rem; flex: 1; min-width: 180px; }
.search-form input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    padding: .4rem .75rem;
    font-size: .88rem;
    outline: none;
}
.search-form input:focus { border-color: var(--primary); }
.search-form button {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    padding: .4rem .9rem;
    cursor: pointer;
    font-size: .88rem;
}
.search-form button:hover { border-color: var(--primary); }
.total-size { color: var(--muted); font-size: .85rem; margin-left: auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: .7rem .8rem;
    text-align: left;
}
th {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    border-bottom: 2px solid var(--border);  /* 헤더 아래만 구분선 */
}
/* 짝수 행 음영으로 행 구분 */
tbody tr:nth-child(even) td {
    background: rgba(255,255,255,.025);
}
tbody tr:hover td {
    background: rgba(108,99,255,.07);
}
/* 라이트 모드 보정 */
[data-theme="light"] tbody tr:nth-child(even) td {
    background: rgba(0,0,0,.025);
}
[data-theme="light"] tbody tr:hover td {
    background: rgba(90,82,213,.06);
}

.filename { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filesize, .filedate { color: var(--muted); white-space: nowrap; }
.fileactions { white-space: nowrap; display: flex; gap: .4rem; align-items: center; }

.sort-link { color: var(--muted); font-size: inherit; }
.sort-link:hover { color: var(--primary); }

/* 클릭 가능한 파일명 */
.file-viewlink {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255,255,255,.2);
    transition: color .15s, border-color .15s;
}
.file-viewlink:hover {
    color: var(--primary-h);
    border-bottom-color: var(--primary);
}

.inline-form { display: inline; }

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 3rem 0;
    font-size: .95rem;
}

.mb { margin-bottom: 1rem; }
.hint-inline { font-size: .75rem; color: var(--muted); font-weight: 400; }

/* ── upload queue ─────────────────────────────────── */
.upload-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .75rem;
    flex-wrap: wrap;
}
.upload-footer #uploadSummary { color: var(--muted); font-size: .88rem; }
.upload-footer .btn-primary { width: auto; margin-top: 0; padding: .55rem 1.5rem; }

.q-item {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .5rem .75rem;
    margin-top: .5rem;
}
.q-info {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .35rem;
}
.q-name { flex: 1; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-folder-count {
    display: inline-block;
    font-size: .75rem;
    color: var(--muted);
    background: var(--surface2);
    border-radius: 10px;
    padding: .05rem .45rem;
    margin-left: .25rem;
    vertical-align: middle;
    font-weight: normal;
}
.q-size { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.q-remove {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: .85rem;
    padding: 0 .2rem;
    line-height: 1;
}
.q-remove:hover { color: var(--danger); }
.q-bar-wrap {
    height: 5px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.q-bar {
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: 99px;
    transition: width .2s;
}
.q-status { font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.q-done .q-status { color: var(--success); }
.q-error .q-status { color: var(--danger); }

/* ── bulk toolbar ─────────────────────────────────── */
.bulk-toolbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .8rem;
    background: rgba(108,99,255,.08);
    border: 1px solid rgba(108,99,255,.25);
    border-radius: 6px;
    margin-bottom: .75rem;
    flex-wrap: wrap;
}
#selectedCount { color: var(--primary); font-size: .88rem; font-weight: 600; flex: 1; }

/* ── checkbox column ──────────────────────────────── */
.col-chk { width: 36px; text-align: center; }
.col-chk input[type=checkbox] { cursor: pointer; width: 15px; height: 15px; }
tr.selected td { background: rgba(108,99,255,.05); }

/* ── manager header ───────────────────────────────── */
.manager-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
}
.manager-header-right { display: flex; align-items: center; gap: .75rem; }

/* ── breadcrumb ───────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .2rem;
    font-size: .88rem;
}
.bc-link {
    color: var(--primary);
    padding: .15rem .35rem;
    border-radius: 4px;
    transition: background .15s;
}
.bc-link:hover { background: rgba(108,99,255,.12); }
.bc-sep { color: var(--muted); }
.bc-current { color: var(--text); font-weight: 600; }

/* ── folder grid ──────────────────────────────────── */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: .75rem;
    margin-bottom: 1.25rem;
}

.folder-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: border-color .2s, box-shadow .2s;
    position: relative;
    display: flex;
    flex-direction: column;
}
.folder-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,99,255,.1);
}

.folder-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem .75rem .6rem;
    gap: .4rem;
    text-decoration: none;
    color: var(--text);
    min-height: 90px;
}
.folder-link:hover { color: var(--text); }

.folder-icon { color: #f0c040; flex-shrink: 0; }
.folder-name {
    font-size: .88rem;
    font-weight: 600;
    text-align: center;
    word-break: break-all;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}
.folder-count { font-size: .72rem; color: var(--muted); }

.folder-meta {
    display: flex;
    justify-content: flex-end;
    gap: .25rem;
    padding: .3rem .4rem;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,.15);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: .9rem;
    padding: .2rem .35rem;
    border-radius: 4px;
    opacity: .7;
    transition: opacity .15s, background .15s;
}
.btn-icon:hover { opacity: 1; background: rgba(255,255,255,.08); }

/* ── move select ──────────────────────────────────── */
.folder-select {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    color: var(--text);
    padding: .3rem .6rem;
    font-size: .82rem;
    cursor: pointer;
    max-width: 180px;
}
.folder-select:focus { outline: none; border-color: var(--primary); }
.btn-action.move {
    background: rgba(76,175,114,.12);
    color: #7dd4a0;
}
.btn-action.move:hover { background: rgba(76,175,114,.25); }

/* ── modal ────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-box h3 { font-size: 1rem; margin-bottom: 1rem; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    margin-top: 1rem;
    align-items: center;
}

/* ── responsive ───────────────────────────────────── */
@media (max-width: 900px) {
    .topbar { padding: .65rem 1rem; }
    .topbar-actions { gap: .4rem; }
    .topbar-user { max-width: 110px; font-size: .82rem; }
}

/* 600px: 텍스트 숨김 (태블릿 세로 / 큰 폰 가로) */
/* ══ 배너 슬라이더 ════════════════════════════════ */
.bs-slider {
    position: relative;
    overflow: hidden;
    background: var(--surface2);
    width: 100%;
    min-height: 120px; /* JS가 실행되기 전 폴백 */
    user-select: none;
    -webkit-user-select: none;
}

/* ── 트랙 ── */
.bs-track {
    display: flex;
    height: 100%;
    transition: transform .55s cubic-bezier(.4, 0, .2, 1);
    will-change: transform;
}

/* ── 슬라이드 ── */
.bs-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.bs-slide a,
.bs-slide-nolink {
    display: block;
    width: 100%;
    height: 100%;
}
.bs-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: none;
}

/* ── FADE 효과 ── */
.effect-fade .bs-track {
    display: block;
    position: relative;
    height: 100%;
    transition: none;
    transform: none !important;
}
.effect-fade .bs-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .75s ease;
    z-index: 1;
}
.effect-fade .bs-slide.bs-active { opacity: 1; z-index: 2; }
.effect-fade .bs-slide.bs-prev   { opacity: 0; z-index: 1; }

/* ── ZOOM 효과 ── */
.effect-zoom .bs-track {
    display: block;
    position: relative;
    height: 100%;
    transition: none;
    transform: none !important;
}
.effect-zoom .bs-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .8s ease;
    z-index: 1;
}
.effect-zoom .bs-slide.bs-active { opacity: 1; z-index: 2; }
.effect-zoom .bs-slide.bs-prev   { opacity: 0; z-index: 1; }
.effect-zoom .bs-slide.bs-active img {
    animation: bs-ken 8s ease forwards;
}
@keyframes bs-ken {
    from { transform: scale(1.07); }
    to   { transform: scale(1.00); }
}

/* ── 화살표 ── */
.bs-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.45);
    color: #fff;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .2s, background .2s, transform .15s;
    padding: 0 0 .05rem;
}
.bs-slider:hover .bs-arrow { opacity: 1; }
.bs-arrow:hover {
    background: rgba(0,0,0,.7);
    transform: translateY(-50%) scale(1.1);
}
.bs-prev { left: 14px; }
.bs-next { right: 14px; }
[data-theme="light"] .bs-arrow { background: rgba(255,255,255,.72); color: #222; }
[data-theme="light"] .bs-arrow:hover { background: rgba(255,255,255,.92); }

/* ── 점 네비 ── */
.bs-dots {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    gap: 7px;
    align-items: center;
}
.bs-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.6);
    background: transparent;
    cursor: pointer;
    padding: 0;
    transition: background .2s, transform .2s, border-color .2s;
}
.bs-dot.bs-dot-active {
    background: #fff;
    border-color: #fff;
    transform: scale(1.25);
}
.bs-dot:hover { background: rgba(255,255,255,.7); }
[data-theme="light"] .bs-dot { border-color: rgba(0,0,0,.4); }
[data-theme="light"] .bs-dot.bs-dot-active { background: #222; border-color: #222; }

/* ── 모바일 ── */
@media (max-width: 600px) {
    .bs-arrow { width: 32px; height: 32px; font-size: 1.4rem; opacity: .75; }
    .bs-prev { left: 6px; }
    .bs-next { right: 6px; }
    .bs-dots { bottom: 8px; gap: 5px; }
    .bs-dot  { width: 7px; height: 7px; }
}
@media (max-width: 400px) {
    .bs-arrow { width: 28px; height: 28px; font-size: 1.2rem; }
    .bs-dots { bottom: 6px; }
}

/* ── notice banner ───────────────────────────────── */
.notice-banner-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.notice-banner {
    width: 100%;
    border-bottom: 1px solid rgba(0,0,0,.12);
}

/* ── 다크 모드 배경 ── */
:root .notice-info,
[data-theme="dark"] .notice-info    { background: #1a1840; }
:root .notice-success,
[data-theme="dark"] .notice-success { background: #0d2618; }
:root .notice-warn,
[data-theme="dark"] .notice-warn    { background: #251c07; }
:root .notice-danger,
[data-theme="dark"] .notice-danger  { background: #280d0d; }

/* ── 라이트 모드 배경 ── */
[data-theme="light"] .notice-info    { background: #ededff; }
[data-theme="light"] .notice-success { background: #e6f7ec; }
[data-theme="light"] .notice-warn    { background: #fff7e0; }
[data-theme="light"] .notice-danger  { background: #fff0f0; }

/* 타입별 상단 강조 선 */
.notice-info    { border-top: 3px solid #6c63ff; }
.notice-success { border-top: 3px solid #4caf72; }
.notice-warn    { border-top: 3px solid #e0a050; }
.notice-danger  { border-top: 3px solid #e05c5c; }

/* 레이아웃 */
.notice-banner-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: .9rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 56px;
}

/* ── 태그 영역 (아이콘 + 레이블) ── */
.notice-tag {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .18rem;
    flex-shrink: 0;
    width: 56px;
}
.notice-tag-icon { font-size: 1.45rem; line-height: 1; }
.notice-tag-label {
    font-size: .6rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.notice-info    .notice-tag-label { color: #9d98ff; }
.notice-success .notice-tag-label { color: #5fd49a; }
.notice-warn    .notice-tag-label { color: #e0b060; }
.notice-danger  .notice-tag-label { color: #ff9090; }
[data-theme="light"] .notice-info    .notice-tag-label { color: #5a52d5; }
[data-theme="light"] .notice-success .notice-tag-label { color: #1e7a40; }
[data-theme="light"] .notice-warn    .notice-tag-label { color: #a05808; }
[data-theme="light"] .notice-danger  .notice-tag-label { color: #c02020; }

/* ── 구분선 ── */
.notice-divider {
    width: 1px;
    align-self: stretch;
    margin: 0 1rem;
    flex-shrink: 0;
}
.notice-info    .notice-divider { background: rgba(108,99,255,.35); }
.notice-success .notice-divider { background: rgba(76,175,114,.35); }
.notice-warn    .notice-divider { background: rgba(224,160,80,.4);  }
.notice-danger  .notice-divider { background: rgba(224,92,92,.4);   }
[data-theme="light"] .notice-info    .notice-divider { background: rgba(90,82,213,.25);  }
[data-theme="light"] .notice-success .notice-divider { background: rgba(46,138,80,.25);  }
[data-theme="light"] .notice-warn    .notice-divider { background: rgba(180,110,20,.3);  }
[data-theme="light"] .notice-danger  .notice-divider { background: rgba(200,40,40,.25);  }

/* ── 텍스트 영역 ── */
.notice-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: .28rem;
}

.notice-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
}
.notice-info    .notice-title { color: #cac6ff; }
.notice-success .notice-title { color: #90ddb0; }
.notice-warn    .notice-title { color: #f5d888; }
.notice-danger  .notice-title { color: #ffaaaa; }
[data-theme="light"] .notice-info    .notice-title { color: #3530a8; }
[data-theme="light"] .notice-success .notice-title { color: #145830; }
[data-theme="light"] .notice-warn    .notice-title { color: #7a4400; }
[data-theme="light"] .notice-danger  .notice-title { color: #b01010; }

.notice-content {
    margin: 0;
    font-size: .875rem;
    line-height: 1.65;
}
:root .notice-content,
[data-theme="dark"] .notice-content { color: rgba(224,228,240,.82); }
[data-theme="light"] .notice-content { color: rgba(26,29,48,.78); }

/* ── 모바일 ── */
@media (max-width: 600px) {
    .notice-banner-inner { padding: .75rem .85rem; gap: 0; }
    .notice-tag { width: 44px; }
    .notice-tag-icon { font-size: 1.2rem; }
    .notice-divider { margin: 0 .7rem; }
    .notice-title { font-size: .92rem; }
    .notice-content { font-size: .82rem; }
}

/* ── usage widget (index.php 상단 용량 바) ────────── */
.usage-widget {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 130px;
}
.usage-text {
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
}
.usage-pct { font-weight: 600; }
.usage-widget.usage-warn  .usage-text { color: #e0a050; }
.usage-widget.usage-critical .usage-text { color: var(--danger); }
.usage-bar-wrap {
    height: 5px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}
.usage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width .3s;
}
.usage-fill-warn     { background: #e0a050; }
.usage-fill-critical { background: var(--danger); }

/* ── profile quota section ───────────────────────── */
.profile-quota-wrap { display: flex; flex-direction: column; gap: .6rem; }
.profile-quota-info {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    flex-wrap: wrap;
}
.profile-quota-used  { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.quota-over          { color: var(--danger) !important; }
.profile-quota-sep   { color: var(--muted); font-size: 1rem; }
.profile-quota-limit { font-size: .95rem; color: var(--muted); }
.profile-quota-pct   { font-size: .82rem; color: var(--muted); margin-left: .25rem; }
.quota-pct-warn      { color: #e0a050 !important; }
.profile-quota-bar-wrap {
    height: 10px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
    max-width: 480px;
}
.profile-quota-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width .4s;
}
.quota-warning-msg {
    font-size: .85rem;
    color: var(--danger);
    margin-top: .25rem;
}

/* ── site footer ─────────────────────────────────── */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--muted);
    font-size: .78rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

@media (max-width: 600px) {
    .topbar {
        padding: .55rem .75rem;
        flex-wrap: nowrap;          /* 2줄 방지 */
        gap: .35rem;
        overflow: hidden;
    }
    .topbar-brand { font-size: 1rem; flex-shrink: 0; }
    .topbar-brand svg { width: 20px; height: 20px; }
    .topbar-actions {
        gap: .25rem;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    /* 아이콘만 남기고 텍스트 숨김 */
    .hide-sm    { display: none; }
    .brand-text { display: none; }
    /* 버튼 크기: 아이콘만 있으므로 패딩 최소화 */
    .topbar-actions .btn-outline-sm {
        padding: .32rem .5rem;
        font-size: .8rem;
    }
    .topbar-user {
        font-size: .85rem;
        max-width: none;
        padding: .28rem .42rem;
    }

    .container { padding: 1rem .75rem; }
    .filedate { display: none; }   /* td + th 모두 숨김 */
    .folder-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .bulk-toolbar { flex-direction: column; align-items: flex-start; }
    .upload-card, .file-list-card { padding: 1rem; }
    .file-list-header,
    .manager-header {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }
    .file-list-header h2,
    .manager-header > * { width: 100%; box-sizing: border-box; }
    .manager-header-right {
        justify-content: space-between;
        width: 100%;
    }
    .search-form { width: 100%; min-width: 0; }
    .search-form input { flex: 1; min-width: 0; }
}

/* ── 모바일에서 우측 세로 스크롤바 숨김 ─────────────────
   페이지 스크롤은 정상 동작하되 시각적 스크롤바만 제거.
   브레이크포인트(768px) 이하 — 태블릿 세로·휴대폰 전부 포함. */
@media (max-width: 768px) {
    html, body { scrollbar-width: none; -ms-overflow-style: none; }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none; }
    /* 내부 컨테이너 스크롤(table-wrap 등)도 모바일에서는 숨김 */
    *::-webkit-scrollbar { width: 0; height: 0; }
    * { scrollbar-width: none; -ms-overflow-style: none; }
}
