:root {
    --primary: #2563EB;
    --bg: #F8FAFC;
    --text: #111827;
    --border: #E5E7EB;
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); margin: 0; font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: #1d4ed8; }

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }
.app-main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; }
.app-content { padding: 24px 32px; max-width: 1400px; }

/* Sidebar */
.sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width);
    background: #fff; border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 1000;
}
.sidebar-brand { padding: 20px 20px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.brand-icon { width: 36px; height: 36px; background: var(--primary); color: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.brand-text { font-weight: 700; font-size: 18px; letter-spacing: -.3px; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 8px;
    color: #64748b; font-weight: 500; margin-bottom: 2px; transition: all .15s;
}
.nav-item:hover { background: #f1f5f9; color: var(--text); }
.nav-item.active { background: #eff6ff; color: var(--primary); }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--border); }

/* Topbar */
.topbar {
    height: var(--topbar-height); background: #fff; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 100;
}
.topbar-search { flex: 1; max-width: 480px; position: relative; }
.topbar-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 13px; }
.topbar-search input {
    width: 100%; padding: 9px 14px 9px 38px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--bg); font-size: 13px; outline: none; transition: border .15s;
}
.topbar-search input:focus { border-color: var(--primary); background: #fff; }
.search-results {
    position: absolute; top: 100%; left: 0; right: 0; background: #fff; border: 1px solid var(--border);
    border-radius: 10px; box-shadow: var(--shadow); margin-top: 4px; display: none; max-height: 320px; overflow-y: auto; z-index: 200;
}
.search-results.show { display: block; }
.search-result-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f1f5f9; }
.search-result-item:hover { background: #f8fafc; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.topbar-sprint, .topbar-clock { font-size: 13px; color: #64748b; }
.notif-badge { position: absolute; top: 2px; right: 2px; background: #ef4444; color: #fff; font-size: 10px; width: 16px; height: 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 24px; }

/* Cards & Stats */
.card { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.card-header { background: transparent; border-bottom: 1px solid var(--border); padding: 16px 20px; font-weight: 600; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; font-size: 16px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; line-height: 1; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 4px; font-weight: 500; }
.project-card, .idea-card, .report-card { transition: transform .15s, box-shadow .15s; }
.project-card:hover, .idea-card:hover, .report-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }

/* Page */
.page-title { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin: 0; }
.breadcrumb { font-size: 13px; }
.breadcrumb-item a { color: #64748b; }

/* Forms */
.form-control, .form-select { border-radius: 8px; border-color: var(--border); font-size: 14px; padding: 9px 14px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn { border-radius: 8px; font-weight: 500; font-size: 14px; padding: 8px 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* Task detail */
.task-meta dt { font-size: 12px; color: #64748b; margin-top: 12px; }
.task-meta dd { margin: 2px 0 0; font-weight: 500; }

/* Activity */
.activity-list { padding: 8px 0; }
.activity-item { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid #f1f5f9; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 6px; flex-shrink: 0; }

/* Auth */
.auth-body { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-container { width: 100%; max-width: 400px; padding: 20px; }
.auth-card { background: #fff; border-radius: var(--radius); padding: 40px 32px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.auth-logo { width: 48px; height: 48px; background: var(--primary); color: #fff; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }

/* Table */
.table { font-size: 14px; }
.table thead th { font-weight: 600; color: #64748b; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; border-bottom-width: 1px; padding: 12px 16px; }
.table td { padding: 14px 16px; vertical-align: middle; }

/* Badges */
.badge { font-weight: 500; font-size: 11px; padding: 4px 10px; border-radius: 6px; }

/* Responsive */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s; }
    .sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .app-content { padding: 16px; }
}

/* Floating action */
.fab { position: fixed; bottom: 24px; right: 24px; width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: #fff; border: none; box-shadow: 0 4px 12px rgba(37,99,235,.4); font-size: 20px; z-index: 50; cursor: pointer; }
.fab:hover { background: #1d4ed8; }

/* Work day timer */
.work-timer-panel { padding: 4px 0; }
.work-day-progress { height: 14px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.work-day-progress .progress-bar { border-radius: 999px; transition: width 1s linear; background: linear-gradient(90deg, #2563EB, #3b82f6); }
.work-day-progress .progress-bar.is-complete { background: linear-gradient(90deg, #16a34a, #22c55e); }
.work-day-progress .progress-bar.is-break { background: #94a3b8; animation: none !important; }
.work-timer-main { font-variant-numeric: tabular-nums; }
.work-day-timer-compact .topbar-timer-bar-wrap { width: 100px; }
.work-day-timer-compact .work-day-progress { height: 6px; }
.work-day-timer-compact .work-timer-count { font-variant-numeric: tabular-nums; color: var(--primary); }
.topbar-timer-inner { min-width: 180px; padding: 4px 10px; background: #f8fafc; border-radius: 8px; border: 1px solid var(--border); }

/* Log hours reminder blink */
@keyframes logHoursBlink {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.8); transform: scale(1); }
    50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); transform: scale(1.03); }
}
#btnLogHours.btn-log-hours-alert {
    animation: logHoursBlink 1s ease-in-out infinite;
    background: #f59e0b !important;
    border-color: #d97706 !important;
    color: #fff !important;
}
.break-progress .progress-bar { transition: width 1s linear; }
.logged-progress .progress-bar { transition: width 1s linear; background: linear-gradient(90deg, #0891b2, #06b6d4) !important; }

/* Today work panel */
.today-work-panel { --today-track: #e2e8f0; }
.today-empty-icon { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; background: #eff6ff; color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 28px; }
.today-attendance-badge, .today-session-badge { font-weight: 600; padding: 6px 10px; }
.today-pulse-dot { font-size: 8px; animation: todayPulse 1.5s ease-in-out infinite; }
@keyframes todayPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.today-time-track { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; padding: 16px; background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius); }
.today-time-node { text-align: center; }
.today-time-node.is-active .today-time-value { color: var(--primary); }
.today-time-value { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.today-time-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: #64748b; margin-top: 4px; }
.today-time-connector { position: relative; min-width: 120px; text-align: center; padding: 8px 0; color: var(--primary); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.today-time-connector::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 3px; background: var(--today-track); border-radius: 999px; z-index: 0; transform: translateY(-50%); }
.today-time-connector.is-live::before { background: linear-gradient(90deg, #2563EB 0%, #2563EB 50%, var(--today-track) 50%); background-size: 200% 100%; animation: todayTrackPulse 2s linear infinite; }
.today-time-connector.is-done::before { background: linear-gradient(90deg, #2563EB, #22c55e); }
.today-time-elapsed { position: relative; z-index: 1; background: #f8fafc; padding: 0 8px; display: inline-block; }
@keyframes todayTrackPulse { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.today-metrics { display: flex; flex-direction: column; gap: 18px; }
.today-metric { padding: 14px 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); }
.today-metric-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.today-metric-label { font-size: 13px; font-weight: 600; color: #334155; }
.today-metric-value { font-variant-numeric: tabular-nums; font-size: 14px; }
.today-metric-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.today-controls-wrap { flex-shrink: 0; }

/* Topbar attendance toolbar — always visible in header */
.topbar-attendance {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}
.topbar-attendance-status {
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #334155;
    padding-right: 8px;
    border-right: 1px solid var(--border);
}
.topbar-attendance-live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: todayPulse 1.5s ease-in-out infinite;
}
.topbar-attendance-time {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}
.topbar-attendance-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
}

/* Attendance panel — dashboard & attendance page */
.attendance-panel {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
}
.attendance-panel-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.attendance-panel-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.attendance-panel-title { font-weight: 700; font-size: 1.1rem; color: #0f172a; }
.attendance-panel-sub { font-size: 13px; color: #64748b; margin-top: 2px; }
.attendance-panel-live {
    margin-left: auto;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #059669;
    background: #ecfdf5;
    padding: 4px 10px;
    border-radius: 999px;
}
.attendance-panel--break .attendance-panel-live { color: #b45309; background: #fffbeb; }
.attendance-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 18px;
}
.attendance-done-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

/* Shared attendance buttons */
.attendance-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    padding: 8px 14px;
    white-space: nowrap;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.attendance-btn:active:not(:disabled) { transform: scale(0.98); }
.attendance-btn:disabled { opacity: 0.65; cursor: wait; }
.attendance-btn--clock-in {
    background: #16a34a;
    color: #fff;
}
.attendance-btn--clock-in:hover { background: #15803d; color: #fff; }
.attendance-btn--clock-out {
    background: #dc2626;
    color: #fff;
}
.attendance-btn--clock-out:hover { background: #b91c1c; color: #fff; }
.attendance-btn--break {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}
.attendance-btn--break:hover { background: #fde68a; color: #78350f; }
.attendance-btn--break-end {
    background: #f59e0b;
    color: #fff;
}
.attendance-btn--break-end:hover { background: #d97706; color: #fff; }
.attendance-btn--log {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.attendance-btn--log:hover { background: #dbeafe; color: #1e40af; }
.attendance-btn--log.btn-log-hours-alert {
    animation: logHoursBlink 1s ease-in-out infinite;
    background: #f59e0b !important;
    border-color: #d97706 !important;
    color: #fff !important;
}
.topbar-attendance .attendance-btn { padding: 6px 10px; font-size: 12px; }
.attendance-panel-actions .attendance-btn { padding: 10px 18px; font-size: 14px; }
.attendance-panel-actions .attendance-btn--clock-in { min-width: 140px; }
.attendance-schedule-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    padding: 10px 18px 14px;
    font-size: 12px;
    color: #64748b;
    border-top: 1px dashed #e2e8f0;
    background: #fafafa;
}
.attendance-schedule-strip strong { color: #334155; }

@media (max-width: 991px) {
    .topbar-attendance .attendance-btn span { display: none; }
    .topbar-attendance { padding: 4px 6px; gap: 4px; }
}
@media (max-width: 575px) {
    .attendance-panel-actions { flex-direction: column; }
    .attendance-panel-actions .attendance-btn { width: 100%; }
}
.today-time-connector.is-paused::before { background: #fcd34d; }
.today-time-connector.is-paused { color: #b45309; }
.today-time-connector.is-away::before { background: linear-gradient(90deg, #2563EB, var(--today-track)); }
.today-time-connector.is-away { color: #64748b; }
.today-time-sessions { display: block; position: relative; z-index: 1; font-size: 0.7rem; font-weight: 500; color: #94a3b8; margin-top: 2px; }
.today-work-panel--break .today-time-elapsed { background: #fffbeb; }

@media (max-width: 575px) {
    .attendance-dock-actions { flex-direction: column; }
    .attendance-dock-actions .attendance-btn { width: 100%; margin-left: 0 !important; }
    .attendance-dock-live-pill { display: none; }
}

@media (max-width: 575px) {
    .today-time-track { grid-template-columns: 1fr; gap: 8px; }
    .today-time-connector { min-width: 0; order: 3; }
    .today-time-connector::before { display: none; }
}

/* Entity discussion (project / sprint) */
.entity-discussion .discussion-item:last-child { border-bottom: none !important; margin-bottom: 0 !important; padding-bottom: 0 !important; }
.discussion-decision-item:last-child { border-bottom: none !important; }
.discussion-body { line-height: 1.5; }
.discussion-filter .btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.discussion-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15); }

/* Task import drafts */
.draft-card--saved { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.35); }
.draft-card--created { opacity: 0.85; }
.format-json-preview { font-size: 12px; max-height: 520px; overflow: auto; background: #f8fafc; }
.conversation-preview { white-space: pre-wrap; max-height: 240px; overflow: auto; }

/* Reports — live attendance indicator */
.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* Calendar */
.calendar-card { min-height: 620px; }
.calendar-card .fc { font-size: 0.875rem; }
.calendar-card .fc-toolbar-title { font-size: 1.15rem; font-weight: 600; }
.calendar-card .fc-button { box-shadow: none !important; }
.calendar-card .fc-event { cursor: pointer; border-radius: 4px; padding: 1px 2px; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.calendar-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; color: #64748b; }
.calendar-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
