/* ══════════════════════════════════════════════════
   우리 갤러리 v3 — Instagram-style Light Theme
   ══════════════════════════════════════════════════ */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

:root {
    --bg: #fafafa;
    --bg-white: #fff;
    --bg-hover: #f0f0f0;
    --bg-input: #f5f5f5;
    --text-primary: #262626;
    --text-secondary: #8e8e8e;
    --text-link: #0095f6;
    --border: #dbdbdb;
    --border-light: #efefef;
    --accent: #0095f6;
    --accent-hover: #1877f2;
    --red: #ed4956;
    --red-light: rgba(237, 73, 86, .08);
    --green: #4caf50;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --header-h: 60px;
    --max-w: 935px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --transition: .2s ease;
}

html {
    font-size: 14px
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased
}

::-webkit-scrollbar {
    width: 6px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px
}

/* ── Name Screen ── */
.name-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 9999
}

.name-card {
    text-align: center;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 48px 40px;
    width: 100%;
    max-width: 380px;
    margin: 16px
}

.name-icon {
    font-size: 3rem;
    margin-bottom: 16px
}

.name-card h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -.03em;
    margin-bottom: 8px
}

.name-card>p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 1rem
}

.name-card input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition);
    margin-bottom: 16px
}

.name-card input:focus {
    border-color: var(--accent)
}

/* ── Buttons ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition)
}

.btn-primary:hover {
    background: var(--accent-hover)
}

.btn-primary:disabled {
    opacity: .5;
    cursor: default
}

.btn-full {
    width: 100%
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition)
}

.btn-outline:hover {
    background: var(--bg-hover)
}

.btn-sm {
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap
}

.btn-sm:hover {
    background: var(--accent-hover)
}

.btn-text-danger {
    background: none;
    border: none;
    color: var(--red);
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0
}

.btn-text-danger:hover {
    text-decoration: underline
}

/* ── Header ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    height: var(--header-h)
}

.header-inner {
    max-width: var(--max-w);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px
}

.header-logo {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -.03em
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px
}

.header-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-primary);
    transition: background var(--transition)
}

.header-btn:hover {
    background: var(--bg-hover)
}

/* ── Banner ── */
.banner {
    position: relative;
    max-width: var(--max-w);
    margin: 0 auto;
    overflow: hidden;
    border-radius: var(--radius-md);
    aspect-ratio: 21/9;
    background: #000;
    margin-bottom: 16px
}

.banner-track {
    display: flex;
    height: 100%;
    transition: transform .5s ease
}

.banner-track img {
    min-width: 100%;
    height: 100%;
    object-fit: cover;
    flex-shrink: 0
}

.banner-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px
}

.banner-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .5);
    cursor: pointer;
    border: none;
    transition: background var(--transition)
}

.banner-dots .dot.active {
    background: #fff
}

/* ── Album Tabs ── */
.album-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none
}

.album-tabs::-webkit-scrollbar {
    display: none
}

.album-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
    flex-shrink: 0;
    text-align: center
}

.album-tab.active {
    background: var(--text-primary);
    color: #fff;
    border-color: var(--text-primary)
}

.album-tab:hover:not(.active) {
    background: var(--bg-hover)
}

.album-tab.admin-add {
    border-style: dashed;
    color: var(--text-secondary)
}

.album-tab.admin-add:hover {
    border-color: var(--accent);
    color: var(--accent)
}

.album-tab .del {
    margin-left: 6px;
    font-size: .7rem;
    color: rgba(255, 255, 255, .6);
    cursor: pointer
}

.album-tab .del:hover {
    color: var(--red)
}

/* ── Tag Filters ── */
.tag-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 4px 0 12px
}

.tag-chip {
    padding: 5px 14px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-white);
    font-size: .8rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition)
}

.tag-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent)
}

.tag-chip:hover:not(.active) {
    background: var(--bg-hover)
}

/* ── Gallery ── */
.gallery-container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 16px 20px 60px
}

.gallery-groups {}

.month-group {
    margin-bottom: 24px
}

.month-header {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px
}

.month-header .count {
    font-weight: 400;
    font-size: .8rem;
    color: var(--text-secondary)
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-input)
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--transition)
}

.gallery-item:hover img {
    opacity: .85
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    background: rgba(0, 0, 0, .3);
    opacity: 0;
    transition: opacity var(--transition);
    color: #fff;
    font-weight: 600;
    font-size: 1rem
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1
}

.overlay-stat {
    display: flex;
    align-items: center;
    gap: 6px
}

.overlay-stat svg {
    width: 18px;
    height: 18px
}

.gallery-item.skeleton {
    cursor: default
}

.gallery-item.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite
}

@keyframes shimmer {
    0% {
        background-position: 200% 0
    }

    100% {
        background-position: -200% 0
    }
}

.load-more {
    display: flex;
    justify-content: center;
    padding: 32px 0
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary)
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px
}

/* Drag highlight */
.album-tab.drag-over {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: scale(1.05)
}

.gallery-item.dragging {
    opacity: .5
}

/* ── Modal Base ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn .2s ease
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 10
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary)
}

/* ── Photo Modal ── */
.photo-modal {
    position: relative;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    animation: slideUp .3s ease
}

@keyframes slideUp {
    from {
        transform: translateY(16px);
        opacity: 0
    }

    to {
        transform: translateY(0);
        opacity: 1
    }
}

.photo-modal-body {
    display: flex;
    height: 80vh;
    max-height: 600px
}

.photo-view {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 0
}

.photo-view img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain
}

.photo-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000
}

.photo-loading.hidden {
    display: none
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, .2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite
}

@keyframes spin {
    to {
        transform: rotate(360deg)
    }
}

/* Slide nav */
.slide-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .85);
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition)
}

.slide-nav:hover {
    background: #fff;
    box-shadow: var(--shadow-md)
}

.slide-nav.prev {
    left: 16px
}

.slide-nav.next {
    right: 356px
}

.photo-modal.slideshow-active .slide-nav {
    display: flex
}

/* Side panel */
.photo-side {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    background: var(--bg-white)
}

.photo-header {
    padding: 18px 16px;
    border-bottom: 1px solid var(--border-light)
}

.photo-header h2 {
    font-size: .95rem;
    font-weight: 600;
    word-break: break-all;
    margin-bottom: 4px;
    padding-right: 36px
}

.photo-date {
    font-size: .78rem;
    color: var(--text-secondary)
}

.action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-light)
}

.action-left,
.action-right {
    display: flex;
    align-items: center;
    gap: 4px
}

.action-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition)
}

.action-btn:hover {
    background: var(--bg-hover)
}

.like-btn.liked {
    color: var(--red)
}

.like-btn.liked svg {
    fill: var(--red)
}

.like-btn svg {
    transition: transform .15s ease
}

.like-btn:active svg {
    transform: scale(1.2)
}

.delete-btn:hover {
    color: var(--red)
}

.like-count {
    font-size: .9rem;
    font-weight: 600
}

/* Tags in modal */
.tags-section {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg-input);
    font-size: .78rem;
    font-weight: 500;
    color: var(--text-primary)
}

.tag-badge .tag-remove {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: .7rem;
    margin-left: 2px
}

.tag-badge .tag-remove:hover {
    color: var(--red)
}

.tag-add {
    display: flex;
    gap: 4px;
    align-items: center
}

.tag-add input {
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .8rem;
    width: 100px;
    background: var(--bg-input);
    font-family: var(--font);
    outline: none;
    color: var(--text-primary)
}

.tag-add input:focus {
    border-color: var(--accent)
}

/* Comments */
.comments-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    min-height: 0
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px
}

.comment-item {
    animation: fadeIn .2s ease
}

.comment-nickname {
    font-weight: 600;
    font-size: .9rem;
    margin-right: 6px
}

.comment-text {
    font-size: .9rem;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px
}

.comment-time {
    font-size: .75rem;
    color: var(--text-secondary)
}

.comment-delete-btn {
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: .75rem;
    cursor: pointer;
    padding: 0
}

.comment-delete-btn:hover {
    color: var(--red)
}

.no-comments {
    text-align: center;
    color: var(--text-secondary);
    font-size: .9rem;
    padding: 32px 0
}

.comment-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light)
}

.comment-form input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: var(--font);
    font-size: .9rem;
    outline: none;
    color: var(--text-primary)
}

.comment-form input::placeholder {
    color: var(--text-secondary)
}

.comment-post-btn {
    border: none;
    background: transparent;
    color: var(--accent);
    font-family: var(--font);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px;
    white-space: nowrap
}

.comment-post-btn:hover {
    color: var(--accent-hover)
}

.comment-post-btn:disabled {
    opacity: .35;
    cursor: default
}

/* ── Settings / Upload / Move Modal ── */
.settings-modal,
.upload-modal {
    position: relative;
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 32px 28px;
    width: 100%;
    max-width: 420px;
    animation: slideUp .3s ease
}

.upload-modal {
    max-width: 480px
}

.settings-modal h2,
.upload-modal h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 24px
}

.settings-section {
    margin-bottom: 24px
}

.settings-section label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px
}

.settings-hint {
    font-size: .8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4
}

.settings-input-row {
    display: flex;
    gap: 8px
}

.settings-input-row input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    font-family: var(--font);
    font-size: .9rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition)
}

.settings-input-row input:focus {
    border-color: var(--accent)
}

.role-badge-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: .85rem;
    color: var(--text-secondary)
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .78rem;
    font-weight: 600
}

.role-badge.guest {
    background: var(--bg-input);
    color: var(--text-secondary)
}

.role-badge.family {
    background: rgba(0, 149, 246, .1);
    color: var(--accent)
}

.role-badge.admin {
    background: var(--red-light);
    color: var(--red)
}

.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: .9rem;
    text-align: center;
    transition: all var(--transition)
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 149, 246, .04)
}

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px
}

.upload-preview-item {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative
}

.upload-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.upload-preview-item .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, .6);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center
}

.upload-progress {
    margin-top: 16px;
    text-align: center
}

.progress-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width .3s ease;
    width: 0%
}

#progressText {
    font-size: .82rem;
    color: var(--text-secondary)
}

/* Move album list */
.move-album-list {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.move-album-item {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .9rem;
    transition: all var(--transition)
}

.move-album-item:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent)
}

/* ── Toast ── */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    align-items: center
}

.toast {
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    background: var(--text-primary);
    color: #fff;
    font-size: .9rem;
    font-weight: 500;
    box-shadow: var(--shadow-md);
    animation: toastIn .3s ease;
    white-space: nowrap
}

.toast.out {
    animation: toastOut .3s ease forwards
}

@keyframes toastIn {
    from {
        transform: translateY(20px);
        opacity: 0
    }

    to {
        transform: translateY(0);
        opacity: 1
    }
}

@keyframes toastOut {
    from {
        transform: translateY(0);
        opacity: 1
    }

    to {
        transform: translateY(20px);
        opacity: 0
    }
}

/* ── Responsive ── */
@media(max-width:735px) {
    .gallery-grid {
        gap: 2px
    }

    .photo-modal {
        border-radius: 0;
        max-width: 100%;
        max-height: 100vh
    }

    .photo-modal-body {
        flex-direction: column;
        height: auto;
        max-height: 100vh
    }

    .photo-view {
        height: 45vh;
        flex: none
    }

    .photo-side {
        width: 100%;
        max-height: 55vh;
        border-left: none;
        border-top: 1px solid var(--border)
    }

    .gallery-container {
        padding: 8px 8px 60px
    }

    .modal-overlay {
        padding: 0
    }

    .header-inner {
        padding: 0 12px
    }

    .slide-nav.next {
        right: 16px
    }

    .banner {
        border-radius: 0;
        margin-bottom: 8px
    }
}

@media(max-width:480px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1px
    }

    .name-card {
        padding: 32px 24px;
        margin: 12px
    }

    .settings-modal,
    .upload-modal {
        margin: 8px;
        padding: 24px 20px
    }
}

/* ── View Tab (갤러리/캘린더 전환) ── */
.view-tab {
    position: relative
}

.view-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 1px
}

/* ── Calendar Container ── */
.calendar-container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 16px 20px 60px
}

/* Calendar header */
.cal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0 16px
}

.cal-title {
    font-size: 1.15rem;
    font-weight: 700;
    flex: 1;
    text-align: center
}

.cal-nav {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-white);
    cursor: pointer;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all var(--transition)
}

.cal-nav:hover {
    background: var(--bg-hover)
}

.cal-today-btn {
    flex-shrink: 0
}

/* Calendar grid */
.cal-grid {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light)
}

.cal-weekdays span:first-child {
    color: var(--red)
}

.cal-weekdays span:last-child {
    color: var(--accent)
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    min-height: 320px
}

/* Day cell */
.cal-day {
    position: relative;
    min-height: 80px;
    padding: 6px 4px;
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition);
    overflow: hidden
}

.cal-day:nth-child(7n) {
    border-right: none
}

.cal-day:hover {
    background: var(--bg-hover)
}

.cal-day.other-month {
    opacity: .35;
    cursor: default
}

.cal-day.today {
    background: rgba(0, 149, 246, .06)
}

.cal-day.today .day-num {
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center
}

.cal-day.selected {
    background: rgba(0, 149, 246, .12)
}

.cal-day:nth-child(7n+1) .day-num {
    color: var(--red)
}

.cal-day:nth-child(7n) .day-num {
    color: var(--accent)
}

.day-num {
    font-size: .85rem;
    font-weight: 500;
    margin-bottom: 3px
}

/* Day events (schedule previews) */
.day-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 1px
}

.day-event {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 1px 3px;
    border-radius: 3px;
    overflow: hidden
}

.day-event-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0
}

.day-event-dot.cat-병원 {
    background: #ed4956
}

.day-event-dot.cat-기념일 {
    background: #e91e8f
}

.day-event-dot.cat-외출 {
    background: #4caf50
}

.day-event-dot.cat-예방접종 {
    background: #ff9800
}

.day-event-dot.cat-기타 {
    background: #9e9e9e
}

.day-event-title {
    font-size: .68rem;
    line-height: 1.2;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%
}

.day-event-more {
    font-size: .65rem;
    color: var(--text-secondary);
    padding-left: 8px
}

/* Keep old dot styles for backward compat */
.day-dots {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin-top: 2px
}

.cal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0
}

.cal-dot.cat-병원 {
    background: #ed4956
}

.cal-dot.cat-기념일 {
    background: #e91e8f
}

.cal-dot.cat-외출 {
    background: #4caf50
}

.cal-dot.cat-예방접종 {
    background: #ff9800
}

.cal-dot.cat-기타 {
    background: #9e9e9e
}

/* Day detail slide */
.cal-day-detail {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 12px;
    overflow: hidden;
    animation: slideUp .2s ease
}

.cal-day-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light)
}

.cal-day-detail-header h3 {
    font-size: 1rem;
    font-weight: 700
}

.cal-schedule-list {
    padding: 8px 0
}

.schedule-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--transition)
}

.schedule-item:hover {
    background: var(--bg-hover)
}

.schedule-cat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0
}

.schedule-cat-dot.cat-병원 {
    background: #ed4956
}

.schedule-cat-dot.cat-기념일 {
    background: #e91e8f
}

.schedule-cat-dot.cat-외출 {
    background: #4caf50
}

.schedule-cat-dot.cat-예방접종 {
    background: #ff9800
}

.schedule-cat-dot.cat-기타 {
    background: #9e9e9e
}

.schedule-info {
    flex: 1
}

.schedule-title {
    font-size: .9rem;
    font-weight: 600
}

.schedule-meta {
    font-size: .78rem;
    color: var(--text-secondary);
    margin-top: 2px;
    display: flex;
    gap: 8px
}

.schedule-repeat {
    font-size: .7rem;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-secondary)
}

.no-schedules {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-secondary);
    font-size: .9rem
}

/* Schedule form modal extras */
.schedule-form-modal {
    max-width: 460px
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    font-family: var(--font);
    font-size: .9rem;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition)
}

.form-input:focus {
    border-color: var(--accent)
}

.form-textarea {
    min-height: 70px;
    resize: vertical
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.category-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-white);
    font-family: var(--font);
    font-size: .82rem;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text-primary)
}

.cat-btn:hover {
    background: var(--bg-hover)
}

.cat-btn.active {
    background: var(--text-primary);
    color: #fff;
    border-color: var(--text-primary)
}

.cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block
}

/* Calendar responsive — tablet */
@media(max-width:735px) {
    .calendar-container {
        padding: 8px 8px 60px
    }

    .cal-day {
        min-height: 72px;
        padding: 4px 3px
    }

    .day-num {
        font-size: .78rem
    }

    .day-event-title {
        font-size: .6rem
    }

    .day-event-dot {
        width: 4px;
        height: 4px
    }

    .form-row-2 {
        grid-template-columns: 1fr
    }
}

/* Calendar responsive — phone */
@media(max-width:480px) {
    .cal-day {
        min-height: 64px;
        padding: 3px 2px
    }

    .day-num {
        font-size: .72rem
    }

    .day-event-title {
        font-size: .58rem
    }

    .day-event-dot {
        width: 4px;
        height: 4px
    }

    .day-event {
        gap: 2px;
        padding: 0 1px
    }

    .day-event-more {
        font-size: .56rem;
        padding-left: 4px
    }
}