/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #4472C4;
    --primary-light: #5B8BD4;
    --primary-dark: #365F9E;
    --primary-bg: #EBF0F9;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --success: #10B981;
    --success-bg: #ECFDF5;
    --warning: #F59E0B;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1E293B;
    --gray-900: #0F172A;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1), 0 6px 12px rgba(0,0,0,0.08);
    --shadow-xl: 0 20px 40px rgba(0,0,0,0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== Navbar ===== */
.navbar-wrap {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #EEF4FF;
    padding: 0.55rem 1.2rem;
    border-bottom: 1px solid rgba(68,114,196,0.1);
}

.navbar {
    background: white;
    border-radius: 14px;
    padding: 0 0.6rem 0 0.8rem;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.nav-logo-img {
    height: 34px;
    width: 34px;
    object-fit: contain;
    border-radius: 9px;
}

.nav-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--gray-900);
    letter-spacing: -0.4px;
    white-space: nowrap;
}

.nav-link {
    text-decoration: none;
    color: var(--gray-500);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.38rem 0.7rem;
    border-radius: 8px;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-link svg { flex-shrink: 0; opacity: 0.7; }
.nav-link:hover svg { opacity: 1; }

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    margin-left: auto;
}

.nav-divider {
    width: 1px;
    height: 22px;
    background: var(--gray-200);
    margin: 0 0.3rem;
    flex-shrink: 0;
}

.nav-user-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.65rem 0.3rem 0.35rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 99px;
    cursor: default;
}

.nav-user-avatar {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    flex-shrink: 0;
}

.nav-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-logout-btn {
    text-decoration: none;
    color: var(--gray-600);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.38rem 0.85rem;
    border-radius: 8px;
    border: 1.5px solid var(--gray-200);
    background: white;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.nav-logout-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-bg);
}

.nav-mobile-menu {
    display: none;
}

.nav-user {
    font-size: 0.82rem;
    color: var(--gray-700);
    font-weight: 600;
    padding: 0.4rem 0.75rem;
}

/* Bildirim zili */
.notif-bell {
    position: relative;
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    border-radius: 9px;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0.38rem 0.45rem;
    display: flex;
    align-items: center;
    transition: all 0.15s;
}
.notif-bell:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
}
.notif-badge {
    position: absolute;
    top: -5px; right: -5px;
    background: #EF4444;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 99px;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid white;
}

/* Bildirim listesi */
.notif-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-50); }
.notif-unseen { background: #F0F5FF; }
.notif-unseen:hover { background: #e4edfb; }
.notif-color { width: 4px; border-radius: 4px; flex-shrink: 0; align-self: stretch; min-height: 100%; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 0.9rem; color: var(--gray-800); display: flex; align-items: center; gap: 0.4rem; }
.notif-new-dot { width: 7px; height: 7px; background: var(--primary); border-radius: 50%; flex-shrink: 0; }
.notif-meta { font-size: 0.8rem; color: var(--gray-500); margin-top: 0.15rem; }
.notif-by { font-size: 0.78rem; color: var(--gray-400); margin-top: 0.1rem; }
.notif-desc { font-size: 0.82rem; color: var(--gray-600); margin-top: 0.3rem; white-space: pre-wrap; }

.assign-inline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.assign-inline-header label { margin: 0; }

/* Görev atama kullanıcı listesi */
.assign-user-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 0.3rem;
}
.assign-user-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}
.assign-user-item:hover { background: var(--gray-50); }
.assign-user-item:has(input:checked) { background: #F0F5FF; }
.assign-user-item input[type="checkbox"] {
    accent-color: var(--primary);
    width: 17px; height: 17px;
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
}
.assign-user-avatar {
    width: 30px; height: 30px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.78rem; font-weight: 700; flex-shrink: 0;
}
.assign-user-name { font-size: 0.88rem; font-weight: 500; color: var(--gray-800); flex: 1; }
.assign-user-handle { font-size: 0.78rem; color: var(--gray-400); }

/* Tamamlandı */
.btn-success {
    background: linear-gradient(135deg, #34D399 0%, #10B981 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}
.btn-success:hover {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    box-shadow: 0 4px 14px rgba(16,185,129,0.4);
    transform: translateY(-1px);
}
.btn-success:active { transform: translateY(0) scale(0.97); }

.completed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #D1FAE5;
    color: #065F46;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.25rem 0.65rem;
    border-radius: 99px;
}

.event-completed { opacity: 0.85; }
.event-completed::after {
    content: '✓';
    font-size: 0.7rem;
    color: #10B981;
    margin-left: auto;
    font-weight: 700;
}

/* Toast */
.toast-msg {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e293b;
    color: white;
    padding: 0.65rem 1.25rem;
    border-radius: 10px;
    font-size: 0.88rem;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    z-index: 9999;
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Etiket seçici */
.tag-select-wrap { display: flex; align-items: center; gap: 0.5rem; }
.tag-select-wrap .form-select { flex: 1; }
.tag-select-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: none; }

/* Admin etiket yönetimi */
.tags-add-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.tag-color-row { display: flex; gap: 0.3rem; }
.tag-color-opt input { display: none; }
.tag-color-opt span {
    display: block; width: 20px; height: 20px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: border-color 0.15s;
}
.tag-color-opt input:checked + span { border-color: #1e293b; }
.tags-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-item {
    display: flex; align-items: center; gap: 0.4rem;
    background: var(--gray-50); border: 1px solid var(--gray-200);
    border-radius: 99px; padding: 0.25rem 0.6rem 0.25rem 0.5rem;
    font-size: 0.85rem;
}
.tag-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tag-name { color: var(--gray-700); }

/* İstatistik sayfası */
.stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.stats-filters { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.1rem 1rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stat-card-green { border-top: 3px solid #10B981; }
.stat-card-blue  { border-top: 3px solid #4472C4; }
.stat-card-purple{ border-top: 3px solid #8B5CF6; }
.stat-num   { font-size: 1.9rem; font-weight: 800; color: var(--gray-800); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--gray-500); margin-top: 0.3rem; }

.stats-section {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stats-section-header { margin-bottom: 1rem; }
.stats-section-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--gray-700); }

.stats-table-wrap { overflow-x: auto; }
.stats-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.stats-table th {
    text-align: left; font-weight: 600; color: var(--gray-500);
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em;
    padding: 0 0.75rem 0.6rem; border-bottom: 1px solid var(--gray-100);
}
.stats-table th.num, .stats-table td.num { text-align: right; }
.stats-table td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--gray-50); color: var(--gray-700); vertical-align: middle; }
.stats-table tr:last-child td { border-bottom: none; }
.stats-table tr:hover td { background: var(--gray-50); }

.pct-wrap { display: flex; align-items: center; gap: 0.5rem; justify-content: flex-end; }
.pct-bar { height: 6px; border-radius: 99px; min-width: 2px; max-width: 80px; flex-shrink: 0; }
.pct-wrap span { font-size: 0.82rem; color: var(--gray-600); min-width: 32px; text-align: right; }
.stats-empty-cell { text-align: center; color: var(--gray-400); padding: 1.5rem; font-size: 0.88rem; }

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: var(--primary-bg);
    border: 1.5px solid var(--gray-200);
    cursor: pointer;
    padding: 7px 8px;
    border-radius: 8px;
    transition: all 0.15s;
}

.nav-toggle:hover { background: var(--primary-bg); border-color: var(--primary); }

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* ===== Badges ===== */
.badge {
    font-size: 0.6rem;
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-admin { background: rgba(255,255,255,0.25); color: white; }
.badge-editor { background: rgba(255,255,255,0.2); color: white; }
.badge-viewer { background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); }

/* Admin page badges */
.admin-grid .badge-admin { background: var(--primary-bg); color: var(--primary-dark); }

/* ===== Main Content ===== */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.2rem;
}

/* ===== Calendar Header ===== */
.calendar-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.calendar-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--gray-900);
    min-width: 220px;
    letter-spacing: -0.5px;
}

.calendar-nav {
    display: flex;
    gap: 3px;
}

.export-btns {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
}

@media (max-width: 640px) {
    .export-btns { display: none; }
}

/* ===== Calendar Container ===== */
.calendar-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--primary);
}

.calendar-weekdays div {
    text-align: center;
    padding: 0.6rem 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.9);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day {
    min-height: 130px;
    padding: 0.35rem;
    cursor: pointer;
    transition: background 0.12s;
    position: relative;
    border-right: 1px solid var(--gray-200);
    border-bottom: 1px solid var(--gray-200);
    vertical-align: top;
}

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

.calendar-day:hover { background: var(--primary-bg); }

.calendar-day.other-month { background: var(--gray-50); }
.calendar-day.other-month .day-number { color: var(--gray-300); }
.calendar-day.other-month:hover { background: var(--gray-100); }

.calendar-day.today { background: #F0F5FF; }

.calendar-day.today .day-number {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.day-number {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-600);
    margin-bottom: 0.2rem;
    padding-left: 2px;
    cursor: pointer;
    display: inline-block;
    min-width: 1.4rem;
    text-align: center;
    border-radius: 4px;
    transition: background 0.15s;
}
.day-number:hover { background: rgba(0,0,0,0.07); }

.day-events { display: flex; flex-direction: column; gap: 2px; }

/* Grid event: show full detail */
.day-event-detail {
    font-size: 0.68rem;
    line-height: 1.35;
    padding: 3px 5px;
    border-radius: 4px;
    border-left: 3px solid;
    background: var(--gray-50);
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.12s;
    overflow: hidden;
}

.day-event-detail:hover { background: var(--gray-100); }

.day-event-title {
    font-weight: 700;
    color: var(--gray-800);
    display: block;
}

.day-event-desc {
    color: var(--gray-500);
    display: block;
    margin-top: 1px;
}

.day-more {
    font-size: 0.65rem;
    color: var(--primary);
    font-weight: 700;
    margin-top: 2px;
    padding-left: 5px;
}

/* ===== Mobile List View ===== */
.calendar-list { display: none; }

.list-day {
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background 0.12s;
}

.list-day:last-child { border-bottom: none; }
.list-day:hover { background: var(--primary-bg); }

.list-day.today { background: #F0F5FF; }

.list-day-header {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem 0.9rem;
}

.list-day-left {
    width: 44px;
    flex-shrink: 0;
    text-align: center;
}

.list-day-num {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--gray-600);
    line-height: 1.1;
}

.list-day.today .list-day-num { color: var(--primary); }

.list-day-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.list-day.today .list-day-name { color: var(--primary-light); }

.list-day-info { flex: 1; min-width: 0; }

.list-event-item {
    padding: 4px 0;
    border-bottom: 1px solid var(--gray-50);
}

.list-event-item:last-child { border-bottom: none; }

.list-event-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.list-event-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-left: 14px;
    line-height: 1.3;
}

.list-day-empty {
    font-size: 0.78rem;
    color: var(--gray-300);
    padding: 4px 0;
    font-style: italic;
}

.list-day-arrow {
    color: var(--gray-300);
    font-size: 1.1rem;
    padding-top: 0.3rem;
    flex-shrink: 0;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.52rem 1.1rem;
    border: none;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
    text-decoration: none;
    gap: 0.4rem;
    font-family: inherit;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(68,114,196,0.35), 0 1px 2px rgba(68,114,196,0.2);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    box-shadow: 0 4px 14px rgba(68,114,196,0.45), 0 2px 4px rgba(68,114,196,0.2);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0) scale(0.97); }

.btn-danger {
    background: linear-gradient(135deg, #F87171 0%, #EF4444 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}
.btn-danger:hover {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    box-shadow: 0 4px 14px rgba(239,68,68,0.4);
    transform: translateY(-1px);
}
.btn-danger:active { transform: translateY(0) scale(0.97); }

.btn-outline {
    background: white;
    color: var(--gray-600);
    border: 1.5px solid var(--gray-200);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
    box-shadow: 0 2px 8px rgba(68,114,196,0.12);
    transform: translateY(-1px);
}
.btn-outline:active { transform: translateY(0) scale(0.97); }

.btn-icon {
    background: white;
    color: var(--gray-500);
    border: 1.5px solid var(--gray-200);
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 0.95rem;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.btn-icon:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(68,114,196,0.15);
    transform: translateY(-1px);
}
.btn-icon:active { transform: translateY(0) scale(0.96); }

.btn-block { width: 100%; }
.btn-sm { padding: 0.28rem 0.65rem; font-size: 0.77rem; border-radius: 7px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 0.9rem; }

.form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-600);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-group input,
.form-group textarea,
.form-select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    transition: all 0.2s;
    background: white;
    color: var(--gray-800);
}

.form-group input:focus,
.form-group textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(68, 114, 196, 0.12);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--gray-400); }

.form-select-sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
    width: auto;
    border-radius: 6px;
}

.form-row { display: flex; gap: 0.8rem; }

.form-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ===== Color Picker ===== */
.color-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.3rem;
}

.color-option {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s;
}

.color-option:hover { transform: scale(1.15); }
.color-option.selected {
    border-color: var(--gray-800);
    box-shadow: 0 0 0 2px white inset;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: none;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
    padding: 0;
    backdrop-filter: blur(3px);
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-handle {
    width: 32px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 4px;
    margin: 8px auto 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.3rem;
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gray-900);
}

.modal-close {
    background: var(--gray-100);
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--gray-400);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s;
    flex-shrink: 0;
}

.modal-close:hover { background: var(--gray-200); color: var(--gray-700); transform: rotate(90deg); }

.modal-sm { max-width: 360px; }

.modal-body { padding: 1rem 1.3rem 1.3rem; }

.recur-choice-btns { display: flex; flex-direction: column; gap: 0.5rem; }

.recur-icon {
    display: inline-block;
    vertical-align: -1px;
    color: var(--gray-400);
    flex-shrink: 0;
}

/* ===== Event List in Modal ===== */
.event-list { margin-bottom: 1rem; }

.event-item {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    padding: 0.7rem;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    transition: 0.12s;
}

.event-item:hover { border-color: var(--gray-200); }

.event-color-bar {
    width: 4px;
    min-height: 32px;
    border-radius: 3px;
    flex-shrink: 0;
    align-self: stretch;
}

.event-content { flex: 1; min-width: 0; }
.event-content-clickable { cursor: pointer; border-radius: 4px; transition: background 0.15s; }
.event-content-clickable:hover { background: rgba(0,0,0,0.04); }

.event-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gray-800);
    line-height: 1.3;
}

.event-desc {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-top: 2px;
    line-height: 1.35;
    white-space: pre-line;
}

.event-meta {
    font-size: 0.72rem;
    color: var(--gray-400);
    margin-top: 4px;
    font-weight: 600;
}

.event-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.event-action-btn {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 5px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.event-action-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
    transform: scale(1.1);
}
.event-action-del:hover {
    background: var(--danger-bg);
    color: var(--danger);
    transform: scale(1.1);
}

.no-events {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.85rem;
    padding: 1.5rem 0;
}

.no-events-icon { font-size: 1.5rem; margin-bottom: 0.3rem; }

.add-event-section {
    border-top: 1.5px solid var(--gray-100);
    padding-top: 1rem;
}

.add-event-section h4 {
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    color: var(--gray-600);
}

/* ===== Alerts ===== */
.alert {
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.alert-error { background: var(--danger-bg); color: #991B1B; border: 1px solid #FECACA; }
.alert-success { background: var(--success-bg); color: #166534; border: 1px solid #BBF7D0; }

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--primary);
    padding: 1.5rem;
    position: relative;
}

.login-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,255,255,0.05), transparent 50%);
}

.login-container { width: 100%; max-width: 380px; position: relative; z-index: 1; }

.login-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    box-shadow: var(--shadow-xl);
}

.login-header { text-align: center; margin-bottom: 1.8rem; }

.login-icon {
    width: 52px;
    height: 52px;
    background: var(--primary);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 0.8rem;
    box-shadow: 0 4px 12px rgba(68, 114, 196, 0.3);
}

.login-logo-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    margin: 0 auto 0.8rem;
    display: block;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.3px;
}

.login-header p {
    color: var(--gray-500);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* ===== Admin Page ===== */
.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 1.2rem;
    align-items: start;
}

.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.3rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.card-title {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.user-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 500px;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem;
    background: var(--gray-50);
    border-radius: 8px;
    gap: 0.5rem;
    border: 1px solid var(--gray-100);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-name { font-weight: 700; font-size: 0.85rem; color: var(--gray-800); }
.user-email { font-size: 0.75rem; color: var(--gray-500); }

.user-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.inline-form { display: inline; }

/* ===== Places Admin ===== */
.admin-section {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    color: var(--gray-800);
}

.site-settings-row {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1rem 1.3rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.site-logo-setting {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.site-logo-preview {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
}

.logo-upload-btn {
    cursor: pointer;
    font-size: 0.75rem !important;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .site-settings-row {
        flex-direction: column;
        align-items: stretch;
    }
    .site-logo-setting {
        flex-direction: row;
        justify-content: center;
    }
}

.places-bar {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1rem 1.3rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.place-add-form {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.place-input {
    flex: 1;
    padding: 0.5rem 0.8rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border 0.2s;
}

.place-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(68, 114, 196, 0.12);
}

.places-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.places-empty {
    font-size: 0.82rem;
    color: var(--gray-400);
    font-style: italic;
}

.place-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--primary-bg);
    color: var(--primary-dark);
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.place-remove {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s;
}

.place-remove:hover { opacity: 1; }

/* ===== Time Picker ===== */
.time-picker-wrap {
    position: relative;
}

.time-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
    background: white;
    transition: all 0.2s;
}

.time-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(68, 114, 196, 0.12);
}

.time-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid var(--gray-200);
    border-radius: 8px;
    max-height: 180px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow-md);
    display: none;
}

.time-dropdown.open { display: block; }

.time-option {
    padding: 0.45rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.1s;
}

.time-option:hover { background: var(--primary-bg); }

/* ===== Place Select ===== */
.place-select-wrap {
    position: relative;
}

.place-custom-input {
    margin-top: 0.4rem;
}

/* ===== Event Time/Place Tags ===== */
.event-tags {
    display: flex;
    gap: 0.4rem;
    margin-top: 3px;
    flex-wrap: wrap;
}

.event-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    color: var(--gray-500);
    font-weight: 600;
}

/* ===== View Switcher ===== */
.view-switcher {
    display: flex;
    background: var(--gray-100);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

.view-btn {
    background: transparent;
    color: var(--gray-500);
    border: none;
    padding: 0.3rem 0.7rem;
    border-radius: 7px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
    font-family: inherit;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.view-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 4px rgba(68,114,196,0.18), 0 0 0 1px rgba(68,114,196,0.08);
    font-weight: 700;
}

.view-btn:hover:not(.active) {
    color: var(--gray-700);
    background: rgba(255,255,255,0.6);
}

/* ===== Weekly View ===== */
.week-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

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

.week-col {
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.week-col:last-child { border-right: none; }
.week-col.today { background: #F0F5FF; }

.week-col-header {
    padding: 0.5rem 0.3rem;
    text-align: center;
    background: var(--primary);
    color: white;
    border-right: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    transition: background 0.15s;
}

.week-col-header:hover { background: var(--primary-dark); }
.week-col.today .week-col-header { background: var(--primary-dark); }

.week-col-day-name {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

.week-col-day-num {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.2;
}

.week-col-events {
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.week-event {
    font-size: 0.7rem;
    padding: 3px 5px;
    border-radius: 4px;
    border-left: 3px solid;
    background: var(--gray-50);
    color: var(--gray-700);
    cursor: pointer;
    line-height: 1.3;
    transition: background 0.12s;
}

.week-event:hover { background: var(--gray-100); }
.week-event-title { font-weight: 700; display: block; }
.week-event-time { color: var(--gray-400); font-size: 0.65rem; display: block; }

/* ===== Daily View ===== */
.day-container {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.day-view-header {
    background: var(--primary);
    color: white;
    padding: 1.5rem;
    text-align: center;
}

.day-view-header.is-today { background: var(--primary-dark); }

.day-view-dayname { font-size: 0.9rem; opacity: 0.85; font-weight: 600; }
.day-view-date { font-size: 2.8rem; font-weight: 800; line-height: 1.1; }
.day-view-month { font-size: 0.95rem; opacity: 0.85; }

.day-view-events { padding: 1rem; }

.day-view-event {
    display: flex;
    gap: 0.75rem;
    padding: 0.9rem;
    border-radius: 10px;
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: 0.12s;
}

.day-view-event:hover { border-color: var(--gray-300); background: white; box-shadow: var(--shadow-sm); }
.day-view-color { width: 4px; border-radius: 3px; flex-shrink: 0; align-self: stretch; min-height: 36px; }
.day-view-content { flex: 1; min-width: 0; }
.day-view-title { font-weight: 700; font-size: 0.95rem; color: var(--gray-800); }
.day-view-meta { font-size: 0.8rem; color: var(--gray-500); margin-top: 3px; }
.day-view-desc { font-size: 0.85rem; color: var(--gray-600); margin-top: 4px; white-space: pre-line; }

/* ===== Yearly View ===== */
.year-container {
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.year-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.mini-month {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.mini-month-header {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 0.4rem 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
}

.mini-cal {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    padding: 0.3rem;
    gap: 1px;
}

.mini-day-hd {
    text-align: center;
    font-size: 0.55rem;
    font-weight: 700;
    color: var(--gray-400);
    text-transform: uppercase;
    padding: 2px 0;
}

.mini-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    border-radius: 50%;
    cursor: pointer;
    color: var(--gray-600);
    transition: background 0.12s;
    font-weight: 500;
}

.mini-day.other-month { color: var(--gray-300); cursor: default; }
.mini-day:not(.other-month):hover { background: var(--primary-bg); color: var(--primary); }
.mini-day.has-events { background: var(--primary); color: white; font-weight: 700; }
.mini-day.has-events:hover { background: var(--primary-dark); }
.mini-day.today { background: var(--primary-dark); color: white; font-weight: 800; box-shadow: 0 0 0 2px white, 0 0 0 3px var(--primary-dark); }

/* ===== Detail Link Button ===== */
.detail-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.48rem 1.1rem;
    border-radius: 10px;
    font-size: 0.83rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.18s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 2px 8px rgba(68,114,196,0.35);
    letter-spacing: 0.01em;
}
.detail-link-btn:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    box-shadow: 0 4px 14px rgba(68,114,196,0.45);
    transform: translateY(-1px);
}
.detail-link-btn:active { transform: translateY(0) scale(0.97); }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* ===== Desktop Modal Center ===== */
@media (min-width: 641px) {
    .modal-overlay {
        align-items: center;
        padding: 2rem;
    }
    .modal {
        border-radius: 16px;
        animation: modalPopIn 0.2s ease;
    }
    @keyframes modalPopIn {
        from { opacity: 0; transform: scale(0.96) translateY(8px); }
        to { opacity: 1; transform: scale(1) translateY(0); }
    }
    .modal-handle { display: none; }
}

/* ===== Yearly responsive ===== */
@media (max-width: 900px) {
    .year-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
    .year-grid { grid-template-columns: repeat(2, 1fr); }
    .week-grid { grid-template-columns: repeat(7, 1fr); }
    .week-col-day-name { font-size: 0.55rem; }
    .week-col-day-num { font-size: 1rem; }
    .week-event { font-size: 0.62rem; }
    .view-btn { padding: 0.25rem 0.4rem; font-size: 0.7rem; }
}

/* ===== Tablet ===== */
@media (max-width: 900px) {
    .calendar-day { min-height: 100px; }
    .day-event-desc { display: none; }
}

@media (max-width: 768px) {
    .admin-grid { grid-template-columns: 1fr; }
    .calendar-day { min-height: 80px; }
    .calendar-header h2 { font-size: 1.4rem; min-width: 180px; }
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
    .navbar-wrap { padding: 0.4rem 0.7rem; }
    .navbar { height: 48px; border-radius: 12px; padding: 0 0.5rem 0 0.65rem; }
    .nav-user-chip { display: none; }
    .nav-logout-btn { display: none; }
    .nav-right .nav-link { display: none; }
    .nav-right .nav-divider { display: none; }

    .nav-toggle { display: flex; }

    .nav-mobile-menu {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: 0;
        right: 0;
        background: white;
        border-radius: 12px;
        flex-direction: column;
        padding: 0.5rem;
        box-shadow: 0 8px 24px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
        gap: 0.15rem;
        z-index: 200;
    }

    .nav-mobile-menu.active { display: flex; }
    .nav-link { padding: 0.55rem 0.9rem; border-radius: 8px; color: var(--gray-600); font-size: 0.88rem; }
    .nav-mobile-user {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.6rem 0.9rem 0.7rem;
        border-bottom: 1px solid var(--gray-100);
        margin-bottom: 0.25rem;
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--gray-700);
    }
    .nav-mobile-user .nav-user-avatar { width: 28px; height: 28px; font-size: 0.75rem; }
    .nav-mobile-logout { color: var(--danger) !important; margin-top: 0.15rem; border-top: 1px solid var(--gray-100); padding-top: 0.6rem !important; }

    .main-content { padding: 0.8rem; }

    .calendar-header {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .calendar-header h2 {
        font-size: 1.4rem;
        min-width: auto;
        order: -1;
        width: 100%;
        margin-bottom: 0.4rem;
    }

    .calendar-container .calendar-weekdays,
    .calendar-container .calendar-grid { display: none; }
    .calendar-list { display: block; }

    .user-item { flex-direction: column; align-items: flex-start; }
    .user-actions { width: 100%; justify-content: flex-end; margin-top: 0.4rem; }

    .login-card { padding: 2rem 1.5rem; }
}
