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

:root {
    --bg:         #08080f;
    --surface:    #111118;
    --surface2:   #18181f;
    --surface3:   #222230;
    --border:     #2a2a3e;
    --border2:    #3a3a50;
    --text:       #eeeef5;
    --text-muted: #7777a0;
    --text-dim:   #4a4a6a;
    --accent:     #4ECDC4;
    --danger:     #FF5555;
    --danger-bg:  rgba(255,85,85,0.1);
    --warning:    #FFD93D;
    --success:    #6BCB77;
    --radius-sm:  10px;
    --radius:     16px;
    --radius-lg:  22px;
    --shadow:     0 12px 48px rgba(0,0,0,0.5);
    --shadow-sm:  0 4px 16px rgba(0,0,0,0.3);
    --font:       'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
    --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

html { font-size: 16px; scroll-behavior: smooth; }

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

button { font-family: var(--font); }
input  { font-family: var(--font); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ===== Header ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(8,8,15,0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
    flex: 1;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #4ECDC4 0%, #87CEEB 60%, #C77DFF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    flex-shrink: 0;
}

.date-time {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.date-display {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.time-display {
    font-size: 1.4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
    color: var(--text);
    white-space: nowrap;
    line-height: 1.2;
}

/* ===== Floating Action Button ===== */
.fab {
    position: fixed;
    bottom: 28px;
    right: 24px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    pointer-events: none;
}

.fab-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 89;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.fab-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    pointer-events: none;
}

.fab-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transform: translateY(16px) scale(0.92);
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
    pointer-events: none;
}

/* stagger: item closest to FAB (nth-child 3) appears first */
.fab-item:nth-child(3) { transition-delay: 0s; }
.fab-item:nth-child(2) { transition-delay: 0.06s; }
.fab-item:nth-child(1) { transition-delay: 0.12s; }

.fab-label {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 9px;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    white-space: nowrap;
    user-select: none;
}

.fab-mini {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    box-shadow: 0 6px 20px rgba(0,0,0,0.35);
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition), transform 0.2s;
}

.fab-item:hover .fab-mini {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
    transform: scale(1.08);
}

.fab-item:hover .fab-label {
    border-color: var(--accent);
    color: var(--accent);
}

/* Main circle */
.fab-main {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #4ECDC4, #45B7D1);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 24px rgba(78,205,196,0.45), 0 2px 8px rgba(0,0,0,0.3);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s, background 0.3s;
    position: relative;
    pointer-events: all;
    flex-shrink: 0;
}

.fab-main:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 32px rgba(78,205,196,0.6), 0 4px 12px rgba(0,0,0,0.3);
}

.fab-main:active { transform: scale(0.96); }

.fab-icon-open,
.fab-icon-close {
    position: absolute;
    transition: opacity 0.2s, transform 0.3s;
}

.fab-icon-close { opacity: 0; transform: rotate(-45deg) scale(0.7); }

/* ===== FAB open state ===== */
.fab.open .fab-menu      { pointer-events: all; }
.fab.open .fab-item      { opacity: 1; transform: none; pointer-events: all; }
.fab.open .fab-main      { background: var(--surface3); box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.fab.open .fab-icon-open { opacity: 0; transform: rotate(45deg) scale(0.7); }
.fab.open .fab-icon-close{ opacity: 1; transform: rotate(0deg) scale(1); }

/* ===== Main / Views ===== */
.main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ===== Day Overview ===== */
.day-overview {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 22px;
    margin-bottom: 16px;
}

.day-bar {
    display: flex;
    height: 9px;
    border-radius: 5px;
    overflow: hidden;
    background: rgba(107,203,119,0.1);
    margin-bottom: 14px;
}

.day-bar-elapsed {
    background: var(--surface3);
    height: 100%;
    border-right: 2px solid var(--bg);
    transition: width 1s linear;
}

.day-bar-committed {
    background: var(--accent);
    height: 100%;
    opacity: 0.75;
    transition: width 0.4s ease;
}

.dov-stats {
    display: flex;
    align-items: center;
}

.dov-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.dov-stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    line-height: 1;
}

.dov-stat-value.accent   { color: var(--accent); }
.dov-stat-value.free     { color: var(--success); font-size: 1.25rem; }
.dov-stat-value.overflow { color: var(--danger) !important; }

.dov-stat-label {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dov-divider {
    width: 1px;
    height: 34px;
    background: var(--border);
    flex-shrink: 0;
}

/* ===== Summary bar (timers) ===== */
.summary-bar {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 24px;
    margin-bottom: 24px;
}

.summary-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.summary-num {
    font-size: 1.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}
.summary-num.danger { color: var(--danger); }
.summary-num.accent { color: var(--accent); font-size: 1.1rem; }

.summary-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* ===== Grid ===== */
.targets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 18px;
    align-items: start;
}

/* ===== Empty State ===== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.empty-icon { font-size: 3.5rem; opacity: 0.2; margin-bottom: 6px; }
.empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text-muted); }
.empty-sub { font-size: 0.88rem; color: var(--text-dim); max-width: 300px; }
.btn-add-empty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    background: var(--surface2);
    border: 1px dashed var(--border2);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-add-empty:hover { border-color: var(--accent); color: var(--accent); background: rgba(78,205,196,0.07); }

/* ===== Target Card ===== */
.target-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 13px;
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
    position: relative;
    overflow: hidden;
    animation: cardIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
}

@keyframes cardIn {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.target-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--card-color, var(--accent));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0.9;
}

.target-card:hover {
    border-color: var(--card-color, var(--accent));
    box-shadow: 0 0 0 1px var(--card-color, var(--accent)), 0 8px 32px rgba(0,0,0,0.4);
    transform: translateY(-2px);
}

.target-card.state-running {
    border-color: var(--card-color, var(--accent));
    box-shadow: 0 0 20px color-mix(in srgb, var(--card-color, var(--accent)) 20%, transparent), var(--shadow-sm);
}

.target-card.state-overdue {
    border-color: var(--danger);
    box-shadow: 0 0 20px rgba(255,85,85,0.18), var(--shadow-sm);
}
.target-card.state-overdue::before {
    background: var(--danger);
    animation: pulseBar 1.5s ease-in-out infinite;
}
@keyframes pulseBar { 0%,100%{opacity:.9} 50%{opacity:.25} }

.target-card.state-completed {
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(107,203,119,0.18), var(--shadow-sm);
}
.target-card.state-completed::before {
    background: var(--success);
}
.status-badge.completed {
    background: rgba(107,203,119,0.12);
    color: var(--success);
}

.card-header { display: flex; align-items: flex-start; gap: 8px; }
.card-name { flex: 1; font-size: 1rem; font-weight: 600; color: var(--text); word-break: break-word; }
.card-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 6px;
    transition: var(--transition);
    opacity: 0;
}
.target-card:hover .card-delete { opacity: 1; }
.card-delete:hover { color: var(--danger); background: var(--danger-bg); }

/* Timer display */
.timer-display {
    text-align: center;
    font-size: 3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: 3px;
    color: var(--card-color, var(--accent));
    line-height: 1;
    padding: 4px 0;
    transition: color var(--transition);
}
.timer-display.is-overdue {
    color: var(--danger);
    animation: timerPulse 2s ease-in-out infinite;
}
@keyframes timerPulse { 0%,100%{opacity:1} 50%{opacity:.6} }

/* Progress bar */
.progress-track {
    height: 5px;
    background: var(--surface3);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--card-color, var(--accent));
    transition: width 0.9s linear;
    position: relative;
}
.progress-fill.is-overdue { background: var(--danger); width: 100% !important; transition: none; }

/* Status badge */
.card-status { display: flex; align-items: center; gap: 8px; }
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.status-badge.idle    { background: rgba(119,119,160,0.12); color: var(--text-muted); }
.status-badge.running { background: color-mix(in srgb, var(--card-color,var(--accent)) 16%, transparent); color: var(--card-color,var(--accent)); }
.status-badge.paused  { background: rgba(255,217,61,0.1);  color: var(--warning); }
.status-badge.overdue { background: var(--danger-bg); color: var(--danger); }

.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-badge.running .status-dot { animation: blink 1s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.saved-label { font-size: 0.74rem; color: var(--text-dim); margin-left: auto; }

/* Card actions */
.card-actions { display: flex; gap: 8px; }
.btn-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    background: var(--card-color, var(--accent));
    color: #000;
}
.btn-action:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-action:active { transform: none; filter: brightness(0.95); }
.btn-action.overdue { background: var(--danger); color: #fff; }

.btn-reset {
    flex: 0;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border2);
    background: var(--surface2);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    line-height: 1;
}
.btn-reset:hover { border-color: var(--text-muted); color: var(--text); }

.btn-complete {
    flex: 0;
    padding: 10px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(107,203,119,0.4);
    background: rgba(107,203,119,0.08);
    color: var(--success);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
}
.btn-complete:hover { background: rgba(107,203,119,0.2); border-color: var(--success); }

/* ===== STATS VIEW ===== */

/* Stats top bar */
.stats-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 10px;
}

.period-tabs {
    display: flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.period-tabs::-webkit-scrollbar { display: none; }

.period-tab {
    padding: 7px 14px;
    background: none;
    border: none;
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 0.83rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}
.period-tab:hover { color: var(--text); background: var(--surface3); }
.period-tab.active {
    background: var(--surface2);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* Muted icon button (delete history etc.) */
.btn-icon-muted {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-icon-muted:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }

/* Period navigation */
.period-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-period-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}
.btn-period-nav:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(78,205,196,0.07);
}
.btn-period-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

.period-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    min-width: 180px;
    text-align: center;
    white-space: nowrap;
}

/* Stat cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 18px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: var(--transition);
}
.stat-card:hover { border-color: var(--border2); transform: translateY(-2px); }

.stat-icon { font-size: 1.5rem; margin-bottom: 4px; }

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Chart block */
.chart-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
}

.chart-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 20px;
}

.chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.chart-unit {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.bar-chart-wrap { overflow-x: auto; }

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 140px;
    min-width: 100%;
    padding-bottom: 28px;
    position: relative;
}

/* Gridlines */
.bar-chart::before {
    content: '';
    position: absolute;
    left: 0; right: 0;
    top: 0; bottom: 28px;
    background:
        repeating-linear-gradient(
            180deg,
            var(--border) 0px,
            var(--border) 1px,
            transparent 1px,
            transparent 25%
        );
    opacity: 0.4;
    pointer-events: none;
}

.bar-col {
    flex: 1;
    min-width: 28px;
    max-width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
    position: relative;
}

.bar-fill {
    width: 100%;
    min-height: 3px;
    border-radius: 4px 4px 0 0;
    background: var(--accent);
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    cursor: pointer;
}
.bar-fill:hover::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface3);
    border: 1px solid var(--border2);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    color: var(--text);
    z-index: 10;
    pointer-events: none;
}

.bar-fill.today { background: var(--accent); box-shadow: 0 0 10px rgba(78,205,196,0.4); }
.bar-fill.empty { background: var(--surface3); }

.bar-label {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.68rem;
    color: var(--text-dim);
    white-space: nowrap;
    line-height: 1.2;
    text-align: center;
}
.bar-label.today { color: var(--accent); font-weight: 700; }

/* Breakdown */
.breakdown-block,
.sessions-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

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

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.breakdown-name {
    font-size: 0.9rem;
    color: var(--text);
    min-width: 120px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.breakdown-bar-wrap {
    flex: 1;
    height: 8px;
    background: var(--surface3);
    border-radius: 4px;
    overflow: hidden;
}

.breakdown-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.breakdown-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 56px;
    text-align: right;
    white-space: nowrap;
}

.breakdown-pct {
    font-size: 0.78rem;
    color: var(--text-dim);
    min-width: 36px;
    text-align: right;
}

/* Sessions list */
.sessions-list { display: flex; flex-direction: column; gap: 8px; }

.session-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    animation: cardIn 0.2s ease;
}
.session-item:hover { border-color: var(--border2); }

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

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

.session-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.session-time {
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
    white-space: nowrap;
}

.session-badge {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.session-badge.ok       { background: rgba(107,203,119,0.12); color: var(--success); }
.session-badge.overtime { background: var(--danger-bg); color: var(--danger); }
.session-badge.early    { background: rgba(255,217,61,0.1);  color: var(--warning); }

.empty-sessions {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.8;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.15s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }

.modal {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow);
    animation: slideUp 0.2s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes slideUp { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}
.modal-header h2 { font-size: 1.2rem; font-weight: 700; }

.modal-close {
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 4px; border-radius: 6px;
    transition: var(--transition); line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--surface3); }

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 11px 14px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(78,205,196,0.15);
}

.time-inputs { display: flex; align-items: center; gap: 6px; }
.time-input-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.time-input-group input[type="number"] {
    width: 100%;
    padding: 11px 4px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1.5rem;
    font-weight: 800;
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: border-color var(--transition);
    -moz-appearance: textfield;
}
.time-input-group input[type="number"]::-webkit-outer-spin-button,
.time-input-group input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.time-input-group input[type="number"]:focus { outline: none; border-color: var(--accent); }
.time-input-group span { font-size: 0.73rem; color: var(--text-muted); font-weight: 500; }
.time-sep { font-size: 1.5rem; font-weight: 800; color: var(--text-dim); padding-bottom: 18px; }

.quick-times { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.quick-btn {
    padding: 5px 12px;
    background: var(--surface3);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.quick-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(78,205,196,0.08); }

.color-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.color-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.color-btn::after {
    content: '✓';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: #000; font-size: 0.78rem; font-weight: 900; opacity: 0;
}
.color-btn.active { border-color: #fff; transform: scale(1.2); box-shadow: 0 0 12px rgba(255,255,255,0.2); }
.color-btn.active::after { opacity: 1; }

.modal-actions { display: flex; gap: 10px; margin-top: 4px; }

.btn-cancel {
    flex: 1; padding: 11px;
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.92rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
}
.btn-cancel:hover { color: var(--text); border-color: var(--text-muted); }

.btn-save {
    flex: 1; padding: 11px;
    background: linear-gradient(135deg, #4ECDC4, #45B7D1);
    border: none; border-radius: var(--radius-sm);
    color: #000; font-size: 0.92rem; font-weight: 700;
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 7px;
}
.btn-save:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger {
    flex: 1; padding: 11px;
    background: var(--danger); border: none;
    border-radius: var(--radius-sm);
    color: #fff; font-size: 0.92rem; font-weight: 700;
    cursor: pointer; transition: var(--transition);
}
.btn-danger:hover { filter: brightness(1.1); }

.confirm-text { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    padding: 11px 20px;
    color: var(--text);
    font-size: 0.88rem; font-weight: 500;
    box-shadow: var(--shadow);
    z-index: 999;
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
    opacity: 0;
    white-space: nowrap;
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== Header user / auth ===== */
.header-user {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
}

.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border2);
    object-fit: cover;
    flex-shrink: 0;
}

.header-username {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Avatar inside FAB mini circle */
.fab-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

/* Login modal */
.login-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.google-btn-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    min-height: 44px;
}

.btn-login-cancel {
    width: 100%;
    margin-top: 4px;
}

/* Profile modal */
.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px 0 24px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 3px solid var(--border2);
    object-fit: cover;
    margin-bottom: 4px;
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.profile-email {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-inner { padding: 10px 16px; }
    .logo { font-size: 1.25rem; }
    .date-display { display: none; }
    .time-display { font-size: 1.2rem; }
    .main { padding: 14px 14px 100px; }
    .targets-grid { grid-template-columns: 1fr; gap: 12px; }
    .timer-display { font-size: 2.8rem; }
    .summary-bar { padding: 10px 14px; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .breakdown-name { max-width: 100px; }
    .fab { bottom: 20px; right: 16px; }
    .toast { bottom: 100px; }
}

@media (max-width: 540px) {
    .modal { padding: 20px 16px; }
    .timer-display { font-size: 2.4rem; letter-spacing: 2px; }
    .card-delete { opacity: 1; }
    .period-tab { padding: 7px 10px; font-size: 0.79rem; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .breakdown-item { flex-wrap: wrap; }
    .breakdown-bar-wrap { order: 3; flex-basis: 100%; }
    .stats-topbar { gap: 8px; }
}

@media (max-width: 380px) {
    .time-sep { display: none; }
    .time-inputs { gap: 4px; }
    .time-input-group input[type="number"] { font-size: 1.3rem; }
    .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-value { font-size: 1.4rem; }
}
