*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0f0f13;
    --bg2: #16161d;
    --surface: #1e1e28;
    --surface2: #26263a;
    --border: rgba(255,255,255,0.07);
    --accent: #7c6af7;
    --accent2: #a78bfa;
    --accent-glow: rgba(124,106,247,0.3);
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;
    --orange: #fb923c;
    --text: #e2e2ef;
    --text2: #9090b0;
    --text3: #5a5a7a;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --bg: #f0f2f8;
    --bg2: #ffffff;
    --surface: #f8f9fc;
    --surface2: #eaecf4;
    --border: rgba(0,0,0,0.08);
    --accent: #7c6af7;
    --accent2: #6d56f0;
    --accent-glow: rgba(124,106,247,0.18);
    --green: #10b981;
    --red: #ef4444;
    --yellow: #d97706;
    --orange: #ea580c;
    --text: #1a1a2e;
    --text2: #4a4a6a;
    --text3: #8a8ab0;
    --shadow: 0 8px 32px rgba(0,0,0,0.10);
}

/* 테마 전환 부드러운 애니메이션 */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
    transition: background-color 0.35s ease, color 0.35s ease,
                border-color 0.35s ease, box-shadow 0.35s ease !important;
}

html, body {
    height: 100%;
}

/* login page: body height must be auto to allow content taller than viewport */
body.login-body {
    height: auto;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow: hidden;
}

.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    min-width: 280px;
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    padding: 28px 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--surface2) transparent;
}

.sidebar-header {
    margin-bottom: 28px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent2), #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    user-select: none;
}
.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.stat-card.active-card { border-color: rgba(124,106,247,0.3); }
.stat-card.done-card { border-color: rgba(52,211,153,0.3); }
.stat-card.high-card { border-color: rgba(248,113,113,0.3); }

.stat-num {
    display: block;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.active-card .stat-num { color: var(--accent2); }
.done-card .stat-num { color: var(--green); }
.high-card .stat-num { color: var(--red); }

.stat-label {
    font-size: 11px;
    color: var(--text2);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
    display: block;
}

.sidebar-nav {
    margin-bottom: 24px;
}

.nav-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 8px;
    padding: 0 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text2);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    margin-bottom: 2px;
}

.nav-item i {
    width: 18px;
    text-align: center;
    font-size: 13px;
}

.nav-item:hover {
    background: var(--surface);
    color: var(--text);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(124,106,247,0.2), rgba(167,139,250,0.1));
    color: var(--accent2);
    border: 1px solid rgba(124,106,247,0.25);
}

.progress-section {
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.progress-bar-wrap {
    background: var(--surface);
    border-radius: 100px;
    height: 8px;
    overflow: hidden;
    margin: 10px 0 6px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 100px;
    transition: width 0.5s ease;
    width: 0%;
    box-shadow: 0 0 12px var(--accent-glow);
}

.progress-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent2);
}

.main-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}

.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 32px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.header-date {
    font-size: 13px;
    color: var(--text3);
    margin-top: 2px;
    display: block;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 16px;
    gap: 8px;
    transition: var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box i {
    color: var(--text3);
    font-size: 13px;
}

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-size: 14px;
    width: 180px;
    font-family: inherit;
}

.search-box input::placeholder {
    color: var(--text3);
}

.btn-add {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px var(--accent-glow);
    font-family: inherit;
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.todo-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 32px;
    flex-shrink: 0;
}

.sort-tabs {
    display: flex;
    background: var(--surface);
    border-radius: 50px;
    padding: 3px;
    gap: 2px;
}

.sort-btn {
    background: none;
    border: none;
    color: var(--text2);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.sort-btn.active {
    background: var(--accent);
    color: white;
}

.btn-clear-done {
    background: none;
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 7px 14px;
    border-radius: 50px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-clear-done:hover {
    border-color: var(--red);
    color: var(--red);
}

.todo-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--surface2) transparent;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: var(--text3);
}

.empty-icon {
    font-size: 52px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 18px;
    font-weight: 600;
    color: var(--text2);
}

.empty-state span {
    font-size: 14px;
}

.todo-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: var(--transition);
    animation: slideIn 0.3s ease forwards;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.todo-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 4px 0 0 4px;
}

.todo-item.priority-high::before { background: var(--red); }
.todo-item.priority-medium::before { background: var(--yellow); }
.todo-item.priority-low::before { background: var(--green); }

.todo-item:hover {
    border-color: rgba(124,106,247,0.3);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.todo-item.completed {
    opacity: 0.55;
}

.todo-item.removing {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(20px); height: 0; padding: 0; margin: 0; }
}

.todo-check {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border-radius: 50%;
    border: 2px solid #979797;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-top: 1px;
    background: none;
}

.todo-check:hover {
    border-color: var(--accent);
    background: var(--accent-glow);
}

.todo-item.completed .todo-check {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.todo-check i {
    font-size: 11px;
    display: none;
}

.todo-item.completed .todo-check i {
    display: block;
}

.todo-body {
    flex: 1;
    min-width: 0;
}

.todo-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.4;
    transition: var(--transition);
}

.todo-item.completed .todo-title {
    text-decoration: line-through;
    color: var(--text3);
}

.todo-desc {
    font-size: 13px;
    color: var(--text2);
    margin-top: 4px;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.todo-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.tag-category {
    background: rgba(124,106,247,0.15);
    color: var(--accent2);
    border: 1px solid rgba(124,106,247,0.2);
}

.tag-priority.high { background: rgba(248,113,113,0.12); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.tag-priority.medium { background: rgba(251,191,36,0.12); color: var(--yellow); border: 1px solid rgba(251,191,36,0.2); }
.tag-priority.low { background: rgba(52,211,153,0.12); color: var(--green); border: 1px solid rgba(52,211,153,0.2); }

.todo-date {
    font-size: 12px;
    color: var(--text2);
    margin-left: auto;
}

.todo-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--surface2);
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: var(--transition);
}

.action-btn:hover { background: var(--accent); color: white; }
.action-btn.delete:hover { background: var(--red); color: white; }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 28px;
    width: 480px;
    max-width: calc(100vw - 32px);
    box-shadow: var(--shadow);
    transform: translateY(20px) scale(0.97);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: var(--transition);
}

.modal-close:hover { background: var(--red); color: white; border-color: var(--red); }

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.required { color: var(--red); }

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: var(--transition);
    resize: vertical;
    color-scheme: dark;
}

.form-group input::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.5);
    opacity: 0.7;
    cursor: pointer;
}

[data-theme="light"] .form-group input::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 0.6;
}

.form-group input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: dark;
}

[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="time"],
[data-theme="light"] input[type="datetime-local"] {
    color-scheme: light;
}

/* 네이티브 달력 아이콘 숨김 */
#input-due-date::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

/* 날짜 입력 래퍼 */
.date-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrap input[type="date"] {
    width: 100%;
    padding-right: 42px;
}

.date-icon-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--accent2);
    font-size: 15px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.date-icon-btn:hover {
    background: rgba(124,106,247,0.2);
    color: white;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(2);
    opacity: 0.75;
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: rgba(124,106,247,0.25);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group select option {
    background: var(--surface);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.btn-cancel {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: none;
    color: var(--text2);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-cancel:hover { background: var(--surface2); color: var(--text); }

.btn-save {
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    box-shadow: var(--shadow);
    transform: translateY(16px);
    opacity: 0;
    transition: var(--transition);
    z-index: 999;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }

/* ===== DASHBOARD ===== */

/* 빠른 입력 폼 */
.dash-quick-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}
.dash-quick-form input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    height: 32px;
    padding: 0 10px;
    outline: none;
    transition: border-color 0.2s;
}
.dash-quick-form input:focus {
    border-color: var(--accent);
}
.dash-quick-form input[placeholder="제목"] {
    flex: 2;
    min-width: 80px;
}
.dash-quick-form input[placeholder="메모"] {
    flex: 3;
    min-width: 120px;
}
.dash-quick-form input[type="date"] {
    flex: 0 0 130px;
}
.dash-quick-form input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.5);
    opacity: 0.8;
    cursor: pointer;
}
[data-theme="light"] .dash-quick-form input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 0.6;
}
.btn-quick-date-icon {
    display: none;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text2);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}
.btn-quick-date-icon:hover { background: var(--surface3); color: var(--text); }

/* ── D-Day 배지 ── */
.dday-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-right: 5px;
    vertical-align: middle;
    white-space: nowrap;
    line-height: 1.6;
}
.dday-badge.dday-today    { background: var(--accent); color: #fff; }
.dday-badge.dday-soon     { background: #f87171;       color: #fff; }
.dday-badge.dday-upcoming { background: var(--surface3); color: var(--text2); border: 1px solid var(--border); }
.dday-badge.dday-overdue  { background: #6b7280;       color: #fff; }

/* ── 드래그 핸들 ── */
.drag-handle {
    display: flex;
    align-items: center;
    padding: 0 6px 0 2px;
    color: var(--text2);
    cursor: grab;
    font-size: 13px;
    opacity: 0.3;
    flex-shrink: 0;
    transition: opacity 0.15s;
    touch-action: none;
}
.todo-item:hover .drag-handle { opacity: 0.7; }
.todo-item.dragging {
    opacity: 0.4;
    outline: 2px dashed var(--accent);
    border-radius: var(--radius);
}
.todo-item.drag-over { border-top: 2px solid var(--accent); }

/* ── 요일 선택기 ── */
.weekday-picker {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}
.weekday-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text2);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.weekday-btn.active            { background: var(--accent); color: #fff; border-color: var(--accent); }
.weekday-btn:hover:not(.active){ background: var(--surface3); color: var(--text); }

.btn-quick-add {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 32px;
    padding: 0 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-quick-add:hover {
    background: var(--accent2);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* 뷰 전환 토글 */
.dash-view-toggle {
    display: flex;
    gap: 3px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.dash-view-btn {
    width: 32px; height: 32px;
    border: none; background: none;
    border-radius: 7px;
    color: var(--text3);
    cursor: pointer;
    font-size: 13px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.dash-view-btn:hover  { background: var(--surface2); color: var(--text2); }
.dash-view-btn.active { background: var(--accent); color: #fff; }

.dashboard-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 32px 32px;
    scrollbar-width: thin;
    scrollbar-color: var(--surface2) transparent;
}

/* 스플릿 뷰 */
.dashboard-split-body {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 24px;
    padding: 32px 32px;
    overflow: hidden;
}

.dash-split-left {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dash-split-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.dash-split-panel-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.dash-split-panel-header h3 i { color: var(--accent2); }

.dash-split-right {
    width: 320px;
    min-width: 280px;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--surface2) transparent;
}

.dash-mini-cal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    flex-shrink: 0;
}

.dash-mini-cal-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

/* 미니 달력 그리드 */
.month-grid.mini .month-weekday {
    font-size: 10px;
    padding: 4px 0;
}
.month-grid.mini .month-day {
    min-height: 40px;
    padding: 4px 3px 2px;
    cursor: pointer;
}
.month-grid.mini .day-num {
    font-size: 11px;
    line-height: 18px;
    width: 18px; height: 18px;
}
.month-grid.mini .today .day-num {
    width: 18px; height: 18px;
    font-size: 11px;
}

/* 미니 달력 이벤트 점 */
.mini-dots {
    display: flex;
    gap: 2px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 2px 0 1px;
}
.mini-dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
    display: block;
}

.dash-cal-section {
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.dash-cal-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.dash-todo-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dash-todo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.dash-todo-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-todo-header h3 i { color: var(--accent2); }

#dash-todo-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-secondary {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text2) !important;
    box-shadow: none !important;
}

.btn-secondary:hover {
    border-color: var(--accent) !important;
    color: var(--accent2) !important;
}

/* ===== SCHEDULE ===== */
#section-dashboard, #section-todo, #section-schedule {
    flex: 1;       
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.sch-view-tabs {
    display: flex;
    gap: 4px;
    padding: 0 32px 0;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sch-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text2);
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: -1px;
}

.sch-tab:hover { color: var(--text); }
.sch-tab.active { color: var(--accent2); border-bottom-color: var(--accent); }

.sch-nav-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    flex-shrink: 0;
}

.sch-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: var(--transition);
}

.sch-nav-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

.sch-nav-label {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    min-width: 160px;
    text-align: center;
}

.sch-today-btn {
    margin-left: auto;
    padding: 6px 14px;
    border-radius: 50px;
    border: 1px solid var(--border);
    background: none;
    color: var(--text2);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.sch-today-btn:hover { background: var(--accent); color: white; border-color: var(--accent); }

.sch-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 32px 32px;
    scrollbar-width: thin;
    scrollbar-color: var(--surface2) transparent;
}

/* 오늘/일 뷰 */
.day-view-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 16px 0 10px;
}

.time-slot {
    display: flex;
    gap: 14px;
    min-height: 52px;
    border-top: 1px solid var(--border);
    position: relative;
}

.time-slot:last-child { border-bottom: 1px solid var(--border); }

.time-label {
    width: 52px;
    min-width: 52px;
    font-size: 11px;
    color: var(--text3);
    padding: 6px 0;
    text-align: right;
    font-weight: 500;
}

.time-events {
    flex: 1;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sch-event {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: rgba(124,106,247,0.12);
    border-left: 3px solid var(--accent);
    color: var(--text);
}

.sch-event:hover { filter: brightness(1.2); transform: translateX(2px); }

.sch-event-time {
    font-size: 11px;
    color: var(--text2);
    white-space: nowrap;
}

.sch-event-title { flex: 1; }

.sch-event-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.sch-event:hover .sch-event-actions { opacity: 1; }

.sch-event-btn {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: none;
    background: rgba(255,255,255,0.1);
    color: var(--text2);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sch-event-btn:hover { background: rgba(255,255,255,0.25); color: white; }
.sch-event-btn.del:hover { background: var(--red); }

.no-events {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    color: var(--text3);
    gap: 8px;
}

.no-events i { font-size: 36px; opacity: 0.4; }
.no-events p { font-size: 15px; }

/* 월 달력 */
.month-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 8px;
}

.month-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.month-weekday {
    text-align: center;
    padding: 10px 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.month-weekday:first-child { color: #f87171; }
.month-weekday:last-child { color: #60a5fa; }

.month-weeks {
    display: flex;
    flex-direction: column;
}

.month-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid var(--border);
}

.month-week:last-child { border-bottom: none; }

.month-day {
    min-height: 90px;
    border-right: 1px solid var(--border);
    padding: 6px 8px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.month-day:last-child { border-right: none; }
.month-day:hover { background: rgba(124,106,247,0.07); }
.month-day.other-month { opacity: 0.35; }

.month-day.today .day-num {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 4px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.month-day:nth-child(1) .day-num { color: #f87171; }
.month-day:nth-child(7) .day-num { color: #60a5fa; }

.day-event-dot {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    font-weight: 500;
    color: white;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
}

.day-event-dot .dot-del {
    display: none;
    margin-left: auto;
    min-width: 14px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.3);
    color: white;
    font-size: 9px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.day-event-dot:hover .dot-del { display: flex; }
.day-event-dot .dot-del:hover { background: var(--red); }

.day-more {
    font-size: 10px;
    color: var(--text3);
    padding: 1px 4px;
}

/* 년 뷰 */
.year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 8px;
}

.mini-month {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.mini-month:hover { border-color: var(--accent); transform: translateY(-2px); }
.mini-month.current-month { border-color: var(--accent); background: rgba(124,106,247,0.08); }

.mini-month-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
    text-align: center;
}

.mini-cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.mini-cal-head {
    font-size: 9px;
    text-align: center;
    color: var(--text3);
    font-weight: 600;
    padding: 2px 0;
}

.mini-cal-day {
    font-size: 9px;
    text-align: center;
    color: var(--text2);
    border-radius: 3px;
    line-height: 1.6;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1px auto;
    position: relative;
}

.mini-cal-day.today {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
}

.mini-cal-day.has-event {
    color: var(--text);
    font-weight: 700;
}

.mini-cal-day.has-event::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent2);
}

.mini-cal-day.other { opacity: 0.3; }

.mini-event-count {
    font-size: 10px;
    color: var(--text3);
    text-align: center;
    margin-top: 6px;
    font-weight: 500;
}

/* 색상 피커 */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}

.color-dot:hover {
    transform: scale(1.2);
}
.color-dot.active {
    transform: scale(1.1);
    box-shadow: 0 0 0 2.5px var(--bg), 0 0 0 4.5px var(--text);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text2);
}

.tag-due {
    background: rgba(96,165,250,0.12);
    color: #60a5fa;
    border: 1px solid rgba(96,165,250,0.2);
}

.sch-event.todo-event.completed {
    opacity: 0.45;
}

.checkbox-label input { width: auto; accent-color: var(--accent); }

/* =============================================
   LOGIN PAGE
============================================= */
.login-body {
    height: auto;
    overflow: auto;
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.login-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
}
.blob1 {
    width: 480px; height: 480px;
    background: var(--accent);
    top: -120px; left: -120px;
}
.blob2 {
    width: 400px; height: 400px;
    background: var(--accent2);
    bottom: -100px; right: -100px;
}

.login-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px 36px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.5);
    backdrop-filter: blur(12px);
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}
.login-logo-icon {
    width: 46px; height: 46px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: white;
}
.login-logo-text {
    font-size: 24px; font-weight: 700;
    background: linear-gradient(135deg, var(--accent2), #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-title {
    font-size: 22px; font-weight: 700;
    color: var(--text); margin-bottom: 6px;
}
.login-sub {
    font-size: 13px; color: var(--text2); margin-bottom: 28px;
}

.login-error {
    background: rgba(248,113,113,0.12);
    border: 1px solid rgba(248,113,113,0.3);
    color: var(--red);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.login-field input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}
.login-field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-pw-wrap {
    position: relative;
}
.login-pw-wrap input { padding-right: 44px; }
.pw-toggle {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--text3); font-size: 14px;
    transition: color 0.2s;
    padding: 4px 6px;
}
.pw-toggle:hover { color: var(--text2); }

.login-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 4px;
}
.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(124,106,247,0.4);
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: var(--text3);
}
.login-footer code {
    background: var(--surface2);
    padding: 2px 6px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    color: var(--accent2);
}

.login-tabs {
    display: flex;
    background: var(--surface);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 28px;
}
.login-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text2);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}
.login-tab.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(124,106,247,0.35);
}
.login-tab-panel { display: none; }
.login-tab-panel.active { display: block; }

.login-success {
    background: rgba(52,211,153,0.12);
    border: 1px solid rgba(52,211,153,0.35);
    color: var(--green);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* =============================================
   USER PROFILE CARD (Sidebar)
============================================= */
.user-profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: var(--transition);
}
.user-profile-card:hover {
    background: var(--surface2);
    border-color: var(--accent);
}

/* 프로필 서브메뉴 */
.profile-menu-wrap {
    position: relative;
    margin-bottom: 20px;
}
.profile-submenu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    z-index: 999;
}
.profile-submenu.open { display: flex; }
.profile-submenu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--text);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s;
}
.profile-submenu-item:hover { background: var(--surface); }
.profile-submenu-item.nav-logout { color: var(--red); }
.profile-submenu-item.nav-logout:hover { background: rgba(248,113,113,0.1); }

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    line-height: 1;
}
.user-avatar.sm {
    width: 28px; height: 28px;
    font-size: 12px;
}
.user-avatar.lg {
    width: 60px; height: 60px;
    font-size: 24px;
}

.user-info {
    display: flex; flex-direction: column;
    gap: 2px; flex: 1; min-width: 0;
}
.user-name {
    font-size: 13px; font-weight: 600;
    color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.role-badge {
    font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: 0.5px;
    display: inline-block;
    width: fit-content;
}
.role-badge.admin {
    background: rgba(124,106,247,0.2);
    color: var(--accent2);
    border: 1px solid rgba(124,106,247,0.3);
}
.role-badge.user {
    background: rgba(52,211,153,0.15);
    color: var(--green);
    border: 1px solid rgba(52,211,153,0.25);
}

/* =============================================
   SIDEBAR BOTTOM
============================================= */
.sidebar-bottom {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-logout {
    color: var(--red) !important;
}
.nav-logout:hover {
    background: rgba(248,113,113,0.1) !important;
    color: var(--red) !important;
}

/* ===== THEME TOGGLE SWITCH ===== */
.theme-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
}
.theme-toggle-wrap:hover {
    background: var(--surface);
}

.theme-icon {
    font-size: 13px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.theme-icon.moon { color: var(--accent2); }
.theme-icon.sun  { color: var(--yellow); }

.theme-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.theme-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.theme-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 22px;
    transition: background 0.3s, border-color 0.3s;
}
.theme-slider::before {
    content: "";
    position: absolute;
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--text3);
    border-radius: 50%;
    transition: transform 0.3s, background 0.3s;
}
.theme-switch input:checked + .theme-slider {
    background: var(--accent);
    border-color: var(--accent);
}
.theme-switch input:checked + .theme-slider::before {
    transform: translateX(18px);
    background: #fff;
}

.theme-toggle-label {
    font-size: 12px;
    color: var(--text2);
    flex: 1;
}

/* =============================================
   PROFILE MODAL
============================================= */
.profile-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 8px 0 4px;
}
.profile-avatar-wrap {
    position: relative;
    cursor: pointer;
}
.profile-avatar-wrap .user-avatar {
    width: 72px; height: 72px;
    font-size: 30px;
    transition: var(--transition);
}
.profile-avatar-wrap:hover .user-avatar {
    opacity: 0.85;
}
.profile-color-row {
    display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
}

/* =============================================
   ADMIN PANEL
============================================= */
.admin-tab {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    height: 100%;
}

.admin-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 4px;
}

.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: var(--transition);
}
.admin-stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.admin-stat-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.admin-stat-num {
    font-size: 26px; font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.admin-stat-label {
    font-size: 12px; color: var(--text2);
    margin-top: 2px;
}

.admin-section-title {
    font-size: 14px; font-weight: 600;
    color: var(--text2);
    display: flex; align-items: center; gap: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-bottom: 4px;
}

.admin-table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table thead th {
    background: var(--surface);
    color: var(--text2);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.admin-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--surface); }
.admin-table td {
    padding: 12px 14px;
    color: var(--text);
    vertical-align: middle;
}

.admin-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.admin-select:focus { outline: none; border-color: var(--accent); }

.table-actions {
    display: flex; gap: 4px; flex-wrap: nowrap;
}
.tbl-btn {
    width: 30px; height: 30px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text2);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    transition: var(--transition);
    flex-shrink: 0;
}
.tbl-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}
.tbl-btn.danger:hover {
    background: var(--red);
    border-color: var(--red);
}

.status-badge {
    font-size: 11px; font-weight: 600;
    padding: 3px 8px; border-radius: 20px;
    display: inline-block;
}
.status-badge.active {
    background: rgba(52,211,153,0.15);
    color: var(--green);
    border: 1px solid rgba(52,211,153,0.25);
}
.status-badge.inactive {
    background: rgba(248,113,113,0.12);
    color: var(--red);
    border: 1px solid rgba(248,113,113,0.2);
}
.status-badge.done {
    background: rgba(52,211,153,0.15);
    color: var(--green);
}
.status-badge.pending {
    background: rgba(251,191,36,0.12);
    color: var(--yellow);
}

/* =============================================
   RESPONSIVE
============================================= */
@media (max-width: 768px) {
    /* ── 기본 레이아웃 ── */
    body { overflow: auto; }
    .app-wrapper { flex-direction: column; height: auto; min-height: 100vh; }

    /* ── 사이드바: 상단 컴팩트 바 ── */
    .sidebar {
        width: 100%;
        min-width: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 8px 10px;
        gap: 6px;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    /* Row 1: 로고 + 프로필 한 줄 */
    .sidebar-header {
        flex: 0 0 auto;
        width: auto;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }
    .profile-menu-wrap {
        flex: 1;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }
    .user-profile-card {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 6px 8px;
        margin: 0;
        border-radius: var(--radius-sm);
    }

    .dashboard-body {
        padding: 12px 12px;
    }
    .user-info  { display: none; }
    .user-name  { font-size: 13px; }
    .role-badge { font-size: 9px; padding: 1px 5px; }
    .user-avatar { width: 28px; height: 28px; font-size: 13px; flex-shrink: 0; }

    /* Row 2: stats-grid 4열 한 줄 */
    .stats-grid {
        width: 100%;
        flex: 0 0 100%;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
        margin-bottom: 0;        
    }
    .stat-card  { padding: 6px 4px; }
    .stat-num   { font-size: 17px; }
    .stat-label { font-size: 9px; }

    /* Row 3: sidebar-bottom 전체 숨김 (테마·관리자·로그아웃 → 프로필 서브메뉴) */
    .sidebar-bottom { display: none; }

    /* 내비게이션 숨김 */
    .sidebar-nav, .progress-section { display: none; }

    /* 프로필 서브메뉴: 모바일에서 fixed 위치로 */
    .profile-menu-wrap { margin-bottom: 0; }
    .profile-submenu {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        border-radius: var(--radius-sm) var(--radius-sm) 0 0;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.35);
    }
    .profile-submenu-item { padding: 14px 20px; font-size: 15px; }

    /* ── 메인 콘텐츠 ── */
    .main-content { overflow: visible; }
    .main-header  { flex-direction: column; gap: 4px; padding: 4px 10px; }
    .header-left  { display: none; }
    .header-right {
        width: 100%;
        flex-wrap: nowrap;
        align-items: center;
        gap: 6px;
        margin-bottom: 5px;
    }

    /* dash-title, header-date 숨김 */
    #dash-title, .header-date { display: none; }

    /* 보기 전환 토글 숨김 (모바일) */
    .dash-view-toggle { display: none; }

    /* 빠른 입력: 한 행에서 flex 확장 */
    .dash-quick-form {
        flex: 1;
        min-width: 0;
        flex-wrap: nowrap;
    }
    .dash-quick-form input[placeholder="메모"] { display: none; }
    .dash-quick-form input[placeholder="제목"] { flex: 1; min-width: 0; }
    #quick-date                                { display: none; }
    .btn-quick-date-icon                       { display: inline-flex; }

    /* 구분선: 빠른 입력 우측 */
    #btn-open-sch-modal-dash {
        border-left: 1px solid var(--border);
        padding-left: 8px;
        margin-left: 2px;
    }

    /* 버튼 텍스트 레이블 숨김 (아이콘만 표시) */
    .btn-label { display: none; }

    /* ── 달력 최소 패딩 ── */
    .dash-stack-view,
    .dash-split-view { padding: 0 2px; }
    #dash-cal-body   { padding: 0; }
    .month-grid   { padding: 0; }
    .month-day    { min-height: 38px; padding: 2px 2px; }
    .month-weekday { font-size: 11px; }
    .day-num      { font-size: 11px; }
    .day-event-dot { font-size: 9px; padding: 1px 3px; }
    .day-more     { font-size: 9px; }

    /* ── 할 일 목록 최소 패딩 ── */
    .section-body   { padding: 0 2px 12px; }
    .todo-list      { padding: 4px 4px 20px; }
    .todo-toolbar   { padding: 8px 4px; }
    .todo-item      { padding: 10px 8px; gap: 8px; }

    /* ── 일정 섹션 최소 패딩 ── */
    .sch-body       { padding: 4px 2px; }
    .sch-month-wrap { padding: 0; }
    .sch-header     { padding: 10px 8px; }

    /* ── 대시보드 헤더: h3 첫 행, sort-tabs + search-box 두 번째 행 ── */
    .dash-todo-header,
    .dash-split-panel-header { flex-wrap: wrap; gap: 6px; }
    .dash-todo-header h3,
    .dash-split-panel-header h3 { flex: 0 0 100%; font-size: 13px; }
    .dash-todo-header .sort-tabs,
    .dash-split-panel-header .sort-tabs { flex: 1 1 auto; min-width: 0; }
    .dash-todo-header .sort-tabs .sort-btn,
    .dash-split-panel-header .sort-tabs .sort-btn { padding: 4px 8px; font-size: 11px; }
    .dash-todo-header .search-box,
    .dash-split-panel-header .search-box { flex: 0 0 auto; padding: 5px 10px; }
    .dash-todo-header .search-box input,
    .dash-split-panel-header .search-box input { width: 72px; font-size: 12px; }
}
