/* ========== 스터디 스킨 (아보카도 퍼스널) ========== */

:root {
    --study-primary: #7c6af5;
    --study-primary-rgb: 124, 106, 245;
    --study-accent: var(--study-primary);
    --study-accent-rgb: var(--study-primary-rgb);
    --study-bg: rgba(255,255,255,0.9);
    --study-surface: rgba(255,255,255,0.9);
    --study-border: #ddd;
    --study-bar-track: #e8e8e8;
    --study-text: #3a3530;
    --study-text-muted: #8a8578;
    --study-success: #6b9e5e;
    --study-danger: #e57373;
    --study-today-bg: rgba(255,255,255,0.9);
    --study-today-text: var(--study-text);
    --study-divider: var(--study-border);
    --study-log-num: var(--study-text);
    --study-work-tag: var(--study-primary);
    --study-work-memo: #555;
    --study-work-feedback: #888;
    --study-work-study: var(--study-primary);
    --study-work-text-bg: rgba(255,255,255,0.8);
    --study-work-card-bg: rgba(255,255,255,0);
    --study-work-border: #ddd;
}

/* ── 기본 ── */
#study_board { color: var(--study-text); font-family: inherit; font-size: 12px; }
#study_view,
#study_write { color: #333; font-family: inherit; font-size: 12px; }
#study_board button,
#study_board select,
#study_board input,
#study_board textarea,
#study_board a,
#study_view button,
#study_view select,
#study_view input,
#study_view textarea,
#study_view a { font-family: inherit; }
#study_board input[type="text"],
#study_board input[type="url"],
#study_board input[type="number"],
#study_board textarea,
#study_board select,
#study_view input[type="text"],
#study_view input[type="url"],
#study_view input[type="number"],
#study_view textarea,
#study_view select {
    background: #fff;
    color: #333;
    border-color: #ddd;
}



/* 전체 가로 폭 제한 — 화면이 넓어도 읽기 편한 너비로 */
#study_board { max-width: 1400px; margin-left: auto; margin-right: auto; }
#study_view  { max-width: 900px;  margin-left: auto; margin-right: auto; }
/* ========== 메인 3단 그리드 (오늘 할 일 | 대시보드 | 스터디 목록) ========== */
.study-main-grid {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: stretch;
    margin-top: 8px;
    padding-top: calc((100vh - 620px) / 2 - 20px);
    min-height: 0;
}
.study-main-grid .main-col {
    min-width: 0; flex: 1;
}
.dash-col-wrap {
    display: flex; flex-direction: column; gap: 8px;
    width: 250px; flex-shrink: 0;
}
.study-today-col {
    background: var(--study-today-bg);
    color: var(--study-today-text);
    border: 1px solid var(--study-border);
    border-radius: 12px;
    padding: 20px 14px;
    overflow-y: auto;
    width: 250px; flex-shrink: 0;
    min-height: 320px;
}
.study-dashboard {
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: 12px;
    padding: 20px 14px;
    display: flex; flex-direction: column; gap: 0;
    flex: 1; min-height: 0;
    overflow-y: auto;
}
.dash-part {
    padding: 16px 0;
    border-bottom: 1px solid var(--study-divider);
}
.dash-part:first-child { padding-top: 0; }
.dash-part:last-child { border-bottom: none; padding-bottom: 0; flex: 1; }
@media (max-width: 1100px) {
    .study-main-grid { flex-wrap: wrap; }
    .study-today-col { width: 220px; height: auto; }
    .dash-col-wrap { width: 220px; height: auto; }
}
@media (max-width: 760px) {
    .study-main-grid { flex-direction: column; min-height: auto; align-items: stretch; }
    .study-today-col { width: auto; height: auto; }
    .dash-col-wrap { width: auto; height: auto; }
}

/* 대시보드 공통 */
.dash-section {
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: 10px;
    padding: 14px 16px;
}
.dash-section h3,
.dash-part h3 {
    font-size: 12px; font-weight: 700; color: var(--study-text);
    margin: 0 0 8px;
    display: flex; align-items: center; gap: 8px;
}
.dash-section h3 .dash-title,
.dash-part h3 .dash-title { letter-spacing: 0.02em; }
.dash-section h3 .dash-count,
.dash-part h3 .dash-count {
    font-size: 11px; min-width: 22px; height: 22px;
    padding: 0 6px; border-radius: 11px;
    background: var(--study-border); color: var(--study-text-muted);
    font-weight: 600;
    margin-left: auto;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 1; box-sizing: border-box;
}
.dash-empty {
    font-size: 12px; color: var(--study-text-muted);
    opacity: 0.7; padding: 4px 2px;
}
.dash-empty-ok { color: var(--study-success); opacity: 0.8; font-weight: 600; }
.dash-more {
    font-size: 11px; color: var(--study-text-muted);
    padding: 4px 2px; text-align: center; font-style: italic;
}

/* 진행 중 */
.dash-progress .dash-count {
    background: rgba(var(--study-primary-rgb), 0.15);
    color: var(--study-primary);
}
.dash-progress-item {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 0;
    color: inherit;
}
.dash-progress-item + .dash-progress-item {
    border-top: none;
}
.dpi-title {
    font-size: 12px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    flex: 1; min-width: 0;
}
.dpi-bar-track {
    width: 60px; height: 5px; background: var(--study-bar-track); border-radius: 3px;
    overflow: hidden; flex-shrink: 0;
}
.dpi-bar-fill {
    height: 100%;
    background: var(--study-primary);
    border-radius: 2px;
    transition: width 0.3s;
}
.dpi-pct {
    font-size: 11px; font-weight: 700; color: var(--study-primary);
    flex-shrink: 0; min-width: 26px; text-align: right;
}
.dpi-range {
    font-size: 10px; color: var(--study-text-muted);
    flex-shrink: 0; white-space: nowrap;
}

/* 놓친 항목 */
.dash-missed .dash-count {
    background: rgba(229, 115, 115, 0.18);
    color: var(--study-danger);
}
.dash-missed-item {
    padding: 6px 0; border-bottom: 1px dashed var(--study-divider);
}
.dash-missed-item:last-of-type { border-bottom: none; }
.dmi-top {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 2px;
}
.dmi-date {
    font-size: 11px; font-weight: 700; color: var(--study-danger);
    padding: 1px 5px; border-radius: 3px;
    background: rgba(229, 115, 115, 0.12);
}
.dmi-study {
    font-size: 11px; color: var(--study-text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dmi-text {
    font-size: 12px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 이번 주 완료 */
.dash-week-stat { text-align: center; padding: 4px 0 2px; }
.dw-big {
    font-size: 22px; font-weight: 700;
    color: var(--study-text); line-height: 1;
    margin-bottom: 8px;
}
.dw-big .dw-done { color: var(--study-primary); }
.dw-big .dw-sep { color: var(--study-text-muted); margin: 0 4px; font-weight: 400; }
.dw-big .dw-total { color: var(--study-text-muted); font-weight: 400; }
.dw-bar-track {
    height: 8px; background: var(--study-bar-track); border-radius: 4px;
    overflow: hidden; margin-bottom: 6px;
}
.dw-bar-fill {
    height: 100%;
    background: var(--study-primary);
    transition: width 0.3s;
}
.dw-sub { font-size: 11px; color: var(--study-text-muted); }

/* 대시보드 링크 */
.dash-link-manage {
    margin-left: auto;
    background: none; border: none; cursor: pointer;
    font-size: 14px; font-weight: 700; line-height: 1;
    color: var(--study-text-muted); opacity: 0.6;
    transition: opacity 0.12s;
}
.dash-link-manage:hover { opacity: 1; }

/* 링크 관리 팝업 */
.link-manage-row {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 0; border-bottom: 1px solid #eee;
}
.link-manage-row:last-child { border-bottom: none; }
.lm-drag-handle { cursor: grab; color: #aaa; font-size: 14px; flex-shrink: 0; user-select: none; }
.lm-drag-handle:hover { color: #666; }
.lm-info { flex: 1; min-width: 0; }
.lm-title { font-size: 12px; font-weight: 600; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-url { font-size: 10px; color: #888; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lm-vis { font-size: 10px; color: #888; flex-shrink: 0; display: flex; align-items: center; gap: 3px; cursor: pointer; }
.lm-level {
    font-size: 10px; padding: 1px 4px; border: 1px solid #ddd;
    border-radius: 3px; background: #fff; color: #333; flex-shrink: 0;
}
.lm-edit, .lm-del {
    background: none; border: none; cursor: pointer;
    font-size: 11px; padding: 2px 4px; color: #888;
    border-radius: 3px;
}
.lm-edit:hover { color: #333; background: #eee; }
.lm-del:hover { color: #e57373; background: #fef5f5; }
.lm-add-form {
    display: flex; gap: 6px; align-items: center;
    padding: 8px 0 10px; border-bottom: 1px solid #eee; margin-bottom: 4px;
}
.lm-input {
    flex: 1; padding: 5px 8px; font-size: 12px;
    border: 1px solid #ddd; border-radius: 4px; outline: none;
    font-family: inherit; min-width: 0;
}
.lm-input:focus { border-color: var(--study-primary); }
.lm-add-form .ui-btn { flex-shrink: 0; font-size: 11px; padding: 5px 12px; }
.link-manage-row .lm-input { flex: 1; }
.link-manage-row .lm-save-edit,
.link-manage-row .lm-cancel-edit { flex-shrink: 0; font-size: 11px; padding: 4px 10px; }
.dash-links-list {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px;
}
.dash-link-item {
    display: flex; align-items: center; gap: 4px;
    padding: 3px 0;
    min-width: 0;
}
.dash-link-url {
    flex: 1; font-size: 12px; color: var(--study-primary);
    text-decoration: none; font-weight: 500;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-link-url:hover { text-decoration: underline; }
.dash-link-del {
    background: none; border: none; cursor: pointer;
    font-size: 11px; color: var(--study-text-muted);
    opacity: 0; padding: 0; transition: opacity 0.12s;
}
.dash-link-item:hover .dash-link-del { opacity: 0.5; }
.dash-link-del:hover { opacity: 1 !important; color: var(--study-danger); }

/* 미니 달력 (대시보드 내부) */
.dash-mini-cal-block {
    padding: 14px 0 0;
}
.mini-cal-nav {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    margin-bottom: 8px;
}
.mini-cal-nav button {
    background: none; border: none; cursor: pointer;
    font-size: 10px; color: var(--study-text-muted); padding: 2px 4px;
}
.mini-cal-nav button:hover { color: var(--study-primary); }
.mini-cal-title { font-size: 12px; font-weight: 700; min-width: 80px; text-align: center; }
.mini-cal-dow {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center; font-size: 10px; font-weight: 600;
    color: var(--study-text-muted); margin-bottom: 2px;
}
.mini-cal-grid {
    display: grid; grid-template-columns: repeat(7, 1fr);
    text-align: center; gap: 1px;
}
.mini-cal-day {
    font-size: 11px; line-height: 1;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    color: var(--study-text);
    box-sizing: border-box;
}
.mini-cal-day.sunday { color: #e57373; }
.mini-cal-day.saturday { color: #5b9bd5; }
.mini-cal-day.today {
    font-weight: 700; color: var(--study-primary);
}
.mini-cal-day.checked {
    background: rgba(var(--study-primary-rgb), 0.15);
    font-weight: 600;
}
.mini-cal-day.today.checked {
    background: var(--study-primary); color: #fff;
}
.mini-cal-day { cursor: pointer; transition: background .15s; }
.mini-cal-day:hover { background: rgba(var(--study-primary-rgb), 0.10); }
.mini-cal-day.selected { outline: 2px solid var(--study-primary); outline-offset: -2px; }
.mini-cal-back-today {
    font-size: 11px; margin-left: 8px; padding: 2px 8px; border-radius: 10px;
    border: 1px solid var(--study-primary); color: var(--study-primary);
    background: transparent; cursor: pointer; vertical-align: middle;
}
.mini-cal-back-today:hover { background: var(--study-primary); color: #fff; }
.today-item.no-toggle { cursor: default; opacity: 0.85; }
.today-item.no-toggle .today-check { pointer-events: none; }
.mini-cal-blank { visibility: hidden; }

/* ui-btn — 테마 기본 스타일 위에 border-radius만 보강 */
#study_board .ui-btn {
    border-radius: 6px;
    font-size: 12px;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
#study_view .ui-btn {
    border-radius: 6px;
    font-size: 12px;
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
    transition: background 0.12s, border-color 0.12s;
}
#study_view .ui-btn:hover { background: #eee; border-color: #ccc; }
#study_view .ui-btn.point { background: var(--study-primary); color: #fff; border-color: var(--study-primary); }
#study_view .ui-btn.point:hover { filter: brightness(0.95); }
#study_view .ui-btn.admin { background: #555; color: #fff; border-color: #555; }

/* ========== 오늘 할 일 위젯 ========== */
.study-today-col .dash-today {
    border: none; padding: 0; border-radius: 0;
    background: none;
}
.study-today-col .today-study-name { color: var(--study-today-text); opacity: 0.6; }
.study-today-col .today-text { color: var(--study-today-text); }
.study-today-col .today-date { color: var(--study-today-text); opacity: 0.6; }
.study-today-col .dash-title { color: var(--study-today-text); }
.dash-today h3 { flex-wrap: nowrap; align-items: center; }
.dash-today h3 { font-size: 15px; }
.dash-today h3 .dash-title { font-weight: 700; line-height: 1; }
.dash-today h3 .dash-count {
    background: var(--study-primary); color: #fff;
    font-size: 12px; min-width: 24px; height: 24px;
    padding: 0 7px; border-radius: 12px;
}
.today-date { font-size: 11px; color: var(--study-text-muted); font-weight: 400; }
.today-body { margin-top: 8px; }

.today-study-group { margin-bottom: 10px; }
.today-study-group:last-child { margin-bottom: 0; }
.today-study-name {
    font-size: 11px; font-weight: 700; color: var(--study-text-muted);
    text-transform: uppercase; letter-spacing: 0.04em;
    padding: 2px 2px 4px;
}

.today-item {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 2px;
    font-size: 12px; cursor: pointer; margin-bottom: 2px;
    transition: background 0.12s, transform 0.08s;
}
.today-item:hover { background: rgba(var(--study-primary-rgb), 0.04); border-radius: 4px; }
.today-item:active { transform: scale(0.995); }
.today-item.done { opacity: 0.55; }
.today-item.done .today-text { text-decoration: line-through; }
.today-check {
    display: inline-flex; align-items: center; justify-content: center;
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--study-text-muted); font-size: 10px; color: #fff;
    flex-shrink: 0;
}
.today-item.done .today-check { background: var(--study-primary); border-color: var(--study-primary); }
.today-study { font-size: 11px; color: var(--study-text-muted); flex-shrink: 0; }
.today-text { flex: 1; word-break: break-word; line-height: 1.4; }

.today-done-list { margin-top: 8px; padding-top: 6px; }

/* ========== 스터디 목록 ========== */
.study-list-head {
    display: flex; align-items: center; gap: 4px;
    margin-bottom: 12px;
}
.study-list-title { font-size: 15px; font-weight: 700; flex: 1; }

/* 완료 숨기기 토글 */
.hide-completed-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; color: #888; cursor: pointer; user-select: none;
    white-space: nowrap;
}
.hide-completed-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.hc-track {
    position: relative; display: inline-block;
    width: 28px; height: 16px; border-radius: 8px;
    background: #ccc; transition: background 0.2s;
}
.hc-thumb {
    position: absolute; top: 2px; left: 2px;
    width: 12px; height: 12px; border-radius: 50%;
    background: #fff; transition: transform 0.2s;
}
.hide-completed-toggle input:checked ~ .hc-track { background: var(--study-primary); }
.hide-completed-toggle input:checked ~ .hc-track .hc-thumb { transform: translateX(12px); }
.hc-label { line-height: 1; }

/* 톱니바퀴 버튼 */
.study-customize-btn { min-width: 0 !important; aspect-ratio: 1; padding: 0 !important; display: inline-flex !important; align-items: center; justify-content: center; font-weight: 700; }

/* 카테고리 필터 */
.study-category-row {
    display: flex; align-items: flex-start; gap: 8px;
    margin-bottom: 12px;
}
.study-category-filter {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    flex: 1; min-width: 0;
}
.dash-hide-completed { flex-shrink: 0; margin-top: 2px; }
.cat-chip {
    display: inline-block; padding: 4px 12px;
    font-size: 12px; font-weight: 600; border-radius: 14px;
    background: var(--study-surface); border: 1px solid var(--study-border);
    color: var(--study-text-muted); text-decoration: none;
    transition: all 0.12s;
}
.cat-chip:hover { border-color: var(--study-primary); color: var(--study-primary); }
.cat-chip.active {
    background: var(--study-primary); border-color: var(--study-primary);
    color: #fff;
}

/* 카드 드래그 핸들 */
.card-drag-handle {
    position: absolute; top: 8px; right: 8px;
    font-size: 14px; color: var(--study-text-muted); opacity: 0;
    cursor: grab; user-select: none; z-index: 2;
    transition: opacity 0.15s;
    line-height: 1;
}
.study-card:hover .card-drag-handle { opacity: 0.5; }
.card-drag-handle:hover { opacity: 1 !important; }
.card-drag-ghost {
    opacity: 0.4;
    border: 2px dashed var(--study-primary) !important;
}

/* 카드 카테고리 배지 */
.study-card-cat {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 1px 8px; border-radius: 10px; margin-bottom: 6px;
    background: rgba(var(--study-primary-rgb), 0.2);
    color: var(--study-primary);
    border: 1px solid rgba(var(--study-primary-rgb), 0.3);
}

.study-cards {
    list-style: none; padding: 0; margin: 0;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.study-card {
    position: relative;
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.study-card:hover {
    border-color: var(--study-primary);
}
.study-card.completed { opacity: 0.6; }
.study-card-link {
    display: block; padding: 14px 16px;
    text-decoration: none; color: inherit;
}
.study-card-title {
    font-size: 14px; font-weight: 600; margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.study-card-title-text {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.study-card-title .vis-badge { flex-shrink: 0; opacity: 0.4; }
i.completed-check.material-icons { font-size: 11px !important; vertical-align: -1px; margin-left: 2px; }
.study-card.locked { opacity: 0.5; }
.study-card-locked { cursor: default; pointer-events: none; }
.vis-badge { display: inline-flex; align-items: center; opacity: 0.5; }
.vis-badge .material-icons { font-size: 14px; }
.study-card-tags { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; flex-wrap: wrap; }
.study-card-tags:empty { display: none; }
.study-card-bar {
    height: 6px; background: var(--study-bar-track); border-radius: 3px; overflow: hidden;
    margin-bottom: 6px;
}
.study-card-bar .bar-fill {
    height: 100%; background: var(--study-primary);
    transition: width 0.2s;
}
.study-card-meta {
    display: flex; justify-content: space-between;
    font-size: 12px; color: var(--study-text-muted);
}
.completed-date { color: var(--study-success); }

/* 카드 내 미리보기 */
.study-card-preview {
    margin-top: 10px; padding-top: 8px;
    border-top: 1px dashed var(--study-border);
    display: flex; flex-direction: column; gap: 3px;
}
.preview-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--study-text-muted);
}
.preview-date {
    flex-shrink: 0; font-size: 10px; font-weight: 600;
    padding: 1px 5px; border-radius: 3px;
    background: var(--study-border); color: var(--study-text-muted);
}
.preview-date.today { background: var(--study-primary); color: #fff; }
.preview-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.study-empty {
    grid-column: 1 / -1; text-align: center;
    padding: 40px 0; color: var(--study-text-muted); font-size: 13px;
}
.study-paging { text-align: center; margin-top: 20px; }

/* ========== 스터디 상세 ========== */
#study_view { padding: 0 4px; }
.study-view-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 10px 0; border-bottom: 1px solid var(--study-divider);
    margin-bottom: 10px;
}
.study-view-title { font-size: 16px; font-weight: 700; flex: 1 1 auto; min-width: 200px; outline: none; }
.study-view-title[contenteditable]:hover { border-bottom: 1px dashed var(--study-border); }
.study-view-title[contenteditable]:focus { border-bottom: 1px solid var(--study-primary); }
.study-mode-tabs {
    display: inline-flex; border: 1px solid #ddd;
    border-radius: 6px; overflow: hidden;
}
.study-tab {
    padding: 6px 14px; font-size: 12px; border: none;
    background: #f5f5f5; color: #888; cursor: pointer;
    transition: background 0.12s, color 0.12s; font-family: inherit;
}
.study-tab.active {
    background: var(--study-primary);
    color: #fff; font-weight: 600;
}
.study-view-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.study-view-actions .ui-btn { border-radius: 20px; }
.study-delete-btn.ui-btn { background: #e53935 !important; color: #fff !important; border-color: #e53935 !important; min-width: 0; aspect-ratio: 1; padding: 0 !important; width: 28px; display: inline-flex; align-items: center; justify-content: center; }
.study-delete-btn.ui-btn:hover { filter: brightness(0.9); }
.vis-select-sm {
    font-size: 11px; padding: 2px 4px; border: 1px solid var(--study-border);
    border-radius: 4px; background: var(--study-bg); color: var(--study-text-muted);
    cursor: pointer; flex-shrink: 0; font-family: inherit;
}

/* 저장 상태 점 — 레이아웃 안 밀리게 고정폭 */
.save-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: transparent; border: 1.5px solid var(--study-border);
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.save-dot[data-state="typing"] { background: #d6b65a; border-color: #d6b65a; }
.save-dot[data-state="saving"] { background: #d6b65a; border-color: #d6b65a; animation: save-pulse 0.8s ease-in-out infinite; }
.save-dot[data-state="saved"] { background: var(--study-success); border-color: var(--study-success); }
.save-dot[data-state="error"] {
    background: var(--study-danger); border-color: var(--study-danger);
    box-shadow: 0 0 0 3px rgba(229, 115, 115, 0.2);
}
@keyframes save-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* 아웃라인 툴바 (편집모드 + 가중치 모드) */
.outline-edit-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; padding: 0; border-radius: 6px;
    background: #f5f5f5; border: 1px solid #ddd;
    color: #888; cursor: pointer; transition: all .15s;
}
.outline-edit-toggle:hover { color: var(--study-primary); border-color: var(--study-primary); }
.outline-edit-toggle.active {
    background: var(--study-primary) !important;
    border-color: var(--study-primary) !important;
    color: #fff !important;
}
.weight-mode-ctrl {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 12px; color: var(--study-text-muted);
}
.weight-mode-ctrl .label { font-size: 12px; }
.wmode-btn { font-size: 12px !important; padding: 3px 10px !important; }
.wmode-btn.active {
    background: var(--study-primary) !important;
    border-color: var(--study-primary) !important;
    color: #fff !important;
}

/* 수동 가중치 패널 */
.weight-panel {
    margin: 6px 4px 10px; padding: 10px 12px;
    background: rgba(var(--study-primary-rgb), 0.05);
    border: 1px solid var(--study-border); border-radius: 8px;
}
.weight-panel .weight-head {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 8px; user-select: none;
}
.weight-panel .weight-head .toggle-arrow { font-size: 11px; color: #888; }
.weight-panel .weight-head .sum { margin-left: auto; }
.weight-panel .weight-head .title { font-size: 12px; font-weight: 700; color: var(--study-text); }
.weight-panel .weight-head .sum {
    font-size: 12px; color: var(--study-text-muted);
    padding: 2px 10px; border-radius: 10px; background: var(--study-surface);
    border: 1px solid var(--study-border);
}
.weight-panel .weight-head .sum.ok {
    color: var(--study-success); border-color: var(--study-success);
    background: rgba(107, 158, 94, 0.08);
}
.weight-panel .weight-head .sum b { color: var(--study-text); }
.weight-panel .weight-head .sum.ok b { color: var(--study-success); }
.weight-list {
    columns: 2; column-gap: 12px;
}
.weight-row {
    display: flex; align-items: center; gap: 6px;
    padding: 3px 0;
    break-inside: avoid;
}
.weight-row .name {
    flex: 1; font-size: 12px; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.weight-row input {
    width: 40px; padding: 3px 4px; font-size: 12px; text-align: right;
    border: 1px solid var(--study-border); border-radius: 4px;
    background: var(--study-surface); outline: none;
    font-family: inherit;
    -moz-appearance: textfield;
}
.weight-row input::-webkit-outer-spin-button,
.weight-row input::-webkit-inner-spin-button {
    -webkit-appearance: none; margin: 0;
}
.weight-row input:focus { border-color: var(--study-primary); }
.weight-row .pct { font-size: 12px; color: var(--study-text-muted); width: 10px; }

/* depth 1 항목에 작은 가중치 배지 */
.oi-badge.weight {
    background: rgba(var(--study-primary-rgb), 0.12);
    color: var(--study-primary); border-color: transparent;
    font-weight: 600;
}

.study-view-progress {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
}
.study-view-progress .bar-track {
    flex: 1; height: 8px; background: var(--study-bar-track); border-radius: 4px; overflow: hidden;
    min-width: 60px;
}
.study-view-progress .bar-fill {
    height: 100%; background: var(--study-primary);
    transition: width 0.2s;
}
.progress-label { font-size: 14px; font-weight: 700; color: var(--study-text-muted); min-width: 36px; }
.study-period { font-size: 11px; color: var(--study-text-muted); white-space: nowrap; }
.progress-toolbar { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.progress-toolbar:empty, .progress-toolbar.hidden { display: none !important; }

.study-pane { display: none; min-height: 400px; }
.study-pane.active { display: block; }
.outline-pane {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 10px; padding: 12px;
}
.schedule-pane {
    padding: 8px 0;
}

/* ========== 아웃라이너 ========== */
.outline-root { padding: 8px 4px; }
.outline-empty {
    text-align: center; padding: 40px 0;
    color: var(--study-text-muted); font-size: 13px;
    border: 1px dashed var(--study-border); border-radius: 8px;
    cursor: pointer;
}
.outline-empty:hover { border-color: var(--study-primary); color: var(--study-primary); }

.outline-item {
    display: flex; align-items: center; gap: 6px;
    min-height: 32px; padding: 2px 0; border-radius: 4px;
}
.outline-item.selected { background: rgba(var(--study-primary-rgb), 0.1); }
.outline-item.dragging { opacity: 0.4; }

.oi-handle {
    width: 14px; flex-shrink: 0; cursor: grab; opacity: 0.25;
    display: flex; align-items: center; justify-content: center; color: var(--study-text);
}
.outline-item:hover .oi-handle,
.outline-item.selected .oi-handle { opacity: 0.6; }
.outline-item.readonly .oi-handle { display: none; }

.oi-caret {
    width: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}
.oi-caret .triangle {
    position: relative;
    width: 0; height: 0;
    border-left: 6px solid var(--study-text-muted);
    border-top: 4.5px solid transparent;
    border-bottom: 4.5px solid transparent;
    cursor: pointer;
    transition: transform 0.12s;
}
.oi-caret .triangle::before {
    content: '';
    position: absolute;
    top: -10px; left: -10px; right: -10px; bottom: -10px;
}
.oi-caret .triangle.open { transform: rotate(90deg); }
.oi-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--study-border); }

.oi-check {
    width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%;
    border: 1.5px solid var(--study-text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
}
.oi-check.checked { background: var(--study-primary); border-color: var(--study-primary); }
.oi-check.checked::after {
    content: ''; display: block; width: 4px; height: 8px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg); margin-bottom: 2px;
}
.oi-check.repeat-count {
    font-size: 9px; font-weight: 700; line-height: 16px;
    color: var(--study-primary); border-color: var(--study-primary);
}

.oi-text {
    font-size: 12px;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
    color: #333;
    padding: 4px 6px;
    flex: 0 1 auto;
    min-width: 120px;
    font-family: inherit;
    border-radius: 0;
}
.oi-text::placeholder { color: var(--study-border); opacity: 1; }
/* 편집 모드 ON 일 때만 포커스 시 밑줄 힌트 */
#study_view[data-editing="1"] .oi-text:focus {
    box-shadow: inset 0 -1px 0 rgba(var(--study-primary-rgb), 0.4) !important;
}
.oi-text.depth-0 { font-size: 13px; font-weight: 600; }
.outline-item.checked .oi-text { color: var(--study-text-muted); text-decoration: line-through; }
.oi-text[readonly] { cursor: default; }

.oi-badge {
    font-size: 10px; padding: 1px 6px; border-radius: 3px;
    color: var(--study-text-muted); border: 1px solid var(--study-border);
    flex-shrink: 0;
}
.oi-badge.date { color: var(--study-primary); border-color: transparent; opacity: 0.75; }
.oi-badge.repeat {
    padding: 1px 7px; border-radius: 10px;
    background: var(--study-border); color: var(--study-text-muted);
    border: none;
}
.oi-badge.repeat.done { background: var(--study-primary); color: #fff; }

.oi-progress {
    display: inline-flex; align-items: center; gap: 6px;
    flex-shrink: 0; width: 80px;
}
.oi-progress .bar-track { flex: 1; height: 3px; background: var(--study-border); border-radius: 2px; overflow: hidden; }
.oi-progress .bar-fill { height: 100%; background: var(--study-primary); transition: width 0.2s; }
.oi-progress .label { font-size: 11px; color: var(--study-text-muted); }

.oi-weight {
    font-size: 10px; padding: 1px 6px; border: 1px solid var(--study-border);
    border-radius: 3px; color: var(--study-text-muted);
    background: transparent; outline: none; width: 36px; text-align: center;
    font-family: inherit;
}
.oi-weight:focus { border-color: var(--study-primary); color: var(--study-text); }

/* 선택 액션 바 */
.outline-select-bar {
    display: none; align-items: center; gap: 8px;
    padding: 6px 12px; border-bottom: 1px solid var(--study-divider);
    background: rgba(var(--study-primary-rgb), 0.08);
    font-size: 12px;
}
.outline-select-bar.show { display: flex; }
.outline-select-bar .count { color: var(--study-primary); font-weight: 600; }

/* 컨텍스트 메뉴 */
.outline-ctx-menu {
    position: fixed; z-index: 9999;
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    min-width: 140px; padding: 4px 0;
    display: none;
}
.outline-ctx-menu.show { display: block; }
.outline-ctx-menu .mi {
    padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.outline-ctx-menu .mi:hover { background: rgba(var(--study-primary-rgb), 0.1); }

/* 반복 팝업 */
.study-modal-overlay {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(0,0,0,0.4);
    display: none; align-items: center; justify-content: center;
}
.study-modal-overlay.show { display: flex; }
.study-modal {
    background: var(--study-surface);
    border: 1px solid var(--study-border);
    border-radius: 10px; padding: 16px;
    width: 260px; max-width: 90vw;
}
.study-modal .title { font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.study-modal .hint { font-size: 11px; color: var(--study-text-muted); margin-bottom: 10px; }
.study-modal .actions { display: flex; gap: 6px; }
.study-modal .actions .ui-btn { flex: 1; text-align: center; }
.study-modal input[type="number"],
.study-modal input[type="text"] {
    width: 100%; padding: 8px 10px; font-size: 13px;
    border: 1px solid var(--study-border); border-radius: 6px;
    outline: none; box-sizing: border-box;
    background: var(--study-surface); color: var(--study-text);
    font-family: inherit;
}
.study-modal input:focus,
.study-modal select:focus { border-color: var(--study-primary); }
.study-modal select,
.new-study-category {
    width: 100%; padding: 8px 10px; border: 1px solid var(--study-border);
    border-radius: 6px; font-size: 11px; margin-bottom: 8px;
    background: var(--study-surface); color: var(--study-text);
    font-family: inherit;
}
.study-modal input::placeholder { color: #aaa; }
.new-study-name { margin-bottom: 8px; }

/* ========== 스케줄뷰 ========== */
.schedule-pane.active { display: flex; gap: 12px; padding: 8px 0; }

.schedule-pane, .schedule-pane * { color: #333; }
.schedule-unassigned {
    width: 160px; flex-shrink: 0;
    padding: 14px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    max-height: 500px; overflow-y: auto;
    scrollbar-width: none; -ms-overflow-style: none;
}
.schedule-unassigned::-webkit-scrollbar { display: none; }
.schedule-calendar {
    flex: 1; min-width: 0;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 10px;
    padding: 14px;
}
.schedule-unassigned .label {
    font-size: 12px; font-weight: 600; color: #888;
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px;
}
.schedule-unassigned .drop-zone {
    min-height: 200px;
    padding: 4px; border-radius: 6px;
    border: 1px solid transparent;
}
.schedule-unassigned .drop-zone.over {
    border-color: var(--study-primary);
    background: rgba(var(--study-primary-rgb), 0.05);
}
.unassigned-group-label {
    font-size: 11px; font-weight: 600; color: #888;
    padding: 6px 0 4px; cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: 4px;
}
.unassigned-group-label .toggle-arrow { font-size: 10px; }
.unassigned-group { margin-bottom: 4px; }
.unassigned-empty { font-size: 12px; color: #888; opacity: 0.5; padding: 10px; text-align: center; }

.unassigned-item {
    padding: 5px 10px; font-size: 12px; cursor: grab;
    background: #fff; border: 1px solid #ddd;
    border-radius: 6px; margin-bottom: 4px;
}
.unassigned-item:hover { border-color: var(--study-primary); }
.unassigned-item .parents {
    font-size: 10px; color: #888; opacity: 0.6;
    line-height: 1.3; word-break: break-all;
}
.unassigned-item.checked { opacity: 0.5; text-decoration: line-through; }
.unassigned-item.repeat-slot { }
.repeat-slot-badge {
    display: inline-block; font-size: 10px; color: var(--study-primary);
    font-weight: 600; margin-left: 4px; opacity: 0.7;
}
.cal-item.repeat { }

.schedule-calendar .nav {
    display: flex; align-items: center; justify-content: center; gap: 16px;
    margin-bottom: 8px;
}
.schedule-calendar .nav button {
    background: none; border: none; cursor: pointer;
    font-size: 14px; color: #888;
}
.schedule-calendar .nav .title { font-size: 13px; font-weight: 600; min-width: 110px; text-align: center; }

.schedule-calendar .dow {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
    margin-bottom: 2px;
}
.schedule-calendar .dow .d {
    text-align: center; font-size: 11px; padding: 2px 0;
    color: #888; font-weight: 600;
}
.schedule-calendar .grid {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px;
}
.cal-cell {
    min-height: 80px; padding: 2px 4px; border-radius: 6px;
    border: 1px solid #ddd;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.cal-cell.today { border-color: var(--study-primary); }
.cal-cell.over { background: rgba(var(--study-primary-rgb), 0.1); border-color: var(--study-primary); }
.cal-cell .day-num {
    text-align: right; font-size: 11px; padding: 2px 4px;
    color: #888;
}
.cal-cell.today .day-num { color: var(--study-primary); font-weight: 700; }
.cal-cell.weekend .day-num { color: #e57373; }

.cal-header-line {
    font-size: 10px; font-weight: 600; color: #888;
    opacity: 0.6; padding: 2px 4px 0; margin-top: 2px;
}
.cal-item {
    display: flex; align-items: center; gap: 4px;
    padding: 2px 4px; font-size: 11px; margin-bottom: 1px;
    background: #fff; border: 1px solid #ddd;
    border-radius: 3px; cursor: grab;
}
.cal-item .text { flex: 1; overflow: hidden; word-break: break-word; white-space: normal; line-height: 1.3; }
.cal-item .unassign {
    background: none; border: none; cursor: pointer;
    color: #888; opacity: 0.3; font-size: 10px; padding: 0;
}
.cal-item .unassign:hover { opacity: 1; color: #e57373; }
.cal-item.checked { opacity: 0.5; text-decoration: line-through; }

/* ========== 글쓰기 ========== */
#study_write { padding: 20px 0; max-width: 500px; margin: 0 auto; }
.study-write-box { display: flex; flex-direction: column; gap: 8px; }
.study-write-label { font-size: 12px; font-weight: 600; margin-top: 8px; color: var(--study-text-muted); }
.frm_input {
    width: 100%; padding: 8px 10px; font-size: 13px;
    border: 1px solid var(--study-border); border-radius: 6px;
    outline: none; background: var(--study-surface); color: var(--study-text);
    box-sizing: border-box;
}
.frm_input:focus { border-color: var(--study-primary); }
.study-write-actions {
    display: flex; gap: 6px; margin-top: 20px; justify-content: center;
}
.study-write-actions .ui-btn { padding: 8px 20px; }

/* 편집 모드에서만 드래그 가능 */
#study_view[data-editing="0"] .oi-handle { visibility: hidden; }
#study_view[data-can-edit="0"] .oi-check { cursor: default; pointer-events: none; }

/* 드래그 중 */
.dragging-ghost {
    position: fixed; pointer-events: none; z-index: 10000;
    padding: 6px 10px; font-size: 12px;
    background: var(--study-surface);
    border: 1px solid var(--study-primary);
    border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* SortableJS helper classes */
.sortable-ghost { opacity: 0.3; background: rgba(var(--study-primary-rgb), 0.1); }
.sortable-chosen { background: rgba(var(--study-primary-rgb), 0.08); }

/* 편집 모드 가이드 토스트 */
.study-edit-hint {
    position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px);
    z-index: 10001;
    background: rgba(58, 53, 48, 0.95); color: #fff;
    padding: 10px 14px; border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    opacity: 0; transition: opacity 0.2s, transform 0.2s;
    display: flex; align-items: center; gap: 10px;
    max-width: 90vw;
}
.study-edit-hint.show { opacity: 1; transform: translate(-50%, 0); }
.study-edit-hint .hint-body {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: 12px;
}
.study-edit-hint .hint-title {
    font-weight: 700; color: var(--study-accent);
    padding-right: 10px; border-right: 1px solid rgba(255,255,255,0.2);
}
.study-edit-hint .hint-tip { opacity: 0.85; }
.study-edit-hint .hint-tip b { color: #fff; font-weight: 600; margin: 0 2px; }
.study-edit-hint .hint-dismiss {
    background: none; border: none; cursor: pointer;
    color: #fff; opacity: 0.5; font-size: 13px; padding: 0 4px;
}
.study-edit-hint .hint-dismiss:hover { opacity: 1; }


/* 전체 작업물 뷰 (인페이지) */
.all-works-view {
    margin-top: 8px;
    height: calc(100vh - 85px);
    display: flex; flex-direction: column;
    overflow: hidden;
    max-width: 1000px;
    margin-left: auto; margin-right: auto;
}
.aw-header {
    display: flex; align-items: center; gap: 4px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.aw-header-spacer { flex: 1; }
.aw-search-box {
    display: flex; align-items: center; gap: 0;
    position: relative; flex-shrink: 0; margin-top: 4px;
}
.aw-view-toggle {
    display: flex; border: 1px solid var(--study-border); border-radius: 6px; overflow: hidden;
    flex-shrink: 0;
}
.aw-view-btn {
    padding: 5px 10px; font-size: 14px; border: none;
    background: var(--study-surface); color: var(--study-text-muted); cursor: pointer;
    transition: background 0.12s, color 0.12s; line-height: 1;
}
.aw-view-btn.active {
    background: var(--study-primary);
    color: #fff;
}
.aw-search-select {
    font-size: 12px; padding: 6px 8px; border: 1px solid var(--study-border);
    border-radius: 6px 0 0 6px; background: var(--study-surface); color: var(--study-text);
    border-right: none; cursor: pointer; flex-shrink: 0;
}
.aw-search-input {
    flex: 1; font-size: 12px; padding: 6px 10px;
    border: 1px solid var(--study-border); border-radius: 0;
    background: var(--study-bg); color: var(--study-text);
    min-width: 0;
}
.aw-search-input:focus { border-color: var(--study-primary); outline: none; }
.aw-search-box .ui-btn {
    font-size: 12px; padding: 6px 12px; border-radius: 0;
    flex-shrink: 0;
}
.aw-search-box .ui-btn:last-child { border-radius: 0 6px 6px 0; }
.aw-links {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 0 12px;
}
.aw-cat-filter {
    display: flex; gap: 4px; flex-wrap: wrap;
    flex-shrink: 0; margin-bottom: 4px;
}
.aw-cat-chip {
    font-size: 12px; padding: 3px 10px; border-radius: 14px;
    border: 1px solid var(--study-border); background: var(--study-surface); color: var(--study-primary);
    cursor: pointer; transition: all 0.12s; font-family: inherit;
    text-decoration: none; white-space: nowrap;
}
.aw-cat-chip:hover { border-color: var(--study-primary); }
.aw-cat-chip.active {
    background: var(--study-primary); border-color: var(--study-primary); color: #fff;
}
.aw-link-chip {
    padding: 3px 10px; font-size: 12px; font-weight: 500;
    border-radius: 14px; text-decoration: none;
    background: var(--study-surface);
    color: var(--study-primary);
    border: 1px solid var(--study-border);
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.aw-link-chip:hover {
    border-color: var(--study-primary);
}

/* 작업물 브라우즈 (좌: 스터디 사이드바 / 우: 피드) */
.works-browse {
    display: grid; grid-template-columns: 240px 1fr;
    gap: 24px; align-items: stretch;
    flex: 1; min-height: 0;
}
.works-sidebar-wrap {
    display: flex; flex-direction: column; gap: 8px;
    overflow: hidden;
}
.works-study-sidebar {
    display: flex; flex-direction: column; gap: 8px;
    flex: 1; min-height: 0; overflow-y: auto;
    scrollbar-width: none; -ms-overflow-style: none;
}
.works-study-sidebar::-webkit-scrollbar { display: none; }
/* 사이드바 오늘 할 일 패널 — 대시보드 today 구조 그대로 사용 */
.ws-today-panel {
    border: 1px solid var(--study-border); border-radius: 10px;
    background: var(--study-today-bg);
    color: var(--study-today-text);
    padding: 10px 12px; margin-bottom: 4px;
}
.ws-today-panel .today-study-name { color: var(--study-today-text); opacity: 0.6; }
.ws-today-panel .today-text { color: var(--study-today-text); }
.ws-today-panel .dash-title { color: var(--study-today-text); }
.ws-today-panel .dash-today { border: none; padding: 0; border-radius: 0; background: none; }

.ws-item {
    padding: 10px 12px;
    border: 1px solid var(--study-border);
    border-radius: 10px; cursor: pointer;
    background: var(--study-surface);
    transition: border-color 0.12s;
}
.ws-item:hover { border-color: var(--study-primary); }
.ws-item.active {
    border: 3px solid var(--study-primary);
}
.ws-item-all {
    font-size: 13px; font-weight: 700;
    text-align: center; color: var(--study-text);
}
.ws-item-all.active { color: var(--study-primary); }
.ws-card-title {
    font-size: 13px; font-weight: 600; margin-bottom: 6px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-card-count { font-weight: 400; font-size: 12px; color: var(--study-text-muted); }
.ws-card-progress {
    display: flex; align-items: center; gap: 6px;
}
.ws-card-progress .study-card-bar { flex: 1; margin-bottom: 0; }
.ws-card-pct { font-size: 12px; color: var(--study-text-muted); min-width: 28px; }
.ws-card-progress .completed-date { font-size: 11px; color: var(--study-text-muted); white-space: nowrap; }
.ws-card { position: relative; }
.ws-card-go {
    position: absolute; top: 8px; right: 8px;
    font-size: 18px; font-weight: 700; text-decoration: none;
    color: var(--study-text-muted); opacity: 0;
    transition: opacity 0.12s;
    line-height: 1;
}
.ws-card:hover .ws-card-go { opacity: 0.5; }
.ws-card-go:hover { opacity: 1 !important; color: var(--study-primary); }
.ws-completed-date {
    position: absolute; top: 8px; right: 30px;
    font-size: 10px; color: var(--study-text-muted);
}
.ws-card.completed { opacity: 0.6; }
.ws-completed-check.material-icons { font-size: 11px !important; vertical-align: -1px; margin-left: 2px; }
.works-browse-main {
    min-width: 0;
    overflow-y: auto;
    scrollbar-width: none; -ms-overflow-style: none;
    background: var(--study-work-card-bg);
    border-radius: 10px;
    padding: 16px;
}
.works-browse-main::-webkit-scrollbar { display: none; }
@media (max-width: 760px) {
    .works-browse { grid-template-columns: 1fr; }
    .all-works-view { height: auto; overflow: visible; }
    .works-sidebar-wrap { position: static; }
    .works-browse-main { overflow-y: visible; }
    .works-study-sidebar { flex-direction: row; flex-wrap: wrap; max-height: none; }
    .ws-item { white-space: nowrap; }
}

/* ========== 작업물 (Works) ========== */
.works-upload-area { margin-bottom: 16px; }
.works-upload-form { display: flex; flex-direction: column; gap: 8px; }

.works-drop-zone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 24px 16px;
    border: 2px dashed var(--study-border); border-radius: 10px;
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
    background: rgba(var(--study-primary-rgb), 0.02);
}
.works-drop-zone:hover,
.works-drop-zone.drag-over {
    border-color: var(--study-primary);
    background: rgba(var(--study-primary-rgb), 0.06);
}
.drop-icon { font-size: 24px; color: var(--study-text-muted); line-height: 1; }
.drop-text { font-size: 12px; color: var(--study-text-muted); }
.works-file-input { display: none; }

.works-file-preview {
    position: relative; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--study-border); background: var(--study-bg);
    text-align: center;
}
.works-file-preview img {
    max-width: 100%; max-height: 200px; display: block; margin: 0 auto;
}
.file-name-preview {
    display: block; padding: 12px; font-size: 12px; color: var(--study-text);
}
.works-file-clear {
    position: absolute; top: 6px; right: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(0,0,0,0.5); color: #fff; border: none;
    cursor: pointer; font-size: 12px; line-height: 1;
}

.works-memo {
    width: 100%; padding: 8px 10px; border: 1px solid var(--study-border);
    border-radius: 6px; font-size: 12px; resize: vertical;
    background: var(--study-surface); color: var(--study-text);
    font-family: inherit;
}
.works-memo:focus { border-color: var(--study-primary); outline: none; }
.works-submit-btn { align-self: flex-end; }

/* 작업물 피드 */
.works-feed {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, 4), 1fr);
    gap: 12px;
}
.works-loading, .works-empty {
    grid-column: 1 / -1; text-align: center;
    padding: 30px 0; font-size: 12px; color: #888;
}


.works-pane, .works-pane * { color: #333; }
.work-card {
    background: transparent; border: 1px solid #ddd;
    border-radius: 10px; overflow: hidden;
    display: flex; flex-direction: column;
}

.work-image {
    position: relative; background: #f5f5f5;
    line-height: 0;
}
.work-image img {
    width: 100%; display: block;
    object-fit: cover; height: 180px;
}

/* 전체 작업물 목록 (browse) — 피드 모드 (기본) */
.works-browse-main .works-feed,
.works-browse-main .works-feed[data-view="feed"] {
    display: flex; flex-direction: column; gap: 0;
}
.works-browse-main .works-feed[data-view="feed"] .work-card {
    border: none; border-radius: 0; background: none;
    padding: 16px 0;
}
.works-browse-main .works-feed[data-view="feed"] .work-card + .work-card {
    border-top: 1px solid #ddd;
}
.works-browse-main .works-feed[data-view="feed"] .work-image img {
    height: auto; object-fit: contain;
}
.works-browse-main .works-feed[data-view="feed"] .work-text-area {
    padding: 12px 16px 8px; font-size: 13px;
}
.works-browse-main .works-feed[data-view="feed"] .work-meta {
    padding: 8px 16px 12px;
}

/* 전체 작업물 목록 (browse) — 그리드 모드 */
.works-browse-main .works-feed[data-view="grid"] {
    display: grid;
    grid-template-columns: repeat(var(--gallery-cols, 4), 1fr);
    gap: 16px;
}
.works-browse-main .works-feed[data-view="grid"] .work-card {
    background: var(--study-work-card-bg, #fff); border: 1px solid var(--study-work-border);
    border-radius: 10px; overflow: hidden; padding: 0;
}
.works-browse-main .works-feed[data-view="grid"] .work-meta {
    background: var(--study-work-text-bg);
    padding: 6px 12px 10px;
}
.works-browse-main .works-feed[data-view="grid"] .work-study-name {
    font-weight: normal; color: inherit;
}
.works-browse-main .works-feed[data-view="grid"] .work-image img {
    height: 180px; object-fit: cover;
}
.works-browse-main .works-feed[data-view="grid"] .work-text-area {
    padding: 10px 12px 6px; font-size: 12px;
}

/* 스터디 상세 작업물 — 그리드 모드 */
.works-pane .works-feed[data-view="grid"] .work-card {
    background: var(--study-work-card-bg, #fff); border: 1px solid var(--study-work-border);
}
.works-pane .works-feed[data-view="grid"] .work-log-num {
    background: var(--study-work-text-bg);
}
.works-pane .works-feed[data-view="grid"] .work-meta {
    background: var(--study-work-text-bg);
    padding: 6px 12px 10px;
}
.works-pane .works-feed[data-view="grid"] .work-text-area {
    padding: 10px 12px 6px;
}
.works-pane .works-feed[data-view="grid"] .work-meta button {
    color: #888;
}

/* 스터디 상세 작업물 — 피드 모드에서만 구분선 */
.works-pane .works-feed[data-view="feed"] { gap: 0; }
.works-pane .works-feed[data-view="feed"] .work-card {
    border: none; border-radius: 0; background: none;
    padding: 12px 0;
}
.works-pane .works-feed[data-view="feed"] .work-card + .work-card {
    border-top: 1px solid #ddd;
}
.work-copy-thumb {
    position: absolute; top: 6px; right: 6px;
    padding: 6px 14px; border-radius: 6px;
    background: rgba(0,0,0,0.6); color: #fff;
    border: none; cursor: pointer; font-size: 12px; font-weight: 700;
    opacity: 0; transition: opacity 0.15s;
}
.work-image:hover .work-copy-thumb,
.work-file-attach:hover .work-copy-thumb { opacity: 1; }

.work-file-attach {
    position: relative; padding: 12px; font-size: 12px;
    background: rgba(var(--study-primary-rgb), 0.04);
}
.work-file-attach a {
    color: var(--study-primary); text-decoration: none; font-weight: 600;
    word-break: break-all;
}
.work-file-attach .work-copy-thumb {
    position: absolute; top: 6px; right: 6px;
}

.work-text-area { padding: 10px 12px 6px; font-size: 12px; line-height: 1.5; color: var(--study-work-memo); flex: 1; background: var(--study-work-text-bg); }
.work-text-area .work-memo,
.work-text-area .work-feedback-text { padding: 0; margin: 0; font-size: inherit; line-height: inherit; }
.work-text-area .work-link-tag + .work-memo,
.work-text-area .work-link-tag + .work-feedback-text { margin-top: 16px; }
.work-text-area .work-memo + .work-feedback-text { margin-top: 16px; }
.work-link-tag {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 0;
    font-size: inherit; color: var(--study-work-tag); font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.work-link-check {
    display: inline-block; flex-shrink: 0;
    padding: 2px 8px; font-size: 11px; font-weight: 700;
    color: var(--study-work-tag);
    background: rgba(var(--study-primary-rgb), 0.12);
    border-radius: 999px; line-height: 1.4;
}
.work-log-num {
    padding: 8px 12px 4px; font-size: 28px; font-weight: 800;
    color: var(--study-log-num);
    line-height: 1; font-family: inherit;
}
.work-link-row { margin-bottom: 8px; }
.link-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.link-tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; font-size: 11px;
    background: rgba(var(--study-primary-rgb), 0.12);
    color: var(--study-primary); border-radius: 12px;
    font-weight: 500;
}
.link-tag-chip button {
    background: none; border: none; cursor: pointer;
    font-size: 12px; color: var(--study-primary); padding: 0; line-height: 1;
    opacity: 0.6;
}
.link-tag-chip button:hover { opacity: 1; }
.link-tags:empty { display: none; }
.work-memo {
    padding: 10px 12px; font-size: 12px; line-height: 1.5;
    color: var(--study-work-memo); word-break: break-word; white-space: pre-wrap;
}
.work-meta {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px 10px; font-size: 11px; color: #888;
    background: var(--study-work-text-bg);
    margin-top: auto;
}
.work-study-name {
    font-weight: 600; color: var(--study-work-study);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-right: auto;
}
.work-date { white-space: nowrap; }

.works-section-title {
    font-size: 15px; font-weight: 700; color: #888;
    margin: 0 0 10px;
}
.works-toolbar {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 12px;
}
.works-view-toggle {
    display: flex; border: 1px solid #ddd; border-radius: 6px; overflow: hidden;
    margin-right: auto;
}
.wv-btn {
    padding: 5px 10px; border: none; background: #f5f5f5;
    font-size: 14px; cursor: pointer; color: #888;
    transition: background 0.12s, color 0.12s; line-height: 1;
}
.wv-btn.active { background: var(--study-primary); color: #fff; }
.wv-btn:not(.active):hover { background: #eee; }
.work-modal { max-width: 520px; width: 90%; }
.work-url-row { margin: 8px 0; }
.work-url-label {
    display: block; font-size: 11px; color: var(--study-text-muted);
    margin-bottom: 4px; font-weight: 600;
}
.work-url-row.disabled { opacity: 0.35; pointer-events: none; }
.work-url-preview {
    margin-top: 6px; border-radius: 6px; overflow: hidden;
    border: 1px solid var(--study-border); text-align: center;
}
.work-url-preview img { max-width: 100%; max-height: 160px; display: block; margin: 0 auto; }
.work-modal .works-memo { margin-bottom: 8px; }
/* 피드(로드비) 모드 */
.works-feed[data-view="feed"] {
    grid-template-columns: 1fr;
    max-width: calc(100% - 16px);
    margin: 0 auto;
    gap: 20px;
}
.works-feed[data-view="feed"] .work-card {
    border: none; border-radius: 0; background: none;
    border-bottom: 1px solid var(--study-border);
    padding-bottom: 16px;
}
.works-feed[data-view="feed"] .work-image img {
    height: auto;
    object-fit: contain;
}
.works-feed[data-view="feed"] .work-text-area {
    padding: 12px 16px 8px; font-size: 13px;
}
.works-feed[data-view="feed"] .work-meta {
    padding: 8px 16px 12px;
}

/* 작업물 피드백 표시 */
.work-feedback-text {
    font-size: 12px; color: var(--study-work-feedback);
    line-height: 1.5; padding: 0;
    margin: 2px 0 0;
    white-space: pre-wrap; word-break: break-word;
}
.work-feedback-text::before {
    content: '●';
    font-size: 6px; margin-right: 5px;
    vertical-align: middle;
    color: var(--study-accent); opacity: 0.7;
}
.work-edit, .work-delete {
    background: none; border: none; cursor: pointer;
    font-size: 12px; padding: 0; font-weight: 700;
    font-family: inherit; opacity: 0.4;
    transition: opacity 0.12s;
    color: var(--study-primary);
}
.work-edit:hover, .work-delete:hover { opacity: 1; }

/* 스터디 회고 */
.study-review-section {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--study-border);
    border-radius: 10px; padding: 16px 20px; margin: 12px 0;
}
.review-header {
    display: flex; align-items: center; margin-bottom: 14px;
}
.review-header .review-title {
    flex: 1; margin: 0;
}
.review-header .review-edit-toggle {
    margin-left: auto;
}
.review-title {
    font-size: 15px; font-weight: 700;
    color: var(--study-accent);
}
.review-divider {
    display: block !important;
    border: none; border-top: 1px dashed var(--study-divider);
    margin: 12px 0;
}
.review-field { margin-bottom: 16px; }
.review-field label {
    display: block; font-size: 16px; font-weight: 700;
    color: #333; margin-bottom: 8px;
}
.review-content {
    font-size: 13px; line-height: 1.7; color: #333;
    white-space: pre-wrap; word-break: break-word;
}
.review-textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd;
    border-radius: 6px; font-size: 12px; line-height: 1.6;
    font-family: inherit; resize: vertical;
    background: #fff; color: #333;
}
.review-textarea::placeholder { color: #aaa; }
.review-textarea:focus { border-color: var(--study-primary); outline: none; }
.review-editor-actions { display: flex; align-items: center; gap: 6px; }
.review-cancel { color: #888 !important; }
.review-save-status {
    font-size: 12px; color: var(--study-success);
    margin-left: 8px; font-weight: 600;
}

/* 이미지 라이트박스 */
.work-lightbox {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0.85);
    overflow: auto;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.work-lightbox.is-scrollable {
    align-items: flex-start; justify-content: flex-start;
}
.work-lightbox img {
    max-width: calc(100vw - 48px);
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.work-lb-close {
    position: absolute; top: 16px; right: 20px;
    background: none; border: none; color: #fff;
    font-size: 28px; cursor: pointer; opacity: 0.7;
    line-height: 1;
}
.work-lb-close:hover { opacity: 1; }

.works-load-more { text-align: center; margin-top: 16px; }

.works-paging {
    flex-shrink: 0;
}
.works-paging .pg_wrap { padding: 6px 0; }
.works-paging-top .pg_wrap { padding-bottom: 8px; }

/* ========== 커스터마이징 팝업 ========== */
.study-customize-popup {
    position: fixed; top: 80px; right: 30px;
    width: 340px; background: #fff; color: #333;
    border: 1px solid #ddd; border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 99990; font-size: 12px;
}
.scp-header {
    display: flex; align-items: center; padding: 10px 14px;
    border-bottom: 1px solid #ddd;
    cursor: move; user-select: none;
}
.scp-title { flex: 1; font-weight: 700; font-size: 13px; }
.scp-close {
    background: none; border: none; font-size: 18px;
    cursor: pointer; color: #999; padding: 0;
}
.scp-presets {
    padding: 10px 14px; border-bottom: 1px solid #ddd;
}
.scp-preset-label { font-size: 11px; font-weight: 600; color: #888; margin-bottom: 6px; }
.scp-preset-btns { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.scp-preset {
    font-size: 11px; padding: 3px 8px; border: 1px solid #ddd;
    border-radius: 4px; background: #f8f8f8; color: #333;
    cursor: pointer; transition: background 0.12s;
}
.scp-preset:hover { background: #eee; }
.scp-preset-custom { display: flex; gap: 4px; align-items: stretch; flex-wrap: wrap; }
.scp-preset-custom .scp-preset { display: flex; align-items: center; }
.scp-saved-select {
    flex: 1; min-width: 80px; font-size: 11px; padding: 3px 4px;
    border: 1px solid #ddd; border-radius: 4px; background: #fff; color: #333;
}
.scp-mode {
    padding: 8px 14px; border-bottom: 1px solid #ddd;
}
.scp-mode-label {
    font-size: 12px; display: flex; align-items: center; gap: 6px; cursor: pointer;
}
.scp-body { padding: 12px 14px; max-height: 500px; overflow-y: auto; transition: opacity 0.15s; }
.scp-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.scp-row label { font-size: 12px; color: #333; flex-shrink: 0; }
.scp-inputs { display: flex; align-items: center; gap: 4px; }
.scp-bw {
    width: 20px; height: 20px; border-radius: 50%; border: 1px solid #ccc;
    background: #222; color: #fff; font-size: 10px; font-weight: 700;
    cursor: pointer; padding: 0; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.scp-bw.scp-w { background: #fff; color: #222; }
.scp-bw:hover { border-color: #888; }
.scp-inputs input[type="color"] {
    width: 28px; height: 24px; border: 1px solid #ddd;
    border-radius: 4px; padding: 0; cursor: pointer; background: #fff;
}
.scp-inputs .scp-hex {
    width: 110px; font-size: 11px; padding: 2px 6px;
    border: 1px solid #ddd; border-radius: 4px;
    font-family: monospace; text-align: center;
    background: #fff; color: #333;
}
.scp-sep { border-top: 1px solid #ddd; margin: 8px 0 4px; }
.scp-group-label { font-size: 10px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; }
.scp-row-sub { margin-top: -2px; margin-bottom: 8px; }
.scp-grad-label { font-size: 11px; color: #888; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.scp-footer {
    display: flex; gap: 6px; padding: 10px 14px;
    border-top: 1px solid #ddd;
}
.scp-option {
    padding: 8px 14px; border-top: 1px solid #ddd;
}
.scp-footer .ui-btn { flex: 1; text-align: center; font-size: 12px; }

/* 대시보드 숨김 시 2열 레이아웃 */
.study-main-grid.no-dash { justify-content: center; }

/* ========== 반응형 ========== */
@media (max-width: 768px) {
    .study-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .study-view-head { gap: 6px; }
    .study-view-title { width: 100%; font-size: 15px; }
    .schedule-pane.active { flex-direction: column; }
    .schedule-unassigned {
        width: 100%; max-height: 180px; overflow-y: auto;
        border-right: none; border-bottom: 1px solid var(--study-border);
        padding-right: 0; padding-bottom: 10px;
    }
    .cal-cell { min-height: 60px; }
    .cal-cell .day-num { font-size: 10px; }
    .cal-item { font-size: 10px; }
    .today-item { font-size: 12px; }
    .today-study { display: none; }
    .works-feed { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .works-browse-main .works-feed[data-view="grid"] { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

@media (max-width: 480px) {
    .study-cards { grid-template-columns: 1fr; }
    .schedule-calendar .grid { gap: 1px; }
    .cal-cell { min-height: 50px; padding: 1px 2px; }
    .study-view-actions .ui-btn { font-size: 12px; padding: 4px 8px; }
    .outline-item { gap: 4px; }
    .oi-text { font-size: 12px; }
    .oi-text.depth-0 { font-size: 12px; }
}

/* 편집 모드 아닐 때 체크박스 클릭만 유효 — 텍스트는 클릭 가능해 보이지 않게 */
#study_view[data-editing="0"] .oi-text { cursor: default; }
#study_view[data-editing="0"] .outline-item { cursor: default; }
