:root {
    --bg: #ffffff;
    --bg-elev: #f7f7f7;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #3aa981; /* muted green */
    --border: #e5e7eb;
}

html[data-theme="dark"] {
    --bg: #0b0f14;
    --bg-elev: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #3aa981;
    --border: #1f2937;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 56px 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar main";
    min-height: 100vh;
}

.sidebar {
    grid-area: sidebar;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 16px 12px;
    border-right: 1px solid var(--border);
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.brand { font-weight: 700; letter-spacing: 0.4px; color: #47CBA5; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    border: 1px solid transparent;
}
.nav-link[aria-current="page"], .nav-link.active {
    background: var(--bg-elev);
    border-color: var(--border);
}
.mini-timer {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.icon-btn {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 10px;
    padding: 6px 10px;
    cursor: pointer;
}
.icon-btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
.flex-spacer { flex: 1; }
.top-timer { text-decoration: none; color: var(--text); }

main#app {
    grid-area: main;
    padding: 16px;
    animation: fadeIn 180ms ease-in;
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* Utilities */
.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
}
.btn.icon { padding: 8px 10px; display:inline-flex; align-items:center; justify-content:center; }
.btn.icon i { font-size: 20px; line-height: 1; }

/* Responsive */
@media (max-width: 768px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-rows: 56px auto 56px;
        grid-template-areas:
            "topbar"
            "main"
            "sidebar";
    }
    .sidebar {
        grid-area: sidebar;
        position: fixed;
        inset: 56px 0 0 auto;
        width: 80%;
        max-width: 320px;
        height: calc(100vh - 56px);
        transform: translateX(100%);
        transition: transform .2s ease;
        z-index: 1001;
        background: var(--bg);
        border-left: 1px solid var(--border);
        border-right: none;
    }
    .sidebar.open { transform: translateX(0); }
    .backdrop { position: fixed; inset: 56px 0 0 0; background: rgba(0,0,0,.3); z-index: 1000; }
    .nav { flex-direction: column; overflow: auto; }
    .nav-link { padding: 12px; }
    .mini-timer { margin-top: auto; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}


