/* =====================================================================
   layout.css - app shell: sidebar, top bar, page area, sign-in screen.
   ===================================================================== */

.tm-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* ---- Sidebar ---- */
.tm-sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; gap: 1.25rem;
    padding: 1.25rem 1rem;
    background: var(--tm-surface);
    border-right: 1px solid var(--tm-border);
}
.tm-brand { display: flex; align-items: center; gap: .6rem; padding: 0 .5rem; color: var(--tm-text); text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.tm-brand img { width: 28px; height: 28px; }
.tm-nav { display: flex; flex-direction: column; gap: .15rem; }
.tm-nav-link {
    display: flex; align-items: center; gap: .7rem;
    padding: .55rem .75rem; border-radius: var(--tm-radius-sm);
    color: var(--tm-muted); text-decoration: none; font-weight: 500;
    transition: background var(--tm-fast) var(--tm-ease), color var(--tm-fast) var(--tm-ease);
}
.tm-nav-link:hover { background: var(--tm-surface-2); color: var(--tm-text); }
.tm-nav-link.active { background: var(--tm-primary-soft); color: var(--tm-primary); }

/* ---- Main column ---- */
.tm-main { min-width: 0; display: flex; flex-direction: column; }
.tm-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .75rem 1.75rem;
    background: color-mix(in srgb, var(--tm-bg) 85%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--tm-border);
}
.tm-topbar-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.tm-content { padding: 2rem 1.75rem 3rem; max-width: 1280px; width: 100%; margin: 0 auto; }

.tm-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: var(--tm-radius-sm);
    border: 1px solid var(--tm-border); background: var(--tm-surface); color: var(--tm-text);
    transition: background var(--tm-fast) var(--tm-ease), transform var(--tm-fast) var(--tm-ease);
}
.tm-icon-btn:hover { background: var(--tm-surface-2); }
.tm-icon-btn:active { transform: scale(.96); }

/* Theme toggle shows the icon for the mode you would switch TO */
.tm-icon-sun { display: none; }
:root[data-theme="dark"] .tm-icon-sun { display: inline-block; }
:root[data-theme="dark"] .tm-icon-moon { display: none; }

.tm-menu-toggle { display: none; }

/* ---- Skip link for keyboard users ---- */
.tm-skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--tm-primary); color: var(--tm-on-primary); padding: .5rem 1rem; border-radius: 0 0 var(--tm-radius-sm) 0; }
.tm-skip:focus { left: 0; }

/* ---- Sign-in screen ---- */
.tm-auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.tm-auth-card { width: 100%; max-width: 400px; }
.tm-auth-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1.5rem; font-weight: 700; font-size: 1.25rem; }
.tm-auth-brand img { width: 36px; height: 36px; }

/* ---- Small screens: sidebar becomes a slide-in drawer ---- */
@media (max-width: 991.98px) {
    .tm-shell { grid-template-columns: 1fr; }
    .tm-sidebar {
        position: fixed; z-index: 40; width: 260px; left: 0;
        transform: translateX(-100%);
        transition: transform var(--tm-med) var(--tm-ease);
    }
    .tm-sidebar.open { transform: translateX(0); box-shadow: var(--tm-shadow-lift); }
    .tm-menu-toggle { display: inline-flex; }
    .tm-topbar, .tm-content { padding-left: 1rem; padding-right: 1rem; }
}
