/* ══════════════════════════════════════════════════════════════════════
   DBS TimeManager Theme — Main Stylesheet
   A clean, app-like interface for time tracking.
   ══════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Properties ───────────────────────────────────────────── */
:root {
    --tm-primary: #2563EB;
    --tm-primary-dark: #1E40AF;
    --tm-primary-light: #3B82F6;
    --tm-secondary: #64748B;
    --tm-success: #16A34A;
    --tm-success-light: #22C55E;
    --tm-warning: #D97706;
    --tm-warning-light: #F59E0B;
    --tm-danger: #DC2626;
    --tm-danger-light: #EF4444;

    --tm-bg-body: #F8FAFC;
    --tm-bg-card: #FFFFFF;
    --tm-bg-sidebar: #FFFFFF;
    --tm-bg-topbar: #1E293B;
    --tm-bg-hover: #F1F5F9;

    --tm-text-primary: #1E293B;
    --tm-text-secondary: #64748B;
    --tm-text-muted: #94A3B8;
    --tm-text-inverse: #FFFFFF;

    --tm-border: #E2E8F0;
    --tm-border-light: #F1F5F9;

    --tm-radius: 8px;
    --tm-radius-sm: 4px;
    --tm-radius-lg: 12px;

    --tm-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --tm-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --tm-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --tm-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

    --tm-topbar-height: 60px;
    --tm-sidebar-width: 260px;
    --tm-sidebar-collapsed: 0px;
    --tm-content-max: 1200px;

    --tm-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --tm-transition: 0.2s ease;
}

/* ── Base Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

body.tm-app {
    font-family: var(--tm-font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--tm-text-primary);
    background-color: var(--tm-bg-body);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Typography ──────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--tm-text-primary);
    margin-top: 0;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tm-text-secondary); }

a {
    color: var(--tm-primary);
    text-decoration: none;
    transition: color var(--tm-transition);
}

a:hover {
    color: var(--tm-primary-dark);
    text-decoration: underline;
}

/* ── Skip Link (Accessibility) ───────────────────────────────────────── */
.tm-skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--tm-primary);
    color: #fff;
    padding: 0.5rem 1rem;
    z-index: 10000;
    font-size: 0.875rem;
    border-radius: 0 0 var(--tm-radius-sm) 0;
    transition: top 0.2s;
}

.tm-skip-link:focus {
    top: 0;
    outline: 2px solid var(--tm-warning);
    text-decoration: none;
    color: #fff;
}

/* ══════════════════════════════════════════════════════════════════════
   TOP HEADER BAR — Uses Bootstrap .navbar-expand-lg component
   ══════════════════════════════════════════════════════════════════════ */

/* Outer wrapper — only used for spacing reference */
.tm-topbar {
    height: var(--tm-topbar-height);
}

/* The actual Bootstrap navbar bar */
.tm-navbar.navbar {
    background: var(--tm-bg-topbar) !important;
    min-height: var(--tm-topbar-height);
    padding-top: 0;
    padding-bottom: 0;
    z-index: 1030;
    box-shadow: var(--tm-shadow-md);
}

/* ── Logo / Brand ────────────────────────────────────────────────────── */
.tm-navbar .navbar-brand.tm-logo-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--tm-text-inverse) !important;
    font-size: 1.1rem;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.5rem 0;
    margin-right: 1rem;
}

.tm-navbar .navbar-brand.tm-logo-link:hover {
    color: var(--tm-primary-light) !important;
    text-decoration: none;
}

.tm-navbar .navbar-brand i {
    font-size: 1.25rem;
    color: var(--tm-primary-light);
}

.tm-logo-text {
    font-weight: 400;
}

.tm-logo-text strong {
    font-weight: 700;
}

/* ── Hamburger Toggle (Bootstrap default, styled for dark bg) ───────── */
.tm-navbar .navbar-toggler {
    border-color: rgba(255, 255, 255, 0.25);
    min-width: 44px;
    min-height: 44px;
}

.tm-navbar .navbar-toggler:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
}

/* ── Main Navigation (inside .navbar-collapse) ───────────────────────── */

/* Bootstrap .navbar-expand-lg automatically makes .navbar-nav horizontal
   on lg+ screens. We just need to style the links for our dark bar. */
.tm-navbar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem !important;
    border-radius: var(--tm-radius-sm);
    white-space: nowrap;
    transition: all var(--tm-transition);
}

.tm-navbar .navbar-nav .nav-link:hover,
.tm-navbar .navbar-nav .nav-link:focus-visible,
.tm-navbar .navbar-nav .nav-item.active > .nav-link {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.12);
}

.tm-navbar .navbar-nav .nav-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* Bootstrap 5 dropdown-toggle caret — hide the e107 <span class="caret"> */
.tm-navbar .caret {
    display: none;
}

/* Dropdown toggles — caret color (Bootstrap 5 ::after pseudo-element) */
.tm-navbar .dropdown-toggle::after {
    border-top-color: rgba(255, 255, 255, 0.6);
}

/* Dropdown menus within topbar */
.tm-navbar .navbar-nav .dropdown-menu {
    background: var(--tm-bg-topbar);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid var(--tm-primary);
    border-radius: var(--tm-radius-sm);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    padding: 0.25rem 0;
    min-width: 180px;
}

.tm-navbar .navbar-nav .dropdown-menu a,
.tm-navbar .navbar-nav .dropdown-menu .dropdown-item {
    color: rgba(255, 255, 255, 0.8) !important;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    background: transparent;
    text-decoration: none;
    display: block;
}

.tm-navbar .navbar-nav .dropdown-menu a:hover,
.tm-navbar .navbar-nav .dropdown-menu .dropdown-item:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
}

/* Show top-level dropdown on hover (desktop) */
@media (min-width: 992px) {
    .tm-navbar .navbar-nav .dropdown:hover > .dropdown-menu {
        display: block;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   DROPDOWN SUBMENU — Multi-level (bootstrap3 pattern)
   e107 core outputs <li class="dropdown-submenu lower"> for nested items
   ══════════════════════════════════════════════════════════════════════ */

.dropdown-submenu {
    position: relative;
}

/* Extra padding on the right for the arrow indicator */
.dropdown-submenu > a {
    padding-right: 19px;
}

/* Right-pointing caret arrow for submenu parents */
.dropdown-submenu > a:after {
    display: block;
    content: " ";
    float: right;
    width: 0;
    height: 0;
    border-color: transparent;
    border-style: solid;
    border-width: 5px 0 5px 5px;
    border-left-color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
    margin-right: -10px;
}

.dropdown-submenu:hover > a:after {
    border-left-color: #ffffff;
}

/* Position sub-dropdown to the right of parent */
.dropdown-submenu > .dropdown-menu {
    top: 0;
    left: 100%;
    margin-left: 5px;
    margin-top: -6px;
    border-radius: 0 6px 6px 6px;
}

/* Show submenu on hover OR when toggled open via JS */
.dropdown-submenu:hover > .dropdown-menu {
    display: block;
}

.dropdown-submenu.open > .dropdown-menu {
    display: block;
}

/* Submenu panels inherit dark topbar styling */
.tm-navbar .dropdown-submenu > .dropdown-menu {
    background: var(--tm-bg-topbar);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Nested sub-submenu arrow coloring */
.dropdown-submenu > .dropdown-menu > li.dropdown-submenu > a:after {
    border-left-color: rgba(255, 255, 255, 0.5);
}

.dropdown-submenu > .dropdown-menu > li.dropdown-submenu:hover > a:after {
    border-left-color: #ffffff;
}

/* If submenu overflows right edge, flip to the left */
.dropdown-submenu.pull-left > .dropdown-menu {
    left: -100%;
    margin-left: 10px;
    border-radius: 6px 0 6px 6px;
}

/* ── Submenu hover highlight (dark topbar) ───────────────────────── */
.tm-navbar .dropdown-submenu:hover > a {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff !important;
}

/* ── Accessibility — keyboard focus ─────────────────────────────── */
.dropdown-submenu > a:focus {
    outline: thin dotted;
    outline-offset: -2px;
}

.dropdown-menu > li > a:focus {
    background-color: rgba(255, 255, 255, 0.08);
    outline: none;
}

/* ── User Menu / SIGNIN ─────────────────────────────────────────────── */
.tm-topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 150px;
    justify-content: flex-end;
}

/* Force all links and text in the user area to be white on dark topbar */
.tm-topbar-user,
.tm-topbar-user a,
.tm-topbar-user .nav-link,
.tm-topbar-user .dropdown-toggle,
.tm-topbar-user span,
.tm-topbar-user button {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 0.8125rem;
    text-decoration: none;
}

.tm-topbar-user a,
.tm-topbar-user .nav-link,
.tm-topbar-user .dropdown-toggle {
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--tm-radius-sm);
    transition: all var(--tm-transition);
}

.tm-topbar-user a:hover,
.tm-topbar-user .nav-link:hover,
.tm-topbar-user .dropdown-toggle:hover,
.tm-topbar-user a:focus-visible {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

.tm-topbar-user a:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* User dropdown menu — light background for readability */
/* Align dropdown to right edge so it doesn't overflow off-screen */
.tm-topbar-user .dropdown-menu {
    background: var(--tm-bg-card);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    box-shadow: var(--tm-shadow-lg);
    min-width: 180px;
    right: 0;
    left: auto;
}

.tm-topbar-user .dropdown-menu a,
.tm-topbar-user .dropdown-menu .dropdown-item {
    color: var(--tm-text-primary) !important;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    background: transparent;
}

.tm-topbar-user .dropdown-menu a:hover,
.tm-topbar-user .dropdown-menu .dropdown-item:hover {
    color: var(--tm-primary) !important;
    background: var(--tm-bg-body);
}

/* User avatar image in topbar */
.tm-topbar-user img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* ── Topbar Clock Button (opens timer panel) ───────────────────────── */
.tm-topbar-clock-btn {
    color: rgba(255, 255, 255, 0.85) !important;
    font-size: 1.15rem;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    border-radius: var(--tm-radius-sm);
    transition: all var(--tm-transition);
    text-decoration: none !important;
    border: none;
    background: transparent;
}

.tm-topbar-clock-btn:hover,
.tm-topbar-clock-btn:focus-visible {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.15);
}

.tm-topbar-clock-btn:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* ══════════════════════════════════════════════════════════════════════
   OFFCANVAS PANELS
   ══════════════════════════════════════════════════════════════════════ */

/* Mobile drawer (left) */
.tm-offcanvas.offcanvas {
    width: 280px;
    background: var(--tm-bg-card);
}

/* Dark header matching topbar */
.tm-offcanvas-header {
    background: var(--tm-bg-topbar);
    color: var(--tm-text-inverse);
    padding: 1rem;
    border-bottom: 1px solid var(--tm-border);
}

/* ── Navigation links inside drawer ──────────────────────────────── */
.tm-drawer-nav {
    border-bottom: 1px solid var(--tm-border);
}

/* e107 {NAVIGATION} renders <ul class="nav navbar-nav"> */
.tm-drawer-nav .nav,
.tm-drawer-nav .navbar-nav {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0;
    flex-direction: column;
    display: flex;
}

.tm-drawer-nav .nav-item {
    list-style: none;
}

.tm-drawer-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: var(--tm-text-primary);
    font-size: 0.9375rem;
    text-decoration: none;
    border-left: 3px solid transparent;
    min-height: 44px;
}

.tm-drawer-nav .nav-link:hover,
.tm-drawer-nav .nav-item.active > .nav-link {
    background: var(--tm-bg-hover);
    border-left-color: var(--tm-primary);
    color: var(--tm-primary);
}

/* ── Drawer: All dropdown-menus hidden by default ──────────────── */
/* Our custom JS (initDrawerDropdowns) toggles .open — we do NOT rely
   on Bootstrap's .show class here so offcanvas event conflicts can't
   interfere. The !important beats Bootstrap's equal-specificity rule. */
.tm-drawer-nav .dropdown-menu {
    position: static !important;
    display: none !important;
    float: none !important;
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
    margin: 0;
    min-width: 0;
}

/* Top-level dropdown open */
.tm-drawer-nav .dropdown.open > .dropdown-menu {
    display: block !important;
}

/* ── Drawer: Nested submenu — click to toggle via .open class ──── */
.tm-drawer-nav .dropdown-submenu {
    position: static;
}

.tm-drawer-nav .dropdown-submenu > .dropdown-menu {
    position: static !important;
    display: none !important;
    margin-left: 0;
    margin-top: 0;
    border: none;
    background-color: rgba(0, 0, 0, 0.03);
    box-shadow: none;
}

.tm-drawer-nav .dropdown-submenu.open > .dropdown-menu {
    display: block !important;
}

/* ── Drawer: Hide the BS5 dropdown-toggle caret (down arrow) ──── */
.tm-drawer-nav .dropdown-toggle::after {
    display: none;
}

/* ── Drawer: Submenu right-arrow → rotate to down-arrow when open ── */
.tm-drawer-nav .dropdown-submenu > a:after {
    border-left-color: var(--tm-text-muted);
    margin-top: 7px;
}

.tm-drawer-nav .dropdown-submenu:hover > a:after {
    border-left-color: var(--tm-primary);
}

/* When open, rotate caret to point down */
.tm-drawer-nav .dropdown-submenu.open > a:after {
    border-width: 5px 5px 0 5px;
    border-left-color: transparent;
    border-top-color: var(--tm-primary);
    margin-top: 8px;
}

/* ── Drawer: Link styling per level ──────────────────────────────── */

/* Level 1 submenu items */
.tm-drawer-nav .dropdown-menu > li > a {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.25rem 0.65rem 2.5rem;
    font-size: 0.875rem;
    color: var(--tm-text-secondary);
    text-decoration: none;
    min-height: 40px;
    border-left: 3px solid transparent;
}

/* Level 2 submenu items */
.tm-drawer-nav .dropdown-menu .dropdown-menu > li > a {
    padding-left: 3.75rem;
    font-size: 0.8125rem;
    color: var(--tm-text-muted);
}

/* Level 3 submenu items */
.tm-drawer-nav .dropdown-menu .dropdown-menu .dropdown-menu > li > a {
    padding-left: 5rem;
    font-size: 0.75rem;
    color: var(--tm-text-muted);
}

/* Hover/active for all sublevel items in drawer */
.tm-drawer-nav .dropdown-menu a:hover {
    color: var(--tm-primary);
    background: var(--tm-bg-hover);
    border-left-color: var(--tm-primary);
}

/* Deeper level background tinting */
.tm-drawer-nav .dropdown-menu .dropdown-menu {
    background: rgba(0, 0, 0, 0.02);
}

.tm-drawer-nav .dropdown-menu .dropdown-menu .dropdown-menu {
    background: rgba(0, 0, 0, 0.04);
}

/* Hide e107's <span class="caret"> in drawer */
.tm-drawer-nav .caret {
    display: none;
}

/* ── User section inside drawer ──────────────────────────────────── */
.tm-drawer-user {
    border-bottom: 1px solid var(--tm-border);
    padding: 0.75rem 1.25rem;
}

.tm-drawer-user a {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    color: var(--tm-text-primary);
    text-decoration: none;
    font-size: 0.9375rem;
}

.tm-drawer-user a:hover {
    color: var(--tm-primary);
}

/* ── Quick-link section inside drawer ─────────────────────────────── */
.tm-drawer-extras {
    border-top: 1px solid var(--tm-border);
    margin-top: auto;
}

.tm-drawer-extras a,
.tm-drawer-extras .btn {
    border-color: var(--tm-border);
    color: var(--tm-text-primary);
}

.tm-drawer-extras a:hover,
.tm-drawer-extras .btn:hover {
    background: var(--tm-primary);
    border-color: var(--tm-primary);
    color: #fff;
}

/* ── Timer section inside left drawer ───────────────────────────── */
.tm-drawer-timer {
    border-top: 1px solid var(--tm-border);
    padding: 1rem;
    background: var(--tm-bg-body);
}

.tm-drawer-timer-title {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tm-text-muted);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

/* ══════════════════════════════════════════════════════════════════════
   LAYOUT STRUCTURE
   ══════════════════════════════════════════════════════════════════════ */

/* ── Main Content ────────────────────────────────────────────────────── */
.tm-main {
    min-height: calc(100vh - var(--tm-topbar-height));
    margin-top: var(--tm-topbar-height);
    padding: 1.5rem;
    max-width: var(--tm-content-max);
    margin-left: auto;
    margin-right: auto;
}

.tm-main-full {
    max-width: 100%;
    padding: 1.5rem 2rem;
}

/* Sidebar-block styling (used inside timer offcanvas panel) */
.tm-sidebar-block {
    padding: 0.75rem;
    border-radius: var(--tm-radius);
    border: 1px solid var(--tm-border-light);
}

.tm-sidebar-title {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tm-text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* ── Site Manager Layout ─────────────────────────────────────────────── */
.tm-main-sitemanager {
    max-width: 100%;
    padding: 1.5rem 2rem;
}

/* Right sidebar in sitemanager layout (Area 16) */
.tm-sm-sidebar {
    position: sticky;
    top: calc(var(--tm-topbar-height) + 1rem);
}

/* ── Breadcrumbs ─────────────────────────────────────────────────────── */
.tm-breadcrumb-bar {
    margin-bottom: 1rem;
}

.tm-breadcrumb-bar .breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 0.8125rem;
}

.tm-breadcrumb-bar .breadcrumb-item a {
    color: var(--tm-text-secondary);
}

.tm-breadcrumb-bar .breadcrumb-item.active {
    color: var(--tm-text-primary);
    font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════
   APP CARDS
   ══════════════════════════════════════════════════════════════════════ */

.tm-app-card {
    background: var(--tm-bg-card);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    box-shadow: var(--tm-shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--tm-transition);
}

.tm-app-card:hover {
    box-shadow: var(--tm-shadow);
}

.tm-app-card-header {
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    font-size: 0.9375rem;
    background: var(--tm-bg-body);
    border-bottom: 1px solid var(--tm-border);
}

.tm-app-card-body {
    padding: 1.25rem;
}

/* ══════════════════════════════════════════════════════════════════════
   SPLASH / LOGIN
   ══════════════════════════════════════════════════════════════════════ */

.tm-splash {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--tm-topbar-height));
    margin-top: var(--tm-topbar-height);
    padding: 2rem;
}

.tm-splash-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 2rem;
}

.tm-splash-card {
    background: var(--tm-bg-card);
    border-radius: var(--tm-radius-lg);
    box-shadow: var(--tm-shadow-lg);
    padding: 2.5rem;
    max-width: 420px;
    width: 100%;
}

.tm-splash-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--tm-primary-dark);
}

/* ══════════════════════════════════════════════════════════════════════
   HERO
   ══════════════════════════════════════════════════════════════════════ */

.tm-hero {
    background: linear-gradient(135deg, var(--tm-primary-dark), var(--tm-primary));
    color: #fff;
    padding: 2rem 0;
}

.tm-hero-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}

.tm-hero-body {
    font-size: 1rem;
    opacity: 0.9;
}

/* ══════════════════════════════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════════════════════════════ */

.tm-footer {
    background: var(--tm-bg-topbar);
    color: rgba(255, 255, 255, 0.7);
    padding: 2rem 0 1rem;
    margin-top: 2rem;
}

.tm-footer-inner {
    max-width: var(--tm-content-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.tm-footer-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.tm-footer-col {
    flex: 1;
    min-width: 200px;
}

.tm-footer-title {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tm-footer-block {
    font-size: 0.8125rem;
}

.tm-footer-block a {
    color: rgba(255, 255, 255, 0.7);
}

.tm-footer-block a:hover {
    color: #fff;
}

.tm-footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tm-footer-powered {
    opacity: 0.6;
}

/* ══════════════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════════════ */

.btn {
    font-family: var(--tm-font);
    font-weight: 500;
    border-radius: var(--tm-radius-sm);
    transition: all var(--tm-transition);
    min-height: 36px;
    font-size: 0.8125rem;
}

.btn:focus-visible {
    outline: 2px solid var(--tm-primary);
    outline-offset: 2px;
}

.btn-primary {
    background-color: var(--tm-primary);
    border-color: var(--tm-primary);
}

.btn-primary:hover {
    background-color: var(--tm-primary-dark);
    border-color: var(--tm-primary-dark);
}

.btn-success {
    background-color: var(--tm-success);
    border-color: var(--tm-success);
}

.btn-warning {
    background-color: var(--tm-warning);
    border-color: var(--tm-warning);
}

.btn-danger {
    background-color: var(--tm-danger);
    border-color: var(--tm-danger);
}

/* Touch targets on mobile */
@media (max-width: 767px) {
    .btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
    }

    .btn-lg {
        min-height: 56px;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════════════════════ */

.form-control, .form-select {
    font-family: var(--tm-font);
    font-size: 0.875rem;
    border-color: var(--tm-border);
    border-radius: var(--tm-radius-sm);
    transition: border-color var(--tm-transition), box-shadow var(--tm-transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--tm-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--tm-text-primary);
    margin-bottom: 0.25rem;
}

label {
    font-size: 0.8125rem;
}

/* ══════════════════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════════════════ */

.table {
    font-size: 0.875rem;
}

.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--tm-text-secondary);
    font-weight: 600;
    border-bottom: 2px solid var(--tm-border);
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

/* Responsive table wrapper — overflow-x scroll on small screens */
.tm-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ══════════════════════════════════════════════════════════════════════
   BADGES
   ══════════════════════════════════════════════════════════════════════ */

.badge {
    font-weight: 500;
    font-size: 0.6875rem;
    padding: 0.25em 0.6em;
    border-radius: var(--tm-radius-sm);
    letter-spacing: 0.02em;
}

/* ══════════════════════════════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════════════════════════════ */

.alert {
    border-radius: var(--tm-radius);
    font-size: 0.875rem;
    border: none;
}

.alert-success { background: #F0FDF4; color: #166534; border-left: 4px solid var(--tm-success); }
.alert-warning { background: #FFFBEB; color: #92400E; border-left: 4px solid var(--tm-warning); }
.alert-danger  { background: #FEF2F2; color: #991B1B; border-left: 4px solid var(--tm-danger); }
.alert-info    { background: #EFF6FF; color: #1E40AF; border-left: 4px solid var(--tm-primary); }

/* ══════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════════════ */

.tm-toast-container {
    position: fixed;
    top: calc(var(--tm-topbar-height) + 1rem);
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 380px;
    width: 100%;
    pointer-events: none;
}

.tm-toast {
    background: var(--tm-bg-card);
    border-radius: var(--tm-radius);
    box-shadow: var(--tm-shadow-lg);
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    pointer-events: auto;
    animation: tmToastIn 0.3s ease;
    border-left: 4px solid var(--tm-primary);
    font-size: 0.875rem;
}

.tm-toast.tm-toast-out {
    animation: tmToastOut 0.3s ease forwards;
}

.tm-toast-success { border-left-color: var(--tm-success); }
.tm-toast-warning { border-left-color: var(--tm-warning); }
.tm-toast-error   { border-left-color: var(--tm-danger); }
.tm-toast-info    { border-left-color: var(--tm-primary); }

.tm-toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.tm-toast-success .tm-toast-icon { color: var(--tm-success); }
.tm-toast-warning .tm-toast-icon { color: var(--tm-warning); }
.tm-toast-error .tm-toast-icon   { color: var(--tm-danger); }
.tm-toast-info .tm-toast-icon    { color: var(--tm-primary); }

.tm-toast-body {
    flex: 1;
    min-width: 0;
}

.tm-toast-close {
    background: none;
    border: none;
    color: var(--tm-text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    flex-shrink: 0;
    min-width: 24px;
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tm-toast-close:hover {
    color: var(--tm-text-primary);
}

@keyframes tmToastIn {
    from { opacity: 0; transform: translateX(100%); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes tmToastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(100%); }
}

/* ══════════════════════════════════════════════════════════════════════
   LOADING & EMPTY STATES
   ══════════════════════════════════════════════════════════════════════ */

/* CSS-only spinner */
.tm-spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--tm-border);
    border-top-color: var(--tm-primary);
    border-radius: 50%;
    animation: tmSpin 0.6s linear infinite;
}

.tm-spinner-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 2px;
}

@keyframes tmSpin {
    to { transform: rotate(360deg); }
}

/* Success flash on save */
.tm-flash-success {
    animation: tmFlashGreen 1s ease;
}

@keyframes tmFlashGreen {
    0%   { background-color: #D1FAE5; }
    100% { background-color: transparent; }
}

/* Empty state */
.tm-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--tm-text-muted);
}

.tm-empty-state i {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.tm-empty-state p {
    font-size: 0.9375rem;
    margin-bottom: 1rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Loading overlay */
.tm-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--tm-radius);
}

/* Button loading state */
.btn.tm-btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn.tm-btn-loading::after {
    content: '';
    display: inline-block;
    width: 0.875rem;
    height: 0.875rem;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tmSpin 0.6s linear infinite;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════════════════
   FOCUS & ACCESSIBILITY
   ══════════════════════════════════════════════════════════════════════ */

:focus-visible {
    outline: 2px solid var(--tm-primary);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--tm-primary);
    outline-offset: 2px;
}

/* Screen-reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET
   ══════════════════════════════════════════════════════════════════════ */

@media (max-width: 991px) {
    .tm-main, .tm-main-full {
        padding: 1rem;
    }
}

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE
   ══════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    :root {
        --tm-topbar-height: 56px;
    }

    .tm-topbar-brand {
        min-width: auto;
    }

    .tm-topbar-user {
        min-width: auto;
    }

    .tm-main, .tm-main-full {
        padding: 0.75rem;
    }

    .tm-app-card-body {
        padding: 1rem;
    }

    /* Toast center on mobile */
    .tm-toast-container {
        right: 0.5rem;
        left: 0.5rem;
        max-width: 100%;
    }

    @keyframes tmToastIn {
        from { opacity: 0; transform: translateY(-20px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    @keyframes tmToastOut {
        from { opacity: 1; transform: translateY(0); }
        to   { opacity: 0; transform: translateY(-20px); }
    }

    .tm-splash {
        padding: 1rem;
    }

    /* Horizontal scroll for tables */
    .table-responsive,
    .tm-table-responsive {
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 575px) {
    .tm-logo-text {
        display: none;
    }

    .tm-topbar-brand {
        min-width: auto;
    }

    .tm-footer-row {
        flex-direction: column;
    }

    .tm-footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* ── Sidebar Timer Widget ──────────────────────────────────────────── */

.tm-sidebar-widget {
    padding: 1rem;
}

.tm-widget-timer-display {
    text-align: center;
    padding: 0.75rem 0;
}

.tm-widget-clock {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--tm-text-primary);
    letter-spacing: 0.02em;
    line-height: 1.2;
}

[data-timer-active="1"] .tm-widget-clock {
    color: var(--tm-primary);
}

.tm-widget-timer-label {
    font-size: 0.8rem;
    color: var(--tm-text-secondary);
    margin-top: 0.25rem;
}

[data-timer-active="1"] .tm-widget-timer-label {
    color: var(--tm-primary);
    font-weight: 500;
}

.tm-widget-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.tm-widget-btn {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
}

.tm-widget-divider {
    border-top: 1px solid var(--tm-border);
    margin: 0.75rem 0;
}

.tm-widget-label-sm {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tm-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.tm-widget-project-section .form-select-sm {
    font-size: 0.8rem;
}

dl.tm-widget-stats {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0;
}

.tm-widget-stat dd {
    margin-bottom: 0;
}

.tm-widget-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.tm-widget-stat-label {
    font-size: 0.7rem;
    color: var(--tm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tm-widget-stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tm-text-primary);
    font-variant-numeric: tabular-nums;
}




/* ─────────────────────────────────────────────────────────────────────────────
   DBS TimeManager — Mobile Drawer Navigation styles
   Add to: e107_themes/timemanager_theme/css/style.css
   ───────────────────────────────────────────────────────────────────────────── */

/* Root list */
.tm-drawer-nav {
    margin: 0;
    padding: 0;
}

/* Each top-level row */
.tm-drawer-item {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.tm-drawer-item:last-child {
    border-bottom: none;
}

/* Wrapper that holds the link + toggle button side by side */
.tm-drawer-parent {
    display: flex;
    align-items: stretch;
}

/* The navigable link — takes all remaining width */
.tm-drawer-link {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
}

.tm-drawer-link:hover,
.tm-drawer-link:focus {
    background-color: rgba(0, 0, 0, 0.05);
    color: inherit;
    text-decoration: none;
}

.tm-drawer-link.active {
    color: var(--bs-primary, #0d6efd);
    font-weight: 600;
}

/* The collapse toggle button — sits to the right of the link */
.tm-drawer-toggle {
    flex: 0 0 auto;
    width: 44px;
    background: none;
    border: none;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: inherit;
    transition: background-color 0.15s ease;
}

.tm-drawer-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Chevron arrow — rotates when expanded */
.tm-drawer-chevron {
    display: inline-block;
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 0.2s ease;
    transform: rotate(0deg);
}

/* When the collapse is open the button loses .collapsed — rotate the arrow */
.tm-drawer-toggle:not(.collapsed) .tm-drawer-chevron {
    transform: rotate(90deg);
}

/* Sub-menu list (first level) */
.tm-drawer-submenu {
    list-style: none;
    margin: 0;
    padding: 0;
    background-color: rgba(0, 0, 0, 0.03);
}

/* Sub-menu items */
.tm-drawer-subitem {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.tm-drawer-sublink {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem 0.6rem 2rem;  /* indent to show hierarchy */
    color: inherit;
    text-decoration: none;
    font-size: 0.9rem;
}

.tm-drawer-sublink:hover,
.tm-drawer-sublink:focus {
    background-color: rgba(0, 0, 0, 0.05);
    color: inherit;
    text-decoration: none;
}

.tm-drawer-sublink.active {
    color: var(--bs-primary, #0d6efd);
    font-weight: 600;
}

/* Third-level (nested) — extra indent */
.tm-drawer-submenu--nested .tm-drawer-sublink {
    padding-left: 3rem;
}