/* Dashboard Layout ========================================= */
.dashboard {
    display: flex;
    min-height: 100vh;
    background: var(--color-bg);
}

/* Main ========================================= */
.dashboard-main {
    width: calc(100% - var(--sidebar-width));
    margin-inline-start: var(--sidebar-width);
}

/* Header ========================================= */
.dashboard-header {
    position: sticky;
    top: 0;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline: var(--page-padding);
    background: rgba(246, 247, 251, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(233, 235, 242, 0.8);
    z-index: 50;
}

.dashboard-header__right,
.dashboard-header__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-box {
    width: 330px;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding-inline: 12px;
    border: 1px solid var(--color-border);
    border-radius: 11px;
    background: #fff;
    transition: border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.search-box:focus-within {
    border-color: rgba(91, 92, 226, 0.4);
    box-shadow: 0 0 0 3px rgba(91, 92, 226, 0.08);
}

.search-box__icon {
    color: var(--color-text-muted);
    font-size: 21px;
}

.search-box input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--color-text);
    font-size: 12px;
}

.search-box__shortcut {
    width: 23px;
    height: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: #f3f4f8;
    color: #8c94a4;
    font-size: 11px;
}

.header-action,
.mobile-menu {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: #fff;
    color: var(--color-text-secondary);
    font-size: 18px;
    transition: transform var(--transition-fast),
    background var(--transition-fast);
    cursor: pointer;
}

.header-action:hover {
    background: var(--color-surface-soft);
    transform: translateY(-1px);
}

.header-avatar {
    width: 40px;
    height: 40px;
}

.mobile-menu {
    display: none;
}

/* Content ========================================= */
.dashboard-content {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 30px var(--page-padding) 50px;
}

/* Welcome ========================================= */
.welcome-section {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 25px;
    margin-bottom: 22px;
}

.welcome-section__date {
    display: block;
    margin-bottom: 5px;
    color: var(--color-text-muted);
    font-size: 13px;
}

.welcome-section h1 {
    margin-bottom: 5px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.4px;
}
.welcome-greeting-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-inline-start: 6px;
    vertical-align: middle;
    line-height: 1;
}
.welcome-greeting-icon svg {
    display: block;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}
.welcome-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.8;
}
.welcome-summary__item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.welcome-summary__item strong {
    color: var(--color-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
}
.welcome-summary__separator {
    margin-inline: 2px;
    color: var(--color-border);
    font-size: 14px;
}
.primary-button {
    height: 43px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding-inline: 18px;
    border: 0;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 7px 18px rgba(91, 92, 226, 0.22);
    transition: transform var(--transition-fast),
    box-shadow var(--transition-fast);
}
.primary-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(91, 92, 226, 0.28);
}
.primary-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.primary-button__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.primary-button__icon svg {
    display: block;
    width: 18px;
    height: 18px;
}

/* Quick Actions ========================================= */
.quick-actions {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.quick-actions[hidden] {
    display: none !important;
}
.quick-action {
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 13px;
    background: #fff;
    color: var(--color-text);
    font-size: 12px;
    text-align: right;
    transition: transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}
.quick-action:hover {
    transform: translateY(-2px);
    border-color: #dfe1f7;
    box-shadow: var(--shadow-sm);
}
.quick-action__icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 10px;
    font-size: 17px;
}
.quick-action__icon svg {
    display: block;
    width: 20px;
    height: 20px;
}
.quick-action__icon.task {
    background: #eeeeff;
    color: var(--color-primary);
}
.quick-action__icon.schedule {
    background: #edf4ff;
    color: var(--color-info);
}
.quick-action__icon.habit {
    background: #eaf8f1;
    color: var(--color-success);
}
.quick-action__icon.project {
    background: #fff6e6;
    color: var(--color-warning);
}

/* Stats ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.stat-card {
    padding: 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-sm);
}
.stat-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.stat-card__icon {
    width: 37px;
    height: 37px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 16px;
}
.stat-card__icon svg {
    display: block;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}
.stat-card__icon.purple {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.stat-card__icon.blue {
    color: var(--color-info);
    background: var(--color-info-light);
}

.stat-card__icon.green {
    color: var(--color-success);
    background: var(--color-success-light);
}

.stat-card__icon.orange {
    color: var(--color-warning);
    background: var(--color-warning-light);
}

.stat-card__trend {
    padding: 3px 7px;
    border-radius: 6px;
    background: #f4f5f8;
    color: var(--color-text-muted);
    font-size: 9px;
}

.stat-card__trend.positive {
    background: var(--color-success-light);
    color: var(--color-success);
}

.stat-card__value {
    margin-top: 12px;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-card__label {
    margin-top: 3px;
    color: var(--color-text);
    font-size: 13px;
}

.stat-card__footer {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 13px;
    color: var(--color-text-muted);
    font-size: 11px;
}

.stat-card__footer strong {
    color: var(--color-text);
}

/* Dashboard Cards ========================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px;
}

.dashboard-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 17px;
}

.card-header h2 {
    font-size: 14px;
    font-weight: 700;
}

.card-header span {
    display: block;
    margin-top: 3px;
    color: var(--color-text-muted);
    font-size: 9px;
}

.card-header a {
    color: var(--color-primary);
    font-size: 10px;
    white-space: nowrap;
}

.card-header a:hover {
    text-decoration: underline;
}

/* Schedule ========================================= */
.schedule-list {
    display: flex;
    flex-direction: column;
}

.schedule-item {
    display: grid;
    grid-template-columns: 48px 18px 1fr;
    min-height: 58px;
}

.schedule-time {
    padding-top: 3px;
    color: var(--color-text-muted);
    font-size: 9px;
}

.schedule-line {
    position: relative;
    display: flex;
    justify-content: center;
}

.schedule-line::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--color-border);
}

.schedule-line span {
    position: relative;
    z-index: 2;
    width: 9px;
    height: 9px;
    margin-top: 5px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #b8bdc9;
    box-shadow: 0 0 0 1px #d9dce4;
}

.schedule-info {
    padding-inline-start: 10px;
}

.schedule-info strong {
    display: block;
    font-size: 10px;
    font-weight: 600;
}

.schedule-info span {
    display: block;
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 8px;
}

.schedule-item.current .schedule-line span {
    background: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.schedule-item.current .schedule-info strong {
    color: var(--color-primary);
}

/* Projects ========================================= */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.project-item__top,
.project-item__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-title strong {
    font-size: 10px;
    font-weight: 600;
}

.project-item__top > span {
    color: var(--color-text-secondary);
    font-size: 10px;
    font-weight: 600;
}

.project-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.progress {
    height: 6px;
    margin-top: 9px;
    overflow: hidden;
    border-radius: 10px;
    background: #f0f1f5;
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
            90deg,
            var(--color-primary),
            #797af0
    );
}

.project-item__bottom {
    margin-top: 7px;
    color: var(--color-text-muted);
    font-size: 8px;
}

/* Tasks ========================================= */
.task-list {
    display: flex;
    flex-direction: column;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 11px;
    min-height: 58px;
    border-bottom: 1px solid var(--color-border-light);
}

.task-item:last-child {
    border-bottom: 0;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1.5px solid #d9dce5;
    border-radius: 6px;
    background: #fff;
    color: #fff;
    font-size: 11px;
    transition: background var(--transition-fast),
    border-color var(--transition-fast);
    cursor: pointer;
}

.task-checkbox:hover {
    border-color: var(--color-primary);
}

.task-checkbox.checked {
    border-color: var(--color-primary);
    background: var(--color-primary);
}

.task-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.task-info strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
    font-weight: 600;
}

.task-info span {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 9px;
}

.task-item.completed .task-info strong {
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.priority {
    padding: 4px 7px;
    border-radius: 6px;
    font-size: 8px;
}

.priority.high {
    color: var(--color-danger);
    background: var(--color-danger-light);
}

.priority.medium {
    color: var(--color-warning);
    background: var(--color-warning-light);
}

.priority.low {
    color: var(--color-info);
    background: var(--color-info-light);
}

/* Habits ========================================= */

/* Dashboard habits */
.dashboard-habits-card {
    grid-column: 1 / -1;
}

.dashboard-habit-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 18px;
}

.dashboard-habit-item {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 11px;
    background: #fff;
}

.dashboard-habit-item.is-completed {
    background: #fafdfb;
}

.dashboard-habit-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--habit-color) 13%, white);
    color: var(--habit-color);
    font-size: 16px;
}

.dashboard-habit-info {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.dashboard-habit-info strong {
    color: var(--color-text);
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-habit-info small {
    color: var(--color-text-muted);
    font-size: 8px;
}

.dashboard-habit-item > button {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--habit-color);
    border-radius: 9px;
    background: #fff;
    color: var(--habit-color);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.dashboard-habit-item.is-completed > button {
    background: var(--habit-color);
    color: #fff;
}

.dashboard-habit-item > button:disabled {
    opacity: .5;
    cursor: wait;
}

@media (max-width: 768px) {
    .dashboard-habits-card {
        grid-column: auto;
    }

    .dashboard-habit-list {
        grid-template-columns: 1fr;
    }
}


/* Responsive ========================================= */
@media (max-width: 1200px) {
    .search-box {
        width: 280px;
    }
}

@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .quick-actions {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .dashboard-main {
        width: 100%;
        margin-inline-start: 0;
    }

    .mobile-menu {
        display: flex;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        height: 64px;
    }

    .search-box {
        width: min(300px, 50vw);
    }

    .dashboard-content {
        padding-top: 22px;
    }

    .welcome-section {
        align-items: flex-start;

        flex-direction: column;
    }

    .welcome-section h1 {
        font-size: 22px;
    }
}

@media (max-width: 560px) {
    .dashboard-header__left {
        gap: 7px;
    }

    .search-box {
        position: relative;
        width: 42px;
        padding-inline: 10px;
        cursor: pointer;
    }

    .search-box input {
        position: absolute;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        opacity: 0;
        cursor: pointer;
    }

    .search-box__shortcut {
        display: none;
    }

    .quick-actions {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .quick-action {
        min-height: 56px;
    }

    .header-action {
        width: 36px;
        height: 36px;
    }

    .header-avatar {
        width: 36px;
        height: 36px;
    }
}


/* =========================================================
   Live dashboard
========================================================= */
.quick-action {
    box-sizing: border-box;
    text-decoration: none;
    cursor: pointer;
}

.quick-actions.is-highlighted {
    animation: dashboard-actions-highlight .9s ease;
}

@keyframes dashboard-actions-highlight {
    35% {
        transform: translateY(-2px);
        filter: drop-shadow(0 7px 12px rgba(91, 92, 226, .18));
    }
}

.dashboard-grid--live .dashboard-card {
    height: 100%;
    box-sizing: border-box;
}

.dashboard-grid--live .schedule-card,
.dashboard-grid--live .projects-card,
.dashboard-grid--live .tasks-card {
    min-height: 330px;
}

.schedule-item,
.project-item {
    color: inherit;
    text-decoration: none;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.schedule-item:hover,
.project-item:hover {
    border-radius: 9px;
    background: #f8f9fc;
    transform: translateX(-2px);
}

.schedule-line span {
    background: var(--item-color, #b8bdc9);
}

.schedule-item.current {
    border-radius: 9px;
    background: #f5f5ff;
}

.schedule-info {
    min-width: 0;
}

.schedule-info strong,
.schedule-info span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-item {
    display: block;
}

.project-dot {
    display: inline-block;
    flex-shrink: 0;
    font-style: normal;
}

.task-info a {
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.task-info a:hover strong {
    color: var(--color-primary);
}

.task-checkbox:disabled {
    opacity: .5;
    cursor: wait;
}

.priority.urgent {
    color: #c63f55;
    background: #ffe7eb;
}

.dashboard-empty {
    min-height: 210px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px;
    color: var(--color-text-muted);
    text-align: center;
}

.dashboard-empty > span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 18px;
}

.dashboard-empty strong {
    color: var(--color-text-secondary);
    font-size: 11px;
}

.dashboard-empty small {
    font-size: 9px;
}

.dashboard-empty a {
    color: var(--color-primary);
    font-size: 10px;
    font-weight: 600;
}

.dashboard-empty.is-success > span {
    background: var(--color-success-light);
    color: var(--color-success);
}

@media (max-width: 560px) {
    .welcome-section .primary-button {
        width: 100%;
        justify-content: center;
    }

    .quick-action {
        font-size: 11px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card__value {
        font-size: 22px;
    }

    .stat-card__footer {
        align-items: flex-start;
        flex-wrap: wrap;
        line-height: 1.7;
    }

    .priority {
        font-size: 9px;
    }
}


