:root {
    --cms-primary: #3b5bfd;
    --cms-primary-dark: #2f49c4;
    --cms-primary-light: #eef2ff;
    --cms-bg: #f4f6fb;
    --cms-surface: #ffffff;
    --cms-border: #e4e9f2;
    --cms-text: #1f2430;
    --cms-text-muted: #697386;
    --cms-sidebar-bg: #161b2b;
    --cms-sidebar-text: #c9d2e0;
    --cms-sidebar-active-bg: rgba(255, 255, 255, 0.08);
    --cms-success: #16a34a;
    --cms-danger: #dc2626;
    --cms-warning: #d97706;
    --cms-radius: 10px;
    --cms-shadow: 0 1px 3px rgba(23, 27, 43, 0.06), 0 1px 2px rgba(23, 27, 43, 0.04);
}

html, body {
    height: 100%;
}

body {
    background-color: var(--cms-bg);
    color: var(--cms-text);
    font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Bengali", sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- App shell ---------- */

.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 264px;
    flex-shrink: 0;
    background: var(--cms-sidebar-bg);
    color: var(--cms-sidebar-text);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: #fff;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: var(--cms-primary);
    color: #fff;
    font-weight: 700;
}

.brand-name {
    font-weight: 600;
    font-size: 1rem;
}

.sidebar-nav {
    padding: 1rem 0.75rem;
}

.sidebar-section {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(201, 210, 224, 0.55);
    padding: 1rem 0.75rem 0.4rem;
}

.sidebar-link {
    display: block;
    padding: 0.55rem 0.75rem;
    margin-bottom: 0.125rem;
    border-radius: 8px;
    color: var(--cms-sidebar-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: var(--cms-sidebar-active-bg);
    color: #fff;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    background: var(--cms-surface);
    border-bottom: 1px solid var(--cms-border);
}

.topbar-title {
    font-weight: 600;
    font-size: 1.05rem;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.user-chip-avatar {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--cms-primary-light);
    color: var(--cms-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.user-chip-name {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.1;
}

.user-chip-tenant {
    font-size: 0.72rem;
    color: var(--cms-text-muted);
    line-height: 1.1;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.app-content-standalone {
    height: 100%;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.5rem;
}

/* ---------- Cards & page header ---------- */

.page-header {
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--cms-text-muted);
    margin-bottom: 0;
}

.card {
    border: 1px solid var(--cms-border);
    border-radius: var(--cms-radius);
    box-shadow: var(--cms-shadow);
}

.stat-card .stat-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cms-text-muted);
}

.stat-card .stat-value {
    font-size: 1.15rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* ---------- Auth page ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, var(--cms-primary-dark) 0%, var(--cms-primary) 60%, #5b78ff 100%);
    padding: 1.5rem;
}

.auth-wrap {
    width: 100%;
    max-width: 420px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
}

.auth-card {
    border: 0;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.auth-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    margin-top: 1.25rem;
}

/* ---------- Onboarding wizard ---------- */

.stepper {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--cms-surface);
    border: 1px solid var(--cms-border);
    border-radius: var(--cms-radius);
    box-shadow: var(--cms-shadow);
}

.stepper-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--cms-text-muted);
    font-size: 0.9rem;
}

.stepper-step span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cms-border);
    color: var(--cms-text-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.stepper-step.active {
    color: var(--cms-primary);
    font-weight: 600;
}

.stepper-step.active span {
    background: var(--cms-primary);
    color: #fff;
}

.stepper-step.done span {
    background: var(--cms-success);
    color: #fff;
}

.plan-card {
    display: block;
    padding: 0.9rem 1rem;
    border: 1px solid var(--cms-border);
    border-radius: var(--cms-radius);
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.plan-card:hover {
    border-color: var(--cms-primary);
}

.plan-card.selected {
    border-color: var(--cms-primary);
    box-shadow: 0 0 0 1px var(--cms-primary);
}

.plan-card .form-check-input {
    float: right;
}

.card-narrow {
    max-width: 760px;
}

.page-head {
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: 1.35rem;
    margin: 0;
}

/* ---------- Routine ---------- */

.routine-day {
    height: 100%;
}

.routine-day-empty {
    opacity: 0.6;
}

.routine-day .list-group-item {
    border-width: 0 0 1px 0;
}

/* ---------- Misc ---------- */

.coming-soon-card {
    max-width: 720px;
    margin: 0 auto;
}

@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 0 0 40px rgba(15, 23, 42, 0.4);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .app-content {
        padding: 1rem;
    }
}
.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
}

.notif-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    min-width: 260px;
    max-width: 360px;
    padding: 0.85rem 1rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-left: 4px solid var(--bs-primary, #0d6efd);
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    font-size: 0.875rem;
}

.notif-toast.show {
    opacity: 1;
    transform: translateY(0);
}
