* { box-sizing:border-box; }

body {
    margin:0;
    font-family:Inter,system-ui,sans-serif;
    background:#f6f8fb;
    color:#172033;
}

a { text-decoration:none; }

.sidebar {
    width:250px;
    height:100vh;
    position:fixed;
    inset:0 auto 0 0;
    background:#fff;
    border-right:1px solid #e8ebf0;
    padding:22px 16px;
    z-index:1000;
}

.brand {
    display:flex;
    align-items:center;
    gap:10px;
    font-size:20px;
    font-weight:700;
    padding:4px 10px 25px;
}

.brand-icon {
    width:38px;
    height:38px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:10px;
    background:#2563eb;
    color:#fff;
}

.create-btn {
    width:100%;
    border:0;
    background:#2563eb;
    color:#fff;
    padding:12px;
    border-radius:10px;
    font-weight:600;
    margin-bottom:22px;
}

.create-btn:hover { background:#1d4ed8; }

.menu-title {
    padding:9px 10px;
    font-size:10px;
    text-transform:uppercase;
    color:#9aa2af;
    font-weight:700;
}

.sidebar-menu {
    display:flex;
    flex-direction:column;
    gap:3px;
}

.sidebar-menu a {
    display:flex;
    align-items:center;
    gap:12px;
    color:#667085;
    padding:10px 12px;
    border-radius:9px;
    font-size:13px;
    font-weight:500;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    color:#2563eb;
    background:#eef4ff;
}

.calendar-list { padding:5px 10px; }

.calendar-item {
    display:flex;
    align-items:center;
    gap:9px;
    margin:10px 0;
    color:#667085;
    font-size:12px;
}

.calendar-dot {
    width:9px;
    height:9px;
    border-radius:50%;
}

.main { margin-left:250px; min-height:100vh; }

.topbar {
    height:70px;
    background:#fff;
    border-bottom:1px solid #e8ebf0;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 28px;
}

.search-box {
    width:340px;
    position:relative;
}

.search-box i {
    position:absolute;
    left:13px;
    top:10px;
    color:#9aa2af;
}

.search-box input {
    width:100%;
    border:1px solid #e6e9ee;
    border-radius:9px;
    padding:9px 12px 9px 38px;
    outline:0;
    background:#f9fafb;
    font-size:12px;
}

.top-actions {
    display:flex;
    align-items:center;
    gap:16px;
}

.icon-btn {
    border:0;
    background:transparent;
    color:#667085;
    font-size:18px;
}

.profile {
    display:flex;
    align-items:center;
    gap:8px;
    font-size:12px;
    font-weight:600;
}

.avatar {
    width:34px;
    height:34px;
    border-radius:50%;
    background:#2563eb;
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
}

.mobile-toggle { display:none; }

.content { padding:28px; }

.welcome h2 {
    font-size:23px;
    font-weight:700;
    margin-bottom:4px;
}

.welcome p {
    color:#7b8494;
    font-size:12px;
}

.stat-card,
.calendar-card,
.upcoming-card,
.analytics-card {
    background:#fff;
    border:1px solid #e8ebf0;
    border-radius:14px;
}

.stat-card {
    padding:18px;
    height:100%;
}

.stat-top,
.section-title {
    display:flex;
    align-items:center;
    justify-content:space-between;
}

.stat-title {
    color:#7b8494;
    font-size:11px;
}

.stat-icon {
    width:35px;
    height:35px;
    border-radius:9px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#eef4ff;
    color:#2563eb;
}

.stat-number {
    font-size:23px;
    font-weight:700;
    margin-top:13px;
}

.stat-growth {
    color:#10a36a;
    font-size:10px;
    margin-top:3px;
}

.calendar-card { overflow:hidden; }

.calendar-toolbar {
    padding:17px 18px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    border-bottom:1px solid #edf0f4;
}

.calendar-title {
    display:flex;
    align-items:center;
    gap:7px;
    font-weight:700;
    font-size:15px;
}

.toolbar-btn {
    background:#fff;
    border:1px solid #e3e7ed;
    border-radius:7px;
    padding:6px 9px;
    font-size:11px;
}

.view-buttons {
    display:flex;
    gap:4px;
}

.view-buttons button {
    border:1px solid #e3e7ed;
    background:#fff;
    border-radius:7px;
    padding:7px 10px;
    font-size:11px;
}

.view-buttons button.active {
    background:#2563eb;
    border-color:#2563eb;
    color:#fff;
}

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

.calendar-weekdays > div {
    text-align:center;
    padding:11px 4px;
    color:#8b93a1;
    font-size:9px;
    font-weight:700;
    border-bottom:1px solid #edf0f4;
}

.calendar-day {
    min-height:110px;
    padding:7px;
    border-right:1px solid #edf0f4;
    border-bottom:1px solid #edf0f4;
    overflow:hidden;
}

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

.day-number {
    width:26px;
    height:26px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:50%;
    font-size:11px;
    margin-bottom:5px;
}

.today .day-number {
    background:#2563eb;
    color:#fff;
    font-weight:700;
}

.other-month {
    background:#fafbfc;
    color:#b7bec8;
}

.event {
    padding:4px 6px;
    margin-bottom:3px;
    border-radius:4px;
    font-size:9px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    cursor:pointer;
}

.upcoming-card,
.analytics-card {
    padding:19px;
}

.section-title {
    margin-bottom:15px;
}

.section-title h5 {
    font-size:14px;
    font-weight:700;
    margin:0;
}

.section-title span {
    font-size:10px;
    color:#8b93a1;
}

.upcoming-item {
    display:flex;
    align-items:center;
    gap:10px;
    padding:11px 0;
    border-bottom:1px solid #f0f2f5;
}

.event-line {
    width:3px;
    height:36px;
    border-radius:4px;
}

.event-time {
    min-width:58px;
    font-size:10px;
    color:#8b93a1;
}

.event-info strong {
    display:block;
    font-size:11px;
}

.event-info span {
    color:#8b93a1;
    font-size:9px;
}

.analytics-card { height:100%; }

.bars {
    height:170px;
    display:flex;
    align-items:flex-end;
    justify-content:space-around;
    gap:14px;
    padding:15px 10px 0;
}

.bars div {
    height:100%;
    flex:1;
    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:flex-end;
    gap:7px;
}

.bars i {
    width:28px;
    max-height:135px;
    border-radius:7px 7px 2px 2px;
    background:#2563eb;
    display:block;
}

.bars span {
    color:#8b93a1;
    font-size:9px;
}

.insight {
    display:flex;
    gap:10px;
    align-items:center;
    padding:12px 0;
    border-bottom:1px solid #f0f2f5;
    color:#667085;
    font-size:11px;
}

.insight i { color:#2563eb; }

.auth-page {
    min-height:100vh;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
}

.auth-card {
    width:100%;
    max-width:410px;
    background:#fff;
    border:1px solid #e8ebf0;
    border-radius:16px;
    padding:30px;
    box-shadow:0 15px 45px rgba(15,23,42,.07);
}

.form-control,
.form-select {
    border-radius:8px;
    padding:10px;
    font-size:13px;
}


@media(max-width:992px) {
    .sidebar {
        display:none;
    }

    .main {
        margin-left:0;
    }

    .mobile-toggle {
        display:block;
        border:0;
        background:transparent;
        font-size:22px;
    }

    .search-box { width:250px; }
}
/* ==========================================
   ADVANCED CALENDAR
========================================== */

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

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

.calendar-event {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 6px;
    border-radius: 5px;
    background: color-mix(
        in srgb,
        var(--event-color) 10%,
        white
    );
    color: var(--event-color);
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    transition: .15s ease;
}

.calendar-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,.08);
}

.event-color {
    width: 5px;
    height: 5px;
    min-width: 5px;
    border-radius: 50%;
    background: var(--event-color);
}

.event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ==========================================
   WEEK VIEW
========================================== */

.calendar-week-view {
    overflow-x: auto;
    background: #fff;
}

.week-header,
.week-row {
    display: grid;
    grid-template-columns: 70px repeat(7, minmax(100px, 1fr));
}

.week-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border-bottom: 1px solid #e9edf2;
}

.week-day-header {
    text-align: center;
    padding: 13px 5px;
    border-left: 1px solid #edf0f4;
}

.week-day-header span {
    display: block;
    color: #8b93a1;
    font-size: 10px;
    text-transform: uppercase;
}

.week-day-header strong {
    display: inline-flex;
    margin-top: 5px;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 14px;
}

.time-column {
    color: #9299a5;
    font-size: 9px;
    text-align: right;
    padding: 8px;
}

.week-row {
    min-height: 65px;
}

.week-cell {
    border-left: 1px solid #edf0f4;
    border-bottom: 1px solid #edf0f4;
    padding: 3px;
    cursor: pointer;
    transition: background .15s;
}

.week-cell:hover {
    background: #f8faff;
}

.week-event {
    color: #fff;
    border-radius: 6px;
    padding: 7px 8px;
    margin: 2px 0;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,.08);
}

.week-event strong {
    display: block;
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.week-event small {
    display: block;
    opacity: .85;
    margin-top: 2px;
    font-size: 8px;
}


/* ==========================================
   DAY VIEW
========================================== */

.calendar-day-view {
    background: #fff;
}

.day-time-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    min-height: 65px;
}

.day-time-label {
    color: #9299a5;
    font-size: 10px;
    text-align: right;
    padding: 9px 12px;
    border-right: 1px solid #edf0f4;
}

.day-time-content {
    border-bottom: 1px solid #edf0f4;
    padding: 4px;
    cursor: pointer;
}

.day-time-content:hover {
    background: #f8faff;
}


/* ==========================================
   AGENDA
========================================== */

.agenda-view {
    padding: 5px;
    background: #fff;
}

.agenda-item {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px;
    margin: 4px;
    border-radius: 10px;
    cursor: pointer;
    transition: .15s;
}

.agenda-item:hover {
    background: #f8faff;
}

.agenda-date {
    width: 50px;
    text-align: center;
}

.agenda-date strong {
    display: block;
    font-size: 20px;
}

.agenda-date span {
    color: #8c94a0;
    font-size: 10px;
}

.agenda-color {
    width: 4px;
    height: 42px;
    border-radius: 5px;
}

.agenda-info h6 {
    margin: 0 0 4px;
    font-size: 13px;
}

.agenda-info span,
.agenda-info small {
    display: block;
    color: #89919e;
    font-size: 10px;
    margin-top: 2px;
}

.agenda-empty {
    text-align: center;
    padding: 60px 20px;
    color: #89919e;
}

.agenda-empty i {
    font-size: 35px;
    color: #c4cad2;
}

.agenda-empty h5 {
    margin-top: 12px;
    color: #505967;
}

.empty-state {
    text-align: center;
    color: #969eaa;
    padding: 35px 10px;
    font-size: 12px;
}
/* ==========================================
   DRAG & DROP
========================================== */

.calendar-event,
.week-event {
    position: relative;
    user-select: none;
}

.calendar-event.dragging,
.week-event.dragging {
    opacity: .45;
    transform: scale(.97);
}

.calendar-day,
.week-cell {
    transition:
        background-color .15s ease,
        box-shadow .15s ease;
}

.calendar-day:hover,
.week-cell:hover {
    background: #f7faff;
}

.resizing-event {
    cursor: ns-resize !important;
}

.event-resize-handle {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 6px;
    cursor: ns-resize;
    opacity: 0;
    transition: opacity .15s ease;
}

.calendar-event:hover
.event-resize-handle,
.week-event:hover
.event-resize-handle {
    opacity: 1;
}

.event-resize-handle::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 1px;
    transform: translateX(-50%);
    width: 22px;
    height: 2px;
    border-radius: 3px;
    background: rgba(255,255,255,.8);
}


/* ==========================================
   SAVING INDICATOR
========================================== */

#calendarSaving {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 9px 14px;

    background: #ffffff;
    border: 1px solid #e5e9ef;
    border-radius: 8px;

    box-shadow:
        0 8px 25px rgba(0,0,0,.10);

    font-size: 12px;
    font-weight: 600;

    color: #4b5563;

    opacity: 0;
    pointer-events: none;

    transform:
        translateY(-10px);

    transition:
        opacity .2s ease,
        transform .2s ease;
}

#calendarSaving.show {
    opacity: 1;

    transform:
        translateY(0);
}

#calendarSaving i {
    font-size: 14px;
}


/* ==========================================
   MOBILE
========================================== */

@media (max-width: 768px) {

    .sidebar.mobile-open {
        display: block;
        width: 270px;
        box-shadow: 10px 0 30px rgba(0,0,0,.12);
    }

    .calendar-day {
        min-height: 90px;
    }

    .calendar-event {
        font-size: 8px;
        padding: 3px;
    }

    .week-header,
    .week-row {
        grid-template-columns:
            55px repeat(7, 90px);
    }

    .calendar-week-view {
        overflow-x: auto;
    }

    .day-time-row {
        grid-template-columns: 60px 1fr;
    }

    .agenda-item {
        gap: 10px;
        padding: 12px 8px;
    }

    .agenda-date {
        width: 40px;
    }

    .content { padding:16px; }

    .topbar {
        padding:0 15px;
    }

    .search-box { display:none; }

    .calendar-toolbar {
        flex-direction:column;
        align-items:flex-start;
        gap:12px;
    }

    .calendar-day {
        min-height:75px;
        padding:5px;
    }

    .event {
        display:none;
    }

    .calendar-day.has-event::after {
        content:"";
        display:block;
        width:5px;
        height:5px;
        background:#2563eb;
        border-radius:50%;
        margin:4px auto;
    }
}


@media(max-width:576px) {
    .profile span,
    .profile .bi-chevron-down {
        display:none;
    }

    .calendar-weekdays > div {
        font-size:8px;
    }

    .day-number {
        width:22px;
        height:22px;
        font-size:9px;
    }

    .view-buttons button {
        padding:6px 8px;
    }
}
