:root {
    --bg: #F9F6F1;
    --bg-subtle: #F0EBE3;
    --surface: #FFFFFF;
    --border: #E3DDD5;
    --border-focus: #D97757;
    --text-primary: #1F1F1E;
    --text-secondary: #7A746E;
    --accent: #D97757;
    --accent-hover: #C4613C;
    --accent-light: rgba(217, 119, 87, 0.10);
    --accent-ring: rgba(217, 119, 87, 0.25);
    --danger: #C44040;
    --danger-light: rgba(196, 64, 64, 0.08);
    --success: #2E8555;
    --success-light: rgba(46, 133, 85, 0.08);
    --radius-xl: 20px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.08);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 32px;
}

/* ----------------------------------------------------------------
   Shared card
   ---------------------------------------------------------------- */

.glass-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
}

/* ----------------------------------------------------------------
   Control-center two-column layout (unchanged structure)
   ---------------------------------------------------------------- */

.app-shell {
    width: min(1400px, 100%);
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
}

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

.main-area {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ----------------------------------------------------------------
   Brand
   ---------------------------------------------------------------- */

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    border-radius: var(--radius-xl);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1.3rem;
}

.brand h1 {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.essentials-card,
.focus-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-list {
    list-style: none;
    display: grid;
    gap: 8px;
    color: var(--text-secondary);
    padding-left: 0;
}

.feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

.focus-card .hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ----------------------------------------------------------------
   Typography helpers
   ---------------------------------------------------------------- */

.label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    font-weight: 500;
}

.value {
    font-size: 1.25rem;
    font-weight: 600;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-subtle);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 10px;
    max-width: 500px;
    line-height: 1.6;
}

.text-muted {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ----------------------------------------------------------------
   Hero (control center)
   ---------------------------------------------------------------- */

.hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.hero-stats {
    display: flex;
    gap: 16px;
}

.hero-stats > div {
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    min-width: 140px;
    border: 1px solid var(--border);
}

/* ----------------------------------------------------------------
   Forms
   ---------------------------------------------------------------- */

.event-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-row {
    display: flex;
    gap: 16px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field span {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.field input,
.field select,
.field textarea {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

textarea {
    resize: vertical;
    font-family: inherit;
}

.flex-2 { flex: 2; }
.flex-1 { flex: 1; }

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timezone-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ----------------------------------------------------------------
   Buttons
   ---------------------------------------------------------------- */

.primary-button,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 11px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    font-size: 0.9rem;
}

.primary-button {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.primary-button:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md);
}

.ghost-button {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.ghost-button:hover {
    background: var(--bg-subtle);
    border-color: #C9C2BA;
}

/* ----------------------------------------------------------------
   Toggles (control center)
   ---------------------------------------------------------------- */

.toggle {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
}

.toggle input {
    display: none;
}

.slider {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #C9C2BA;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle input:checked + .slider {
    background: var(--accent);
}

.toggle input:checked + .slider::after {
    transform: translateX(20px);
}

.toggle strong {
    font-size: 0.92rem;
    color: var(--text-primary);
}

.toggle small {
    color: var(--text-secondary);
    display: block;
    margin-top: 2px;
}

/* ----------------------------------------------------------------
   Active event (old class for control-center compat)
   ---------------------------------------------------------------- */

.active-event {
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--accent-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(217, 119, 87, 0.2);
}

.active-event h3 { font-size: 1.05rem; }
.active-event p { color: var(--text-secondary); }

.active-timer {
    display: flex;
    align-items: center;
    gap: 14px;
}

.active-timer span {
    font-size: 1.4rem;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ----------------------------------------------------------------
   Event list / timeline (shared)
   ---------------------------------------------------------------- */

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.chart-card { min-height: 360px; }

.list-card {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header input[type="search"] {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.85rem;
}

.event-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    max-height: 480px;
    padding-right: 4px;
}

.event-item {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.event-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.event-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.event-times {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.event-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.event-actions .ghost-button {
    padding: 6px 12px;
    font-size: 0.82rem;
}

.event-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge-category {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-ai {
    background: var(--accent-light);
    color: var(--accent);
}

/* ----------------------------------------------------------------
   Categories (control center)
   ---------------------------------------------------------------- */

.category-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 0.9rem;
}

.category-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.category-form {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.category-form input[type="text"] {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.9rem;
    outline: none;
}

.category-form input[type="text"]:focus {
    border-color: var(--border-focus);
}

.roadmap-card ul {
    margin-top: 14px;
    display: grid;
    gap: 10px;
    color: var(--text-secondary);
}

.roadmap-card li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

/* ----------------------------------------------------------------
   Hidden / Modal
   ---------------------------------------------------------------- */

[hidden] {
    display: none !important;
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(31, 31, 30, 0.35);
    display: grid;
    place-items: center;
    z-index: 50;
    backdrop-filter: blur(4px);
}

.modal-content {
    width: min(480px, 90vw);
}

.modal-content header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

/* ----------------------------------------------------------------
   Control center layout
   ---------------------------------------------------------------- */

.control-shell {
    grid-template-columns: 300px 1fr;
}

.control-main { gap: 24px; }

.control-hero {
    display: flex;
    align-items: center;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.section-intro {
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.6;
    font-size: 0.9rem;
}

/* ----------------------------------------------------------------
   User bar (control center sidebar)
   ---------------------------------------------------------------- */

.user-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.user-bar .username {
    font-weight: 600;
    color: var(--text-primary);
}

.user-bar a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.82rem;
}

.user-bar a:hover {
    color: var(--accent);
}

/* ----------------------------------------------------------------
   Auth pages
   ---------------------------------------------------------------- */

.auth-container {
    display: grid;
    place-items: center;
    min-height: 100vh;
    width: 100%;
}

.auth-card {
    width: min(400px, 90vw);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-switch {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.auth-switch a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.flash-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flash {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
}

.flash-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(196, 64, 64, 0.2);
}

.flash-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(46, 133, 85, 0.2);
}

/* ----------------------------------------------------------------
   Home page – clean single-column layout
   ---------------------------------------------------------------- */

.home-wrapper {
    width: min(600px, 100%);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100vh;
}

.home-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.brand-mark.small {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.8rem;
}

.home-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.82rem;
}

.home-nav a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.home-nav a:hover {
    color: var(--accent);
}

.nav-sep {
    width: 1px;
    height: 14px;
    background: var(--border);
}

.nav-user {
    color: var(--text-primary);
    font-weight: 600;
}

/* Active event card (home) */

.active-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--accent-light);
    border-color: rgba(217, 119, 87, 0.22);
}

.active-card h2 {
    font-size: 1.1rem;
    margin: 4px 0 2px;
}

.active-card .active-timer span {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
}

.stop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(196, 64, 64, 0.3);
    background: var(--danger-light);
    color: var(--danger);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.15s;
}

.stop-btn:hover {
    background: rgba(196, 64, 64, 0.15);
    border-color: rgba(196, 64, 64, 0.5);
}

/* Record form (home) */

.record-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.record-form input[type="text"],
.record-form textarea,
.record-form select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.92rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.record-form input[type="text"]::placeholder,
.record-form textarea::placeholder {
    color: #B0AAA3;
}

.record-form input[type="text"]:focus,
.record-form textarea:focus,
.record-form select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.record-form textarea {
    resize: vertical;
}

.record-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.record-footer select {
    flex: 1;
    min-width: 0;
}

.inline-check {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    white-space: nowrap;
    cursor: pointer;
}

.inline-check input {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
}

/* Back link */

.back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: opacity 0.15s;
}

.back-link:hover {
    opacity: 0.7;
}

/* Settings hub */

.settings-hub {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.hub-card {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: inherit;
    padding: 20px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.hub-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.hub-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.hub-card h3 {
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.hub-card p {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

/* Sub-page content */

.sub-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tz-current {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

@media (max-width: 640px) {
    .settings-hub {
        grid-template-columns: 1fr;
    }
}

/* Daily summary */

.daily-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
}

.daily-date-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.date-picker {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.88rem;
    font-family: inherit;
    cursor: pointer;
}

.day-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.daily-total-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.daily-total-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.cat-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cat-tag {
    font-size: 0.75rem;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1.5px solid;
    color: var(--text-primary);
    background: var(--bg-subtle);
}

.daily-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.donut-wrap {
    max-width: 220px;
    margin: 0 auto;
}

.timeline-chart-wrap {
    min-height: 180px;
}

.daily-event-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
}

.daily-ev {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
}

.daily-ev-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.daily-ev-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.daily-ev-title {
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.daily-ev-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.daily-ev-dur {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent);
    white-space: nowrap;
}

@media (max-width: 640px) {
    .daily-charts {
        grid-template-columns: 1fr;
    }
}

/* Stats (home) */

.stats-section {
    display: flex;
    flex-direction: column;
}

.stats-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.sort-select {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
}

.sort-select:focus {
    border-color: var(--border-focus);
}

.stats-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
}

.stats-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.stats-title {
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-count {
    color: var(--text-secondary);
    font-size: 0.78rem;
    white-space: nowrap;
}

.stats-duration {
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--accent);
    white-space: nowrap;
    margin-left: 12px;
}

/* Timeline (home) */

.timeline-section {
    display: flex;
    flex-direction: column;
}

.timeline-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.timeline-head h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.search-input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 0.82rem;
    outline: none;
    width: 150px;
}

.search-input:focus {
    border-color: var(--border-focus);
}

.timeline-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

/* ----------------------------------------------------------------
   Scrollbar
   ---------------------------------------------------------------- */

::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */

@media (max-width: 1180px) {
    body { padding: 20px; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { order: 2; }
    .main-area { order: 1; }
    .analytics-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    body { padding: 10px; }

    .home-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .active-card {
        flex-direction: column;
        gap: 14px;
        text-align: center;
    }

    .active-card .active-timer {
        justify-content: center;
    }

    .record-footer {
        flex-wrap: wrap;
    }

    .record-footer select {
        flex: 1 1 100%;
    }

    .hero {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-stats {
        width: 100%;
        flex-direction: column;
    }

    .input-row {
        flex-direction: column;
    }

    .form-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}
