/* ═══════════════════════════════════════════════
   PAGE VIEWS — Inbox, Upcoming, Streaks, Analytics
   ═══════════════════════════════════════════════ */
.page-view {
    animation: fadeSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-view-header {
    padding: 24px 20px 16px;
}

.page-view-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-view-title svg {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.page-view-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

.page-group {
    margin-bottom: 8px;
}

.page-group-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-tertiary);
    padding: 10px 20px 6px;
}

.page-group-label svg {
    width: 13px;
    height: 13px;
    stroke-width: 1.8;
}

/* Streaks */
.streaks-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 0 20px 16px;
}

.streak-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    animation: fadeSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.streak-stat-card:nth-child(1) {
    animation-delay: 0ms;
}

.streak-stat-card:nth-child(2) {
    animation-delay: 60ms;
}

.streak-stat-card:nth-child(3) {
    animation-delay: 120ms;
}

.streak-stat-value {
    font-family: var(--mono);
    font-size: 26px;
    font-weight: 600;
}

.streak-stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.streak-list {
    padding: 0 20px;
}

.streak-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
    animation: fadeSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.streak-item:nth-child(1) {
    animation-delay: 0ms;
}

.streak-item:nth-child(2) {
    animation-delay: 40ms;
}

.streak-item:nth-child(3) {
    animation-delay: 80ms;
}

.streak-item:nth-child(4) {
    animation-delay: 120ms;
}

.streak-item:nth-child(5) {
    animation-delay: 160ms;
}

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

.streak-rank {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-tertiary);
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.streak-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-active);
    flex-shrink: 0;
}

.streak-icon-wrap svg {
    width: 16px;
    height: 16px;
    stroke-width: 1.8;
    stroke: var(--text-secondary);
}

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

.streak-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.streak-bar-wrap {
    height: 4px;
    background: var(--bg-active);
    border-radius: 2px;
    overflow: hidden;
}

.streak-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 2px;
}

.streak-count {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    width: 30px;
    text-align: right;
}

.streak-history {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}

/* Analytics */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 20px 16px;
}

.analytics-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    animation: fadeSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
    transition: border-color 0.2s;
}

.analytics-card:hover {
    border-color: var(--accent-purple-dim);
}

.analytics-card:nth-child(1) {
    animation-delay: 0ms;
}

.analytics-card:nth-child(2) {
    animation-delay: 60ms;
}

.analytics-card:nth-child(3) {
    animation-delay: 120ms;
}

.analytics-card:nth-child(4) {
    animation-delay: 180ms;
}

.analytics-card-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
}

.analytics-card-title svg {
    width: 13px;
    height: 13px;
    stroke-width: 1.8;
}

.analytics-big-number {
    font-family: var(--mono);
    font-size: 32px;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 4px;
}

.analytics-detail {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.analytics-bar-wrap {
    height: 4px;
    background: var(--bg-active);
    border-radius: 2px;
    overflow: hidden;
}

.analytics-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.analytics-section {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
}

.analytics-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.analytics-section-title svg {
    width: 14px;
    height: 14px;
    stroke-width: 1.8;
}

.analytics-cat-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.analytics-cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-cat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    width: 80px;
    flex-shrink: 0;
}

.analytics-cat-bar-wrap {
    flex: 1;
    height: 6px;
    background: var(--bg-active);
    border-radius: 3px;
    overflow: hidden;
}

.analytics-cat-count {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-tertiary);
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   RESPONSIVE — Hamburger & Sidebar Overlay base
   ═══════════════════════════════════════════════ */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    align-items: center;
    justify-content: center;
}

.hamburger-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

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

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
}

.sidebar-overlay.open {
    display: block;
}

/* ═══════════════════════════════════════════════
   TABLET — 768px to 1024px
   ═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
    :root {
        --sidebar-w: 200px;
    }

    .content {
        flex-direction: column;
        padding: 20px 24px;
    }

    .col-side {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .stats-row {
        grid-template-columns: repeat(3, 1fr);
    }

    .ring-wrap {
        width: 130px;
        height: 130px;
    }

    .ring-svg {
        width: 130px;
        height: 130px;
    }

    .templates-card {
        width: 90vw;
        max-width: 540px;
    }
}

/* ═══════════════════════════════════════════════
   MOBILE — Under 768px
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --sidebar-w: 260px;
    }

    body {
        overflow: auto;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        -webkit-user-select: none; /* Prevent accidental text selection on mobile */
        user-select: none;
    }

    /* Sidebar: off-canvas */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        height: 100%;
        height: 100dvh;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
    }

    .mobile-close-btn {
        display: flex;
    }

    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        margin-left: -12px;
    }

    .main {
        overflow: visible;
    }

    /* Header */
    .header {
        padding: 0 16px;
        height: 56px;
        gap: 8px;
    }

    .greeting-wrap {
        gap: 4px;
    }

    .greeting-text {
        display: none;
    }

    .greeting-name {
        font-size: 13px;
    }

    .search-wrap {
        margin-right: 0;
        display: flex;
        align-items: center;
        width: 32px;
        height: 32px;
    }

    .search-wrap input {
        width: 32px;
        height: 32px;
        padding: 0;
        padding-left: 32px;
        /* pushes text out of view when collapsed */
        background: transparent;
        border-color: transparent;
        color: transparent;
        cursor: pointer;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .search-wrap input::placeholder {
        color: transparent;
    }

    .search-wrap input:focus {
        width: 180px;
        height: auto;
        padding: 6px 12px 6px 30px;
        position: absolute;
        right: 0;
        background: var(--bg-surface);
        border-color: var(--accent-purple);
        color: var(--text-primary);
        z-index: 50;
        cursor: text;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }

    .search-wrap input:focus::placeholder {
        color: var(--text-tertiary);
    }

    .search-wrap svg {
        left: 8px;
        pointer-events: none;
        z-index: 51;
    }

    .date-chip {
        display: none;
    }

    .header-actions {
        gap: 4px;
    }

    .header-actions .btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    .header-actions .kbd {
        display: none;
    }

    /* Content */
    .content {
        flex-direction: column;
        padding: 16px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
        gap: 16px;
        /* Re-enable text selection for actual content but keep UI elements unselectable */
        -webkit-user-select: text;
        user-select: text;
    }

    .col-side {
        width: 100%;
        display: flex;
        flex-direction: column;
    }

    /* Stats */
    .stats-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 12px 14px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 24px;
    }

    .stat-sub {
        font-size: 10px;
    }

    /* Progress */
    .progress-section {
        padding: 12px 16px;
    }

    /* Section */
    .section-header {
        padding: 12px 16px;
    }

    .section-title {
        font-size: 16px;
    }

    /* Tasks */
    .task-item {
        padding: 14px 16px;
    }

    .task-name {
        font-size: 15px;
    }

    .task-time {
        font-size: 13px;
    }

    /* Habits */
    .habit-item {
        padding: 14px 16px;
    }

    .habit-name {
        font-size: 15px;
    }

    /* Rings */
    .ring-section {
        padding: 16px;
    }

    .ring-wrap {
        width: 120px;
        height: 120px;
    }

    .ring-svg {
        width: 120px;
        height: 120px;
    }

    .ring-pct {
        font-size: 22px;
    }

    .ring-title {
        font-size: 13px;
    }

    .legend-item {
        font-size: 12px;
    }

    /* Pomodoro */
    .pomo-section {
        padding: 16px;
    }

    .pomo-tabs {
        gap: 1px;
    }

    .pomo-tab {
        font-size: 12px;
        padding: 8px 6px;
    }

    /* Modals — full screen on mobile */
    .modal-card {
        width: 100vw;
        max-width: 100vw;
        border-radius: 14px 14px 0 0;
        max-height: 90vh;
    }

    .templates-card {
        width: 100vw;
        max-width: 100vw;
        border-radius: 14px 14px 0 0;
        max-height: 90vh;
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }

    /* Shortcuts */
    .shortcuts-card {
        width: 90vw;
    }

    /* Focus mode */
    .focus-overlay .focus-card {
        width: 95vw;
        padding: 32px 20px;
    }

    .focus-task-name {
        font-size: 22px;
    }

    /* Welcome */
    .welcome-card {
        width: 90vw;
        padding: 40px 24px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-sub {
        font-size: 13px;
    }

    /* Footer */
    .sidebar-footer {
        padding: 12px 10px;
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* ═══════════════════════════════════════════════
   SMALL MOBILE — Under 480px
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card:last-child {
        grid-column: 1 / -1;
    }

    .stat-value {
        font-size: 22px;
    }

    .header-actions .desktop-only-btn {
        display: none;
    }

    .mobile-only-nav {
        display: flex !important;
    }

    .section-title {
        font-size: 12px;
    }

    .ring-wrap {
        width: 100px;
        height: 100px;
    }

    .ring-svg {
        width: 100px;
        height: 100px;
    }

    .ring-pct {
        font-size: 18px;
    }

    .ring-sub {
        font-size: 8px;
    }
}

/* ═══════════════════════════════════════════════
   LARGE DESKTOP — 1440px+
   ═══════════════════════════════════════════════ */
@media (min-width: 1440px) {
    .content {
        max-width: 1400px;
    }

    .col-side {
        width: 310px;
    }

    .ring-wrap {
        width: 160px;
        height: 160px;
    }

    .ring-svg {
        width: 160px;
        height: 160px;
    }

    .ring-pct {
        font-size: 28px;
    }
}

/* ═══════════════════════════════════════════════
   4K MONITORS — 1920px+
   ═══════════════════════════════════════════════ */
@media (min-width: 1920px) {
    :root {
        --sidebar-w: 260px;
    }

    body {
        font-size: 15px;
    }

    .content {
        max-width: 1600px;
        padding: 36px 48px;
        gap: 32px;
    }

    .col-side {
        width: 340px;
        gap: 24px;
    }

    .header {
        height: 58px;
        padding: 0 48px;
    }

    .greeting-text {
        font-size: 15px;
    }

    .greeting-name {
        font-size: 16px;
    }

    .stat-card {
        padding: 22px 24px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 34px;
    }

    .ring-wrap {
        width: 170px;
        height: 170px;
    }

    .ring-svg {
        width: 170px;
        height: 170px;
    }

    .ring-pct {
        font-size: 30px;
    }

    .ring-title {
        font-size: 15px;
    }

    .legend-item {
        font-size: 13.5px;
    }

    .section-title {
        font-size: 14px;
    }

    .task-name {
        font-size: 14.5px;
    }

    .task-item {
        padding: 14px 22px;
    }

    .habit-item {
        padding: 14px 22px;
    }

    .habit-name {
        font-size: 14.5px;
    }

    .pomo-title {
        font-size: 14px;
    }

    .pomo-time {
        font-size: 24px;
    }

    .pomo-tab {
        font-size: 12px;
    }

    .nav-item {
        font-size: 14px;
        padding: 10px 12px;
    }

    .logo-name {
        font-size: 16px;
    }

    .templates-card {
        width: 620px;
    }
}

/* ═══════════════════════════════════════════════
   ULTRA-WIDE — 2560px+
   ═══════════════════════════════════════════════ */
@media (min-width: 2560px) {
    :root {
        --sidebar-w: 280px;
    }

    body {
        font-size: 16px;
    }

    .content {
        max-width: 1800px;
        padding: 40px 56px;
    }

    .col-side {
        width: 380px;
    }

    .stat-value {
        font-size: 38px;
    }

    .ring-wrap {
        width: 190px;
        height: 190px;
    }

    .ring-svg {
        width: 190px;
        height: 190px;
    }

    .ring-pct {
        font-size: 34px;
    }
}